uawdijnntqw1x1x1
IP : 216.73.216.26
Hostname : server.wtmmart.in
Kernel : Linux server.wtmmart.in 4.18.0-553.45.1.el8_10.x86_64 #1 SMP Wed Mar 19 09:44:46 EDT 2025 x86_64
Disable Function : exec,passthru,shell_exec,system
OS : Linux
PATH:
/
home2
/
wtmwscom
/
www
/
post
/
scripts
/
OutSystems.js
/
/
var requirejs,require,define;!function(global){function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var n;for(n=0;n<e.length&&(!e[n]||!t(e[n],n,e));n+=1);}}function eachReverse(e,t){if(e){var n;for(n=e.length-1;n>-1&&(!e[n]||!t(e[n],n,e));n-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var n;for(n in e)if(hasProp(e,n)&&t(e[n],n))break}function mixin(e,t,n,r){return t&&eachProp(t,function(t,i){(n||!hasProp(e,i))&&(!r||"object"!=typeof t||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[i]=t:(e[i]||(e[i]={}),mixin(e[i],t,n,r)))}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,n,r){var i=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return i.requireType=e,i.requireModules=r,n&&(i.originalError=n),i}function newContext(e){function t(e){var t,n;for(t=0;t<e.length;t++)if(n=e[t],"."===n)e.splice(t,1),t-=1;else if(".."===n){if(0===t||1===t&&".."===e[2]||".."===e[t-1])continue;t>0&&(e.splice(t-1,2),t-=2)}}function n(e,n,r){var i,o,a,s,u,c,l,f,d,p,h,g,m=n&&n.split("/"),y=D.map,v=y&&y["*"];if(e&&(e=e.split("/"),l=e.length-1,D.nodeIdCompat&&jsSuffixRegExp.test(e[l])&&(e[l]=e[l].replace(jsSuffixRegExp,"")),"."===e[0].charAt(0)&&m&&(g=m.slice(0,m.length-1),e=g.concat(e)),t(e),e=e.join("/")),r&&y&&(m||v)){a=e.split("/");e:for(s=a.length;s>0;s-=1){if(c=a.slice(0,s).join("/"),m)for(u=m.length;u>0;u-=1)if(o=getOwn(y,m.slice(0,u).join("/")),o&&(o=getOwn(o,c))){f=o,d=s;break e}!p&&v&&getOwn(v,c)&&(p=getOwn(v,c),h=s)}!f&&p&&(f=p,d=h),f&&(a.splice(0,d,f),e=a.join("/"))}return i=getOwn(D.pkgs,e),i?i:e}function r(e){isBrowser&&each(scripts(),function(t){return t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===T.contextName?(t.parentNode.removeChild(t),!0):void 0})}function i(e){var t=getOwn(D.paths,e);return t&&isArray(t)&&t.length>1?(t.shift(),T.require.undef(e),T.makeRequire(null,{skipMap:!0})([e]),!0):void 0}function o(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function a(e,t,r,i){var a,s,u,c,l=null,f=t?t.name:null,d=e,p=!0,h="";return e||(p=!1,e="_@r"+(O+=1)),c=o(e),l=c[0],e=c[1],l&&(l=n(l,f,i),s=getOwn(A,l)),e&&(l?h=s&&s.normalize?s.normalize(e,function(e){return n(e,f,i)}):-1===e.indexOf("!")?n(e,f,i):e:(h=n(e,f,i),c=o(h),l=c[0],h=c[1],r=!0,a=T.nameToUrl(h))),u=!l||s||r?"":"_unnormalized"+(R+=1),{prefix:l,name:h,parentMap:t,unnormalized:!!u,url:a,originalName:d,isDefine:p,id:(l?l+"!"+h:h)+u}}function s(e){var t=e.id,n=getOwn(S,t);return n||(n=S[t]=new T.Module(e)),n}function u(e,t,n){var r=e.id,i=getOwn(S,r);!hasProp(A,r)||i&&!i.defineEmitComplete?(i=s(e),i.error&&"error"===t?n(i.error):i.on(t,n)):"defined"===t&&n(A[r])}function c(e,t){var n=e.requireModules,r=!1;t?t(e):(each(n,function(t){var n=getOwn(S,t);n&&(n.error=e,n.events.error&&(r=!0,n.emit("error",e)))}),r||req.onError(e))}function l(){globalDefQueue.length&&(each(globalDefQueue,function(e){var t=e[0];"string"==typeof t&&(T.defQueueMap[t]=!0),x.push(e)}),globalDefQueue=[])}function f(e){delete S[e],delete I[e]}function d(e,t,n){var r=e.map.id;e.error?e.emit("error",e.error):(t[r]=!0,each(e.depMaps,function(r,i){var o=r.id,a=getOwn(S,o);!a||e.depMatched[i]||n[o]||(getOwn(t,o)?(e.defineDep(i,A[o]),e.check()):d(a,t,n))}),n[r]=!0)}function p(){var e,t,n=1e3*D.waitSeconds,o=n&&T.startTime+n<(new Date).getTime(),a=[],s=[],u=!1,l=!0;if(!v){if(v=!0,eachProp(I,function(e){var n=e.map,c=n.id;if(e.enabled&&(n.isDefine||s.push(e),!e.error))if(!e.inited&&o)i(c)?(t=!0,u=!0):(a.push(c),r(c));else if(!e.inited&&e.fetched&&n.isDefine&&(u=!0,!n.prefix))return l=!1}),o&&a.length)return e=makeError("timeout","Load timeout for modules: "+a,null,a),e.contextName=T.contextName,c(e);l&&each(s,function(e){d(e,{},{})}),o&&!t||!u||!isBrowser&&!isWebWorker||w||(w=setTimeout(function(){w=0,p()},50)),v=!1}}function h(e){hasProp(A,e[0])||s(a(e[0],null,!0)).init(e[1],e[2])}function g(e,t,n,r){e.detachEvent&&!isOpera?r&&e.detachEvent(r,t):e.removeEventListener(n,t,!1)}function m(e){var t=e.currentTarget||e.srcElement;return g(t,T.onScriptLoad,"load","onreadystatechange"),g(t,T.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function y(){var e;for(l();x.length;){if(e=x.shift(),null===e[0])return c(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));h(e)}T.defQueueMap={}}var v,b,T,E,w,D={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},S={},I={},_={},x=[],A={},N={},C={},O=1,R=1;return E={require:function(e){return e.require?e.require:e.require=T.makeRequire(e.map)},exports:function(e){return e.usingExports=!0,e.map.isDefine?e.exports?A[e.map.id]=e.exports:e.exports=A[e.map.id]={}:void 0},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(D.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},b=function(e){this.events=getOwn(_,e.id)||{},this.map=e,this.shim=getOwn(D.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},b.prototype={init:function(e,t,n,r){r=r||{},this.inited||(this.factory=t,n?this.on("error",n):this.events.error&&(n=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=r.ignore,r.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,T.startTime=(new Date).getTime();var e=this.map;return this.shim?void T.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()})):e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;N[e]||(N[e]=!0,T.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,n=this.map.id,r=this.depExports,i=this.exports,o=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(o)){try{i=T.execCb(n,o,r,i)}catch(a){e=a}if(this.map.isDefine&&void 0===i&&(t=this.module,t?i=t.exports:this.usingExports&&(i=this.exports)),e){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",c(this.error=e);"undefined"!=typeof console&&console.error?console.error(e):req.onError(e)}}else i=o;if(this.exports=i,this.map.isDefine&&!this.ignore&&(A[n]=i,req.onResourceLoad)){var s=[];each(this.depMaps,function(e){s.push(e.normalizedMap||e)}),req.onResourceLoad(T,this.map,s)}f(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(T.defQueueMap,n)||this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,r=a(e.prefix);this.depMaps.push(r),u(r,"defined",bind(this,function(r){var i,o,l,d=getOwn(C,this.map.id),p=this.map.name,h=this.map.parentMap?this.map.parentMap.name:null,g=T.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(r.normalize&&(p=r.normalize(p,function(e){return n(e,h,!0)})||""),o=a(e.prefix+"!"+p,this.map.parentMap),u(o,"defined",bind(this,function(e){this.map.normalizedMap=o,this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),l=getOwn(S,o.id),void(l&&(this.depMaps.push(o),this.events.error&&l.on("error",bind(this,function(e){this.emit("error",e)})),l.enable()))):d?(this.map.url=T.nameToUrl(d),void this.load()):(i=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),i.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(S,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&f(e.map.id)}),c(e)}),i.fromText=bind(this,function(n,r){var o=e.name,u=a(o),l=useInteractive;r&&(n=r),l&&(useInteractive=!1),s(u),hasProp(D.config,t)&&(D.config[o]=D.config[t]);try{req.exec(n)}catch(f){return c(makeError("fromtexteval","fromText eval for "+t+" failed: "+f,f,[t]))}l&&(useInteractive=!0),this.depMaps.push(u),T.completeLoad(o),g([o],i)}),void r.load(e.name,g,i,D))})),T.enable(r,this),this.pluginMaps[r.id]=r},enable:function(){I[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var n,r,i;if("string"==typeof e){if(e=a(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,i=getOwn(E,e.id))return void(this.depExports[t]=i(this));this.depCount+=1,u(e,"defined",bind(this,function(e){this.undefed||(this.defineDep(t,e),this.check())})),this.errback?u(e,"error",bind(this,this.errback)):this.events.error&&u(e,"error",bind(this,function(e){this.emit("error",e)}))}n=e.id,r=S[n],hasProp(E,n)||!r||r.enabled||T.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(S,e.id);t&&!t.enabled&&T.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var n=this.events[e];n||(n=this.events[e]=[]),n.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},T={config:D,contextName:e,registry:S,defined:A,urlFetched:N,defQueue:x,defQueueMap:{},Module:b,makeModuleMap:a,nextTick:req.nextTick,onError:c,configure:function(e){e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/");var t=D.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(D[t]||(D[t]={}),mixin(D[t],e,!0,!0)):D[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(C[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,n){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=T.makeShimExports(e)),t[n]=e}),D.shim=t),e.packages&&each(e.packages,function(e){var t,n;e="string"==typeof e?{name:e}:e,n=e.name,t=e.location,t&&(D.paths[n]=e.location),D.pkgs[n]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(S,function(e,t){e.inited||e.map.unnormalized||(e.map=a(t,null,!0))}),(e.deps||e.callback)&&T.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,i){function o(n,r,u){var l,f,d;return i.enableBuildCallback&&r&&isFunction(r)&&(r.__requireJsBuild=!0),"string"==typeof n?isFunction(r)?c(makeError("requireargs","Invalid require call"),u):t&&hasProp(E,n)?E[n](S[t.id]):req.get?req.get(T,n,t,o):(f=a(n,t,!1,!0),l=f.id,hasProp(A,l)?A[l]:c(makeError("notloaded",'Module name "'+l+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(y(),T.nextTick(function(){y(),d=s(a(null,t)),d.skipMap=i.skipMap,d.init(n,r,u,{enabled:!0}),p()}),o)}return i=i||{},mixin(o,{isBrowser:isBrowser,toUrl:function(e){var r,i=e.lastIndexOf("."),o=e.split("/")[0],a="."===o||".."===o;return-1!==i&&(!a||i>1)&&(r=e.substring(i,e.length),e=e.substring(0,i)),T.nameToUrl(n(e,t&&t.id,!0),r,!0)},defined:function(e){return hasProp(A,a(e,t,!1,!0).id)},specified:function(e){return e=a(e,t,!1,!0).id,hasProp(A,e)||hasProp(S,e)}}),t||(o.undef=function(e){l();var n=a(e,t,!0),i=getOwn(S,e);i.undefed=!0,r(e),delete A[e],delete N[n.url],delete _[e],eachReverse(x,function(t,n){t[0]===e&&x.splice(n,1)}),delete T.defQueueMap[e],i&&(i.events.defined&&(_[e]=i.events),f(e))}),o},enable:function(e){var t=getOwn(S,e.id);t&&s(e).enable()},completeLoad:function(e){var t,n,r,o=getOwn(D.shim,e)||{},a=o.exports;for(l();x.length;){if(n=x.shift(),null===n[0]){if(n[0]=e,t)break;t=!0}else n[0]===e&&(t=!0);h(n)}if(T.defQueueMap={},r=getOwn(S,e),!t&&!hasProp(A,e)&&r&&!r.inited){if(!(!D.enforceDefine||a&&getGlobal(a)))return i(e)?void 0:c(makeError("nodefine","No define call for "+e,null,[e]));h([e,o.deps||[],o.exportsFn])}p()},nameToUrl:function(e,t,n){var r,i,o,a,s,u,c,l=getOwn(D.pkgs,e);if(l&&(e=l),c=getOwn(C,e))return T.nameToUrl(c,t,n);if(req.jsExtRegExp.test(e))s=e+(t||"");else{for(r=D.paths,i=e.split("/"),o=i.length;o>0;o-=1)if(a=i.slice(0,o).join("/"),u=getOwn(r,a)){isArray(u)&&(u=u[0]),i.splice(0,o,u);break}s=i.join("/"),s+=t||(/^data\:|\?/.test(s)||n?"":".js"),s=("/"===s.charAt(0)||s.match(/^[\w\+\.\-]+:/)?"":D.baseUrl)+s}return D.urlArgs?s+((-1===s.indexOf("?")?"?":"&")+D.urlArgs):s},load:function(e,t){req.load(T,e,t)},execCb:function(e,t,n,r){return t.apply(r,n)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=m(e);T.completeLoad(t.id)}},onScriptError:function(e){var t=m(e);if(!i(t.id)){var n=[];return eachProp(S,function(e,r){0!==r.indexOf("_@r")&&each(e.depMaps,function(e){return e.id===t.id&&n.push(r),!0})}),c(makeError("scripterror",'Script error for "'+t.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[t.id]))}}},T.require=T.makeRequire(),T}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(e){return"interactive"===e.readyState?interactiveScript=e:void 0}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.22",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if("undefined"==typeof define){if("undefined"!=typeof requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}"undefined"==typeof require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,n,r){var i,o,a=defContextName;return isArray(e)||"string"==typeof e||(o=e,isArray(t)?(e=t,t=n,n=r):e=[]),o&&o.context&&(a=o.context),i=getOwn(contexts,a),i||(i=contexts[a]=req.s.newContext(a)),o&&i.configure(o),i.require(e,t,n)},req.config=function(e){return req(e)},req.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,n){var r=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return r.type=e.scriptType||"text/javascript",r.charset="utf-8",r.async=!0,r},req.load=function(e,t,n){var r,i=e&&e.config||{};if(isBrowser)return r=req.createNode(i,t,n),i.onNodeCreated&&i.onNodeCreated(r,i,t,n),r.setAttribute("data-requirecontext",e.contextName),r.setAttribute("data-requiremodule",t),!r.attachEvent||r.attachEvent.toString&&r.attachEvent.toString().indexOf("[native code")<0||isOpera?(r.addEventListener("load",e.onScriptLoad,!1),r.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,r.attachEvent("onreadystatechange",e.onScriptLoad)),r.src=n,currentlyAddingScript=r,baseElement?head.insertBefore(r,baseElement):head.appendChild(r),currentlyAddingScript=null,r;if(isWebWorker)try{importScripts(n),e.completeLoad(t)}catch(o){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+n,o,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){return head||(head=e.parentNode),dataMain=e.getAttribute("data-main"),dataMain?(mainScript=dataMain,cfg.baseUrl||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0):void 0}),define=function(e,t,n){var r,i;"string"!=typeof e&&(n=t,t=e,e=null),isArray(t)||(n=t,t=null),!t&&isFunction(n)&&(t=[],n.length&&(n.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(e,n){t.push(n)}),t=(1===n.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(r=currentlyAddingScript||getInteractiveScript(),r&&(e||(e=r.getAttribute("data-requiremodule")),i=contexts[r.getAttribute("data-requirecontext")])),i?(i.defQueue.push([e,t,n]),i.defQueueMap[e]=!0):globalDefQueue.push([e,t,n])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}}(this),define("requireLib",function(){});var __extends,__assign,__rest,__decorate,__param,__metadata,__awaiter,__generator,__exportStar,__values,__read,__spread,__spreadArrays,__await,__asyncGenerator,__asyncDelegator,__asyncValues,__makeTemplateObject,__importStar,__importDefault;!function(e){function t(e,t){return e!==n&&("function"==typeof Object.create?Object.defineProperty(e,"__esModule",{value:!0}):e.__esModule=!0),function(n,r){return e[n]=t?t(n,r):r}}var n="object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:{};"function"==typeof define&&define.amd?define("tslib",["exports"],function(r){e(t(n,t(r)))}):e("object"==typeof module&&"object"==typeof module.exports?t(n,t(module.exports)):t(n))}(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};__extends=function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)},__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},__rest=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},__decorate=function(e,t,n,r){var i,o=arguments.length,a=3>o?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(3>o?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},__param=function(e,t){return function(n,r){t(n,r,e)}},__metadata=function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},__awaiter=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r["throw"](e))}catch(t){o(t)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},__generator=function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(a=2&n[0]?o["return"]:n[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,n[1])).done)return a;switch(o=0,a&&(n=[2&n[0],a.value]),n[0]){case 0:case 1:a=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(a=u.trys,!(a=a.length>0&&a[a.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){u.label=n[1];break}if(6===n[0]&&u.label<a[1]){u.label=a[1],a=n;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(n);break}a[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(r){n=[6,r],o=0}finally{i=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,a,s,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:n(0),"throw":n(1),"return":n(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s},__exportStar=function(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])},__values=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}},__read=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o["return"])&&n.call(o)}finally{if(i)throw i.error}}return a},__spread=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e},__spreadArrays=function(){for(var e=0,t=0,n=arguments.length;n>t;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;n>t;t++)for(var o=arguments[t],a=0,s=o.length;s>a;a++,i++)r[i]=o[a];return r},__await=function(e){return this instanceof __await?(this.v=e,this):new __await(e)},__asyncGenerator=function(e,t,n){function r(e){l[e]&&(c[e]=function(t){return new Promise(function(n,r){f.push([e,t,n,r])>1||i(e,t)})})}function i(e,t){try{o(l[e](t))}catch(n){u(f[0][3],n)}}function o(e){e.value instanceof __await?Promise.resolve(e.value.v).then(a,s):u(f[0][2],e)}function a(e){i("next",e)}function s(e){i("throw",e)}function u(e,t){e(t),f.shift(),f.length&&i(f[0][0],f[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var c,l=n.apply(e,t||[]),f=[];return c={},r("next"),r("throw"),r("return"),c[Symbol.asyncIterator]=function(){return this},c},__asyncDelegator=function(e){function t(t,i){n[t]=e[t]?function(n){return(r=!r)?{value:__await(e[t](n)),done:"return"===t}:i?i(n):n}:i}var n,r;return n={},t("next"),t("throw",function(e){throw e}),t("return"),n[Symbol.iterator]=function(){return this},n},__asyncValues=function(e){function t(t){r[t]=e[t]&&function(r){return new Promise(function(i,o){r=e[t](r),n(i,o,r.done,r.value)})}}function n(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=e[Symbol.asyncIterator];return i?i.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),r={},t("next"),t("throw"),t("return"),r[Symbol.asyncIterator]=function(){return this},r)},__makeTemplateObject=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__importStar=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t},__importDefault=function(e){return e&&e.__esModule?e:{"default":e}},e("__extends",__extends),e("__assign",__assign),e("__rest",__rest),e("__decorate",__decorate),e("__param",__param),e("__metadata",__metadata),e("__awaiter",__awaiter),e("__generator",__generator),e("__exportStar",__exportStar),e("__values",__values),e("__read",__read),e("__spread",__spread),e("__spreadArrays",__spreadArrays),e("__await",__await),e("__asyncGenerator",__asyncGenerator),e("__asyncDelegator",__asyncDelegator),e("__asyncValues",__asyncValues),e("__makeTemplateObject",__makeTemplateObject),e("__importStar",__importStar),e("__importDefault",__importDefault)}),define("OutSystems/ClientRuntime/modules/Storage/StorageType",["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e[e.Persistent=0]="Persistent",e[e.Session=1]="Session"}(n||(n={})),t["default"]=n}),define("OutSystems/ClientRuntime/modules/Storage/InMemoryStorage",["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){if(this.storageObj={},e)for(var t=0,n=e.key(t);null!==n;)this.storageObj[n]=e.getItem(n),n=e.key(++t)}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.storageObj).length},enumerable:!0,configurable:!0}),e.prototype.clear=function(){this.storageObj={}},e.prototype.getItem=function(e){return this.storageObj.hasOwnProperty(e)?this.storageObj[e]:null},e.prototype.key=function(e){var t=Object.keys(this.storageObj);return e<t.length?t[e]:null},e.prototype.removeItem=function(e){this.storageObj.hasOwnProperty(e)&&delete this.storageObj[e]},e.prototype.setItem=function(e,t){this.storageObj[e]=t},e}();t["default"]=n}),define("OutSystems/ClientRuntime/modules/Storage/StorageNaming",["require","exports"],function(e,t){"use strict";function n(){return i}function r(e){i=e}Object.defineProperty(t,"__esModule",{value:!0}),t.OS_STORAGE_PREFIX="$OS_";var i="OS";t.getDefaultStorageNamespace=n,t.setDefaultStorageNamespace=r}),define("OutSystems/ClientRuntime/modules/Storage/StorageEnvironment",["require","exports","./StorageType","./StorageNaming","./InMemoryStorage"],function(e,t,n,r,i){"use strict";function o(e){var t=e===n["default"].Persistent?"localStorage":"sessionStorage";return"undefined"==typeof window?void 0:window[t]}function a(e){var t=r.OS_STORAGE_PREFIX+"test",n="1";try{var i=o(e);i.setItem(t,n);var a=i.getItem(t)===n;return i.removeItem(t),a}catch(s){return!1}}function s(){return d}function u(){return p}function c(e){d=e}function l(e){p=e}function f(e){return e===n["default"].Persistent&&d===o(n["default"].Persistent)?(console.warn("The localStorage is full... Proceding with a static Javascript object"),d=new i["default"](d),!0):this.storageType===n["default"].Session&&p===o(n["default"].Session)?(console.warn("The sessionStorage is full... Proceding with a static Javascript object"),p=new i["default"](p),!0):!1}Object.defineProperty(t,"__esModule",{value:!0});var d=a(n["default"].Persistent)?o(n["default"].Persistent):new i["default"],p=a(n["default"].Session)?o(n["default"].Session):new i["default"];t.isSpecificStorageAvailable=a,t.getPersistentStorage=s,t.getSessionStorage=u,t.setCustomPersistentStorage=c,t.setCustomSessionStorage=l,t.tryExpandStorage=f}),define("OutSystems/ClientRuntime/modules/Storage/StorageObject",["require","exports","./StorageType","./StorageNaming","./StorageEnvironment"],function(e,t,n,r,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.freeze(Object()),a=function(){function e(e,t,n,i){this.storageType=e,this.key=t,this.defaultValue=n,this.getModuleName=function(){return r.getDefaultStorageNamespace()},this.clearCache(),i&&(this.getModuleName=i)}return e.prototype.get=function(){return this.getValueForModule(this.getModuleName())},e.prototype.set=function(e){this.setValueForModule(this.getModuleName(),e)},e.prototype.remove=function(){this.removeValueForModule(this.getModuleName())},e.prototype.isDefined=function(){return this.hasValueForModule(this.getModuleName())},e.prototype.getStorageKeyForModule=function(e){return r.OS_STORAGE_PREFIX+e+"$"+this.key},Object.defineProperty(e.prototype,"storage",{get:function(){return this.storageType===n["default"].Persistent?i.getPersistentStorage():i.getSessionStorage()},enumerable:!0,configurable:!0}),e.prototype.getValueForModule=function(e){return this.cachedValue===o&&(this.cachedValue=this.getValueForModuleFromStorage(e)),this.cachedValue},e.prototype.getValueForModuleFromStorage=function(e){var t=this.storage.getItem(this.getStorageKeyForModule(e));return null===t?this.defaultValue:"undefined"===t||void 0===t?void 0:JSON.parse(t)},e.prototype.hasValueForModule=function(e){var t=this.storage.getItem(this.getStorageKeyForModule(e));return null!==t&&void 0!==t&&"undefined"!==t},e.prototype.setValueForModule=function(e,t){var n=this.getStorageKeyForModule(e),r=JSON.stringify(t),o=this.storage;if(!o||!o.setItem)throw Error("The storage object for "+this.key+" is invalid.");try{o.setItem(n,r),this.cachedValue=t}catch(a){if(!i.tryExpandStorage(this.storageType))throw a;this.storage.setItem(n,r)}},e.prototype.removeValueForModule=function(e){this.storage.removeItem(this.getStorageKeyForModule(e)),this.clearCache()},e.prototype.clearCache=function(){this.cachedValue=o},e}();t["default"]=a}),define("OutSystems/ClientRuntime/StorageProvider",["require","exports","./modules/Storage/StorageType","./modules/Storage/InMemoryStorage","./modules/Storage/StorageObject","./modules/Storage/StorageNaming","./modules/Storage/StorageEnvironment"],function(e,t,n,r,i,o,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StorageType=n["default"],t.DummyStorage=r["default"],t.StorageObject=i["default"],t.setDefaultStorageNamespace=o.setDefaultStorageNamespace,t.getPersistentStorage=a.getPersistentStorage,t.getSessionStorage=a.getSessionStorage,t.setCustomPersistentStorage=a.setCustomPersistentStorage,t.setCustomSessionStorage=a.setCustomSessionStorage}),define("OutSystems/ClientRuntime/TransitionAnimation",["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e[e.None=0]="None",e[e.Default=1]="Default",e[e.Fade=2]="Fade",e[e.SlideFromLeft=3]="SlideFromLeft",e[e.SlideFromRight=4]="SlideFromRight",e[e.SlideFromBottom=5]="SlideFromBottom",e[e.SlideFromTop=6]="SlideFromTop"}(n=t.TransitionAnimation||(t.TransitionAnimation={}))}),define("OutSystems/ClientRuntime/Transitions",["require","exports","./TransitionAnimation"],function(e,t,n){"use strict";function r(e){t.Default=e}function i(e){return new s(e?e.name:"")}function o(e,n){if("string"==typeof e)return new s(e);switch(e){case t.TransitionAnimation.None:return u;case t.TransitionAnimation.Fade:return c;case t.TransitionAnimation.SlideFromLeft:return l;case t.TransitionAnimation.SlideFromRight:return f;case t.TransitionAnimation.SlideFromBottom:return d;case t.TransitionAnimation.SlideFromTop:return p;case t.TransitionAnimation.Default:return t.Default;default:return n}}function a(e){if(!e||!e.name)return new s("");switch(e.name){case c.name:return new s(c.name);case d.name:return new s(p.name);case l.name:return new s(f.name);case f.name:return new s(l.name);case p.name:return new s(d.name);default:return new s(e.name+"-back")}}Object.defineProperty(t,"__esModule",{value:!0}),t.TransitionAnimation=n.TransitionAnimation;var s=function(){function e(e){void 0===e&&(e=""),this.name=e}return e}();t.Transition=s;var u=new s,c=new s("fade"),l=new s("slide-from-left"),f=new s("slide-from-right"),d=new s("slide-from-bottom"),p=new s("slide-from-top");t.Default=new s,t.setDefaultTransition=r,t.sanitizeTransition=i,t.createTransition=o,t.reverseTransition=a}),define("OutSystems/ClientRuntime/ApplicationInfo",["require","exports","./Transitions"],function(e,t,n){"use strict";function r(e){F=e}function i(){return F.environmentKey}function o(){return F.environmentName}function a(){return F.applicationKey}function s(){return F.applicationName}function u(){return F.databaseName}function c(e){F.modules=e}function l(){return F.modules}function f(e){var t=F.modules,n=t[e];return n||(t[e]={moduleName:null,homeScreenName:null,splashScreenName:null,screens:[],staticEntities:{}}),t[e]}function d(){return F.clientEntitiesModules}function p(e){F.clientEntitiesModules=e}function h(e){F.databaseName=e}function g(){return F.homeModuleName}function m(){return F.homeModuleKey}function y(){if(F.homeModuleName&&F.modules){var e=F.modules[F.homeModuleKey]; return e?e:null}return null}function v(e,t){for(var n=0,r=e.screens;n<r.length;n++){var i=r[n];if(i.screenUrl===t)return i}return null}function b(e,t){for(var n=0,r=e.screens;n<r.length;n++){var i=r[n];if(i.screenName===t)return i}return null}function T(){return F.personalArea}function E(){var e=T();return e?"/"+e:""}function w(){var e=T();return e?"-"+e:""}function D(){var e=y();return"/"+e.moduleName+E()+"/"+e.homeScreenName}function S(){return V}function I(){return"nr2"+F.userProviderName}function _(){return F.userProviderName}function x(){return F.debugEnabled}function A(){return F.homeModuleControllerName}function N(){return F.homeModuleLanguageResourcesName}function C(){return F.applicationDefaultTimeout}function O(e){F.applicationDefaultTimeout=e}function R(){var e=n.TransitionAnimation[F.defaultTransition];return n.createTransition(e)}function L(){return F.errorPageConfig}function M(){return F.isWeb}function P(e){var t=Object.keys(F.modules).filter(function(t){return f(t).moduleName===e});if(t&&t.length>0){var n=t[0];return f(n).ownerAppKey!==a()}return!0}Object.defineProperty(t,"__esModule",{value:!0});var F={environmentKey:"",environmentName:"",applicationKey:"",applicationName:"",userProviderName:"",debugEnabled:!1,homeModuleName:"",homeModuleKey:"",modules:{},homeModuleControllerName:"",homeModuleLanguageResourcesName:"",clientEntitiesModules:[],applicationDefaultTimeout:null,isWeb:!1},V="";t.setApplicationDefinition=r,t.getEnvironmentKey=i,t.getEnvironmentName=o,t.getApplicationKey=a,t.getApplicationName=s,t.getDatabaseName=u,t.setModules=c,t.getModules=l,t.getModuleFromKey=f,t.getClientEntitiesModules=d,t.setClientEntitiesModules=p,t.setDatabaseName=h,t.getHomeModuleName=g,t.getHomeModuleKey=m,t.getHomeModuleDefinition=y,t.getScreenDefinition=v,t.getScreenDefinitionFromScreenName=b,t.getPersonalAreaName=T,t.getPersonalAreaPathOrDefault=E,t.getPersonalAreaStorageIdOrDefault=w,t.getDefaultModuleHomeScreenURL=D,t.getCurrentLocale=S,t.getUserCookieName=I,t.getUserProviderName=_,t.isDebugEnabled=x,t.getHomeModuleControllerName=A,t.getHomeModuleLanguageResourcesName=N,t.getApplicationDefaultTimeout=C,t.setApplicationDefaultTimeout=O,t.getDefaultTransition=R,t.getErrorPageConfig=L,t.isWebApplication=M,t.hasModule=P}),define("OutSystems/ClientRuntime/Exceptions",["require","exports","tslib"],function(e,t,n){"use strict";function r(e,t,n){return void 0===n&&(n=""),t===l.Exception?!0:e instanceof t?""!==n?e.specificType?e.specificType===n:!1:!0:!1}function i(e){if(void 0===e)return"";if(e instanceof Error)return e.message;var t=e.toString();return"[object SQLError]"===t?e.message.toString():t}function o(e){var t=(void 0!==e.extraStack?e.extraStack+"\r\n ":"")+(e.stack||"");return t||""}function a(e){var t={name:e.name,message:i(e),stack:o(e),extraStack:e instanceof l.Exception?e.extraStack:void 0};return t}function s(e){return e.name?e.specificType?new l[e.name](e.specificType,e.message,e.extraStack):new l[e.name](e.message,e.extraStack):new l.Exception(e.message,e.extraStack)}function u(e){return r(e,l.SystemException)}function c(e){return r(e,l.LicensingException)}Object.defineProperty(t,"__esModule",{value:!0});var l;!function(e){e.CustomError=function(e){var t=Error.call(this,e);"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(t,this.constructor.prototype):t.__proto__=this.constructor.prototype,"stack"in this||Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)},e.CustomError.prototype=Error.prototype;var t=function(e){function t(t,n){var r=e.call(this,t)||this;return r.extraStack=n,r.message=t,r.name="Exception",r}return n.__extends(t,e),t}(e.CustomError);e.Exception=t;var i=function(e){function t(t,n,r){var i=e.call(this,n,r)||this;return i.specificType=t,i.name=t,i}return n.__extends(t,e),t}(t);e.ServerException=i;var o=function(e){function t(t,n,r){var i=e.call(this,n,r)||this;return i.specificType=t,i.name=t,i}return n.__extends(t,e),t}(t);e.DataBaseException=o;var a=function(e){function t(t,n){return e.call(this,"OpenDatabaseException",t,n)||this}return n.__extends(t,e),t}(o);e.OpenDatabaseException=a;var s=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="CommunicationException",r}return n.__extends(t,e),t}(t);e.CommunicationException=s;var u=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="NumberOverflowException",r}return n.__extends(t,e),t.prototype.valueOf=function(){return this.name+": "+this.message},t}(t);e.NumberOverflowException=u;var c=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="InvalidJavascriptType",r}return n.__extends(t,e),t.prototype.valueOf=function(){return this.name+": "+this.message},t}(t);e.InvalidJavascriptType=c;var l=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="SecurityException",r}return n.__extends(t,e),t}(t);e.SecurityException=l;var f=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="InvalidLoginException",r}return n.__extends(t,e),t}(l);e.InvalidLoginException=f;var d=function(e){function t(t,n,r){var i=e.call(this,n,r)||this;return i.specificType=t,i.name=t,i}return n.__extends(t,e),t}(l);e.NotRegisteredException=d;var p=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="SystemException",r}return n.__extends(t,e),t}(t);e.SystemException=p;var h=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="IgnorableSystemException",r}return n.__extends(t,e),t}(p);e.IgnorableSystemException=h;var g=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="ViewHasChangedException",r}return n.__extends(t,e),t}(h);e.ViewHasChangedException=g;var m=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="OutOfOrderException",r}return n.__extends(t,e),t}(h);e.OutOfOrderException=m;var y=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="OutOfContextException",r}return n.__extends(t,e),t}(h);e.OutOfContextException=y;var v=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="RedirectOccurredException",r}return n.__extends(t,e),t}(h);e.RedirectOccurredException=v;var b=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="UnhandledOrIgnoredErrorInEventException",r}return n.__extends(t,e),Object.defineProperty(t.prototype,"handleErrorResult",{get:function(){return this._handleErrorResult},enumerable:!0,configurable:!0}),t.create=function(e,n,r){var i=new t(n,r);return i._handleErrorResult=e,i},t.ignore=function(e){if(!r(e,t))throw e},t}(h);e.UnhandledOrIgnoredErrorInEventException=b;var T=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="ApplicationBackendUnavailableException",r}return n.__extends(t,e),t}(p);e.ApplicationBackendUnavailableException=T;var E=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="LicensingException",r}return n.__extends(t,e),t}(p);e.LicensingException=E;var w=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="IncompatibleProducerException",r}return n.__extends(t,e),t}(p);e.IncompatibleProducerException=w;var D=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="ControllerDisposedException",r}return n.__extends(t,e),t}(h);e.ControllerDisposedException=D;var S=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name="AbortActivityChangeException",r}return n.__extends(t,e),t}(t);e.AbortActivityChangeException=S;var I=function(e){function t(t,n,r){var i=e.call(this,n,r)||this;return i.specificType=t,i.name=t,i}return n.__extends(t,e),t}(t);e.UserException=I}(l=t.Exceptions||(t.Exceptions={})),t.isInstanceOf=r,t.getMessage=i,t.getStack=o,t.getExceptionInfo=a,t.getException=s,t.isSystem=u,t.isApplicationOffline=c}),define("OutSystems/ClientRuntime/Flow",["require","exports"],function(e,t){"use strict";function n(e){var t=e;return t&&"function"==typeof t.then&&"function"==typeof t["catch"]}function r(e,t){switch(t){case D:return e();case w:return;default:return Promise.reject(t)}}function i(e){return e()?Promise.resolve(void 0):s()}function o(e){return new Promise(e)}function a(e){return Promise.resolve(e)}function s(){return Promise.reject(w)}function u(){return Promise.reject(D)}function c(e){return Promise.reject(new E(e))}function l(e){return Promise.reject(e)}function f(e){return d(e)}function d(e,t){function r(e,n){return o?n?(clearTimeout(t),d(function(){return n(o)})):(s(),d(a,t)):d(e?function(){return e(i)}:function(){return i})}var i=void 0,o=void 0,a=function(){throw o},s=function(){clearTimeout(t),t=setTimeout(a,0)};try{i=e()}catch(u){o=u,s()}return n(i)?i:{then:function(e,t){return r(e,t)},"catch":function(e){return r(void 0,e)}}}function p(e,t,n){return void 0===t&&(t=function(e){return Promise.reject(e)}),void 0===n&&(n=function(){return Promise.resolve(void 0)}),f(e)["catch"](t).then(function(e){return f(n).then(function(t){return void 0!==t?t:e})},function(e){return f(n).then(function(){return Promise.reject(e)})})}function h(e,t){return p(e,t,void 0)}function g(e,t){return p(e,void 0,t)}function m(e){return void 0===e&&(e=function(){}),f(e)["catch"](T)}function y(e,t){function n(){return i(e).then(t).then(n,r.bind(null,n))}return n()}function v(e,t){var n=0;return y(function(){return n<e.length},function(){var r=e[n++];return t(r)})}function b(e,t){function n(){return i(e).then(o,r.bind(null,o))}function o(){return f(t).then(function(){return i(e)}).then(o,r.bind(null,n))}return o()}function T(e){return e instanceof E?e.returnValue:Promise.reject(e)}Object.defineProperty(t,"__esModule",{value:!0});var E=function(){function e(e){this.returnValue=e}return e}(),w=new Object,D=new Object;t.isPromiseCompatible=n,t.promise=o,t.resolve=a,t.breakAsync=s,t.continueAsync=u,t.returnAsync=c,t.throwAsync=l,t.executeSequence=f,t.tryCatchFinally=p,t.tryCatch=h,t.tryFinally=g,t.executeAsyncFlow=m,t.whileAsync=y,t.forEachAsync=v,t.doWhileAsync=b,t.whileTrueAsync=y.bind(null,function(){return!0})}),define("OutSystems/ClientRuntime/ClientInfo",["require","exports","./StorageProvider"],function(e,t,n){"use strict";function r(){var e=window.device;if(e){var t=new a(new s(e.platform,e.version,e.manufacturer,e.model,e.uuid,e.serial,e.cordova,e.isVirtual));u.set(o.serializeClientInfo(t))}}function i(){var e=u.get();if(e)return o.deserializeClientInfo(e)}Object.defineProperty(t,"__esModule",{value:!0});var o,a=function(){function e(e){this._device=e}return Object.defineProperty(e.prototype,"device",{get:function(){return this._device},enumerable:!0,configurable:!0}),e}(),s=function(){function e(e,t,n,r,i,o,a,s){this._platform=e,this._version=t,this._manufacturer=n,this._model=r,this._uuid=i,this._serial=o,this._cordova=a,this._isVirtual=s}return Object.defineProperty(e.prototype,"platform",{get:function(){return this._platform},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"manufacturer",{get:function(){return this._manufacturer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"model",{get:function(){return this._model},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uuid",{get:function(){return this._uuid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serial",{get:function(){return this._serial},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cordova",{get:function(){return this._cordova},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isVirtual",{get:function(){return this._isVirtual},enumerable:!0,configurable:!0}),e}();!function(e){function t(e){var t=n(e);if(t)return JSON.stringify(t)}function n(e){return e?{device:e.device?r(e.device):void 0}:void 0}function r(e){return e?{platform:e.platform,version:e.version,manufacturer:e.manufacturer,model:e.model,uuid:e.uuid,serial:e.serial,cordova:e.cordova,isVirtual:e.isVirtual}:void 0}function i(e){var t;try{t=JSON.parse(e)}catch(n){}if(t)return o(t)}function o(e){return e?new a(u(e.device)):void 0}function u(e){return e?new s("string"==typeof e.platform?e.platform:void 0,"string"==typeof e.version?e.version:void 0,"string"==typeof e.manufacturer?e.manufacturer:void 0,"string"==typeof e.model?e.model:void 0,"string"==typeof e.uuid?e.uuid:void 0,"string"==typeof e.serial?e.serial:void 0,"string"==typeof e.cordova?e.cordova:void 0,"boolean"==typeof e.isVirtual?e.isVirtual:void 0):void 0}e.serializeClientInfo=t,e.deserializeClientInfo=i}(o||(o={}));var u=new n.StorageObject(n.StorageType.Persistent,"ClientInfo");t.setClientInfo=r,t.getClientInfo=i}),define("OutSystems/ClientRuntime/Logger",["require","exports","./Exceptions","./StorageProvider","./ClientInfo"],function(e,t,n,r,i){"use strict";function o(){q=[],H=le,G=fe,W=0,z=0,K=!1,Q=!1,X=!1,Y=!1,$=!1,Z=!1,ee=!1,te=!1,ne=!1,ue="",ie=new Promise(function(e,t){se=function(t){ee=!0,e(t),Q=!0}}),re=new Promise(function(e,t){ae=function(t){te=!0,e(t),Q=!0}})}function a(e){var t=new k(e);se(t)}function s(e){ae(e)}function u(e){e.onOnline(function(){return b()}),e.onOffline(function(){return T()}),X=e.isOnline(),Y=!0,Q=X,oe=e}function c(){ne=!0,y(),J=t.LoggerStorage.hasTracingEnabled.get()}function l(){return K=!0,Q&&te?void v():void Promise.resolve().then(function(){return X&&Y&&ee?d():te?p():void(K=!1)})["catch"](function(){K=!1})}function f(){return!D()||Q}function d(){return W>=he&&oe?(Y=!1,z=0,E(),void setTimeout(function(){return l()},G)):ie.then(function(e){return h(e,H)})}function p(e){return void 0===e&&(e=H),re.then(function(t){return h(t,e)})}function h(e,t){if(D())return K=!1,Promise.resolve(void 0);var n=q.slice(0,t);return e.writeLogBatch(n).then(function(){q.splice(0,n.length),W=0,f()?setTimeout(function(){return l()},G):K=!1})["catch"](function(){q.splice(0,n.length),q=q.concat(n),W++,setTimeout(function(){return l()},x(W))})}function g(){b()}function m(){if(te)return p(q.length);if(ne){var e=q;$&&(e=t.LoggerStorage.fallbackLogStorage.get().concat(q)),t.LoggerStorage.fallbackLogStorage.set(e),$=!0,q=[]}return Promise.resolve(void 0)}function y(){var e=t.LoggerStorage.fallbackLogStorage.get();0!==e.length&&(I(e),X?t.LoggerStorage.fallbackLogStorage.remove():(oe.onOnline(function(){return t.LoggerStorage.fallbackLogStorage.remove()}),re.then(function(){return t.LoggerStorage.fallbackLogStorage.remove()})),Z=!0)}function v(){return re.then(function(e){e.popLogs().then(function(e){q=e.concat(q),Q=!1,setTimeout(function(){return l()},G)})["catch"](function(){setTimeout(function(){return l()},G)})})}function b(){X=!0,Y=!0,Q=!0,W=0,K||l()}function T(){X=!1,Y=!1,Q=!1,W=0,K||l()}function E(){oe&&oe.ping(ge).then(function(){z=0,b()})["catch"](function(){X&&!Y&&(z++,setTimeout(function(){E()},x(z)))})}function w(e){H=e}function D(){return 0===q.length}function S(e){q.push(_(e)),K||l()}function I(e){e.forEach(function(e){return S(e)})}function _(e){return e.message=e.message?e.message.substring(0,me):e.message,e.stack=e.stack?e.stack.substring(0,me):e.stack,e}function x(e){var t=Math.min(e,pe);return Math.pow(de,t)*G}function A(){return!D()}function N(){return Z}function C(e){void 0===e&&(e=!1),J=e;try{t.LoggerStorage.hasTracingEnabled.set(J)}catch(n){O(ce,"Error saving the new value of 'tracingEnabled' property in the local storage. "+n)}}function O(e,n){if(e&&n&&(J||t.forceTracing)){var r="";"string"==typeof e?r=e:(r=e.constructor.name,"Function"===r&&(r=e.name));var i=void 0;i="string"==typeof n?n:n(),U(r,i,t.LogTypes.Trace)}}function R(e,n){U(e,n,t.LogTypes.General)}function L(e,r,i){var o="",a="";"string"==typeof r?o=r:(o=n.getMessage(r),a=n.getStack(r)),i&&(o+="\n"+n.getMessage(i),a+=(a?"\n":"")+n.getStack(i)),U(e,o,t.LogTypes.Error,a)}function M(e){J&&e?(j(),O(ce,"Device details initialized")):O(ce,"Device details not initialized: isNative = ["+e+"] tracingEnabled = ["+J+"]")}function P(e,t,n,r,i){function o(e,t,r,s,u){return e&&"object"==typeof e?(u=a.has(e),a.set(e,!0),s=Array.isArray(e),u?r=i&&i(e)||null:JSON.stringify(e,function(i,a){if(s||t>0){if(n&&(a=n(i,a)),!i)return s=Array.isArray(a),e=a;r=r||(s?[]:{}),r[i]=o(a,s?t:t-1)}}),void 0===r?s?[]:"(...)":r):e}void 0===t&&(t=3),n=n||F,t=isNaN(+t)?1:t;var a=new WeakMap;return JSON.stringify(o(e,t),null,r)}function F(e,t){var n=10,r=10,i=25;if(""===e){if(Array.isArray(t)){var o=t;return o.length>=n&&(o=o.slice(0,n-1),o.push("(...)")),o}var a=V(t,r);return a}if("string"==typeof t){var s=t;return s.length>i?s.substring(0,i-6)+" (...)":s}return t}function V(e,t){var n=0,r=!1,i=Object.keys(e).reduce(function(i,o){return n++,t>=n?i[o]=e[o]:r=!0,i},{});return r&&(i["..."]="(...)"),i}function U(e,n,r,i){if(!r||""===r.trim())throw new Error("Logger: Error sending log. LogType must be defined.");var o=(new Date).toISOString(),a=e?e+" ":"",s=""+n+ue,u=a+"["+o+"]: "+n+" "+(i?"\n"+i:"");r===t.LogTypes.Error?console.error(u):console.log(u);var c={instant:o,logType:r,message:s,moduleName:e,stack:i};S(c)}function j(){if(!ue){var e=i.getClientInfo();if(e&&e.device){var t=e.device;ue=" ["+t.platform+"|"+t.version+"|"+t.manufacturer+"|"+t.model+"|"+t.uuid+"|"+t.cordova+"]"}}return ue}Object.defineProperty(t,"__esModule",{value:!0}),t.LoggerStorage={hasTracingEnabled:new r.StorageObject(r.StorageType.Persistent,"HasTracingEnabled"),fallbackLogStorage:new r.StorageObject(r.StorageType.Persistent,"FallbackLogStorage",[])},t.LogTypes={Error:"error",General:"general",Trace:"trace"};var k=function(){function e(e){this.postLog=e}return e.prototype.writeLog=function(e){return this.writeLogBatch([e])},e.prototype.writeLogBatch=function(e){return this.postLog(e)},e}();t.ServerLogAppender=k;var B=function(){function e(){}return e.prototype.writeLog=function(e){return Promise.resolve(void 0)},e.prototype.writeLogBatch=function(e){return Promise.resolve(void 0)},e.prototype.countLogs=function(){return Promise.resolve(0)},e.prototype.getLogs=function(e){return Promise.resolve([])},e.prototype.popLogs=function(e){return Promise.resolve([])},e.prototype.removeLogs=function(e){return Promise.resolve(void 0)},e}();t.DummyLogStorage=B;var q,H,G,W,z,J,K,Q,X,Y,$,Z,ee,te,ne,re,ie,oe,ae,se,ue,ce="Logger",le=10,fe=200,de=1.2,pe=40,he=5,ge=5e3,me=2e3;t.initialize=o,t.setPostLogsFunction=a,t.setOfflineStorage=s,t.setNetworkStatusChecker=u,t.enableFallbackStorage=c,t.flushLogsToServer=g,t.flushLogsToStorage=m,t.setBatchSize=w,t.hasPendingLogs=A,t.hadSessionLogs=N,t.setTracingEnabled=C,t.trace=O,t.log=R,t.error=L,t.setDeviceDetails=M,t.serializeObjectForLog=P,o()}),define("OutSystems/ClientRuntime/Navigation",["require","exports","./ApplicationInfo","./Exceptions","./Flow","./Logger"],function(e,t,n,r,i,o){"use strict";function a(e){if(!s(e))throw new r.Exceptions.OutOfContextException}function s(e){return e&&e.isOutOfContext?!1:!0}function u(e){if(e)throw new r.Exceptions.RedirectOccurredException}function c(e){W.push(e)}function l(){return W[W.length-1]}function f(){return W.pop()}function d(e){void 0===e&&(e=!1),o.trace(F,"Next navigation will force a reload..."),K=!0,Q=e}function p(){return K}function h(){return X}function g(){return"undefined"!=typeof window&&window.location.search.indexOf(B)>=0}function m(e){var t=e.indexOf(U)<0?U:k;return e+=t+B+"="+(new Date).valueOf()}function y(e){void 0===e&&(e=!1);var n=P();t.changeWindowLocation(n,e)}function v(e){void 0===e&&(e=!1),t.changeWindowLocation(t.getCurrentLocation().href,e,!0)}function b(e){return P(n.getHomeModuleName(),e)}function T(e){for(var t=(new Date).getTime(),n=t-H;G.length>0&&G[0].timestamp<n;)G.shift();var r=G.reduce(function(t,n){return n.url===e?t+1:t},0);return q>r?(G.push({timestamp:t,url:e}),!1):(o.trace(F,"Identified a recursive navigation to '"+e+"'."),!0)}function E(e){return J.push(e)}function w(e){J.remove(e)}function D(e){var t={};return e.length>0&&e.split(k).forEach(function(e){var n=e.split("=");if(2===n.length){var r=S(n[0]),i=S(n[1]);t[r]=i}}),t}function S(e){return decodeURIComponent(e.replace(/\+/g," "))}function I(e,r){var a=n.getHomeModuleName(),s=K;if(K&&(K=!1),r&&!J.isEmpty){var u=J.pop();return i.tryCatch(u,function(e){o.error(a,e)}),!1}var c=R(e);if(c||s){var l=t.getUrlInfo(e.pathname),f=l.url,d=n.getModules(),p=void 0;if(l.isInternal){p=!0;var h=function(e){if(d.hasOwnProperty(e)){var t=d[e],n=P(t.moduleName);if(n===f||t.screens.some(function(e){return P(t.moduleName,e.screenUrl)===f}))return p=!1,"break"}};for(var g in d){var m=h(g);if("break"===m)break}}else p=!1;if(s||p){var y=void 0;if(p)y=P();else{var v=e.search||"";y=e.pathname==="/"+n.getHomeModuleName()&&""===v?e.pathname+"/":e.pathname+v}return t.changeWindowLocation(y,Q,c),!p}}return J.clear(),!0}function _(){n.isWebApplication()&&window.stop&&"complete"===document.readyState&&(o.trace(F,"Stopping all currently pending resources."),window.stop())}function x(e,n,r,i,o){if(a(r),T(e))throw Error("Too many redirects.");i||_();var s=t.getUrlInfo(e);W&&l().goTo&&s.isInternal?l().goTo(s,n,o):t.changeWindowLocation(e),u(i)}function A(e,t,n){a(t),n||_(),W&&l().goBack?l().goBack(e):window.history.back(),u(n)}function N(e,t,n){a(t),n||_(),W&&l().goForward?l().goForward(e):window.history.forward(),u(n)}function C(e,t,n){return n+e.substring(t.length)}function O(){var e=t.getCurrentLocation();if("http:"===e.protocol.toLocaleLowerCase()){if("localhost"!==e.hostname.toLocaleLowerCase()){var n=C(e.href,e.protocol,"https:");return t.changeWindowLocation(n,!1,!0),!0}o.log("Navigation","Accessing through http://localhost is not supported. Please access the application using the hostname instead.")}return!1}function R(e){return e.action.toUpperCase()===t.NAVIGATE_FROM_HISTORY_ACTION}function L(e){if(n.getPersonalAreaName()){var t="/"+n.getHomeModuleName(),r=t+n.getPersonalAreaPathOrDefault();0===e.indexOf(t)&&-1===e.indexOf(r)&&(e=e.replace(t,r))}return e}function M(e,t){var n=Object.keys(t).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])}).join("&");return L(e)+(n.length>0?"?"+n:"")}function P(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return L(0===e.length?"/"+n.getHomeModuleName()+"/":"/"+e.join("/"))}Object.defineProperty(t,"__esModule",{value:!0});var F="Navigation",V=new RegExp("/([^/]*)"),U="?",j="#",k="&",B="_ts",q=10,H=1e3;t.NAVIGATE_TO_URL_ACTION="PUSH",t.NAVIGATE_FROM_HISTORY_ACTION="POP",t.SCREEN_URL_PART_SEPARATOR="-";var G=[],W=[],z=function(){function e(){this.stack=[],this.handlerCallback={},this.counter=0}return e.prototype.push=function(e){var t=this.counter++;return this.stack.push(t),this.handlerCallback[t]=e,t},e.prototype.remove=function(e){var t=this.stack.indexOf(e),n=t>-1;return n&&(this.stack.splice(t),delete this.handlerCallback[e]),n},e.prototype.pop=function(){if(0===this.stack.length)throw new Error("NavigationHandlerStack: pop from empty stack.");var e=this.stack.pop(),t=this.handlerCallback[e];return delete this.handlerCallback[e],t},e.prototype.clear=function(){this.stack=[],this.handlerCallback={}},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.stack.length},enumerable:!0,configurable:!0}),e}(),J=new z;t.validateContext=a,t.isValidContext=s,t.throwRedirectOccurredExceptionIfNeeded=u,t.setNavigationCallbacks=c,t.getNavigationCallbacks=l,t.removeNavigationCallbacks=f;var K=!1,Q=!1;t.forceReloadOnNextNavigation=d,t.willReloadInNextNavigation=p,t.getCurrentLocation=function(){var e,t=(e=window.location,e.protocol),n=e.pathname,r=e.href,i=e.search,o=window.location.hostname||window.location.host.split(":")[0];return{protocol:t,pathname:n,href:r,search:i,hostname:o}},t.getSearchParameterValue=function(e){if(void 0===e)return null;var t=window.location.search.substr(1),n=D(t);return n[e]},t.urlBelongsToCurrentApplication=function(e){var r="http:"===e.protocol||"https:"===e.protocol||"outsystems:"===e.protocol;if(!r)return!1;var i=t.getCurrentLocation().hostname,o=""!==e.hostname?e.hostname:i;if(i!==o)return!1;var a=V.exec(e.pathname);if(a.length<2)return!1;var s=n.getHomeModuleName(),u=void 0!==a[1]?a[1]:s;return s===u},t.getLocationFromUrl=function(e){var t=document.createElement("a");return t.href=e,t};var X=!1;t.hasPendingReload=h,t.changeWindowLocation=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1),t&&(e=m(e)),o.trace(F,"Reloading application with url: '"+e+"' (replace = "+n+")");var r=function(){n?window.location.replace(e):window.location.href=e};X=!0,o.flushLogsToStorage().then(r)["catch"](r)},t.currentLocationHasTimestamp=g,t.addInvalidationSuffixToUrl=m,t.reloadApplication=y,t.reloadCurrentLocation=v,t.registerBackNavigationHandler=E,t.unregisterBackNavigationHandler=w,t.getUrlInfo=function(e){var n,r=!1,i="",o=e,a=-1!==e.indexOf(":")||0===e.indexOf("/"),s=o.indexOf(j);-1!==s&&(n=o.substr(s+1).trim(),o=o.substr(0,s));var u=o.indexOf(U);if(-1!==u&&(i=o.substr(u+1).trim(),o=o.substr(0,u)),a){var c=t.getLocationFromUrl(o);r=t.urlBelongsToCurrentApplication(c),r&&(o=c.pathname)}else o=b(o),r=!0;var l=D(i);return{url:e,isInternal:r,path:o,queryParams:l,hash:n}},t.onBeforeNavigate=I,t.navigateTo=x,t.navigateBack=A,t.navigateForward=N,t.switchUrlProtocol=C,t.ensureRequestSecurity=O,t.locationReachedFromHistory=R,t.generateScreenURL=M,t.buildApplicationRelativeUrl=P;var Y;!function(e){function t(e){i=e}function r(e){return i(e,n.getHomeModuleName())}var i=function(e){return e};e.setUrlVersionProvider=t,e.getVersionedUrl=r}(Y=t.VersionedURL||(t.VersionedURL={}))}),define("OutSystems/ClientRuntime/NativeHelper",["require","exports","./Logger","./Flow"],function(e,t,n,r){"use strict";function i(e){n.trace("NativeHelper",e)}function o(){var e="undefined"!=typeof navigator&&/OutSystemsApp/i.test(navigator.userAgent);return i("Running on "+(e?"native shell":"browser")),e}function a(){return u(p.Android)}function s(){return u(p.iOS)}function u(e){return o()&&window.device.platform===e}function c(){return r.promise(function(e,n){i("Waiting for 'deviceready' event"),o()?void 0===window.cordova?n("Running on native but cordova wasn't loaded"):e(t.whenDeviceReady):(i("'deviceready' event wait ignored"),e())})}function l(){return a()?(navigator.app.exitApp(),!0):!1}function f(e,t){c().then(function(){return d(e,t)})}function d(e,t){return"undefined"!=typeof document&&document.addEventListener?(document.addEventListener(e,t),!0):!1}Object.defineProperty(t,"__esModule",{value:!0});var p={Android:"Android",iOS:"iOS"};t.isRunningOnNative=o,t.isAndroid=a,t.isIOS=s,t.whenDeviceReady=r.promise(function(e,t){d("deviceready",function(){return e()})||e()}),t.ensureNativeReady=c,t.exitApp=l,t.addNativeEventListener=f}),define("OutSystems/ClientRuntime/Settings",["require","exports"],function(e,t){"use strict";function n(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];i[r]=e[r]}}function r(){return i}Object.defineProperty(t,"__esModule",{value:!0});var i;!function(e){e.DbNullDatesTZAware=!1,e.ForceXhrCommunication=!1}(i=t.EnvParam||(t.EnvParam={})),t.setPlatformSettings=n,t.getEnvParams=r}),define("OutSystems/ClientRuntime/NativeHttp",["require","exports","tslib","./NativeHelper","./Settings"],function(e,t,n,r,i){"use strict";function o(){return n.__awaiter(this,void 0,void 0,function(){var e,t;return n.__generator(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),null==u&&(u=r.ensureNativeReady()),[4,u];case 1:return n.sent(),e=window,e&&e.OutSystemsNative&&e.OutSystemsNative.Http?[2,e.OutSystemsNative.Http]:[3,3];case 2:return t=n.sent(),[2,null];case 3:return[2]}})})}function a(){return n.__awaiter(this,void 0,void 0,function(){var e;return n.__generator(this,function(t){switch(t.label){case 0:return[4,o()];case 1:return e=t.sent(),[2,!i.getEnvParams().ForceXhrCommunication&&!!e]}})})}function s(e,t){return n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(n){switch(n.label){case 0:return[4,o()];case 1:return r=n.sent(),[2,new l(r,e,t)]}})})}Object.defineProperty(t,"__esModule",{value:!0});var u=null;t.getNativeHttpPlugin=o,t.isNativeHttpPluginAvailable=a,t.createNativeHttpRequest=s;var c=function(){function e(e,t){this.requestHandler=e,this.nativeHttp=t}return Object.defineProperty(e.prototype,"complete",{get:function(){return this.requestHandler.isDone()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseUrl",{get:function(){return this.nativeHttp.responseUrl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"statusCode",{get:function(){return this.nativeHttp.status},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"statusText",{get:function(){return this.nativeHttp.statusText},enumerable:!0,configurable:!0}),e.prototype.getHeader=function(e){return e=e||"",this.nativeHttp.responseHeaders[e.toLowerCase()]},Object.defineProperty(e.prototype,"headers",{get:function(){return this.nativeHttp.responseHeaders},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseText",{get:function(){return this.nativeHttp.responseText},enumerable:!0,configurable:!0}),e}(),l=function(){function e(e,t,n){this.nativeRequest=e.createRequest(t,n)}return e.prototype.createRequestCallback=function(e){var t=this;return function(n){var r=new c(t,t.nativeRequest);e(r)}},e.prototype.setTimeout=function(e){this.nativeRequest.setTimeout(e)},e.prototype.setBody=function(e){this.nativeRequest.setBody(e)},e.prototype.setHeader=function(e,t){this.nativeRequest.setHeader(e,t)},e.prototype.isDone=function(){return 4===this.nativeRequest.readyState},e.prototype.send=function(){this.onSuccess&&(this.nativeRequest.onSuccess=this.createRequestCallback(this.onSuccess)),this.onError&&(this.nativeRequest.onError=this.createRequestCallback(this.onError)),this.onTimeout&&(this.nativeRequest.onTimeout=this.createRequestCallback(this.onTimeout)),this.onAbort&&(this.nativeRequest.onAbort=this.createRequestCallback(this.onAbort)),this.onFinish&&(this.nativeRequest.onFinish=this.createRequestCallback(this.onFinish)),this.nativeRequest.send()},e.prototype.abort=function(){this.nativeRequest.abort()},e}()}),define("OutSystems/ClientRuntime/Request",["require","exports","tslib","./NativeHttp"],function(e,t,n,r){"use strict";function i(e,t){return n.__awaiter(this,void 0,void 0,function(){var i;return n.__generator(this,function(n){switch(n.label){case 0:return[4,r.isNativeHttpPluginAvailable()];case 1:return i=n.sent(),i?[2,r.createNativeHttpRequest(e,t)]:[2,new u(e,t)]}})})}Object.defineProperty(t,"__esModule",{value:!0});var o={Unsent:0,Opened:1,HeadersReceived:2,Loading:3,Done:4},a=/[\r\n]+/,s=function(){function e(e,t){this.request=e,this.xhr=t}return Object.defineProperty(e.prototype,"complete",{get:function(){return this.request.isDone()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseUrl",{get:function(){return this.xhr.responseURL},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"statusCode",{get:function(){return this.xhr.status},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"statusText",{get:function(){return this.xhr.statusText},enumerable:!0,configurable:!0}),e.prototype.getHeader=function(e){return this.xhr.getResponseHeader(e)},Object.defineProperty(e.prototype,"headers",{get:function(){var e={},t=this.xhr.getAllResponseHeaders()||"";return t.split(a).reduce(function(e,t){var n=t.indexOf(":"),r=t.substr(0,n),i=t.substr(n+1).trim();return e[r]=i,e},e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseText",{get:function(){return this.xhr.responseText},enumerable:!0,configurable:!0}),e}(),u=function(){function e(e,t){this.xhr=new XMLHttpRequest,this.xhr.open(e,t,!0)}return e.prototype.createRequestCallback=function(e){var t=this;return function(n){var r=new s(t,t.xhr);e(r)}},e.prototype.setTimeout=function(e){this.xhr.timeout=e},e.prototype.setBody=function(e){this.body=e},e.prototype.setHeader=function(e,t){this.xhr.setRequestHeader(e,t)},e.prototype.isDone=function(){return this.xhr.readyState===o.Done},e.prototype.send=function(){ this.onSuccess&&(this.xhr.onload=this.createRequestCallback(this.onSuccess)),this.onError&&(this.xhr.onerror=this.createRequestCallback(this.onError)),this.onTimeout&&(this.xhr.ontimeout=this.createRequestCallback(this.onTimeout)),this.onAbort&&(this.xhr.onabort=this.createRequestCallback(this.onAbort)),this.onFinish&&(this.xhr.onloadend=this.createRequestCallback(this.onFinish)),this.xhr.send(this.body)},e.prototype.abort=function(){this.xhr.abort()},e}();t.createNewHttpRequest=i}),define("OutSystems/ClientRuntime/ResourceCache",["require","exports","tslib","./Logger","./Request","./NativeHelper"],function(e,t,n,r,i,o){"use strict";function a(){return"undefined"==typeof document?new p:"undefined"!=typeof applicationCache&&document.documentElement.getAttribute("manifest")?new l:o.isRunningOnNative()?new f:new d}function s(){t.ResourceCache=new p}Object.defineProperty(t,"__esModule",{value:!0});var u="ResourceCache",c=function(){function e(){this.isCaching=!1,this.errorMessages=[],this.onFinishListeners=[],this.onErrorListeners=[],this.onProgressListeners=[],r.trace(u,"Initializing resource cache using '"+this.getCacheName()+"' mechanism")}return e.prototype.onFinish=function(){this.isCaching=!1,r.trace(u,"Caching finished"),this.onFinishListeners.forEach(function(e){return e()}),this.onFinishListeners=[],this.onErrorListeners=[],this.onProgressListeners=[]},e.prototype.onError=function(e){r.trace(u,"Caching error: "+e),this.errorMessages.push(e),this.onErrorListeners.forEach(function(t){return t(e)})},e.prototype.onProgress=function(e,t){r.trace(u,"Caching progress: "+e+" / "+t),this.onProgressListeners.forEach(function(n){return n(e,t)})},e.prototype.listen=function(e,t,n){r.trace(u,"Started listening to resource cache events"),this.errorMessages.length>0&&t&&t(this.errorMessages.join("\n")),!this.isCaching&&e&&e(),this.isCaching?(e&&this.onFinishListeners.push(e),t&&this.onErrorListeners.push(t),n&&this.onProgressListeners.push(n)):r.trace(u,"Resource caching was already finished, listeners not attached")},e.prototype.start=function(e){var t=this;return r.trace(u,"Started caching resources for version "+e.versionToken),new Promise(function(n,r){if(!t.isCaching)try{t.isCaching=!0,t.errorMessages=[],t.innerStart(e)}catch(i){return t.onError(i.message),void r(i.message)}var o={finished:!1};t.listen(function(){o.finished||(o.finished=!0,n())},function(e){o.finished||(o.finished=!0,r(e))},null)})},e.prototype["switch"]=function(e){r.trace(u,"Switching cached resources to version "+e),this.innerSwitch(e)},e}(),l=function(e){function t(){for(var t=e.call(this)||this,n=0,r=["noupdate","cached","updateready"];n<r.length;n++){var i=r[n];applicationCache.addEventListener(i,function(){return t.handleEventBasedOnState()},!1)}return applicationCache.onprogress=function(e){return t.onProgress(e.loaded,e.total)},applicationCache.onerror=function(e){return t.callOnErrorAndFinish(e.message)},t}return n.__extends(t,e),t.prototype.callOnErrorAndFinish=function(e){var t=this;return applicationCache.status!==applicationCache.IDLE||this.isCaching?(this.onError(this.getErrorDescription(e)),void setTimeout(function(){return t.onFinish()},1)):void r.trace(u,"Cache invalidation bypassed"+(e?" - "+e:""))},t.prototype.getCacheName=function(){return"Application Cache"},t.prototype.innerStart=function(e){this.handleEventBasedOnState(),applicationCache.status===applicationCache.UNCACHED?this.callOnErrorAndFinish():applicationCache.status===applicationCache.IDLE&&applicationCache.update()},t.prototype.innerSwitch=function(e){},t.prototype.handleEventBasedOnState=function(){if(applicationCache.status===applicationCache.UPDATEREADY)setTimeout(function(){try{applicationCache.swapCache()}catch(e){r.error(u,e),applicationCache.update()}},0);else if(applicationCache.status!==applicationCache.IDLE&&applicationCache.status!==applicationCache.OBSOLETE)return;this.onFinish()},t.prototype.getErrorDescription=function(e){var t="Unable to cache "+(applicationCache.status===applicationCache.UNCACHED?"":"new ")+"resources, the application will be unavailable offline.";return e&&(t+="\nError message: "+e),"https:"===document.location.protocol&&(t+="\nPlease ensure that the server has a valid HTTPS certificate for '"+window.location.hostname+"', which is a requirement for offline."),t},t}(c),f=function(e){function t(){var n=e.call(this)||this;return n.isNativeReady=!1,n.isCacheAvailable=!1,o.ensureNativeReady().then(function(){return n.isNativeReady=!0,n.isCacheAvailable="undefined"!=typeof OSCache,n.isCacheAvailable?(OSCache.addEventListener("onfinish",function(e){return n.onFinish()}),OSCache.addEventListener("onerror",function(e){return n.onError(e.message)}),void OSCache.addEventListener("onprogress",function(e){return n.onProgress(e.loaded,e.total)})):void r.error(u,t.OSCacheNotFoundMessage)},function(e){r.error(u,"OSCache was not initialized because Cordova was not loaded.",e)}),n}return n.__extends(t,e),t.prototype.checkOSCacheAndDeferCall=function(e,n){return this.isNativeReady?this.isCacheAvailable?!0:(e&&this.onError(t.OSCacheNotFoundMessage),!1):(r.trace(u,"OSCache call deferred until Cordova is loaded"),o.ensureNativeReady().then(n),!1)},t.prototype.getCacheName=function(){return"Native Cache"},t.prototype.innerStart=function(e){var t=this;if(this.checkOSCacheAndDeferCall(!0,function(){return t.innerStart(e)})){for(var n=[],i=0,o=Object.getOwnPropertyNames(e.urlVersions);i<o.length;i++){var a=o[i];n.push(a+e.urlVersions[a])}r.trace(u,"Start Caching... "+n.length+" files: ");for(var s=0;s<n.length;s++)r.trace(u,s+1+"/"+n.length+": "+n[s]);OSCache.startCaching(e.versionToken,n,e.urlMappings,e.urlMappingsNoCache)}},t.prototype.innerSwitch=function(e){var t=this;if(this.checkOSCacheAndDeferCall(!1,function(){return t.innerSwitch(e)}))try{OSCache.switchToVersion(e)}catch(n){r.error(u,n)}},t.OSCacheNotFoundMessage="OSCache not found (is a native plugin missing?)",t}(c),d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.requested=0,t.resourceQueue=[],t.count=0,t.total=0,t}return n.__extends(t,e),t.prototype.getCacheName=function(){return"Preloader"},t.prototype.innerStart=function(e){if(!this.isOngoing()&&(this.count=this.requested=this.total=0,this.resources=e.urlVersions,this.resources&&(this.resourceQueue=Object.getOwnPropertyNames(this.resources),this.total=this.resourceQueue.length,!(this.resourceQueue.length<=0))))for(var n=0;n<t.DefaultWindowSize;++n)this.prefetchNext()},t.prototype.innerSwitch=function(e){},t.prototype.isOngoing=function(){return this.requested>0||this.resourceQueue.length>0},t.prototype.prefetchNext=function(){var e=this,n=this.resourceQueue.pop(),o=this.resources[n],a=n+(o&&o.length>0?o:"");r.trace(u,"Requesting resource: "+a),i.createNewHttpRequest("GET",a).then(function(n){n.onSuccess=n.onError=n.onTimeout=function(t){!e.onError||t.complete&&200===t.statusCode||e.onError("Failed to load resource '"+a+"' with status: "+t.statusText),e.onProgress&&e.onProgress(++e.count,e.total),e.requested--,0===e.resourceQueue.length&&0===e.requested?e.onFinish&&e.onFinish():e.resourceQueue.length>0&&e.prefetchNext()},n.setTimeout(t.DefaultResourceTimeout),n.send()}),this.requested++},t.DefaultWindowSize=2,t.DefaultResourceTimeout=2e4,t}(c),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.getCacheName=function(){return"Dummy"},t.prototype.innerStart=function(e){this.onFinish()},t.prototype.innerSwitch=function(e){},t}(c);t.ResourceCache=a(),t.forceDummyCacheHandler=s}),define("OutSystems/ClientRuntime/RequireManager",["require","exports"],function(e,t){"use strict";function n(){r()}function r(){a()}function i(e){requirejs.onError=e}function o(t,n){void 0===n&&(n="scripts");var i={baseUrl:n,waitSeconds:30};if(t){for(var o in t)(e.specified(o)||e.defined(o))&&delete t[o];i.paths=t}var a=requirejs.config(i);return r(),a}function a(){var e=requirejs.s.contexts;Object.keys(e).forEach(function(t){var n=e[t];if(!n._osNameToUrlPatched){var r=n.nameToUrl;n.nameToUrl=function(e,t,i){return e.indexOf(s)>0&&-1===e.indexOf("?")&&(e=e.split(s,2)[0]),r.apply(n,[e,t,i])},n._osNameToUrlPatched=!0}})}Object.defineProperty(t,"__esModule",{value:!0});var s="$";t.initialize=n,t.setErrorHandler=i,t.configure=o}),define("OutSystems/ClientRuntime/ErrorHandling",["require","exports","./ApplicationInfo","./Logger","./Navigation","./StorageProvider","./Exceptions"],function(e,t,n,r,i,o,a){"use strict";function s(e,n,o,s){if(void 0===n&&(n=""),void 0===o&&(o=""),!i.hasPendingReload()&&(e&&r.error(null,e),i.isValidContext(s))){var u=i.VersionedURL.getVersionedUrl(t.ERROR_PAGE_HTML);t.ErrorHandlingStorage.errorPageMessage.set(n),t.ErrorHandlingStorage.errorPageExtraMessage.set(o),e?t.ErrorHandlingStorage.errorPageExceptionInfo.set(a.getExceptionInfo(e)):t.ErrorHandlingStorage.errorPageExceptionInfo.remove(),i.changeWindowLocation(u)}}function u(e,t){var r=n.getErrorPageConfig(),i=r&&r.messages&&r.messages.incompatibleProducer;this.navigateToErrorPage(e,i||e.message,null,t)}function c(e){var t=n.getErrorPageConfig(),r=t&&t.messages&&t.messages.appOffline;this.navigateToErrorPage(null,r||"This application is temporarily unavailable. Try reloading or contact the administrator.",null,e)}function l(e,t){r.trace(p,"Error thrown by the application: "+e),a.isApplicationOffline(e)?this.navigateToAppOffline(t):a.isInstanceOf(e,a.Exceptions.IncompatibleProducerException)?this.navigateToIncompatibleProducer(e,t):this.navigateToErrorPage(e,null,null,t)}function f(e,t){return a.isInstanceOf(e,a.Exceptions.IgnorableSystemException)?!0:a.isApplicationOffline(e)?(this.navigateToAppOffline(t),!0):!1}function d(e){return e===t.UNHANDLED_ERROR_RESULT||e===t.IGNORED_ERROR_RESULT}Object.defineProperty(t,"__esModule",{value:!0}),t.ERROR_PAGE_HTML="_error.html",t.UNHANDLED_ERROR_RESULT={errorCode:"UNHANDLED"},t.IGNORED_ERROR_RESULT={errorCode:"IGNORED"};var p="ErrorHandling";t.ErrorHandlingStorage={errorPageMessage:new o.StorageObject(o.StorageType.Session,"ErrorPageMessage",""),errorPageExtraMessage:new o.StorageObject(o.StorageType.Session,"ErrorPageExtraMessage",""),errorPageExceptionInfo:new o.StorageObject(o.StorageType.Session,"ErrorPageExceptionInfo",null)},t.navigateToErrorPage=s,t.navigateToIncompatibleProducer=u,t.navigateToAppOffline=c,t.handleError=l,t.ignoreError=f,t.isSpecialHandleErrorResult=d}),define("OutSystems/ClientRuntime/Performance",["require","exports"],function(e,t){"use strict";function n(e){a&&__PERFORMANCE.start(e)}function r(e){a&&__PERFORMANCE.end(e)}function i(){return a?__PERFORMANCE.dump():void 0}function o(){return a?__PERFORMANCE.clear():void 0}Object.defineProperty(t,"__esModule",{value:!0});var a="undefined"!=typeof __PERFORMANCE;t.start=n,t.end=r,t.dump=i,t.clear=o}),define("OutSystems/ClientRuntime/EventDispatcher",["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e[e.TransitionStart=0]="TransitionStart",e[e.TransitionEnd=1]="TransitionEnd",e[e.NavigationStart=2]="NavigationStart"}(n=t.EventType||(t.EventType={}));var r;!function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"}(r=t.TransitionEndResult||(t.TransitionEndResult={}));var i,o=0,a=function(){for(var e=[],t=Object.keys(n).length/2,r=0;t>r;r++)e.push({});return e}();!function(e){function t(){return"_"+o++}function n(e,n,r){void 0===r&&(r=!1);var i=t();return a[e][i]={listenOnce:r,callback:n},{type:e,id:i}}function r(e,t){return n(e,t,!0)}function i(e){return e&&s(e.type,e.id)}function s(e,t){return delete a[e][t]}function u(e){var t=void 0,n=a[e.type];for(var r in n){var i=n[r];i.listenOnce&&s(e.type,r);var o=i.callback(e.args);void 0!==o&&(t=o)}return t}e.listen=n,e.listenOnce=r,e.unregister=i,e.dispatch=u}(i=t.EventDispatcher||(t.EventDispatcher={}))}),define("OutSystems/ClientRuntime/VersionsManager",["require","exports","module","./ApplicationInfo","./StorageProvider","./ResourceCache","./Navigation","./RequireManager","./Flow","./Logger","./ErrorHandling","./Performance","./EventDispatcher","./Exceptions","./NativeHelper"],function(e,t,n,r,i,o,a,s,u,c,l,f,d,p,h){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var g,m="VersionsManager",y="index.html";!function(e){e[e.Generic=0]="Generic",e[e.Resources=1]="Resources",e[e.DataModel=2]="DataModel"}(g=t.UpgradeFailReason||(t.UpgradeFailReason={}));var v;!function(e){e[e.Idle=0]="Idle",e[e.Upgrading=1]="Upgrading",e[e.UpgradeSuccess=2]="UpgradeSuccess",e[e.UpgradeFailed=3]="UpgradeFailed"}(v=t.UpgradeStatus||(t.UpgradeStatus={})),t.VersionsManagerStorage={applicationInfo:new i.StorageObject(i.StorageType.Persistent,"ApplicationInfo"),upgradeStatus:new i.StorageObject(i.StorageType.Session,"UpgradeStatus",0)};var b=function(){function e(){this.checkedCachedInfoConsistency=!1}return Object.defineProperty(e.prototype,"cachedAppInfo",{get:function(){var n=t.VersionsManagerStorage.applicationInfo.get();if(n&&!this.checkedCachedInfoConsistency){try{e.validateApplicationInfo(n)}catch(r){n=null,t.VersionsManagerStorage.applicationInfo.remove()}this.checkedCachedInfoConsistency=!0}return n},set:function(e){t.VersionsManagerStorage.applicationInfo.set(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentAppInfo",{get:function(){return this.pendingAppInfo?this.pendingAppInfo:this.cachedAppInfo},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"upgradeStatus",{get:function(){return t.VersionsManagerStorage.upgradeStatus.get()},set:function(e){t.VersionsManagerStorage.upgradeStatus.set(e)},enumerable:!0,configurable:!0}),e.prototype.initialize=function(e,t){var n=this;c.trace(m,"Initializing VersionsManager"),this.onVersionReady=t.onVersionReady||function(){},this.onUpgradeFinished=t.onUpgradeFinished||function(e){},this.onNewVersionDetected=!this.isUpgradeDisabled&&t.onNewVersionDetected||function(e){return Promise.resolve(null)};var i=t.onAppInfoReady||function(e){};this.initialUpgradeStatus=this.upgradeStatus;var o=r.getHomeModuleName();return o?(this.enableBackgroundCheckForNewVersions(),this.fetchApplicationManifest().then(function(t){if(n.pendingAppInfo=t,i(t),s.configure(n.buildScriptMap(t.manifest.urlVersions)),n.isNewVersion(t.manifest.versionToken)){if(!n.isUpgradeDisabled&&n.usingStaleIndex(t))return a.reloadCurrentLocation(!0),c.trace(m,"Reloading application - index.html was changed in the server"),!1;n.upgrade(t,e)}else n.initDataModel(e);return!0})):Promise.reject(Error("Home module not defined!"))},e.prototype.initDataModel=function(e){var t=this;c.trace(m,"Initializing data model"),e.then(function(e){return t.upgradeDataModel(e).then(function(){return t.switchDataModel(e)}).then(function(){t.onVersionReady()})}).then(function(){return t.setUpgradeStatus(0)})["catch"](function(e){return t.handleInitError(e)})},e.prototype.cacheResourcesInBackground=function(e){var t=this;return c.trace(m,"Caching resources in the background..."),this.fetchApplicationManifest(!1).then(function(n){var r=t.usingStaleIndex(n);return e&&e(r),a.forceReloadOnNextNavigation(r),t.isNewVersion(n.manifest.versionToken)?t.upgradeResources(n):void 0})["catch"](function(e){return c.trace(m,"Error caching resources for new version in the background: "+e)})},e.prototype.buildURLFromVersionedResource=function(e,t){return""+e+t},e.prototype.getBaseUrlFromRelativeUrl=function(e,t){return"/"+t+"/"+e},e.prototype.getResourceVersionToken=function(e,t){return this.currentAppInfo?this.getResourceVersionTokenFromManifest(e,t,this.currentAppInfo.manifest.urlVersions):void 0},e.prototype.getResourceVersionTokenFromManifest=function(e,t,n){return n[this.getBaseUrlFromRelativeUrl(e,t)]},e.prototype.isNewVersion=function(e){return e!==this.getLastApplicationVersionToken()},e.prototype.getLastApplicationVersionToken=function(e){if(void 0===e&&(e=!1),e&&this.pendingAppInfo)return this.pendingAppInfo.manifest.versionToken;var t=this.cachedAppInfo;return t?t.manifest.versionToken:""},e.prototype.getVersionToken=function(e,t){return this.getResourceVersionToken(e,t)},e.prototype.getVersionedUrl=function(e,t){var n=this.getVersionToken(e,t);return n?this.buildURLFromVersionedResource(this.getBaseUrlFromRelativeUrl(e,t),n):e},e.prototype.buildScriptMap=function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var i=t[r],o=e[i];if(/\.js$/.exec(i)){var a=i.substring(i.lastIndexOf("/")+1,i.lastIndexOf(".js"));n.hasOwnProperty(a)||(n[a]=this.buildURLFromVersionedResource(i,o))}}return n},e.getJSONParseErrorMessage=function(e){return void 0===e&&(e=""),"Error parsing manifest JSON "+(e?", missing or invalid field: "+e+".":".")},e.validateApplicationInfo=function(e){if(!e)throw Error(this.getJSONParseErrorMessage());if(!e.manifest)throw Error(this.getJSONParseErrorMessage("manifest"));var t=e.manifest;if(!t.versionToken||"string"!=typeof t.versionToken)throw Error(this.getJSONParseErrorMessage("manifest.versionToken"));if(!t.urlVersions||"object"!=typeof t.urlVersions)throw Error(this.getJSONParseErrorMessage("manifest.urlVersions"));if(!t.urlMappings||"object"!=typeof t.urlMappings)throw Error(this.getJSONParseErrorMessage("manifest.urlMappings"));if(!t.urlMappingsNoCache||"object"!=typeof t.urlMappingsNoCache)throw Error(this.getJSONParseErrorMessage("manifest.urlMappingsNoCache"));if(!e.data)throw Error(this.getJSONParseErrorMessage("data"));var n=e.data;if(!n.modules||"object"!=typeof n.modules)throw Error(this.getJSONParseErrorMessage("data.modules"))},e.prototype.getLatestVersionFromServer=function(e){return void 0===e&&(e=!1),e&&OSManifestLoader.prefetchedVersion||OSManifestLoader.getLatestVersion(r.getPersonalAreaName())},e.prototype.checkForNewVersion=function(){var e=this;this.isUpgradeDisabled||this.isUpgradingVersion||!t.VersionsManagerStorage.applicationInfo.isDefined()||this.getLatestVersionFromServer(!1).then(function(t){e.getLastApplicationVersionToken()!==t&&e.onNewVersionDetected(!1)},function(e){c.trace(m,"Error checking for new version: "+e)})},e.prototype.upgrade=function(e,t){var n=this;c.trace(m,"New application version detected, starting upgrade..."),this.setUpgradeStatus(1);var i=r.isWebApplication()&&!r.getHomeModuleDefinition().splashScreenName?Promise.resolve():this.upgradeResources(e)["catch"](function(e){return n.handleUpgradeError(e,1,Promise.resolve(void 0))}),o=t.then(function(e){return n.upgradeDataModel(e)})["catch"](function(e){return n.handleUpgradeError(e,2,i)});Promise.all([i,o]).then(function(){1===n.upgradeStatus&&n.commitNewVersion(e,t).then(function(e){e&&n.onVersionReady()})})["catch"](function(e){return n.handleUpgradeError(e)})},e.prototype.commitNewVersion=function(e,t){var n=this;return t.then(function(e){return n.switchDataModel(e)}).then(function(){return n.switchResourcesVersion(e.manifest.versionToken)}).then(function(){var t=!n.cachedAppInfo;return n.cachedAppInfo=e,n.setUpgradeStatus(t?0:2),!0})},e.prototype.upgradeResources=function(e){return f.start("VersionsManager upgradeResources"),u.tryFinally(function(){return o.ResourceCache.start(e.manifest)},function(){return f.end("VersionsManager upgradeResources")})},e.prototype.upgradeDataModel=function(e){var t=this;return f.start("VersionsManager upgradeDataModel"),u.tryFinally(function(){return t.doForEachClientEntitiesModule(e,function(e,t){return t.init(e)})},function(){return f.end("VersionsManager upgradeDataModel")})},e.prototype.doForEachClientEntitiesModule=function(e,t){if(e.isMock)return Promise.resolve();var n=r.getClientEntitiesModules(),i=[];return u.forEachAsync(n,function(e){return u.promise(function(t,n){requirejs([e],function(e){i.push(e),t()},n)})}).then(function(){return e.executeTransaction(function(e){return e.feed(null).andThenAll(function(e){return i.map(function(e){return function(n){return t(n,e)}})})})})},e.prototype.switchResourcesVersion=function(e){o.ResourceCache["switch"](e)},e.prototype.switchDataModel=function(e){return this.doForEachClientEntitiesModule(e,function(e,t){return t["switch"](e)})},e.prototype.handleInitError=function(e){var t=this.isUpgradeDisabled?"Upgrade failed and rollback isn't possible at this time":"Unable to load the data model";c.error(m,t,e),l.handleError(e)},e.prototype.handleUpgradeError=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Promise.resolve(void 0)),p.isInstanceOf(e,p.Exceptions.OpenDatabaseException)?(c.error(m,"Upgrade failed - unable to open the database.",e),l.handleError(e),Promise.resolve(void 0)):a.hasPendingReload()||3===this.initialUpgradeStatus?3===this.initialUpgradeStatus?(l.handleError(e),Promise.resolve(void 0)):(c.trace(m,"Upgrade failed - ignoring error due to concurrent navigation."),3!==this.upgradeStatus&&this.setUpgradeStatus(0),Promise.resolve(void 0)):(c.error(m,"Upgrade failed - rolling back to previous application version.",e),this.rollBackApplicationVersion(t,n))},Object.defineProperty(e.prototype,"isUpgradingVersion",{get:function(){return 1===this.upgradeStatus},enumerable:!0,configurable:!0}),e.prototype.setUpgradeStatus=function(e,t){return void 0===t&&(t=0),this.upgradeStatus=e,c.trace(m,"Upgrade status changed to: "+e),2===e?this.onUpgradeFinished(!0):3===e?this.onUpgradeFinished(!1,t):void 0},e.prototype.rollBackApplicationVersion=function(e,t){var n=this;return this.loadCachedManifest().then(function(r){return n.setUpgradeStatus(3,e),1!==e?t.then(function(){return o.ResourceCache.start(r.manifest)}):void 0}).then(function(){a.reloadApplication(!1)})["catch"](function(e){l.handleError(e)})},Object.defineProperty(e.prototype,"isUpgradeDisabled",{get:function(){return 3===this.upgradeStatus},enumerable:!0,configurable:!0}),e.prototype.usingStaleIndex=function(e){if(a.currentLocationHasTimestamp())return!1;var t=OSManifestLoader.indexVersionToken||this.getIndexVersion(this.cachedAppInfo),n=this.getIndexVersion(e);return t!==n},e.prototype.getIndexVersion=function(e){if(!e)return"";var t=this.getResourceVersionTokenFromManifest(y,r.getHomeModuleName(),e.manifest.urlVersions);return t?t.substr(1):""},e.prototype.loadCachedManifest=function(){var t=this;return this.ensureCachedManifest().then(function(){return t.cachedAppInfo?Promise.resolve(t.cachedAppInfo):OSManifestLoader.getCachedManifest(r.getPersonalAreaName()).then(function(t){return e.validateApplicationInfo(t),t})})},e.prototype.ensureCachedManifest=function(){return h.isRunningOnNative()||this.cachedAppInfo?Promise.resolve(void 0):(this.setUpgradeStatus(0),Promise.reject(new Error("No cached manifest found. It's not possible to rollback to a previous version.")))},e.prototype.getLatestManifestFromServer=function(t,n){return OSManifestLoader.getLatestManifest(t,n).then(function(t){return e.validateApplicationInfo(t),t})},e.prototype.fetchApplicationManifest=function(e){var t=this;return void 0===e&&(e=!0),f.start("VersionsManager fetchApplicationManifest"),this.isUpgradeDisabled?this.loadCachedManifest():this.getLatestVersionFromServer(e).then(function(e){return t.isNewVersion(e)?t.getLatestManifestFromServer(e,r.getPersonalAreaName()):t.loadCachedManifest()})["catch"](function(){return t.loadCachedManifest()}).then(function(e){return f.end("VersionsManager fetchApplicationManifest"),e})},e.prototype.enableBackgroundCheckForNewVersions=function(){var e=this,t=!1;d.EventDispatcher.listen(d.EventType.NavigationStart,function(){return t=!0}),d.EventDispatcher.listen(d.EventType.TransitionEnd,function(){t=!1,setTimeout(function(){t||e.checkForNewVersion()},1e3)})},e}();t.VersionsManager=b;var T=new b;t["default"]=T,T["default"]=T,T.VersionsManagerStorage=t.VersionsManagerStorage,n.exports=T}),define("OutSystems/ClientRuntime/FeedbackMessageService",["require","exports"],function(e,t){"use strict";function n(e){a=e,s&&(s(),s=null)}function r(e){u=e}function i(e,t,n,r,i,o){if(void 0===n&&(n=!0),void 0===r&&(r=""),void 0===i&&(i=!0),u){var c=function(){return a.showMessage(e,t,n,r,i,o)};a?c():s=c}}function o(){if(u){var e=function(){return a.closeMessage()};a?e():s=null}}Object.defineProperty(t,"__esModule",{value:!0});var a,s,u=!0;t.registerFeedbackMessageService=n,t.setEnabled=r,t.showFeedbackMessage=i,t.closeFeedbackMessage=o}),define("OutSystems/ClientRuntime/CookiesManager",["require","exports"],function(e,t){"use strict";function n(e){o=e}function r(){return o?o.getCookies():document.cookie}function i(e){for(var t=e+"=",n=r().split(";"),i=0;i<n.length;i++){for(var o=n[i];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return decodeURIComponent(o.substring(t.length,o.length))}return null}Object.defineProperty(t,"__esModule",{value:!0});var o;t.initialize=n,t.readCookie=i}),define("OutSystems/ClientRuntime/Communication",["require","exports","tslib","./Flow","./Request","./Exceptions","./CookiesManager","./ClientInfo"],function(e,t,n,r,i,o,a,s){"use strict";function u(){var e=0,t=9007199254740991;return Math.floor(Math.random()*(t-e+1))+e}function c(e){w&&w(e)}function l(e,t){return void 0===t&&(t="POST"),n.__awaiter(this,void 0,void 0,function(){var r;return n.__generator(this,function(n){switch(n.label){case 0:return[4,i.createNewHttpRequest(t,e)];case 1:return r=n.sent(),r.setHeader(D.CSRFHeader,D.getCSRFToken()),r.setHeader("Content-Type","application/json; charset=UTF-8"),r.setHeader("Accept","application/json"),[2,r]}})})}function f(e,t){return r.promise(function(n,r){var i="/"+t+"/moduleservices/checkrequestsuspended?requestToken="+e;l(i,"GET").then(function(e){var t=function(){return n(!1)};e.onSuccess=function(e){200===e.statusCode?n(JSON.parse(e.responseText)):t()},e.onTimeout=t,e.onError=t,e.onAbort=t,e.setTimeout(1e4),e.send()})["catch"](r)})}function d(e,t,n,r,i){if(r)if(i){var o=u().toString(),a=setTimeout(function(){e.isDone()||f(o,n).then(function(t){t||(e.abort(),e.onTimeout(null))})},1e3*r);e.onFinish=function(){clearTimeout(a)},e.setHeader(I+"Request-Token",o)}else e.setTimeout(1e3*r);e.setBody(t),e.send()}function p(e,t,n){void 0===n&&(n=!1);var r=n?" (request aborted)":"";return"Unable to access '"+e+"'"+r+". Error Code: "+t}function h(e,t,n,r,o){return void 0===t&&(t=void 0),void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=!0),new Promise(function(a,s){if(n&&"undefined"!=typeof navigator&&!navigator.onLine)return s("Unable to access '"+e+"' - There's no network connection.");var u=o?"":"?"+(new Date).getTime();i.createNewHttpRequest("GET",e+u).then(function(n){n.onSuccess=function(t){if(!t.complete||200!==t.statusCode)return s(p(e,t.statusCode));var n;if(r){try{n=JSON.parse(t.responseText.substring(t.responseText.indexOf("{"),t.responseText.length))}catch(i){return s(i)}if(!n)return s(Error("Unable to parse payload downloaded from '"+e+"'."))}a(n)},n.onError=n.onTimeout=function(t){return s(Error(p(e,t.statusCode)))},n.onAbort=function(t){return s(Error(p(e,t.statusCode,!0)))},t&&n.setTimeout(t),n.setHeader("Accept","application/json"),y(n),n.send()})["catch"](s)})}function g(e,t,n,i,a,s,u,f,p){return void 0===i&&(i=void 0),void 0===u&&(u=!1),void 0===f&&(f=0),r.promise(function(r,h){var g=e+f,m=u?N.startTracking(g):-1;l(e).then(function(l){l.onSuccess=function(t){if(u)try{var n=N.getRequestInfo(m,g);if(n.isOutOfOrder)return h(new o.Exceptions.OutOfOrderException("Response out of endpoint order: Endpoint= "+e+" Last= "+n.lastRequestId+" Got= "+m))}finally{N.stopTracking(g)}var i=200===t.statusCode,a=503===t.statusCode&&"application/json"===t.getHeader("Content-Type");if(!i&&!a)return void(404===t.statusCode?(c(!0),h(new o.Exceptions.ViewHasChangedException)):h(new o.Exceptions.CommunicationException("Request failed with status "+t.statusCode)));try{var l=JSON.parse(t.responseText);if(!a){if(l.versionInfo&&l.versionInfo.hasModuleVersionChanged){if(l.versionInfo.hasApiVersionChanged)return c(!0),void h(new o.Exceptions.ViewHasChangedException);c(!1)}if(s){var f=b(t);s(l,f)}}l.exception?h(o.getException(l.exception)):r(l.data)}catch(d){h(d)}},l.onError=function(){h(new o.Exceptions.CommunicationException("Request failed with an error"))},void 0!==i&&(l.onTimeout=function(){a&&a(),h(new o.Exceptions.CommunicationException("The connection has timed out"))}),v(l,p),y(l),d(l,JSON.stringify(t),n,i,x)})["catch"](h)})}function m(e){return r.promise(function(t,n){var r="moduleservices/log",i=(new Date).getTime();l(r+"?clientTimeInMillis="+i).then(function(i){i.onSuccess=function(e){200===e.statusCode?t(!0):n(new o.Exceptions.CommunicationException("Logger: Error sending log to "+r+". Error Code: "+e.statusCode))},i.onError=function(e){n(new o.Exceptions.CommunicationException("Logger: Error sending log to "+r+". Error Code: "+e.statusCode))},i.onAbort=function(e){n(new o.Exceptions.CommunicationException("Logger: Error sending log to "+r+" (Aborted). Error Code: "+e.statusCode))},i.onTimeout=function(e){n(new o.Exceptions.CommunicationException("Logger: Error sending log to "+r+" (Timeout)."))},i.setTimeout(S),y(i),i.setBody(JSON.stringify(e)),i.send()})["catch"](n)})}function y(e){var t=s.getClientInfo();t&&t.device&&t.device.uuid&&e.setHeader(I+"device-uuid",t.device.uuid)}function v(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&e.setHeader(I+n,t[n])}function b(e){var t={};if(!e)return t;var n=e.headers||{};return Object.keys(n).filter(function(e){return!!e.match(_)}).reduce(function(e,t){var r=t.substr(I.length),i=n[t];return e[r]=i,e},t)}function T(e,t,n){x=e,t&&(E=t),n&&(w=n)}Object.defineProperty(t,"__esModule",{value:!0});var E,w,D,S=1e4,I="OutSystems-",_=new RegExp("^"+I,"i"),x=!1;!function(e){function t(){var t=a.readCookie(E);if(null==t)return e.AnonymousCSRFToken;var n=/crf=([^;]+)/,r=t.match(n);if(null==r)throw new Error("Cookie format error: no 'crf' key found");return r[1]}e.CSRFHeader="X-CSRFToken",e.AnonymousCSRFToken="T6C+9iB49TLra4jEsMeSckDMNhQ=",e.getCSRFToken=t}(D=t.CSRF||(t.CSRF={}));var A;!function(e){function t(){var e="undefined"!=typeof window?window:global,t=e&&e.cordova&&e.navigator&&e.navigator.connection;return t?"none"!==e.navigator.connection.type:!0}function n(e){"undefined"!=typeof document&&document.addEventListener&&document.addEventListener("online",e,!1)}function r(e){"undefined"!=typeof document&&document.addEventListener&&document.addEventListener("offline",e,!1)}function i(e){var t="moduleservices/ping";return h(t,e,!0,!1)}e.isOnline=t,e.onOnline=n,e.onOffline=r,e.ping=i}(A||(A={})),t.NetworkStatus=A,t.get=h,t.post=g,t.postLog=m;var N;!function(e){function t(e){i++;var t=o[e];return t?(t.requestId=i,t.counter++):o[e]={requestId:i,counter:1},i}function n(e){var t=o[e];if(!t)throw new Error("There's no requestInfo for url : "+e);t.counter--,t.counter<=0&&delete o[e]}function r(e,t){var n=o[t];if(!n)throw new Error("There's no requestInfo for url : "+t);var r=n.requestId;return{isOutOfOrder:r>e,lastRequestId:r}}var i=0,o={};e.startTracking=t,e.stopTracking=n,e.getRequestInfo=r}(N||(N={})),t.initialize=T}),define("OutSystems/ClientRuntime/LightImmutable",["require","exports"],function(e,t){"use strict";function n(e){for(var t=e.length,n=new Array(t);t-- >0;)n[t]=e[t];return n}function r(e){var t=Object.keys(e),n="function ImmutableRecord"+i+"(o) { this._ = o || defaults }\n"+("function R"+i+"(o) {\n");t.forEach(function(e){return n+="this."+e+" = o."+e+";\n"}),n+="}\n";var r="switch(key){\n";t.forEach(function(e){r+='case "'+e+'": return this._.'+e+";\n"}),r+="}";var o="var clone = new R"+i+"(this._);\n";o+="switch (key) {\n",t.forEach(function(e){o+='case "'+e+'": clone.'+e+"=value;break;"}),o+="}\n",o+="return new ImmutableRecord"+i+"(clone);\n";var a="return {\n";a+=t.map(function(e){return e+": this._."+e}).join(",\n"),a+="\n};";var s=n+("ImmutableRecord"+i+".prototype.get = function(key){"+r+"};\n")+("ImmutableRecord"+i+".prototype.set = function(key,value){"+o+"};\n")+("ImmutableRecord"+i+".prototype.toJS = function(){"+a+"};\n")+("return ImmutableRecord"+i+";");return i++,new Function("defaults",s)(e)}Object.defineProperty(t,"__esModule",{value:!0});var i=0;t.defineRecordClass=r;var o=128,a=function(){function e(t,n){ if("undefined"!=typeof n)this._values=t,this._lengths=n;else if("undefined"!=typeof t){var r=e.fromJS(t);this._values=r._values,this._lengths=r._lengths}else this._values=[],this._lengths=[]}return e.prototype.clear=function(){return new e},e.prototype.clone=function(){return this},e.prototype.count=function(){for(var e=0,t=this._lengths.length;t-- >0;)e+=this._lengths[t];return e},e.prototype.isEmpty=function(){return 0===this._lengths.length},e.prototype.get=function(e){for(var t=0,n=e,r=this._lengths.length;r>t&&e>=0;){if(n<this._lengths[t])return this._values[t][n];n-=this._lengths[t],t++}},e.prototype.set=function(t,r){for(var i=0,o=t,a=n(this._values),s=this._lengths,u=s.length;u>i&&t>=0;){if(o<this._lengths[i])return a[i]=n(a[i]),a[i][o]=r,new e(a,s);o-=s[i],i++}},e.prototype.push=function(t){var r,i,a=this._values.length-1;0>a?(a=0,r=[[]],i=[0]):(r=n(this._values),i=n(this._lengths));var s=r[a];if(s.length<o){for(var u=s.length,c=new Array(u+1),l=u;l-- >0;)c[l]=s[l];c[u]=t,r[a]=c,i[a]++}else{var f=[t];r.push(f),i.push(1)}return new e(r,i)},e.prototype.insert=function(t,r){for(var i=0,a=t,s=n(this._values),u=n(this._lengths),c=u.length;c>i&&a>=0;){if(a<u[i]){if(u[i]===o){var l=o/2|0,f=o-l;u.splice(i,1,l,f);for(var d=new Array(l),p=new Array(f),h=0;l>h;h++)d[h]=s[i][h];for(var g=0,m=l;f>g;)p[g++]=s[i][m++];s.splice(i,1,d,p),c++;continue}for(var y=0,v=u[i],b=new Array(v+1),T=s[i];a>y;y++)b[y]=T[y];b[a]=r;for(var E=y+1;v>y;)b[E++]=T[y++];return u[i]++,s[i]=b,new e(s,u)}a-=u[i],i++}return u.push(1),s.push([r]),new e(s,u)},e.prototype.remove=function(t){for(var r=0,i=t,o=n(this._lengths),a=n(this._values),s=o.length;s>r&&i>=0;){if(i<o[r]){for(var u=--o[r],c=new Array(u),l=0,f=0;u>l;)l===i&&f++,c[l++]=a[r][f++];return a[r]=c,0===o[r]&&(o.splice(r,1),a.splice(r,1)),new e(a,o)}i-=o[r],r++}},e.prototype.reduce=function(e,t){for(var n=0;n<this._values.length;n++)for(var r=this._values[n],i=0;i<r.length;i++)t=e(t,r[i]);return t},e.prototype.map=function(e){for(var t=new Array(this.count()),n=0,r=0;r<this._values.length;r++)for(var i=this._values[r],o=0;o<i.length;o++)t[n]=e(i[o],n),n++;return t},e.prototype.pushAll=function(t){if(0===t.length)return this;var n=new e(t),r=this._values.concat(n._values),i=this._lengths.concat(n._lengths);return new e(r,i)},e.prototype.forEach=function(e){for(var t=0;t<this._values.length;t++)for(var n=this._values[t],r=0;r<n.length;r++)e(n[r])},e.prototype.addFromOther=function(t){if(0===t.count())return this;if(0===this._values.length)return t;for(var n=new Array(this._lengths.length+t._lengths.length),r=new Array(this._values.length+t._values.length),i=0,o=0;i<this._values.length;)r[i]=this._values[i],n[i]=this._lengths[i],i++;for(;o<t._values.length;)r[i]=t._values[o],n[i]=t._lengths[o],i++,o++;return new e(r,n)},e.fromJS=function(t){for(var n=0|Math.ceil(t.length/o),r=new Array(n),i=new Array(n),a=0,s=0,u=0;n>u;u++){s=t.length-a;var c=s>o?o:s;i[u]=c,r[u]=new Array(c);for(var l=0;c>l;l++)r[u][l]=t[a+l];a+=c}return new e(r,i)},e}();t.ImmutableList=a}),function(e,t){"function"==typeof define&&define.amd?define("long",[],t):"function"==typeof require&&"object"==typeof module&&module&&module.exports?module.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()}(this,function(){"use strict";function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return(e&&e.__isLong__)===!0}function n(e,t){var n,r,o;return t?(e>>>=0,(o=e>=0&&256>e)&&(r=u[e])?r:(n=i(e,0>(0|e)?-1:0,!0),o&&(u[e]=n),n)):(e|=0,(o=e>=-128&&128>e)&&(r=s[e])?r:(n=i(e,0>e?-1:0,!1),o&&(s[e]=n),n))}function r(e,t){if(isNaN(e)||!isFinite(e))return t?y:m;if(t){if(0>e)return y;if(e>=p)return w}else{if(-h>=e)return D;if(e+1>=h)return E}return 0>e?r(-e,t).neg():i(e%d|0,e/d|0,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return m;if("number"==typeof t?(n=t,t=!1):t=!!t,n=n||10,2>n||n>36)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return o(e.substring(1),t,n).neg();for(var a=r(c(n,8)),s=m,u=0;u<e.length;u+=8){var l=Math.min(8,e.length-u),f=parseInt(e.substring(u,u+l),n);if(8>l){var d=r(c(n,l));s=s.mul(d).add(r(f))}else s=s.mul(a),s=s.add(r(f))}return s.unsigned=t,s}function a(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):i(t.low,t.high,t.unsigned)}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var s={},u={};e.fromInt=n,e.fromNumber=r,e.fromBits=i;var c=Math.pow;e.fromString=o,e.fromValue=a;var l=65536,f=1<<24,d=l*l,p=d*d,h=p/2,g=n(f),m=n(0);e.ZERO=m;var y=n(0,!0);e.UZERO=y;var v=n(1);e.ONE=v;var b=n(1,!0);e.UONE=b;var T=n(-1);e.NEG_ONE=T;var E=i(-1,2147483647,!1);e.MAX_VALUE=E;var w=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=w;var D=i(0,-2147483648,!1);e.MIN_VALUE=D;var S=e.prototype;return S.toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},S.toString=function(e){if(e=e||10,2>e||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(D)){var t=r(e),n=this.div(t),i=n.mul(t).sub(this);return n.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=r(c(e,6),this.unsigned),a=this,s="";;){var u=a.div(o),l=a.sub(u.mul(o)).toInt()>>>0,f=l.toString(e);if(a=u,a.isZero())return f+s;for(;f.length<6;)f="0"+f;s=""+f+s}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(D)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},S.isZero=function(){return 0===this.high&&0===this.low},S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=0},S.isOdd=function(){return 1===(1&this.low)},S.isEven=function(){return 0===(1&this.low)},S.equals=function(e){return t(e)||(e=a(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},S.eq=S.equals,S.notEquals=function(e){return!this.eq(e)},S.neq=S.notEquals,S.lessThan=function(e){return this.comp(e)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(e){return this.comp(e)<=0},S.lte=S.lessThanOrEqual,S.greaterThan=function(e){return this.comp(e)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(e){return this.comp(e)>=0},S.gte=S.greaterThanOrEqual,S.compare=function(e){if(t(e)||(e=a(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(D)?D:this.not().add(v)},S.neg=S.negate,S.add=function(e){t(e)||(e=a(e));var n=this.high>>>16,r=65535&this.high,o=this.low>>>16,s=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,f=65535&e.low,d=0,p=0,h=0,g=0;return g+=s+f,h+=g>>>16,g&=65535,h+=o+l,p+=h>>>16,h&=65535,p+=r+c,d+=p>>>16,p&=65535,d+=n+u,d&=65535,i(h<<16|g,d<<16|p,this.unsigned)},S.subtract=function(e){return t(e)||(e=a(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){if(this.isZero())return m;if(t(e)||(e=a(e)),e.isZero())return m;if(this.eq(D))return e.isOdd()?D:m;if(e.eq(D))return this.isOdd()?D:m;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(g)&&e.lt(g))return r(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,o=65535&this.high,s=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,f=e.low>>>16,d=65535&e.low,p=0,h=0,y=0,v=0;return v+=u*d,y+=v>>>16,v&=65535,y+=s*d,h+=y>>>16,y&=65535,y+=u*f,h+=y>>>16,y&=65535,h+=o*d,p+=h>>>16,h&=65535,h+=s*f,p+=h>>>16,h&=65535,h+=u*l,p+=h>>>16,h&=65535,p+=n*d+o*f+s*l+u*c,p&=65535,i(y<<16|v,p<<16|h,this.unsigned)},S.mul=S.multiply,S.divide=function(e){if(t(e)||(e=a(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:m;var n,i,o;if(this.unsigned)e.unsigned||(e=e.toUnsigned());else{if(this.eq(D)){if(e.eq(v)||e.eq(T))return D;if(e.eq(D))return v;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(m)?e.isNegative()?v:T:(i=this.sub(e.mul(n)),o=n.add(i.div(e)))}if(e.eq(D))return this.unsigned?y:m;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg()}if(this.unsigned){if(e.gt(this))return y;if(e.gt(this.shru(1)))return b;o=y}else o=m;for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var u=Math.ceil(Math.log(n)/Math.LN2),l=48>=u?1:c(2,u-48),f=r(n),d=f.mul(e);d.isNegative()||d.gt(i);)n-=l,f=r(n,this.unsigned),d=f.mul(e);f.isZero()&&(f=v),o=o.add(f),i=i.sub(d)}return o},S.div=S.divide,S.modulo=function(e){return t(e)||(e=a(e)),this.sub(this.div(e).mul(e))},S.mod=S.modulo,S.not=function(){return i(~this.low,~this.high,this.unsigned)},S.and=function(e){return t(e)||(e=a(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return t(e)||(e=a(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return t(e)||(e=a(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},S.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0===(e&=63)?this:32>e?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(0,this.low<<e-32,this.unsigned)},S.shl=S.shiftLeft,S.shiftRight=function(e){return t(e)&&(e=e.toInt()),0===(e&=63)?this:32>e?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),e&=63,0===e)return this;var n=this.high;if(32>e){var r=this.low;return i(r>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?i(n,0,this.unsigned):i(n>>>e-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},e}),!function(e){"use strict";function t(e){var t,n,r,i=e.length-1,o="",a=e[0];if(i>0){for(o+=a,t=1;i>t;t++)r=e[t]+"",n=Le-r.length,n&&(o+=d(n)),o+=r;a=e[t],r=a+"",n=Le-r.length,n&&(o+=d(n))}else if(0===a)return"0";for(;a%10===0;)a/=10;return o+a}function n(e,t,n){if(e!==~~e||t>e||e>n)throw Error(De+e)}function r(e,t,n,r){var i,o,a,s;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=Le,i=0):(i=Math.ceil((t+1)/Le),t%=Le),o=xe(10,Le-t),s=e[i]%o|0,null==r?3>t?(0==t?s=s/100|0:1==t&&(s=s/10|0),a=4>n&&99999==s||n>3&&49999==s||5e4==s||0==s):a=(4>n&&s+1==o||n>3&&s+1==o/2)&&(e[i+1]/o/100|0)==xe(10,t-2)-1||(s==o/2||0==s)&&0==(e[i+1]/o/100|0):4>t?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),a=(r||4>n)&&9999==s||!r&&n>3&&4999==s):a=((r||4>n)&&s+1==o||!r&&n>3&&s+1==o/2)&&(e[i+1]/o/1e3|0)==xe(10,t-3)-1,a}function i(e,t,n){for(var r,i,o=[0],a=0,s=e.length;s>a;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=ye.indexOf(e.charAt(a++)),r=0;r<o.length;r++)o[r]>n-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function o(e,t){var n,r,i=t.d.length;32>i?(n=Math.ceil(i/3),r=Math.pow(4,-n).toString()):(n=16,r="2.3283064365386962890625e-10"),e.precision+=n,t=w(e,1,t.times(r),new e(1));for(var o=n;o--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=n,t}function a(e,t,n,r){var i,o,a,s,u,c,l,f,d,p=e.constructor;e:if(null!=t){if(f=e.d,!f)return e;for(i=1,s=f[0];s>=10;s/=10)i++;if(o=t-i,0>o)o+=Le,a=t,l=f[d=0],u=l/xe(10,i-a-1)%10|0;else if(d=Math.ceil((o+1)/Le),s=f.length,d>=s){if(!r)break e;for(;s++<=d;)f.push(0);l=u=0,i=1,o%=Le,a=o-Le+1}else{for(l=s=f[d],i=1;s>=10;s/=10)i++;o%=Le,a=o-Le+i,u=0>a?0:l/xe(10,i-a-1)%10|0}if(r=r||0>t||void 0!==f[d+1]||(0>a?l:l%xe(10,i-a-1)),c=4>n?(u||r)&&(0==n||n==(e.s<0?3:2)):u>5||5==u&&(4==n||r||6==n&&(o>0?a>0?l/xe(10,i-a):0:f[d-1])%10&1||n==(e.s<0?8:7)),1>t||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=xe(10,(Le-t%Le)%Le),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=d,s=1,d--):(f.length=d+1,s=xe(10,Le-o),f[d]=a>0?(l/xe(10,i-a)%xe(10,a)|0)*s:0),c)for(;;){if(0==d){for(o=1,a=f[0];a>=10;a/=10)o++;for(a=f[0]+=s,s=1;a>=10;a/=10)s++;o!=s&&(e.e++,f[0]==Re&&(f[0]=1));break}if(f[d]+=s,f[d]!=Re)break;f[d--]=0,s=1}for(o=f.length;0===f[--o];)f.pop()}return Ee&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}function s(e,n,r){if(!e.isFinite())return v(e);var i,o=e.e,a=t(e.d),s=a.length;return n?(r&&(i=r-s)>0?a=a.charAt(0)+"."+a.slice(1)+d(i):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):0>o?(a="0."+d(-o-1)+a,r&&(i=r-s)>0&&(a+=d(i))):o>=s?(a+=d(o+1-s),r&&(i=r-o-1)>0&&(a=a+"."+d(i))):((i=o+1)<s&&(a=a.slice(0,i)+"."+a.slice(i)),r&&(i=r-s)>0&&(o+1===s&&(a+="."),a+=d(i))),a}function u(e,t){var n=e[0];for(t*=Le;n>=10;n/=10)t++;return t}function c(e,t,n){if(t>Pe)throw Ee=!0,n&&(e.precision=n),Error(Se);return a(new e(ve),t,1,!0)}function l(e,t,n){if(t>Fe)throw Error(Se);return a(new e(be),t,n,!0)}function f(e){var t=e.length-1,n=t*Le+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function d(e){for(var t="";e--;)t+="0";return t}function p(e,t,n,r){var i,o=new e(1),a=Math.ceil(r/Le+4);for(Ee=!1;;){if(n%2&&(o=o.times(t),I(o.d,a)&&(i=!0)),n=_e(n/2),0===n){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}t=t.times(t),I(t.d,a)}return Ee=!0,o}function h(e){return 1&e.d[e.d.length-1]}function g(e,t,n){for(var r,i=new e(t[0]),o=0;++o<t.length;){if(r=new e(t[o]),!r.s){i=r;break}i[n](r)&&(i=r)}return i}function m(e,n){var i,o,s,u,c,l,f,d=0,p=0,h=0,g=e.constructor,m=g.rounding,y=g.precision;if(!e.d||!e.d[0]||e.e>17)return new g(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==n?(Ee=!1,f=y):f=n,l=new g(.03125);e.e>-2;)e=e.times(l),h+=5;for(o=Math.log(xe(2,h))/Math.LN10*2+5|0,f+=o,i=u=c=new g(1),g.precision=f;;){if(u=a(u.times(e),f,1),i=i.times(++p),l=c.plus(Ue(u,i,f,1)),t(l.d).slice(0,f)===t(c.d).slice(0,f)){for(s=h;s--;)c=a(c.times(c),f,1);if(null!=n)return g.precision=y,c;if(!(3>d&&r(c.d,f-o,m,d)))return a(c,g.precision=y,m,Ee=!0);g.precision=f+=10,i=u=l=new g(1),p=0,d++}c=l}}function y(e,n){var i,o,s,u,l,f,d,p,h,g,m,v=1,b=10,T=e,E=T.d,w=T.constructor,D=w.rounding,S=w.precision;if(T.s<0||!E||!E[0]||!T.e&&1==E[0]&&1==E.length)return new w(E&&!E[0]?-1/0:1!=T.s?NaN:E?0:T);if(null==n?(Ee=!1,h=S):h=n,w.precision=h+=b,i=t(E),o=i.charAt(0),!(Math.abs(u=T.e)<15e14))return p=c(w,h+2,S).times(u+""),T=y(new w(o+"."+i.slice(1)),h-b).plus(p),w.precision=S,null==n?a(T,S,D,Ee=!0):T;for(;7>o&&1!=o||1==o&&i.charAt(1)>3;)T=T.times(e),i=t(T.d),o=i.charAt(0),v++;for(u=T.e,o>1?(T=new w("0."+i),u++):T=new w(o+"."+i.slice(1)),g=T,d=l=T=Ue(T.minus(1),T.plus(1),h,1),m=a(T.times(T),h,1),s=3;;){if(l=a(l.times(m),h,1),p=d.plus(Ue(l,new w(s),h,1)),t(p.d).slice(0,h)===t(d.d).slice(0,h)){if(d=d.times(2),0!==u&&(d=d.plus(c(w,h+2,S).times(u+""))),d=Ue(d,new w(v),h,1),null!=n)return w.precision=S,d;if(!r(d.d,h-b,D,f))return a(d,w.precision=S,D,Ee=!0);w.precision=h+=b,p=l=T=Ue(g.minus(1),g.plus(1),h,1),m=a(T.times(T),h,1),s=f=1}d=p,s+=2}}function v(e){return String(e.s*e.s/0)}function b(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(0>n&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):0>n&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%Le,0>n&&(r+=Le),i>r){for(r&&e.d.push(+t.slice(0,r)),i-=Le;i>r;)e.d.push(+t.slice(r,r+=Le));t=t.slice(r),r=Le-t.length}else r-=i;for(;r--;)t+="0";e.d.push(+t),Ee&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function T(e,t){var n,r,o,a,s,c,l,f,d;if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Ne.test(t))n=16,t=t.toLowerCase();else if(Ae.test(t))n=2;else{if(!Ce.test(t))throw Error(De+t);n=8}for(a=t.search(/p/i),a>0?(l=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),a=t.indexOf("."),s=a>=0,r=e.constructor,s&&(t=t.replace(".",""),c=t.length,a=c-a,o=p(r,new r(n),a,2*a)),f=i(t,n,Re),d=f.length-1,a=d;0===f[a];--a)f.pop();return 0>a?new r(0*e.s):(e.e=u(f,d),e.d=f,Ee=!1,s&&(e=Ue(e,o,4*c)),l&&(e=e.times(Math.abs(l)<54?Math.pow(2,l):fe.pow(2,l))),Ee=!0,e)}function E(e,t){var n,r=t.d.length;if(3>r)return w(e,2,t,t);n=1.4*Math.sqrt(r),n=n>16?16:0|n,t=t.times(Math.pow(5,-n)),t=w(e,2,t,t);for(var i,o=new e(5),a=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(a.times(i).minus(s))));return t}function w(e,t,n,r,i){var o,a,s,u,c=1,l=e.precision,f=Math.ceil(l/Le);for(Ee=!1,u=n.times(n),s=new e(r);;){if(a=Ue(s.times(u),new e(t++*t++),l,1),s=i?r.plus(a):r.minus(a),r=Ue(a.times(u),new e(t++*t++),l,1),a=s.plus(r),void 0!==a.d[f]){for(o=f;a.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=r,r=a,a=o,c++}return Ee=!0,a.d.length=f+1,a}function D(e,t){var n,r=t.s<0,i=l(e,e.precision,1),o=i.times(.5);if(t=t.abs(),t.lte(o))return he=r?4:1,t;if(n=t.divToInt(i),n.isZero())he=r?3:2;else{if(t=t.minus(n.times(i)),t.lte(o))return he=h(n)?r?2:3:r?4:1,t;he=h(n)?r?1:4:r?3:2}return t.minus(i).abs()}function S(e,t,r,o){var a,u,c,l,f,d,p,h,g,m=e.constructor,y=void 0!==r;if(y?(n(r,1,me),void 0===o?o=m.rounding:n(o,0,8)):(r=m.precision,o=m.rounding),e.isFinite()){for(p=s(e),c=p.indexOf("."),y?(a=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):a=t,c>=0&&(p=p.replace(".",""),g=new m(1),g.e=p.length-c,g.d=i(s(g),10,a),g.e=g.d.length),h=i(p,10,a),u=f=h.length;0==h[--f];)h.pop();if(h[0]){if(0>c?u--:(e=new m(e),e.d=h,e.e=u,e=Ue(e,g,r,o,0,a),h=e.d,u=e.e,d=de),c=h[r],l=a/2,d=d||void 0!==h[r+1],d=4>o?(void 0!==c||d)&&(0===o||o===(e.s<0?3:2)):c>l||c===l&&(4===o||d||6===o&&1&h[r-1]||o===(e.s<0?8:7)),h.length=r,d)for(;++h[--r]>a-1;)h[r]=0,r||(++u,h.unshift(1));for(f=h.length;!h[f-1];--f);for(c=0,p="";f>c;c++)p+=ye.charAt(h[c]);if(y){if(f>1)if(16==t||8==t){for(c=16==t?4:3,--f;f%c;f++)p+="0";for(h=i(p,a,t),f=h.length;!h[f-1];--f);for(c=1,p="1.";f>c;c++)p+=ye.charAt(h[c])}else p=p.charAt(0)+"."+p.slice(1);p=p+(0>u?"p":"p+")+u}else if(0>u){for(;++u;)p="0"+p;p="0."+p}else if(++u>f)for(u-=f;u--;)p+="0";else f>u&&(p=p.slice(0,u)+"."+p.slice(u))}else p=y?"0p+0":"0";p=(16==t?"0x":2==t?"0b":8==t?"0o":"")+p}else p=v(e);return e.s<0?"-"+p:p}function I(e,t){return e.length>t?(e.length=t,!0):void 0}function _(e){return new this(e).abs()}function x(e){return new this(e).acos()}function A(e){return new this(e).acosh()}function N(e,t){return new this(e).plus(t)}function C(e){return new this(e).asin()}function O(e){return new this(e).asinh()}function R(e){return new this(e).atan()}function L(e){return new this(e).atanh()}function M(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?l(this,r,i):new this(0),n.s=e.s):!e.d||t.isZero()?(n=l(this,o,1).times(.5),n.s=e.s):t.s<0?(this.precision=o,this.rounding=1,n=this.atan(Ue(e,t,o,1)),t=l(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(Ue(e,t,o,1)):(n=l(this,o,1).times(t.s>0?.25:.75),n.s=e.s):n=new this(NaN),n}function P(e){return new this(e).cbrt()}function F(e){return a(e=new this(e),e.e+1,2)}function V(e){if(!e||"object"!=typeof e)throw Error(we+"Object expected");var t,n,r,i=e.defaults===!0,o=["precision",1,me,"rounding",0,8,"toExpNeg",-ge,0,"toExpPos",0,ge,"maxE",0,ge,"minE",-ge,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],i&&(this[n]=Te[n]),void 0!==(r=e[n])){if(!(_e(r)===r&&r>=o[t+1]&&r<=o[t+2]))throw Error(De+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=Te[n]),void 0!==(r=e[n])){if(r!==!0&&r!==!1&&0!==r&&1!==r)throw Error(De+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(Ie);this[n]=!0}else this[n]=!1}return this}function U(e){return new this(e).cos()}function j(e){return new this(e).cosh()}function k(e){function t(e){var n,r,i,o=this;if(!(o instanceof t))return new t(e);if(o.constructor=t,e instanceof t)return o.s=e.s,o.e=e.e,void(o.d=(e=e.d)?e.slice():e);if(i=typeof e,"number"===i){if(0===e)return o.s=0>1/e?-1:1,o.e=0,void(o.d=[0]);if(0>e?(e=-e,o.s=-1):o.s=1,e===~~e&&1e7>e){for(n=0,r=e;r>=10;r/=10)n++;return o.e=n,void(o.d=[e])}return 0*e!==0?(e||(o.s=NaN),o.e=NaN,void(o.d=null)):b(o,e.toString())}if("string"!==i)throw Error(De+e);return 45===e.charCodeAt(0)?(e=e.slice(1),o.s=-1):o.s=1,Oe.test(e)?b(o,e):T(o,e)}var n,r,i;if(t.prototype=Ve,t.ROUND_UP=0,t.ROUND_DOWN=1,t.ROUND_CEIL=2,t.ROUND_FLOOR=3,t.ROUND_HALF_UP=4,t.ROUND_HALF_DOWN=5,t.ROUND_HALF_EVEN=6,t.ROUND_HALF_CEIL=7,t.ROUND_HALF_FLOOR=8,t.EUCLID=9,t.config=t.set=V,t.clone=k,t.isDecimal=W,t.abs=_,t.acos=x,t.acosh=A,t.add=N,t.asin=C,t.asinh=O,t.atan=R,t.atanh=L,t.atan2=M,t.cbrt=P,t.ceil=F,t.cos=U,t.cosh=j,t.div=B,t.exp=q,t.floor=H,t.hypot=G,t.ln=z,t.log=J,t.log10=Q,t.log2=K,t.max=X,t.min=Y,t.mod=$,t.mul=Z,t.pow=ee,t.random=te,t.round=ne,t.sign=re,t.sin=ie,t.sinh=oe,t.sqrt=ae,t.sub=se,t.tan=ue,t.tanh=ce,t.trunc=le,void 0===e&&(e={}),e&&e.defaults!==!0)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],n=0;n<i.length;)e.hasOwnProperty(r=i[n++])||(e[r]=this[r]);return t.config(e),t}function B(e,t){return new this(e).div(t)}function q(e){return new this(e).exp()}function H(e){return a(e=new this(e),e.e+1,3)}function G(){var e,t,n=new this(0);for(Ee=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return Ee=!0,new this(1/0);n=t}return Ee=!0,n.sqrt()}function W(e){return e instanceof fe||e&&"[object Decimal]"===e.name||!1}function z(e){return new this(e).ln()}function J(e,t){return new this(e).log(t)}function K(e){return new this(e).log(2)}function Q(e){return new this(e).log(10)}function X(){return g(this,arguments,"lt")}function Y(){return g(this,arguments,"gt")}function $(e,t){return new this(e).mod(t)}function Z(e,t){return new this(e).mul(t)}function ee(e,t){return new this(e).pow(t)}function te(e){var t,r,i,o,a=0,s=new this(1),u=[];if(void 0===e?e=this.precision:n(e,1,me),i=Math.ceil(e/Le),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(i));i>a;)o=t[a],o>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:u[a++]=o%1e7;else{if(!crypto.randomBytes)throw Error(Ie);for(t=crypto.randomBytes(i*=4);i>a;)o=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((127&t[a+3])<<24),o>=214e7?crypto.randomBytes(4).copy(t,a):(u.push(o%1e7),a+=4);a=i/4}else for(;i>a;)u[a++]=1e7*Math.random()|0;for(i=u[--a],e%=Le,i&&e&&(o=xe(10,Le-e),u[a]=(i/o|0)*o);0===u[a];a--)u.pop();if(0>a)r=0,u=[0];else{for(r=-1;0===u[0];r-=Le)u.shift();for(i=1,o=u[0];o>=10;o/=10)i++;Le>i&&(r-=Le-i)}return s.e=r,s.d=u,s}function ne(e){return a(e=new this(e),e.e+1,this.rounding)}function re(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function ie(e){return new this(e).sin()}function oe(e){return new this(e).sinh()}function ae(e){return new this(e).sqrt()}function se(e,t){return new this(e).sub(t)}function ue(e){return new this(e).tan()}function ce(e){return new this(e).tanh()}function le(e){return a(e=new this(e),e.e+1,1)}var fe,de,pe,he,ge=9e15,me=1e9,ye="0123456789abcdef",ve="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",be="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Te={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ge,maxE:ge,crypto:!1},Ee=!0,we="[DecimalError] ",De=we+"Invalid argument: ",Se=we+"Precision limit exceeded",Ie=we+"crypto unavailable",_e=Math.floor,xe=Math.pow,Ae=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Ne=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Ce=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Oe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Re=1e7,Le=7,Me=9007199254740991,Pe=ve.length-1,Fe=be.length-1,Ve={name:"[object Decimal]"};Ve.absoluteValue=Ve.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),a(e)},Ve.ceil=function(){return a(new this.constructor(this),this.e+1,2)},Ve.comparedTo=Ve.cmp=function(e){var t,n,r,i,o=this,a=o.d,s=(e=new o.constructor(e)).d,u=o.s,c=e.s;if(!a||!s)return u&&c?u!==c?u:a===s?0:!a^0>u?1:-1:NaN;if(!a[0]||!s[0])return a[0]?u:s[0]?-c:0;if(u!==c)return u;if(o.e!==e.e)return o.e>e.e^0>u?1:-1;for(r=a.length,i=s.length,t=0,n=i>r?r:i;n>t;++t)if(a[t]!==s[t])return a[t]>s[t]^0>u?1:-1;return r===i?0:r>i^0>u?1:-1},Ve.cosine=Ve.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Le,r.rounding=1,n=o(r,D(r,n)),r.precision=e,r.rounding=t,a(2==he||3==he?n.neg():n,e,t,!0)):new r(1):new r(NaN)},Ve.cubeRoot=Ve.cbrt=function(){var e,n,r,i,o,s,u,c,l,f,d=this,p=d.constructor;if(!d.isFinite()||d.isZero())return new p(d);for(Ee=!1,s=d.s*Math.pow(d.s*d,1/3),s&&Math.abs(s)!=1/0?i=new p(s.toString()):(r=t(d.d),e=d.e,(s=(e-r.length+1)%3)&&(r+=1==s||-2==s?"0":"00"),s=Math.pow(r,1/3),e=_e((e+1)/3)-(e%3==(0>e?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),i=new p(r),i.s=d.s),u=(e=p.precision)+3;;)if(c=i,l=c.times(c).times(c),f=l.plus(d),i=Ue(f.plus(d).times(c),f.plus(l),u+2,1),t(c.d).slice(0,u)===(r=t(i.d)).slice(0,u)){if(r=r.slice(u-3,u+1),"9999"!=r&&(o||"4999"!=r)){(!+r||!+r.slice(1)&&"5"==r.charAt(0))&&(a(i,e+1,1),n=!i.times(i).times(i).eq(d));break}if(!o&&(a(c,e+1,0),c.times(c).times(c).eq(d))){i=c;break}u+=4,o=1}return Ee=!0,a(i,e,p.rounding,n)},Ve.decimalPlaces=Ve.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-_e(this.e/Le))*Le,e=t[e])for(;e%10==0;e/=10)n--;0>n&&(n=0)}return n},Ve.dividedBy=Ve.div=function(e){return Ue(this,new this.constructor(e))},Ve.dividedToIntegerBy=Ve.divToInt=function(e){var t=this,n=t.constructor;return a(Ue(t,new n(e),0,1,1),n.precision,n.rounding)},Ve.equals=Ve.eq=function(e){return 0===this.cmp(e)},Ve.floor=function(){return a(new this.constructor(this),this.e+1,3)},Ve.greaterThan=Ve.gt=function(e){return this.cmp(e)>0},Ve.greaterThanOrEqualTo=Ve.gte=function(e){var t=this.cmp(e);return 1==t||0===t},Ve.hyperbolicCosine=Ve.cosh=function(){var e,t,n,r,i,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,32>i?(e=Math.ceil(i/3),t=Math.pow(4,-e).toString()):(e=16,t="2.3283064365386962890625e-10"),o=w(s,1,o.times(t),new s(1),!0);for(var c,l=e,f=new s(8);l--;)c=o.times(o),o=u.minus(c.times(f.minus(c.times(f))));return a(o,s.precision=n,s.rounding=r,!0)},Ve.hyperbolicSine=Ve.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,r=i.d.length,3>r)i=w(o,2,i,i,!0);else{e=1.4*Math.sqrt(r),e=e>16?16:0|e,i=i.times(Math.pow(5,-e)),i=w(o,2,i,i,!0);for(var s,u=new o(5),c=new o(16),l=new o(20);e--;)s=i.times(i),i=i.times(u.plus(s.times(c.times(s).plus(l))))}return o.precision=t,o.rounding=n,a(i,t,n,!0)},Ve.hyperbolicTangent=Ve.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,Ue(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},Ve.inverseCosine=Ve.acos=function(){var e,t=this,n=t.constructor,r=t.abs().cmp(1),i=n.precision,o=n.rounding;return-1!==r?0===r?t.isNeg()?l(n,i,o):new n(0):new n(NaN):t.isZero()?l(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),e=l(n,i+4,o).times(.5),n.precision=i,n.rounding=o,e.minus(t))},Ve.inverseHyperbolicCosine=Ve.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,Ee=!1,n=n.times(n).minus(1).sqrt().plus(n),Ee=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},Ve.inverseHyperbolicSine=Ve.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,Ee=!1,n=n.times(n).plus(1).sqrt().plus(n),Ee=!0,r.precision=e,r.rounding=t,n.ln())},Ve.inverseHyperbolicTangent=Ve.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?a(new o(i),e,t,!0):(o.precision=n=r-i.e,i=Ue(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},Ve.inverseSine=Ve.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t?0===t?(e=l(o,n+4,r).times(.5),e.s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},Ve.inverseTangent=Ve.atan=function(){var e,t,n,r,i,o,s,u,c,f=this,d=f.constructor,p=d.precision,h=d.rounding;if(f.isFinite()){if(f.isZero())return new d(f);if(f.abs().eq(1)&&Fe>=p+4)return s=l(d,p+4,h).times(.25),s.s=f.s,s}else{if(!f.s)return new d(NaN);if(Fe>=p+4)return s=l(d,p+4,h).times(.5),s.s=f.s,s}for(d.precision=u=p+10,d.rounding=1,n=Math.min(28,u/Le+2|0),e=n;e;--e)f=f.div(f.times(f).plus(1).sqrt().plus(1));for(Ee=!1,t=Math.ceil(u/Le),r=1,c=f.times(f),s=new d(f),i=f;-1!==e;)if(i=i.times(c),o=s.minus(i.div(r+=2)),i=i.times(c),s=o.plus(i.div(r+=2)),void 0!==s.d[t])for(e=t;s.d[e]===o.d[e]&&e--;);return n&&(s=s.times(2<<n-1)),Ee=!0,a(s,d.precision=p,d.rounding=h,!0)},Ve.isFinite=function(){return!!this.d},Ve.isInteger=Ve.isInt=function(){return!!this.d&&_e(this.e/Le)>this.d.length-2},Ve.isNaN=function(){return!this.s},Ve.isNegative=Ve.isNeg=function(){return this.s<0},Ve.isPositive=Ve.isPos=function(){return this.s>0},Ve.isZero=function(){return!!this.d&&0===this.d[0]},Ve.lessThan=Ve.lt=function(e){return this.cmp(e)<0},Ve.lessThanOrEqualTo=Ve.lte=function(e){return this.cmp(e)<1},Ve.logarithm=Ve.log=function(e){var n,i,o,s,u,l,f,d,p=this,h=p.constructor,g=h.precision,m=h.rounding,v=5; if(null==e)e=new h(10),n=!0;else{if(e=new h(e),i=e.d,e.s<0||!i||!i[0]||e.eq(1))return new h(NaN);n=e.eq(10)}if(i=p.d,p.s<0||!i||!i[0]||p.eq(1))return new h(i&&!i[0]?-1/0:1!=p.s?NaN:i?0:1/0);if(n)if(i.length>1)u=!0;else{for(s=i[0];s%10===0;)s/=10;u=1!==s}if(Ee=!1,f=g+v,l=y(p,f),o=n?c(h,f+10):y(e,f),d=Ue(l,o,f,1),r(d.d,s=g,m))do if(f+=10,l=y(p,f),o=n?c(h,f+10):y(e,f),d=Ue(l,o,f,1),!u){+t(d.d).slice(s+1,s+15)+1==1e14&&(d=a(d,g+1,0));break}while(r(d.d,s+=10,m));return Ee=!0,a(d,g,m)},Ve.minus=Ve.sub=function(e){var t,n,r,i,o,s,c,l,f,d,p,h,g=this,m=g.constructor;if(e=new m(e),!g.d||!e.d)return g.s&&e.s?g.d?e.s=-e.s:e=new m(e.d||g.s!==e.s?g:NaN):e=new m(NaN),e;if(g.s!=e.s)return e.s=-e.s,g.plus(e);if(f=g.d,h=e.d,c=m.precision,l=m.rounding,!f[0]||!h[0]){if(h[0])e.s=-e.s;else{if(!f[0])return new m(3===l?-0:0);e=new m(g)}return Ee?a(e,c,l):e}if(n=_e(e.e/Le),d=_e(g.e/Le),f=f.slice(),o=d-n){for(p=0>o,p?(t=f,o=-o,s=h.length):(t=h,n=d,s=f.length),r=Math.max(Math.ceil(c/Le),s)+2,o>r&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for(r=f.length,s=h.length,p=s>r,p&&(s=r),r=0;s>r;r++)if(f[r]!=h[r]){p=f[r]<h[r];break}o=0}for(p&&(t=f,f=h,h=t,e.s=-e.s),s=f.length,r=h.length-s;r>0;--r)f[s++]=0;for(r=h.length;r>o;){if(f[--r]<h[r]){for(i=r;i&&0===f[--i];)f[i]=Re-1;--f[i],f[r]+=Re}f[r]-=h[r]}for(;0===f[--s];)f.pop();for(;0===f[0];f.shift())--n;return f[0]?(e.d=f,e.e=u(f,n),Ee?a(e,c,l):e):new m(3===l?-0:0)},Ve.modulo=Ve.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?a(new r(n),r.precision,r.rounding):(Ee=!1,9==r.modulo?(t=Ue(n,e.abs(),0,3,1),t.s*=e.s):t=Ue(n,e,0,r.modulo,1),t=t.times(e),Ee=!0,n.minus(t))},Ve.naturalExponential=Ve.exp=function(){return m(this)},Ve.naturalLogarithm=Ve.ln=function(){return y(this)},Ve.negated=Ve.neg=function(){var e=new this.constructor(this);return e.s=-e.s,a(e)},Ve.plus=Ve.add=function(e){var t,n,r,i,o,s,c,l,f,d,p=this,h=p.constructor;if(e=new h(e),!p.d||!e.d)return p.s&&e.s?p.d||(e=new h(e.d||p.s===e.s?p:NaN)):e=new h(NaN),e;if(p.s!=e.s)return e.s=-e.s,p.minus(e);if(f=p.d,d=e.d,c=h.precision,l=h.rounding,!f[0]||!d[0])return d[0]||(e=new h(p)),Ee?a(e,c,l):e;if(o=_e(p.e/Le),r=_e(e.e/Le),f=f.slice(),i=o-r){for(0>i?(n=f,i=-i,s=d.length):(n=d,r=o,s=f.length),o=Math.ceil(c/Le),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=f.length,i=d.length,0>s-i&&(i=s,n=d,d=f,f=n),t=0;i;)t=(f[--i]=f[i]+d[i]+t)/Re|0,f[i]%=Re;for(t&&(f.unshift(t),++r),s=f.length;0==f[--s];)f.pop();return e.d=f,e.e=u(f,r),Ee?a(e,c,l):e},Ve.precision=Ve.sd=function(e){var t,n=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(De+e);return n.d?(t=f(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},Ve.round=function(){var e=this,t=e.constructor;return a(new t(e),e.e+1,t.rounding)},Ve.sine=Ve.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+Le,r.rounding=1,n=E(r,D(r,n)),r.precision=e,r.rounding=t,a(he>2?n.neg():n,e,t,!0)):new r(NaN)},Ve.squareRoot=Ve.sqrt=function(){var e,n,r,i,o,s,u=this,c=u.d,l=u.e,f=u.s,d=u.constructor;if(1!==f||!c||!c[0])return new d(!f||0>f&&(!c||c[0])?NaN:c?u:1/0);for(Ee=!1,f=Math.sqrt(+u),0==f||f==1/0?(n=t(c),(n.length+l)%2==0&&(n+="0"),f=Math.sqrt(n),l=_e((l+1)/2)-(0>l||l%2),f==1/0?n="1e"+l:(n=f.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),i=new d(n)):i=new d(f.toString()),r=(l=d.precision)+3;;)if(s=i,i=s.plus(Ue(u,s,r+2,1)).times(.5),t(s.d).slice(0,r)===(n=t(i.d)).slice(0,r)){if(n=n.slice(r-3,r+1),"9999"!=n&&(o||"4999"!=n)){(!+n||!+n.slice(1)&&"5"==n.charAt(0))&&(a(i,l+1,1),e=!i.times(i).eq(u));break}if(!o&&(a(s,l+1,0),s.times(s).eq(u))){i=s;break}r+=4,o=1}return Ee=!0,a(i,l,d.rounding,e)},Ve.tangent=Ve.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,n=n.sin(),n.s=1,n=Ue(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,a(2==he||4==he?n.neg():n,e,t,!0)):new r(NaN)},Ve.times=Ve.mul=function(e){var t,n,r,i,o,s,c,l,f,d=this,p=d.constructor,h=d.d,g=(e=new p(e)).d;if(e.s*=d.s,!(h&&h[0]&&g&&g[0]))return new p(!e.s||h&&!h[0]&&!g||g&&!g[0]&&!h?NaN:h&&g?0*e.s:e.s/0);for(n=_e(d.e/Le)+_e(e.e/Le),l=h.length,f=g.length,f>l&&(o=h,h=g,g=o,s=l,l=f,f=s),o=[],s=l+f,r=s;r--;)o.push(0);for(r=f;--r>=0;){for(t=0,i=l+r;i>r;)c=o[i]+g[r]*h[i-r-1]+t,o[i--]=c%Re|0,t=c/Re|0;o[i]=(o[i]+t)%Re|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=u(o,n),Ee?a(e,p.precision,p.rounding):e},Ve.toBinary=function(e,t){return S(this,2,e,t)},Ve.toDecimalPlaces=Ve.toDP=function(e,t){var r=this,i=r.constructor;return r=new i(r),void 0===e?r:(n(e,0,me),void 0===t?t=i.rounding:n(t,0,8),a(r,e+r.e+1,t))},Ve.toExponential=function(e,t){var r,i=this,o=i.constructor;return void 0===e?r=s(i,!0):(n(e,0,me),void 0===t?t=o.rounding:n(t,0,8),i=a(new o(i),e+1,t),r=s(i,!0,e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},Ve.toFixed=function(e,t){var r,i,o=this,u=o.constructor;return void 0===e?r=s(o):(n(e,0,me),void 0===t?t=u.rounding:n(t,0,8),i=a(new u(o),e+o.e+1,t),r=s(i,!1,e+i.e+1)),o.isNeg()&&!o.isZero()?"-"+r:r},Ve.toFraction=function(e){var n,r,i,o,a,s,u,c,l,d,p,h,g=this,m=g.d,y=g.constructor;if(!m)return new y(g);if(l=r=new y(1),i=c=new y(0),n=new y(i),a=n.e=f(m)-g.e-1,s=a%Le,n.d[0]=xe(10,0>s?Le+s:s),null==e)e=a>0?n:l;else{if(u=new y(e),!u.isInt()||u.lt(l))throw Error(De+u);e=u.gt(n)?a>0?n:l:u}for(Ee=!1,u=new y(t(m)),d=y.precision,y.precision=a=m.length*Le*2;p=Ue(u,n,0,1,1),o=r.plus(p.times(i)),1!=o.cmp(e);)r=i,i=o,o=l,l=c.plus(p.times(o)),c=o,o=n,n=u.minus(p.times(o)),u=o;return o=Ue(e.minus(r),i,0,1,1),c=c.plus(o.times(l)),r=r.plus(o.times(i)),c.s=l.s=g.s,h=Ue(l,i,a,1).minus(g).abs().cmp(Ue(c,r,a,1).minus(g).abs())<1?[l,i]:[c,r],y.precision=d,Ee=!0,h},Ve.toHexadecimal=Ve.toHex=function(e,t){return S(this,16,e,t)},Ve.toNearest=function(e,t){var r=this,i=r.constructor;if(r=new i(r),null==e){if(!r.d)return r;e=new i(1),t=i.rounding}else{if(e=new i(e),void 0===t?t=i.rounding:n(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(Ee=!1,r=Ue(r,e,0,t,1).times(e),Ee=!0,a(r)):(e.s=r.s,r=e),r},Ve.toNumber=function(){return+this},Ve.toOctal=function(e,t){return S(this,8,e,t)},Ve.toPower=Ve.pow=function(e){var n,i,o,s,u,c,l=this,f=l.constructor,d=+(e=new f(e));if(!(l.d&&e.d&&l.d[0]&&e.d[0]))return new f(xe(+l,d));if(l=new f(l),l.eq(1))return l;if(o=f.precision,u=f.rounding,e.eq(1))return a(l,o,u);if(n=_e(e.e/Le),n>=e.d.length-1&&(i=0>d?-d:d)<=Me)return s=p(f,l,i,o),e.s<0?new f(1).div(s):a(s,o,u);if(c=l.s,0>c){if(n<e.d.length-1)return new f(NaN);if(0==(1&e.d[n])&&(c=1),0==l.e&&1==l.d[0]&&1==l.d.length)return l.s=c,l}return i=xe(+l,d),n=0!=i&&isFinite(i)?new f(i+"").e:_e(d*(Math.log("0."+t(l.d))/Math.LN10+l.e+1)),n>f.maxE+1||n<f.minE-1?new f(n>0?c/0:0):(Ee=!1,f.rounding=l.s=1,i=Math.min(12,(n+"").length),s=m(e.times(y(l,o+i)),o),s.d&&(s=a(s,o+5,1),r(s.d,o,u)&&(n=o+10,s=a(m(e.times(y(l,n+i)),n),n+5,1),+t(s.d).slice(o+1,o+15)+1==1e14&&(s=a(s,o+1,0)))),s.s=c,Ee=!0,f.rounding=u,a(s,o,u))},Ve.toPrecision=function(e,t){var r,i=this,o=i.constructor;return void 0===e?r=s(i,i.e<=o.toExpNeg||i.e>=o.toExpPos):(n(e,1,me),void 0===t?t=o.rounding:n(t,0,8),i=a(new o(i),e,t),r=s(i,e<=i.e||i.e<=o.toExpNeg,e)),i.isNeg()&&!i.isZero()?"-"+r:r},Ve.toSignificantDigits=Ve.toSD=function(e,t){var r=this,i=r.constructor;return void 0===e?(e=i.precision,t=i.rounding):(n(e,1,me),void 0===t?t=i.rounding:n(t,0,8)),a(new i(r),e,t)},Ve.toString=function(){var e=this,t=e.constructor,n=s(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},Ve.truncated=Ve.trunc=function(){return a(new this.constructor(this),this.e+1,1)},Ve.valueOf=Ve.toJSON=function(){var e=this,t=e.constructor,n=s(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};var Ue=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,s,u,c){var l,f,d,p,h,g,m,y,v,b,T,E,w,D,S,I,_,x,A,N,C=r.constructor,O=r.s==i.s?1:-1,R=r.d,L=i.d;if(!(R&&R[0]&&L&&L[0]))return new C(r.s&&i.s&&(R?!L||R[0]!=L[0]:L)?R&&0==R[0]||!L?0*O:O/0:NaN);for(c?(h=1,f=r.e-i.e):(c=Re,h=Le,f=_e(r.e/h)-_e(i.e/h)),A=L.length,_=R.length,v=new C(O),b=v.d=[],d=0;L[d]==(R[d]||0);d++);if(L[d]>(R[d]||0)&&f--,null==o?(D=o=C.precision,s=C.rounding):D=u?o+(r.e-i.e)+1:o,0>D)b.push(1),g=!0;else{if(D=D/h+2|0,d=0,1==A){for(p=0,L=L[0],D++;(_>d||p)&&D--;d++)S=p*c+(R[d]||0),b[d]=S/L|0,p=S%L|0;g=p||_>d}else{for(p=c/(L[0]+1)|0,p>1&&(L=e(L,p,c),R=e(R,p,c),A=L.length,_=R.length),I=A,T=R.slice(0,A),E=T.length;A>E;)T[E++]=0;N=L.slice(),N.unshift(0),x=L[0],L[1]>=c/2&&++x;do p=0,l=t(L,T,A,E),0>l?(w=T[0],A!=E&&(w=w*c+(T[1]||0)),p=w/x|0,p>1?(p>=c&&(p=c-1),m=e(L,p,c),y=m.length,E=T.length,l=t(m,T,y,E),1==l&&(p--,n(m,y>A?N:L,y,c))):(0==p&&(l=p=1),m=L.slice()),y=m.length,E>y&&m.unshift(0),n(T,m,E,c),-1==l&&(E=T.length,l=t(L,T,A,E),1>l&&(p++,n(T,E>A?N:L,E,c))),E=T.length):0===l&&(p++,T=[0]),b[d++]=p,l&&T[0]?T[E++]=R[I]||0:(T=[R[I]],E=1);while((I++<_||void 0!==T[0])&&D--);g=void 0!==T[0]}b[0]||b.shift()}if(1==h)v.e=f,de=g;else{for(d=1,p=b[0];p>=10;p/=10)d++;v.e=d+f*h-1,a(v,u?o+v.e+1:o,s,g)}return v}}();fe=k(Te),fe["default"]=fe.Decimal=fe,ve=new fe(ve),be=new fe(be),"function"==typeof define&&define.amd?define("decimal",[],function(){return fe}):"undefined"!=typeof module&&module.exports?module.exports=fe:(e||(e="undefined"!=typeof self&&self&&self.self==self?self:Function("return this")()),pe=e.Decimal,fe.noConflict=function(){return e.Decimal=pe,fe},e.Decimal=fe)}(this),!function(e){"use strict";function t(e){return e.prototype.toFormat=function(e,t,n){if(!this.e&&0!==this.e)return this.toString();var r,i,o,a,s,u,c,l,f,d,p,h,g,m,y,v=this.format||{},b=this.constructor.format||{};if(e!=s?"object"==typeof e?(n=e,e=s):t!=s?"object"==typeof t?(n=t,t=s):"object"!=typeof n&&(n={}):n={}:n={},l=(r=this.toFixed(e,t).split("."))[0],f=r[1],u=(c=this.s<0?l.slice(1):l).length,(d=n.decimalSeparator)==s&&(d=v.decimalSeparator)==s&&(d=b.decimalSeparator)==s&&(d="."),(p=n.groupSeparator)==s&&(p=v.groupSeparator)==s&&(p=b.groupSeparator),p&&((h=n.groupSize)==s&&(h=v.groupSize)==s&&(h=b.groupSize)==s&&(h=0),(g=n.secondaryGroupSize)==s&&(g=v.secondaryGroupSize)==s&&(g=b.secondaryGroupSize)==s&&(g=0),g?(i=+g,u-=o=+h):(i=+h,o=+g),i>0&&u>0)){for(a=u%i||i,l=c.substr(0,a);u>a;a+=i)l+=p+c.substr(a,i);o>0&&(l+=p+c.slice(a)),this.s<0&&(l="-"+l)}return f?((m=n.fractionGroupSeparator)==s&&(m=v.fractionGroupSeparator)==s&&(m=b.fractionGroupSeparator),m&&((y=n.fractionGroupSize)==s&&(y=v.fractionGroupSize)==s&&(y=b.fractionGroupSize)==s&&(y=0),(y=+y)&&(f=f.replace(new RegExp("\\d{"+y+"}\\B","g"),"$&"+m))),l+d+f):l},e.format={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},e}"function"==typeof define&&define.amd?define("toformat",["require","exports","module"],function(e,n){n["default"]=t}):"undefined"!=typeof module&&module.exports?module.exports=t:(e||(e="undefined"!=typeof self&&self&&self.self==self?self:window),noConflict=e.toFormat,t.noConflict=function(){return e.toFormat=noConflict,t},e.toFormat=t)}(this),define("OutSystems/ClientRuntime/Format",["require","exports"],function(e,t){"use strict";function n(e,t){var n=o[e];if("undefined"!=typeof n)return n;var r,i=e.replace(new RegExp("["+t.join("")+"]","gi"),"").substr(0,1),a=[];for(r=0;r<t.length;r++)a.push({index:e.toLowerCase().indexOf(t[r]),character:t[r],length:e.replace(new RegExp("[^"+t[r]+"]","gi"),"").length});a.sort(function(e,t){return e.index<t.index?-1:1});var s={format:e,separator:i,parts:{},regExp:null};for(s.regExp="^",r=0;r<a.length;r++){var u="";switch(a[r].character.toLowerCase()){case"h":case"m":case"d":u="1,2";break;case"s":s.regExp+="(?"+i,u="1,2";break;default:u=a[r].length}r>0&&(s.regExp+="\\"+i),s.regExp+="([0-9]{"+u+"})"+("s"===a[r].character?")?":""),s.parts[a[r].character+"Index"]=r,s.parts[a[r].character+"Format"]=e.slice(a[r].index,a[r].index+a[r].length)}return s.regExp+="$",o[e]=s,s}function r(e){return n(e,["y","m","d"])}function i(e){return n(e,["h","m","s"])}Object.defineProperty(t,"__esModule",{value:!0});var o={},a=function(){function e(e,t,n,o){void 0===n&&(n=" "),void 0===o&&(o=""),this.dateFmt=r(e),this.timeFmt=i(t),this.dateTimeSep=n,this.tzInformation=o}return e.getDayName=function(t){return e.DayNames[t]},e.getShortDayName=function(t){return e.DayNames[t].slice(0,3)},e.getMonthName=function(t){return e.MonthNames[t-1]},e.getShortMonthName=function(t){return e.MonthNames[t-1].slice(0,3)},e.get12HourNotation=function(e){return 12>e?"AM":"PM"},e.getTimezoneInformationFull=function(t){return t=-t,e.getTimezoneSignal(t)+e.padLeadingZeros(Math.floor(t/60).toString(),2)+":"+e.padLeadingZeros(Math.floor(t%60).toString(),2)},e.getTimezoneInformationHoursFull=function(t){return t=-t,e.getTimezoneSignal(t)+e.padLeadingZeros(Math.floor(t/60).toString(),2)},e.getTimezoneInformationHoursShort=function(t){return t=-t,e.getTimezoneSignal(t)+Math.floor(t/60)},e.getTimezoneSignal=function(e){return 0>e?"-":"+"},e.padLeadingZeros=function(e,t){for(var n=e||"";n.length<t;)n="0"+n;return n},e.removeTrailingZeros=function(e){var t=e||"";return t.replace(/0+$/gm,"")},Object.defineProperty(e.prototype,"dateFormat",{get:function(){return this.dateFmt.format},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"timeFormat",{get:function(){return this.timeFmt.format},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateTimeFormat",{get:function(){return this.dateFmt.format+this.dateTimeSeparator+this.timeFmt.format},enumerable:!0,configurable:!0}),e.prototype.getRegExpForDate=function(){return new RegExp(this.dateFmt.regExp,"i")},Object.defineProperty(e.prototype,"yearIndexForDate",{get:function(){return this.dateFmt.parts.yIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"monthIndexForDate",{get:function(){return this.dateFmt.parts.mIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dayIndexForDate",{get:function(){return this.dateFmt.parts.dIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"yearFormatForDate",{get:function(){return this.dateFmt.parts.yFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"monthFormatForDate",{get:function(){return this.dateFmt.parts.mFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dayFormatForDate",{get:function(){return this.dateFmt.parts.dFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateSeparator",{get:function(){return this.dateFmt.separator},enumerable:!0,configurable:!0}),e.prototype.getRegExpForTime=function(){return new RegExp(this.timeFmt.regExp,"i")},Object.defineProperty(e.prototype,"hoursIndexForTime",{get:function(){return this.timeFmt.parts.hIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minutesIndexForTime",{get:function(){return this.timeFmt.parts.mIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"secondsIndexForTime",{get:function(){return this.timeFmt.parts.sIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"timeSeparator",{get:function(){return this.timeFmt.separator},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateTimeSeparator",{get:function(){return this.dateTimeSep},enumerable:!0,configurable:!0}),e.prototype.getRegExpForDateTime=function(){return new RegExp(this.dateFmt.regExp.substring(0,this.dateFmt.regExp.length-1)+this.dateTimeSeparator+this.timeFmt.regExp.substring(1,this.timeFmt.regExp.length-1)+this.tzInformation+"$","i")},Object.defineProperty(e.prototype,"yearIndexForDateTime",{get:function(){return this.dateFmt.parts.yIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"monthIndexForDateTime",{get:function(){return this.dateFmt.parts.mIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dayIndexForDateTime",{get:function(){return this.dateFmt.parts.dIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hoursIndexForDateTime",{get:function(){return this.timeFmt.parts.hIndex+3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hoursFormatForTime",{get:function(){return this.timeFmt.parts.hFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minutesFormatForTime",{get:function(){return this.timeFmt.parts.mFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"secondsFormatForTime",{get:function(){return this.timeFmt.parts.sFormat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minutesIndexForDateTime",{get:function(){return this.timeFmt.parts.mIndex+3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"secondsIndexForDateTime",{get:function(){return this.timeFmt.parts.sIndex+3},enumerable:!0,configurable:!0}),e.DayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],e.MonthNames=["January","February","March","April","May","June","July","August","September","October","November","December"],e}();t.DateTimeFormatInfo=a;var s=function(){function e(e,t){this.decimalSep=e,this.groupSep=t,this.integerFmtRegExp=null,this.decimalFmtRegExp=null,this.generateFormatRegExps(e,t)}return e.prototype.generateFormatRegExps=function(e,t){var n="\\"+e,r="(([0-9]{1,3}("+(t?"\\"+t:"")+"[0-9]{3})*)|([0-9]+))",i="[0-9]+";this.integerFmtRegExp="^[-]?"+r+"$",this.decimalFmtRegExp="^[-]?(("+r+"("+n+"("+i+")?)?)|(("+r+")?"+n+i+"))$"},Object.defineProperty(e.prototype,"decimalSeparator",{get:function(){return this.decimalSep},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groupSeparator",{get:function(){return this.groupSep},enumerable:!0,configurable:!0}),e.prototype.getRegExpForInteger=function(){return new RegExp(this.integerFmtRegExp,"i")},e.prototype.getRegExpForDecimal=function(){return new RegExp(this.decimalFmtRegExp,"i")},e.prototype.getRegExpForJSNumber=function(){return new RegExp("^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$","i")},e}();t.NumberFormatInfo=s;var u=function(){function e(e,t){this.defaultDateTimeFormats=[new a("yyyy-MM-dd","HH:mm:ss"),new a("yyyy-MM-dd","HH:mm:ss"),new a("yyyy/MM/dd","HH:mm:ss"),new a("yyyy.MM.dd","HH:mm:ss")],this.defaultNumberFmt=t,this.currentNumberFmt=t,this.defaultDateTimeFormats[0]=e}return Object.defineProperty(e.prototype,"defaultDateTimeFormat",{get:function(){return this.defaultDateTimeFormats[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateTimeFormats",{get:function(){return this.defaultDateTimeFormats},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateTimeFormat",{set:function(e){this.defaultDateTimeFormats[0]=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultNumberFormat",{get:function(){return this.defaultNumberFmt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numberFormat",{get:function(){return this.currentNumberFmt},set:function(e){this.currentNumberFmt=e},enumerable:!0,configurable:!0}),e}();t.ApplicationFormatInfo=u}),define("OutSystems/ClientRuntime/DataTypes",["require","exports","tslib","./LightImmutable","long","decimal","toformat","./Format","./Flow","./Exceptions"],function(e,t,n,r,i,o,a,s,u,c){"use strict";function l(e,t){return null===e||void 0===e?t:e}function f(e,t){if("string"==typeof e){var n=e,r=t;return n.localeCompare(r)}return"number"==typeof e?e-t:"boolean"==typeof e?!e&&t?-1:e&&!t?1:0:e.lessThan(t)?-1:e.greaterThan(t)?1:0}function d(e,t){return e&&t&&t.equals instanceof Function?t.equals(e):t===e}function p(e,t){return!e.hasContent()&&!t.hasContent()}function h(e){switch(e){case y.Integer:return T.DEFAULT_INTEGER;case y.LongInteger:return T.DEFAULT_LONGINTEGER;case y.Decimal:return T.DEFAULT_DECIMAL;case y.Currency:return T.DEFAULT_CURRENCY;case y.Text:return T.DEFAULT_TEXT;case y.PhoneNumber:return T.DEFAULT_PHONENUMBER;case y.Email:return T.DEFAULT_EMAIL;case y.Date:return T.DEFAULT_DATE;case y.DateTime:return T.DEFAULT_DATETIME;case y.Time:return T.DEFAULT_TIME;case y.Boolean:return T.DEFAULT_BOOLEAN;case y.BinaryData:return T.DEFAULT_BINARYDATA;case y.Object:return T.DEFAULT_OBJECT;default:throw new TypeError("Records and Record lists are not basic types")}}function g(e){return e===y.Record||e===y.RecordList||e===y.LongInteger||e===y.Decimal||e===y.Currency||e===y.DateTime||e===y.Time||e===y.Date}function m(){return function(e){var t=e;void 0!==t.init&&t.init()}}Object.defineProperty(t,"__esModule",{value:!0}),a["default"](o.Decimal);var y,v="__cache";!function(e){e[e.Integer=0]="Integer",e[e.LongInteger=1]="LongInteger",e[e.Decimal=2]="Decimal",e[e.Currency=3]="Currency",e[e.Text=4]="Text",e[e.PhoneNumber=5]="PhoneNumber",e[e.Email=6]="Email",e[e.Boolean=7]="Boolean",e[e.Date=8]="Date",e[e.DateTime=9]="DateTime",e[e.Time=10]="Time",e[e.Record=11]="Record",e[e.RecordList=12]="RecordList",e[e.BinaryData=13]="BinaryData",e[e.Object=14]="Object"}(y=t.DataTypes||(t.DataTypes={})),t.Decimal=o.Decimal.config({precision:30,toExpNeg:-1024,toExpPos:1024,rounding:o.Decimal.Decimal.ROUND_HALF_EVEN}),t.Decimal.defaultValue=new t.Decimal(0),t.LongInteger=i,t.LongInteger.defaultValue=t.LongInteger.ZERO;var b=function(){function e(e,t,n){this._content=e,this._url=t,this.getOfflineContent=n,this._cachedBlob=null,this._content=this._content||null}return Object.defineProperty(e.prototype,"url",{get:function(){return this._url},set:function(e){this._url=e,this.clearCachedBlob()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cachedBlob",{get:function(){return this._cachedBlob},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(e){this._content=e,this.clearCachedBlob()},enumerable:!0,configurable:!0}),e.prototype.loadContent=function(){var e=this;return this.getOfflineContent?this.getOfflineContent().then(function(t){return e.content=t,Promise.resolve(e)}):u.executeSequence(function(){return e})},e.prototype.hasContent=function(){return!(!this._url&&!this._content)},e.prototype.fastEquals=function(e){return e&&this.constructor===e.constructor&&this._url===e._url&&this._content===e._content&&(!!this.getOfflineContent&&!!e.getOfflineContent||!this.getOfflineContent&&!e.getOfflineContent)},e.prototype.base64toHex=function(e){for(var t=atob(e),n="",r=0;r<t.length;r++){var i=t.charCodeAt(r).toString(16);n+=2===i.length?i:"0"+i}return n},e.prototype.getContentType=function(){if(this._content){var e=this.base64toHex(this._content.substr(0,16));return"00000100"===e.substr(0,8)?"image/x-icon":"ffd8ffdb"===e.substr(0,8)||"ffd8ffe0"===e.substr(0,8)||"ffd8ffe1"===e.substr(0,8)?"image/jpeg":"49492a00"===e.substr(0,8)||"4d4d002a"===e.substr(0,8)?"image/tiff":"424d"===e.substr(0,4)?"image/bmp":"474946"===e.substr(0,6)?"image/gif":"89504e47"===e.substr(0,8)?"image/png":"application/octet-stream"}return null},e.prototype.toDataURI=function(){return this._content?"data:"+this.getContentType()+";base64,"+this._content:null},e.prototype.toBlob=function(){return!this._cachedBlob&&this._content&&(this._cachedBlob=e.base64toBlob(this._content,this.getContentType())),this._cachedBlob},Object.defineProperty(e.prototype,"length",{get:function(){var e=this.toBlob();return e?e.size:0},enumerable:!0,configurable:!0}),e.base64toBlob=function(e,t,n){void 0===t&&(t=""),void 0===n&&(n=512);for(var r=atob((e||"").replace(/\s/g,"")),i=[],o=0;o<r.length;o+=n){for(var a=r.slice(o,o+n),s=new Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);var c=new Uint8Array(s);i.push(c)}return new Blob(i,{type:t})},e.prototype.clearCachedBlob=function(){this._cachedBlob=null},e.defaultValue=new e,e}();t.BinaryData=b;var T;!function(e){e.RFC3339_TIMEPART=/^([01][0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9](\.\d+)?)?$/,e.RFC3339_DATEPART=/^\d{4,}-(0\d|1[012])-([0-2]\d|3[01])$/,e.RFC3339_TIMEPART_FORMAT="HH:mm:ss",e.RFC3339_DATEPART_FORMAT="yyyy-MM-dd"}(T=t.Constants||(t.Constants={}));var E=function(){function e(e,t,n,r,i,o,a){if(0===arguments.length)this.date=new Date(1900,0,1,0,0,0,0);else if(1===arguments.length)if(e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)){var s=e.getTime();isNaN(s)?this.date=new Date(1900,0,1,0,0,0,0):this.date=new Date(s)}else this.date=new Date(e);else l(e,1900)<100?(this.date=new Date(100,0,1,0,0,0,0),this.date.setFullYear(l(e,1900)),this.date.setMonth(l(t,1)-1),this.date.setDate(l(n,1)),this.date.setHours(l(r,0)),this.date.setMinutes(l(i,0)),this.date.setSeconds(l(o,0)),this.date.setMilliseconds(l(a,0))):this.date=new Date(l(e,1900),l(t,1)-1,l(n,1),l(r,0),l(i,0),l(o,0),l(a,0))}return Object.defineProperty(e,"defaultValue",{get:function(){return e.defaultValueField},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"year",{get:function(){return this.date.getFullYear()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"month",{get:function(){return this.date.getMonth()+1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"day",{get:function(){return this.date.getDate()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hours",{get:function(){return this.date.getHours()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minutes",{get:function(){return this.date.getMinutes()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"seconds",{get:function(){return this.date.getSeconds()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"milliseconds",{get:function(){return this.date.getMilliseconds()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weekDay",{get:function(){return this.date.getDay()},enumerable:!0,configurable:!0}),e.prototype.addYears=function(t){var n=new e(this.year+t,this.month,this.day,this.hours,this.minutes,this.seconds,this.milliseconds);return 2===this.month&&29===this.day&&3===n.month?new e(n.year,2,28,n.hours,n.minutes,n.seconds,n.milliseconds):n},e.prototype.daysInMonth=function(e,t){return new Date(t,e,0).getDate()},e.prototype.addMonths=function(t){var n=new e(this.year,this.month+t,this.day,this.hours,this.minutes,this.seconds,this.milliseconds);return n.day===this.day?n:new e(n.year,n.month-1,this.daysInMonth(n.month-1,n.year),n.hours,n.minutes,n.seconds,n.milliseconds)},e.prototype.addDays=function(t){return new e(this.year,this.month,this.day+t,this.hours,this.minutes,this.seconds,this.milliseconds)},e.prototype.addHours=function(t){return new e(this.year,this.month,this.day,this.hours+t,this.minutes,this.seconds,this.milliseconds)},e.prototype.addMinutes=function(t){return new e(this.year,this.month,this.day,this.hours,this.minutes+t,this.seconds,this.milliseconds)},e.prototype.addSeconds=function(t){return new e(this.year,this.month,this.day,this.hours,this.minutes,this.seconds+t,this.milliseconds)},e.prototype.addMilliseconds=function(t){return new e(this.year,this.month,this.day,this.hours,this.minutes,this.seconds,this.milliseconds+t)},e.prototype.equals=function(e){return!!e&&this.date.getTime()===e.date.getTime()},e.prototype.eq=function(e){return this.equals(e)},e.prototype.greaterThan=function(e){return this.date>e.date},e.prototype.gt=function(e){return this.greaterThan(e)},e.prototype.greaterThanOrEqualTo=function(e){return this.date>=e.date},e.prototype.gte=function(e){return this.greaterThanOrEqualTo(e)},e.prototype.lessThan=function(e){return this.date<e.date},e.prototype.lt=function(e){return this.lessThan(e)},e.prototype.lessThanOrEqualTo=function(e){return this.date<=e.date},e.prototype.lte=function(e){return this.lessThanOrEqualTo(e)},e.prototype.toNative=function(){return new Date(this.date.getTime())},e.prototype.getTime=function(){return this.date.getTime()},e.prototype.valueOf=function(){return this.date.valueOf()},e.fromISODate=function(t){var n=T.RFC3339_DATEPART.test(t);return n?e.internalFromUTCWithoutConversion(t+"T00:00:00Z"):e.defaultValue},e.prototype.toISODate=function(){return this.toString(T.RFC3339_DATEPART_FORMAT)},e.fromISOTime=function(t){var n=T.RFC3339_TIMEPART.test(t);return n?e.internalFromUTCWithoutConversion("1900-01-01T"+t+"Z"):e.defaultValue},e.prototype.toISOTime=function(){return this.toString(T.RFC3339_TIMEPART_FORMAT)},e.fromISODateTime=function(t){if(t=t||"",""===t||t.indexOf("1900-01-01")>=0&&t.indexOf("00:00:00")>=0)return e.defaultValue;var n=/([+\-]\d{2}((:\d{2})|(\d{2})?)|Z)$/;if(t.indexOf("T")>0&&!n.test(t))return e.internalFromUTCWithoutConversion(t.trim()+"Z");t=t.replace(/([+-]\d{2})$/,function(e){return e+"00"});var r=Date.parse(t);return isNaN(r)?e.defaultValue:new e(r)},e.internalFromUTCWithoutConversion=function(t){var n=Date.parse(t);if(!isNaN(n)){var r=new Date(n);return new e(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds())}return e.defaultValue},e.prototype.getMillisecondsString=function(){return(this.milliseconds/1e3).toFixed(3).substring(2,5)},e.prototype.toString=function(t){var n=this;return 0===arguments.length?this.equals(e.defaultValue)?"1900-01-01T00:00:00":this.date.toISOString():t.replace(/(\\.)|dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|ff?f?|FF?F?|\.FF?F?|tt?|zz?z?/g,function(e){if(0===e.indexOf("\\"))return e.substring(1);switch(e){case"hh":case"h":return s.DateTimeFormatInfo.padLeadingZeros((n.hours<13?n.hours:n.hours-12).toString(),e.length);case"HH":case"H":return s.DateTimeFormatInfo.padLeadingZeros(n.hours.toString(),e.length);case"mm":case"m":return s.DateTimeFormatInfo.padLeadingZeros(n.minutes.toString(),e.length);case"ss":case"s":return s.DateTimeFormatInfo.padLeadingZeros(n.seconds.toString(),e.length);case"fff":return n.getMillisecondsString();case"ff":return n.getMillisecondsString().substring(0,2);case"f":return n.getMillisecondsString().substring(0,1);case".FFF":case".FF":case".F":return 0===n.milliseconds?"":"."+s.DateTimeFormatInfo.removeTrailingZeros(n.getMillisecondsString());case"FFF":return s.DateTimeFormatInfo.removeTrailingZeros(n.getMillisecondsString());case"FF":return s.DateTimeFormatInfo.removeTrailingZeros(n.getMillisecondsString()).substring(0,2);case"F":return s.DateTimeFormatInfo.removeTrailingZeros(n.getMillisecondsString()).substring(0,1);case"yyyy":case"yyy":var t=n.year.toString();return"0"===t.charAt(0)?n.year.toString().substring(1):t;case"yy":return n.year.toString().substring(2,4);case"y":return Number(n.year.toString().substring(2,4)).toString();case"dddd":return s.DateTimeFormatInfo.getDayName(n.weekDay);case"ddd":return s.DateTimeFormatInfo.getShortDayName(n.weekDay);case"dd":case"d":return s.DateTimeFormatInfo.padLeadingZeros(n.day.toString(),e.length);case"MMMM":return s.DateTimeFormatInfo.getMonthName(n.month);case"MMM":return s.DateTimeFormatInfo.getShortMonthName(n.month);case"MM":case"M":return s.DateTimeFormatInfo.padLeadingZeros(n.month.toString(),e.length);case"t":return s.DateTimeFormatInfo.get12HourNotation(n.hours).substring(0,1);case"tt":return s.DateTimeFormatInfo.get12HourNotation(n.hours);case"zzz":return s.DateTimeFormatInfo.getTimezoneInformationFull(n.date.getTimezoneOffset());case"zz":return s.DateTimeFormatInfo.getTimezoneInformationHoursFull(n.date.getTimezoneOffset());case"z":return s.DateTimeFormatInfo.getTimezoneInformationHoursShort(n.date.getTimezoneOffset());default:return e}})},e.defaultValueField=new e,e}();t.DateTime=E,function(e){e.MIN_INTEGER_VALUE=-2147483648,e.MAX_INTEGER_VALUE=2147483647,e.MIN_LONGINTEGER_VALUE=t.LongInteger.MIN_VALUE,e.MAX_LONGINTEGER_VALUE=t.LongInteger.MAX_VALUE,e.MIN_DECIMAL_VALUE=new t.Decimal("2").pow(96).neg(),e.MAX_DECIMAL_VALUE=new t.Decimal("2").pow(96).minus(1), e.MIN_DATE_VALUE=new E(1753,1,1),e.MAX_DATE_VALUE=new E(9999,12,31),e.MIN_TIME_VALUE=E.defaultValue,e.MAX_TIME_VALUE=E.defaultValue.addHours(23).addMinutes(59).addSeconds(59),e.MIN_DATETIME_VALUE=new E(1753,1,1,0,0,0),e.MAX_DATETIME_VALUE=new E(9999,12,31,23,59,59),e.DEFAULT_INTEGER=0,e.DEFAULT_LONGINTEGER=t.LongInteger.defaultValue,e.DEFAULT_DECIMAL=t.Decimal.defaultValue,e.DEFAULT_CURRENCY=t.Decimal.defaultValue,e.DEFAULT_TEXT="",e.DEFAULT_PHONENUMBER="",e.DEFAULT_EMAIL="",e.DEFAULT_BOOLEAN=!1,e.DEFAULT_DATE=E.defaultValue,e.DEFAULT_DATETIME=E.defaultValue,e.DEFAULT_TIME=E.defaultValue,e.DEFAULT_BINARYDATA=b.defaultValue,e.DEFAULT_OBJECT=null,e.FORMAT=new s.ApplicationFormatInfo(new s.DateTimeFormatInfo("yyyy-MM-dd","HH:mm:ss"),new s.NumberFormatInfo(".","")),e.ISO_DATE_FORMAT_REGEXP=/^\d{4,}-(0\d|1[012])-([0-2]\d|3[01])([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?(([+\-]\d{2}((:\d{2})|(\d{2})?))|Z)?)?)?$/i}(T=t.Constants||(t.Constants={}));var w=function(){function e(){this.map={}}return e.prototype.getItem=function(e){return this.map[e]},e.prototype.setItem=function(e,t){this.map[e]=t},e.prototype.invalidate=function(e){void 0===e?this.map={}:this.setItem(e,void 0)},e.prototype.clone=function(){var t=new e;for(var n in this.map)t.setItem(n,this.map[n]);return t},e}();t.Cache=w;var D=function(){function e(){this.list=[]}return e.prototype.getItem=function(e){return e>=this.length?void 0:this.list[e]},e.prototype.append=function(e){this.list.push(e)},e.prototype.appendMultiple=function(e){this.list=this.list.concat(new Array(e))},e.prototype.setItem=function(e,t){this.list[e]=t},e.prototype.insert=function(e,t){this.list.splice(e,0,t)},e.prototype.invalidate=function(e){void 0===e?this.list=[]:this.list.splice(e,1)},Object.defineProperty(e.prototype,"length",{get:function(){return this.list.length},enumerable:!0,configurable:!0}),e}();t.ListCache=D,t.equals=d,t.areBinaryNulls=p,t.defaultForType=h;var S=function(){function e(t,n,i,o,a){if(this.emptyListItem=t,this.data=n||new r.ImmutableList,this.itemIds=i||new r.ImmutableList,this._itemIdSeed=o||0,this._modelId=a||e.nextModelId++,n&&!i)for(var s=0,u=this.data.count();u>s;s++)this.itemIds=this.itemIds.push(this._itemIdSeed),this._itemIdSeed=this._itemIdSeed+1|0}return Object.defineProperty(e.prototype,"modelId",{get:function(){return this._modelId},enumerable:!0,configurable:!0}),e.prototype.push=function(t){return new e(this.emptyListItem,this.data.push(t),this.itemIds.push(this._itemIdSeed),this._itemIdSeed+1|0,this._modelId)},e.prototype.addFromOther=function(t){var n=this;return new e(this.emptyListItem,this.data.addFromOther(t.data),this.itemIds.pushAll(t.data.map(function(){return n._itemIdSeed++})),this._itemIdSeed,this._modelId)},e.prototype.pushAll=function(t){var n=this;return new e(this.emptyListItem,this.data.pushAll(t),this.itemIds.pushAll(t.map(function(){return n._itemIdSeed++})),this._itemIdSeed,this._modelId)},e.prototype.remove=function(t){return new e(this.emptyListItem,this.data.remove(t),this.itemIds.remove(t),this._itemIdSeed,this._modelId)},e.prototype.insert=function(t,n){return new e(this.emptyListItem,this.data.insert(t,n),this.itemIds.insert(t,this._itemIdSeed),this._itemIdSeed+1|0,this._modelId)},e.prototype.sort=function(t,n,i){var o=this,a=this.data.map(function(e,r){return{item:t(r),itemId:o.itemIds.get(r),by:n(t(r))}}),s=i?1:-1;a.sort(function(e,t){return s*f(e.by,t.by)});var u=r.ImmutableList.fromJS(a.map(function(e){return e.item})),c=r.ImmutableList.fromJS(a.map(function(e){return e.itemId}));return new e(this.emptyListItem,u,c,this._itemIdSeed,this._modelId)},e.prototype.getEmptyListItem=function(){return this.emptyListItem},e.prototype.setEmptyListItem=function(t){return new e(t,this.data,this.itemIds,this._itemIdSeed,this._modelId)},e.prototype.get=function(e){return this.data.get(e)},e.prototype.getId=function(e){return this.itemIds.get(e)+""},e.prototype.count=function(){return this.data.count()},e.prototype.isEmpty=function(){return this.data.isEmpty()},e.prototype.set=function(t,n){return new e(this.emptyListItem,this.data.set(t,n),this.itemIds,this._itemIdSeed,this._modelId)},e.prototype.clear=function(){return new e(this.emptyListItem,this.data.clear(),this.itemIds.clear(),this._itemIdSeed,this._modelId)},e.prototype.forEach=function(e){return this.data.forEach(e)},e.prototype.reduce=function(e,t){return this.data.reduce(e,t)},e.fromJS=function(t,n){return new e(n,r.ImmutableList.fromJS(t))},e.fromJSON=function(t,n){return new e(n,r.ImmutableList.fromJS(t))},e.prototype.clone=function(){return new e(this.emptyListItem,this.data.clone(),this.itemIds.clone(),this._itemIdSeed)},e.nextModelId=1,e}();t.ImmutableListWithTracking=S;var I=function(){function e(){this.writePropagateHandler=this.defaultWritePropagate,this.propagationParent=this}return e.getData=function(e){return void 0!==e&&e.constructor!==S?e.data:void 0},e.setPropagationHandler=function(t,n,r,i){t.writePropagateHandler=i,e.setPropagationParent(t,n),e.setPropagationKey(t,r)},e.setPropagationParent=function(e,t){e.propagationParent=t},e.setPropagationKey=function(e,t){e.propagationKey=t},e.prototype.writePropagate=function(e,t){if(this.data.constructor!==e.constructor)throw new Error("Unexpected new data type");this.data=e,this.writePropagateHandler.apply(this.propagationParent,[this.propagationKey,e,t])},e.prototype.defaultWritePropagate=function(e,t,n){this.onDefaultWritePropagate(n)},e.prototype.onDefaultWritePropagate=function(e){},e}();t.ImmutableBase=I;var _=function(e){function i(t,n){var r=e.call(this)||this;return r.cache=n||new w,t?r.data=t:r.data=r.constructor.createDefaultData(),r}return n.__extends(i,e),i.createDefaultData=function(){var e=this,t=e.RecordClass;return t?new t:void 0},i.prototype.getBasicProperty=function(e){return this.data.get(e)},i.prototype.setBasicProperty=function(e,t,n,r){this.data.get(e)!==t&&(i.checkType(n,t,r),this.writePropagate(this.data.set(e,t),this.cache),this.onPropertyValueChanged(e))},i.prototype.onPropertyValueChanged=function(e){},i.prototype.getComplexProperty=function(e,t){var n=this.cache.getItem(e);if(n)return i.setPropagationParent(n,this),n;var r=this.data.get(e),o=this.cache.getItem(e+v);return n=new t(r,o?o:null),this.cache.setItem(e,n),o&&this.cache.invalidate(e+v),i.setPropagationHandler(n,this,e,this.internalSetComplexProperty),n},i.prototype.setComplexProperty=function(e,t,n,r){this.setProperties([{name:e,value:t,expectedType:n,valueType:r,isBasicType:!1}])},i.prototype.internalSetComplexProperty=function(e,t,n){this.internalSetProperties([{name:e,value:t,isBasicType:!1}],n)},i.prototype.setProperties=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var o=r[n],a=i.getData(o.value)||o.value;this.data.get(o.name)!==a&&(void 0!==o.expectedType&&i.checkType(o.expectedType,o.value,o.valueType),t.push({name:o.name,value:a,isBasicType:o.isBasicType}))}t.length>0&&this.internalSetProperties(t)},i.prototype.internalSetProperties=function(e,t){for(var n=this.data,r=this.cloneCache(),i=0,o=e;i<o.length;i++){var a=o[i];n=n.set(a.name,a.value),a.isBasicType||(r.invalidate(a.name),t&&r.setItem(a.name+v,t))}this.writePropagate(n,r);for(var s=0,u=e;s<u.length;s++){var a=u[s];this.onPropertyValueChanged(a.name)}},i.prototype.cloneCache=function(){return this.cache.clone()},i.prototype.onDefaultWritePropagate=function(e){this.cache=e},i.checkType=function(e,t,n){switch(e){case y.Integer:i.ensureValidInteger(t);break;case y.LongInteger:i.ensureValidLongInteger(t);break;case y.Decimal:case y.Currency:i.ensureValidDecimal(t);break;case y.Text:case y.PhoneNumber:i.ensureValidText(t);break;case y.Email:i.ensureValidEmail(t);break;case y.Boolean:i.ensureValidBoolean(t);break;case y.Date:i.ensureValidDate(t);break;case y.Time:i.ensureValidTime(t);break;case y.DateTime:i.ensureValidDateTime(t);break;case y.Record:case y.RecordList:i.ensureValidComplexType(t,n);break;case y.BinaryData:i.ensureValidBinaryData(t);break;case y.Object:break;default:throw new TypeError("Unnexpected data type: "+e)}},i.ensureValidBinaryData=function(e){if(!("string"==typeof e||e instanceof b))throw new TypeError("Expecting a Binary Data, found: "+e)},i.ensureValidInteger=function(e){if("number"!=typeof e||isNaN(e)||e%1!==0)throw new TypeError("Expecting an Integer, found: "+e);if(e<T.MIN_INTEGER_VALUE)throw new TypeError("Integers must be greater than "+T.MIN_INTEGER_VALUE+", found: "+e);if(e>T.MAX_INTEGER_VALUE)throw new TypeError("Integers must be lower than "+T.MAX_INTEGER_VALUE+", found: "+e)},i.ensureValidLongInteger=function(e){if(!e||e.constructor!==t.LongInteger)throw new TypeError("Expecting a LongInteger, found: "+e);if(e.lessThan(T.MIN_LONGINTEGER_VALUE))throw new TypeError("Long Integers must be greater than "+T.MIN_LONGINTEGER_VALUE.toString()+", found: "+e.toString());if(e.greaterThan(T.MAX_LONGINTEGER_VALUE))throw new TypeError("Long Integers must be lower than "+T.MAX_LONGINTEGER_VALUE.toString()+", found: "+e.toString())},i.ensureValidDecimal=function(e){if(!e||e.constructor!==t.Decimal)throw new TypeError("Expecting a Decimal, found: "+e);if(e.lessThan(T.MIN_DECIMAL_VALUE))throw new TypeError("Decimals must be greater than "+T.MIN_DECIMAL_VALUE.toString()+", found: "+e.toString());if(e.greaterThan(T.MAX_DECIMAL_VALUE))throw new TypeError("Decimals must be lower than "+T.MAX_DECIMAL_VALUE.toString()+", found: "+e.toString())},i.ensureValidText=function(e){if("string"!=typeof e)throw new TypeError("Expecting a Text, found: "+e)},i.ensureValidEmail=function(e){if("string"!=typeof e)throw new TypeError("Expecting an Email, found: "+e)},i.ensureValidBoolean=function(e){if("boolean"!=typeof e)throw new TypeError("Expecting a Boolean, found: "+e)},i.ensureValidDate=function(e){if(!e||e.constructor!==E)throw new TypeError("Expecting a Date, found: "+e)},i.ensureValidTime=function(e){if(!e||e.constructor!==E)throw new TypeError("Expecting a Time, found: "+e)},i.ensureValidDateTime=function(e){if(!e||e.constructor!==E)throw new TypeError("Expecting a DateTime, found: "+e)},i.ensureValidComplexType=function(e,t){if(e){if(e.constructor===t)return;if(void 0!==e.isCompatibleWith){if(e.isCompatibleWith(t))return;throw new TypeError("Expecting a "+t.name+" type, found: "+e.constructor.name)}}throw new TypeError("Expecting a Record or RecordList, found: "+e)},i.prototype.replaceWith=function(e){var t=i.getData(e);this.writePropagate(t,new w)},i.prototype.fastEquals=function(e){return this===e},i.prototype.equals=function(e){return e&&this.constructor===e.constructor?!0:!1},i.defineRecordClass=function(e){return r.defineRecordClass(e)},i.prototype.clone=function(){var e=this.constructor;return new e(this.data,this.cloneCache())},i}(I);t.Record=_;var x=function(){function e(e,t,n,r,i,o,a,s,u){this.name=e,this.attrName=t,this.nameForJson=n,this.mandatory=r,this.ignoreForServer=i,this.dataType=o,this.optimizeList=s,this.complexType=u,this.defaultValue=a()}return e}(),A=function(){function e(e,t,n,r,i,o,a,s,u){this.name=e,this.attrName=t,this.nameForJson=n,this.mandatory=r,this.ignoreForServer=i,this.dataType=o,this.defaultValueGetter=a,this.optimizeList=s,this.complexType=u}return Object.defineProperty(e.prototype,"defaultValue",{get:function(){return this.defaultValueGetter()},enumerable:!0,configurable:!0}),e}(),N=function(e){function t(t,n){return e.call(this,t,n)||this}return n.__extends(t,e),Object.defineProperty(t,"isGenericRecordType",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.getAttributes=function(){return this.constructor.Attributes||[]},t.getAttributes=function(){return this.Attributes||[]},t.isAnonymousRecord=function(){return this._isAnonymousRecord},t.attr=function(e,t,n,r,i,o,a,s,u){void 0===s&&(s=!0);var c;return"boolean"!=typeof s?(u=s,c=!0):c=s,o===y.DateTime||o===y.Date||o===y.Time?new A(e,t,n,r,i,o,a,c,u):new x(e,t,n,r,i,o,a,c,u)},t.attributesToDeclare=function(){return[]},t.init=function(){var e=this,n=e.attributesToDeclare();e.Attributes=n,n.forEach(function(t){t.attrName in e.prototype||(t.dataType===y.Record||t.dataType===y.RecordList?e.defineComplexProperty(t.attrName,t.dataType,t.complexType):e.defineBasicProperty(t.attrName,t.dataType))}),e.RecordClass=_.defineRecordClass(n.reduce(function(e,t){return e[t.attrName]=null,e},{}));var r="return function equals(other) {\n";r+=" return _super.prototype.equals.call(this, other)",n.forEach(function(e){r+=g(e.dataType)?" &&\n this."+e.attrName+".equals(other."+e.attrName+")":" &&\n (this."+e.attrName+" === other."+e.attrName+")"}),r+=";\n",r+="};",e.prototype.equals=new Function("_super",r)(t)},t.createDefaultData=function(){var e=this,t=e.RecordClass;if(t){for(var n={},r=0,i=e.Attributes;r<i.length;r++){var o=i[r];o.dataType===y.Record||o.dataType===y.RecordList?n[o.attrName]=_.getData(o.defaultValue):n[o.attrName]=o.defaultValue}return new t(n)}},t.defineBasicProperty=function(e,t){Object.defineProperty(this.prototype,e,{enumerable:!0,configurable:!0,get:function(){return this.getBasicProperty(e)},set:function(n){this.setBasicProperty(e,n,t)}})},t.defineComplexProperty=function(e,t,n){Object.defineProperty(this.prototype,e,{enumerable:!0,configurable:!0,get:function(){return this.getComplexProperty(e,n)},set:function(r){this.setComplexProperty(e,r,t,n)}})},t.isCompatibleWith=function(e){return this===e?!0:this.isAnonymousRecord()&&e.isAnonymousRecord()&&this.UniqueId===e.UniqueId},t.prototype.isCompatibleWith=function(e){return e.prototype instanceof t&&this.constructor.isCompatibleWith(e)},t.prototype.getNonSerializableAttributes=function(){return this.getAttributes().filter(function(e){return e.dataType===y.Object}).map(function(e){return e.attrName})},t.UniqueId="",t._isAnonymousRecord=!1,t}(_);t.GenericRecord=N;var C=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.getItemType=function(){return this.itemType},t.prototype.getCache=function(){return null},t.prototype.newItem=function(e){throw new Error("@abstract")},t.prototype.resetEmptyListItem=function(){this.data=this.data.setEmptyListItem(this.newItem())},Object.defineProperty(t.prototype,"emptyListItem",{get:function(){return this.isEmpty?this.data.getEmptyListItem():this.data.get(0)},set:function(e){if(this.isEmpty){if(this.data.getEmptyListItem()===e)return;this.writePropagate(this.data.setEmptyListItem(e),this.getCache())}else{if(this.data.get(0)===e)return;this.writePropagate(this.data.set(0,e),this.getCache())}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"modelId",{get:function(){return this.data.modelId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){return this.data.isEmpty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.data.count()},enumerable:!0,configurable:!0}),t.prototype.isValidIndex=function(e,t){return void 0===t&&(t=!1),e%1===0&&e>=0&&e<this.length+(t?1:0)},t.prototype.checkIndex=function(e,t){if(void 0===t&&(t=!1),!this.isValidIndex(e,t)){var n="Index out of bounds. Index "+e+" for ";throw n+=this.isEmpty?"empty list.":"bounds [0, "+(this.length-1)+"].",new Error(n)}},t.prototype.idOf=function(e){return this.checkIndex(e),this.data.getId(e)},t.prototype.append=function(e){this.writePropagate(this.data.push(e),this.getCache())},t.prototype.appendAll=function(e){e.length>0&&this.writePropagate(this.data.addFromOther(e.data),this.getCache())},t.prototype.pushAll=function(e){e.length>0&&this.writePropagate(this.data.pushAll(e),this.getCache())},t.prototype.insert=function(e,t){this.checkIndex(e,!0),this.writePropagate(this.data.insert(e,t),this.getCache())},t.prototype.remove=function(e){this.checkIndex(e),1===this.length&&this.resetEmptyListItem(),this.writePropagate(this.data.remove(e),this.getCache())},t.prototype.clear=function(){this.resetEmptyListItem(),this.writePropagate(this.data.clear(),this.getCache())},t.prototype.indexOf=function(e){for(var t=0;t<this.length;t++)if(e(this.getItem(t)))return t;return-1},t.prototype.any=function(e){return-1!==this.indexOf(e)},t.prototype.all=function(e){return!this.any(function(t){return!e(t)})},t.prototype.filter=function(e){for(var t=new this.constructor,n=[],r=0;r<this.length;r++){var i=this.getItem(r);e(i)&&n.push(i)}return t.pushAll(n),t},t.prototype.distinct=function(){for(var e=new this.constructor,t=new Array,n=0;n<this.length;n++){for(var r=this.getItem(n),i=!0,o=0;o<t.length;o++)if(d(r,this.getItem(t[o]))){i=!1;break}i&&(t.push(n),e.append(r))}return e},t.prototype.sort=function(e,t){for(var n=[],r=0;r<this.length;r++)n[r]=this.getItem(r);var i=t?1:-1;n.sort(function(t,n){return i*f(e(t),e(n))}),this.clear(),this.pushAll(n)},t.prototype.getCurrent=function(e){if(this.isEmpty)return this.emptyListItem;var t=this.getCurrentRowNumber(e);return this.getItem(t)},t.prototype.getCurrentRowNumber=function(e){return e.getCurrentRowNumber(this)},t.prototype.getItem=function(e){return this.checkIndex(e),this.data.get(e)},t.prototype.setCurrent=function(e,t){if(this.isEmpty)this.emptyListItem=t;else{var n=this.getCurrentRowNumber(e);this.setItem(n,t)}},t.prototype.setItem=function(e,t){this.checkIndex(e),this.data.get(e)!==t&&this.writePropagate(this.data.set(e,t),this.getCache())},t.prototype.fastEquals=function(e){return this===e},t.prototype.equals=function(e){if(!e||this.constructor!==e.constructor||this.length!==e.length)return!1;if(this.isEmpty){var t=this.emptyListItem,n=e.emptyListItem;return d(t,n)}for(var r=0;r<this.length;r++){var i=this.getItem(r),o=e.getItem(r),a=d(i,o);if(!a)return!1}return!0},t}(I);t.List=C;var O=function(e){function t(t){var n=e.call(this)||this;return n.data=t||new S(n.newItem()),n}return n.__extends(t,e),Object.defineProperty(t,"isBasicTypeListType",{get:function(){return!0},enumerable:!0,configurable:!0}),t.getTypeDefaultValue=function(){throw new Error("Not implemented: getTypeDefaultValue")},t.prototype.newItem=function(){var e=this.constructor;return e.getTypeDefaultValue()},t.prototype.clone=function(){var e=this.constructor,t=this.data.clone();return new e(t)},t}(C);t.BasicTypeList=O;var R=function(e){function t(t,n){var r=e.call(this)||this;if(r._recordType=r.constructor.getItemType(),!r._recordType)throw new TypeError("GenericRecordLists must define a RecordType");return t?r.data=t:r.data=new S(N.getData(r.newItem())),r.cache=n||new D,r}return n.__extends(t,e),Object.defineProperty(t,"isGenericRecordListType",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.getCache=function(){return this.cache},t.prototype.newItem=function(e){return new(this.getRecordType())(e)},t.prototype.resetEmptyListItem=function(){this.data=this.data.setEmptyListItem(N.getData(this.newItem()))},t.prototype.getRecordType=function(){return this._recordType},Object.defineProperty(t.prototype,"emptyListItem",{get:function(){return this.internalGetItem(0,this.isEmpty)},set:function(e){this.isEmpty?this.internalSetEmptyListItem(0,e):this.internalSetItem(0,e)},enumerable:!0,configurable:!0}),t.prototype.append=function(t){this.isEmpty&&this.cache.invalidate(0),e.prototype.append.call(this,N.getData(t)),this.cache.append(void 0)},t.prototype.appendAll=function(t){this.isEmpty&&this.cache.invalidate(0),e.prototype.appendAll.call(this,t),this.cache.appendMultiple(t.length)},t.prototype.pushAll=function(t){this.isEmpty&&this.cache.invalidate(0),e.prototype.pushAll.call(this,t.map(function(e){return _.getData(e)})),this.cache.appendMultiple(t.length)},t.prototype.insert=function(t,n){this.checkIndex(t,!0),this.isEmpty&&this.cache.invalidate(0),e.prototype.insert.call(this,t,N.getData(n)),this.cache.insert(t,void 0)},t.prototype.getItem=function(e){return this.internalGetItem(e,!1)},t.prototype.internalGetItem=function(e,n){n||this.checkIndex(e);var r=this.cache.getItem(e);return r?(t.setPropagationParent(r,this),t.setPropagationKey(r,e),r):(n?(r=this.newItem(this.data.getEmptyListItem()),t.setPropagationHandler(r,this,e,this.internalSetEmptyListItem)):(r=this.newItem(this.data.get(e)),t.setPropagationHandler(r,this,e,this.internalSetItem)),this.cache.setItem(e,r),r)},t.prototype.setItem=function(e,t){this.internalSetItem(e,t)},t.prototype.internalSetItem=function(e,t,n){var r=N.getData(t)||t;this.checkIndex(e),this.data.get(e)!==r&&(this.writePropagate(this.data.set(e,r),this.cache),this.cache.setItem(e,void 0))},t.prototype.internalSetEmptyListItem=function(e,t,n){var r=N.getData(t)||t;this.data.getEmptyListItem()!==r&&(this.writePropagate(this.data.setEmptyListItem(r),this.cache),this.cache.setItem(e,void 0))},t.prototype.remove=function(t){e.prototype.remove.call(this,t),this.cache.invalidate(t)},t.prototype.clear=function(){e.prototype.clear.call(this),this.cache.invalidate()},t.prototype.readAll=function(e,t){for(var n=[],r=0;r<t.length;r++){var i=this.newItem();e(i,t.item(r)),n.push(i)}this.pushAll(n)},t.prototype.clone=function(){var e=this.constructor,t=this.data.clone();return new e(t)},t.isCompatibleWith=function(e){return this===e?!0:this.getItemType().isCompatibleWith(e.getItemType())},t.prototype.isCompatibleWith=function(e){return e.prototype instanceof t&&this.constructor.isCompatibleWith(e)},t}(C);t.GenericRecordList=R;var L=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_INTEGER},t.itemType=y.Integer,t}(O);t.IntegerList=L;var M=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_LONGINTEGER},t.itemType=y.LongInteger,t}(O);t.LongIntegerList=M;var P=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_DATE},t.itemType=y.Date,t}(O);t.DateList=P;var F=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_DATETIME},t.itemType=y.DateTime,t}(O);t.DateTimeList=F;var V=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_TIME},t.itemType=y.Time,t}(O);t.TimeList=V;var U=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_DECIMAL},t.itemType=y.Decimal,t}(O);t.DecimalList=U;var j=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_CURRENCY},t.itemType=y.Currency,t}(O);t.CurrencyList=j;var k=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_EMAIL},t.itemType=y.Email,t}(O);t.EmailList=k;var B=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_PHONENUMBER},t.itemType=y.PhoneNumber,t}(O);t.PhoneNumberList=B;var q=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_BOOLEAN},t.itemType=y.Boolean,t}(O);t.BooleanList=q;var H=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_BINARYDATA},t.itemType=y.BinaryData,t}(O);t.BinaryDataList=H;var G=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.getTypeDefaultValue=function(){return T.DEFAULT_TEXT},t.itemType=y.Text,t}(O);t.TextList=G;var W=function(){function e(e){this.varValue=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this.varValue},set:function(e){this.setValue(e)},enumerable:!0,configurable:!0}),e.prototype.setValue=function(e){this.varValue=e},e}();t.BasicVariableHolder=W;var z=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),t.prototype.setValue=function(t){e.prototype.setValue.call(this,t?t.clone():t)},t}(W);t.VariableHolder=z,t.RecordWithStaticConstructor=m;var J=function(e){function t(t,n){return e.call(this,t,n)||this}return n.__extends(t,e),t.attributesToDeclare=function(){return[this.attr("JSON","jSONOut","jSONOut",!0,!0,y.Text,function(){return h(y.Text)})].concat(e.attributesToDeclare.call(this))},t=n.__decorate([m()],t)}(N);t.JSONSerializeOutputType=J;var K=function(e){function t(t,n){return e.call(this,t,n)||this}return n.__extends(t,e),t.attributesToDeclare=function(){return[this.attr("ExceptionMessage","exceptionMessageAttr","exceptionMessageAttr",!0,!0,y.Text,function(){return h(y.Text)})].concat(e.attributesToDeclare.call(this))},t=n.__decorate([m()],t)}(N);t.ErrorHandlerOutputType=K;var Q=function(){function e(){this.typeDefinitions=new Map,this.typeCache=new Map}return e.prototype.isTypeRegistered=function(e){return void 0!==this.typeDefinitions.get(e)},e.prototype.registerTypeDefinition=function(e,t){this.typeDefinitions.set(e,t)},e.prototype.getType=function(e){var t=this.typeCache.get(e);if(t)return t;var r=this.typeDefinitions.get(e);if(!r)throw new TypeError("Type "+e+" was not registered");var i=function(e){function t(t,n){return e.call(this,t,n)||this}return n.__extends(t,e),t.attributesToDeclare=function(){var t=this;return r.map(function(e){return t.attr(e.name,e.attrName,e.nameForJson||e.attrName,void 0===e.mandatory?!1:e.mandatory,void 0===e.ignoreForServer?!0:e.ignoreForServer,e.dataType,e.defaultValue,void 0===e.optimizeList?!0:e.optimizeList,e.complexType)}).concat(e.attributesToDeclare.call(this))},t=n.__decorate([m()],t)}(N);return this.typeCache.set(e,i),i},e}();t.RecordTypeFactory=Q;var X=function(e){function t(t,n,r){var i=e.call(this)||this;return i.mainAttributeName=t,i.mainAttributeAttrName=n,i.additionalAttributes=r,i}return n.__extends(t,e),t.prototype.registerTypeDefinition=function(e,t){throw new Error("Invalid operation")},t.prototype.createMainAttributeInfo=function(e){return{name:this.mainAttributeName,attrName:this.mainAttributeAttrName,mandatory:!0,dataType:this.getDataType(e),defaultValue:this.getDefaultValue(e),complexType:this.getComplexType(e)}},t.prototype.registerTypeIfNeeded=function(t){if(!this.isTypeRegistered(t)){var n=[this.createMainAttributeInfo(t)];this.additionalAttributes&&(n=n.concat(this.additionalAttributes)),e.prototype.registerTypeDefinition.call(this,t,n)}},t.prototype.getType=function(t){return this.registerTypeIfNeeded(t),e.prototype.getType.call(this,t)},t}(Q);t.TypeKeyedTypeFactory=X;var Y=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return n.__extends(t,e),t.prototype.getDataType=function(e){return e},t.prototype.getDefaultValue=function(e){return function(){return h(e)}},t.prototype.getComplexType=function(e){},t}(X);t.BasicTypeKeyedTypeFactory=Y;var $=function(e){function t(t,n,r){return e.call(this,t,n,r)||this}return n.__extends(t,e),t.prototype.getDataType=function(e){return y.Record},t.prototype.getDefaultValue=function(e){return function(){return I.getData(new e)}},t.prototype.getComplexType=function(e){return e},t}(X);t.ComplexTypeKeyedTypeFactory=$;var Z;!function(e){function n(e){return e&&e.constructor===t.Decimal}function r(e){return e&&e.value&&e.value.constructor===b}function i(e){return n(e)&&!e.isNaN()}function o(e){return T.MIN_DECIMAL_VALUE.lessThanOrEqualTo(e)&&T.MAX_DECIMAL_VALUE.greaterThanOrEqualTo(e)}function a(e){return"string"==typeof e}function s(e){return"boolean"==typeof e}function u(e){return a(e)||d(e)||s(e)||v(e)||g(e)||n(e)}function l(e){return f(e)&&e%1===0}function f(e){return d(e)&&!isNaN(e)}function d(e){return"number"==typeof e}function p(e){return e>=T.MIN_INTEGER_VALUE&&e<=T.MAX_INTEGER_VALUE}function h(e){return g(e)}function g(e){return e&&e.constructor===t.LongInteger}function m(e){return w(e)&&e.hours===T.DEFAULT_DATE.hours&&e.minutes===T.DEFAULT_DATE.minutes&&e.seconds===T.DEFAULT_DATE.seconds}function y(e){return w(e)&&e.year===T.DEFAULT_TIME.year&&e.month===T.DEFAULT_TIME.month&&e.day===T.DEFAULT_TIME.day}function v(e){return e instanceof E}function w(e){return v(e)&&!isNaN(e.getTime())}function D(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function S(e){return D(e)&&!isNaN(e.getTime())}function I(e){return!!e&&(void 0!==e.content||void 0!==e.url)}function _(e){var t="",n="";if(e.greaterThan(L))t="maximum",n=L.toString();else{if(!e.lessThan(M))return;t="minimum",n=M.toString()}var r="Unable to convert "+e.toString()+" to the Javascript Number type since exceeds the "+t+" value allowed which is "+n+".";throw new c.Exceptions.NumberOverflowException(r)}function x(e){var t=16;if(e.decimalPlaces()>t){var n="Unable to convert "+e.toString()+" to the Javascript Number type because it will lead to precision loss. The maximum safe number of digits after the decimal point is "+t+".";throw new c.Exceptions.NumberOverflowException(n)}}function A(e,t,n,r){return"Unable to convert "+e+" to the "+t+" type since it exceeds the "+n+" value allowed which is "+r+"."}function N(e,t,n,r){var i=P.None,o="",a=Math.max(t,M),s=Math.min(n,L);if(a>e)i=P.Minimum,o=a.toString();else{if(!(e>s))return null;i=P.Maximum,o=s.toString()}throw new c.Exceptions.NumberOverflowException(A(e.toString(),r,i,o))}function C(e){N(e,T.MIN_INTEGER_VALUE,T.MAX_INTEGER_VALUE,"Integer")}function O(e){N(e,T.MIN_LONGINTEGER_VALUE.toNumber(),T.MAX_LONGINTEGER_VALUE.toNumber(),"Long Integer")}function R(e){N(e,T.MIN_DECIMAL_VALUE.toNumber(),T.MAX_DECIMAL_VALUE.toNumber(),"Decimal")}e.isDecimal=n,e.isBinaryData=r,e.isValidDecimal=i,e.isWithinDecimalRange=o,e.isText=a,e.isBoolean=s,e.isBasicType=u,e.isValidInteger=l,e.isValidJsNumber=f,e.isJsNumber=d,e.isWithinIntegerRange=p,e.isValidLongInteger=h,e.isLongInteger=g,e.isValidDate=m,e.isValidTime=y,e.isDateTime=v,e.isValidDateTime=w,e.isJsDate=D,e.isValidJsDate=S,e.hasBinaryDataInterface=I;var L=9007199254740991,M=-9007199254740991;e.ensureNumberInsideBounds=_,e.ensureNumberPrecision=x;var P=function(){function e(){}return Object.defineProperty(e,"None",{get:function(){return""},enumerable:!0,configurable:!0}),Object.defineProperty(e,"Minimum",{get:function(){return"minimum"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"Maximum",{get:function(){return"maximum"},enumerable:!0,configurable:!0}),e}();e.ensureIntegerInsideBounds=C,e.ensureLongIntegerInsideBounds=O,e.ensureDecimalInsideBounds=R}(Z=t.TypeValidations||(t.TypeValidations={}))}),define("OutSystems/ClientRuntime/RegExpHelper",["require","exports"],function(e,t){"use strict";function n(e,t,n){void 0===n&&(n=!1);for(var r=[],i=new RegExp(t,"g"+(n?"i":"")),a=i.exec(e);a;)r.push(new o(a,i.lastIndex)),a=i.exec(e);return r}function r(e,t,r,i){void 0===r&&(r=!1);for(var o=n(e,t,r),a=e,s=0,u=0;u<o.length;u++){var c=o[u],l=i(c);a=a.substr(0,c.index+s)+l+a.substr(s+c.index+c.length),s+=l.length-c.length}return a}function i(e){return e?e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"):e}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){this._groups=e,this._index=t-this._groups[0].length}return Object.defineProperty(e.prototype,"value",{get:function(){return this._groups[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._groups[0].length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groups",{get:function(){return this._groups},enumerable:!0,configurable:!0}),e}();t.Match=o,t.matches=n,t.replace=r,t.escape=i}),define("OutSystems/ClientRuntime/Database",["require","exports","tslib","./Exceptions","./Flow","./NativeHelper","./Logger","./RegExpHelper"],function(e,t,n,r,i,o,a,s){"use strict";function u(e){a.error("Database",c),"undefined"!=typeof SQLError&&e instanceof SQLError?a.error("Database","SQLError "+e.code+": "+e.message):a.error("Database",e)}Object.defineProperty(t,"__esModule",{value:!0});var c="Failed to execute canary query (probably due to zombie transaction)",l=function(){function e(e){this.callback=e}return e; }(),f=function(e){function t(t){var n=e.call(this,t)||this;return n.callback=t,n}return n.__extends(t,e),t}(l),d=function(e){function t(t){var n=e.call(this,t)||this;return n.callback=t,n}return n.__extends(t,e),t}(l),p=function(){function e(e,t){void 0===t&&(t=!0),this.tx=e,this.allowTraces=t,this.chain=[],this.pendingResult=null,this.hasPendingResult=!1,this.pendingError=null,this.hasPendingError=!1,this.parent=null}return e.prototype.cloneForNext=function(){var t=new e(this.tx,this.allowTraces);return t.parent=this,t},e.prototype.andThen=function(e){return this.hasPendingError||(this.chain.push(new f(e)),this.triggerPendingResults()),this},e.prototype.withoutTraces=function(e){return this.andThen(function(t,n){return t.allowTraces=!1,e(t,n)})},e.prototype.andThenAll=function(e){return this.andThen(function(t,n){var r=e(n),i=t.feed(void 0);if(r)for(var o=0;o<r.length;o++)i=i.andThen(r[o]);return i.andThen(function(){})})},e.prototype.extractScalar=function(e){var t=Object.keys(e);if(1===t.length){var n=t[0];return e[n]}throw new r.Exceptions.DataBaseException("","Invalid use of 'extractScalar': the row should have a single column, but found '"+t.join("', '")+"'")},e.prototype.executeScalar=function(e,t){var n=this;return this.executeQueryRaw(e,t).andThen(function(e,t){return 0===t.rows.length?void 0:n.extractScalar(t.rows.item(0))})},e.prototype.executeQuery=function(e,t,n){return this.executeQueryRaw(e,n).andThen(function(e,n){for(var r=new Array(n.rows.length),i=0;i<n.rows.length;i++){var o=n.rows.item(i);r[i]=t(o)}return r})},e.prototype.executeNonQuery=function(e,t){return this.executeQueryRaw(e,t).andThen(function(e,t){})},e.prototype.executeQueryRaw=function(t,n){var r=this,i=e.queryCount++,o=n||[];return this.traceQuery(i,t,o),this.tx.executeSql(t,n,function(e,t){try{r.continueWithNext(t)}catch(n){r.abortExplicitly(e,n)}},function(e,t){return r.trace("SQL command #"+i+" failed with error "+t.message),r.abort(t)}),this},e.prototype.feed=function(e){return this.hasPendingResult=!0,this.pendingResult=e,this},e.prototype.onError=function(e){return this.chain.push(new d(e)),this.triggerPendingError(),this},e.prototype.nextCallback=function(e){for(var t=0;t<this.chain.length;t++)if(e(this.chain[t])){var n=this.chain[t].callback;return this.chain=this.chain.slice(t+1,this.chain.length),n}return null},e.prototype.nextErrorCallback=function(){return this.nextCallback(function(e){return e instanceof d})},e.prototype.hasErrorCallback=function(){return this.chain.some(function(e){return e instanceof d})},e.prototype.nextSuccessCallback=function(){return this.nextCallback(function(e){return e instanceof f})},e.prototype.abort=function(e){var t=this.nextErrorCallback();if(t){this.pendingError=null,this.hasPendingError=!1;try{var n=!1,r=function(){n=!0},i=t(e,r);return n?this.chain=[]:this.continueWithNext(i),n}catch(o){if(this.hasErrorCallback())return this.abort(o);if(this.parent)return this.parent.abort(o);throw o}}else this.pendingError=e,this.hasPendingError=!0;return this.parent?this.parent.abort(e):!0},e.prototype.abortExplicitly=function(e,t){this.abort(t)&&e.executeSql("ABORT_TRANSACTION",null,function(){},function(){return!0})},e.prototype.continueWithNext=function(t){var n=this;if(this.hasPendingResult=!1,t instanceof e)return void t.andThen(function(e,t){n.continueWithNext(t)});if(t instanceof Array&&0!==t.length&&t[0]instanceof e){var r=0,i=function(){r<t.length?(t[r].andThen(i),r++):n.continueWithNext(t)};return void i()}if(this.chain.length>0){var o=this.nextSuccessCallback();if(o)return void this.continueWithNext(this.tryNextItem(o,this.cloneForNext(),t))}this.hasPendingResult=!0,this.pendingResult=t},e.prototype.tryNextItem=function(e,t,n){try{return e(t,n)}catch(r){this.abortExplicitly(this.tx,r)}},e.prototype.triggerPendingResults=function(){this.hasPendingResult&&(this.hasPendingResult=!1,this.continueWithNext(this.pendingResult))},e.prototype.triggerPendingError=function(){this.hasPendingError&&(this.hasPendingError=!1,this.abort(this.pendingError))},e.prototype.trace=function(e){this.allowTraces&&a.trace(this,e)},e.prototype.traceQuery=function(e,t,n){this.allowTraces&&a.trace(this,function(){var r=(n||[]).map(function(e){return String(e).substr(0,80)});return"Executing SQL command #"+e+": "+t+" with arguments "+r})},e["for"]=function(t){return new e(t)},e.queryCount=0,e}(),h=function(){function e(e,t){this.dbName=e,this.db=t,this.txCount=0,this.setDispose()}return e.prototype.setDispose=function(){var e=this,t=this.db;window&&t&&t.close&&window.addEventListener("unload",function(){e.trace("Closing database "+e.name),t.close(function(){return e.trace("Database "+e.name+" closed successfully")},function(t){return a.error("SqlDatabase","Database "+e.name+" failed to close",t)})},!1)},Object.defineProperty(e.prototype,"name",{get:function(){return this.dbName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMock",{get:function(){return!1},enumerable:!0,configurable:!0}),e.prototype.executeTransaction=function(e,t){return void 0===t&&(t=!0),this.innerExecuteTransaction(e,!1,t)},e.prototype.executeReadTransaction=function(e,t){return void 0===t&&(t=!0),this.innerExecuteTransaction(e,!0,t)},e.prototype.innerExecuteTransaction=function(e,t,n){var o=this,a=t?"READ":"WRITE",s=t?this.db.readTransaction:this.db.transaction,u=++this.txCount;return i.promise(function(t,i){var c,l;o.trace("Opening local storage "+a+" transaction #"+u+" on database "+o.name,n),s.call(o.db,function(t){o.trace("Executing local storage "+a+" transaction #"+u+" on database "+o.name,n);var r=p["for"](t).feed(void 0);return r=n?r.andThen(e):r.withoutTraces(e),r.andThen(function(e,t){return c=t}).onError(function(e,t){l=e,t()})},function(e){l=l||e;var t=l&&l.message?l:new Error(l);return o.trace("Rolled back local storage "+a+" transaction #"+u+" on database "+o.name+": "+t.message,n),i(new r.Exceptions.DataBaseException("",t.message.toString())),!0},function(){o.trace("Committed local storage "+a+" transaction #"+u+" on database "+o.name,n),t(c)})})},e.prototype.testConnection=function(){var e=this,t=5,n=0;return this.trace("Starting to test on database connections. Performing #"+t+" test queries."),Promise.all(Array.apply(null,{length:t}).map(function(t,r){return new Promise(function(t){e.executeTransaction(function(e){return e.executeQueryRaw("SELECT 1").onError(function(e,t){u(e),n++})})["catch"](function(e){u(e),n++}).then(function(){t()})})})).then(function(){e.trace("Finished tests on database connections. #"+(t-n)+" out of #"+t+" successfull queries.")})},e.prototype.trace=function(e,t){void 0===t&&(t=!0),t&&a.trace(this,e)},e}(),g=function(){function e(e,t){this.dbName=e,this.db=t}return Object.defineProperty(e.prototype,"name",{get:function(){return this.dbName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMock",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.executeTransaction=function(e,t){return void 0===t&&(t=!0),i.resolve()},e.prototype.executeReadTransaction=function(e,t){return void 0===t&&(t=!0),i.resolve()},e.prototype.testConnection=function(){return Promise.resolve()},e}(),m="Could not open database",y=function(){function e(){this.dbCache={}}return e.prototype.trace=function(e){a.trace(this,e)},e.prototype.asSafeDbName=function(e){return e||""},e.prototype.openDb=function(e){var t=this;return e=this.asSafeDbName(e),i.promise(function(n,i){t.dbCache[e]?n(t.dbCache[e]):o.ensureNativeReady().then(function(){if("undefined"==typeof window)return i(new r.Exceptions.SystemException("Database is only available in the browser/web view"));var a=window;if(o.isRunningOnNative())if(a.sqlitePlugin){t.trace("Opening database '"+e+"'");try{a.sqlitePlugin.openDatabase({name:e,location:"default"},function(o){o?(t.trace("Database '"+e+"' opened successfully"),t.dbCache[e]=new h(e,o),n(t.dbCache[e])):(t.trace("Error opening database '"+e+"'"),i(new r.Exceptions.OpenDatabaseException(m+" '"+e+"'")))},function(n){t.trace("Error opening database '"+e+"' "+n.message),i(new r.Exceptions.OpenDatabaseException(m+" '"+e+"': "+n.message.toString()))})}catch(s){i(new r.Exceptions.OpenDatabaseException(m+" '"+e+"': "+s.message.toString()))}}else i(new r.Exceptions.OpenDatabaseException("No database driver available"));else if(a.openDatabase)try{t.trace("Opening database '"+e+"'");var u=a.openDatabase(e,"1.0",e,5242880);u?(t.trace("Database '"+e+"' opened successfully"),t.dbCache[e]=new h(e,u),n(t.dbCache[e])):(t.trace("Error opening database '"+e+"'"),i(new r.Exceptions.OpenDatabaseException(m+" '"+e+"'")))}catch(s){i(new r.Exceptions.OpenDatabaseException(m+" '"+e+"': "+s.message.toString()))}else{var c=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),l=!!a.chrome,f="Your app requires native access to a Local Storage database that is not available in your browser.\n\nPlease test your app in your mobile device"+(c||l?"":", or use Google Chrome or Safari web browsers")+".";alert(f),i(new r.Exceptions.SystemException(f))}})["catch"](i)})},e.prototype.mockDb=function(e){return i.resolve(new g(e,null))},e}();t.SqlDbProvider=new y;var v;!function(e){e[e.Full=0]="Full",e[e.Type=1]="Type",e[e.Length=3]="Length",e[e.Decimals=5]="Decimals"}(v||(v={}));var b="^([a-z]+)(\\(([0-9]+)(\\,([0-9]+))?\\))?$",T=function(){function e(){}return e.prototype.tableExists=function(e,t){return e.executeReadTransaction(function(e){return e.executeScalar("SELECT COUNT(*) FROM sqlite_master WHERE type = 'table' AND name = UPPER(?)",[t]).andThen(function(e,t){return 0!==t})})},e.prototype.columnExists=function(e,t,n){return e.executeReadTransaction(function(e){return e.executeScalar('SELECT "'+t+'"."'+n+'" FROM "'+t+'" LIMIT 1')}).then(function(){return!0})["catch"](function(){return!1})},e.prototype.dbTypeFromSchemaType=function(e){switch(e=e||"",e.toUpperCase()){case"INTEGER":return 3;case"BIGINT":return 4;case"REAL":return 5;case"BOOLEAN":return 2;case"TEXT":return 0;case"DATE":return 7;case"TIME":return 8;case"DATETIME":return 6;case"BLOB":return 1;default:return 9}},e.prototype.pragmaToTableInfo=function(e,t,n){var r=this;t=t||"";var i=t.search(/INTEGER PRIMARY KEY AUTOINCREMENT/i)>=0,o={tableName:e,idIsAutoNumber:i?2:0,attributes:n.map(function(e){var t=s.matches(e.type,b,!0).shift();if(t){var n=r.dbTypeFromSchemaType(t.groups[1]);return{name:e.name,type:n,length:t.groups[3]?parseInt(t.groups[3],10):void 0,decimals:t.groups[5]?parseInt(t.groups[5],10):void 0,isEntityReference:"NULL"===e.dflt_value&&r.isIdentifierUnderlyingType(n),isPrimaryKey:1===e.pk}}})};return o},e.prototype.isIdentifierUnderlyingType=function(e){switch(e){case 3:case 4:case 0:return!0;default:return!1}},e.prototype.introspectTableInfo=function(e,t){var n=this;if(!o.isRunningOnNative())return e.feed(null);var r;return e.executeScalar("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = '"+t+"'").andThen(function(e,t){return r=t}).andThen(function(e,n){return e.executeQuery("PRAGMA table_info('"+t+"')",function(e){return e})}).andThen(function(e,i){return n.pragmaToTableInfo(t,r,i)})},e}();t.SqlDbIntrospector=new T}),define("OutSystems/ClientRuntime/RolesInfo",["require","exports","./StorageProvider","./ApplicationInfo","./CookiesManager","./Exceptions","./Logger"],function(e,t,n,r,i,o,a){"use strict";function s(e){return t.RolesInfoPersistentStorage=e,!c()&&0!==this.getUserId()&&t.RolesInfoPersistentStorage?t.RolesInfoPersistentStorage.getValue(t.ROLES_INFO_MODULE_NAME).then(function(e){return t.RolesInfoStorage.rolesInfo.set(e)}):Promise.resolve(void 0)}function u(e){c()&&e===t.RolesInfoStorage.rolesInfo.get()||!t.RolesInfoPersistentStorage||t.RolesInfoPersistentStorage.setValue(t.ROLES_INFO_MODULE_NAME,e),t.RolesInfoStorage.rolesInfo.set(e)}function c(){return t.RolesInfoStorage.rolesInfo.isDefined()}function l(){var e=i.readCookie(r.getUserCookieName());if(a.trace(t.ROLES_INFO_MODULE_NAME,"Checking User's ID: User cookie value ("+e+")"),null==e)return 0;var n=/uid=(\d+)/,o=e.match(n);return null==o?(a.trace(t.ROLES_INFO_MODULE_NAME,"Checking User's ID: User is Anonymous"),0):parseInt(o[1],10)}function f(){if(0===this.getUserId())throw a.trace(t.ROLES_INFO_MODULE_NAME,"Checking authorization: Not authorized since user is not registered"),new o.Exceptions.NotRegisteredException("","Registered role required");a.trace(t.ROLES_INFO_MODULE_NAME,"Checking authorization: User authorized since it is registered")}function d(e){if(0===this.getUserId())throw a.trace(t.ROLES_INFO_MODULE_NAME,"Checking authorization: Not authorized because user is not logged in"),e[e.length-1].roleException;if(!c())throw a.trace(t.ROLES_INFO_MODULE_NAME,"Checking authorization: Not authorized since user don't have roles for the specified user provider"),e[e.length-1].roleException;a.trace(t.ROLES_INFO_MODULE_NAME,function(){var t="";return e.forEach(function(e){return t+=e.roleException.message+" [RoleKey="+e.roleKey+"] "}),"Checking authorization: Required Roles ( "+t+")"});var n=t.RolesInfoStorage.rolesInfo.get();if(a.trace(t.ROLES_INFO_MODULE_NAME,"Checking authorization: User roles keys ("+n+")"),!e.some(function(e){return n.indexOf(e.roleKey)>=0}))throw a.trace(t.ROLES_INFO_MODULE_NAME,"Checking authorization: Not authorized since roles don't match"),e[e.length-1].roleException;a.trace(t.ROLES_INFO_MODULE_NAME,"Checking authorization: User authorized due to role match")}Object.defineProperty(t,"__esModule",{value:!0}),t.ROLES_INFO_MODULE_NAME="RolesInfo",t.RolesInfoStorage={rolesInfo:new n.StorageObject(n.StorageType.Persistent,t.ROLES_INFO_MODULE_NAME,null,r.getUserProviderName)},t.initialize=s,t.storeRoleInformation=u,t.areRolesDefined=c,t.getUserId=l,t.checkRegistered=f,t.checkRoles=d}),define("OutSystems/ClientRuntime/BuiltinFunctions",["require","exports","./DataTypes","./ApplicationInfo","./Navigation","./RolesInfo"],function(e,t,n,r,i,o){"use strict";function a(e){return void 0===e&&(e=n.Constants.FORMAT.defaultDateTimeFormat),{year:parseInt(RegExp["$"+(e.yearIndexForDate+1)],10),month:parseInt(RegExp["$"+(e.monthIndexForDate+1)],10),day:parseInt(RegExp["$"+(e.dayIndexForDate+1)],10)}}function s(e){void 0===e&&(e=n.Constants.FORMAT.defaultDateTimeFormat);var t=parseInt(RegExp["$"+(e.secondsIndexForTime+1)],10);return{hours:parseInt(RegExp["$"+(e.hoursIndexForTime+1)],10),minutes:parseInt(RegExp["$"+(e.minutesIndexForTime+1)],10),seconds:isNaN(t)?0:t}}function u(e){void 0===e&&(e=n.Constants.FORMAT.defaultDateTimeFormat);var t=parseInt(RegExp["$"+(e.secondsIndexForDateTime+1)],10);return{year:parseInt(RegExp["$"+(e.yearIndexForDateTime+1)],10),month:parseInt(RegExp["$"+(e.monthIndexForDateTime+1)],10),day:parseInt(RegExp["$"+(e.dayIndexForDateTime+1)],10),hours:parseInt(RegExp["$"+(e.hoursIndexForDateTime+1)],10),minutes:parseInt(RegExp["$"+(e.minutesIndexForDateTime+1)],10),seconds:isNaN(t)?0:t}}function c(e){var t=e.abs();return t.isNaN()?n.Constants.DEFAULT_DECIMAL:t}function l(e,t){var r=e.mod(t);return r.isNaN()?n.Constants.DEFAULT_DECIMAL:r}function f(e,t){var r=e.pow(t);return r.isNaN()?n.Constants.DEFAULT_DECIMAL:r}function d(e,t){void 0===t&&(t=0);var r=e.toDecimalPlaces(t);return r.isNaN()?n.Constants.DEFAULT_DECIMAL:r}function p(e){try{var t=e.sqrt();return t.isNaN()?n.Constants.DEFAULT_DECIMAL:t}catch(r){return n.Constants.DEFAULT_DECIMAL}}function h(e){var t=e.trunc();return t.isNaN()?n.Constants.DEFAULT_DECIMAL:t}function g(e,t){var r=n.Decimal.max(e,t);return r.isNaN()?n.Constants.DEFAULT_DECIMAL:r}function m(e,t){var r=n.Decimal.min(e,t);return r.isNaN()?n.Constants.DEFAULT_DECIMAL:r}function y(e){var t=new n.Decimal(0);return e.eq(t)||e.isNaN()?n.Constants.DEFAULT_INTEGER:e>t?1:-1}function v(e){var t=65535,r=0;return e>=r&&t>=e?String.fromCharCode(e):n.Constants.DEFAULT_TEXT}function b(e,t){return(e||"")+(t||"")}function T(e){if(void 0===e||""===e)return e;var t=[],n=" ".charCodeAt(0),r="\n".charCodeAt(0),i=" ";e.charCodeAt(0)===n?t[0]=i:t[0]=e.charAt(0);for(var o=1;o<e.length-1;++o)e.charCodeAt(o)!==n||e.charCodeAt(o-1)!==r&&e.charCodeAt(o+1)!==n?t[o]=e.charAt(o):t[o]=i;return 1!==e.length&&(e.charCodeAt(e.length-1)===n?t[e.length-1]=i:t[e.length-1]=e.charAt(e.length-1)),t.join("")}function E(e){for(var t=[],n=0;n<e.length;++n){var r=e.charCodeAt(n);60===r?t.push("<"):62===r?t.push(">"):38===r?t.push("&"):34===r?t.push("""):39===r?t.push("'"):r>=160&&255>=r?t.push("&#"+r+";"):t.push(e.charAt(n))}return t.join("")}function w(e){return void 0===e?"":T(E(e)).replace(/\r/g,"").replace(/ /g,"").replace(/\n/g,"<br/>").replace(/ /g,"<br/>")}function D(e){return e.replace(/\\/g,"\\x5c").replace(/'/g,"\\x27").replace(/\"/g,"\\x22").replace("&","\\x26").replace("<","\\x3c").replace(/>/g,"\\x3e").replace(/\r/g,"\\r").replace(/\n/g,"\\n")}function S(e){return encodeURIComponent(e).replace(/'/g,"%27").replace(/%20/g,"+")}function I(e,t,n,r,i){try{if(0===t.length||0>n||n>_(e))return-1;i&&(e=e.toLocaleLowerCase(),t=t.toLocaleLowerCase()),n&&n>0&&(n=e.match(new RegExp("("+Ut+".|.){"+n+"}"))[0].length);var o=r?e.lastIndexOf(t,n||e.length):e.indexOf(t,n||0);return 0>o?-1:_(e.substr(0,o))}catch(a){return-1}}function _(e){var t=e.match(jt);return e.length-(t?t.length:0)}function x(e,t,n){var r=t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1");return e.replace(new RegExp(r,"g"),n)}function A(e,t,r){var i=_(e);if(t>=0&&r>0&&i>=t+1)i=r;else{if(!(t>=0&&r>0&&i>t))return n.Constants.DEFAULT_TEXT;i-=t}var o=e.match(jt);return o?e.match(new RegExp("("+Ut+".|.){"+t+"}(("+Ut+".|.){"+i+"})"))[2]:e.substr(t,i)}function N(e){return e.toLowerCase()}function C(e){return e.toUpperCase()}function O(e){return e.trim()}function R(e){for(var t=0,n=" ";e[t]===n;)t++;return e.substr(t)}function L(e){for(var t=e.length-1,n=" ";e[t]===n;)t--;return e.substr(0,t+1)}function M(e,t){return e.addDays(t)}function P(e,t){return e.addHours(t)}function F(e,t){return e.addMinutes(t)}function V(e,t){return e.addSeconds(t)}function U(e,t){return e.addYears(t)}function j(e,t){return e.addMonths(t)}function k(e,t){return new n.DateTime(e.year,e.month,e.day,t.hours,t.minutes,t.seconds,t.milliseconds)}function B(){var e=new n.DateTime(new Date);return new n.DateTime(e.year,e.month,e.day)}function q(){return new n.DateTime(new Date)}function H(){var e=new n.DateTime(new Date);return new n.DateTime(1900,1,1,e.hours,e.minutes,e.seconds)}function G(e){return e.weekDay}function W(e,t,n){var r=36e5>=n,i=6e4>=n,o=1e3>=n,a=z(e,r,i,o).toNative(),s=z(t,r,i,o).toNative(),u=Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),0),c=Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate(),s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),0),l=c-u;return Math.floor(l/n)}function z(e,t,r,i){return new n.DateTime(e.year,e.month,e.day,t?e.hours:0,r?e.minutes:0,i?e.seconds:0)}function J(e,t){return W(e,t,864e5)}function K(e,t){return W(e,t,36e5)}function Q(e,t){return W(e,t,6e4)}function X(e,t){return W(e,t,1e3)}function Y(e){return e.year}function $(e){return e.month}function Z(e){return e.day}function ee(e){return e.hours}function te(e){return e.minutes}function ne(e){return e.seconds}function re(e,t,r){return se(e,t,r,0,0,0)?new n.DateTime(e,t,r):n.Constants.DEFAULT_DATE}function ie(e,t,r,i,o,a){return se(e,t,r,i,o,a)?new n.DateTime(e,t,r,i,o,a):n.Constants.DEFAULT_DATETIME}function oe(e,t,r){return ae(e,t,r)?new n.DateTime(1900,1,1,e,t,r):n.Constants.DEFAULT_TIME}function ae(e,t,r){var i=new n.DateTime(1900,1,1,e,t,r);return i.hours===e&&i.minutes===t&&i.seconds===r}function se(e,t,r,i,o,a){var s=new n.DateTime(e,t,r,i,o,a);return s.year===e&&s.month===t&&s.day===r&&s.hours===i&&s.minutes===o&&s.seconds===a}function ue(e){return e?1:0}function ce(e){return e?n.LongInteger.fromNumber(1):n.LongInteger.fromNumber(0)}function le(e){return new n.Decimal(e?1:0)}function fe(e){return e===!0?"True":e===!1?"False":n.Constants.DEFAULT_TEXT}function de(e){return new n.DateTime(e.year,e.month,e.day)}function pe(e){return new n.DateTime(1900,1,1,e.hours,e.minutes,e.seconds)}function he(e){return e.toString(n.Constants.FORMAT.defaultDateTimeFormat.dateTimeFormat)}function ge(e){return e.toString(n.Constants.FORMAT.defaultDateTimeFormat.dateFormat)}function me(e){return e}function ye(e){return!e.eq(new n.Decimal(0))}function ve(e){return n.TypeValidations.isValidDecimal(e)?e.toString():n.Constants.DEFAULT_TEXT}function be(e){return e.gte(n.Constants.MIN_INTEGER_VALUE)&&e.lte(n.Constants.MAX_INTEGER_VALUE)}function Te(e){return be(e)?e.round().toNumber():n.Constants.DEFAULT_INTEGER}function Ee(e){return e.gte(n.Constants.MIN_LONGINTEGER_VALUE.toString())&&e.lte(n.Constants.MAX_LONGINTEGER_VALUE.toString())}function we(e){return Ee(e)?n.LongInteger.fromString(e.round().toString()):n.Constants.DEFAULT_LONGINTEGER}function De(e){return new n.Decimal(e.toString())}function Se(e){return n.TypeValidations.isWithinIntegerRange(e.toNumber())}function Ie(e){var t=e.toNumber();return n.TypeValidations.isWithinIntegerRange(t)?t:n.Constants.DEFAULT_INTEGER}function _e(e){return e}function xe(e){return n.TypeValidations.isValidLongInteger(e)?e.toString():n.Constants.DEFAULT_TEXT}function Ae(e){return e}function Ne(e){return e}function Ce(e){return e}function Oe(e){return n.LongInteger.fromNumber(e)}function Re(e){return e}function Le(e){return 0!==e}function Me(e){return n.TypeValidations.isValidInteger(e)?e.toString():n.Constants.DEFAULT_TEXT}function Pe(e){return new n.Decimal(e)}function Fe(){return 0}function Ve(){return""}function Ue(){return n.Constants.DEFAULT_DATE}function je(){return null}function ke(){return n.Constants.DEFAULT_BINARYDATA}function Be(e,t){var r=t.getRegExpForDate().test(e);if(r){var i=a(t),o=new n.DateTime(i.year,i.month,i.day);r=o.year===i.year&&o.month===i.month&&o.day===i.day}return r}function qe(e,t){if(!Be(e,t))return n.DateTime.defaultValue;t.getRegExpForDate().test(e);var r=a(t);return new n.DateTime(r.year,r.month,r.day)}function He(e,t){var n=t.getRegExpForDateTime().test(e);if(n){var r=u(t);n=se(r.year,r.month,r.day,r.hours,r.minutes,r.seconds)}return n}function Ge(e,t){if(!He(e,t))return n.DateTime.defaultValue;var r=u(t);return new n.DateTime(r.year,r.month,r.day,r.hours,r.minutes,r.seconds)}function We(e){return-1!==e.toUpperCase().indexOf("T")}function ze(e){return-1!==e.indexOf(" ")}function Je(e){var t=e.toUpperCase().search("T| ");return-1!==t&&(e=e.substring(0,t)),e}function Ke(e){var t=n.Constants.FORMAT.dateTimeFormats;e=Je(e);for(var r=0;r<t.length;++r)if(Be(e,t[r]))return!0;return!1}function Qe(e){var t=n.Constants.FORMAT.dateTimeFormats;e=Je(e);for(var r=0;r<t.length;++r){var i=qe(e,t[r]);if(!i.eq(n.DateTime.defaultValue))return i}return n.DateTime.defaultValue}function Xe(e){return We(e)?!isNaN(Date.parse(e)):!0}function Ye(e){var t=n.Constants.FORMAT.dateTimeFormats;if(We(e))return Xe(e);ze(e)||(e+=" 00:00:00");for(var r=0;r<t.length;++r)if(He(e,t[r]))return!0;return!1}function $e(e){var t=n.Constants.FORMAT.dateTimeFormats;if(We(e))return n.DateTime.fromISODateTime(e);ze(e)||(e+=" 00:00:00");for(var r=0;r<t.length;++r){var i=Ge(e,t[r]);if(!i.eq(n.DateTime.defaultValue))return i}return n.DateTime.defaultValue}function Ze(e){var t=e.indexOf(" ");return-1!==t&&(e=e.substring(t+1,e.length)),e}function et(e,t){if(void 0===t&&(t=n.Constants.FORMAT.defaultDateTimeFormat),We(e))return Xe(e);ze(e)&&(e=Ze(e));var r=t.getRegExpForTime().test(e);if(r){var i=s(t);r=ae(i.hours,i.minutes,i.seconds)}return r}function tt(e){if(We(e)){var t=n.DateTime.fromISODateTime(e);return new n.DateTime(1900,1,1,t.hours,t.minutes,t.seconds,t.milliseconds)}return ze(e)&&(e=Ze(e)),nt(e,n.Constants.FORMAT.defaultDateTimeFormat)}function nt(e,t){if(!et(e,t))return n.DateTime.defaultValue;t.getRegExpForTime().test(e);var r=s(t);return new n.DateTime(1900,1,1,r.hours,r.minutes,r.seconds)}function rt(e){return e.toString(n.Constants.FORMAT.defaultDateTimeFormat.timeFormat)}function it(e){if(n.Constants.FORMAT.numberFormat.getRegExpForInteger().test(e)){var t=parseInt(e,10);if(!isNaN(t)&&t>=n.Constants.MIN_INTEGER_VALUE&&t<=n.Constants.MAX_INTEGER_VALUE)return t}return null}function ot(e){if(n.Constants.FORMAT.numberFormat.getRegExpForDecimal().test(e)){var t=new n.Decimal(e);if(!t.isNaN()&&t.gte(n.Constants.MIN_DECIMAL_VALUE)&&t.lte(n.Constants.MAX_DECIMAL_VALUE))return t}return null}function at(e){if(!n.Constants.FORMAT.numberFormat.getRegExpForInteger().test(e))return null;var t="-"===e.charAt(0);if(t&&e.length<n.Constants.MIN_LONGINTEGER_VALUE.toString().length||!t&&e.length<n.Constants.MAX_LONGINTEGER_VALUE.toString().length||Ee(new n.Decimal(e)))try{return n.LongInteger.fromString(e)}catch(r){}return null}function st(e){return null!==ot(e)}function ut(e){var t=ot(e);return null===t?n.Constants.DEFAULT_DECIMAL:new n.Decimal(e)}function ct(e){return null!==it(e)}function lt(e){var t=it(e);return null===t?n.Constants.DEFAULT_INTEGER:t}function ft(e){return null!==at(e)}function dt(e){var t=at(e);return null===t?n.Constants.DEFAULT_LONGINTEGER:t}function pt(e){return"true"===e.toLowerCase()}function ht(e){return e}function gt(e){if("number"==typeof e||n.TypeValidations.isLongInteger(e)||n.TypeValidations.isDecimal(e))return new n.Decimal(e.toString()).round().toNumber();throw new TypeError("Cannot convert type '"+typeof e+"' to 'Integer'")}function mt(e){if("number"==typeof e||n.TypeValidations.isLongInteger(e)||n.TypeValidations.isDecimal(e))return n.LongInteger.fromString(new n.Decimal(e.toString()).round().toString());throw new TypeError("Cannot convert type '"+typeof e+"' to 'LongInteger'")}function yt(e){if("boolean"==typeof e)return e;throw new TypeError("Cannot convert type '"+typeof e+"' to 'Boolean'")}function vt(e){if("number"==typeof e||n.TypeValidations.isLongInteger(e)||n.TypeValidations.isDecimal(e))return new n.Decimal(e.toString());throw new TypeError("Cannot convert type '"+typeof e+"' to 'Decimal'")}function bt(e){if("string"==typeof e)return e;throw new TypeError("Cannot convert type '"+typeof e+"' to 'Text'")}function Tt(e){return Dt(e,!0,!1)}function Et(e){return Dt(e,!1,!0)}function wt(e){return Dt(e,!0,!0)}function Dt(e,t,r){if(e instanceof n.DateTime||"[object Date]"===Object.prototype.toString.call(e)){var i=new n.DateTime(e.getTime()),o=t?i.year:1900,a=t?i.month:1,s=t?i.day:1,u=r?i.hours:0,c=r?i.minutes:0,l=r?i.seconds:0;return new n.DateTime(o,a,s,u,c,l)}throw new TypeError("Cannot convert type '"+typeof e+"' to 'DateTime'")}function St(e){return e}function It(e,t){return e.toString(t)}function _t(e,t,r,i,o){var a=xt(e,r,i,o);return a===n.Constants.DEFAULT_TEXT?n.Constants.DEFAULT_TEXT:t+a}function xt(e,t,r,i){return 0>t?n.Constants.DEFAULT_TEXT:(r.length>1&&(r=r.substr(0,1)),i.length>1&&(i=i.substr(0,1)),e.toFormat(t,n.Decimal.rounding,{decimalSeparator:r,groupSeparator:i}))}function At(e,t,r){try{return 0>t?"":(r.length>1&&(r=r.substr(0,1)),e.times(100).toFormat(t,n.Decimal.rounding,{decimalSeparator:r,groupSeparator:""})+"%")}catch(i){return""}}function Nt(e,t,n,r,i,o,a){try{return/^\d+$/.test(e)?e.length!==t+n+r?e:i+e.substr(0,t)+o+e.substr(t,n)+a+e.substr(t+n,r):e}catch(s){return""}}function Ct(e,t,n,r,i){try{var o=_(e);if(t>o){i=A(i,0,1);for(var a=t-o;a-- >0;)r?e=i+e:e+=i;return e}return o>n?r?A(e,o-n,n):A(e,0,n):e}catch(s){return""}}function Ot(e){return""===e?!0:/\.@/.test(e)?!1:qt.test(e)||Ht.test(e)||Gt.test(e)}function Rt(){return r.getCurrentLocale()}function Lt(){return navigator.userAgent}function Mt(){return r.getHomeModuleName()}function Pt(){return window.location.href}function Ft(){return i.buildApplicationRelativeUrl()}function Vt(){return o.getUserId()}Object.defineProperty(t,"__esModule",{value:!0}),t.abs=c,t.mod=l,t.power=f,t.round=d,t.sqrt=p,t.trunc=h,t.max=g,t.min=m,t.sign=y,t.chr=v,t.concat=b,t.encodeHtml=w,t.encodeJavascript=D,t.encodeUrl=S;var Ut="["+String.fromCharCode(55296)+"-"+String.fromCharCode(56319)+"]",jt=new RegExp(Ut,"g");t.index=I,t.length=_,t.replace=x,t.substr=A,t.toLower=N,t.toUpper=C,t.trim=O,t.trimStart=R,t.trimEnd=L,t.addDays=M,t.addHours=P,t.addMinutes=F,t.addSeconds=V,t.addYears=U,t.addMonths=j,t.buildDateTime=k,t.currDate=B,t.currDateTime=q,t.currTime=H,t.dayOfWeek=G,t.diffDays=J,t.diffHours=K,t.diffMinutes=Q,t.diffSeconds=X,t.year=Y,t.month=$,t.day=Z,t.hour=ee,t.minute=te,t.second=ne,t.newDate=re,t.newDateTime=ie,t.newTime=oe,t.booleanToInteger=ue,t.booleanToLongInteger=ce,t.booleanToDecimal=le,t.booleanToText=fe,t.dateTimeToDate=de,t.dateTimeToTime=pe,t.dateTimeToText=he,t.dateToText=ge,t.dateToDateTime=me,t.decimalToBoolean=ye,t.decimalToText=ve,t.decimalToIntegerValidate=be,t.decimalToInteger=Te,t.decimalToLongIntegerValidate=Ee,t.decimalToLongInteger=we,t.longIntegerToDecimal=De,t.longIntegerToIntegerValidate=Se,t.longIntegerToInteger=Ie,t.longIntegerToIdentifier=_e,t.longIntegerToText=xe,t.identifierToInteger=Ae,t.identifierToLongInteger=Ne,t.identifierToText=Ce,t.integerToLongInteger=Oe,t.integerToIdentifier=Re,t.integerToBoolean=Le,t.integerToText=Me,t.integerToDecimal=Pe,t.nullIdentifier=Fe,t.nullTextIdentifier=Ve,t.nullDate=Ue,t.nullObject=je,t.nullBinary=ke,t.textToDateValidate=Ke,t.textToDate=Qe,t.textToDateTimeValidate=Ye,t.textToDateTime=$e,t.textToTimeValidate=et,t.textToTime=tt,t.timeToText=rt,t.textToDecimalValidate=st,t.textToDecimal=ut,t.textToIntegerValidate=ct,t.textToInteger=lt,t.textToLongIntegerValidate=ft,t.textToLongInteger=dt,t.textToBoolean=pt,t.textToIdentifier=ht,t.objectToInteger=gt,t.objectToLongInteger=mt,t.objectToBoolean=yt,t.objectToDecimal=vt,t.objectToText=bt,t.objectToDate=Tt,t.objectToTime=Et,t.objectToDateTime=wt,t.toObject=St,t.formatDateTime=It,t.formatCurrency=_t,t.formatDecimal=xt,t.formatPercent=At,t.formatPhoneNumber=Nt,t.formatText=Ct;var kt="[a-zA-Z0-9.!#$%&'*+\\-/=?^_`{|}~]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*",Bt="([0-9a-zA-Z\\\\= ]*|=\\?([^?]*)\\?([qQbB])\\?([^?]*)\\?=)",qt=new RegExp("^"+kt+"$"),Ht=new RegExp("^"+Bt+"[ ]*<"+kt+">$"),Gt=new RegExp('^\\"'+Bt+'\\"[ ]*<'+kt+">$");t.emailAddressValidate=Ot,t.getCurrentLocale=Rt,t.getUserAgent=Lt,t.getEntryEspaceName=Mt,t.getBookmarkableURL=Pt,t.getOwnerURLPath=Ft,t.getUserId=Vt}),define("OutSystems/ClientRuntime/DataConversion",["require","exports","./DataTypes","./BuiltinFunctions","./Exceptions","./Settings"],function(e,t,n,r,i,o){"use strict";function a(e){return!!e.isGenericRecordType}function s(e){return!!e.isGenericRecordListType}function u(e){return!!e.isBasicTypeListType}Object.defineProperty(t,"__esModule",{value:!0});var c;!function(e){function t(e,r,i,a){if(void 0===r&&(r=n.DataTypes.Record),void 0===i&&(i=!1),void 0===a&&(a=!1),void 0!==e&&null!==e){var s,u=n.DataTypes.Record;if("number"!=typeof r?(a=i===!0,s=r,u=n.DataTypes.Record):(u=r,"boolean"!=typeof i&&(s=i)),e instanceof n.GenericRecord){var c=e,f=c.constructor,d=l.get(f);if(!d){var p=c.getAttributes(),h="return function to(record, callContext, optimizeList) {\n";h+=" return {\n",p.forEach(function(e,t){e.ignoreForServer||(e.dataType===n.DataTypes.Record||e.dataType===n.DataTypes.RecordList?h+=" "+e.name+": toServerData(record."+e.attrName+", callContext, "+e.optimizeList+" && optimizeList),\n":e.dataType!==n.DataTypes.Object&&(h+=" "+e.name+": basicTypeToJS(record."+e.attrName+", attributes["+t+"].dataType),\n"))}),h+=" };\n",h+="};",d=new Function("toServerData","basicTypeToJS","attributes",h)(t,o,p),l.set(f,d)}return d(e,s,a)}if(e instanceof n.List){var g=e,m=g.constructor.getItemType(),y={List:[]};if(a&&s){if(g.length>0&&s){var v=s.iterationContext.getCurrentRowNumber(e);y.List.push(t(g.getItem(v),m,s,a))}}else for(var b=0;b<g.length;b++)y.List.push(t(g.getItem(b),m));return g.isEmpty&&(y.EmptyListItem=t(g.emptyListItem,m,s,a)),y}return u!==n.DataTypes.Object?o(e,u):void 0}}function i(e,t){if(a(t)){var r=t,o=f.get(r);if(!o){var l=r.getAttributes(),d="return function from(obj) {\n";d+=" if (!obj) { obj = {}; }\n",d+=" return new classDef(new classDef.RecordClass({\n",l.forEach(function(e,t){d+=e.dataType===n.DataTypes.Record||e.dataType===n.DataTypes.RecordList?" "+e.attrName+": GenericRecord.getData(fromServerData(obj."+e.name+", attributes["+t+"].complexType)),\n":e.dataType===n.DataTypes.BinaryData?" "+e.attrName+": jsToBasicType({ content: obj."+e.name+", url: obj._"+e.name+"URL }, attributes["+t+"].dataType),\n":" "+e.attrName+": jsToBasicType(obj."+e.name+", attributes["+t+"].dataType),\n"; }),d+=" }));\n",d+="};",o=new Function("fromServerData","jsToBasicType","GenericRecord","attributes","classDef",d)(i,c,n.GenericRecord,l,r),f.set(r,o)}return o(e)}if(s(t)||u(t)){if(void 0===t.getItemType()||null===t.getItemType())throw Error("A List can only be deserialized if its ItemType is defined.");var p=t,h=new p;return 0===e.List.length?h.emptyListItem=i(e.EmptyListItem,t.getItemType()):h.pushAll(e.List.map(function(e){return i(e,t.getItemType())})),h}return c(e,t)}function o(e,t){switch(t){case n.DataTypes.Integer:return e;case n.DataTypes.LongInteger:return r.longIntegerToText(e);case n.DataTypes.Decimal:case n.DataTypes.Currency:return r.decimalToText(e);case n.DataTypes.Text:case n.DataTypes.PhoneNumber:case n.DataTypes.Email:return e;case n.DataTypes.Date:return e.toISODate();case n.DataTypes.DateTime:return e.toString();case n.DataTypes.Time:return e.toISOTime();case n.DataTypes.Boolean:return e;case n.DataTypes.Record:case n.DataTypes.RecordList:throw new TypeError("Records and Record lists are not basic types");case n.DataTypes.BinaryData:return"string"==typeof e?e:e.content;case n.DataTypes.Object:return e;default:return e}}function c(e,t){switch(t){case n.DataTypes.Integer:return n.TypeValidations.ensureIntegerInsideBounds(e),0|e;case n.DataTypes.LongInteger:return"string"==typeof e?n.LongInteger.fromString(e):n.LongInteger.fromNumber(e);case n.DataTypes.Decimal:case n.DataTypes.Currency:return new n.Decimal(e||"0");case n.DataTypes.Boolean:return"string"==typeof e?r.textToBoolean(e):e;case n.DataTypes.Text:case n.DataTypes.PhoneNumber:case n.DataTypes.Email:return void 0===e?"":e+"";case n.DataTypes.Date:return e instanceof Date?new n.DateTime(e):n.DateTime.fromISODate(e);case n.DataTypes.DateTime:return e instanceof Date?new n.DateTime(e):n.DateTime.fromISODateTime(e);case n.DataTypes.Time:return e instanceof Date?new n.DateTime(e):n.DateTime.fromISOTime(e);case n.DataTypes.Record:case n.DataTypes.RecordList:throw new TypeError("Records and Record lists are not basic types");case n.DataTypes.BinaryData:return n.TypeValidations.hasBinaryDataInterface(e)?new n.BinaryData(e.content,e.url):new n.BinaryData(e);case n.DataTypes.Object:return e;default:return e}}var l=new Map,f=new Map;e.to=t,e.from=i}(c=t.ServerDataConverter||(t.ServerDataConverter={}));var l;!function(e){function t(e){return n.TypeValidations.isValidJsNumber(e)&&e>=n.Constants.MIN_INTEGER_VALUE&&e<=n.Constants.MAX_INTEGER_VALUE?!0:n.TypeValidations.isLongInteger(e)?r.longIntegerToIntegerValidate(e):n.TypeValidations.isDecimal(e)?r.decimalToIntegerValidate(e):n.TypeValidations.isText(e)?r.textToIntegerValidate(e):n.TypeValidations.isBoolean(e)?!0:!1}function i(e){return n.TypeValidations.isValidJsNumber(e)?!0:n.TypeValidations.isValidLongInteger(e)?!0:n.TypeValidations.isValidDecimal(e)?r.decimalToLongIntegerValidate(e):n.TypeValidations.isText(e)?r.textToLongIntegerValidate(e):n.TypeValidations.isBoolean(e)?!0:!1}function o(e){return n.TypeValidations.isValidJsNumber(e)?!0:n.TypeValidations.isValidDecimal(e)&&n.Constants.MIN_DECIMAL_VALUE.lte(e)&&n.Constants.MAX_DECIMAL_VALUE.gte(e)?!0:n.TypeValidations.isValidLongInteger(e)?!0:n.TypeValidations.isText(e)?r.textToDecimalValidate(e):n.TypeValidations.isBoolean(e)?!0:!1}function a(e){return o(e)}function s(e){return n.TypeValidations.isJsNumber(e)?n.TypeValidations.isValidJsNumber(e):n.TypeValidations.isLongInteger(e)?n.TypeValidations.isValidLongInteger(e):n.TypeValidations.isDecimal(e)?n.TypeValidations.isValidDecimal(e):n.TypeValidations.isText(e)?!0:n.TypeValidations.isBoolean(e)?!0:n.TypeValidations.isDateTime(e)?n.TypeValidations.isValidDateTime(e):n.TypeValidations.isJsDate(e)?n.TypeValidations.isValidJsDate(e):!1}function u(e){return s(e)}function c(e){return s(e)}function l(e){return n.TypeValidations.isJsNumber(e)?n.TypeValidations.isValidJsNumber(e):n.TypeValidations.isLongInteger(e)?n.TypeValidations.isValidLongInteger(e):n.TypeValidations.isDecimal(e)?n.TypeValidations.isValidDecimal(e):n.TypeValidations.isText(e)?/^(true)|(false)$/gi.test(e):n.TypeValidations.isBoolean(e)?!0:!1}function f(e){if(n.TypeValidations.isValidDateTime(e)&&e.gte(n.Constants.MIN_DATE_VALUE)&&e.lte(n.Constants.MAX_DATE_VALUE))return!0;if(n.TypeValidations.isValidJsDate(e)&&new n.DateTime(e).gte(n.Constants.MIN_DATE_VALUE)&&new n.DateTime(e).lte(n.Constants.MAX_DATE_VALUE))return!0;if(n.TypeValidations.isText(e)){if(n.Constants.ISO_DATE_FORMAT_REGEXP.test(e)){var t=new n.DateTime(new Date(e));return t.gte(n.Constants.MIN_DATE_VALUE)&&t.lte(n.Constants.MAX_DATE_VALUE)}if(r.textToDateValidate(e)){var t=r.textToDate(e);return t.gte(n.Constants.MIN_DATE_VALUE)&&t.lte(n.Constants.MAX_DATE_VALUE)}return!1}return!1}function d(e){return n.TypeValidations.isValidDateTime(e)?!0:n.TypeValidations.isValidJsDate(e)?!0:n.TypeValidations.isText(e)?n.Constants.RFC3339_TIMEPART.test(e)||n.Constants.ISO_DATE_FORMAT_REGEXP.test(e)?!0:r.textToTimeValidate(e):!1}function p(e){if(n.TypeValidations.isValidDateTime(e)&&e.gte(n.Constants.MIN_DATETIME_VALUE)&&e.lte(n.Constants.MAX_DATETIME_VALUE))return!0;if(n.TypeValidations.isValidJsDate(e)&&new n.DateTime(e).gte(n.Constants.MIN_DATETIME_VALUE)&&new n.DateTime(e).lte(n.Constants.MAX_DATETIME_VALUE))return!0;if(n.TypeValidations.isText(e)){if(n.Constants.ISO_DATE_FORMAT_REGEXP.test(e)){var t=new n.DateTime(new Date(e));return t.gte(n.Constants.MIN_DATETIME_VALUE)&&t.lte(n.Constants.MAX_DATETIME_VALUE)}if(r.textToDateTimeValidate(e)){var t=r.textToDateTime(e);return t.gte(n.Constants.MIN_DATETIME_VALUE)&&t.lte(n.Constants.MAX_DATETIME_VALUE)}return!1}return!1}function h(e){return n.TypeValidations.isBinaryData(e)}function g(e,r){switch(r){case n.DataTypes.Integer:return t(e);case n.DataTypes.LongInteger:return i(e);case n.DataTypes.Decimal:return o(e);case n.DataTypes.Currency:return a(e);case n.DataTypes.Text:return s(e);case n.DataTypes.PhoneNumber:return u(e);case n.DataTypes.Email:return c(e);case n.DataTypes.Boolean:return l(e);case n.DataTypes.Date:return f(e);case n.DataTypes.Time:return d(e);case n.DataTypes.DateTime:return p(e);case n.DataTypes.BinaryData:return h(e);default:return!1}}function m(e){return n.TypeValidations.isValidJsNumber(e)&&e===n.Constants.DEFAULT_INTEGER||n.TypeValidations.isValidLongInteger(e)&&e.equals(n.Constants.DEFAULT_LONGINTEGER)||n.TypeValidations.isValidDecimal(e)&&e.equals(n.Constants.DEFAULT_DECIMAL)||n.TypeValidations.isText(e)&&e===n.Constants.DEFAULT_TEXT||n.TypeValidations.isBoolean(e)&&e===n.Constants.DEFAULT_BOOLEAN||n.TypeValidations.isValidDateTime(e)&&e.equals(n.Constants.DEFAULT_DATETIME)}function y(e){if(t(e)){if(n.TypeValidations.isJsNumber(e))return r.objectToInteger(e);if(n.TypeValidations.isLongInteger(e))return r.objectToInteger(e);if(n.TypeValidations.isDecimal(e))return r.objectToInteger(e);if(n.TypeValidations.isText(e)&&""!==e)return r.textToInteger(e);if(n.TypeValidations.isBoolean(e))return r.booleanToInteger(e)}return n.Constants.DEFAULT_INTEGER}function v(e){if(i(e)){if(n.TypeValidations.isJsNumber(e))return r.objectToLongInteger(e);if(n.TypeValidations.isLongInteger(e))return r.objectToLongInteger(e);if(n.TypeValidations.isDecimal(e))return r.objectToLongInteger(e);if(n.TypeValidations.isText(e)&&""!==e)return r.textToLongInteger(e);if(n.TypeValidations.isBoolean(e))return r.booleanToLongInteger(e)}return n.Constants.DEFAULT_LONGINTEGER}function b(e){if(o(e)){if(n.TypeValidations.isJsNumber(e))return r.objectToDecimal(e);if(n.TypeValidations.isLongInteger(e))return r.objectToDecimal(e);if(n.TypeValidations.isDecimal(e))return r.objectToDecimal(e);if(n.TypeValidations.isText(e)&&""!==e)return r.textToDecimal(e);if(n.TypeValidations.isBoolean(e))return r.booleanToDecimal(e)}return n.Constants.DEFAULT_DECIMAL}function T(e){return b(e)}function E(e){if(s(e)){if(n.TypeValidations.isJsNumber(e))return n.TypeValidations.isValidInteger(e)?r.integerToText(e):r.decimalToText(new n.Decimal(e));if(n.TypeValidations.isLongInteger(e))return r.longIntegerToText(e);if(n.TypeValidations.isDecimal(e))return r.decimalToText(e);if(n.TypeValidations.isText(e))return e;if(n.TypeValidations.isBoolean(e))return r.booleanToText(e);if(n.TypeValidations.isValidDate(e))return r.dateToText(e);if(n.TypeValidations.isValidTime(e))return r.timeToText(e);if(n.TypeValidations.isDateTime(e))return r.dateTimeToText(e);if(n.TypeValidations.isJsDate(e)){var t=new n.DateTime(e);return n.TypeValidations.isValidDate(t)?r.dateToText(t):n.TypeValidations.isValidTime(t)?r.timeToText(t):r.dateTimeToText(t)}}return n.Constants.DEFAULT_TEXT}function w(e){return E(e)}function D(e){return c(e)&&n.TypeValidations.isText(e)?e:n.Constants.DEFAULT_EMAIL}function S(e){if(l(e)){if(n.TypeValidations.isJsNumber(e))return 0!==e;if(n.TypeValidations.isLongInteger(e))return!e.eq(0);if(n.TypeValidations.isDecimal(e))return!e.eq(0);if(n.TypeValidations.isText(e)&&""!==e)return!/^(false)$/gi.test(e);if(n.TypeValidations.isBoolean(e))return e}return n.Constants.DEFAULT_BOOLEAN}function I(e){if(f(e)){if(n.TypeValidations.isDateTime(e)){var t=e;return new n.DateTime(t.year,t.month,t.day)}if(n.TypeValidations.isJsDate(e)){var i=e;return new n.DateTime(i.getFullYear(),i.getMonth()+1,i.getDate())}if(n.TypeValidations.isText(e)&&""!==e)return n.Constants.RFC3339_DATEPART.test(e)?n.DateTime.fromISODate(e):n.Constants.ISO_DATE_FORMAT_REGEXP.test(e)?r.dateTimeToDate(n.DateTime.fromISODateTime(e)):r.textToDate(e)}return n.Constants.DEFAULT_DATE}function _(e){if(d(e)){if(n.TypeValidations.isDateTime(e)){var t=e;return new n.DateTime(null,null,null,t.hours,t.minutes,t.seconds,t.milliseconds)}if(n.TypeValidations.isJsDate(e)){var i=e;return new n.DateTime(null,null,null,i.getHours(),i.getMinutes(),i.getSeconds())}if(n.TypeValidations.isText(e)&&""!==e)return n.Constants.RFC3339_TIMEPART.test(e)?n.DateTime.fromISOTime(e):n.Constants.ISO_DATE_FORMAT_REGEXP.test(e)?r.dateTimeToTime(n.DateTime.fromISODateTime(e)):r.textToTime(e)}return n.Constants.DEFAULT_TIME}function x(e){if(p(e)){if(n.TypeValidations.isDateTime(e)){var t=e;return new n.DateTime(t.year,t.month,t.day,t.hours,t.minutes,t.seconds,t.milliseconds)}if(n.TypeValidations.isJsDate(e)){var i=e;return new n.DateTime(i)}if(n.TypeValidations.isText(e)&&""!==e)return n.Constants.ISO_DATE_FORMAT_REGEXP.test(e)?n.DateTime.fromISODateTime(e):r.textToDateTime(e)}return n.Constants.DEFAULT_DATETIME}function A(e){return e}function N(e,t){switch(t){case n.DataTypes.Integer:return y(e);case n.DataTypes.LongInteger:return v(e);case n.DataTypes.Decimal:return b(e);case n.DataTypes.Currency:return T(e);case n.DataTypes.Text:return E(e);case n.DataTypes.PhoneNumber:return w(e);case n.DataTypes.Email:return D(e);case n.DataTypes.Boolean:return S(e);case n.DataTypes.Date:return I(e);case n.DataTypes.Time:return _(e);case n.DataTypes.DateTime:return x(e);case n.DataTypes.BinaryData:return A(e);default:return null}}function C(e,t,n){return n(e,t)}function O(e,t,n){for(var r=0;r<e.length;)t.append(n(e.getItem(r),t.newItem())),r++;return t}e.isConvertibleTo=g,e.isDefault=m,e.convertTo=N,e.typeConvertRecord=C,e.typeConvertRecordList=O}(l=t.JSConversions||(t.JSConversions={}));var f;!function(e){function t(e){return e-e%1}function o(e,t){return s(e,t)}function a(e,t){return u(e,t)}function s(e,t){switch(t){case n.DataTypes.Integer:return e;case n.DataTypes.LongInteger:var r=e;return n.TypeValidations.ensureNumberInsideBounds(r),r.toNumber();case n.DataTypes.Decimal:case n.DataTypes.Currency:var i=e;return n.TypeValidations.ensureNumberPrecision(i),n.TypeValidations.ensureNumberInsideBounds(i),i.toNumber();case n.DataTypes.Text:case n.DataTypes.PhoneNumber:case n.DataTypes.Email:return e;case n.DataTypes.Date:case n.DataTypes.DateTime:case n.DataTypes.Time:var o=e;return o.toNative();case n.DataTypes.Boolean:return e;case n.DataTypes.Record:case n.DataTypes.RecordList:throw new TypeError("Records and Record lists are not basic types");case n.DataTypes.BinaryData:var a=e;return"string"==typeof e?e:a.content;case n.DataTypes.Object:return e;default:return e}}function u(e,o){switch(o){case n.DataTypes.Integer:if(n.TypeValidations.isValidJsNumber(e))return n.TypeValidations.ensureIntegerInsideBounds(e),t(e);break;case n.DataTypes.LongInteger:if(n.TypeValidations.isValidJsNumber(e))return n.TypeValidations.ensureLongIntegerInsideBounds(e),n.LongInteger.fromNumber(t(e));break;case n.DataTypes.Decimal:case n.DataTypes.Currency:if(n.TypeValidations.isValidJsNumber(e))return n.TypeValidations.ensureDecimalInsideBounds(e),new n.Decimal(e);break;case n.DataTypes.Boolean:if(n.TypeValidations.isBoolean(e))return e;break;case n.DataTypes.Text:case n.DataTypes.PhoneNumber:case n.DataTypes.Email:if(n.TypeValidations.isText(e))return e;if(n.TypeValidations.isValidJsNumber(e))return n.TypeValidations.ensureDecimalInsideBounds(e),r.decimalToText(new n.Decimal(e));if(n.TypeValidations.isBoolean(e))return r.booleanToText(e);break;case n.DataTypes.Date:if(n.TypeValidations.isValidJsDate(e)){var a=e;return new n.DateTime(a.getFullYear(),a.getMonth()+1,a.getDate())}break;case n.DataTypes.DateTime:if(n.TypeValidations.isValidJsDate(e))return new n.DateTime(e);break;case n.DataTypes.Time:if(n.TypeValidations.isValidJsDate(e)){var a=e;return new n.DateTime(null,null,null,a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds())}break;case n.DataTypes.BinaryData:return n.TypeValidations.hasBinaryDataInterface(e)?new n.BinaryData(e.content,e.url):new n.BinaryData(e);case n.DataTypes.Object:return e}throw new i.Exceptions.InvalidJavascriptType("Cannot assign a JavaScript "+typeof e+" with value "+(void 0===e||null===e?JSON.stringify(e):e.toString())+" to an output parameter of type "+n.DataTypes[o])}e.to=o,e.from=a}(f=t.JSNodeParamConverter||(t.JSNodeParamConverter={}));var d;!function(e){function t(e,r,i,o,a){if(void 0===o&&(o=n.DataTypes.Record),void 0!==e&&null!==e){if(e instanceof n.GenericRecord){var s=e,u=s.constructor,c=v.get(u);if(!c){var l=s.getAttributes(),f="return function to(record, serializeDefaultValues, useUnixDateFormat) {\n";f+=" if (serializeDefaultValues === void 0) { serializeDefaultValues = true; }\n",f+=" return {\n",l.forEach(function(e,t){""!==e.nameForJson&&(f+=e.dataType===n.DataTypes.Record||e.dataType===n.DataTypes.RecordList?' "'+e.nameForJson+'": toJSON(record.'+e.attrName+", serializeDefaultValues, useUnixDateFormat),\n":' "'+e.nameForJson+'": basicTypeToJSON(record.'+e.attrName+", attributes["+t+"].dataType, attributes["+t+"].defaultValue, "+(e.mandatory?"true":"serializeDefaultValues")+", useUnixDateFormat),\n")}),f+=" };\n",f+="};",c=new Function("toJSON","basicTypeToJSON","attributes",f)(t,d,l),v.set(u,c)}return c(e,r,i)}if(e instanceof n.List){for(var p=e,h=p.constructor.getItemType(),g=[],m=0;m<p.length;m++)g.push(t(p.getItem(m),r,i,h));return g}return d(e,o,void 0===a?n.defaultForType(o):a,r,i)}}function o(e,t,r,i){if(a(t)){var c=t,l=b.get(c);if(!l){var f=c.getAttributes(),d="return function from(obj, useUnixDateFormat) {\n";d+=" if (!obj) { obj = {}; }\n",d+=" return new classDef(new classDef.RecordClass({\n",f.forEach(function(e,t){""!==e.nameForJson&&(d+=e.dataType===n.DataTypes.Record||e.dataType===n.DataTypes.RecordList?" "+e.attrName+': GenericRecord.getData(fromJSON(obj["'+e.nameForJson+'"], attributes['+t+"].complexType, useUnixDateFormat)),\n":" "+e.attrName+': jsonToBasicType(obj["'+e.nameForJson+'"], attributes['+t+"].dataType, attributes["+t+"].defaultValue, useUnixDateFormat),\n")}),d+=" }));\n",d+="};",l=new Function("fromJSON","jsonToBasicType","GenericRecord","attributes","classDef",d)(o,p,n.GenericRecord,f,t),b.set(c,l)}return l(e,r)}if(s(t)||u(t)){if(void 0===t.getItemType()||null===t.getItemType())throw Error("A List can only be deserialized if its ItemType is defined.");var h=e;if((null===h||void 0===h)&&(h=[]),h.constructor!==Array)throw new TypeError("Could not convert '"+h+"' to List");var g=t,m=new g;return m.pushAll(h.map(function(e){return o(e,t.getItemType(),r)})),m}return p(e,t,void 0===i?n.defaultForType(t):i,r)}function d(e,t,r,i,o){if(void 0===i&&(i=!0),i===!1&&n.equals(e,r))return null;switch(t){case n.DataTypes.Time:return e.toISOTime();case n.DataTypes.Date:return e.toISODate();case n.DataTypes.DateTime:return o===!0?""+Math.floor(e.getTime()/1e3):e.toString().replace(/\.\d+/,"");default:return f.to(e,t)}}function p(e,t,r,i){if(void 0===e||null===e)return r;switch(t){case n.DataTypes.Integer:return h(e);case n.DataTypes.LongInteger:return g(e);case n.DataTypes.Currency:case n.DataTypes.Decimal:return m(e);case n.DataTypes.DateTime:return y(e,i);default:return c.from(e,t)}}function h(e){var t;if(n.Constants.FORMAT.numberFormat.getRegExpForInteger().test(e)?t=new n.Decimal(e):n.Constants.FORMAT.numberFormat.getRegExpForJSNumber().test(e)&&(t=new n.Decimal(+e)),void 0===t||!t.isInteger()||!r.decimalToIntegerValidate(t))throw new i.Exceptions.Exception("Could not convert '"+e+"' to Integer");return r.decimalToInteger(t)}function g(e){var t;if(n.Constants.FORMAT.numberFormat.getRegExpForInteger().test(e)?t=new n.Decimal(e):n.Constants.FORMAT.numberFormat.getRegExpForJSNumber().test(e)&&(t=new n.Decimal(+e)),void 0===t||!t.isInteger()||!r.decimalToLongIntegerValidate(t))throw new i.Exceptions.Exception("Could not convert '"+e+"' to Long Integer");return r.decimalToLongInteger(t)}function m(e){var t;if(n.Constants.FORMAT.numberFormat.getRegExpForInteger().test(e)?t=new n.Decimal(e):n.Constants.FORMAT.numberFormat.getRegExpForJSNumber().test(e)&&(t=new n.Decimal(+e)),void 0===t||t.lt(n.Constants.MIN_DECIMAL_VALUE)||t.gt(n.Constants.MAX_DECIMAL_VALUE))throw new i.Exceptions.Exception("Could not convert '"+e+"' to Decimal");return t}function y(e,t){if(!t){if(!l.isConvertibleTo(e,n.DataTypes.DateTime))throw new i.Exceptions.Exception("Could not convert '"+e+"' to DateTime");return c.from(e,n.DataTypes.DateTime)}e instanceof Date&&(e=new n.DateTime(e.getTime()));try{return new n.DateTime(1e3*+e)}catch(r){throw new i.Exceptions.Exception("Could not convert '"+e+"' to DateTime")}}var v=new Map,b=new Map;e.to=t,e.from=o}(d=t.JSONConverter||(t.JSONConverter={}));var p;!function(e){function t(e,r,i,o){if(a(r)){var u=e,c=r,l=i,d=T.get(c);if(!d){var p=c.getAttributes(),h="return function from(row, indexRef, readerImplementation, attributeOrder) {\n";h+=" var data = null;\n",h+=" if (attributeOrder && attributeOrder.length > 0) {\n",h+=" data = {\n",p.forEach(function(e,t){e.dataType!==n.DataTypes.RecordList&&(h+=" "+e.attrName+": null,\n")}),h+=" };\n",h+=" for (var i = 0; i < attributeOrder.length; i++) {\n",h+=" var attrName = attributeOrder[i];\n",h+=" var attr = attributes.filter(function(attr) { return attr.attrName === attrName; })[0];\n",h+=" if (attr.complexType) {\n",h+=" data[attrName] = fromLocalStorage(row, attr.complexType, indexRef);\n",h+=" } else {\n",h+=" data[attrName] = readerImplementation(row, indexRef.value++, attr.name, attr.dataType);\n",h+=" }\n",h+=" }\n",h+=" } else {\n",h+=" data = {\n",p.forEach(function(e,t){e.dataType!==n.DataTypes.RecordList&&(h+=e.dataType===n.DataTypes.Record&&r.isAnonymousRecord()?" "+e.attrName+": fromLocalStorage(row, attributes["+t+"].complexType, indexRef),\n":" "+e.attrName+": readerImplementation(row, indexRef.value++, attributes["+t+"].name, attributes["+t+"].dataType),\n")}),h+=" };\n",h+=" }\n",h+=" return new classDef.RecordClass(data);\n",h+="};",d=new Function("fromLocalStorage","GenericRecord","attributes","classDef",h)(t,n.GenericRecord,p,r),T.set(c,d)}return d(u,l,f(r),o)}if(s(r)){if(void 0===r.getItemType()||null===r.getItemType())throw Error("A List can only be deserialized if its ItemType is defined.");for(var g=e,m=r.getItemType(),y=i,v=r,b=new v,E=[],w=0;w<g.length;w++)E.push(new m(y(null,g.item(w))));return b.pushAll(E),b}var D=r;throw new Error("Unable to read data from Local Storage. Unknown type "+(D&&D.name?D.name:D))}function r(e){switch(e){case 3:case 4:case 5:case 0:case 2:case 7:case 6:case 8:case 1:return n.defaultForType(l(e));default:throw new i.Exceptions.DataBaseException("","Unable to determine default value for type "+u(e))}}function u(e){var t=l(e);return n.DataTypes[t]}function c(e){var t=b[e];return void 0===t?9:t}function l(e){switch(e){case 0:return n.DataTypes.Text;case 1:return n.DataTypes.BinaryData;case 2:return n.DataTypes.Boolean;case 7:return n.DataTypes.Date;case 6:return n.DataTypes.DateTime;case 8:return n.DataTypes.Time;case 5:return n.DataTypes.Decimal;case 3:return n.DataTypes.Integer;case 4:return n.DataTypes.LongInteger;default:throw new Error("Missing case for conversion of DB data type '"+e+"' to a model data type.")}}function f(e){return e.isAnonymousRecord()?p:d}function d(t,n,r,i){return e.deserializeFromDB(t["o"+n],c(i))}function p(t,n,r,i){return e.deserializeFromDB(t[r],c(i))}function h(e,t){var n=t.length,r=e.toString();return t.substr(0,Math.max(0,n-r.length))+r}function g(e,t){if(t.isEntityReference&&n.equals(e,r(t.type)))return null;switch(t.type){case 3:return e;case 4:var a=e;return null==a?null:a.toString();case 5:var s=e;return t.decimals?s.toFixed(t.decimals):s.toString();case 0:return e;case 2:var u=e;return u?1:0;case 6:var c=e.toNative();return!o.getEnvParams().DbNullDatesTZAware&&e.eq(n.DateTime.defaultValue)?v:(c=e.toNative(),h(c.getUTCFullYear(),"0000")+"-"+h(c.getUTCMonth()+1,"00")+"-"+h(c.getUTCDate(),"00")+" "+h(c.getUTCHours(),"00")+":"+h(c.getUTCMinutes(),"00")+":"+h(c.getUTCSeconds(),"00"));case 7:var l=e.toNative();return h(l.getFullYear(),"0000")+"-"+h(l.getMonth()+1,"00")+"-"+h(l.getDate(),"00");case 8:var f=e.toNative();return"1900-01-01 "+h(f.getHours(),"00")+":"+h(f.getMinutes(),"00")+":"+h(f.getSeconds(),"00");case 1:var d=e;return void 0===d.content?null:d.content;default:throw new i.Exceptions.DataBaseException("","Unable to serialize "+e+" to a database value.")}}function m(e,t){if(null===e)return r(t);switch(t){case 3:return e;case 4:return n.LongInteger.fromValue(e);case 5:var a=e;return new n.Decimal(a);case 0:return e;case 2:var s=e;return 0!==s;case 6:case 7:case 8:var u=/^(\d{4})-(\d{2})-(\d{2})( (\d{2}):(\d{2}):(\d{2}))?$/,c=e,l=u.exec(c),f=new Date;switch(t){case 6:if(e===v&&!o.getEnvParams().DbNullDatesTZAware)return n.DateTime.defaultValue;f.setUTCFullYear(parseInt(l[1],10),parseInt(l[2],10)-1,parseInt(l[3],10)),f.setUTCHours(parseInt(l[5],10)||0,parseInt(l[6],10)||0,parseInt(l[7],10)||0,0);break;case 7:f.setFullYear(parseInt(l[1],10),parseInt(l[2],10)-1,parseInt(l[3],10)),f.setHours(0,0,0,0);break;case 8:f.setFullYear(1900,0,1),f.setHours(parseInt(l[5],10)||0,parseInt(l[6],10)||0,parseInt(l[7],10)||0,0)}return new n.DateTime(f);case 1:return new n.BinaryData(e);default:throw new i.Exceptions.DataBaseException("","Unable to deserialize "+e+" to a runtime value.")}}function y(e){return new n.BinaryData(null,null,e)}var v="1900-01-01 00:00:00",b={};b[n.DataTypes.Integer]=3,b[n.DataTypes.LongInteger]=4,b[n.DataTypes.Decimal]=5,b[n.DataTypes.Currency]=5,b[n.DataTypes.Text]=0,b[n.DataTypes.PhoneNumber]=0,b[n.DataTypes.Email]=0,b[n.DataTypes.Boolean]=2,b[n.DataTypes.Date]=7,b[n.DataTypes.DateTime]=6,b[n.DataTypes.Time]=8,b[n.DataTypes.Record]=9,b[n.DataTypes.RecordList]=9,b[n.DataTypes.BinaryData]=1,b[n.DataTypes.Object]=9;var T=new Map;e.from=t,e.typeDefaultValue=r,e.typeDisplayName=u,e.convertToModelDataType=l,e.serializeToDB=g,e.deserializeFromDB=m,e.deserializeLazyBinaryFromDB=y}(p=t.LocalStorageConverter||(t.LocalStorageConverter={}))}),define("OutSystems/ClientRuntime/Entities",["require","exports","./Exceptions","./DataTypes","./DataConversion","./Logger","./RegExpHelper","./Database"],function(e,t,n,r,i,o,a,s){"use strict";function u(e){}function c(e){for(var t in e)if(e.hasOwnProperty(t))return e[t];return null}function l(e,t,n){for(var r=e.getAllAttributesFromRecord(t).toArray(),i=0;i<e.attributes.length;i++){var o=e.attributes[i];f(r[i],o,n+" '"+e.name+"."+o.name+"'")}}function f(e,t,r){if(0===t.type){if(null===e)return;var i=e,o=i.length-t.length;if(o>0)throw new n.Exceptions.DataBaseException("","Unable to "+r+" because it exceeds the maximum allowed length by "+o+" characters.")}else if(5===t.type){var i=e,o=i.split(".")[0].length-(t.length-t.decimals);if(o>0)throw new n.Exceptions.DataBaseException("","Unable to "+r+" because it exceeds the maximum allowed length by "+o+" characters.")}}function d(e){switch(e){case 0:return"Text";case 1:return"Binary Data";case 2:return"Boolean";case 3:return"Integer";case 4:return"Long Integer";case 5:return"Decimal";case 6:return"DateTime";case 7:return"Date";case 8:return"Time";default:return"Unknown"}}Object.defineProperty(t,"__esModule",{value:!0}),t.BACKUP_TABLE_PREFIX="BACKUP_";var p;!function(e){function t(){return'CREATE TABLE IF NOT EXISTS "'+e.TABLE_NAME+'" ("'+s.join('","')+'")'}function n(e){a=e}function r(e,t){return e.executeNonQuery(this.createSql()).andThen(function(e){var n=new u(t);return n.initialize(e).andThen(function(){return o.setOfflineStorage(n)})})}var i={Instant:"Instant",LogType:"LogType",Message:"Message",ModuleName:"ModuleName",Stack:"Stack",MessageType:"MessageType"};e.TABLE_NAME="OSSYS_LOG";var a=1e3,s=Object.keys(i).map(function(e){return i[e]});e.createSql=t,e.setMaxRecords=n,e.initialize=r;var u=function(){function t(e){this.db=e}return t.prototype.initialize=function(e){var t=this;return e.feed(null).withoutTraces(function(e){return t.internalCountLogs(e).andThen(function(e,n){t.count=n})})},t.prototype.insertEntity=function(t,n){var r=this,o=new w;return o.add(i.Instant,0,n.instant),o.add(i.LogType,0,n.logType),o.add(i.Message,0,n.message),o.add(i.ModuleName,0,n.moduleName),o.add(i.Stack,0,n.stack),o.add(i.MessageType,0,n.messageType),t.executeNonQuery('INSERT INTO "'+e.TABLE_NAME+'" ("'+s.join('", "')+'") VALUES ('+s.map(function(){return"?"}).join(", ")+")",o.toArray()).andThen(function(){r.updateCount(1)})},t.prototype.internalWriteLog=function(e){var t=this;return this.db.executeTransaction(function(n){var r;if(t.count+e.length>=a){var i=t.count+e.length-a;r=t.discardLogs(n,t.count,i)}else r=n.feed(null);return r.andThenAll(function(n){return e.map(function(e){return function(n){return t.insertEntity(n,e)}})})},!1)},t.prototype.writeLog=function(e){return this.internalWriteLog([e])},t.prototype.writeLogBatch=function(e){if(e.length>a){var t=e.length-a;e.splice(0,t)}return this.internalWriteLog(e)},t.prototype.getLogs=function(t){var n=this;return this.db.executeReadTransaction(function(r){return void 0===t&&(t=n.count),r.executeQuery('SELECT * FROM "'+e.TABLE_NAME+'" ORDER BY rowid ASC LIMIT '+t,n.dbRecordToLogMessage)},!1)},t.prototype.popLogs=function(e){var t=this;return void 0===e&&(e=this.count),this.getLogs(e).then(function(n){return t.removeLogs(e).then(function(){return n})})},t.prototype.internalCountLogs=function(t){return t.executeScalar('SELECT COUNT(*) AS count FROM "'+e.TABLE_NAME+'"').andThen(function(e,t){return t})},t.prototype.updateCount=function(e){this.count+=e,this.count=Math.max(this.count,0)},t.prototype.countLogs=function(){var e=this;return this.db.executeReadTransaction(function(t){return e.internalCountLogs(t)},!1)},t.prototype.discardLogs=function(e,t,n){var r=this,i=this.buildDeleteQuery(n,!1);return e.executeNonQuery(i,[o.LogTypes.Error]).andThen(function(e){return r.internalCountLogs(e)}).andThen(function(e,a){var s=t-a;if(n>s){var u=n-s;i=r.buildDeleteQuery(u,!0),e.executeNonQuery(i,[o.LogTypes.Error])}}).andThen(function(){r.updateCount(-n)})},t.prototype.buildDeleteQuery=function(t,n){return'DELETE FROM "'+e.TABLE_NAME+'" WHERE rowid IN '+('(SELECT rowid FROM "'+e.TABLE_NAME+'" ')+("WHERE LogType "+(n?"=":"<>")+" ? ")+"ORDER BY rowid ASC "+("LIMIT "+t+")")},t.prototype.removeLogs=function(t){var n=this;return this.db.executeTransaction(function(r){var i='DELETE FROM "'+e.TABLE_NAME+'" WHERE rowid IN (SELECT rowid FROM "'+e.TABLE_NAME+'" ORDER BY rowid ASC LIMIT '+t+")";return r.executeNonQuery(i).andThen(function(){n.updateCount(-t)})},!1)},t.prototype.dbRecordToLogMessage=function(e){return{instant:e.Instant,logType:e.LogType,message:e.Message,moduleName:e.ModuleName,stack:e.Stack,messageType:e.MessageType}},t}();e.LogDatabaseStorage=u}(p=t.LogTable||(t.LogTable={}));var h;!function(e){e[e.Unchanged=0]="Unchanged",e[e.Deleted=1]="Deleted",e[e.Recreated=2]="Recreated",e[e.New=3]="New"}(h||(h={}));var g;!function(e){function t(t,r){return e.storage=new a(r),n(t)}function n(t){return t.executeNonQuery('CREATE TABLE IF NOT EXISTS "'+e.TABLE_NAME+'" ('+o+")")}var r=[{columnName:"Id",options:"INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL"},{columnName:"Key",options:"UNIQUE NOT NULL"},{columnName:"Value"}];e.TABLE_NAME="OSSYS_PERSISTENTKEYVALUE";var i='"'+r.map(function(e){return e.columnName}).join('", "')+'"',o=r.map(function(e){return"'"+e.columnName+(e.options?"' "+e.options:"'")}).join(", ");e.initialize=t,e.create=n;var a=function(){function t(e){this.db=e}return t.prototype.getValue=function(t){return this.db.executeTransaction(function(n){return n.executeScalar("SELECT VALUE FROM "+e.TABLE_NAME+" WHERE Key = ?",[t])})},t.prototype.setValue=function(t,n){this.db.executeTransaction(function(r){return r.executeNonQuery("INSERT OR REPLACE INTO "+e.TABLE_NAME+" ("+i+") VALUES (COALESCE((SELECT Id FROM "+e.TABLE_NAME+" WHERE Key = ?), null), ?, ?)",[t,t,n])})},t}();e.PersistentKeyValueStorage=a}(g=t.PersistentKeyValue||(t.PersistentKeyValue={}));var m;!function(e){function a(e,t){for(var n=0,r=t.attributes;n<r.length;n++){var o=r[n],a=o.name.toLowerCase();if(void 0===e[a]){var s=void 0===o["default"]?i.LocalStorageConverter.typeDefaultValue(o.type):o["default"];e[a]=i.LocalStorageConverter.serializeToDB(s,o)}}}function s(e,t){if(void 0===e)return!0;if(e===t)return!1;switch(e){case 2:return 3!==t&&4!==t;case 3:return 4!==t&&0!==t;case 4:return 0!==t;default:return!0}}function u(e,t){return s(e.type,t.type)?!0:!e.isEntityReference!=!t.isEntityReference?!0:void 0!==e.length?void 0!==e.decimals?e.length-e.decimals>t.length-t.decimals:e.length>t.length:!1}function c(e,t,r){if(u(t,r)){var o=i.LocalStorageConverter.deserializeFromDB(e,t.type),a=i.LocalStorageConverter.convertToModelDataType(r.type),s=l(e,o,t.type,a);if(i.JSConversions.isConvertibleTo(o,a)){var c=i.JSConversions.convertTo(o,a),d=i.LocalStorageConverter.serializeToDB(c,r);return f(d,r,s),d}throw new n.Exceptions.DataBaseException("","Unable to "+s+".")}return e}function l(e,t,n,i){var o=e,a=t,s=d(n),u=r.DataTypes[i];if("string"==typeof e&&e&&(o=e.substr(0,50)+(" (length:"+e.length+")")),r.TypeValidations.isText(t)){var c=t;a=c.substr(0,50)+(" (length:"+c.length+")")}if(t instanceof r.BinaryData){var l=t.content;a=l.substr(0,50)+(" (length:"+l.length+")")}return"convert databaseValue:'"+o+"'/deserializedValue:'"+a+"' from type "+s+" to "+u}function p(e,t){var n=e.name.toLowerCase(),r=t.attributes.filter(function(e){return e.name.toLowerCase()===n});return 0===r.length?null:r[0]}function h(t,n,r,i){if(r){var o=p(n,r);if(null!=o){if(i&&6===o.type){var a=i.attrs[n.name.toLowerCase()];if(a)return e.upgradeDbValue(t,a,n)}return e.upgradeDbValue(t,o,n)}}var s=i.attrs[n.name.toLowerCase()];return s?e.upgradeDbValue(t,s,n):t}function g(e,t,r,o){for(var s={},u=0,c=Object.keys(e);u<c.length;u++){var l=c[u];s[l.toLowerCase()]=e[l]}a(s,t);for(var f={},d=0,p=t.attributes;d<p.length;d++){var g=p[d];try{var m=g.name.toLowerCase(),y=s[m];f[m]=h(y,g,r,o)}catch(v){throw new n.Exceptions.DataBaseException("","Unable to upgrade attribute '"+g.name+"' data type to '"+i.LocalStorageConverter.typeDisplayName(g.type)+"':\n"+n.getMessage(v))}}return f}function m(e,t,n){var r;if(r=t?t.idIsAutoNumber:n.idIsAutoNumber,r!==e.idIsAutoNumber)return!0;var i=b(e,t,n);return i.some(function(e){return e.entityAttribute?e.dbAttribute||e.dbMetaAttribute?y(e.entityAttribute,e.dbAttribute,e.dbMetaAttribute,0!==r):e.entityAttribute.isPrimaryKey:!0; })}function y(e,t,n,r){if(void 0===r&&(r=!1),t){var i=void 0===n||void 0===n.type||n.type===e.type;return!i||v(e,t,r,n)||!t.isPrimaryKey!=!e.isPrimaryKey}return v(e,n,r)||!n.isPrimaryKey!=!e.isPrimaryKey}function v(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=null);var i,o=t;return r&&6===t.type&&(o=r),i=e.isPrimaryKey&&o.isPrimaryKey&&n?!!(3!==e.type&&4!==e.type||3!==o.type&&4!==o.type):e.type!==o.type,i||5!==o.type&&o.length!==e.length||5!==o.type&&o.decimals!==e.decimals||!o.isEntityReference!=!e.isEntityReference&&!e.isPrimaryKey}function b(e,t,n){for(var r={},i=0,o=e.attributes;i<o.length;i++){var a=o[i],s=a.name.toLowerCase();r[s]={},r[s].entityAttribute=a}for(var u=0,c=Object.keys(n.attrs);u<c.length;u++){var l=c[u],s=l.toLowerCase();r[s]=r[s]||{},r[s].dbMetaAttribute=n.attrs[l]}if(t)for(var f=0,d=t.attributes;f<d.length;f++){var p=d[f],s=p.name.toLowerCase();r[s]=r[s]||{},r[s].dbAttribute=p}return Object.keys(r).map(function(e){return r[e]})}var T;!function(e){function n(){return{v:-1,attrs:{}}}function r(e){return i(e,m).andThen(function(e){return i(e,""+t.BACKUP_TABLE_PREFIX+m)})}function i(e,t){return e.executeNonQuery('CREATE TABLE IF NOT EXISTS "'+t+'" ('+b+", UNIQUE (SS_Key, Module_SS_Key))")}function a(e){return s(e,m).andThen(function(e){return s(e,y)})}function s(e,t){var n=!0,r=v.map(function(e){return'"ent"."'+e.name+'"'});return e.executeQueryRaw("SELECT "+r.join(", ")+' FROM "'+t+'" "ent" LIMIT 0').onError(function(e){n=!1}).andThen(function(){return n})}function u(e){return e.feed(null).andThenAll(function(e){return v.map(function(e){return function(t){return c(t,e.name,e.defaultValue)}})})}function c(e,t,n){return l(e,m,t,n).andThen(function(e){return l(e,y,t,n)})}function l(e,t,n,r){var i=!1;return e.feed(null).andThenAll(function(e){return[function(e){return e.executeNonQuery('SELECT "ent"."'+n+'" FROM '+t+' "ent" LIMIT 0').onError(function(e){i=!0})},function(e){return i?e.executeNonQuery("ALTER TABLE "+t+' ADD "'+n+'"').andThen(function(e){return r?e.executeNonQuery("UPDATE "+t+' SET "'+n+'" = '+r):e.feed(null)}):e.feed(null)}]})}function f(e,t,n){var r=n?y:m,i=n?m:y,o=e.executeNonQuery("DELETE FROM "+i+" WHERE Physical_Table_name = ?",[t]).andThen(function(e){return e.executeNonQuery("INSERT INTO "+i+"("+b+") SELECT "+b+" FROM "+r+" WHERE Physical_Table_name = ?",[t])});return n&&(o=o.andThen(function(e){return e.executeNonQuery("DELETE FROM "+r+" WHERE Physical_Table_name = ?",[t])})),o}function d(e){o.trace("Metamodel","Extracting metadata for table "+e.tableName+" ("+e.name+")");for(var t={v:0,idIsAutoNumber:e.idIsAutoNumber,attrs:{}},n=0,r=e.attributes;n<r.length;n++){var i=r[n];t.attrs[i.name.toLowerCase()]=p(i)}return t}function p(e){var t={type:e.type};return void 0!==e.decimals&&(t.decimals=e.decimals),void 0!==e.length&&(t.length=e.length),e.isPrimaryKey&&(t.isPrimaryKey=e.isPrimaryKey),e.isEntityReference&&(t.isEntityReference=e.isEntityReference),t}function h(e,t,n){var r=d(t);o.trace("Metamodel","Updating metadata for table "+t.tableName+" ("+t.name+")");var i=new w;return i.add("Hash",0,t.hash),i.add("Name",0,t.name),i.add("Physical_Table_name",0,t.tableName),i.add("Extra_Info",0,JSON.stringify(r)),i.add("Key",0,t.key),i.add("ModuleKey",0,n),e.executeNonQuery("UPDATE "+m+" SET Hash = ?, Name = ?, Physical_Table_name = ?, Extra_Info = ? WHERE SS_Key = ? AND Module_SS_Key = ?",i.toArray())}function g(e,t,n){var r=d(t),i=new w;return i.add("Key",0,t.key),i.add("ModuleKey",0,n),i.add("Name",0,t.name),i.add("TableName",0,t.tableName),i.add("Hash",0,t.hash),i.add("Extra_Info",0,JSON.stringify(r)),i.add("Upgrade_Status",0,3),e.executeNonQuery("INSERT INTO "+m+"(SS_Key, Module_SS_Key, Name, Physical_Table_name, Hash, Extra_Info, Upgrade_Status) VALUES (?, ?, ?, ?, ?, ?, ?)",i.toArray())}var m="OSSYS_ENTITY",y=""+t.BACKUP_TABLE_PREFIX+m,v=[{name:"SS_Key"},{name:"Module_SS_Key"},{name:"Name"},{name:"Physical_Table_name"},{name:"Hash"},{name:"Extra_Info",defaultValue:"'{\"attrs\":{}}'"},{name:"Upgrade_Status",defaultValue:0..toString()}],b='"'+v.map(function(e){return e.name}).join('", "')+'"';e.getDefaultMetaData=n,e.create=r,e.innerCreate=i,e.verifyColumns=a,e.innerVerifyColumns=s,e.addMissingColumns=u,e.addColumnIfNeeded=c,e.copyMetaInfo=f,e.extractEntityMetadata=d,e.updateEntity=h,e.insertEntity=g}(T=e.Metamodel||(e.Metamodel={})),e.upgradeDbValue=c,e.upgradeDbRecord=g,e.requiresFullUpgrade=m}(m=t.Upgrades||(t.Upgrades={}));var y;!function(e){e[e.Auto=0]="Auto",e[e.Single=1]="Single",e[e.Bulk=2]="Bulk"}(y||(y={}));var v=new r.BasicTypeKeyedTypeFactory("Id","idOut"),b=new r.ComplexTypeKeyedTypeFactory("Record","recordOut"),T=function(){function e(){}return e.prototype.getDatabase=function(){var e=this;return this._db?Promise.resolve(this._db):(this.dbReadyPromise||(this.dbReadyPromise=new Promise(function(t){e.onDbInit=function(){return t(e._db)}})),this.dbReadyPromise)},e.prototype.trace=function(e){o.trace(this,e)},e.prototype.initDb=function(e){o.trace(this,"Setting platform database to '"+(e?e.name:"none")+"'"),this._db=e,this.onDbInit&&(this.onDbInit(),this.onDbInit=null)},e.prototype.clearDb=function(){this._db=null},e.prototype.initModule=function(e,t,n){var r=this;return this.recoverBackupTables(t,e,n).andThen(function(t){return 0===e.length?t.feed(null):r.dropInconsistentTables(t,e,n)}).andThen(function(t){return r.backupDeletedTables(t,e,n)}).andThen(function(e){var t=new w;return t.add("ModuleKey",0,n),e.executeQuery("SELECT SS_Key, Hash, Extra_Info FROM OSSYS_ENTITY WHERE Module_SS_Key = ?",function(e){return{hash:e.Hash,extraInfo:JSON.parse(e.Extra_Info||"{}"),ssKey:e.SS_Key}},t.toArray())}).andThenAll(function(t){return e.map(function(e){var i=t.filter(function(t){return t.ssKey===e.key});return function(t){return r.createOrUpgradeTable(t,e,1===i.length?i[0]:void 0,n)}})})},e.prototype.initMetamodel=function(e){return m.Metamodel.create(e).andThen(function(e){return m.Metamodel.verifyColumns(e)}).andThen(function(e,t){return t?void 0:m.Metamodel.addMissingColumns(e)})},e.prototype.createOrUpgradeTable=function(e,t,n,r){var i=this;this.trace("Checking the status of table "+t.tableName+" ("+t.name+")"),n||(n={hash:null,extraInfo:m.Metamodel.getDefaultMetaData()});var o=n.hash,a=n.extraInfo;return o?o!==t.hash?s.SqlDbIntrospector.introspectTableInfo(e,t.tableName).andThen(function(e,n){return m.requiresFullUpgrade(t,n,a)?(i.trace("Table "+t.tableName+" ("+t.name+") exists and will be fully upgraded"),i.recreateTable(e,t,n,r,a)):(i.trace("Table "+t.tableName+" ("+t.name+") exists and will be incrementally upgraded"),i.upgradeTable(e,t,n,r,a))}):(this.trace("Table "+t.tableName+" ("+t.name+") exists and is up to date"),null):(this.trace("Table "+t.tableName+" ("+t.name+") does not exist and will be created"),this.createTable(e,t,r).andThen(function(e){return m.Metamodel.insertEntity(e,t,r)}))},e.prototype.recreateTable=function(e,t,r,i,o){var a=this;return e.executeQuery('SELECT * FROM "'+t.tableName+'"',function(e){return e}).onError(function(e){throw a.trace("Unable to upgrade the definition of entity '"+t.name+"':\n"+n.getMessage(e)),new n.Exceptions.DataBaseException("","Unable to upgrade the definition of entity '"+t.name+"':\n"+n.getMessage(e))}).andThen(function(e,n){return a.backupTable(e,t.tableName,2).andThen(function(e){return a.createTable(e,t,i)}).andThenAll(function(){return n.map(function(e){for(var n=m.upgradeDbRecord(e,t,r,o),i=new w(!0),a=0,s=t.attributes;a<s.length;a++){var u=s[a];i.add(u.name,u.type,n[u.name.toLowerCase()])}return function(e){return e.executeNonQuery(t.insert.sql,i.toArray())}})})}).andThen(function(e){return m.Metamodel.updateEntity(e,t,i)})},e.prototype.upgradeTable=function(e,t,n,r,i,o){var a=this;return void 0===o&&(o=null),e.feed(null).andThenAll(function(){var e=t.attributes.filter(function(e){return n?!n.attributes.some(function(t){return e.name===t.name}):!Object.keys(i.attrs).some(function(t){return t===e.name.toLowerCase()})});return a.trace("Entity '"+t.name+"' - newAttributes - "+JSON.stringify(e)+" - hash - "+o+" - info.hash - "+t.hash),e.map(function(e){return function(n){var r=n.executeNonQuery(e.addColumn.sql);if(void 0!==e["default"]){var i=new w;i.add("value",e.type,e["default"]),r=r.andThen(function(n){return n.executeNonQuery('UPDATE "'+t.tableName+'" SET "'+e.name+'" = ?',i.toArray())})}return r}})}).andThen(function(e){return m.Metamodel.updateEntity(e,t,r)})},e.prototype.switchModule=function(e,t){return this.dropBackupTables(e,t)},e.prototype.recoverBackupTables=function(e,t,n){var r=this;return this.doForEachTable(e,function(e){r.trace("Recovering table "+e);var i=t.filter(function(t){return t.tableName===e});return function(t){return r.recoverBackupTable(t,e,1===i.length?i[0]:null,n)}},n,"Upgrade_Status <> 0")},e.prototype.dropInconsistentTables=function(e,t,n){var r=this;return this.doForEachTable(e,function(e){return r.trace("Dropping inconsistent table "+e+" (same key, different physical table name)"),function(t){return r.dropTableIfExists(t,e).andThen(function(t){return t.executeNonQuery("DELETE FROM OSSYS_ENTITY WHERE upper(Physical_Table_name) = '"+e+"'")})}},n,"Upgrade_Status = 0"+(0===t.length?"":" AND SS_Key IN ("+t.map(function(e){return"'"+e.key+"'"}).join(", ")+")"+(" AND Physical_Table_name NOT IN ("+t.map(function(e){return"'"+e.tableName+"'"}).join(", ")+")")))},e.prototype.dropBackupTables=function(e,t){var n=this;return this.doForEachTable(e,function(e){return n.trace("Dropping table "+e),function(t){return n.dropBackupTable(t,e)}},t,"Upgrade_Status <> 0")},e.prototype.backupDeletedTables=function(e,t,n){var r=this;return this.doForEachTable(e,function(e){return r.trace("Backing up old table "+e),function(t){return r.backupTable(t,e,1)}},n,"Upgrade_Status = 0"+(0===t.length?"":" AND Physical_Table_name NOT IN ("+t.map(function(e){return"'"+e.tableName+"'"}).join(", ")+")"))},e.prototype.doForEachTable=function(e,t,n,r){var i="SELECT Physical_Table_name as name FROM OSSYS_ENTITY WHERE Module_SS_Key = '"+n+"'";return r&&(i+=" AND "+r),e.executeQuery(i,function(e){return e.name}).andThenAll(function(e){var n=[];return e.forEach(function(e){n.push(t(e))}),n})},e.prototype.dropTableIfExists=function(e,t){return e.executeNonQuery('DROP TABLE IF EXISTS "'+t+'"')},e.prototype.createTable=function(e,t,n){return this.trace("createTable '"+t.createTable.sql+"'"),e.executeNonQuery(t.createTable.sql)},e.prototype.backupTable=function(e,t,n){var r=this;return this.trace("backupTable '"+t+"'"),m.Metamodel.copyMetaInfo(e,t,!1).andThen(function(e){return r.dropTableIfExists(e,r.getBackupTableName(t))}).andThen(function(e){return r.renameTableAndSetStatus(e,t,r.getBackupTableName(t),t,n)})},e.prototype.recoverBackupTable=function(e,t,n,r){var i=this,o=!0;return this.dropTableIfExists(e,t).andThen(function(e){return e.executeScalar("SELECT 1 FROM "+i.getBackupTableName(t))}).onError(function(e){e&&(o=!1)}).andThen(function(e){return o?i.renameTableAndSetStatus(e,i.getBackupTableName(t),t,t,0):void 0}).andThen(function(e){return m.Metamodel.copyMetaInfo(e,t,!0)})},e.prototype.dropBackupTable=function(e,n){return this.dropTableIfExists(e,this.getBackupTableName(n)).andThen(function(e){return e.executeScalar("SELECT Upgrade_Status FROM OSSYS_ENTITY WHERE upper(Physical_Table_name) = '"+n+"'")}).andThen(function(e,t){return e.executeNonQuery(1===t?"DELETE FROM OSSYS_ENTITY WHERE upper(Physical_Table_name) = '"+n+"'":"UPDATE OSSYS_ENTITY SET Upgrade_Status = 0 WHERE upper(Physical_Table_name) = '"+n+"'")}).andThen(function(e){return e.executeNonQuery("DELETE FROM "+t.BACKUP_TABLE_PREFIX+"OSSYS_ENTITY WHERE Physical_Table_name = ?",[n])})},e.prototype.renameTableAndSetStatus=function(e,t,n,r,i){var o=this;return this.trace("renameTableAndSetStatus '"+r+" to "+n+"'"),this.renameTable(e,t,n).andThen(function(e){return o.setTableUpgradeStatus(e,r,i)})},e.prototype.renameTable=function(e,t,n){return e.executeNonQuery('ALTER TABLE "'+t+'" RENAME TO "'+n+'"')},e.prototype.setTableUpgradeStatus=function(e,t,n){return e.executeNonQuery("UPDATE OSSYS_ENTITY SET Upgrade_Status = "+n+" WHERE upper(Physical_Table_name) = '"+t+"'")},e.prototype.getBackupTableName=function(e){return t.BACKUP_TABLE_PREFIX+e},e.prototype.executeNonQuery=function(e,t){return this.getDatabase().then(function(n){return n.executeTransaction(function(n){return n.executeNonQuery(e,t&&t.toArray())})})},e.prototype.executeQuery=function(e,t,n,r){return this.getDatabase().then(function(o){return o.executeReadTransaction(function(o){return o.executeQueryRaw(e,r&&r.toArray()).andThen(function(e,r){return i.LocalStorageConverter.from(r.rows,t,n)})})})},e.prototype.rawExecuteQuery=function(e,t,n){return this.getDatabase().then(function(r){return r.executeReadTransaction(function(r){return r.executeQueryRaw(e,n&&n.toArray()).andThen(function(e,n){for(var r=new Array(n.rows.length),i=0;i<n.rows.length;i++){var o=n.rows.item(i);r[i]=t(o)}return r})})})},e.prototype.executeCount=function(e,t){return this.getDatabase().then(function(n){return n.executeReadTransaction(function(n){return n.executeScalar(e,t&&t.toArray()).andThen(function(e,t){return i.LocalStorageConverter.deserializeFromDB(t,4)})})})},e.prototype.rawExecuteScalar=function(e,t){return this.getDatabase().then(function(n){return n.executeReadTransaction(function(n){return n.executeQueryRaw(e,t&&t.toArray()).andThen(function(e,t){return 0===t.rows.length?null:c(t.rows.item(0))})})})},e.prototype.create=function(e,t){var n=this;return l(e,t,"create"),this.getDatabase().then(function(r){return r.executeTransaction(function(r){return n.createInner(r,e,t,!0)})})},e.prototype.createInner=function(e,t,n,r){var o=t.insert.getArguments(n);return e.executeQueryRaw(t.insert.sql,o.toArray()).andThen(function(e,o){if(null===t.getIdAttribute())return null;(0===t.idIsAutoNumber||2===t.idIsAutoNumber&&!t.hasNullId(n))&&(r=!1);var a=t.getIdAttribute().type,s=i.LocalStorageConverter.convertToModelDataType(a),u=new(v.getType(s)),c=null;return c=r?i.LocalStorageConverter.deserializeFromDB(o.insertId,a):t.getIdFromRecord(n),u.idOut=c,u})},e.prototype.update=function(e,t){l(e,t,"update");var n=e.update.getArguments(t);return this.executeNonQuery(e.update.sql,n)},e.prototype.createOrUpdate=function(e,t){var n=this;return this.getDatabase().then(function(r){return r.executeTransaction(function(r){return n.createOrUpdateInner(r,e,t,!0)})})},e.prototype.createOrUpdateInner=function(e,t,n,r){if(l(t,n,"create or update"),t.hasNullId(n))return this.createInner(e,t,n,!0);var o=t.upsert.getArguments(n);return e.executeQueryRaw(t.upsert.sql,o.toArray()).andThen(function(e,r){var o=t.getIdFromRecord(n),a=t.getIdAttribute().type,s=i.LocalStorageConverter.convertToModelDataType(a),u=new(v.getType(s));return u.idOut=o,u})},e.prototype.createOrUpdateAll=function(t,n){var r=this;return this.getDatabase().then(function(i){return i.executeTransaction(function(i){return e.ForceCreateOrUpdateAllMethod===y.Bulk||e.ForceCreateOrUpdateAllMethod===y.Auto&&0===t.attributes.filter(function(e){return 1===e.type}).length?r.createOrUpdateAllBulk(i,t,n):r.createOrUpdateAllSingle(i,t,n)}).then(u)})},e.prototype.createOrUpdateAllBulk=function(t,n,r){var i=[],o=function(e,t){return i.push(function(n){return n.executeQueryRaw(e,t)})},a=Math.floor(e.MaxQueryParameters/n.attributes.length);if(0===a)return this.createOrUpdateAllSingle(t,n,r);for(var s=Math.ceil(r.length/a),u=0;s>u;u++){for(var c=[],f=0;a>f;){var d=u*a+f;if(d===r.length)break;var p=r.getItem(d);l(n,p,"create or update"),c=c.concat(n.upsert.getArguments(p).toArray()),f++}var h=n.upsert.getBulkSql(f);o(h,c)}return t.feed(null).andThenAll(function(e){return i})},e.prototype.createOrUpdateAllSingle=function(e,t,n){for(var r=this,i=[],o=function(e){return i.push(function(n){return r.createOrUpdateInner(n,t,e,!1)})},a=0;a<n.length;a++){var s=n.getItem(a);o(s)}return e.feed(null).andThenAll(function(e){return i})},e.prototype.get=function(e,t){var r=e.getIdAttribute(),i=new w;return i.add(r.name,r.type,t),this.rawExecuteQuery(e.select.sql,e.dbRecordToRecord,i).then(function(r){if(0===r.length)throw new n.Exceptions.DataBaseException("",e.name+" with id "+t+" was not found");var i=new(b.getType(r[0].constructor));return i.recordOut=r[0],i})},e.prototype["delete"]=function(e,t){var n=e.getIdAttribute(),r=new w;return r.add(n.name,n.type,t),this.executeNonQuery(e["delete"].sql,r)},e.prototype.deleteAll=function(e){return this.executeNonQuery(e.deleteAll.sql)},e.prototype.getBinary=function(e,t,n){var r=this,o=e.getIdAttribute(),a=o.name,s=o.type,u='SELECT "'+t+'" FROM "'+e.tableName+'" WHERE "'+a+'" = ?',c=new w;return c.add(a,s,n),i.LocalStorageConverter.deserializeLazyBinaryFromDB(function(){return r.getDatabase().then(function(e){return e.executeReadTransaction(function(e){return e.executeScalar(u,c.toArray())})})})},e.prototype.replaceEntityReferencesInOrderBy=function(e,t,r){var i=this,o=null,s=null,u=null;if(e=e.trim(),s=a.matches(e,'(^|\\s|\\.)(\\[|"|)(ossys_|osltm_|oslog_|osevt_|osusr_|osext_)',!0),s.length>0)throw u=s[0],new n.Exceptions.DataBaseException("","'"+(u.groups[2]+u.groups[3])+"' found in 'Order By' parameter is a reserved prefix");if(""!==e&&(s=a.matches(e,"((((\\{\\w+\\})|(\\w+)).)?((\\[\\w+\\])|(\\w+))(( )+(desc|asc))?)(( )*,( )*(((\\{\\w+\\})|(\\w+)).)?((\\[\\w+\\])|(\\w+))(( )+(desc|asc))?)*",!0),1!==s.length||s[0].value!==e))throw new n.Exceptions.DataBaseException("","Invalid syntax in 'Order By' parameter.");var c=function(e){return i.replaceEntityNameInOrderBy(e,t,r)},l=function(e){return i.replaceAttributeName(e)};return o=a.replace(e,"(\\{\\w+\\}|\\w+\\.)",!1,c),o=a.replace(o,"(\\[\\w+\\])",!1,l)},e.prototype.replaceEntityNameInOrderBy=function(e,t,r){for(var i="",o=this.getEntityNameFromMatch(e),a=!1,s=0;s<t.length;s++)if(t[s].toLowerCase()===o.toLowerCase()){a=!0,i='"'+r[s]+'"';break}if(!a)throw new n.Exceptions.DataBaseException("","'"+o+"' found in 'Order By' parameter is an invalid Entity");return"."===e.value.charAt(e.value.length-1)?i+".":i},e.prototype.replaceAttributeName=function(e){var t=e.value.substr(1,e.value.length-2);return t?('"'===t.charAt(0)?"":'"')+t+('"'===t.charAt(t.length-1)?"":'"'):""},e.prototype.getEntityNameFromMatch=function(e){return"."===e.value.charAt(e.value.length-1)?e.value.substr(0,e.value.length-1):e.value.substr(1,e.value.length-2)},e.prototype.getOrderByColumnsWithoutDuplicates=function(e){return this.filterDuplicateOrderByColumns(e).join(", ")},e.prototype.filterDuplicateOrderByColumns=function(e){var t=new Array,n={};return e.forEach(function(e){var r=e.trim();if(""!==r){var i=r.replace(new RegExp("\b((ASC)|(DESC))$","im"),"").replace('"',"").replace("[","").replace("]","").trim().toLowerCase();n[i]!==!0&&(t.push(r),n[i]=!0)}}),t},e.MaxQueryParameters=500,e.ForceCreateOrUpdateAllMethod=y.Auto,e}();t.WebSQLStorage=T,t.webSQLStorageInstance=new T;var E=function(){function e(e,t,n){var r=this;this.storage=e,this.info=t,this.moduleKey=n,this.getBinary=function(e,t,n){return n.hasContent()?n:r.storage.getBinary(r.info,e,t)}}return e.prototype.getStorage=function(){return this.storage},e.prototype.getInfo=function(){return this.info},e.prototype.create=function(e){return this.storage.create(this.info,e)},e.prototype.createOrUpdate=function(e){return this.storage.createOrUpdate(this.info,e)},e.prototype.createOrUpdateAll=function(e){return this.storage.createOrUpdateAll(this.info,e)},e.prototype.update=function(e){return this.storage.update(this.info,e)},e.prototype.get=function(e){return this.storage.get(this.info,e)},e.prototype["delete"]=function(e){return this.storage["delete"](this.info,e)},e.prototype.deleteAll=function(){return this.storage.deleteAll(this.info)},e}();t.Entity=E;var w=function(){function e(e){this.skipConversion=e,this.argumentList=[],this.existingArguments={}}return e.prototype.add=function(e,t,n,r,o,a){if(!this.existingArguments[e])if(this.existingArguments[e]=!0,void 0===n)this.argumentList.push(null);else{var s=void 0;s=this.skipConversion?n:i.LocalStorageConverter.serializeToDB(n,{type:t,length:r,decimals:o,isEntityReference:a}),this.argumentList.push(s)}},e.prototype.toArray=function(){return this.argumentList},e}();t.QueryArgumentsList=w}),define("OutSystems/ClientRuntime/ObjectExtensions",["require","exports","./DataTypes"],function(e,t,n){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!0}function i(e){var t,n,r=0,i=e.length;if(0===i)return r;for(t=0;i>t;t++)n=e.charCodeAt(t),r=(r<<5)-r+n,r|=0;return r}function o(e,t){return e&&t&&!n.TypeValidations.isBasicType(e)?e.fastEquals instanceof Function?e.fastEquals(t):n.equals(e,t):e===t}function a(e,t,n){if(void 0===n&&(n=r),e===t)return!0;if(null===e||null===t||"object"!=typeof e||"object"!=typeof t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),u=0;u<i.length;u++){var c=i[u];if(n(e,c)){if(!s(c))return!1;if(!o(e[c],t[c]))return!1}}return!0}function s(e,t){if(e===t)return!0;if(!(null!==e&&null!==t&&e instanceof Array&&t instanceof Array))return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!o(e[n],t[n]))return!1;return!0}function u(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(null==e)throw new TypeError("ObjectHelper.assign target cannot be null or undefined");for(var r=Object(e),i=Object.prototype.hasOwnProperty,o=0,a=t;o<a.length;o++){var s=a[o];if(null!=s){var u=Object(s);for(var c in u)i.call(u,c)&&(r[c]=u[c])}}return r}function c(e){return!e||0===Object.keys(e).length}function l(e){for(var t=[],n=[e],r=0;n.length;){var i=n.pop();switch(typeof i){case"boolean":r+=4;break;case"number":r+=8;break;case"string":r+=2*i.length;break;case"object":if(-1!==t.indexOf(i))continue;t.push(i),Array.isArray(i)||(r+=2*Object.keys(i).length);for(var o in i){var a=null;try{a=i[o]}catch(s){}a&&n.push(a)}}}return r}function f(e,t,n){var r=e[t]||function(){};e[t]=function(){return n.apply(this,[].concat(r,arguments))}}function d(e,t,n){for(var r=e,i=0;n>i;i++)r+=t;return r}Object.defineProperty(t,"__esModule",{value:!0}),t.getHashCode=i,t.shallowEquals=a,t.arrayShallowEquals=s,t.assign=u,t.isEmptyObject=c,t.roughSizeOf=l,t.overrideMethod=f,t.concatenateMultipleTimes=d}),define("OutSystems/ClientRuntime/ScreenStateCache",["require","exports","./Logger","./ObjectExtensions"],function(e,t,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.addKey=function(t){this.cache[t]={components:{}},this.cacheKeys.push(t);var n=this.cacheKeys.length-e.MaxCacheSize;if(n>0)for(var r=0;n>r;r++)this.removeKey(this.cacheKeys[r])},e.removeKey=function(e){delete this.cache[e],this.cacheKeys.splice(this.cacheKeys.indexOf(e),1)},e.save=function(e,t,n,r){this.cache[e]||this.addKey(e),this.cache[e].components[t]={state:n,customProperties:r}},e.load=function(t,n){var r=e.loadScreenCache(t);return r?r.components[n]:null},e.loadScreenCache=function(e){return this.cache[e]||void 0},e.clear=function(e){var t=this;e?this.cache[e]&&this.removeKey(e):(this.cache={},this.cacheKeys=[]),n.trace(this,function(){return"State cache contains "+Object.keys(t.cache).length+" entries with a total size of "+r.roughSizeOf(t.cache)+" bytes"})},e.inspect=function(){return{cache:this.cache,cacheKeys:this.cacheKeys}},e.MaxCacheSize=20,e.cache={},e.cacheKeys=[],e}();t.ScreenStateCache=i}),define("OutSystems/ClientRuntime/NativeLogger",["require","exports","tslib","./Logger","./NativeHelper"],function(e,t,n,r,i){"use strict";function o(){var e=window;return e&&e.OutSystemsNative&&e.OutSystemsNative.Logger?e.OutSystemsNative.Logger:void 0}function a(e){return n.__awaiter(this,void 0,void 0,function(){var t,i,a,s,u,c;return n.__generator(this,function(n){if(t=o(),i=Promise.resolve(void 0),t&&e&&e.length>0)for(a=function(e){i=i.then(function(){return new Promise(function(n,i){switch(e.logType){case r.LogTypes.General:t.logInfo(e.message,e.moduleName,n,i);break;case r.LogTypes.Error:t.logError(e.message,e.moduleName,null,e.stack,n,i);break;case r.LogTypes.Trace:t.logDebug(e.message,e.moduleName,n,i);break;default:t.logError("Unknown log type: "+e.logType,"NativeLogger",JSON.stringify(e),(new Error).stack,n,i)}})})},s=0,u=e;s<u.length;s++)c=u[s],a(c);return[2,i.then(function(){return!0})]})})}Object.defineProperty(t,"__esModule",{value:!0});var s;!function(e){function t(){return!!o()}function n(e){i.ensureNativeReady().then(function(){t()&&e()})}function r(e){}function a(){return t()?Promise.resolve():Promise.reject(new Error("NativeLogger API is not available"))}e.isOnline=t,e.onOnline=n,e.onOffline=r,e.ping=a}(s||(s={})),t.NetworkStatus=s,t.postLog=a}),define("OutSystems/ClientRuntime/NativeApplicationInfo",["require","exports","tslib","./NativeHelper"],function(e,t,n,r){"use strict";function i(){var e=window;return e&&e.OutSystemsNative&&e.OutSystemsNative.ApplicationInfo?e.OutSystemsNative.ApplicationInfo:void 0}function o(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return[4,r.ensureNativeReady()];case 1:return e.sent(),[2,new Promise(function(e,t){var n=i();return n?void n.getPlatformVersion(e,t):t(new Error("NativeAppInfo API is not available"))})]}})})}function a(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return[4,r.ensureNativeReady()];case 1:return e.sent(),[2,new Promise(function(e,t){var n=i();return n?void n.getNativeShellVersion(e,t):t(new Error("NativeAppInfo API is not available"))})]}})})}function s(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return[4,r.ensureNativeReady()];case 1:return e.sent(),[2,new Promise(function(e,t){var n=i();return n?void n.getAppVersion(e,t):t(new Error("NativeAppInfo API is not available"))})]}})})}function u(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){switch(e.label){case 0:return[4,r.ensureNativeReady()];case 1:return e.sent(),[2,new Promise(function(e,t){var n=i();return n?void n.getAppVersionNumber(e,t):t(new Error("NativeAppInfo API is not available"))})]}})})}function c(e,t){if(!e||!t)return!1;var n=e.split(".").map(function(e){return parseInt(e,10)}),r=t.split(".").map(function(e){return parseInt(e,10)});return l(n,r,0)}function l(e,t,n){return isNaN(t[n])?!0:(e[n]||0)>(t[n]||0)?!0:e[n]<(t[n]||0)?!1:l(e,t,n+1)}Object.defineProperty(t,"__esModule",{value:!0}),t.getPlatformVersion=o,t.getNativeShellVersion=a,t.getAppVersion=s,t.getAppVersionNumber=u,t.isVersionGreaterOrEqualTo=c}),define("OutSystems/ClientRuntime/Injector",["require","exports"],function(e,t){"use strict";function n(e,t){a[e]=t,e in s&&s[e].forEach(function(n){return n(e,t)})}function r(e,t){e in s?s[e].push(t):s[e]=[t]}function i(e,t){e in s&&(s[e]=s[e].filter(function(e){return e!==t}))}function o(e){return a[e]}Object.defineProperty(t,"__esModule",{value:!0});var a={},s={};t.register=n,t.addRegistrationListener=r,t.removeRegistrationListener=i,t.resolve=o;var u={register:n,resolve:o,addRegistrationListener:r,removeRegistrationListener:i};t["default"]=u}),define("OutSystems/ClientRuntime/Injector/KnownServices",["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e.DeviceHelperClassProvider="DeviceHelperClassProvider",e.ClientVariablesService="ClientVariablesService",e.DatabaseService="DatabaseService"}(n=t.ServiceNames||(t.ServiceNames={}))}),define("OutSystems/ClientRuntime/modules/ClientVariables/LocalStorageSerializer",["require","exports","../../DataTypes"],function(e,t,n){"use strict";function r(e){return"Unsupported data type ("+e+") for client variable"}function i(e,t){switch(t){case n.DataTypes.Integer:return n.TypeValidations.isValidInteger(e);case n.DataTypes.LongInteger:return n.TypeValidations.isValidLongInteger(e);case n.DataTypes.Decimal:case n.DataTypes.Currency:return n.TypeValidations.isValidDecimal(e);case n.DataTypes.Boolean:return n.TypeValidations.isBoolean(e);case n.DataTypes.Text:case n.DataTypes.PhoneNumber:case n.DataTypes.Email:return n.TypeValidations.isText(e);case n.DataTypes.Date:return n.TypeValidations.isValidDate(e);case n.DataTypes.DateTime:return n.TypeValidations.isValidDateTime(e);case n.DataTypes.Time:return n.TypeValidations.isValidTime(e);case n.DataTypes.Record:throw new TypeError(r("Record"));case n.DataTypes.RecordList:throw new TypeError(r("List"));case n.DataTypes.BinaryData:throw new TypeError(r("Binary Data"));case n.DataTypes.Object:throw new TypeError(r("Object"));default:throw new TypeError(r("Unknown: "+e))}}function o(e,t){if(void 0===e||null===e)throw new TypeError("Value "+e+" is not a valid value for a client variable.");if(!i(e,t))throw new TypeError("Value "+e+" is not a valid value for a client variable of the specified type ("+t+").");switch(t){case n.DataTypes.Integer:case n.DataTypes.LongInteger:case n.DataTypes.Decimal:case n.DataTypes.Currency:return e.toString();case n.DataTypes.Boolean:return e?s:u;case n.DataTypes.Text:case n.DataTypes.PhoneNumber:case n.DataTypes.Email:return e;case n.DataTypes.Date:return e.toISODate();case n.DataTypes.DateTime:return e.toString();case n.DataTypes.Time:return e.toISOTime();default:throw new TypeError(r(""+t))}}function a(e,t){switch(t){case n.DataTypes.Integer:var i=Number(e);return n.TypeValidations.isValidInteger(i)&&n.TypeValidations.isWithinIntegerRange(i)?i:n.Constants.DEFAULT_INTEGER;case n.DataTypes.LongInteger:if(!e)return n.Constants.DEFAULT_LONGINTEGER;var o=n.LongInteger.fromString(e);return n.TypeValidations.isValidLongInteger(o)?o:n.Constants.DEFAULT_LONGINTEGER;case n.DataTypes.Decimal:if(!e)return n.Constants.DEFAULT_DECIMAL;var a=new n.Decimal(e);return n.TypeValidations.isValidDecimal(a)&&n.TypeValidations.isWithinDecimalRange(a)?a:n.Constants.DEFAULT_DECIMAL;case n.DataTypes.Currency:if(!e)return n.Constants.DEFAULT_CURRENCY;var c=new n.Decimal(e);return n.TypeValidations.isValidDecimal(c)&&n.TypeValidations.isWithinDecimalRange(c)?c:n.Constants.DEFAULT_CURRENCY;case n.DataTypes.Boolean:return e===s?!0:e===u?!1:n.Constants.DEFAULT_BOOLEAN;case n.DataTypes.Text:return n.TypeValidations.isText(e)?e:n.Constants.DEFAULT_TEXT;case n.DataTypes.PhoneNumber:return n.TypeValidations.isText(e)?e:n.Constants.DEFAULT_PHONENUMBER;case n.DataTypes.Email:return n.TypeValidations.isText(e)?e:n.Constants.DEFAULT_EMAIL;case n.DataTypes.Date:var l=n.DateTime.fromISODate(e);return n.TypeValidations.isValidDate(l)?l:n.Constants.DEFAULT_DATE;case n.DataTypes.DateTime:var f=n.DateTime.fromISODateTime(e);return n.TypeValidations.isValidDateTime(f)?f:n.Constants.DEFAULT_DATETIME;case n.DataTypes.Time:var d=n.DateTime.fromISOTime(e);return n.TypeValidations.isValidTime(d)?d:n.Constants.DEFAULT_TIME;case n.DataTypes.Record:throw new TypeError(r("Record"));case n.DataTypes.RecordList:throw new TypeError(r("List"));case n.DataTypes.BinaryData:throw new TypeError(r("Binary Data"));case n.DataTypes.Object:throw new TypeError(r("Object"));default:throw new TypeError(r("Unknown: "+e))}}Object.defineProperty(t,"__esModule",{value:!0});var s="true",u="false";t.serialize=o,t.deserialize=a}),define("OutSystems/ClientRuntime/modules/ClientVariables/LocalStorageClientVariablesService",["require","exports","../../DataTypes","../../RegExpHelper","../../RolesInfo","../Storage/StorageNaming","./LocalStorageSerializer","../../Logger"],function(e,t,n,r,i,o,a,s){"use strict";function u(e){return void 0===e||null===e}Object.defineProperty(t,"__esModule",{value:!0});var c="Client Variables",l="Argument 'handler' cannot be null or undefined",f="$SESSION_USER_ID",d=function(){function e(e){this.namespace=e,this.subscribers=[],this.fullKeyMatcher=null,this.fullKeyMatcher=new RegExp("^"+r.escape(o.OS_STORAGE_PREFIX)+r.escape(this.namespace)+"\\$[^$]*\\$ClientVars\\$"),this.checkSessionExpires(),this.innerSetVariable(f,"",n.DataTypes.Integer,i.getUserId()); }return e.prototype.getFullKey=function(e,t){return""+o.OS_STORAGE_PREFIX+this.namespace+"$"+t+"$ClientVars$"+e},e.prototype.getVariable=function(e,t,n,r){return this.checkSessionExpires(),this.innerGetVariable(e,t,n,r)},e.prototype.innerGetVariable=function(e,t,r,i){var o=window.localStorage.getItem(this.getFullKey(e,t));return s.trace(c,"Reading Client Variable "+e+" of module "+t+" for "+this.namespace),u(o)?u(i)?n.defaultForType(r):i:a.deserialize(o,r)},e.prototype.setVariable=function(e,t,n,r){this.checkSessionExpires(),this.innerSetVariable(e,t,n,r),this.notifySubscribers(e,t,r)},e.prototype.innerSetVariable=function(e,t,n,r){window.localStorage.setItem(this.getFullKey(e,t),a.serialize(r,n)),s.trace(c,"Set Client Variable "+e+" of module "+t+" for "+this.namespace)},e.prototype.removeAllVariables=function(){for(var e=[],t=0;t<window.localStorage.length;t++){var n=window.localStorage.key(t);this.fullKeyMatcher.test(n)&&e.push(n)}if(e.length>0){for(var r=0,i=e;r<i.length;r++){var n=i[r];window.localStorage.removeItem(n)}this.notifySubscribers()}},e.prototype.subscribe=function(e){if(!e)throw new Error(l);for(var t=0;t<this.subscribers.length;t++)if(this.subscribers[t]===e)return!1;return this.subscribers.push(e),s.trace(c,"Subscribing handler for "+this.namespace),!0},e.prototype.unsubscribe=function(e){if(!e)throw new Error(l);for(var t=0;t<this.subscribers.length;t++)if(this.subscribers[t]===e)return this.subscribers.splice(t,1),s.trace(c,"Unsubscribing handler for "+this.namespace),!0;return!1},e.prototype.notifySubscribers=function(e,t,n){for(var r=0,i=this.subscribers;r<i.length;r++){var o=i[r];o(e,t,n)}s.trace(c,"Notifying subscribers for "+this.namespace)},e.prototype.checkSessionExpires=function(){var e=this.innerGetVariable(f,"",n.DataTypes.Integer);i.getUserId()!==e&&(0!==e&&(s.trace(c,"Removing all Client Variables for user provider "+this.namespace),this.removeAllVariables()),this.innerSetVariable(f,"",n.DataTypes.Integer,i.getUserId()))},e}();t["default"]=d}),define("OutSystems/ClientRuntime/modules/Database/DatabaseUtils",["require","exports"],function(e,t){"use strict";function n(e){var t=e.columns.filter(function(e){return e.isPrimaryKey?e:void 0});return 0===t.length?null:t[0]}Object.defineProperty(t,"__esModule",{value:!0}),t.fetchIdentifierColumn=n}),define("OutSystems/ClientRuntime/modules/Database/IndexedDB/IndexedDBTransaction",["require","exports","../../../Logger","../DatabaseUtils"],function(e,t,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t,n){this.allowTraces=e,this.transaction=t,this.database=n}return Object.defineProperty(e.prototype,"onComplete",{set:function(e){this.transaction.oncomplete=function(){return e()}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onAbort",{set:function(e){var t=this;this.transaction.onabort=function(){return e(t.transaction.error)}},enumerable:!0,configurable:!0}),e.prototype.createTable=function(e){var t=this;return new Promise(function(i){n.trace(t,"Creating table '"+e.name+"'");var o=r.fetchIdentifierColumn(e),a=t.database.createObjectStore(e.name,{keyPath:o?o.name:null,autoIncrement:0===e.idIsAutoNumber?!1:!0});n.trace(t,"Creating columns for '"+e.name+"' table");for(var s=0;s<e.columns.length;s++)n.trace(t,"Creating column '"+e.columns[s].name+"'"),a.createIndex(e.columns[s].name,e.columns[s].name);i()})},e.prototype.deleteTable=function(e){var t=this;return new Promise(function(r){n.trace(t,"Deleting table '"+e.name+"'"),t.database.deleteObjectStore(e.name),r()})},e.prototype.renameTable=function(e,t){throw new Error("Method not implemented.")},e.prototype.copyData=function(e,t){throw new Error("Method not implemented.")},e.prototype.getRecord=function(e,t){var r=this;return new Promise(function(i,o){n.trace(r,"Getting record with key '"+t+"' from table '"+e.name+"'");var a=r.transaction.objectStore(e.name),s=a.get(t);s.onsuccess=function(){n.trace(r,"Retrieved record with key '"+t+"' from table '"+e.name+"' successfully"),i(s.result)},s.onerror=function(){n.trace(r,"Error retrieving record with key '"+t+"' from table '"+e.name+"'"),o(r.transaction.error)}})},e.prototype.removeRecord=function(e,t){var r=this;return new Promise(function(i,o){n.trace(r,"Deleting record with key '"+t+"' from table '"+e.name+"'");var a=r.transaction.objectStore(e.name),s=a["delete"](t);s.onsuccess=function(){n.trace(r,"Deleted record with key '"+t+"' from table '"+e.name+"' successfully"),i()},s.onerror=function(){n.trace(r,"Error deleting record with key '"+t+"' from table '"+e.name+"'"),o(s.error)}})},e.prototype.insertRecord=function(e,t){var r=this;return new Promise(function(i,o){n.trace(r,function(){return"Inserting record on table '"+e.name+"'"});var a=r.transaction.objectStore(e.name).add(t);a.onerror=function(){n.trace(r,function(){return"Error inserting record on table '"+e.name+"'\n "+a.error}),o(a.error)},a.onsuccess=function(){n.trace(r,function(){return"Inserted record on table '"+e.name+"' successfully"}),i(a.result)}})},e.prototype.upsert=function(e,t){var r=this;return new Promise(function(i,o){n.trace(r,function(){return"Adding/Updating record on table '"+e.name+"'"});var a=r.transaction.objectStore(e.name).put(t);a.onerror=function(){n.trace(r,function(){return"Error adding/updating record on table '"+e.name+"'\n "+a.error}),o(a.error)},a.onsuccess=function(){n.trace(r,function(){return"Added/Updated record on table '"+e.name+"' successfully"}),i(a.result.valueOf())}})},e.prototype.addColumn=function(e,t){var r=this;return new Promise(function(i){n.trace(r,function(){return"Adding column '"+n.serializeObjectForLog(t)+"' on table '"+e.name+"'"}),r.transaction.objectStore(e.name).createIndex(t.name,t.name),i()})},e}();t["default"]=i}),define("OutSystems/ClientRuntime/modules/Database/IndexedDB/IndexedDBDatabase",["require","exports","../../../Exceptions","../../../Flow","../../../Logger","./IndexedDBTransaction"],function(e,t,n,r,i,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a="Could not open database",s=function(){function e(e,t){this.databaseName=e,this.databaseImplementation=t}return e.asSafeDbName=function(e){return e||""},Object.defineProperty(e.prototype,"name",{get:function(){return this.databaseName},enumerable:!0,configurable:!0}),e.open=function(t){var i=this;return t=this.asSafeDbName(t),r.promise(function(r,o){if(i.cache[t])r(i.cache[t]);else{if("undefined"==typeof window)return o(new n.Exceptions.SystemException("Database is only available in the browser/web view"));if(!("indexedDB"in window))return i.trace("This browser doesn't support IndexedDB"),o(new n.Exceptions.SystemException("This browser doesn't support IndexedDB"));i.trace("Opening database '"+t+"'");var s=window.indexedDB.open(t);s.onsuccess=function(n){i.trace("Database '"+t+"' opened successfully"),i.cache[t]=new e(t,s.result),r(i.cache[t])},s.onerror=function(e){i.trace("Error opening database '"+t+"'"),o(new n.Exceptions.OpenDatabaseException(a+" '"+t+"'"))}}})},e.prototype.close=function(){return i.trace(this,"Closing database "+this.name),this.databaseImplementation.close(),r.resolve()},e.prototype.testConnection=function(){return Promise.resolve()},e.prototype.executeTransaction=function(e,t){return void 0===t&&(t=!0),this.innerExecuteDMLTransaction(e,t,"readwrite")},e.prototype.executeReadTransaction=function(e,t){return void 0===t&&(t=!0),this.innerExecuteDMLTransaction(e,t,"readonly")},e.prototype.innerExecuteDMLTransaction=function(e,t,n){var r=this;return new Promise(function(i,a){for(var s=[],u=0;u<r.databaseImplementation.objectStoreNames.length;u++)s.push(r.databaseImplementation.objectStoreNames.item(u));var c=new o["default"](t,r.databaseImplementation.transaction(s,n),r.databaseImplementation),l=null;c.onComplete=function(){return i(l)},c.onAbort=function(e){return a(e)},e(c).then(function(e){return l=e})})},e.prototype.executeUpgradeTransaction=function(e,t){var n=this;return void 0===t&&(t=!0),new Promise(function(r,a){var s=n.databaseImplementation.version;n.databaseImplementation.close();var u=window.indexedDB.open(n.databaseName,s+1);u.onsuccess=function(){i.trace(n,"Database '"+n.databaseName+"' opened successfully"),n.databaseImplementation=u.result},u.onerror=function(){i.trace(n,"Error opening '"+n.databaseName+"' database"),a(u.error)},u.onupgradeneeded=function(c){i.trace(n,"Upgrading database '"+n.databaseName+"' with version '"+(s+1)+"'"),n.databaseImplementation=u.result;var l=new o["default"](t,u.transaction,u.result),f=null;l.onComplete=function(){return r(f)},l.onAbort=function(e){return a(e)},e(l).then(function(e){return f=e})}})},e.trace=function(e,t){void 0===t&&(t=!0),t&&i.trace(this,e)},e.cache={},e}();t["default"]=s}),define("OutSystems/ClientRuntime/modules/Database/IndexedDB/IndexedDBService",["require","exports","tslib","./IndexedDBDatabase"],function(e,t,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){this.databaseName=e}return e.prototype.getDatabase=function(){var e=this;return this.databasePromise||(this.databasePromise=new Promise(function(t){e.releaseDatabaseForUse=function(){return t(e.database)}})),this.databasePromise},e.prototype.initialize=function(e){return n.__awaiter(this,void 0,void 0,function(){var t,i=this;return n.__generator(this,function(o){switch(o.label){case 0:return t=this,[4,r["default"].open(this.databaseName)];case 1:return t.database=o.sent(),e&&e.length>0?[4,this.database.executeUpgradeTransaction(function(t){return n.__awaiter(i,void 0,void 0,function(){var r,i,o;return n.__generator(this,function(n){switch(n.label){case 0:r=0,i=e,n.label=1;case 1:return r<i.length?(o=i[r],[4,o(t)]):[3,4];case 2:n.sent(),n.label=3;case 3:return r++,[3,1];case 4:return[2]}})})})]:[3,3];case 2:o.sent(),o.label=3;case 3:return[2]}})})},e.prototype.setReady=function(){this.databasePromise?this.releaseDatabaseForUse():this.databasePromise=Promise.resolve(this.database)},e.prototype.close=function(){return this.database?this.database.close():Promise.resolve()},e}();t["default"]=i}),define("OutSystems/ClientRuntime/CSSHelper",["require","exports","./Logger"],function(e,t,n){"use strict";function r(e,t){return t&&(e.classList?e.classList.add(t):a(e,t)||(e.className=e.className+" "+t)),e}function i(e,t){return t&&(e.classList?e.classList.remove(t):a(e,t)&&(e.className=e.className.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,""))),e}function o(e,t,n){return(n?r:i)(e,t)}function a(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+e.className+" ").indexOf(" "+t+" ")>-1}function s(e,t){if(0===e.length)return{loadStylesPromise:Promise.resolve(),triggerRemoveStyles:function(){}};var n=document.head||document.querySelector("head"),r=[].slice.call(document.querySelectorAll("link[data-os]")||[]).reverse(),i=[],o=[],a=[],s=void 0,l=0;e:for(var f=0,p=e.reverse();f<p.length;f++){for(var g=p[f],m=l;m<r.length;m++){var y=r[m];if(y.id===g){s=y,o.push(y),l=m+1;continue e}}var v=d(g,i,t);a.push({beforeElement:s,element:v}),s=v}u("Adding",a);for(var b=0,T=a;b<T.length;b++){var E=T[b],w=E.beforeElement,D=E.element;c("Adding",D.id),w?n.insertBefore(D,w):n.appendChild(D)}h+=1;var S=h,I=function(){if(h===S){u("Retaining",o);for(var e=0,t=o;e<t.length;e++){var n=t[e];c("Retaining",n.id)}for(var i=0,a=r;i<a.length;i++){var s=a[i];s.parentNode&&-1===o.indexOf(s)&&(c("Removing",s.id),s.parentNode.removeChild(s))}}};return{loadStylesPromise:Promise.all(i),triggerRemoveStyles:I}}function u(e,t){n.trace(p,e+" "+t.length+" stylesheets : document '"+document.baseURI+"':")}function c(e,t){n.trace(p,e+" stylesheet '"+t+"' : document '"+document.baseURI+"'")}function l(e){n.trace(p,"Setting ignore load errors to "+e),g=e}function f(){return g}function d(e,t,r){n.trace(p,"Loading stylesheet '"+e+"'");var i=document.createElement("link");return i.type="text/css",i.rel="stylesheet",i.id=e,i.href=e,i.setAttribute("data-os","true"),t.push(new Promise(function(t){i.onerror=i.onabort=function(o){g?n.trace(p,"Ignored error while loading stylesheet '"+e+"'"):r("Error loading stylesheet: "+e),i.parentNode.removeChild(i),t(o)},i.onload=t})),i}Object.defineProperty(t,"__esModule",{value:!0});var p="CSSHelper";t.addClass=r,t.removeClass=i,t.conditionClass=o,t.hasClass=a;var h=0;t.scheduleCSSPreparation=s;var g=!1;t.setIgnoreLoadErrors=l,t.getIgnoreLoadErrors=f}),define("OutSystems/ClientRuntime/Application",["require","exports","module","tslib","./StorageProvider","./Navigation","./VersionsManager","./ApplicationInfo","./FeedbackMessageService","./Logger","./Performance","./ErrorHandling","./Communication","./DataTypes","./NativeHelper","./RequireManager","./Database","./Entities","./ScreenStateCache","./Flow","./Exceptions","./Transitions","./ClientInfo","./NativeLogger","./NativeApplicationInfo","./NativeHttp","./CookiesManager","./RolesInfo","./Injector","./Injector/KnownServices","./modules/ClientVariables/LocalStorageClientVariablesService","./modules/Database/IndexedDB/IndexedDBService","./CSSHelper"],function(e,t,n,r,i,o,a,s,u,c,l,f,d,p,h,g,m,y,v,b,T,E,w,D,S,I,_,x,A,N,C,O,R){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var L="Application",M="upgrade-required",P="upgrade-success",F="upgrade-error";t.ApplicationStorage={hasRenderedSplashInSession:new i.StorageObject(i.StorageType.Session,"HasRenderedSplashInSession",!1),pendingUpgradeFeedback:new i.StorageObject(i.StorageType.Session,"PendingUpgradeFeedback")};var V=function(){function e(){this.showingSplashScreen=!1}return e.prototype.setApplicationDefinition=function(e){s.setApplicationDefinition(e);var t=h.isRunningOnNative()?e.environmentKey+"_"+e.applicationKey:e.applicationName;s.setDatabaseName(t)},e.prototype.initializeLogger=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t,n,i;return r.__generator(this,function(r){switch(r.label){case 0:e=d.NetworkStatus,t=d.postLog,r.label=1;case 1:return r.trys.push([1,5,,6]),[4,h.ensureNativeReady()];case 2:return r.sent(),D.NetworkStatus.isOnline()?[4,S.getNativeShellVersion()]:[3,4];case 3:n=r.sent(),S.isVersionGreaterOrEqualTo(n,"2.7.3")&&(e=D.NetworkStatus,t=D.postLog),r.label=4;case 4:return[3,6];case 5:return i=r.sent(),[3,6];case 6:return c.setNetworkStatusChecker(e),c.setPostLogsFunction(t),c.enableFallbackStorage(),[2]}})})},e.prototype.initializeCookiesManager=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t;return r.__generator(this,function(n){switch(n.label){case 0:return[4,I.isNativeHttpPluginAvailable()];case 1:return e=n.sent(),e?[4,I.getNativeHttpPlugin()]:[3,3];case 2:t=n.sent(),_.initialize(t),n.label=3;case 3:return[2]}})})},e.prototype.initialize=function(e,t,n,o){var u=this;void 0===t&&(t=0),l.start("Application initialize");var f,h;return b.tryCatchFinally(function(){return r.__awaiter(u,void 0,void 0,function(){var u,l,m,y,b,w,D=this;return r.__generator(this,function(r){switch(r.label){case 0:c.trace(L,"Initializing Application"),h=this.initializeCookiesManager(),f=this.initializeLogger(),this.setApplicationDefinition(e),i.setDefaultStorageNamespace(s.getHomeModuleName()+s.getPersonalAreaStorageIdOrDefault()),d.initialize(s.isDebugEnabled(),s.getUserCookieName(),function(e){return D.onNewVersionDetected(e)}),g.setErrorHandler(function(e){return a["default"].isUpgradingVersion&&!T.isSystem(e)?(c.trace(L,"RequireJS error during upgrade, treating as an upgrade error."),void a["default"].handleUpgradeError(e,1)):void D.handleError(e)}),v.ScreenStateCache.clear(),E.setDefaultTransition(s.getDefaultTransition()),n&&(p.Constants.FORMAT.dateTimeFormat=n),o&&(p.Constants.FORMAT.numberFormat=o);try{A["default"].register(N.ServiceNames.ClientVariablesService,new C["default"](e.userProviderName+s.getPersonalAreaStorageIdOrDefault()))}catch(S){c.trace(L,"Failed to initialize Client Variables service: "+S)}return[4,h];case 1:return r.sent(),[4,f];case 2:if(r.sent(),s.isWebApplication())try{A["default"].register(N.ServiceNames.DatabaseService,new O["default"](e.userProviderName+s.getPersonalAreaStorageIdOrDefault()))}catch(S){c.trace(L,"Failed to initialize Database service: "+S)}return 1===t?[2,!0]:(u=this.initializeDatabase(),l=!1,m=function(){l=!0},y=new Promise(function(e){if(l)e();else{var t=m;m=function(){t(),e()}}}),b=y.then(function(){return D.triggerApplicationReadyEvent()}),w={onVersionReady:function(){return u.then(function(e){return D.onDatabaseReady(e)}).then(function(){return y}).then(function(){return b}).then(function(){return D.onApplicationReady()})},onUpgradeFinished:function(e,t){return D.onUpgradeFinished(e,t)},onNewVersionDetected:function(e){return D.onNewVersionDetected(e)},onAppInfoReady:function(e){return D.onAppInfoReady(e)}},[2,a["default"].initialize(u,w).then(function(e){return m(),e})])}})})},function(e){return b.tryFinally(function(){return f},function(){if(0!==t)throw e;u.handleError(e)})},function(){return l.end("Application initialize")})},e.prototype.triggerApplicationReadyEvent=function(){var e=this,t=s.getHomeModuleControllerName();return t?(c.trace(L,"Calling application ready event handler for "+s.getHomeModuleName()),new Promise(function(e,n){requirejs([t],e,n)}).then(function(e){return e["default"].fireApplicationReady()})["catch"](function(t){e.handleError(t)})):void 0},e.prototype.initializeDatabase=function(){c.trace(L,"Initializing application database.");var e;if(s.isWebApplication()||"28f21196-030a-4be2-8241-5a4888fb3ca5"===s.getHomeModuleKey()){e=m.SqlDbProvider.mockDb(s.getDatabaseName());var t=A["default"].resolve(N.ServiceNames.DatabaseService);t&&(e=e.then(function(e){return t.initialize().then(function(){return e})}))}else e=m.SqlDbProvider.openDb(s.getDatabaseName()).then(function(e){return e.testConnection().then(function(){return e.executeTransaction(function(t){return y.LogTable.initialize(t,e).andThen(function(t){return y.PersistentKeyValue.initialize(t,e)}).andThen(function(e){return y.webSQLStorageInstance.initMetamodel(e)}).andThen(function(){return e})})})});return e.then(function(e){return x.initialize(y.PersistentKeyValue.storage).then(function(){return e})})},e.prototype.onDatabaseReady=function(e){y.webSQLStorageInstance.initDb(e);var t=A["default"].resolve(N.ServiceNames.DatabaseService);t&&t.setReady(),c.trace(L,"Database initialized successfully")},e.prototype.onNewVersionDetected=function(e){var t=this;c.trace(L,"New version detected, currentViewHasChanged = "+e);var n=!0,r=function(e){n=e};if(e){this.disableDocument();var i=function(){return o.changeWindowLocation(o.buildApplicationRelativeUrl(),n,!0)},s=function(e){return e.getApplicationUpgradeRequiredMessage(t.canLoseDataInUpgrade())};this.showFeedbackMessage(s,2,M,i).then(function(){return u.setEnabled(!1)})}return a["default"].cacheResourcesInBackground(r)},e.prototype.onAppInfoReady=function(e){try{l.start("Application onAppInfoReady"),this.updateHasTracingEnabled(e),this.updateApplicationDefaultTimeout(e),this.updateApplicationInfo(e),this.updateClientInfo(),this.updateLoggerDetails()}finally{l.end("Application onAppInfoReady")}},e.prototype.updateHasTracingEnabled=function(e){c.setTracingEnabled(e.data.hasTracingEnabled)},e.prototype.updateApplicationDefaultTimeout=function(e){s.setApplicationDefaultTimeout(e.data.applicationDefaultTimeout)},e.prototype.updateApplicationInfo=function(e){s.setModules(e.data.modules),s.setClientEntitiesModules(e.data.entityModuleNames)},e.prototype.updateClientInfo=function(){h.ensureNativeReady().then(function(){return w.setClientInfo()})["catch"](function(e){return c.trace("","Client info update failed: "+e)})},e.prototype.updateLoggerDetails=function(){var e=h.isRunningOnNative();c.setDeviceDetails(e)},e.prototype.shouldRenderSplashScreen=function(){var e=s.getHomeModuleDefinition();return e.splashScreenName&&e.splashScreenName.length>0&&!t.ApplicationStorage.hasRenderedSplashInSession.get()},e.prototype.disableDocument=function(){var e=document.createElement("div");e.classList.add("background-backdrop"),document.body.classList.add("disable-scroll"),document.body.appendChild(e)},e.prototype.canLoseDataInUpgrade=function(){return document.getElementsByTagName("form").length>0},e.prototype.onUpgradeFinished=function(e,n){c.trace(L,"Upgrade "+(e?"finished successfully":"failed with reason: "+n));var r={success:e,failReason:n};e&&!this.isShowingSplashScreen?this.showUpgradeFeedback(r):t.ApplicationStorage.pendingUpgradeFeedback.set(r)},e.prototype.waitForAppReady=function(){var e=this;return this.isReady?Promise.resolve(void 0):(this.appReadyPromise||(this.appReadyPromise=new Promise(function(t){e.onReady=function(){return t()}})),this.appReadyPromise)},e.prototype.onApplicationReady=function(){c.trace(L,"Application ready"),l.end("Application ready"),this.isReady=!0,this.onReady&&(this.onReady(),this.onReady=null)},e.prototype.onBeforeNavigation=function(e,t){return R.setIgnoreLoadErrors(!0),o.onBeforeNavigate(e,t)},e.prototype.onAfterNavigation=function(){if(R.setIgnoreLoadErrors(!1),!this.isShowingSplashScreen&&!o.hasPendingReload()){c.trace(L,"Navigated to: "+o.getCurrentLocation().href);var e=t.ApplicationStorage.pendingUpgradeFeedback.get();e&&(this.showUpgradeFeedback(e),t.ApplicationStorage.pendingUpgradeFeedback.remove())}},e.prototype.showUpgradeFeedback=function(e){var t,n,r;if(e.success)n=0,t=function(e){return e.getApplicationUpgradeCompleteMessage()},r=P;else switch(n=2,r=F,e.failReason){case 1:t=function(e){return e.getApplicationUpgradeFailedOnResourcesMessage()};break;case 2:t=function(e){return e.getApplicationUpgradeFailedOnDataModelMessage()};break;default:t=function(e){return e.getApplicationUpgradeFailedUnknownMessage()}}this.showFeedbackMessage(t,n,r)},e.prototype.showFeedbackMessage=function(e,t,n,r){return void 0===n&&(n=""),new Promise(function(i){var o=s.getHomeModuleLanguageResourcesName();requirejs([o],function(o){var a=e(o);a&&u.showFeedbackMessage(a,t,!0,n,!0,r),i()})})},Object.defineProperty(e.prototype,"isShowingSplashScreen",{get:function(){return this.showingSplashScreen},set:function(e){e&&t.ApplicationStorage.hasRenderedSplashInSession.set(!0),this.showingSplashScreen=e},enumerable:!0,configurable:!0}),e.prototype.handleError=function(e,t){f.handleError(e,t)},e.prototype.exit=function(){return h.isRunningOnNative()?h.exitApp():!0},e}();t.Application=V;var U=new V;t["default"]=U,o.VersionedURL.setUrlVersionProvider(a["default"].getVersionedUrl.bind(a["default"])),U["default"]=U,U.ApplicationStorage=t.ApplicationStorage,n.exports=U}),define("OutSystems/ClientRuntime/JSONUtils",["require","exports","./DataConversion"],function(e,t,n){"use strict";function r(e,t,r,i){var a=n.JSONConverter.to(e,t,r,i);return JSON.stringify(a,o)}function i(e,t,r){try{var i=void 0;return e&&(i=a(e)),n.JSONConverter.from(i,t,r)}catch(o){throw"Failed to deserialize JSON to "+t.name+": "+o.message}}function o(e,t){return null!==t?t:void 0}function a(e){var t=/(?:"([^\\"]|\\.)*")|(?:'([^\\']|\\.)*')|(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(\w+)\s*:/g,n=e.replace(t,function(e,t,n,r,i){return r?'"'+r+'"':n?'"'+e.substring(1,e.length-1)+'"':i?'"'+i+'":':e});return JSON.parse(n)}function s(e,t){var n,r,i,o;for(var a in t){n=e[a],r=t[a];var u=r&&n&&("object"==typeof r||(i=Array.isArray(r)));u?(i?(i=!1,o=Array.isArray(n)?n:[]):o="object"==typeof n?n:{},e[a]=s(o,r)):void 0!==r&&(e[a]=r)}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.serializeToJSON=r,t.deserializeFromJSON=i,t.filterJSONValues=o,t.parseJSON=a,t.mergeJS=s}),define("OutSystems/ClientRuntime/ScriptsManager",["require","exports","./Logger"],function(e,t,n){"use strict";function r(e){i("Adding script",e),o();var t=l.get(e);if(t)return i("Script already added",e),t.promise;var n=document.createElement("script");n.async=!1,n.setAttribute("src",e),n.setAttribute(u,"false");var r=new Promise(function(t,r){var o=function(){n.setAttribute(u,"true")};n.onerror=n.onabort=function(t){o(),r("Error adding script '"+e+"' to document '"+document.baseURI+"'")},n.onload=function(n){i("Script added",e),o(),t(n)}});return d?d.domElement.parentNode.insertBefore(n,d.domElement.nextSibling):document.head.appendChild(n),l.set(e,{promise:r,domElement:n}),d=l.get(e),r}function i(e,t){n.trace(c,e+" '"+t+"' : document '"+document.baseURI+"'")}function o(){f||(f=!0,Object.defineProperty(define,"amd",{get:a.bind(this,define.amd),configurable:!0}))}function a(e){var t=document.currentScript;if(!t||!t.hasAttribute(u))return e}function s(e,t){return Promise.all(e.map(function(e){return r(e)["catch"](t)}))}Object.defineProperty(t,"__esModule",{value:!0});var u="data-os-finished",c="ScriptsManager",l=new Map,f=!1,d=null;t.addScript=r,t.scheduleCustomJsLoading=s}),define("OutSystems/ClientRuntime/SystemActions",["require","exports","tslib","./DataTypes","./ScriptsManager","./Logger","./Navigation"],function(e,t,n,r,i,o,a){"use strict";function s(e,t,n){if(t.isBeingIterated(e))throw new Error("List is being iterated: "+n+" is not allowed")}function u(e,t,n,r){s(e,t,n);try{return t.registerIterationStart(e),r()}finally{t.registerIterationEnd(e)}}function c(e){return e?e.iterationContext:new x}function l(e,t,n){var r=c(n);s(e,r,"append"),e.append(t)}function f(e,t){var n=c(t);s(e,n,"clear"),e.clear(),n.setCurrentRowNumber(e,0)}function d(e,t,n,r){var i=c(r);s(e,i,"insert"),e.insert(n,t);var o=i.getCurrentRowNumber(e);e.length>1&&o>=n&&i.setCurrentRowNumber(e,o+1)}function p(e,t,n){var r=c(n);s(e,r,"remove");var i,o=1===e.length;o&&(i=e.getItem(0)),e.remove(t),o&&(e.emptyListItem=i);var a=r.getCurrentRowNumber(e);a>t?r.setCurrentRowNumber(e,a-1):t===e.length&&r.setCurrentRowNumber(e,Math.max(0,e.length-1))}function h(e,t,n){var r=c(n);s(e,r,"appendAll"),e.appendAll(t)}function g(e,t){var n=c(t);s(e,n,"duplicate");var r=new(S.getType(e.constructor));return r.duplicatedListOut=e.clone(),r}function m(e,t){var n=c(t);return u(e,n,"distinct",function(){var t=new(_.getType(e.constructor));return t.distinctListOut=e.distinct(),t})}function y(e,t,n){var r=c(n);return u(e,r,"all",function(){var n=new A;return n.resultOut=e.all(t),n})}function v(e,t,n){var r=c(n);return u(e,r,"any",function(){var n=new A;return n.resultOut=e.any(t),n})}function b(e,t,n){var r=c(n);return u(e,r,"filter",function(){var n=new(I.getType(e.constructor));return n.filteredListOut=e.filter(t),n})}function T(e,t,n,r){var i=c(r);return u(e,i,"sort",function(){e.sort(t,n)})}function E(e,t,n){var r=c(n);return u(e,r,"indexOf",function(){var n=new N;return n.positionOut=e.indexOf(t),n})}function w(e,t){var n=a.VersionedURL.getVersionedUrl(e);return i.addScript(n)}function D(e,t,n){o.log(t,e)}Object.defineProperty(t,"__esModule",{value:!0});var S=new r.ComplexTypeKeyedTypeFactory("DuplicatedList","duplicatedListOut"),I=new r.ComplexTypeKeyedTypeFactory("FilteredList","filteredListOut"),_=new r.ComplexTypeKeyedTypeFactory("DistinctList","distinctListOut"),x=function(){function e(){}return e.prototype.getCurrentRowNumber=function(e){return 0},e.prototype.setCurrentRowNumber=function(e,t){},e.prototype.isBeingIterated=function(e){return!1},e.prototype.registerIterationStart=function(e){},e.prototype.registerIterationEnd=function(e){},e.prototype.getIterator=function(e){return null},e.prototype.clone=function(){return this},e}();t.listAppend=l,t.listClear=f,t.listInsert=d,t.listRemove=p,t.listAppendAll=h,t.listDuplicate=g,t.listDistinct=m;var A=function(e){function t(t,n){return e.call(this,t,n)||this}return n.__extends(t,e),t.attributesToDeclare=function(){return[this.attr("Result","resultOut","resultOut",!0,!0,r.DataTypes.Boolean,function(){})].concat(e.attributesToDeclare.call(this))},t._constructor=function(){t.init()}(),t}(r.GenericRecord);t.listAll=y,t.listAny=v,t.listFilter=b,t.listSort=T;var N=function(e){function t(t,n){return e.call(this,t,n)||this}return n.__extends(t,e),t.attributesToDeclare=function(){return[this.attr("Position","positionOut","positionOut",!0,!0,r.DataTypes.Integer,function(){})].concat(e.attributesToDeclare.call(this))},t._constructor=function(){t.init()}(),t}(r.GenericRecord);t.listIndexOf=E,t.requireScript=w,t.logMessage=D}),define("OutSystems/ClientRuntime/WidgetNaming",["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e[e.Block=0]="Block",e[e.IteratorItem=1]="IteratorItem",e[e.None=2]="None"}(n=t.NamespaceKind||(t.NamespaceKind={}));var r="-",i=function(){function e(e,t,i,o){switch(void 0===t&&(t=""),void 0===i&&(i=n.None),void 0===o&&(o=null),this._ownerService=e,i){case n.Block:this._namespace="b";break;case n.IteratorItem:this._namespace="l";break;default:this._namespace=""}if(this._namespace+=t,e){var a=o?o+r:"";this._namespace=e.namespace+this._namespace+r+a}else this._namespace&&(this._namespace=this._namespace+r)}return e.prototype.getId=function(e){return e?this.namespace+e:null},e.nameFromId=function(e){return e.substring(e.lastIndexOf(r)+1)},Object.defineProperty(e.prototype,"namespace",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ownerService",{get:function(){return this._ownerService},enumerable:!0,configurable:!0}),e}();t.WidgetIdService=i}),define("OutSystems/ClientRuntime/Validation",["require","exports","./WidgetNaming"],function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="",i=function(){function e(e,t){var n=this;this.model=e,this.messagesProvider=t,this.updatingValidations=!1,this.disposed=!1,e.hasValidationWidgets&&(this.widgets={},this.widgetChildren={},this.oldModelWidgets=this.model.widgets,this.model.subscribeWrites(function(){n.updatingValidations||n.oldModelWidgets===n.model.widgets||n.recalculateAggregatorsState(r),n.oldModelWidgets=n.model.widgets},!0))}return e.prototype.getWidgetRecord=function(e){return this.model.widgets.get(e)},e.prototype.updateWidgetValidationsProperties=function(e,t,n){var r=this.updatingValidations;this.updatingValidations=!0;try{if(e.isWebBlockInstance){var i=e;i.valid=t}else{var o=this.getWidgetRecord(e.getId());o.validAttr!==t&&(o.validAttr=t),void 0!==n&&o.validationMessageAttr!==n&&(o.validationMessageAttr=n)}}finally{this.updatingValidations=r}},e.prototype.validateWidget=function(e){var t=!0;for(var n in this.widgetChildren[e])this.validateWidget(n)!==!0&&(t=!1);var r=this.widgets[e];if(r){var i=null;r.isValidationAggregator?i=new o(t):r.validate&&(i=r.validate()),i&&(this.updateWidgetValidationsProperties(r,i.valid,i.validationMessage),i.valid||(t=!1))}return t},e.prototype.recalculateAggregatorsState=function(e){var t=!0;for(var n in this.widgetChildren[e])this.recalculateAggregatorsState(n)||(t=!1);var r=this.widgets[e];if(r){if(r.isWebBlockInstance)return r.valid;if(!r.isValidationAggregator)return this.getWidgetRecord(e).validAttr;this.updateWidgetValidationsProperties(r,t,void 0)}return t},e.prototype.register=function(e){if(this.model.hasValidationWidgets&&e){var t=e.getId();if(t){this.widgets[t]=e;var n=e.validationParentId||r,i=this.widgetChildren[n];if(i||(i={},this.widgetChildren[n]=i),i[t]=1,!e.isWebBlockInstance){var o=e,a=this.model.widgets.create(t);a.generationNode=o.generationNode,this.model.widgets.add(a)}}}},e.prototype.unregister=function(e){if(e&&!this.disposed&&this.model.hasValidationWidgets){var t=this.widgets[e],n=(t?t.validationParentId:null)||r;delete this.widgets[e],delete this.widgetChildren[n][e],t&&this.model.widgets.remove(e)}},e.prototype.isRegistered=function(e){return!!this.widgets&&void 0!==this.widgets[e]},e.prototype.validate=function(e){if(!this.model.hasValidationWidgets)return!0;var t=this.validateWidget(e||r);return e&&(t=this.recalculateAggregatorsState(r)),this.model.flush(),t},e.prototype.getMandatoryValueMessage=function(){return this.messagesProvider.getMandatoryValueMessage()},e.prototype.getInvalidValueMessage=function(e){return this.messagesProvider.getInvalidValueMessage(e)},e.prototype.getNameById=function(e){return n.WidgetIdService.nameFromId(e); },e.prototype.getWidgetChildren=function(){return this.widgetChildren},e.prototype.dispose=function(){this.disposed=!0},e}();t.ValidationService=i;var o=function(){function e(e,t){this.valid=e,this.validationMessage=t}return Object.defineProperty(e.prototype,"valid",{get:function(){return this._valid},set:function(e){this._valid=void 0===e?!0:e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"validationMessage",{get:function(){return this._validationMessage},set:function(e){this._validationMessage=e||""},enumerable:!0,configurable:!0}),e}();t.ValidationResult=o}),define("OutSystems/ClientRuntime/RolesService",["require","exports","./RolesInfo"],function(e,t,n){"use strict";function r(e){if(!n.RolesInfoStorage.rolesInfo.isDefined())return!1;var t=n.RolesInfoStorage.rolesInfo.get();return t.indexOf(e)>=0}Object.defineProperty(t,"__esModule",{value:!0}),t.checkRole=r,t.getUserId=n.getUserId}),define("OutSystems/ClientRuntime/Public",["require","exports","./NativeHelper","./RolesService","./VersionsManager","./Application","./ApplicationInfo","./ResourceCache","./Logger","./FeedbackMessageService","./Controller","./Navigation","./Transitions","./BuiltinFunctions","./Injector","./Injector/KnownServices"],function(e,t,n,r,i,o,a,s,u,c,l,f,d,p,h,g){"use strict";function m(e,t){u.log("Public","'"+e+"' is deprecated and will be removed on the next version. Consider using '"+t+"' instead.")}function y(){return l.BaseViewController.activeScreen?l.BaseViewController.activeScreen.modelContext:{viewName:"",navigatedFromHistory:!1,viewWasRestoredFromCache:!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.BuiltinFunctions=p;var v;!function(e){function t(e){return r.checkRole(e)}e.checkIfCurrentUserHasRole=t}(v=t.Security||(t.Security={}));var b;!function(e){e[e.Info=0]="Info",e[e.Success=1]="Success",e[e.Warning=2]="Warning",e[e.Error=3]="Error"}(b=t.FeedbackMessageType||(t.FeedbackMessageType={}));var T;!function(e){function t(e){switch(e){case b.Info:return 0;case b.Success:return 1;case b.Warning:return 2;case b.Error:return 3;default:throw new Error("Don't know how to convert "+e)}}function n(e,n,r,i,o,a){return void 0===r&&(r=!0),void 0===o&&(o=!0),c.showFeedbackMessage(e,t(n),r,i,o,a)}function r(){return c.closeFeedbackMessage()}e.showFeedbackMessage=n,e.closeFeedbackMessage=r}(T=t.FeedbackMessage||(t.FeedbackMessage={}));var E=function(){function e(e){this._model=e}return e.prototype.setWidgetAsInvalid=function(e,t){var n=this._model.widgets.get(e);n.validAttr=!1,n.validationMessageAttr=t},e.prototype.setWidgetAsValid=function(e){var t=this._model.widgets.get(e);t.validAttr=!0,t.validationMessageAttr=""},e.prototype.isWidgetValid=function(e){var t=this._model.widgets.get(e);return t.validAttr===!0},e}();t.Validation=E;var w;!function(e){function t(){return n.whenDeviceReady}e.whenReady=t}(w=t.Device||(t.Device={}));var D;!function(e){function t(){return i["default"].isUpgradingVersion}function n(e){u.trace("ApplicationLifecycle","Registering listeners for the application load process."),e&&(e.onLoadComplete&&o["default"].waitForAppReady().then(function(){return e.onLoadComplete()}),e.onUpgradeProgress&&s.ResourceCache.listen(null,null,function(t,n){return e.onUpgradeProgress(t,n)}))}e.isUpgradingVersion=t,e.listen=n}(D=t.ApplicationLifecycle||(t.ApplicationLifecycle={}));var S=function(){function e(e){this._context=e}return e.prototype.navigateTo=function(e,t,n){f.navigateTo(e,this.getTransitionObject(t,d.Default),this._context,!1,n)},e.prototype.navigateBack=function(e){f.navigateBack(this.getTransitionObject(e),this._context,!1)},e.prototype.navigateForward=function(e){f.navigateForward(this.getTransitionObject(e),this._context,!1)},e.prototype.navigatedFromHistory=function(){return y().navigatedFromHistory},e.prototype.registerBackNavigationHandler=function(e){return f.registerBackNavigationHandler(e)},e.prototype.unregisterBackNavigationHandler=function(e){f.unregisterBackNavigationHandler(e)},e.prototype.getTransitionObject=function(e,t){return void 0===t&&(t=null),d.createTransition(e,t)},e}();t.Navigation=S;var I;!function(e){function t(e,t){u.log(e,t)}function n(e,t,n){u.error(e,t,n)}e.log=t,e.error=n}(I=t.Logger||(t.Logger={}));var _=function(){function e(e){this._model=e}return Object.defineProperty(e,"ActiveScreenCssClass",{get:function(){return"active-screen"},enumerable:!0,configurable:!0}),e.prototype.getCurrentScreenRootElement=function(){return document.querySelector("."+e.ActiveScreenCssClass)},e.prototype.render=function(){return new Promise(function(e){requestAnimationFrame(function(){setTimeout(e,1)})})},e.prototype.wasCurrentViewRestoredFromCache=function(){return this._model?this._model.context.viewWasRestoredFromCache:!1},e.prototype.registerDeviceClassGetter=function(e){h.register(g.ServiceNames.DeviceHelperClassProvider,e)},e}();t.View=_;var x=function(){function e(){}return e.getCurrentScreenDefinition=function(){var e=l.BaseViewController.activeScreen;if(e){var t=a.getModuleFromKey(a.getHomeModuleKey());if(t)return a.getScreenDefinitionFromScreenName(t,e.viewName)}return null},e.getCurrentContext=function(){var t=e.getCurrentScreenDefinition();return{applicationKey:a.getApplicationKey()||"",applicationName:a.getApplicationName()||"",moduleKey:a.getHomeModuleKey()||"",moduleName:a.getHomeModuleName()||"",screenKey:t?t.screenKey:"",screenName:t?t.screenName:""}},e}();t.ApplicationContext=x;var A=function(){function e(){}return Object.defineProperty(e,"Instance",{get:function(){return e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"isUpgradingVersion",{get:function(){return m("ApplicationLoad.isUpgradingVersion","ApplicationLifecycle.isUpgradingVersion()"),D.isUpgradingVersion()},enumerable:!0,configurable:!0}),e.listen=function(e){m("ApplicationLoad.listen()","ApplicationLifecycle.listen()"),D.listen(e)},e}();t.ApplicationLoad=A}),define("OutSystems/ClientRuntime/PublicApiHelper",["require","exports","./Public","./BuiltinFunctions"],function(e,t,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){this._model=e,this._navigationContext=t}return Object.defineProperty(e.prototype,"BuiltinFunctions",{get:function(){return r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Validation",{get:function(){return this._validation||(this._validation=new n.Validation(this._model)),this._validation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"FeedbackMessage",{get:function(){return n.FeedbackMessage},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Device",{get:function(){return n.Device},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Security",{get:function(){return n.Security},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ApplicationLifecycle",{get:function(){return n.ApplicationLifecycle},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ApplicationContext",{get:function(){return n.ApplicationContext},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ApplicationLoad",{get:function(){return n.ApplicationLoad},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Navigation",{get:function(){return this._navigation||(this._navigation=new n.Navigation(this._navigationContext)),this._navigation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Logger",{get:function(){return n.Logger},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"View",{get:function(){return this._view||(this._view=new n.View(this._model)),this._view},enumerable:!0,configurable:!0}),e}();t.PublicApiHelper=i}),define("OutSystems/ClientRuntime/Controller",["require","exports","tslib","./Validation","./Logger","./Communication","./Exceptions","./Flow","./ApplicationInfo","./DataTypes","./Navigation","./WidgetNaming","./VersionsManager","./ErrorHandling","./NativeHelper","./PublicApiHelper","./RolesInfo","./DataConversion","./Injector","./Injector/KnownServices"],function(e,t,n,r,i,o,a,s,u,c,l,f,d,p,h,g,m,y,v,b){"use strict";function T(e,t){var n=new Map;return e.forEach(function(e,r){var i=t(e);n.set(r,i)}),n}Object.defineProperty(t,"__esModule",{value:!0});var E=function(){},w="*",D=function(){function e(e,t){this.controllerClass=e,this.messagesProvider=t}return e.prototype.create=function(e,t){return new this.controllerClass(e,this.messagesProvider,t)},e.executeWithNavigationCallbacks=function(e,t,n){l.setNavigationCallbacks(t);var r=function(){t.dispose(n),l.removeNavigationCallbacks()};return s.tryFinally(e,r)},e.prototype.initialize=function(t,r,i,o,s){return n.__awaiter(this,void 0,void 0,function(){var u,c,l,d,h,y,v,b;return n.__generator(this,function(n){switch(n.label){case 0:u=O.activeScreen,c=u?u.callContext():i.callContext(),n.label=1;case 1:return n.trys.push([1,4,,5]),0===m.getUserId()||m.areRolesDefined()?[3,3]:[4,new Promise(function(e){new g.PublicApiHelper(null,null).ApplicationLifecycle.listen({onLoadComplete:e})})];case 2:n.sent(),n.label=3;case 3:return this.controllerClass.checkPermissions(),[3,5];case 4:return l=n.sent(),d={permissionsOk:!1},[2,e.executeWithNavigationCallbacks(function(){return i.handleError(l,c)},o,c).then(function(){return d},function(e){return d})];case 5:return h=r.create(t),y=this.create(h,new f.WidgetIdService(null)),y.setAsActiveScreen(),v=e.executeWithNavigationCallbacks(function(){return y.fireInitialize()},s,y.callContext()),b={permissionsOk:!0,controller:y,model:h},[2,v.then(function(){return b},function(e){return a.isInstanceOf(e,a.Exceptions.UnhandledOrIgnoredErrorInEventException)&&e.handleErrorResult===p.UNHANDLED_ERROR_RESULT?{permissionsOk:!0}:b})]}})})},Object.defineProperty(e.prototype,"activeScreenController",{get:function(){return O.activeScreen},enumerable:!0,configurable:!0}),e}();t.ControllerFactory=D;var S=function(){function e(){this._iterationContext=new I,this._id=++e.currentId}return Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewName",{get:function(){return this._viewName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"timeout",{get:function(){return this._timeout},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iterationContext",{get:function(){return this._iterationContext},set:function(e){this._iterationContext=e},enumerable:!0,configurable:!0}),e.prototype.withViewName=function(e){return this._viewName!==e?this.innerClone({_viewName:{value:e}}):this},e.prototype.withTimeout=function(e){return this._timeout!==e?this.innerClone({_timeout:{value:e}}):this},e.prototype.clone=function(){var t=this.innerClone();return t._id=++e.currentId,t},e.prototype.innerClone=function(e){var t=Object.create(this,e);return t.iterationContext=this.iterationContext.clone(),t},Object.defineProperty(e.prototype,"isOutOfContext",{get:function(){return!!O.activeScreen&&this.viewName!==O.activeScreen.viewName},enumerable:!0,configurable:!0}),e.currentId=0,e}();t.CallContext=S;var I=function(){function e(){}return e.prototype.getCurrentRowNumber=function(e){var t=this.getIterator(e);return t?t.currentRowNumber:0},e.prototype.setCurrentRowNumber=function(e,t){var n=this.getIteratorForSet(e);n.currentRowNumber=t},e.prototype.isBeingIterated=function(e){var t=this.getIterator(e);return t?t.isBeingIterated:!1},e.prototype.registerIterationStart=function(e){var t=this.getIteratorForSet(e);if(t.isBeingIterated)throw new Error("List is already being iterated in this context");t.currentRowNumber=e.length-1,t.isBeingIterated=!0},e.prototype.registerIterationEnd=function(e){var t=this.getIteratorForSet(e);if(!t.isBeingIterated)throw new Error("List was redefined while being iterated");t.isBeingIterated=!1},e.prototype.getIterator=function(e){return this.iterators?this.iterators.get(e.modelId):null},e.prototype.getIteratorForSet=function(e){this.iterators||(this.iterators=new Map);var t=this.getIterator(e);return t||(t={currentRowNumber:0,isBeingIterated:!1},this.iterators.set(e.modelId,t)),t},e.prototype.clone=function(){var t=new e;return this.iterators&&(t.iterators=T(this.iterators,function(e){return Object.create(e)})),t},e}();t.IterationContext=I;var _=new c.RecordTypeFactory,x=new c.ComplexTypeKeyedTypeFactory("Data","dataOut"),A=new c.ComplexTypeKeyedTypeFactory("List","listOut",[{name:"Count",attrName:"countOut",mandatory:!0,dataType:c.DataTypes.LongInteger,defaultValue:function(){return c.LongInteger.defaultValue}}]),N=function(){function e(){this.isExecutingJSNode=!1}return Object.defineProperty(e.prototype,"publicApiHelper",{get:function(){return this._publicApiHelper||(this._publicApiHelper=this.createPublicApiHelper()),this._publicApiHelper},enumerable:!0,configurable:!0}),e.prototype.getDefaultTimeout=function(){throw new Error("Controllers must implement getDefaultTimeout")},e.prototype.createPublicApiHelper=function(){return new g.PublicApiHelper(null,this.callContext())},Object.defineProperty(e.prototype,"default",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"controller",{get:function(){return this},enumerable:!0,configurable:!0}),e.prototype.callContext=function(e){return void 0===e&&(e=new S),e},e.prototype.safeExecuteJSNode=function(e,t,n,r,i,o,s,u){void 0===u&&(u=!1);var c=function(e){var r="Check the JavaScript node '"+t+"' of the action '"+n+"'.";throw e=e||new Error(r),(e instanceof a.Exceptions.NumberOverflowException||e instanceof a.Exceptions.InvalidJavascriptType)&&(e.message=e.message+" "+r),e},l=this.isExecutingJSNode,f=(r?[r]:[]).concat(o,s,this.publicApiHelper);e=e.bind.apply(e,[null].concat(f));try{if(this.isExecutingJSNode=!0,u)return e().then(function(){return i(r)})["catch"](c);try{return e(),i(r)}catch(d){c(d)}}finally{this.isExecutingJSNode=l}},e.prototype.safeExecuteAsyncJSNode=function(e,t,n,r,i,o,a){return this.safeExecuteJSNode(e,t,n,r,i,o,a,!0)},e.prototype.executeActionInsideJSNode=function(e,t,n,r){void 0===n&&(n=E),void 0===r&&(r=E);var i=function(e){if(!p.ignoreError(e,t))throw e};try{var o=e(t);return o instanceof Promise?o.then(function(e){return r(),n(e)})["catch"](function(e){r(),i(e)}):n(o)}catch(a){i(a)}finally{this.isExecutingJSNode||r()}},e.prototype.getInitialPayloadObject=function(e,t){return{versionInfo:{moduleVersion:d["default"].getLastApplicationVersionToken(!0),apiVersion:t},viewName:e.viewName?e.viewName:w}},e.prototype.getEffectiveTimeoutForServerCall=function(e){var t=u.getApplicationDefaultTimeout();return t||e||this.getDefaultTimeout()},e.prototype.callServerAction=function(t,n,r,a,s,c,l){var f=this.getEffectiveTimeoutForServerCall(s.timeout),d=this.getInitialPayloadObject(s,r);d.inputParameters=a;var p="The timeout of "+f+"s was reached while executing this server action.",h=function(){i.trace(t,p)};return o.post(n,d,u.getHomeModuleName(),f,h,e.createPostResponseHandler(l),void 0,void 0,c).then(function(e){return e||{}})["catch"](function(e){throw e.extraStack=t,e})},e.checkPermissions=function(){throw new Error("Screen Controllers must implement checkPermissions")},e.handlePostResponse=function(e){e.rolesInfo&&m.storeRoleInformation(e.rolesInfo);var t=v["default"].resolve(b.ServiceNames.ClientVariablesService);t&&t.checkSessionExpires()},e.createPostResponseHandler=function(t){return function(n,r){e.handlePostResponse(n),t&&t(n,r)}},e.prototype.executeClientAggregate=function(e,t){return s.executeSequence(function(){return e()}).then(function(e){var n=t();n.listOut=e.list,n.countOut=e.count})},e.prototype.ensureControllerAlive=function(e){},e.getJSONDeserializeOutputType=function(e){return x.getType(e)},e.getAggregateOutputType=function(e){return A.getType(e)},e.registerVariableGroupType=function(e,t){_.registerTypeDefinition(e,t)},e.getVariableGroupType=function(e){return _.getType(e)},e}();t.BaseController=N;var C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.fireApplicationResumeSingletonCallback=t.fireApplicationResume.bind(t),t}return n.__extends(t,e),t.prototype.registerEventHandler=function(e,t,n){var r=this;n(function(){return new Promise(function(t,n){requirejs([e],t,n)}).then(function(){var e=r[t],i=function(){return Promise.resolve().then(function(){return e.call(r)})};return n(i),i()})})},t.prototype.registerOnApplicationReadyHandler=function(e,t){var n=this;this.registerEventHandler(e,t,function(e){return n.onApplicationReadyHandler=e})},t.prototype.registerOnApplicationResumeHandler=function(e,t){var n=this;this.registerEventHandler(e,t,function(e){return n.onApplicationResumeHandler=e})},t.prototype.fireApplicationReady=function(){var e=this;return this.onApplicationReadyHandler?this.onApplicationReadyHandler().then(function(){return e.setupOnApplicationResumeListener()}):(this.setupOnApplicationResumeListener(),Promise.resolve(void 0))},t.prototype.setupOnApplicationResumeListener=function(){this.onApplicationResumeHandler&&h.addNativeEventListener("resume",this.fireApplicationResumeSingletonCallback)},t.prototype.fireApplicationResume=function(){return this.onApplicationResumeHandler?this.onApplicationResumeHandler():Promise.resolve(void 0)},t}(N);t.BaseModuleController=C;var O=function(e){function t(n,i,o){var a=e.call(this)||this;return a.model=n,a.messagesProvider=i,a._idService=o,a.instanceId=t.globalInstanceId++,a.isDisposed=!1,a.useImprovedDataFetch=!1,a.hasDependenciesBetweenSources=!1,a.shouldSendClientVarsToDataSources=!1,a.fetchReadySources=function(e){var t=[],n=void 0===e?a.dataFetchActionNames:a.dataFetchDependentsGraph[e];n.forEach(function(n){e&&a.dataFetchDependencies[n]--,0===a.dataFetchDependencies[n]&&t.push(n)}),t.forEach(function(e){a.remainingFetchesCount++,a.dataFetchDependencies[e]=-1,a.executeDataFetchAction(e).then(function(){return a.fetchReadySources(e)})})},a.clientVariablesHandler=function(e,t,n){a.model.clientVariablesGeneration++,a.model.flush()},a.validationServiceInstance=new r.ValidationService(n,i),a}return n.__extends(t,e),t.prototype.fireEvent=function(e){var t=this;return s.executeSequence(function(){return e?e.call(t,t.callContext()):void 0}).then(function(e){if(p.isSpecialHandleErrorResult(e))throw a.Exceptions.UnhandledOrIgnoredErrorInEventException.create(e)})},t.prototype.fireEventAndForget=function(e){this.fireEvent(e)["catch"](a.Exceptions.UnhandledOrIgnoredErrorInEventException.ignore)},t.prototype.createPublicApiHelper=function(){return new g.PublicApiHelper(this.model,this.callContext())},Object.defineProperty(t,"activeScreen",{get:function(){return t.activeScreenInstance},enumerable:!0,configurable:!0}),t.prototype.setAsActiveScreen=function(){t.activeScreenInstance=this},t.prototype.callContext=function(t){return e.prototype.callContext.call(this,t).withViewName(this.viewName)},Object.defineProperty(t.prototype,"validationService",{get:function(){return this.validationServiceInstance},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewName",{get:function(){return this.modelContext?this.modelContext.viewName:void 0},enumerable:!0,configurable:!0}),t.prototype.fetchData=function(){var e=!1;this.useImprovedDataFetch?(i.trace(this,"Using Improved data fetching with dependencies"),e=this.innerFetchDataWithDependencies()):(i.trace(this,"Using traditional fetch data"),e=this.innerFetchData()),e&&this.model.flush()},t.prototype.executeDataFetchAction=function(e){var t=this;return i.trace(this,"Fetching "+e),s.executeSequence(function(){return t[e]()}).then(function(){t.remainingFetchesCount--,clearTimeout(t.flushTimeoutHandle),i.trace(t,"Fetched "+e),t.remainingFetchesCount>0?t.flushTimeoutHandle=setTimeout(function(){return t.model.flush()},50):t.model.flush()},function(e){t.remainingFetchesCount--,t.model.flush(),t.handleError(e)})},t.prototype.innerFetchData=function(){var e=this;if(!this.dataFetchActionNames||0===this.dataFetchActionNames.length)return!1;var t=0,n=this.dataFetchActionNames.length;return this.dataFetchActionNames.forEach(function(r){i.trace(e,"Fetching "+r),s.executeSequence(function(){return e[r]()}).then(function(){n--,clearTimeout(t),i.trace(e,"Fetched "+r),n>0?t=setTimeout(function(){return e.model.flush()},50):e.model.flush()},function(t){n--,e.model.flush(),e.handleError(t)})}),!0},t.prototype.innerFetchDataWithDependencies=function(){return this.dataFetchActionNames&&0!==this.dataFetchActionNames.length?(this.dataFetchDependencies=n.__assign({},this.dataFetchDependenciesOriginal),this.flushTimeoutHandle=0,this.remainingFetchesCount=0,this.fetchReadySources(),!0):!1},Object.defineProperty(t.prototype,"idService",{get:function(){return this._idService},enumerable:!0,configurable:!0}),t.prototype.fireInitialize=function(){var e=this,t=v["default"].resolve(b.ServiceNames.ClientVariablesService);return t&&t.subscribe(this.clientVariablesHandler),this.fireEvent(this.onInitializeEventHandler).then(function(){return e.fetchData()})},t.prototype.fireAfterViewReady=function(){var e=this;this.fireEvent(this.onReadyEventHandler).then(function(){return e.fireEvent(e.onRenderEventHandler)})["catch"](a.Exceptions.UnhandledOrIgnoredErrorInEventException.ignore)},t.prototype.fireAfterInputsChanged=function(){this.fireEventAndForget(this.onParametersChangedEventHandler)},t.prototype.fireAfterViewRender=function(e){var t=this;void 0===e&&(e=!1),this.onRenderEventHandler&&this.fireEventAndForget(function(n){return e?void i.error("View","Render loop avoided. "+("This is likely due to the model of the screen/block '"+t.viewName+"' being changed inside its 'On Render' client action. ")+"Avoid changes to the model inside 'On Render' client actions."):t.onRenderEventHandler(n)})},t.prototype.fireAfterViewDestroy=function(){var e=v["default"].resolve(b.ServiceNames.ClientVariablesService);e&&e.unsubscribe(this.clientVariablesHandler),this.fireEventAndForget(this.onDestroyEventHandler)},t.prototype.registerClientAction=function(e,t){this[e]=t},t.prototype.innerCallAggregate=function(e,t,n,r,o,a,s,u,c,l,f,d){var p=this.getEffectiveTimeoutForServerCall(u);return i.trace(this,"Calling "+e+" aggregate with start index endpoint"),this.callServerDataSource(e,t,n,a,s,function(e){e.inputParameters={StartIndex:o,MaxRecords:r}},p,c,l,f,d)},t.prototype.callAggregateWithStartIndexAndClientVars=function(e,t,n,r,i,o,a,s,u,c,l,f){return this.innerCallAggregate(e,t,n,r,i,o,a,s,u,c,l,f)},t.prototype.callAggregateWithStartIndex=function(e,t,n,r,i,o,a,s,u,c,l){return this.innerCallAggregate(e,t,n,r,i,o,a,s,u,c,l)},t.prototype.callAggregate=function(e,t,n,r,i,o,a,s,u,c){return this.innerCallAggregate(e,t,n,r,0,i,o,a,s,u,c)},t.prototype.callDataAction=function(e,t,n,r,i,o,a,s,u,c){var l=this.getEffectiveTimeoutForServerCall(o);return this.callServerDataSource(e,t,n,r,i,void 0,l,a,s,u,c)},t.prototype.callServerDataSource=function(e,n,r,c,l,f,d,p,h,g,m){var v=this;void 0===f&&(f=void 0),void 0===d&&(d=0);var b=this.getInitialPayloadObject(this.callContext(),r);this.hasDependenciesBetweenSources?(i.trace(this,"Calling "+e+" data source with optimized on payload"),b.screenData={variables:y.ServerDataConverter.to(this.model.variables,g,!0)}):(i.trace(this,"Calling "+e+" data source with full list on payload"),b.screenData={variables:y.ServerDataConverter.to(this.model.variables)}),f&&f(b),this.shouldSendClientVarsToDataSources&&m&&(b.clientVariables=m.serialize()),c(0);var T=function(){i.trace(e,"The timeout of "+d+"s was reached while fetching this screen data.")};return s.promise(function(e,r){o.post(n,b,u.getHomeModuleName(),d,T,t.createPostResponseHandler(h),!0,v.instanceId,p).then(function(t){return v.isDisposed?void 0:(l(t),c(1),e())})["catch"](function(e){return v.isDisposed?void 0:(a.isInstanceOf(e,a.Exceptions.ViewHasChangedException)||c(2),r(e))})})},t.prototype.handleError=function(e){throw new Error("@abstract")},t.prototype.safeExecuteAsyncJSNode=function(t,n,r,i,o,a,s){return this.model.flush(),e.prototype.safeExecuteAsyncJSNode.call(this,t,n,r,i,o,a,s)},t.prototype.executeActionInsideJSNode=function(t,n,r,i){var o=this;return void 0===r&&(r=E),void 0===i&&(i=E),e.prototype.executeActionInsideJSNode.call(this,t,n,r,function(){i(),o.model.flush()})},t.prototype.dispose=function(){this.validationService.dispose(),this.isDisposed=!0},t.prototype.ensureControllerAlive=function(e){if(this.isDisposed){var t=new a.Exceptions.ControllerDisposedException("Invalid call of the '"+e+"' client action of the '"+this.viewName+"' since the latter is not currently active. This is likely due to a platform's client action being used as an event handler or in a setTimeout function. Consider removing this call by using the 'On Destroy' event of the screen/block or moving your logic to a global client action.");throw i.error("Controller",t),t}},t.prototype.safeExecuteClientAction=function(e,t){for(var n=this,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return s.tryCatchFinally(function(){return e.apply(n,r.concat(n.callContext(t)))},function(e){return n.handleError(e)},function(){return n.model.flush()})},Object.defineProperty(t.prototype,"modelContext",{get:function(){return this.model.context},enumerable:!0,configurable:!0}),t.prototype.executeScreenClientAggregate=function(e,t,n){var r=this;return s.executeSequence(function(){return t().dataFetchStatusAttr=0,e()}).then(function(e){return r.isDisposed?void 0:(t().bulkSet(e.list,1,e.count),s.executeSequence(n))},function(e){if(!r.isDisposed)throw t().dataFetchStatusAttr=2,e})},t.downloadBinary=function(e,t){var n=e.toBlob()||new Blob([]),r=document.createElement("a");r.style.display="none",document.body.appendChild(r),n.type&&(r.type=n.type);var i=window.URL.createObjectURL(n);r.href=i,r.download=t,r.click(),setTimeout(function(){return window.URL.revokeObjectURL(i)},500),r.remove()},t.globalInstanceId=0,t}(N);t.BaseViewController=O}),define("OutSystems/ClientRuntime/ErrorScreen",["require","exports","./Logger","./Navigation","./ErrorHandling","./Exceptions"],function(e,t,n,r,i,o){"use strict";function a(e,t){return Promise.resolve().then(function(){return t.initialize(e,1).then(function(){s(e.errorPageConfig);var r="";try{var o=i.ErrorHandlingStorage.errorPageExceptionInfo.get();o&&(r=" "+o.message)}catch(a){}return n.error("ErrorScreen","[ErrorScreen]"+r),n.hadSessionLogs()?void 0:t.initializeDatabase().then(function(){n.flushLogsToServer()})})["catch"](function(e){console.error(e)})})}function s(e){var t=i.ErrorHandlingStorage.errorPageMessage.get(),n=i.ErrorHandlingStorage.errorPageExtraMessage.get(),r=i.ErrorHandlingStorage.errorPageExceptionInfo.get();if(r){var a=r.message,s=o.getStack(r);if(s&&(a+="\n"+s),console.error(a),"undefined"!=typeof document&&document.querySelector&&(document.querySelector(b).innerHTML=r.message,document.querySelector(T).innerHTML=s,document.querySelector(v).addEventListener("click",function(){return c()}),e&&e.showExceptionStack)){var m=document.querySelector(y);m.style.display="block"}}if("undefined"!=typeof document&&document.querySelector){var E=e&&e.messages&&e.messages.defaultMessage,w=e&&e.extraMessage;document.querySelector(p).innerHTML=t||E||l,document.querySelector(h).innerHTML=n||w||f,document.querySelector(g).innerHTML=e&&e.reloadLabel||d,document.querySelector(g).addEventListener("click",function(){return u()})}}function u(){if("undefined"!=typeof document&&document.querySelector){var e=document.querySelector(g);e.style.display="none";var t=document.querySelector(m);t.style.display="inline-block"}setTimeout(function(){r.reloadApplication()},2e3)}function c(){if("undefined"!=typeof document&&document.querySelector){var e=document.querySelector(v),t=document.querySelector(E);t.hidden?(e.innerHTML="Hide Detail",t.hidden=!1):(e.innerHTML="Show Detail",t.hidden=!0)}}Object.defineProperty(t,"__esModule",{value:!0});var l="There was an error processing your request.",f="",d="RELOAD",p="#error-screen-message-text",h="#error-screen-message-text-extra",g="#error-screen-message-reload-button",m="#error-screen-spinner",y="#exception-detail",v="#error-screen-show-detail-button",b="#error-screen-exception-message",T="#error-screen-exception-stack",E="#exception-detail-text";t.initializeErrorPage=a}),define("OutSystems/ClientRuntime/Interfaces",["require","exports"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){var t;!function(e){e[e.Full=0]="Full",e[e.Minimal=1]="Minimal"}(t=e.InitializationType||(e.InitializationType={}))}(n=t.Application||(t.Application={}));var r;!function(e){var t;!function(e){e[e.No=0]="No",e[e.Yes=1]="Yes",e[e.YesIfEmpty=2]="YesIfEmpty"}(t=e.AutoNumber||(e.AutoNumber={}));var n;!function(e){e[e.TEXT=0]="TEXT",e[e.BINARY_DATA=1]="BINARY_DATA",e[e.BOOLEAN=2]="BOOLEAN",e[e.INTEGER=3]="INTEGER",e[e.LONGINTEGER=4]="LONGINTEGER",e[e.DECIMAL=5]="DECIMAL",e[e.DATE_TIME=6]="DATE_TIME",e[e.DATE=7]="DATE",e[e.TIME=8]="TIME",e[e.UNKNOWN=9]="UNKNOWN"}(n=e.DBDataType||(e.DBDataType={}))}(r=t.ClientDB||(t.ClientDB={}));var i;!function(e){var t;!function(e){e[e.Fetching=0]="Fetching",e[e.Fetched=1]="Fetched",e[e.Error=2]="Error"}(t=e.DataFetchStatus||(e.DataFetchStatus={}))}(i=t.Model||(t.Model={}));var o;!function(e){var t;!function(e){e[e.Info=0]="Info",e[e.Success=1]="Success",e[e.Warning=2]="Warning",e[e.Error=3]="Error"}(t=e.FeedbackMessageType||(e.FeedbackMessageType={}))}(o=t.FeedbackMessage||(t.FeedbackMessage={}));var a;!function(e){var t;!function(e){e[e.Created=0]="Created",e[e.Sent=1]="Sent",e[e.Receiving=2]="Receiving",e[e.Aborting=3]="Aborting",e[e.Finished=4]="Finished"}(t=e.NativeHttpRequestReadyState||(e.NativeHttpRequestReadyState={}))}(a=t.NativeHttp||(t.NativeHttp={}))}),define("OutSystems/ClientRuntime/LanguageResources",["require","exports","./DataTypes"],function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.messages={}}return e.prototype.getMandatoryValueMessage=function(){return this.getMessage("Validation.Mandatory","Required Value!")},e.prototype.getInvalidValueMessage=function(e){return this.getMessage("Validation."+n.DataTypes[e],"Invalid Value!")},e.prototype.getApplicationUpgradeCompleteMessage=function(){return this.getMessage("UpgradeComplete","")},e.prototype.getApplicationUpgradeRequiredMessage=function(e){return e?this.getMessage("UpgradeRequiredDataLoss",""):this.getMessage("UpgradeRequired","")},e.prototype.getApplicationUpgradeFailedOnResourcesMessage=function(){return this.getMessage("AppInitError.Resources","")},e.prototype.getApplicationUpgradeFailedOnDataModelMessage=function(){return this.getMessage("AppInitError.DataModel","")},e.prototype.getApplicationUpgradeFailedUnknownMessage=function(){return this.getMessage("AppInitError.Generic","")},e.prototype.getMessage=function(e,t){var n=this.messages[e];return n?n:t},e.prototype.setMessage=function(e,t){this.messages[e]=t},e}();t.BaseMessagesProvider=r}),define("OutSystems/ClientRuntime/Model",["require","exports","tslib","./DataTypes","./DataConversion","./Logger","./WidgetNaming"],function(e,t,n,r,i,o,a){"use strict";function s(e){return{idAttr:e.get(c),nameAttr:e.get(l),validAttr:e.get(f),validationMessageAttr:e.get(d)}}function u(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=1,r=0,i=e;r<i.length;r++){var o=i[r];switch(o){case 2:return 2;case 0:n=0}}return n}Object.defineProperty(t,"__esModule",{value:!0});var c="idAttr",l="nameAttr",f="validAttr",d="validationMessageAttr",p=function(){function e(e,t,n,r){this.type=e,this._value=t,this.setter=n,this.model=r}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){var t=i.JSConversions.convertTo(e,this.type);this.setter(t),this.model.flush()},enumerable:!0,configurable:!0}),e.prototype.isAcceptable=function(e){return i.JSConversions.isConvertibleTo(e,this.type)},e.prototype.fastEquals=function(e){return e&&this.constructor===e.constructor&&this.value===e.value},e.prototype.equals=function(e){ return e&&this.constructor===e.constructor&&r.equals(this.value,e.value)},e}();t.Variable=p;var h=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),Object.defineProperty(t.prototype,"idAttr",{get:function(){return this.getBasicProperty(c)},set:function(e){this.setBasicProperty(c,e,r.DataTypes.Text)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nameAttr",{get:function(){return this.getBasicProperty(l)},set:function(e){this.setBasicProperty(l,e,r.DataTypes.Text)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"generationNode",{get:function(){return this.getBasicProperty(t.WidgetGenerationNodeAttributeName)},set:function(e){this.setBasicProperty(t.WidgetGenerationNodeAttributeName,e,r.DataTypes.Object)},enumerable:!0,configurable:!0}),t.prototype.asReadOnly=function(){return{idAttr:this.idAttr,nameAttr:this.nameAttr}},t.prototype.refreshGeneration=function(){this.generationNode&&(this.generationNode.generation=S.currentGeneration)},t.WidgetGenerationNodeAttributeName="widgetGenerationNode",t.RecordClass=r.Record.defineRecordClass({idAttr:"",nameAttr:"",widgetGenerationNode:null}),t}(r.Record);t.WidgetRecord=h;var g=function(e){function t(t){return e.call(this,t)||this}return n.__extends(t,e),Object.defineProperty(t.prototype,"validAttr",{get:function(){return this.getBasicProperty(f)},set:function(e){this.setBasicProperty(f,e,r.DataTypes.Boolean)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validationMessageAttr",{get:function(){return this.getBasicProperty(d)},set:function(e){this.setBasicProperty(d,e,r.DataTypes.Text)},enumerable:!0,configurable:!0}),t.prototype.onPropertyValueChanged=function(e){(e===f||e===d)&&this.refreshGeneration()},t.prototype.asReadOnly=function(){return s(this.data)},t.RecordClass=function(){var e=(new h.RecordClass).toJS();return e.validAttr=!0,e.validationMessageAttr="",r.Record.defineRecordClass(e)}(),t}(h);t.ValidationWidgetRecord=g;var m=function(e){function t(n){var r=e.call(this,n)||this;return r.widgetsIdToRecord=r.data.get(t.WidgetRecordsAttribute),r.widgetsIdToRecordDataCache=r.data.get(t.WidgetRecordsDataCacheAttribute),r}return n.__extends(t,e),t.createDefaultData=function(){return new t.RecordClass({records:new Map,recordsCache:new Map})},t.getWidgetsType=function(){return{}},t.prototype.getWidgetsType=function(){return this.constructor.getWidgetsType()},t.prototype.getWidgetRecordType=function(e){return this.getWidgetsType()[e]||h},t.prototype.get=function(e){var t=this.widgetsIdToRecord.get(e);return t?t:(t=this.create(e),this.add(t),t)},t.prototype.set=function(e,t){this.widgetsIdToRecord.set(e,t),this.widgetsIdToRecordDataCache["delete"](e),this.writePropagate(this.data,null)},t.prototype.internalSet=function(e,t){this.widgetsIdToRecord["delete"](e),this.widgetsIdToRecordDataCache.set(e,t),this.writePropagate(this.data,null)},t.prototype.create=function(e){var t=a.WidgetIdService.nameFromId(e),n=this.getWidgetRecordType(t),r=this.widgetsIdToRecordDataCache.get(e),i=new n(r);return i.idAttr=e,i.nameAttr=t,i},t.prototype.add=function(e){t.setPropagationHandler(e,this,e.idAttr,this.internalSet),this.widgetsIdToRecordDataCache["delete"](e.idAttr),this.widgetsIdToRecord.set(e.idAttr,e)},t.prototype.remove=function(e){this.widgetsIdToRecord["delete"](e),this.widgetsIdToRecordDataCache["delete"](e),this.writePropagate(this.data,null)},t.WidgetRecordsAttribute="records",t.WidgetRecordsDataCacheAttribute="recordsCache",t.RecordClass=r.Record.defineRecordClass({records:null,recordsCache:null}),t}(r.Record);t.BaseWidgetRecordMap=m;var y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),Object.defineProperty(t.prototype,"dataFetchStatusAttr",{get:function(){return this.getBasicProperty(t.DataFetchStatusAttributeName)},set:function(e){this.setBasicProperty(t.DataFetchStatusAttributeName,e,r.DataTypes.Integer)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDataFetchedAttr",{get:function(){return 1===this.dataFetchStatusAttr},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasFetchErrorAttr",{get:function(){return 2===this.dataFetchStatusAttr},enumerable:!0,configurable:!0}),t.attributesToDeclare=function(){return[r.GenericRecord.attr("DataFetchStatus",t.DataFetchStatusAttributeName,"",!0,!1,r.DataTypes.Integer,function(){return 0})].concat(e.attributesToDeclare.call(this))},t.prototype.replaceWith=function(e){var t=new this.constructor(r.Record.getData(e));t.dataFetchStatusAttr=this.dataFetchStatusAttr,this.writePropagate(r.Record.getData(t),new r.Cache)},t.DataFetchStatusAttributeName="dataFetchStatusAttr",t}(r.GenericRecord);t.DataSourceRecord=y;var v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),Object.defineProperty(t.prototype,"listOut",{get:function(){return this.getComplexProperty(t.ListOutAttributeName,this.getRecordListType())},set:function(e){this.setComplexProperty(t.ListOutAttributeName,e,r.DataTypes.RecordList,this.getRecordListType())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"countOut",{get:function(){return this.getBasicProperty(t.CountOutAttributeName)},set:function(e){this.setBasicProperty(t.CountOutAttributeName,e,r.DataTypes.LongInteger)},enumerable:!0,configurable:!0}),t.prototype.bulkSet=function(e,n,r){var i=[{name:t.ListOutAttributeName,value:e,isBasicType:!1},{name:y.DataFetchStatusAttributeName,value:n,isBasicType:!0}];void 0!==r&&i.push({name:t.CountOutAttributeName,value:r,isBasicType:!0}),this.setProperties(i)},t.prototype.getRecordListType=function(){return this.constructor.RecordListType},t.attributesToDeclare=function(){return[r.GenericRecord.attr("List",t.ListOutAttributeName,"List",!0,!1,r.DataTypes.RecordList,function(){return!1},!0,this.RecordListType),r.GenericRecord.attr("Count",t.CountOutAttributeName,"Count",!0,!1,r.DataTypes.LongInteger,function(){return r.LongInteger.defaultValue})].concat(e.attributesToDeclare.call(this))},t.init=function(){if(!this.RecordListType)throw new TypeError("AggregateRecords must define a RecordListType");e.init.call(this)},t.ListOutAttributeName="listOut",t.CountOutAttributeName="countOut",t}(y);t.AggregateRecord=v;var b=function(e){function t(t){var n=e.call(this)||this;return n._context=t,n.writeSubscriptions=[],n.cachedValues={},n.modified=!1,n.hasVariables&&n.variables,n.hasValidationWidgets&&n.widgets,n}return n.__extends(t,e),t.createDefaultData=function(){var e=this.newVariablesRecord(),n=this.newWidgetsRecord();return new t.RecordClass({variables:r.Record.getData(e),widgets:r.Record.getData(n),clientVariablesGeneration:0})},t.prototype.onDefaultWritePropagate=function(t){e.prototype.onDefaultWritePropagate.call(this,t),this.modified=!0,this.innerFlush(!0)},t.prototype.cloneCache=function(){return this.cache},Object.defineProperty(t.prototype,"isModified",{get:function(){return this.modified},enumerable:!0,configurable:!0}),t.prototype.flush=function(){this.modified&&(this.modified=!1,S.currentGeneration++,this.innerFlush(!1),o.trace(this,"Flushing model"))},t.prototype.innerFlush=function(e){for(var t=0;t<this.writeSubscriptions.length;t++){var n=this.writeSubscriptions[t];n.immediate===e&&n.handler(this)}},t.prototype.subscribeWrites=function(e,t){return void 0===t&&(t=!1),(this.hasVariables||this.hasValidationWidgets)&&e?(this.writeSubscriptions.push({handler:e,immediate:t}),!0):!1},t.prototype.unsubscribeWrites=function(e){if(e){for(var t=-1,n=0,r=this.writeSubscriptions.length;r>n;n++)if(this.writeSubscriptions[n].handler===e){t=n;break}if(t>=0)return this.writeSubscriptions.splice(t,1),!0}return!1},t.prototype.clearSubscriptions=function(){this.writeSubscriptions=[]},Object.defineProperty(t,"hasVariables",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasVariables",{get:function(){return this.constructor.hasVariables},enumerable:!0,configurable:!0}),t.getVariablesRecordConstructor=function(){throw new Error("@abstract")},t.newVariablesRecord=function(e){return this.hasVariables?new(this.getVariablesRecordConstructor())(e):void 0},t.prototype.getVariables=function(){var e=this.constructor;if(this.hasVariables)return this.getComplexProperty(t.VariablesPropertyName,e.getVariablesRecordConstructor());throw new Error("Model does not contain variables")},Object.defineProperty(t.prototype,"variables",{get:function(){return this.getVariables()},set:function(e){var n=this.constructor;this.setComplexProperty(t.VariablesPropertyName,e,r.DataTypes.Record,n.getVariablesRecordConstructor())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"clientVariablesGeneration",{get:function(){return this.getBasicProperty(t.ClientVariablesGenerationPropertyName)},set:function(e){this.setBasicProperty(t.ClientVariablesGenerationPropertyName,e,r.DataTypes.Integer)},enumerable:!0,configurable:!0}),Object.defineProperty(t,"hasValidationWidgets",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasValidationWidgets",{get:function(){return this.constructor.hasValidationWidgets},enumerable:!0,configurable:!0}),t.getWidgetsRecordConstructor=function(){throw new Error("@abstract")},t.newWidgetsRecord=function(e){return this.hasValidationWidgets?new(this.getWidgetsRecordConstructor())(e):void 0},t.prototype.getWidgets=function(){var e=this.constructor;if(this.hasValidationWidgets)return this.getComplexProperty(t.WidgetsPropertyName,e.getWidgetsRecordConstructor());throw new Error("Model does not contain validation widgets")},Object.defineProperty(t.prototype,"widgets",{get:function(){return this.getWidgets()},set:function(e){this.setComplexProperty(t.WidgetsPropertyName,e,r.DataTypes.Object)},enumerable:!0,configurable:!0}),t.prototype.hasCachedValue=function(e){return this.cachedValues.hasOwnProperty(e)},t.prototype.getCachedValue=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=this.cachedValues[e],a=r.map(function(e,n){try{return e()}catch(r){return t.InvalidValue}}),s=void 0!==o&&r.length===o.args.length&&a.every(function(e,t){return e===o.args[t]});return s||(o={args:a,value:n()},this.cachedValues[e]=o),o.value},t.prototype.createVariable=function(e,t,n){return new p(e,t,n,this)},t.prototype.fromOther=function(e){this.fromImmutableData(e.data)},t.prototype.toImmutableData=function(){return this.data},t.prototype.fromImmutableData=function(e){this.data=e,this.writePropagate(this.data,this.cache),this.cache.invalidate()},t.prototype.setInputs=function(e){throw new Error("@abstract")},Object.defineProperty(t.prototype,"widgetsGenerationsTree",{get:function(){return this._widgetsGenerationsTree||(this._widgetsGenerationsTree=new S),this._widgetsGenerationsTree},enumerable:!0,configurable:!0}),t.prototype.getReadOnlyWidgetRecord=function(e){return this.widgets.get(e).asReadOnly()},Object.defineProperty(t.prototype,"context",{get:function(){return this._context},enumerable:!0,configurable:!0}),t.prototype.sanitize=function(e){var n=e;if(this.hasVariables){if(e.constructor!==this.data.constructor)throw new Error("Expected data to be the same type of this model data");var r=this.variables.getNonSerializableAttributes();if(r.length>0){var i=n.get(t.VariablesPropertyName);r.forEach(function(e){return i=i.set(e,null)}),n=n.set(t.VariablesPropertyName,i)}}return n},t.VariablesPropertyName="variables",t.WidgetsPropertyName="widgets",t.ClientVariablesGenerationPropertyName="clientVariablesGeneration",t.InvalidValue=new Object,t.RecordClass=r.Record.defineRecordClass({variables:null,widgets:null,clientVariablesGeneration:0}),t}(r.Record);t.BaseViewModel=b,t.calculateDataFetchStatus=u;var T=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),Object.defineProperty(t,"hasVariables",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.setInputs=function(){},t}(b);t.VariablelessViewModel=T;var E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),Object.defineProperty(t,"hasVariables",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t,"hasValidationWidgets",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.setInputs=function(){},t.create=function(e,n,r){return new t({viewName:e,navigatedFromHistory:n,viewWasRestoredFromCache:r})},t}(b);t.DummyViewModel=E;var w=function(){function e(e){this.modelClass=e}return e.prototype.create=function(e){return this.modelClass.hasVariables||this.modelClass.hasValidationWidgets?new this.modelClass(e):new E(e)},Object.defineProperty(e.prototype,"hasValidationWidgets",{get:function(){return this.modelClass.hasValidationWidgets},enumerable:!0,configurable:!0}),e}();t.ModelFactory=w;var D=function(){function e(e){this._parent=e,this._generation=e?e.generation:0}return Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"generation",{get:function(){return this._generation},set:function(e){this.generation<e&&(this._generation=e,this.parent&&(this.parent.generation=e))},enumerable:!0,configurable:!0}),e.prototype.addChild=function(){return new e(this)},e}(),S=function(){function e(){this._root=new D(null),this._root.generation=e.currentGeneration,e.currentGeneration++}return Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e,"currentGeneration",{get:function(){return e.generation},set:function(t){e.generation=t},enumerable:!0,configurable:!0}),e.generation=0,e}()}),define("OutSystems/ClientRuntime/Main",["require","exports","./Application","./ApplicationInfo","./Flow","./BuiltinFunctions","./JSONUtils","./SystemActions","./ResourceCache","./Communication","./Controller","./CookiesManager","./CSSHelper","./DataTypes","./ErrorHandling","./ErrorScreen","./EventDispatcher","./FeedbackMessageService","./Format","./Interfaces","./LanguageResources","./LightImmutable","./Logger","./Model","./NativeHelper","./Navigation","./ObjectExtensions","./Public","./Request","./ScriptsManager","./StorageProvider","./Transitions","./TransitionAnimation","./Validation","./VersionsManager","./WidgetNaming","./Entities","./Exceptions","./RegExpHelper","./RolesInfo","./RequireManager","./Performance","./ScreenStateCache","./DataConversion","./Settings","./ClientInfo","./Injector/KnownServices","./Injector"],function(e,t,n,r,i,o,a,s,u,c,l,f,d,p,h,g,m,y,v,b,T,E,w,D,S,I,_,x,A,N,C,O,R,L,M,P,F,V,U,j,k,B,q,H,G,W,z,J){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),k.initialize();var K;!function(e){e.Application=n,e.ApplicationInfo=r,e.Flow=i,e.BuiltinFunctions=o,e.JSONUtils=a,e.SystemActions=s,e.ResourceCache=u,e.Communication=c,e.Controller=l,e.CookiesManager=f,e.CSSHelper=d,e.DataTypes=p,e.ErrorHandling=h,e.ErrorScreen=g,e.EventDispatcher=m,e.FeedbackMessageService=y,e.Format=v,e.ServiceNames=z.ServiceNames,e.Injector=J["default"],e.Interfaces=b,e.LanguageResources=T,e.LightImmutable=E,e.Logger=w,e.Model=D,e.NativeHelper=S,e.Navigation=I,e.ObjectExtensions=_,e.Request=A,e.ScriptsManager=N,e.StorageProvider=C,e.TransitionAnimation=R,e.Transitions=O,e.Validation=L,e.VersionsManager=M,e.WidgetNaming=P,e.Entities=F,e.Exceptions=V,e.RegExpHelper=U,e.RolesInfo=j,e.Performance=B,e.ScreenStateCache=q,e.DataConversion=H,e.Settings=G,e.ClientInfo=W,e.Types=e.DataTypes.DataTypes}(K=t.Internal||(t.Internal={})),t.Public=x,t.Version="1.0.0"}),function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function t(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function r(e){B=e}function i(e){W=e}function o(){var e=process.nextTick,t=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);return Array.isArray(t)&&"0"===t[1]&&"10"===t[2]&&(e=setImmediate),function(){e(l)}}function a(){return function(){k(l)}}function s(){var e=0,t=new K(l),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function u(){var e=new MessageChannel;return e.port1.onmessage=l,function(){e.port2.postMessage(0)}}function c(){return function(){setTimeout(l,1)}}function l(){for(var e=0;G>e;e+=2){var t=Y[e],n=Y[e+1];t(n),Y[e]=void 0,Y[e+1]=void 0}G=0}function f(){try{var e=require,t=e("vertx");return k=t.runOnLoop||t.runOnContext,a()}catch(n){return c()}}function d(){}function p(){return new TypeError("You cannot resolve a promise with itself")}function h(){return new TypeError("A promises callback cannot return that same promise.")}function g(e){try{return e.then}catch(t){return te.error=t,te}}function m(e,t,n,r){try{e.call(t,n,r)}catch(i){return i}}function y(e,t,n){W(function(e){var r=!1,i=m(n,t,function(n){r||(r=!0,t!==n?T(e,n):w(e,n))},function(t){r||(r=!0,D(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,D(e,i))},e)}function v(e,t){t._state===Z?w(e,t._result):t._state===ee?D(e,t._result):S(t,void 0,function(t){T(e,t)},function(t){D(e,t)})}function b(e,n){if(n.constructor===e.constructor)v(e,n);else{var r=g(n);r===te?D(e,te.error):void 0===r?w(e,n):t(r)?y(e,n,r):w(e,n)}}function T(t,n){t===n?D(t,p()):e(n)?b(t,n):w(t,n)}function E(e){e._onerror&&e._onerror(e._result),I(e)}function w(e,t){e._state===$&&(e._result=t,e._state=Z,0!==e._subscribers.length&&W(I,e))}function D(e,t){e._state===$&&(e._state=ee,e._result=t,W(E,e))}function S(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+Z]=n,i[o+ee]=r,0===o&&e._state&&W(I,e)}function I(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,o=e._result,a=0;a<t.length;a+=3)r=t[a],i=t[a+n],r?A(n,r,i,o):i(o);e._subscribers.length=0}}function _(){this.error=null}function x(e,t){try{return e(t)}catch(n){return ne.error=n,ne}}function A(e,n,r,i){var o,a,s,u,c=t(r);if(c){if(o=x(r,i),o===ne?(u=!0,a=o.error,o=null):s=!0,n===o)return void D(n,h())}else o=i,s=!0;n._state!==$||(c&&s?T(n,o):u?D(n,a):e===Z?w(n,o):e===ee&&D(n,o))}function N(e,t){try{t(function(t){T(e,t)},function(t){D(e,t)})}catch(n){D(e,n)}}function C(e,t){var n=this;n._instanceConstructor=e,n.promise=new e(d),n._validateInput(t)?(n._input=t,n.length=t.length,n._remaining=t.length,n._init(),0===n.length?w(n.promise,n._result):(n.length=n.length||0,n._enumerate(),0===n._remaining&&w(n.promise,n._result))):D(n.promise,n._validationError())}function O(e){return new re(this,e).promise}function R(e){function t(e){T(i,e)}function n(e){D(i,e)}var r=this,i=new r(d);if(!H(e))return D(i,new TypeError("You must pass an array to race.")),i;for(var o=e.length,a=0;i._state===$&&o>a;a++)S(r.resolve(e[a]),void 0,t,n);return i}function L(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(d);return T(n,e),n}function M(e){var t=this,n=new t(d);return D(n,e),n}function P(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function F(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function V(e){this._id=ue++,this._state=void 0,this._result=void 0,this._subscribers=[],d!==e&&(t(e)||P(),this instanceof V||F(),N(this,e))}function U(){var e;if("undefined"!=typeof global)e=global;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(e.Promise=ce)}var j;j=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var k,B,q,H=j,G=0,W=({}.toString,function(e,t){Y[G]=e,Y[G+1]=t,G+=2,2===G&&(B?B(l):q())}),z="undefined"!=typeof window?window:void 0,J=z||{},K=J.MutationObserver||J.WebKitMutationObserver,Q="undefined"!=typeof process&&"[object process]"==={}.toString.call(process),X="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Y=new Array(1e3);q=Q?o():K?s():X?u():void 0===z&&"function"==typeof require?f():c();var $=void 0,Z=1,ee=2,te=new _,ne=new _;C.prototype._validateInput=function(e){return H(e)},C.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},C.prototype._init=function(){this._result=new Array(this.length)};var re=C;C.prototype._enumerate=function(){for(var e=this,t=e.length,n=e.promise,r=e._input,i=0;n._state===$&&t>i;i++)e._eachEntry(r[i],i)},C.prototype._eachEntry=function(e,t){var r=this,i=r._instanceConstructor;n(e)?e.constructor===i&&e._state!==$?(e._onerror=null,r._settledAt(e._state,t,e._result)):r._willSettleAt(i.resolve(e),t):(r._remaining--,r._result[t]=e)},C.prototype._settledAt=function(e,t,n){var r=this,i=r.promise;i._state===$&&(r._remaining--,e===ee?D(i,n):r._result[t]=n),0===r._remaining&&w(i,r._result)},C.prototype._willSettleAt=function(e,t){var n=this;S(e,void 0,function(e){n._settledAt(Z,t,e)},function(e){n._settledAt(ee,t,e)})};var ie=O,oe=R,ae=L,se=M,ue=0,ce=V;V.all=ie,V.race=oe,V.resolve=ae,V.reject=se,V._setScheduler=r,V._setAsap=i,V._asap=W,V.prototype={constructor:V,then:function(e,t){var n=this,r=n._state;if(r===Z&&!e||r===ee&&!t)return this;var i=new this.constructor(d),o=n._result;if(r){var a=arguments[r-1];W(function(){A(r,i,a,o)})}else S(n,i,e,t);return i},"catch":function(e){return this.then(null,e)}};var le=U,fe={Promise:ce,polyfill:le};"function"==typeof define&&define.amd?define("es6-promise",[],function(){return fe}):"undefined"!=typeof module&&module.exports?module.exports=fe:"undefined"!=typeof this&&(this.ES6Promise=fe),le()}.call(this);var MapPolyfill=function(){function e(e){var t=this;this.keys=[],this.values=[],e&&e.forEach(function(e,n){t.keys.push(n),t.values.push(e)})}return Object.defineProperty(e.prototype,"size",{get:function(){return this.keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this.keys.indexOf(e)>=0},e.prototype.get=function(e){var t=this.keys.indexOf(e);if(!(0>t))return this.values[t]},e.prototype.set=function(e,t){var n=this.keys.indexOf(e);0>n?(this.keys.push(e),this.values.push(t)):this.values[n]=t},e.prototype["delete"]=function(e){var t=this.keys.indexOf(e);return 0>t?!1:(this.keys.splice(t,1),this.values.splice(t,1),!0)},e.prototype.clear=function(){this.keys=[],this.values=[]},e.prototype.forEach=function(e,t){for(var n=0;n<this.keys.length;n++)e.apply(t,[this.values[n],this.keys[n],this])},e}();("undefined"==typeof Map||"[object Map]"!==Object.prototype.toString.call(new Map))&&((window||global||this).Map=MapPolyfill),define("Map",function(){}); // All licensing information regarding this source code can be found in the LICENSES.txt file. //# sourceMappingURL=OutSystems.js.map?ts=1575554011826
/home2/wtmwscom/www/post/scripts/OutSystems.js