/** * @version : 15.6.0 - Bridge.NET * @author : Object.NET, Inc. http://bridge.net/ * @date : 2016-12-12 * @copyright : Copyright 2008-2016 Object.NET, Inc. http://object.net/ * @license : See license.txt and https://github.com/bridgedotnet/Bridge/blob/master/LICENSE.md */ (function(n){"use strict";var bt={global:n,emptyFn:function(){},identity:function(n){return n},geti:function(n,t,i){return Bridge.hasValue(n[t])?t:i},literal:function(n,t){return t.$getType=function(){return n},t},isPlainObject:function(n){if(typeof n=="object"&&n!==null){if(typeof Object.getPrototypeOf=="function"){var t=Object.getPrototypeOf(n);return t===Object.prototype||t===null}return Object.prototype.toString.call(n)==="[object Object]"}return!1},toPlain:function(n){var i,t,r,u,f;if(!n||Bridge.isPlainObject(n)||typeof n!="object")return n;if(typeof n.toJSON=="function")return n.toJSON();if(Bridge.isArray(n)){for(i=[],t=0;t0&&t.length-u-1>0&&!isNaN(parseInt(t.substr(u+1)));h&&(u=t.substring(0,u-1).lastIndexOf("$"));u>0&&u!==t.length-1&&(e=t.substring(0,u)+"get"+t.substr(u+1),o=t.substring(0,u)+"set"+t.substr(u+1));n[e]=function(n,t,i){return i?function(){return t[n]}:function(){return this[n]}}(t,n,r);n[o]=function(n,t,i){return i?function(i){t[n]=i}:function(t){this[n]=t}}(t,n,r)},event:function(n,t,i,r){n[t]=i;var s=t.charAt(0)==="$",f=s?t.slice(1):t,e="add"+f,o="remove"+f,u=t.lastIndexOf("$"),h=u>0&&t.length-u-1>0&&!isNaN(parseInt(t.substr(u+1)));h&&(u=t.substring(0,u-1).lastIndexOf("$"));u>0&&u!==t.length-1&&(e=t.substring(0,u)+"add"+t.substr(u+1),o=t.substring(0,u)+"remove"+t.substr(u+1));n[e]=function(n,t,i){return i?function(i){t[n]=Bridge.fn.combine(t[n],i)}:function(t){this[n]=Bridge.fn.combine(this[n],t)}}(t,n,r);n[o]=function(n,t,i){return i?function(i){t[n]=Bridge.fn.remove(t[n],i)}:function(t){this[n]=Bridge.fn.remove(this[n],t)}}(t,n,r)},createInstance:function(n,t){return n===System.Decimal?System.Decimal.Zero:n===System.Int64?System.Int64.Zero:n===System.UInt64?System.UInt64.Zero:n===System.Double||n===System.Single||n===System.Byte||n===System.SByte||n===System.Int16||n===System.UInt16||n===System.Int32||n===System.UInt32||n===Bridge.Int?0:typeof n.getDefaultValue=="function"?n.getDefaultValue():n===Boolean?!1:n===Date?new Date(0):n===Number?0:n===String?"":n&&n.$literal?n.ctor():t&&t.length>0?Bridge.Reflection.applyConstructor(n,t):new n},clone:function(n){if(Bridge.isArray(n))return System.Array.clone(n);if(Bridge.isString(n))return n;var t;return Bridge.isFunction(n[t="System$ICloneable$clone"])?n[t]():Bridge.is(n,System.ICloneable)?n.clone():null},copy:function(n,t,i,r){typeof i=="string"&&(i=i.split(/[,;\s]+/));for(var u,f=0,e=i?i.length:0;f=0;if(Bridge.isArray(n,u))return System.Array.is(n,t);if(u===String)return System.String.is(n,t)}return i!==!0&&t.$is?t.$is(n):t.$literal&&Bridge.isPlainObject(n)?n.$getType?Bridge.Reflection.isAssignableFrom(t,n.$getType()):!0:!1}if(f=typeof t,f==="boolean")return t;if(f==="string"&&(t=Bridge.unroll(t)),f==="function"&&Bridge.getType(n).prototype instanceof t)return!0;if(i!==!0){if(typeof t.$is=="function")return t.$is(n);if(typeof t.isAssignableFrom=="function")return t.isAssignableFrom(Bridge.getType(n))}return Bridge.isArray(n)?System.Array.is(n,t):f==="object"&&(u===t||n instanceof t)},as:function(n,t,i){return Bridge.is(n,t,!1,i)?n:null},cast:function(n,t,i){if(n==null)return n;var r=Bridge.is(n,t,!1,i)?n:null;if(r===null)throw new System.InvalidCastException("Unable to cast type "+(n?Bridge.getTypeName(n):"'null'")+" to type "+Bridge.getTypeName(t));return r},apply:function(n,t){for(var u=Bridge.getPropertyNames(t,!0),i,r=0;r=0:!1},isFunction:function(n){return typeof n=="function"},isDate:function(n){return Object.prototype.toString.call(n)==="[object Date]"},isNull:function(n){return n===null||n===undefined},isBoolean:function(n){return typeof n=="boolean"},isNumber:function(n){return typeof n=="number"&&isFinite(n)},isString:function(n){return typeof n=="string"},unroll:function(n){var r=n.split("."),t=Bridge.global[r[0]],i=1;for(i;i-1||Bridge.$$rightChain.indexOf(t)>-1)return!1;for(var i in t)if(t.hasOwnProperty(i)!==n.hasOwnProperty(i)||typeof t[i]!=typeof n[i])return!1;for(i in n){if(t.hasOwnProperty(i)!==n.hasOwnProperty(i)||typeof n[i]!=typeof t[i])return!1;if(n[i]===t[i])continue;else if(typeof n[i]=="object"){if(Bridge.$$leftChain.push(n),Bridge.$$rightChain.push(t),!Bridge.deepEquals(n[i],t[i]))return!1;Bridge.$$leftChain.pop();Bridge.$$rightChain.pop()}else if(!Bridge.equals(n[i],t[i]))return!1}return!0}return Bridge.equals(n,t)},compare:function(n,t,i,r){if(Bridge.isDefined(n,!0)){if(Bridge.isNumber(n)||Bridge.isString(n)||Bridge.isBoolean(n))return Bridge.isString(n)&&!Bridge.hasValue(t)?1:nt?1:0;if(Bridge.isDate(n))return Bridge.compare(n.valueOf(),t.valueOf())}else{if(i)return 0;throw new System.NullReferenceException;}var u;if(r&&Bridge.isFunction(n[u="System$IComparable$1$"+Bridge.getTypeAlias(r)+"$compareTo"])||Bridge.isFunction(n[u="System$IComparable$compareTo"]))return n[u](t);if(Bridge.isFunction(n.compareTo))return n.compareTo(t);if(r&&Bridge.isFunction(t[u="System$IComparable$1$"+Bridge.getTypeAlias(r)+"$compareTo"])||Bridge.isFunction(t[u="System$IComparable$compareTo"]))return-t[u](n);if(Bridge.isFunction(t.compareTo))return-t.compareTo(n);if(i)return 0;throw new System.Exception("Cannot compare items");},equalsT:function(n,t,i){if(Bridge.isDefined(n,!0)){if(Bridge.isNumber(n)||Bridge.isString(n)||Bridge.isBoolean(n))return n===t;if(Bridge.isDate(n))return n.valueOf()===t.valueOf()}else throw new System.NullReferenceException;var r;return i&&n!=null&&Bridge.isFunction(n[r="System$IEquatable$1$"+Bridge.getTypeAlias(i)+"$equalsT"])?n[r](t):i&&t!=null&&Bridge.isFunction(t[r="System$IEquatable$1$"+Bridge.getTypeAlias(i)+"$equalsT"])?t[r](n):n.equalsT?n.equalsT(t):t.equalsT(n)},format:function(n,t,i){if(Bridge.isNumber(n))return Bridge.Int.format(n,t,i);if(Bridge.isDate(n))return Bridge.Date.format(n,t,i);var r;return Bridge.isFunction(n[r="System$IFormattable$format"])?n[r](t,i):n.format(t,i)},getType:function(n){if(n==null)throw new System.NullReferenceException("instance is null");if(typeof n=="number")return!isNaN(n)&&isFinite(n)&&Math.floor(n,0)===n?System.Int32:System.Double;if(n.$getType)return n.$getType();try{return n.constructor}catch(t){return Object}},isLower:function(n){var t=String.fromCharCode(n);return t===t.toLowerCase()&&t!==t.toUpperCase()},isUpper:function(n){var t=String.fromCharCode(n);return t!==t.toLowerCase()&&t===t.toUpperCase()},coalesce:function(n,t){return Bridge.hasValue(n)?n:t},fn:{equals:function(n){return this===n?!0:n==null||this.constructor!==n.constructor?!1:this.equals===n.equals&&this.$method===n.$method&&this.$scope===n.$scope},call:function(n,t){var i=Array.prototype.slice.call(arguments,2);return n=n||Bridge.global,n[t].apply(n,i)},makeFn:function(n,t){switch(t){case 0:return function(){return n.apply(this,arguments)};case 1:return function(){return n.apply(this,arguments)};case 2:return function(){return n.apply(this,arguments)};case 3:return function(){return n.apply(this,arguments)};case 4:return function(){return n.apply(this,arguments)};case 5:return function(){return n.apply(this,arguments)};case 6:return function(){return n.apply(this,arguments)};case 7:return function(){return n.apply(this,arguments)};case 8:return function(){return n.apply(this,arguments)};case 9:return function(){return n.apply(this,arguments)};case 10:return function(){return n.apply(this,arguments)};case 11:return function(){return n.apply(this,arguments)};case 12:return function(){return n.apply(this,arguments)};case 13:return function(){return n.apply(this,arguments)};case 14:return function(){return n.apply(this,arguments)};case 15:return function(){return n.apply(this,arguments)};case 16:return function(){return n.apply(this,arguments)};case 17:return function(){return n.apply(this,arguments)};case 18:return function(){return n.apply(this,arguments)};case 19:return function(){return n.apply(this,arguments)};default:return function(){return n.apply(this,arguments)}}},bind:function(n,t,i,r){var f,u;if(t&&t.$method===t&&t.$scope===n)return t;if(n&&n.$$bind)for(f=0;f=0;i--){for(o=!1,u=0;u2147483647)throw new System.ArgumentOutOfRangeException("timeout","Number must be either non-negative and less than or equal to Int32.MaxValue or -1");n==-1&&(n=2147483647);for(var i=(new Date).getTime();(new Date).getTime()-i2147483647)break},getMetadata:function(n){return n.$getMetadata?n.$getMetadata():n.$metadata}},nt,s,at,o,vt,yt,pt,k,wt,t;n.Bridge=bt;n.Bridge.caller=[];n.System={};n.System.Diagnostics={};n.System.Diagnostics.Contracts={};n.System.Threading={};nt={is:function(n,t){return Bridge.isString(n)?n.constructor===t||n instanceof t?!0:t===System.ICloneable||t===System.Collections.IEnumerable||t===System.Collections.Generic.IEnumerable$1(System.Char)||t===System.IComparable$1(String)||t===System.IEquatable$1(String)?!0:!1:!1},lastIndexOf:function(n,t,i,r){var u=n.lastIndexOf(t,i);return u=f;u--)if(t.indexOf(n.charAt(u))>=0)return u;return-1},isNullOrWhiteSpace:function(n){return n?System.Char.isWhiteSpace(n):!0},isNullOrEmpty:function(n){return!n},fromCharCount:function(n,t){if(t>=0)return String(Array(t+1).join(String.fromCharCode(n)));throw new System.ArgumentOutOfRangeException("count","cannot be less than zero");},format:function(n){return System.String._format(System.Globalization.CultureInfo.getCurrentCulture(),n,Array.prototype.slice.call(arguments,1))},formatProvider:function(n,t){return System.String._format(n,t,Array.prototype.slice.call(arguments,2))},_format:function(n,t,i){var u=this,f=i,r=this.decodeBraceSequence;return t.replace(/(\{+)((\d+|[a-zA-Z_$]\w+(?:\.[a-zA-Z_$]\w+|\[\d+\])*)(?:\,(-?\d*))?(?:\:([^\}]*))?)(\}+)|(\{+)|(\}+)/g,function(t,i,e,o,s,h,c,l,a){return l?r(l):a?r(a):i.length%2==0||c.length%2==0?r(i)+e+r(c):r(i,!0)+u.handleElement(n,o,s,h,f)+r(c,!0)})},handleElement:function(n,t,i,r,u){var f;if(t=parseInt(t,10),t>u.length-1)throw new System.FormatException("Input string was not in a correct format.");return f=u[t],f==null&&(f=""),f=r&&Bridge.is(f,System.IFormattable)?Bridge.format(f,r,n):""+f,i&&(i=parseInt(i,10),Bridge.isNumber(i)||(i=null)),System.String.alignString(f.toString(),i)},decodeBraceSequence:function(n,t){return n.substr(0,(n.length+(t?0:1))/2)},alignString:function(n,t,i,r,u){if(!n||!t)return n;if(i||(i=" "),Bridge.isNumber(i)&&(i=String.fromCharCode(i)),r||(r=t<0?1:2),t=Math.abs(t),u&&n.length>t&&(n=n.substring(0,t)),t+1>=n.length)switch(r){case 2:n=Array(t+1-n.length).join(i)+n;break;case 3:var f=t-n.length,e=Math.ceil(f/2),o=f-e;n=Array(o+1).join(i)+n+Array(e+1).join(i);break;case 1:default:n=n+Array(t+1-n.length).join(i)}return n},startsWith:function(n,t){return t.length?t.length>n.length?!1:(t=System.String.escape(t),n.match("^"+t)!==null):!0},endsWith:function(n,t){return t.length?t.length>n.length?!1:(t=System.String.escape(t),n.match(t+"$")!==null):!0},contains:function(n,t){if(t==null)throw new System.ArgumentNullException;return n==null?!1:n.indexOf(t)>-1},indexOfAny:function(n,t){var i,r,e,u,o,f;if(t==null)throw new System.ArgumentNullException;if(n==null||n==="")return-1;if(i=arguments.length>2?arguments[2]:0,i<0)throw new System.ArgumentOutOfRangeException("startIndex","startIndex cannot be less than zero");if(r=arguments.length>3?arguments[3]:n.length-i,r<0)throw new System.ArgumentOutOfRangeException("length","must be non-negative");if(r>n.length-i)throw new System.ArgumentOutOfRangeException("Index and length must refer to a location within the string");for(e=n.substr(i,r),u=0;u-1)return f+i;return-1},indexOf:function(n,t){var i,u,f,r;if(t==null)throw new System.ArgumentNullException;if(n==null||n==="")return-1;if(i=arguments.length>2?arguments[2]:0,i<0||i>n.length)throw new System.ArgumentOutOfRangeException("startIndex","startIndex cannot be less than zero and must refer to a location within the string");if(t==="")return arguments.length>2?i:0;if(u=arguments.length>3?arguments[3]:n.length-i,u<0)throw new System.ArgumentOutOfRangeException("length","must be non-negative");if(u>n.length-i)throw new System.ArgumentOutOfRangeException("Index and length must refer to a location within the string");return(f=n.substr(i,u),r=arguments.length===5&&arguments[4]%2!=0?f.toLocaleUpperCase().indexOf(t.toLocaleUpperCase()):f.indexOf(t),r>-1)?arguments.length===5?System.String.compare(t,f.substr(r,t.length),arguments[4])===0?r+i:-1:r+i:-1},equals:function(){return System.String.compare.apply(this,arguments)===0},compare:function(n,t){if(n==null)return t==null?0:-1;if(t==null)return 1;if(arguments.length>=3)if(Bridge.isBoolean(arguments[2])){if(arguments[2]&&(n=n.toLocaleUpperCase(),t=t.toLocaleUpperCase()),arguments.length===4)return n.localeCompare(t,arguments[3].name)}else switch(arguments[2]){case 1:return n.localeCompare(t,System.Globalization.CultureInfo.getCurrentCulture().name,{sensitivity:"accent"});case 2:return n.localeCompare(t,System.Globalization.CultureInfo.invariantCulture.name);case 3:return n.localeCompare(t,System.Globalization.CultureInfo.invariantCulture.name,{sensitivity:"accent"});case 4:return n===t?0:n>t?1:-1;case 5:return n.toUpperCase()===t.toUpperCase()?0:n.toUpperCase()>t.toUpperCase()?1:-1}return n.localeCompare(t)},toCharArray:function(n,t,i){var u,r;if(t<0||t>n.length||t>n.length-i)throw new System.ArgumentOutOfRangeException("startIndex","startIndex cannot be less than zero and must refer to a location within the string");if(i<0)throw new System.ArgumentOutOfRangeException("length","must be non-negative");for(Bridge.hasValue(t)||(t=0),Bridge.hasValue(i)||(i=n.length),u=[],r=t;r0?t.substring(0,n)+i+t.substring(n,t.length):i+t},remove:function(n,t,i){if(n==null)throw new System.NullReferenceException;if(t<0)throw new System.ArgumentOutOfRangeException("startIndex","StartIndex cannot be less than zero");if(i!=null){if(i<0)throw new System.ArgumentOutOfRangeException("count","Count cannot be less than zero");if(i>n.length-t)throw new System.ArgumentOutOfRangeException("count","Index and count must refer to a location within the string");}else if(t>=n.length)throw new System.ArgumentOutOfRangeException("startIndex","startIndex must be less than length of string");return i==null||t+i>n.length?n.substr(0,t):n.substr(0,t)+n.substr(t+i)},split:function(n,t,i,r){for(var o=!Bridge.hasValue(t)||t.length===0?new RegExp("\\s","g"):new RegExp(t.map(System.String.escape).join("|"),"g"),f=[],e,u=0;;u=o.lastIndex)if(e=o.exec(n)){if(r!==1||e.index>u){if(f.length===i-1)return f.push(n.substr(u)),f;f.push(n.substring(u,e.index))}}else return(r!==1||u!==n.length)&&f.push(n.substr(u)),f},trimEnd:function(n,t){return n.replace(t?new RegExp("["+System.String.escape(String.fromCharCode.apply(null,t))+"]+$"):/\s*$/,"")},trimStart:function(n,t){return n.replace(t?new RegExp("^["+System.String.escape(String.fromCharCode.apply(null,t))+"]+"):/^\s*/,"")},trim:function(n,t){return System.String.trimStart(System.String.trimEnd(n,t),t)},concat:function(){for(var t,i="",n=0;n=0;e--){v=c[e].trim();h=!1;for(u in f)if(s.nameEquals(u,v,i)){l|=f[u];h=!0;break}if(!h){a=!1;break}}if(a)return l}else for(u in f)if(s.nameEquals(u,t,i))return f[u];if(r!==!0)throw new System.ArgumentException("Invalid Enumeration Value");return null},toString:function(n,t,i){var u,e,f,r;if(n===Number)return t.toString();if(System.Enum.checkEnumType(n),u=n,e=System.Int64.is64Bit(t),(n.prototype&&n.prototype.$flags||i===!0)&&t!==0){f=[];for(r in u)(e&&System.Int64.is64Bit(u[r])?!u[r].and(t).isZero():u[r]&t)&&f.push(s.toName(r));return f.length?f.join(", "):t.toString()}for(r in u)if(e&&System.Int64.is64Bit(u[r])?u[r].eq(t):u[r]===t)return s.toName(r);return t.toString()},getValues:function(n){var r,t,i;System.Enum.checkEnumType(n);r=[];t=n;for(i in t)t.hasOwnProperty(i)&&i.indexOf("$")<0&&typeof t[i]!="function"&&r.push(t[i]);return r},format:function(n,t,i){System.Enum.checkEnumType(n);var r;if(!Bridge.hasValue(t)&&(r="value")||!Bridge.hasValue(i)&&(r="format"))throw new System.ArgumentNullException(r);switch(i){case"G":case"g":return System.Enum.toString(n,t);case"x":case"X":return t.toString(16);case"d":case"D":return t.toString();case"f":case"F":return System.Enum.toString(n,t,!0);default:throw new System.FormatException;}},getNames:function(n){var r,i,t;System.Enum.checkEnumType(n);r=[];i=n;for(t in i)i.hasOwnProperty(t)&&t.indexOf("$")<0&&typeof i[t]!="function"&&r.push(s.toName(t));return r},getName:function(n,t){var r,i;System.Enum.checkEnumType(n);r=n;for(i in r)if(r[i]===t)return i.charAt(0).toUpperCase()+i.slice(1);return null},hasFlag:function(n,t){return!!(n&t)},isDefined:function(n,t){var i,u,r;System.Enum.checkEnumType(n);i=n;u=Bridge.isString(t);for(r in i)if(u?s.nameEquals(r,t,!1):i[r]===t)return!0;return!1},tryParse:function(n,t,i,r){return(i.v=0,i.v=s.parse(n,t,r,!0),i.v==null)?!1:!0}};System.Enum=s;var i=function(n){return n.test(navigator.userAgent.toLowerCase())},tt=Bridge.global.document&&Bridge.global.document.compatMode==="CSS1Compat",v=function(n,t){var i;return n&&(i=t.exec(navigator.userAgent.toLowerCase()))?parseFloat(i[1]):0},r=Bridge.global.document?Bridge.global.document.documentMode:null,p=i(/opera/),kt=p&&i(/version\/10\.5/),it=i(/\bchrome\b/),d=i(/webkit/),c=!it&&i(/safari/),dt=c&&i(/applewebkit\/4/),gt=c&&i(/version\/3/),ni=c&&i(/version\/4/),ti=c&&i(/version\/5\.0/),ii=c&&i(/version\/5/),u=!p&&(i(/msie/)||i(/trident/)),e=u&&(i(/msie 7/)&&r!==8&&r!==9&&r!==10||r===7),h=u&&(i(/msie 8/)&&r!==7&&r!==9&&r!==10||r===8),l=u&&(i(/msie 9/)&&r!==7&&r!==8&&r!==10||r===9),w=u&&(i(/msie 10/)&&r!==7&&r!==8&&r!==9||r===10),rt=u&&(i(/trident\/7\.0/)&&r!==7&&r!==8&&r!==9&&r!==10||r===11),f=u&&i(/msie 6/),y=!d&&!u&&i(/gecko/),b=y&&i(/rv:1\.9/),ri=y&&i(/rv:2\.0/),ui=y&&i(/rv:5\./),fi=y&&i(/rv:10\./),ei=b&&i(/rv:1\.9\.0/),oi=b&&i(/rv:1\.9\.1/),si=b&&i(/rv:1\.9\.2/),ut=i(/windows|win32/),ft=i(/macintosh|mac os x/),et=i(/linux/),hi=v(!0,/\bchrome\/(\d+\.\d+)/),a=v(!0,/\bfirefox\/(\d+\.\d+)/),ci=v(u,/msie (\d+\.\d+)/),li=v(p,/version\/(\d+\.\d+)/),ai=v(c,/version\/(\d+\.\d+)/),vi=v(d,/webkit\/(\d+\.\d+)/),yi=Bridge.global.location?/^https/i.test(Bridge.global.location.protocol):!1,ot=/iPhone/i.test(navigator.platform),st=/iPod/i.test(navigator.platform),g=/iPad/i.test(navigator.userAgent),pi=/Blackberry/i.test(navigator.userAgent),ht=/Android/i.test(navigator.userAgent),ct=ft||ut||et&&!ht,lt=g,wi=!ct&&!lt,bi={isStrict:tt,isIEQuirks:u&&!tt&&(f||e||h||l),isOpera:p,isOpera10_5:kt,isWebKit:d,isChrome:it,isSafari:c,isSafari3:gt,isSafari4:ni,isSafari5:ii,isSafari5_0:ti,isSafari2:dt,isIE:u,isIE6:f,isIE7:e,isIE7m:f||e,isIE7p:u&&!f,isIE8:h,isIE8m:f||e||h,isIE8p:u&&!(f||e),isIE9:l,isIE9m:f||e||h||l,isIE9p:u&&!(f||e||h),isIE10:w,isIE10m:f||e||h||l||w,isIE10p:u&&!(f||e||h||l),isIE11:rt,isIE11m:f||e||h||l||w||rt,isIE11p:u&&!(f||e||h||l||w),isGecko:y,isGecko3:b,isGecko4:ri,isGecko5:ui,isGecko10:fi,isFF3_0:ei,isFF3_5:oi,isFF3_6:si,isFF4:4<=a&&a<5,isFF5:5<=a&&a<6,isFF10:10<=a&&a<11,isLinux:et,isWindows:ut,isMac:ft,chromeVersion:hi,firefoxVersion:a,ieVersion:ci,operaVersion:li,safariVersion:ai,webKitVersion:vi,isSecure:yi,isiPhone:ot,isiPod:st,isiPad:g,isBlackberry:pi,isAndroid:ht,isDesktop:ct,isTablet:lt,isPhone:wi,iOS:ot||g||st,standalone:Bridge.global.navigator?!!Bridge.global.navigator.standalone:!1};Bridge.Browser=bi;at={_initialize:function(){this.$initialized||(this.$initialized=Bridge.emptyFn,this.$staticInit&&this.$staticInit(),this.$initMembers&&this.$initMembers())},initConfig:function(n,t,i,r,u,f){var s,e,o,h;if(i.fields)for(e in i.fields)u[e]=i.fields[e];if(i.properties)for(e in i.properties)Bridge.property(u,e,i.properties[e],r);if(i.events)for(e in i.events)Bridge.event(u,e,i.events[e],r);if(i.alias)for(o=0;o0&&u.$$inherits[0].$staticInit&&u.$$inherits[0].$staticInit(),u.$base.ctor.call(this))},i.ctor=u),i.$literal&&(o&&o.getDefaultValue||(u.getDefaultValue=function(){var n={};return n.$getType=function(){return u},n}),u.$literal=!0,delete i.$literal),l||(v=Bridge.Class.set(v,n,u)),r&&r.fn.$cache.push({type:u,args:r.args}),u.$$name=n,u.$kind=i.$kind,r&&l){for(u.$genericTypeDefinition=r.fn,u.$typeArguments=r.args,u.$assembly=r.fn.$assembly||Bridge.$currentAssembly,nt=Bridge.Reflection.getTypeFullName(r.fn),s=0;s0)for(d=0;d0)for(u=0;u1?t[1]:"Object")},_makeQName:function(n,t){return n+(t?", "+t.name:"")},getTypeQName:function(n){return Bridge.Reflection._makeQName(Bridge.Reflection.getTypeFullName(n),n.$assembly)},getTypeName:function(n){var t=Bridge.Reflection.getTypeFullName(n),i=t.indexOf("["),r=t.lastIndexOf(".",i>=0?i:t.length);return r>0?t.substr(r+1):t},getTypeNamespace:function(n){var t=Bridge.Reflection.getTypeFullName(n),u=t.indexOf("["),f=t.lastIndexOf(".",u>=0?u:t.length),i=f>0?t.substr(0,f):"",r;return n.$assembly&&(r=Bridge.Reflection._getAssemblyType(n.$assembly,i),r&&(i=Bridge.Reflection.getTypeNamespace(r))),i},getTypeAssembly:function(n){return System.Array.contains([Date,Number,Boolean,String,Function,Array],n)?Bridge.SystemAssembly:n.$assembly||Bridge.SystemAssembly},_getAssemblyType:function(n,t){var e=!1,u,f,i,r;if(n||(n=Bridge.SystemAssembly,e=!0),n.$types){if(u=n.$types[t]||null,u)return u;if(n.name==="mscorlib")n=Bridge.global;else return null}for(f=t.split("."),i=n,r=0;r0?n.substring(r.index+1,i.lastIndex-1):n.substring(r.index+1)).trim()])))return null;break;case",":if(i.exec(n),!(t=System.Reflection.Assembly.assemblies[(i.lastIndex>0?n.substring(r.index+1,i.lastIndex-1):n.substring(r.index+1)).trim()]))return null}}else f=n.substring(o);return s&&i.lastIndex?null:(u=Bridge.Reflection._getAssemblyType(t,f.trim()),u=e.length?u.apply(null,e):u,u&&u.$staticInit&&u.$staticInit(),u)},getType:function(n,t){return n?Bridge.Reflection._getType(n,t):null},canAcceptNull:function(n){return n.$kind==="struct"||n===System.Decimal||n===System.Int64||n===System.UInt64||n===System.Double||n===System.Single||n===System.Byte||n===System.SByte||n===System.Int16||n===System.UInt16||n===System.Int32||n===System.UInt32||n===Bridge.Int||n===Boolean||n===Date||n===Number?!1:!0},applyConstructor:function(n,t){var a,f,s,h,e,i,r,c,o,u,l;if(!t||t.length===0)return new n;if(n.$$initCtor&&n.$kind!=="anonymous"){if(a=Bridge.getMetadata(n),f=0,a){for(s=Bridge.Reflection.getMembers(n,1,28),e=0;e1)throw new System.Exception("The ambiguous constructor call");}return l=function(){n.apply(this,t)},l.prototype=n.prototype,new l},getAttributes:function(n,t,i){var f=[],r,o,u,e,s,c,h;if(i&&(c=Bridge.Reflection.getBaseType(n),c))for(u=Bridge.Reflection.getAttributes(c,t,!0),r=0;r=0;h--)Bridge.Reflection.isInstanceOfType(f[h],o)&&f.splice(h,1);f.push(u)}return f},getMembers:function(n,t,i,r,u){var e=[],l,a,o,y,h,c,v,s,f;if(((i&72)==72||(i&6)==4)&&(l=Bridge.Reflection.getBaseType(n),l&&(e=Bridge.Reflection.getMembers(l,t&-2,i&(i&64?255:247)&(i&2?251:255),r,u))),a=function(n){if(t&n.t&&(i&4&&!n.is||i&8&&n.is)&&(!r||n.n===r)){if(u){if((n.p||[]).length!==u.length)return;for(var f=0;f1)throw new System.Reflection.AmbiguousMatchException("Ambiguous match");else if(s.length===1)return s[0];n=Bridge.Reflection.getBaseType(n)}return null}return e},midel:function(n,t,i){var r,u,f,e;if(n.is&&!!t)throw new System.ArgumentException("Cannot specify target for static method");else if(!n.is&&!t)throw new System.ArgumentException("Must specify target for instance method");if(n.fg)r=function(){return(n.is?n.td:this)[n.fg]};else if(n.fs)r=function(t){(n.is?n.td:this)[n.fs]=t};else{if(r=n.def||(n.is||n.sm?n.td[n.sn]:t[n.sn]),n.tpc){if(!i||i.length!==n.tpc)throw new System.ArgumentException("Wrong number of type arguments");u=r;r=function(){return u.apply(this,i.concat(Array.prototype.slice.call(arguments)))}}else if(i&&i.length)throw new System.ArgumentException("Cannot specify type arguments for non-generic method");n.exp&&(f=r,r=function(){return f.apply(this,Array.prototype.slice.call(arguments,0,arguments.length-1).concat(arguments[arguments.length-1]))});n.sm&&(e=r,r=function(){return e.apply(null,[this].concat(Array.prototype.slice.call(arguments)))})}return Bridge.fn.bind(t,r)},invokeCI:function(n,t){return n.exp&&(t=t.slice(0,t.length-1).concat(t[t.length-1])),n.def?n.def.apply(null,t):n.sm?n.td[n.sn].apply(null,t):Bridge.Reflection.applyConstructor(n.sn?n.td[n.sn]:n.td,t)},fieldAccess:function(n,t){if(n.is&&!!t)throw new System.ArgumentException("Cannot specify target for static field");else if(!n.is&&!t)throw new System.ArgumentException("Must specify target for instance field");if(t=n.is?n.td:t,arguments.length===3)t[n.sn]=arguments[2];else return t[n.sn]}};Bridge.setMetadata=Bridge.Reflection.setMetadata;System.Reflection.ConstructorInfo={$is:function(n){return n!=null&&n.t===1}};System.Reflection.EventInfo={$is:function(n){return n!=null&&n.t===2}};System.Reflection.FieldInfo={$is:function(n){return n!=null&&n.t===4}};System.Reflection.MethodBase={$is:function(n){return n!=null&&(n.t===1||n.t===8)}};System.Reflection.MethodInfo={$is:function(n){return n!=null&&n.t===8}};System.Reflection.PropertyInfo={$is:function(n){return n!=null&&n.t===16}};System.AppDomain={getAssemblies:function(){return Object.keys(System.Reflection.Assembly.assemblies).map(function(n){return System.Reflection.Assembly.assemblies[n]})}};Bridge.define("System.IFormattable",{$kind:"interface",statics:{$is:function(n){return Bridge.isNumber(n)||Bridge.isDate(n)?!0:Bridge.is(n,System.IFormattable,!0)}}});Bridge.define("System.IComparable",{$kind:"interface",statics:{$is:function(n){return Bridge.isNumber(n)||Bridge.isDate(n)||Bridge.isBoolean(n)||Bridge.isString(n)?!0:Bridge.is(n,System.IComparable,!0)}}});Bridge.define("System.IFormatProvider",{$kind:"interface"});Bridge.define("System.ICloneable",{$kind:"interface"});Bridge.define("System.IComparable$1",function(n){return{$kind:"interface",statics:{$is:function(t){return Bridge.isNumber(t)&&n.$number&&n.$is(t)||Bridge.isDate(t)&&n===Date||Bridge.isBoolean(t)&&n===Boolean||Bridge.isString(t)&&n===String?!0:Bridge.is(t,System.IComparable$1(n),!0)}}}});Bridge.define("System.IEquatable$1",function(n){return{$kind:"interface",statics:{$is:function(t){return Bridge.isNumber(t)&&n.$number&&n.$is(t)||Bridge.isDate(t)&&n===Date||Bridge.isBoolean(t)&&n===Boolean||Bridge.isString(t)&&n===String?!0:Bridge.is(t,System.IEquatable$1(n),!0)}}}});Bridge.define("Bridge.IPromise",{$kind:"interface"});Bridge.define("System.IDisposable",{$kind:"interface"});vt={hasValue:Bridge.hasValue,getValue:function(n){if(!Bridge.hasValue(n))throw new System.InvalidOperationException("Nullable instance doesn't have a value.");return n},getValueOrDefault:function(n,t){return Bridge.hasValue(n)?n:t},add:function(n,t){return Bridge.hasValue$1(n,t)?n+t:null},band:function(n,t){return Bridge.hasValue$1(n,t)?n&t:null},bor:function(n,t){return Bridge.hasValue$1(n,t)?n|t:null},and:function(n,t){return n===!0&&t===!0?!0:n===!1||t===!1?!1:null},or:function(n,t){return n===!0||t===!0?!0:n===!1&&t===!1?!1:null},div:function(n,t){return Bridge.hasValue$1(n,t)?n/t:null},eq:function(n,t){return Bridge.hasValue(n)?n===t:!Bridge.hasValue(t)},equals:function(n,t,i){return Bridge.hasValue(n)?i?i(n,t):Bridge.equals(n,t):!Bridge.hasValue(t)},toString:function(n,t){return Bridge.hasValue(n)?t?t(n):n.toString():""},getHashCode:function(n,t){return Bridge.hasValue(n)?t?t(n):Bridge.getHashCode(n):0},xor:function(n,t){return Bridge.hasValue$1(n,t)?n^t:null},gt:function(n,t){return Bridge.hasValue$1(n,t)&&n>t},gte:function(n,t){return Bridge.hasValue$1(n,t)&&n>=t},neq:function(n,t){return Bridge.hasValue(n)?n!==t:Bridge.hasValue(t)},lt:function(n,t){return Bridge.hasValue$1(n,t)&&n>t:null},srr:function(n,t){return Bridge.hasValue$1(n,t)?n>>>t:null},sub:function(n,t){return Bridge.hasValue$1(n,t)?n-t:null},bnot:function(n){return Bridge.hasValue(n)?~n:null},neg:function(n){return Bridge.hasValue(n)?-n:null},not:function(n){return Bridge.hasValue(n)?!n:null},pos:function(n){return Bridge.hasValue(n)?+n:null},lift:function(){for(var n=1;n=System.Char.min&&n<=System.Char.max},getDefaultValue:function(){return 0},parse:function(n){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("s");if(n.length!==1)throw new System.FormatException;return n.charCodeAt(0)},tryParse:function(n,t){var i=n&&n.length===1;return t.v=i?n.charCodeAt(0):0,i},format:function(n,t,i){return Bridge.Int.format(n,t,i)},charCodeAt:function(n,t){if(n==null)throw new System.ArgumentNullException;if(n.length!=1)throw new System.FormatException("String must be exactly one character long");return n.charCodeAt(t)},isWhiteSpace:function(n){return!/[^\s\x09-\x0D\x85\xA0]/.test(n)},isDigit:function(n){return n<256?n>=48&&n<=57:new RegExp("[0-90-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9]").test(String.fromCharCode(n))},isLetter:function(n){return n<256?n>=65&&n<=90||n>=97&&n<=122:new RegExp("[A-Za-za-zµß-öø-ÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıijĵķĸĺļľŀłńņňʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷźżž-ƀƃƅƈƌƍƒƕƙ-ƛƞơƣƥƨƪƫƭưƴƶƹƺƽ-ƿdžljnjǎǐǒǔǖǘǚǜǝǟǡǣǥǧǩǫǭǯǰdzǵǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟȡȣȥȧȩȫȭȯȱȳ-ȹȼȿɀɂɇɉɋɍɏ-ʓʕ-ʯͱͳͷͻ-ͽΐά-ώϐϑϕ-ϗϙϛϝϟϡϣϥϧϩϫϭϯ-ϳϵϸϻϼа-џѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӂӄӆӈӊӌӎӏӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧա-ևᴀ-ᴫᵫ-ᵷᵹ-ᶚḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕ-ẝẟạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷιῂ-ῄῆῇῐ-ΐῖῗῠ-ῧῲ-ῴῶῷℊℎℏℓℯℴℹℼℽⅆ-ⅉⅎↄⰰ-ⱞⱡⱥⱦⱨⱪⱬⱱⱳⱴⱶ-ⱻⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣⳤⳬⳮⳳⴀ-ⴥⴧⴭꙁꙃꙅꙇꙉꙋꙍꙏꙑꙓꙕꙗꙙꙛꙝꙟꙡꙣꙥꙧꙩꙫꙭꚁꚃꚅꚇꚉꚋꚍꚏꚑꚓꚕꚗꜣꜥꜧꜩꜫꜭꜯ-ꜱꜳꜵꜷꜹꜻꜽꜿꝁꝃꝅꝇꝉꝋꝍꝏꝑꝓꝕꝗꝙꝛꝝꝟꝡꝣꝥꝧꝩꝫꝭꝯꝱ-ꝸꝺꝼꝿꞁꞃꞅꞇꞌꞎꞑꞓꞡꞣꞥꞧꞩꟺff-stﬓ-ﬗa-zA-ZÀ-ÖØ-ÞĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIJĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽƁƂƄƆƇƉ-ƋƎ-ƑƓƔƖ-ƘƜƝƟƠƢƤƦƧƩƬƮƯƱ-ƳƵƷƸƼDŽLJNJǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮDZǴǶ-ǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾɁɃ-ɆɈɊɌɎͰͲͶΆΈ-ΊΌΎΏΑ-ΡΣ-ΫϏϒ-ϔϘϚϜϞϠϢϤϦϨϪϬϮϴϷϹϺϽ-ЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԱ-ՖႠ-ჅჇჍḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈ-ἏἘ-ἝἨ-ἯἸ-ἿὈ-ὍὙὛὝὟὨ-ὯᾸ-ΆῈ-ΉῘ-ΊῨ-ῬῸ-Ώℂℇℋ-ℍℐ-ℒℕℙ-ℝℤΩℨK-ℭℰ-ℳℾℿⅅↃⰀ-ⰮⱠⱢ-ⱤⱧⱩⱫⱭ-ⱰⱲⱵⱾ-ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲꙀꙂꙄꙆꙈꙊꙌꙎꙐꙒꙔꙖꙘꙚꙜꙞꙠꙢꙤꙦꙨꙪꙬꚀꚂꚄꚆꚈꚊꚌꚎꚐꚒꚔꚖꜢꜤꜦꜨꜪꜬꜮꜲꜴꜶꜸꜺꜼꜾꝀꝂꝄꝆꝈꝊꝌꝎꝐꝒꝔꝖꝘꝚꝜꝞꝠꝢꝤꝦꝨꝪꝬꝮꝹꝻꝽꝾꞀꞂꞄꞆꞋꞍꞐꞒꞠꞢꞤꞦꞨꞪA-ZDžLjNjDzᾈ-ᾏᾘ-ᾟᾨ-ᾯᾼῌῼʰ-ˁˆ-ˑˠ-ˤˬˮʹͺՙـۥۦߴߵߺࠚࠤࠨॱๆໆჼៗᡃᪧᱸ-ᱽᴬ-ᵪᵸᶛ-ᶿⁱⁿₐ-ₜⱼⱽⵯⸯ々〱-〵〻ゝゞー-ヾꀕꓸ-ꓽꘌꙿꜗ-ꜟꝰꞈꟸꟹꧏꩰꫝꫳꫴー゙゚ªºƻǀ-ǃʔא-תװ-ײؠ-ؿف-يٮٯٱ-ۓەۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪࠀ-ࠕࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॲ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๅກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎა-ჺჽ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៜᠠ-ᡂᡄ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱷᳩ-ᳬᳮ-ᳱᳵᳶℵ-ℸⴰ-ⵧⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ〆〼ぁ-ゖゟァ-ヺヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꀔꀖ-ꒌꓐ-ꓷꔀ-ꘋꘐ-ꘟꘪꘫꙮꚠ-ꛥꟻ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩯꩱ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛꫜꫠ-ꫪꫲꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎יִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼヲ-ッア-ンᅠ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]").test(String.fromCharCode(n))},isHighSurrogate:function(n){return new RegExp("[\uD800-\uDBFF]").test(String.fromCharCode(n))},isLowSurrogate:function(n){return new RegExp("[\uDC00-\uDFFF]").test(String.fromCharCode(n))},isSurrogate:function(n){return new RegExp("[\uD800-\uDFFF]").test(String.fromCharCode(n))},isNull:function(n){return new RegExp("\x00").test(String.fromCharCode(n))},isSymbol:function(n){return n<256?[36,43,60,61,62,94,96,124,126,162,163,164,165,166,167,168,169,172,174,175,176,177,180,182,184,215,247].indexOf(n)!=-1:new RegExp("[₠-⃏⃐-⃿℀-⅏⅐-↏←-⇿∀-⋿⌀-⏿■-◿☀-⛿✀-➿⟀-⟯⟰-⟿⠀-⣿⤀-⥿⦀-⧿⨀-⫿⬀-⯿]").test(String.fromCharCode(n))},isSeparator:function(n){return n<256?n==32||n==160:new RegExp("[\u2028\u2029   ᠎ -    ]").test(String.fromCharCode(n))},isPunctuation:function(n){return n<256?[33,34,35,37,38,39,40,41,42,44,45,46,47,58,59,63,64,91,92,93,95,123,125,161,171,173,183,187,191].indexOf(n)!=-1:new RegExp("[!-#%-*,-/:;?@[-]_{}¡§«¶·»¿;·՚-՟։֊־׀׃׆׳״؉؊،؍؛؞؟٪-٭۔܀-܍߷-߹࠰-࠾࡞।॥॰૰෴๏๚๛༄-༒༔༺-༽྅࿐-࿔࿙࿚၊-၏჻፠-፨᐀᙭᙮᚛᚜᛫-᛭᜵᜶។-៖៘-៚᠀-᠊᥄᥅᨞᨟᪠-᪦᪨-᪭᭚-᭠᯼-᯿᰻-᰿᱾᱿᳀-᳇᳓‐-‧‰-⁃⁅-⁑⁓-⁞⁽⁾₍₎〈〉❨-❵⟅⟆⟦-⟯⦃-⦘⧘-⧛⧼⧽⳹-⳼⳾⳿⵰⸀-⸮⸰-⸻、-〃〈-】〔-〟〰〽゠・꓾꓿꘍-꘏꙳꙾꛲-꛷꡴-꡷꣎꣏꣸-꣺꤮꤯꥟꧁-꧍꧞꧟꩜-꩟꫞꫟꫰꫱꯫﴾﴿︐-︙︰-﹒﹔-﹡﹣﹨﹪﹫!-#%-*,-/:;?@[-]_{}⦅-・-֊־᐀᠆‐-―⸗⸚⸺⸻〜〰゠︱︲﹘﹣-([{༺༼᚛‚„⁅⁽₍〈❨❪❬❮❰❲❴⟅⟦⟨⟪⟬⟮⦃⦅⦇⦉⦋⦍⦏⦑⦓⦕⦗⧘⧚⧼⸢⸤⸦⸨〈《「『【〔〖〘〚〝﴾︗︵︷︹︻︽︿﹁﹃﹇﹙﹛﹝([{⦅「)]}༻༽᚜⁆⁾₎〉❩❫❭❯❱❳❵⟆⟧⟩⟫⟭⟯⦄⦆⦈⦊⦌⦎⦐⦒⦔⦖⦘⧙⧛⧽⸣⸥⸧⸩〉》」』】〕〗〙〛〞〟﴿︘︶︸︺︼︾﹀﹂﹄﹈﹚﹜﹞)]}⦆」«‘‛“‟‹⸂⸄⸉⸌⸜⸠»’”›⸃⸅⸊⸍⸝⸡_‿⁀⁔︳︴﹍-﹏_!-#%-'*,./:;?@\\¡§¶·¿;·՚-՟։׀׃׆׳״؉؊،؍؛؞؟٪-٭۔܀-܍߷-߹࠰-࠾࡞।॥॰૰෴๏๚๛༄-༒༔྅࿐-࿔࿙࿚၊-၏჻፠-፨᙭᙮᛫-᛭᜵᜶។-៖៘-៚᠀-᠅᠇-᠊᥄᥅᨞᨟᪠-᪦᪨-᪭᭚-᭠᯼-᯿᰻-᰿᱾᱿᳀-᳇᳓‖‗†-‧‰-‸※-‾⁁-⁃⁇-⁑⁓⁕-⁞⳹-⳼⳾⳿⵰⸀⸁⸆-⸈⸋⸎-⸖⸘⸙⸛⸞⸟⸪-⸮⸰-⸹、-〃〽・꓾꓿꘍-꘏꙳꙾꛲-꛷꡴-꡷꣎꣏꣸-꣺꤮꤯꥟꧁-꧍꧞꧟꩜-꩟꫞꫟꫰꫱꯫︐-︖︙︰﹅﹆﹉-﹌﹐-﹒﹔-﹗﹟-﹡﹨﹪﹫!-#%-'*,./:;?@\。、・]").test(String.fromCharCode(n))},isNumber:function(n){return n<256?[48,49,50,51,52,53,54,55,56,57,178,179,185,188,189,190].indexOf(n)!=-1:new RegExp("[0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-90-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9ᛮ-ᛰⅠ-ↂↅ-ↈ〇〡-〩〸-〺ꛦ-ꛯ²³¹¼-¾৴-৹୲-୷௰-௲౸-౾൰-൵༪-༳፩-፼៰-៹᧚⁰⁴-⁹₀-₉⅐-⅟↉①-⒛⓪-⓿❶-➓⳽㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꠰-꠵]").test(String.fromCharCode(n))},isControl:function(n){return n<256?n>=0&&n<=31||n>=127&&n<=159:new RegExp("[\x00-\x1f€-Ÿ]").test(String.fromCharCode(n))}}});Bridge.Class.addExtend(System.Char,[System.IComparable$1(System.Char),System.IEquatable$1(System.Char)]);Bridge.define("System.FormattableString",{inherits:[System.IFormattable],statics:{invariant:function(n){return n.toString$1(System.Globalization.CultureInfo.invariantCulture)}},toString:function(){return this.toString$1(System.Globalization.CultureInfo.getCurrentCulture())},System$IFormattable$format:function(n,t){return this.toString$1(t)}});Bridge.define("System.FormattableStringImpl",{inherits:[System.FormattableString],args:null,format:null,ctor:function(n,t){t===void 0&&(t=[]);this.$initialize();System.FormattableString.ctor.call(this);this.format=n;this.args=t},getArgumentCount:function(){return this.args.length},getFormat:function(){return this.format},getArgument:function(n){return this.args[n]},getArguments:function(){return this.args},toString$1:function(n){return System.String.formatProvider.apply(System.String,[n,this.format].concat(this.args))}});Bridge.define("System.Runtime.CompilerServices.FormattableStringFactory",{statics:{create:function(n,t){return t===void 0&&(t=[]),new System.FormattableStringImpl(n,t)}}});Bridge.define("System.Exception",{ctor:function(n,t){this.$initialize();this.message=n?n:"Exception of type '"+Bridge.getTypeName(this)+"' was thrown.";this.innerException=t?t:null;this.errorStack=new Error;this.data=new(System.Collections.Generic.Dictionary$2(Object,Object))},getMessage:function(){return this.message},getInnerException:function(){return this.innerException},getStackTrace:function(){return this.errorStack.stack},getData:function(){return this.data},toString:function(){return this.getMessage()},statics:{create:function(n){return Bridge.is(n,System.Exception)?n:n instanceof TypeError?new System.NullReferenceException(n.message,new Bridge.ErrorException(n)):n instanceof RangeError?new System.ArgumentOutOfRangeException(null,n.message,new Bridge.ErrorException(n)):n instanceof Error?new Bridge.ErrorException(n):new System.Exception(n?n.toString():null)}}});Bridge.define("System.SystemException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"System error.",t)}});Bridge.define("System.OutOfMemoryException",{inherits:[System.SystemException],ctor:function(n,t){this.$initialize();n||(n="Insufficient memory to continue the execution of the program.");System.SystemException.ctor.call(this,n,t)}});Bridge.define("System.IndexOutOfRangeException",{inherits:[System.SystemException],ctor:function(n,t){this.$initialize();n||(n="Index was outside the bounds of the array.");System.SystemException.ctor.call(this,n,t)}});Bridge.define("System.TimeoutException",{inherits:[System.SystemException],ctor:function(n,t){this.$initialize();n||(n="The operation has timed out.");System.SystemException.ctor.call(this,n,t)}});Bridge.define("System.RegexMatchTimeoutException",{inherits:[System.TimeoutException],_regexInput:"",_regexPattern:"",_matchTimeout:null,config:{init:function(){this._matchTimeout=System.TimeSpan.fromTicks(-1)}},ctor:function(){this.$initialize();System.TimeoutException.ctor.call(this)},$ctor1:function(n){this.$initialize();System.TimeoutException.ctor.call(this,n)},$ctor2:function(n,t){this.$initialize();System.TimeoutException.ctor.call(this,n,t)},$ctor3:function(n,t,i){this.$initialize();this._regexInput=n;this._regexPattern=t;this._matchTimeout=i;this.$ctor1("The RegEx engine has timed out while trying to match a pattern to an input string. This can occur for many reasons, including very large inputs or excessive backtracking caused by nested quantifiers, back-references and other factors.")},getPattern:function(){return this._regexPattern},getInput:function(){return this._regexInput},getMatchTimeout:function(){return this._matchTimeout}});Bridge.define("Bridge.ErrorException",{inherits:[System.Exception],ctor:function(n){this.$initialize();System.Exception.ctor.call(this,n.message);this.errorStack=n;this.error=n},getError:function(){return this.error}});Bridge.define("System.ArgumentException",{inherits:[System.Exception],ctor:function(n,t,i){this.$initialize();System.Exception.ctor.call(this,n||"Value does not fall within the expected range.",i);this.paramName=t?t:null},getParamName:function(){return this.paramName}});Bridge.define("System.ArgumentNullException",{inherits:[System.ArgumentException],ctor:function(n,t,i){this.$initialize();t||(t="Value cannot be null.",n&&(t+="\nParameter name: "+n));System.ArgumentException.ctor.call(this,t,n,i)}});Bridge.define("System.ArgumentOutOfRangeException",{inherits:[System.ArgumentException],ctor:function(n,t,i,r){this.$initialize();t||(t="Value is out of range.",n&&(t+="\nParameter name: "+n));System.ArgumentException.ctor.call(this,t,n,i);this.actualValue=r?r:null},getActualValue:function(){return this.actualValue}});Bridge.define("System.Globalization.CultureNotFoundException",{inherits:[System.ArgumentException],ctor:function(n,t,i,r,u){this.$initialize();i||(i="Culture is not supported.",n&&(i+="\nParameter name: "+n),t&&(i+="\n"+t+" is an invalid culture identifier."));System.ArgumentException.ctor.call(this,i,n,r);this.invalidCultureName=t?t:null;this.invalidCultureId=u?u:null},getInvalidCultureName:function(){return this.invalidCultureName},getInvalidCultureId:function(){return this.invalidCultureId}});Bridge.define("System.Collections.Generic.KeyNotFoundException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Key not found.",t)}});Bridge.define("System.ArithmeticException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Overflow or underflow in the arithmetic operation.",t)}});Bridge.define("System.DivideByZeroException",{inherits:[System.ArithmeticException],ctor:function(n,t){this.$initialize();System.ArithmeticException.ctor.call(this,n||"Division by 0.",t)}});Bridge.define("System.OverflowException",{inherits:[System.ArithmeticException],ctor:function(n,t){this.$initialize();System.ArithmeticException.ctor.call(this,n||"Arithmetic operation resulted in an overflow.",t)}});Bridge.define("System.FormatException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Invalid format.",t)}});Bridge.define("System.InvalidCastException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"The cast is not valid.",t)}});Bridge.define("System.InvalidOperationException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Operation is not valid due to the current state of the object.",t)}});Bridge.define("System.NotImplementedException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"The method or operation is not implemented.",t)}});Bridge.define("System.NotSupportedException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Specified method is not supported.",t)}});Bridge.define("System.NullReferenceException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Object is null.",t)}});Bridge.define("System.RankException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();System.Exception.ctor.call(this,n||"Attempted to operate on an array with the incorrect number of dimensions.",t)}});Bridge.define("Bridge.PromiseException",{inherits:[System.Exception],ctor:function(n,t,i){this.$initialize();this.arguments=System.Array.clone(n);t==null&&(t="Promise exception: [",t+=this.arguments.map(function(n){return n==null?"null":n.toString()}).join(", "),t+="]");System.Exception.ctor.call(this,t,i)},getArguments:function(){return this.arguments}});Bridge.define("System.OperationCanceledException",{inherits:[System.Exception],ctor:function(n,t,i){this.$initialize();System.Exception.ctor.call(this,n||"Operation was canceled.",i);this.cancellationToken=t||System.Threading.CancellationToken.none}});Bridge.define("System.Threading.Tasks.TaskCanceledException",{inherits:[System.OperationCanceledException],ctor:function(n,t,i){this.$initialize();System.OperationCanceledException.ctor.call(this,n||"A task was canceled.",null,i);this.task=t||null}});Bridge.define("System.AggregateException",{inherits:[System.Exception],ctor:function(n,t){this.$initialize();this.innerExceptions=new(System.Collections.ObjectModel.ReadOnlyCollection$1(System.Exception))(Bridge.hasValue(t)?Bridge.toArray(t):[]);System.Exception.ctor.call(this,n||"One or more errors occurred.",this.innerExceptions.items.length?this.innerExceptions.items[0]:null)},handle:function(n){var r,i,t;if(!Bridge.hasValue(n))throw new System.ArgumentNullException("predicate");for(r=this.innerExceptions.getCount(),i=[],t=0;t0)throw new System.AggregateException(this.getMessage(),i);},flatten:function(){var e=new(System.Collections.Generic.List$1(System.Exception)),n=new(System.Collections.Generic.List$1(System.AggregateException)),r,u,t,i,f;for(n.add(this),r=0;n.getCount()>r;)for(u=n.getItem(r++).innerExceptions,t=0;t6)throw new System.ArgumentOutOfRangeException("dayofweek");return this.abbreviatedDayNames[n]},getAbbreviatedMonthName:function(n){if(n<1||n>13)throw new System.ArgumentOutOfRangeException("month");return this.abbreviatedMonthNames[n-1]},getAllDateTimePatterns:function(n,t){var i=System.Globalization.DateTimeFormatInfo.$allStandardFormats,r,e,f,u,o=[];if(n){if(!i[n]){if(t)return null;throw new System.ArgumentException(null,"format");}r={};r[n]=i[n]}else r=i;for(i in r){for(e=r[i].split(" "),f="",u=0;u6)throw new System.ArgumentOutOfRangeException("dayofweek");return this.dayNames[n]},getMonthName:function(n){if(n<1||n>13)throw new System.ArgumentOutOfRangeException("month");return this.monthNames[n-1]},getShortestDayName:function(n){if(n<0||n>6)throw new System.ArgumentOutOfRangeException("dayOfWeek");return this.shortestDayNames[n]},clone:function(){return Bridge.copy(new System.Globalization.DateTimeFormatInfo,this,["abbreviatedDayNames","abbreviatedMonthGenitiveNames","abbreviatedMonthNames","amDesignator","dateSeparator","dayNames","firstDayOfWeek","fullDateTimePattern","longDatePattern","longTimePattern","monthDayPattern","monthGenitiveNames","monthNames","pmDesignator","rfc1123","shortDatePattern","shortestDayNames","shortTimePattern","sortableDateTimePattern","timeSeparator","universalSortableDateTimePattern","yearMonthPattern","roundtripFormat"])}});Bridge.define("System.Globalization.NumberFormatInfo",{inherits:[System.IFormatProvider,System.ICloneable],config:{alias:{getFormat:"System$IFormatProvider$getFormat"}},statics:{ctor:function(){this.numberNegativePatterns=["(n)","-n","- n","n-","n -"];this.currencyNegativePatterns=["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];this.currencyPositivePatterns=["$n","n$","$ n","n $"];this.percentNegativePatterns=["-n %","-n%","-%n","%-n","%n-","n-%","n%-","-% n","n %-","% n-","% -n","n- %"];this.percentPositivePatterns=["n %","n%","%n","% n"];this.invariantInfo=Bridge.merge(new System.Globalization.NumberFormatInfo,{nanSymbol:"NaN",negativeSign:"-",positiveSign:"+",negativeInfinitySymbol:"-Infinity",positiveInfinitySymbol:"Infinity",percentSymbol:"%",percentGroupSizes:[3],percentDecimalDigits:2,percentDecimalSeparator:".",percentGroupSeparator:",",percentPositivePattern:0,percentNegativePattern:0,currencySymbol:"¤",currencyGroupSizes:[3],currencyDecimalDigits:2,currencyDecimalSeparator:".",currencyGroupSeparator:",",currencyNegativePattern:0,currencyPositivePattern:0,numberGroupSizes:[3],numberDecimalDigits:2,numberDecimalSeparator:".",numberGroupSeparator:",",numberNegativePattern:1})}},getFormat:function(n){switch(n){case System.Globalization.NumberFormatInfo:return this;default:return null}},clone:function(){return Bridge.copy(new System.Globalization.NumberFormatInfo,this,["nanSymbol","negativeSign","positiveSign","negativeInfinitySymbol","positiveInfinitySymbol","percentSymbol","percentGroupSizes","percentDecimalDigits","percentDecimalSeparator","percentGroupSeparator","percentPositivePattern","percentNegativePattern","currencySymbol","currencyGroupSizes","currencyDecimalDigits","currencyDecimalSeparator","currencyGroupSeparator","currencyNegativePattern","currencyPositivePattern","numberGroupSizes","numberDecimalDigits","numberDecimalSeparator","numberGroupSeparator","numberNegativePattern"])}});Bridge.define("System.Globalization.CultureInfo",{inherits:[System.IFormatProvider,System.ICloneable],config:{alias:{getFormat:"System$IFormatProvider$getFormat"}},$entryPoint:!0,statics:{ctor:function(){this.cultures=this.cultures||{};this.invariantCulture=Bridge.merge(new System.Globalization.CultureInfo("iv",!0),{englishName:"Invariant Language (Invariant Country)",nativeName:"Invariant Language (Invariant Country)",numberFormat:System.Globalization.NumberFormatInfo.invariantInfo,dateTimeFormat:System.Globalization.DateTimeFormatInfo.invariantInfo});this.setCurrentCulture(System.Globalization.CultureInfo.invariantCulture)},getCurrentCulture:function(){return this.currentCulture},setCurrentCulture:function(n){this.currentCulture=n;System.Globalization.DateTimeFormatInfo.currentInfo=n.dateTimeFormat;System.Globalization.NumberFormatInfo.currentInfo=n.numberFormat},getCultureInfo:function(n){if(!n)throw new System.ArgumentNullException("name");return this.cultures[n]},getCultures:function(){for(var t=Bridge.getPropertyNames(this.cultures),i=[],n=0;n0|-(n<0),n%1==.5*r)?(f=Math.floor(n),(f+(i===4?r>0:f%2*r))/u):Math.round(n)/u},log10:Math.log10||function(n){return Math.log(n)/Math.LN10},logWithBase:function(n,t){return isNaN(n)?n:isNaN(t)?t:t===1?NaN:n!==1&&(t===0||t===Number.POSITIVE_INFINITY)?NaN:Bridge.Math.log10(n)/Bridge.Math.log10(t)},log:function(n){return n===0?Number.NEGATIVE_INFINITY:n<0||isNaN(n)?NaN:n===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:n===Number.NEGATIVE_INFINITY?NaN:Math.log(n)},sinh:Math.sinh||function(n){return(Math.exp(n)-Math.exp(-n))/2},cosh:Math.cosh||function(n){return(Math.exp(n)+Math.exp(-n))/2},tanh:Math.tanh||function(n){if(n===Infinity)return 1;if(n===-Infinity)return-1;var t=Math.exp(2*n);return(t-1)/(t+1)}};yt={trueString:"True",falseString:"False",is:function(n,t){return t===System.IComparable||t===System.IEquatable$1(Boolean)||t===System.IComparable$1(Boolean)?!0:!1},$is:function(n){return typeof n=="boolean"},getDefaultValue:function(){return!1},toString:function(n){return n?System.Boolean.trueString:System.Boolean.falseString},parse:function(n){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("value");var t={v:!1};if(!System.Boolean.tryParse(n,t))throw new System.FormatException("Bad format for Boolean value");return t.v},tryParse:function(n,t){if(t.v=!1,!Bridge.hasValue(n))return!1;if(System.String.equals(System.Boolean.trueString,n,5))return t.v=!0,!0;if(System.String.equals(System.Boolean.falseString,n,5))return t.v=!1,!0;for(var i=0,r=n.length-1;i=i){if(!System.Char.isWhiteSpace(n[r])&&!System.Char.isNull(n.charCodeAt(r)))break;r--}return(n=n.substr(i,r-i+1),System.String.equals(System.Boolean.trueString,n,5))?(t.v=!0,!0):System.String.equals(System.Boolean.falseString,n,5)?(t.v=!1,!0):!1}};System.Boolean=yt,function(){var n=function(n,t,i,r){var u=Bridge.define(n,{inherits:[System.IComparable,System.IFormattable],statics:{$number:!0,min:t,max:i,precision:r,$is:function(n){return typeof n=="number"&&Math.floor(n,0)===n&&n>=t&&n<=i},getDefaultValue:function(){return 0},parse:function(n,r){return Bridge.Int.parseInt(n,t,i,r)},tryParse:function(n,r,u){return Bridge.Int.tryParseInt(n,r,t,i,u)},format:function(n,t,i){return Bridge.Int.format(n,t,i,u)}}});u.$kind="";Bridge.Class.addExtend(u,[System.IComparable$1(u),System.IEquatable$1(u)])};n("System.Byte",0,255,3);n("System.SByte",-128,127,3);n("System.Int16",-32768,32767,5);n("System.UInt16",0,65535,5);n("System.Int32",-2147483648,2147483647,10);n("System.UInt32",0,4294967295,10)}();Bridge.define("Bridge.Int",{inherits:[System.IComparable,System.IFormattable],statics:{$number:!0,$is:function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n,0)===n},getDefaultValue:function(){return 0},format:function(n,t,i,r){var e=(i||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.NumberFormatInfo),nt=e.numberDecimalSeparator,rt=e.numberGroupSeparator,f=n instanceof System.Decimal,o=n instanceof System.Int64||n instanceof System.UInt64,tt=f||o?n.isZero()?!1:n.isNegative():n<0,l,u,v,b,g,c,k,d,a;if(!o&&(f?!n.isFinite():!isFinite(n)))return Number.NEGATIVE_INFINITY===n||f&&tt?e.negativeInfinitySymbol:isNaN(n)?e.nanSymbol:e.positiveInfinitySymbol;if(t||(t="G"),l=t.match(/^([a-zA-Z])(\d*)$/),l){b=l[1].toUpperCase();u=parseInt(l[2],10);u=u>15?15:u;switch(b){case"D":return this.defaultFormat(n,isNaN(u)?1:u,0,0,e,!0);case"F":case"N":return isNaN(u)&&(u=e.numberDecimalDigits),this.defaultFormat(n,1,u,u,e,b==="F");case"G":case"E":for(var h=0,s=f||o?o&&n.eq(System.Int64.MinValue)?System.Int64(n.value.toUnsigned()):n.abs():Math.abs(n),y=l[1],it=3,p,w;f||o?s.gte(10):s>=10;)f||o?s=s.div(10):s/=10,h++;while(f||o?s.ne(0)&&s.lt(1):s!==0&&s<1)f||o?s=s.mul(10):s*=10,h--;if(b==="G"){if(g=isNaN(u),g&&(u=f?29:o?n instanceof System.Int64?19:20:r&&r.precision?r.precision:15),h>-5&&h0?h+1:1),this.defaultFormat(n,1,p,w,e,!0);y=y==="G"?"E":"e";it=2;p=0;w=(u||15)-1}else p=w=isNaN(u)?6:u;return h>=0?y+=e.positiveSign:(y+=e.negativeSign,h=-h),tt&&(f||o?s=s.mul(-1):s*=-1),this.defaultFormat(s,1,p,w,e)+y+this.defaultFormat(h,it,0,0,e,!0);case"P":return isNaN(u)&&(u=e.percentDecimalDigits),this.defaultFormat(n*100,1,u,u,e,!1,"percent");case"X":for(c=f?n.round().value.toHex().substr(2):o?n.toString(16):Math.round(n).toString(16),l[1]==="X"&&(c=c.toUpperCase()),u-=c.length;u-->0;)c="0"+c;return c;case"C":return isNaN(u)&&(u=e.currencyDecimalDigits),this.defaultFormat(n,1,u,u,e,!1,"currency");case"R":return k=f||o?n.toString():""+n,nt!=="."&&(k=k.replace(".",nt)),k.replace("e","E")}}if(t.indexOf(",.")!==-1||System.String.endsWith(t,",")){for(d=0,a=t.indexOf(",."),a===-1&&(a=t.length-1);a>-1&&t.charAt(a)===",";)d++,a--;f||o?n=n.div(Math.pow(1e3,d)):n/=Math.pow(1e3,d)}return t.indexOf("%")!==-1&&(f||o?n=n.mul(100):n*=100),t.indexOf("‰")!==-1&&(f||o?n=n.mul(1e3):n*=1e3),v=t.split(";"),(f||o?n.lt(0):n<0)&&v.length>1?(f||o?n=n.mul(-1):n*=-1,t=v[1]):t=v[(f||o?n.ne(0):!n)&&v.length>2?2:0],this.customFormat(n,t,e,!t.match(/^[^\.]*[0#],[0#]/))},defaultFormat:function(n,t,i,r,u,f,e){e=e||"number";var h=(u||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.NumberFormatInfo),o,p,w,ut,v,y,b=h[e+"GroupSizes"],s,k,d,l,a,g,nt,c="",tt=n instanceof System.Decimal,it=n instanceof System.Int64||n instanceof System.UInt64,ft=tt||it?n.isZero()?!1:n.isNegative():n<0,rt=!1;if(ut=Math.pow(10,r),o=tt?n.abs().toDecimalPlaces(r).toFixed():it?n.eq(System.Int64.MinValue)?n.value.toUnsigned().toString():n.abs().toString():""+ +Math.abs(n).toFixed(r),rt=o.split("").every(function(n){return n==="0"||n==="."}),p=o.indexOf("."),p>0&&(s=h[e+"DecimalSeparator"]+o.substr(p+1),o=o.substr(0,p)),o.lengthr&&(s=s.substr(0,r+1))):i>0&&(s=h[e+"DecimalSeparator"]+Array(i+1).join("0")),v=0,y=b[v],o.length=0?(nt&&this.addGroup(n.substr(0,f),l),this.addGroup(n.charAt(f),l)):f>=h-s&&this.addGroup("0",l),nt=0):(b-->0||f=n.length?"0":n.charAt(f),l),e=l.buffer,f++)):u==="."?(g||d||(e+=n.substr(0,h),g=!0),(n.length>++f||b>0)&&(rt=!0,e+=i[y+"DecimalSeparator"])):u!==","&&(e+=u);return tt&&!it&&(e="-"+e),e},addGroup:function(n,t){for(var i=t.buffer,f=t.sep,r=t.groupIndex,u=0,e=n.length;u1&&r--%3==1&&(i+=f);t.buffer=i;t.groupIndex=r},parseFloat:function(n,t){var i={};return Bridge.Int.tryParseFloat(n,t,i,!1),i.v},tryParseFloat:function(n,t,i,r){var l,a,u,v;if(i.v=0,r==null&&(r=!0),n==null){if(r)return!1;throw new System.ArgumentNullException("s");}n=n.trim();var f=(t||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.NumberFormatInfo),h=f.numberDecimalSeparator,e=f.numberGroupSeparator,o="Input string was not in a correct format.",s=n.indexOf(h),c=e?n.indexOf(e):-1;if(s>-1&&(s-1&&s-1)){if(r)return!1;throw new System.FormatException(o);}if(h!=="."&&e!=="."&&n.indexOf(".")>-1){if(r)return!1;throw new System.FormatException(o);}if(c>-1){for(l="",u=0;u1){if(r)return!1;throw new System.FormatException(o);}}else{if(r)return!1;throw new System.FormatException(o);}if(v=parseFloat(n.replace(h,".")),isNaN(v)){if(r)return!1;throw new System.FormatException(o);}return i.v=v,!0},parseInt:function(n,t,i,r){if(r=r||10,n==null)throw new System.ArgumentNullException("str");if(r<=10&&!/^[+-]?[0-9]+$/.test(n)||r==16&&!/^[+-]?[0-9A-F]+$/gi.test(n))throw new System.FormatException("Input string was not in a correct format.");var u=parseInt(n,r);if(isNaN(u))throw new System.FormatException("Input string was not in a correct format.");if(ui)throw new System.OverflowException;return u},tryParseInt:function(n,t,i,r,u){return(t.v=0,u=u||10,u<=10&&!/^[+-]?[0-9]+$/.test(n)||u==16&&!/^[+-]?[0-9A-F]+$/gi.test(n))?!1:(t.v=parseInt(n,u),t.vr)?!1:!0},isInfinite:function(n){return n===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY},trunc:function(n){return Bridge.isNumber(n)?n>0?Math.floor(n):Math.ceil(n):Bridge.Int.isInfinite(n)?n:null},div:function(n,t){if(!Bridge.isNumber(n)||!Bridge.isNumber(t))return null;if(t===0)throw new System.DivideByZeroException;return this.trunc(n/t)},mod:function(n,t){if(!Bridge.isNumber(n)||!Bridge.isNumber(t))return null;if(t===0)throw new System.DivideByZeroException;return n%t},check:function(n,t){if(System.Int64.is64Bit(n))return System.Int64.check(n,t);if(n instanceof System.Decimal)return System.Decimal.toInt(n,t);if(Bridge.isNumber(n)&&!t.$is(n))throw new System.OverflowException;return Bridge.Int.isInfinite(n)?t===System.Int64||t===System.UInt64?t.MinValue:t.min:n},sxb:function(n){return Bridge.isNumber(n)?n|(n&128?4294967040:0):Bridge.Int.isInfinite(n)?System.SByte.min:null},sxs:function(n){return Bridge.isNumber(n)?n|(n&32768?4294901760:0):Bridge.Int.isInfinite(n)?System.Int16.min:null},clip8:function(n){return Bridge.isNumber(n)?Bridge.Int.sxb(n&255):Bridge.Int.isInfinite(n)?System.SByte.min:null},clipu8:function(n){return Bridge.isNumber(n)?n&255:Bridge.Int.isInfinite(n)?System.Byte.min:null},clip16:function(n){return Bridge.isNumber(n)?Bridge.Int.sxs(n&65535):Bridge.Int.isInfinite(n)?System.Int16.min:null},clipu16:function(n){return Bridge.isNumber(n)?n&65535:Bridge.Int.isInfinite(n)?System.UInt16.min:null},clip32:function(n){return Bridge.isNumber(n)?n|0:Bridge.Int.isInfinite(n)?System.Int32.min:null},clipu32:function(n){return Bridge.isNumber(n)?n>>>0:Bridge.Int.isInfinite(n)?System.UInt32.min:null},clip64:function(n){return Bridge.isNumber(n)?System.Int64(Bridge.Int.trunc(n)):Bridge.Int.isInfinite(n)?System.Int64.MinValue:null},clipu64:function(n){return Bridge.isNumber(n)?System.UInt64(Bridge.Int.trunc(n)):Bridge.Int.isInfinite(n)?System.UInt64.MinValue:null},sign:function(n){return Bridge.isNumber(n)?n===0?0:n<0?-1:1:null}}});Bridge.Int.$kind="";Bridge.Class.addExtend(Bridge.Int,[System.IComparable$1(Bridge.Int),System.IEquatable$1(Bridge.Int)]);Bridge.define("System.Double",{inherits:[System.IComparable,System.IFormattable],statics:{min:-Number.MAX_VALUE,max:Number.MAX_VALUE,precision:15,$number:!0,$is:function(n){return typeof n=="number"},getDefaultValue:function(){return 0},parse:function(n,t){return Bridge.Int.parseFloat(n,t)},tryParse:function(n,t,i){return Bridge.Int.tryParseFloat(n,t,i)},format:function(n,t,i){return Bridge.Int.format(n,t,i,System.Double)}}});System.Double.$kind="";Bridge.Class.addExtend(System.Double,[System.IComparable$1(System.Double),System.IEquatable$1(System.Double)]);Bridge.define("System.Single",{inherits:[System.IComparable,System.IFormattable],statics:{min:-34028234663852886e22,max:34028234663852886e22,precision:7,$number:!0,$is:System.Double.$is,getDefaultValue:System.Double.getDefaultValue,parse:System.Double.parse,tryParse:System.Double.tryParse,format:function(n,t,i){return Bridge.Int.format(n,t,i,System.Single)}}});System.Single.$kind="";Bridge.Class.addExtend(System.Single,[System.IComparable$1(System.Single),System.IEquatable$1(System.Single)]),function(n){function i(n,t,i){this.low=n|0;this.high=t|0;this.unsigned=!!i}function u(n){return!0===(n&&n.__isLong__)}function h(n,i){var r,u;if(i){if(n>>>=0,(u=0<=n&&256>n)&&(r=p[n]))return r;r=t(n,0>(n|0)?-1:0,!0);u&&(p[n]=r)}else{if(n|=0,(u=-128<=n&&128>n)&&(r=y[n]))return r;r=t(n,0>n?-1:0,!1);u&&(y[n]=r)}return r}function f(n,i){if(isNaN(n)||!isFinite(n))return i?s:e;if(i){if(0>n)return s;if(n>=d)return k}else{if(n<=-g)return r;if(n+1>=g)return b}return 0>n?f(-n,i).neg():t(n%4294967296|0,n/4294967296|0,i)}function t(n,t,r){return new i(n,t,r)}function v(n,t,i){var s,r,u,o,h;if(0===n.length)throw Error("empty string");if("NaN"===n||"Infinity"===n||"+Infinity"===n||"-Infinity"===n)return e;if("number"==typeof t?(i=t,t=!1):t=!!t,i=i||10,2>i||36o?(o=f(l(i,o)),r=r.mul(o).add(f(h))):(r=r.mul(s),r=r.add(f(h)));return r.unsigned=t,r}function o(n){return n instanceof i?n:"number"==typeof n?f(n):"string"==typeof n?v(n):t(n.low,n.high,n.unsigned)}var y,p,l,s,c,w,a,b,k,r;n.Bridge.$Long=i;i.__isLong__;Object.defineProperty(i.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});i.isLong=u;y={};p={};i.fromInt=h;i.fromNumber=f;i.fromBits=t;l=Math.pow;i.fromString=v;i.fromValue=o;var d=4294967296*4294967296,g=d/2,nt=h(16777216),e=h(0);i.ZERO=e;s=h(0,!0);i.UZERO=s;c=h(1);i.ONE=c;w=h(1,!0);i.UONE=w;a=h(-1);i.NEG_ONE=a;b=t(-1,2147483647,!1);i.MAX_VALUE=b;k=t(-1,-1,!0);i.MAX_UNSIGNED_VALUE=k;r=t(0,-2147483648,!1);i.MIN_VALUE=r;n=i.prototype;n.toInt=function(){return this.unsigned?this.low>>>0:this.low};n.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)};n.toString=function(n){if(n=n||10,2>n||36>>0).toString(n),t=o;if(t.isZero())return i+e;for(;6>i.length;)i="0"+i;e=""+i+e}};n.getHighBits=function(){return this.high};n.getHighBitsUnsigned=function(){return this.high>>>0};n.getLowBits=function(){return this.low};n.getLowBitsUnsigned=function(){return this.low>>>0};n.getNumBitsAbs=function(){if(this.isNegative())return this.eq(r)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,n=31;0this.high};n.isPositive=function(){return this.unsigned||0<=this.high};n.isOdd=function(){return 1==(this.low&1)};n.isEven=function(){return 0==(this.low&1)};n.equals=function(n){return u(n)||(n=o(n)),this.unsigned!==n.unsigned&&1==this.high>>>31&&1==n.high>>>31?!1:this.high===n.high&&this.low===n.low};n.eq=n.equals;n.notEquals=function(n){return!this.eq(n)};n.neq=n.notEquals;n.lessThan=function(n){return 0>this.comp(n)};n.lt=n.lessThan;n.lessThanOrEqual=function(n){return 0>=this.comp(n)};n.lte=n.lessThanOrEqual;n.greaterThan=function(n){return 0>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1};n.comp=n.compare;n.negate=function(){return!this.unsigned&&this.eq(r)?r:this.not().add(c)};n.neg=n.negate;n.add=function(n){u(n)||(n=o(n));var e=this.high>>>16,i=this.high&65535,r=this.low>>>16,s=n.high>>>16,h=n.high&65535,c=n.low>>>16,f;return f=0+((this.low&65535)+(n.low&65535)),n=0+(f>>>16),n+=r+c,r=0+(n>>>16),r+=i+h,i=0+(r>>>16),i=i+(e+s)&65535,t((n&65535)<<16|f&65535,i<<16|r&65535,this.unsigned)};n.subtract=function(n){return u(n)||(n=o(n)),this.add(n.neg())};n.sub=n.subtract;n.multiply=function(n){var h,i,s,v;if(this.isZero()||(u(n)||(n=o(n)),n.isZero()))return e;if(this.eq(r))return n.isOdd()?r:e;if(n.eq(r))return this.isOdd()?r:e;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(nt)&&n.lt(nt))return f(this.toNumber()*n.toNumber(),this.unsigned);var w=this.high>>>16,y=this.high&65535,l=this.low>>>16,c=this.low&65535,b=n.high>>>16,p=n.high&65535,a=n.low>>>16;return n=n.low&65535,v=0+c*n,s=0+(v>>>16),s+=l*n,i=0+(s>>>16),s=(s&65535)+c*a,i+=s>>>16,s&=65535,i+=y*n,h=0+(i>>>16),i=(i&65535)+l*a,h+=i>>>16,i&=65535,i+=c*p,h+=i>>>16,i&=65535,h=h+(w*n+y*a+l*p+c*b)&65535,t(s<<16|v&65535,h<<16|i,this.unsigned)};n.mul=n.multiply;n.divide=function(n){var t,i,v;if(u(n)||(n=o(n)),n.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?s:e;if(this.unsigned)n.unsigned||(n=n.toUnsigned());else{if(this.eq(r))return n.eq(c)||n.eq(a)?r:n.eq(r)?c:(t=this.shr(1).div(n).shl(1),t.eq(e))?n.isNegative()?c:a:(i=this.sub(n.mul(t)),t.add(i.div(n)));if(n.eq(r))return this.unsigned?s:e;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg()}if(this.unsigned){if(n.gt(this))return s;if(n.gt(this.shru(1)))return w;v=s}else v=e;for(i=this;i.gte(n);){t=Math.max(1,Math.floor(i.toNumber()/n.toNumber()));for(var p=Math.ceil(Math.log(t)/Math.LN2),p=48>=p?1:l(2,p-48),h=f(t),y=h.mul(n);y.isNegative()||y.gt(i);)t-=p,h=f(t,this.unsigned),y=h.mul(n);h.isZero()&&(h=c);v=v.add(h);i=i.sub(y)}return v};n.div=n.divide;n.modulo=function(n){return u(n)||(n=o(n)),this.sub(this.div(n).mul(n))};n.mod=n.modulo;n.not=function(){return t(~this.low,~this.high,this.unsigned)};n.and=function(n){return u(n)||(n=o(n)),t(this.low&n.low,this.high&n.high,this.unsigned)};n.or=function(n){return u(n)||(n=o(n)),t(this.low|n.low,this.high|n.high,this.unsigned)};n.xor=function(n){return u(n)||(n=o(n)),t(this.low^n.low,this.high^n.high,this.unsigned)};n.shiftLeft=function(n){return u(n)&&(n=n.toInt()),0==(n&=63)?this:32>n?t(this.low<>>32-n,this.unsigned):t(0,this.low<n?t(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):t(this.high>>n-32,0<=this.high?0:-1,this.unsigned)};n.shr=n.shiftRight;n.shiftRightUnsigned=function(n){if(u(n)&&(n=n.toInt()),n&=63,0===n)return this;var i=this.high;return 32>n?t(this.low>>>n|i<<32-n,i>>>n,this.unsigned):32===n?t(i,0,this.unsigned):t(i>>>n-32,0,this.unsigned)};n.shru=n.shiftRightUnsigned;n.toSigned=function(){return this.unsigned?t(this.low,this.high,!1):this};n.toUnsigned=function(){return this.unsigned?this:t(this.low,this.high,!0)}}(Bridge.global);System.Int64=function(n){if(this.constructor!==System.Int64)return new System.Int64(n);Bridge.hasValue(n)||(n=0);this.T=System.Int64;this.unsigned=!1;this.value=System.Int64.getValue(n)};System.Int64.$$name="System.Int64";System.Int64.prototype.$$name="System.Int64";System.Int64.$kind="struct";System.Int64.prototype.$kind="struct";System.Int64.$$inherits=[];Bridge.Class.addExtend(System.Int64,[System.IComparable,System.IFormattable,System.IComparable$1(System.Int64),System.IEquatable$1(System.Int64)]);System.Int64.$is=function(n){return n instanceof System.Int64};System.Int64.is64Bit=function(n){return n instanceof System.Int64||n instanceof System.UInt64};System.Int64.getDefaultValue=function(){return System.Int64.Zero};System.Int64.getValue=function(n){return Bridge.hasValue(n)?n instanceof Bridge.$Long?n:n instanceof System.Int64?n.value:n instanceof System.UInt64?n.value.toSigned():Bridge.isArray(n)?new Bridge.$Long(n[0],n[1]):Bridge.isString(n)?Bridge.$Long.fromString(n):Bridge.isNumber(n)?Bridge.$Long.fromNumber(n):n instanceof System.Decimal?Bridge.$Long.fromString(n.toString()):Bridge.$Long.fromValue(n):null};System.Int64.create=function(n){return Bridge.hasValue(n)?n instanceof System.Int64?n:new System.Int64(n):null};System.Int64.lift=function(n){return Bridge.hasValue(n)?System.Int64.create(n):null};System.Int64.toNumber=function(n){return n?n.toNumber():null};System.Int64.prototype.toNumberDivided=function(n){var t=this.div(n),i=this.mod(n),r=i.toNumber()/n;return t.toNumber()+r};System.Int64.prototype.toJSON=function(){return this.toNumber()};System.Int64.prototype.toString=function(n,t){return!n&&!t?this.value.toString():Bridge.isNumber(n)&&!t?this.value.toString(n):Bridge.Int.format(this,n,t)};System.Int64.prototype.format=function(n,t){return Bridge.Int.format(this,n,t)};System.Int64.prototype.isNegative=function(){return this.value.isNegative()};System.Int64.prototype.abs=function(){if(this.T===System.Int64&&this.eq(System.Int64.MinValue))throw new System.OverflowException;return new this.T(this.value.isNegative()?this.value.neg():this.value)};System.Int64.prototype.compareTo=function(n){return this.value.compare(this.T.getValue(n))};System.Int64.prototype.add=function(n,t){var i=this.T.getValue(n),r=new this.T(this.value.add(i));if(t){var u=this.value.isNegative(),f=i.isNegative(),e=r.value.isNegative();if(u&&f&&!e||!u&&!f&&e||this.T===System.UInt64&&r.lt(System.UInt64.max(this,i)))throw new System.OverflowException;}return r};System.Int64.prototype.sub=function(n,t){var i=this.T.getValue(n),r=new this.T(this.value.sub(i));if(t){var u=this.value.isNegative(),f=i.isNegative(),e=r.value.isNegative();if(u&&!f&&!e||!u&&f&&e||this.T===System.UInt64&&this.value.lt(i))throw new System.OverflowException;}return r};System.Int64.prototype.isZero=function(){return this.value.isZero()};System.Int64.prototype.mul=function(n,t){var i=this.T.getValue(n),r=new this.T(this.value.mul(i)),u;if(t){var f=this.sign(),e=i.isZero()?0:i.isNegative()?-1:1,o=r.sign();if(this.T===System.Int64){if(this.eq(System.Int64.MinValue)||this.eq(System.Int64.MaxValue)){if(i.neq(1)&&i.neq(0))throw new System.OverflowException;return r}if(i.eq(Bridge.$Long.MIN_VALUE)||i.eq(Bridge.$Long.MAX_VALUE)){if(this.neq(1)&&this.neq(0))throw new System.OverflowException;return r}if(f===-1&&e===-1&&o!==1||f===1&&e===1&&o!==1||f===-1&&e===1&&o!==-1||f===1&&e===-1&&o!==-1)throw new System.OverflowException;if(u=r.abs(),u.lt(this.abs())||u.lt(System.Int64(i).abs()))throw new System.OverflowException;}else{if(this.eq(System.UInt64.MaxValue)){if(i.neq(1)&&i.neq(0))throw new System.OverflowException;return r}if(i.eq(Bridge.$Long.MAX_UNSIGNED_VALUE)){if(this.neq(1)&&this.neq(0))throw new System.OverflowException;return r}if(u=r.abs(),u.lt(this.abs())||u.lt(System.Int64(i).abs()))throw new System.OverflowException;}}return r};System.Int64.prototype.div=function(n){return new this.T(this.value.div(this.T.getValue(n)))};System.Int64.prototype.mod=function(n){return new this.T(this.value.mod(this.T.getValue(n)))};System.Int64.prototype.neg=function(n){if(n&&this.T===System.Int64&&this.eq(System.Int64.MinValue))throw new System.OverflowException;return new this.T(this.value.neg())};System.Int64.prototype.inc=function(n){return this.add(1,n)};System.Int64.prototype.dec=function(n){return this.sub(1,n)};System.Int64.prototype.sign=function(){return this.value.isZero()?0:this.value.isNegative()?-1:1};System.Int64.prototype.clone=function(){return new this.T(this)};System.Int64.prototype.ne=function(n){return this.value.neq(this.T.getValue(n))};System.Int64.prototype.neq=function(n){return this.value.neq(this.T.getValue(n))};System.Int64.prototype.eq=function(n){return this.value.eq(this.T.getValue(n))};System.Int64.prototype.lt=function(n){return this.value.lt(this.T.getValue(n))};System.Int64.prototype.lte=function(n){return this.value.lte(this.T.getValue(n))};System.Int64.prototype.gt=function(n){return this.value.gt(this.T.getValue(n))};System.Int64.prototype.gte=function(n){return this.value.gte(this.T.getValue(n))};System.Int64.prototype.equals=function(n){return this.value.eq(this.T.getValue(n))};System.Int64.prototype.equalsT=function(n){return this.equals(n)};System.Int64.prototype.getHashCode=function(){var n=this.sign()*397+this.value.high|0;return n*397+this.value.low|0};System.Int64.prototype.toNumber=function(){return this.value.toNumber()};System.Int64.parse=function(n){if(n==null)throw new System.ArgumentNullException("str");if(!/^[+-]?[0-9]+$/.test(n))throw new System.FormatException("Input string was not in a correct format.");var t=new System.Int64(n);if(n!==t.toString())throw new System.OverflowException;return t};System.Int64.tryParse=function(n,t){try{return n==null||!/^[+-]?[0-9]+$/.test(n)?(t.v=System.Int64(Bridge.$Long.ZERO),!1):(t.v=new System.Int64(n),n!==t.v.toString())?(t.v=System.Int64(Bridge.$Long.ZERO),!1):!0}catch(i){return t.v=System.Int64(Bridge.$Long.ZERO),!1}};System.Int64.divRem=function(n,t,i){n=System.Int64(n);t=System.Int64(t);var r=n.mod(t);return i.v=r,n.sub(r).div(t)};System.Int64.min=function(){for(var t=[],i,n=0,r=arguments.length;n>>0:Bridge.Int.isInfinite(n)?System.UInt32.min:null};System.Int64.clip64=function(n){return n?new System.Int64(n.value.toSigned()):Bridge.Int.isInfinite(n)?System.Int64.MinValue:null};System.Int64.clipu64=function(n){return n?new System.UInt64(n.value.toUnsigned()):Bridge.Int.isInfinite(n)?System.UInt64.MinValue:null};System.Int64.Zero=System.Int64(Bridge.$Long.ZERO);System.Int64.MinValue=System.Int64(Bridge.$Long.MIN_VALUE);System.Int64.MaxValue=System.Int64(Bridge.$Long.MAX_VALUE);System.Int64.precision=19;System.UInt64=function(n){if(this.constructor!==System.UInt64)return new System.UInt64(n);Bridge.hasValue(n)||(n=0);this.T=System.UInt64;this.unsigned=!0;this.value=System.UInt64.getValue(n,!0)};System.UInt64.$$name="System.UInt64";System.UInt64.prototype.$$name="System.UInt64";System.UInt64.$kind="struct";System.UInt64.prototype.$kind="struct";System.UInt64.$$inherits=[];Bridge.Class.addExtend(System.UInt64,[System.IComparable,System.IFormattable,System.IComparable$1(System.UInt64),System.IEquatable$1(System.UInt64)]);System.UInt64.$is=function(n){return n instanceof System.UInt64};System.UInt64.getDefaultValue=function(){return System.UInt64.Zero};System.UInt64.getValue=function(n){return Bridge.hasValue(n)?n instanceof Bridge.$Long?n:n instanceof System.UInt64?n.value:n instanceof System.Int64?n.value.toUnsigned():Bridge.isArray(n)?new Bridge.$Long(n[0],n[1],!0):Bridge.isString(n)?Bridge.$Long.fromString(n,!0):Bridge.isNumber(n)?Bridge.$Long.fromNumber(n,!0):n instanceof System.Decimal?Bridge.$Long.fromString(n.toString(),!0):Bridge.$Long.fromValue(n):null};System.UInt64.create=function(n){return Bridge.hasValue(n)?n instanceof System.UInt64?n:new System.UInt64(n):null};System.UInt64.lift=function(n){return Bridge.hasValue(n)?System.UInt64.create(n):null};System.UInt64.prototype.toJSON=System.Int64.prototype.toJSON;System.UInt64.prototype.toString=System.Int64.prototype.toString;System.UInt64.prototype.format=System.Int64.prototype.format;System.UInt64.prototype.isNegative=System.Int64.prototype.isNegative;System.UInt64.prototype.abs=System.Int64.prototype.abs;System.UInt64.prototype.compareTo=System.Int64.prototype.compareTo;System.UInt64.prototype.add=System.Int64.prototype.add;System.UInt64.prototype.sub=System.Int64.prototype.sub;System.UInt64.prototype.isZero=System.Int64.prototype.isZero;System.UInt64.prototype.mul=System.Int64.prototype.mul;System.UInt64.prototype.div=System.Int64.prototype.div;System.UInt64.prototype.toNumberDivided=System.Int64.prototype.toNumberDivided;System.UInt64.prototype.mod=System.Int64.prototype.mod;System.UInt64.prototype.neg=System.Int64.prototype.neg;System.UInt64.prototype.inc=System.Int64.prototype.inc;System.UInt64.prototype.dec=System.Int64.prototype.dec;System.UInt64.prototype.sign=System.Int64.prototype.sign;System.UInt64.prototype.clone=System.Int64.prototype.clone;System.UInt64.prototype.ne=System.Int64.prototype.ne;System.UInt64.prototype.neq=System.Int64.prototype.neq;System.UInt64.prototype.eq=System.Int64.prototype.eq;System.UInt64.prototype.lt=System.Int64.prototype.lt;System.UInt64.prototype.lte=System.Int64.prototype.lte;System.UInt64.prototype.gt=System.Int64.prototype.gt;System.UInt64.prototype.gte=System.Int64.prototype.gte;System.UInt64.prototype.equals=System.Int64.prototype.equals;System.UInt64.prototype.equalsT=System.Int64.prototype.equalsT;System.UInt64.prototype.getHashCode=System.Int64.prototype.getHashCode;System.UInt64.prototype.toNumber=System.Int64.prototype.toNumber;System.UInt64.parse=function(n){if(n==null)throw new System.ArgumentNullException("str");if(!/^[+-]?[0-9]+$/.test(n))throw new System.FormatException("Input string was not in a correct format.");var t=new System.UInt64(n);if(t.value.isNegative())throw new System.OverflowException;if(n!==t.toString())throw new System.OverflowException;return t};System.UInt64.tryParse=function(n,t){try{return n==null||!/^[+-]?[0-9]+$/.test(n)?(t.v=System.UInt64(Bridge.$Long.UZERO),!1):(t.v=new System.UInt64(n),t.v.isNegative())?(t.v=System.UInt64(Bridge.$Long.UZERO),!1):n!==t.v.toString()?(t.v=System.UInt64(Bridge.$Long.UZERO),!1):!0}catch(i){return t.v=System.UInt64(Bridge.$Long.UZERO),!1}};System.UInt64.min=function(){for(var t=[],i,n=0,r=arguments.length;n0){for(e+=t,u=1;o>u;u++)f=n[u]+"",i=r-f.length,i&&(e+=k(i)),e+=f;t=n[u];f=t+"";i=r-f.length;i&&(e+=k(i))}else if(0===t)return"0";for(;t%10==0;)t/=10;return e+t}function c(n,t,i){if(n!==~~n||t>n||n>i)throw Error(nt+n);}function rt(n,t,i,u){for(var o,s,f,e=n[0];e>=10;e/=10)--t;return--t<0?(t+=r,o=0):(o=Math.ceil((t+1)/r),t%=r),e=h(10,r-t),f=n[o]%e|0,null==u?3>t?(0==t?f=f/100|0:1==t&&(f=f/10|0),s=4>i&&99999==f||i>3&&49999==f||5e4==f||0==f):s=(4>i&&f+1==e||i>3&&f+1==e/2)&&(n[o+1]/e/100|0)==h(10,t-2)-1||(f==e/2||0==f)&&0==(n[o+1]/e/100|0):4>t?(0==t?f=f/1e3|0:1==t?f=f/100|0:2==t&&(f=f/10|0),s=(u||4>i)&&9999==f||!u&&i>3&&4999==f):s=((u||4>i)&&f+1==e||!u&&i>3&&f+1==e/2)&&(n[o+1]/e/1e3|0)==h(10,t-3)-1,s}function w(n,t,i){for(var u,f,r=[0],e=0,s=n.length;s>e;){for(f=r.length;f--;)r[f]*=t;for(r[0]+=o.indexOf(n.charAt(e++)),u=0;ui-1&&(void 0===r[u+1]&&(r[u+1]=0),r[u+1]+=r[u]/i|0,r[u]%=i)}return r.reverse()}function ri(n,t){var i,u,f=t.d.length,e,r;for(32>f?(i=Math.ceil(f/3),u=Math.pow(4,-i).toString()):(i=16,u="2.3283064365386962890625e-10"),n.precision+=i,t=tt(n,1,t.times(u),new n(1)),e=i;e--;)r=t.times(t),t=r.times(r).minus(r).times(8).plus(1);return n.precision-=i,t}function i(n,t,i,f){var a,c,o,s,p,w,v,e,l,b=n.constructor;n:if(null!=t){if(e=n.d,!e)return n;for(a=1,s=e[0];s>=10;s/=10)a++;if(c=t-a,0>c)c+=r,o=t,v=e[l=0],p=v/h(10,a-o-1)%10|0;else if(l=Math.ceil((c+1)/r),s=e.length,l>=s){if(!f)break n;for(;s++<=l;)e.push(0);v=p=0;a=1;c%=r;o=c-r+1}else{for(v=s=e[l],a=1;s>=10;s/=10)a++;c%=r;o=c-r+a;p=0>o?0:v/h(10,a-o-1)%10|0}if(f=f||0>t||void 0!==e[l+1]||(0>o?v:v%h(10,a-o-1)),w=4>i?(p||f)&&(0==i||i==(n.s<0?3:2)):p>5||5==p&&(4==i||f||6==i&&(c>0?o>0?v/h(10,a-o):0:e[l-1])%10&1||i==(n.s<0?8:7)),1>t||!e[0])return e.length=0,w?(t-=n.e+1,e[0]=h(10,(r-t%r)%r),n.e=-t||0):e[0]=n.e=0,n;if(0==c?(e.length=l,s=1,l--):(e.length=l+1,s=h(10,r-c),e[l]=o>0?(v/h(10,a-o)%h(10,o)|0)*s:0),w)for(;;){if(0==l){for(c=1,o=e[0];o>=10;o/=10)c++;for(o=e[0]+=s,s=1;o>=10;o/=10)s++;c!=s&&(n.e++,e[0]==y&&(e[0]=1));break}if(e[l]+=s,e[l]!=y)break;e[l--]=0;s=1}for(c=e.length;0===e[--c];)e.pop()}return u&&(n.e>b.maxE?(n.d=null,n.e=NaN):n.e0?r=r.charAt(0)+"."+r.slice(1)+k(u):f>1&&(r=r.charAt(0)+"."+r.slice(1)),r=r+(n.e<0?"e":"e+")+n.e):0>o?(r="0."+k(-o-1)+r,i&&(u=i-f)>0&&(r+=k(u))):o>=f?(r+=k(o+1-f),i&&(u=i-o-1)>0&&(r=r+"."+k(u))):((u=o+1)0&&(o+1===f&&(r+="."),r+=k(u))),r}function ut(n,t){for(var i=1,u=n[0];u>=10;u/=10)i++;return i+t*r-1}function ft(n,t,r){if(t>ou)throw u=!0,r&&(n.precision=r),Error(ii);return i(new n(et),t,1,!0)}function a(n,t,r){if(t>lt)throw Error(ii);return i(new n(ot),t,r,!0)}function at(n){var t=n.length-1,i=t*r+1;if(t=n[t]){for(;t%10==0;t/=10)i--;for(t=n[0];t>=10;t/=10)i++}return i}function k(n){for(var t="";n--;)t+="0";return t}function vt(n,t,i,f){var o,e=new n(1),h=Math.ceil(f/r+4);for(u=!1;;){if(i%2&&(e=e.times(t),dt(e.d,h)&&(o=!0)),i=s(i/2),0===i){i=e.d.length-1;o&&0===e.d[i]&&++e.d[i];break}t=t.times(t);dt(t.d,h)}return u=!0,e}function yt(n){return 1&n.d[n.d.length-1]}function pt(n,t,i){for(var r,u=new n(t[0]),f=0;++f17)return new s(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(null==t?(u=!1,r=w):r=t,c=new s(.03125);n.e>-2;)n=n.times(c),p+=5;for(v=Math.log(h(2,p))/Math.LN10*2+5|0,r+=v,l=a=o=new s(1),s.precision=r;;){if(a=i(a.times(n),r,1),l=l.times(++k),c=o.plus(f(a,l,r,1)),e(c.d).slice(0,r)===e(o.d).slice(0,r)){for(b=p;b--;)o=i(o.times(o),r,1);if(null!=t)return s.precision=w,o;if(!(3>y&&rt(o.d,r-v,d,y)))return i(o,s.precision=w,d,u=!0);s.precision=r+=10;l=a=c=new s(1);k=0;y++}o=c}}function d(n,t){var c,l,b,y,w,it,h,p,o,g,nt,ut=1,k=10,r=n,a=r.d,s=r.constructor,tt=s.rounding,v=s.precision;if(r.s<0||!a||!a[0]||!r.e&&1==a[0]&&1==a.length)return new s(a&&!a[0]?-1/0:1!=r.s?NaN:a?0:r);if(null==t?(u=!1,o=v):o=t,s.precision=o+=k,c=e(a),l=c.charAt(0),!(Math.abs(y=r.e)<15e14))return p=ft(s,o+2,v).times(y+""),r=d(new s(l+"."+c.slice(1)),o-k).plus(p),s.precision=v,null==t?i(r,v,tt,u=!0):r;for(;7>l&&1!=l||1==l&&c.charAt(1)>3;)r=r.times(n),c=e(r.d),l=c.charAt(0),ut++;for(y=r.e,l>1?(r=new s("0."+c),y++):r=new s(l+"."+c.slice(1)),g=r,h=w=r=f(r.minus(1),r.plus(1),o,1),nt=i(r.times(r),o,1),b=3;;){if(w=i(w.times(nt),o,1),p=h.plus(f(w,new s(b),o,1)),e(p.d).slice(0,o)===e(h.d).slice(0,o)){if(h=h.times(2),0!==y&&(h=h.plus(ft(s,o+2,v).times(y+""))),h=f(h,new s(ut),o,1),null!=t)return s.precision=v,h;if(!rt(h.d,o-k,tt,it))return i(h,s.precision=v,tt,u=!0);s.precision=o+=k;p=w=r=f(g.minus(1),g.plus(1),o,1);nt=i(r.times(r),o,1);b=it=1}h=p;b+=2}}function wt(n){return String(n.s*n.s/0)}function bt(n,t){var f,i,e;for((f=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(0>f&&(f=i),f+=+t.slice(i+1),t=t.substring(0,i)):0>f&&(f=t.length),i=0;48===t.charCodeAt(i);i++);for(e=t.length;48===t.charCodeAt(e-1);--e);if(t=t.slice(i,e)){if(e-=i,n.e=f=f-i-1,n.d=[],i=(f+1)%r,0>f&&(i+=r),e>i){for(i&&n.d.push(+t.slice(0,i)),e-=r;e>i;)n.d.push(+t.slice(i,i+=r));t=t.slice(i);i=r-t.length}else i-=e;for(;i--;)t+="0";n.d.push(+t);u&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e0?(o=+t.slice(i+1),t=t.substring(2,i)):t=t.slice(2),i=t.indexOf("."),h=i>=0,s=n.constructor,h&&(t=t.replace(".",""),c=t.length,i=c-i,a=vt(s,new s(e),i,2*i)),r=w(t,e,y),l=r.length-1,i=l;0===r[i];--i)r.pop();return 0>i?new s(0*n.s):(n.e=ut(r,l),n.d=r,u=!1,h&&(n=f(n,a,4*c)),o&&(n=n.times(Math.abs(o)<54?Math.pow(2,o):v.pow(2,o))),u=!0,n)}function fi(n,t){var i,u=t.d.length;if(3>u)return tt(n,2,t,t);i=1.4*Math.sqrt(u);i=i>16?16:0|i;t=t.times(Math.pow(5,-i));t=tt(n,2,t,t);for(var r,f=new n(5),e=new n(16),o=new n(20);i--;)r=t.times(t),t=t.times(f.plus(r.times(e.times(r).minus(o))));return t}function tt(n,t,i,e,o){var h,s,c,l,y=1,a=n.precision,v=Math.ceil(a/r);for(u=!1,l=i.times(i),c=new n(e);;){if(s=f(c.times(l),new n(t++*t++),a,1),c=o?e.plus(s):e.minus(s),e=f(s.times(l),new n(t++*t++),a,1),s=c.plus(e),void 0!==s.d[v]){for(h=v;s.d[h]===c.d[h]&&h--;);if(-1==h)break}h=c;c=e;e=s;s=h;y++}return u=!0,s.d.length=v+1,s}function kt(n,t){var r,i=t.s<0,u=a(n,n.precision,1),f=u.times(.5);if(t=t.abs(),t.lte(f))return b=i?4:1,t;if(r=t.divToInt(u),r.isZero())b=i?3:2;else{if(t=t.minus(r.times(u)),t.lte(f))return b=yt(r)?i?2:3:i?4:1,t;b=yt(r)?i?1:4:i?3:2}return t.minus(u).abs()}function ct(n,t,i,r){var a,l,s,d,h,v,u,e,y,b=n.constructor,k=void 0!==i;if(k?(c(i,1,g),void 0===r?r=b.rounding:c(r,0,8)):(i=b.precision,r=b.rounding),n.isFinite()){for(u=p(n),s=u.indexOf("."),k?(a=2,16==t?i=4*i-3:8==t&&(i=3*i-2)):a=t,s>=0&&(u=u.replace(".",""),y=new b(1),y.e=u.length-s,y.d=w(p(y),10,a),y.e=y.d.length),e=w(u,10,a),l=h=e.length;0==e[--h];)e.pop();if(e[0]){if(0>s?l--:(n=new b(n),n.d=e,n.e=l,n=f(n,y,i,r,0,a),e=n.d,l=n.e,v=ni),s=e[i],d=a/2,v=v||void 0!==e[i+1],v=4>r?(void 0!==s||v)&&(0===r||r===(n.s<0?3:2)):s>d||s===d&&(4===r||v||6===r&&1&e[i-1]||r===(n.s<0?8:7)),e.length=i,v)for(;++e[--i]>a-1;)e[i]=0,i||(++l,e.unshift(1));for(h=e.length;!e[h-1];--h);for(s=0,u="";h>s;s++)u+=o.charAt(e[s]);if(k){if(h>1)if(16==t||8==t){for(s=16==t?4:3,--h;h%s;h++)u+="0";for(e=w(u,a,t),h=e.length;!e[h-1];--h);for(s=1,u="1.";h>s;s++)u+=o.charAt(e[s])}else u=u.charAt(0)+"."+u.slice(1);u=u+(0>l?"p":"p+")+l}else if(0>l){for(;++l;)u="0"+u;u="0."+u}else if(++l>h)for(l-=h;l--;)u+="0";else h>l&&(u=u.slice(0,l)+"."+u.slice(l))}else u=k?"0p+0":"0";u=(16==t?"0x":2==t?"0b":8==t?"0o":"")+u}else u=wt(n);return n.s<0?"-"+u:u}function dt(n,t){if(n.length>t)return(n.length=t,!0)}function ei(n){return new this(n).abs()}function oi(n){return new this(n).acos()}function si(n){return new this(n).acosh()}function hi(n,t){return new this(n).plus(t)}function ci(n){return new this(n).asin()}function li(n){return new this(n).asinh()}function ai(n){return new this(n).atan()}function vi(n){return new this(n).atanh()}function yi(n,t){n=new this(n);t=new this(t);var i,u=this.precision,e=this.rounding,r=u+4;return n.s&&t.s?n.d||t.d?!t.d||n.isZero()?(i=t.s<0?a(this,u,e):new this(0),i.s=n.s):!n.d||t.isZero()?(i=a(this,r,1).times(.5),i.s=n.s):t.s<0?(this.precision=r,this.rounding=1,i=this.atan(f(n,t,r,1)),t=a(this,r,1),this.precision=u,this.rounding=e,i=n.s<0?i.minus(t):i.plus(t)):i=this.atan(f(n,t,r,1)):(i=a(this,r,1).times(t.s>0?.25:.75),i.s=n.s):i=new this(NaN),i}function pi(n){return new this(n).cbrt()}function wi(n){return i(n=new this(n),n.e+1,2)}function bi(n){if(!n||"object"!=typeof n)throw Error(st+"Object expected");for(var i,t,u=["precision",1,g,"rounding",0,8,"toExpNeg",-it,0,"toExpPos",0,it,"maxE",0,it,"minE",-it,0,"modulo",0,9],r=0;r=u[r+1]&&t<=u[r+2]))throw Error(nt+i+": "+t);this[i]=t}if(n.hasOwnProperty(i="crypto"))if(void 0===(t=n[i]))this[i]=t;else{if(t!==!0&&t!==!1&&0!==t&&1!==t)throw Error(nt+i+": "+t);this[i]=!(!t||!l||!l.getRandomValues&&!l.randomBytes)}return this}function ki(n){return new this(n).cos()}function di(n){return new this(n).cosh()}function gt(n){function i(n){var r,u,f,t=this;if(!(t instanceof i))return new i(n);if(t.constructor=i,n instanceof i)return t.s=n.s,t.e=n.e,void(t.d=(n=n.d)?n.slice():n);if(f=typeof n,"number"===f){if(0===n)return t.s=0>1/n?-1:1,t.e=0,void(t.d=[0]);if(0>n?(n=-n,t.s=-1):t.s=1,n===~~n&&1e7>n){for(r=0,u=n;u>=10;u/=10)r++;return t.e=r,void(t.d=[n])}return 0*n!=0?(n||(t.s=NaN),t.e=NaN,void(t.d=null)):bt(t,n.toString())}if("string"!==f)throw Error(nt+n);return 45===n.charCodeAt(0)?(n=n.slice(1),t.s=-1):t.s=1,fu.test(n)?bt(t,n):ui(t,n)}var r,u,f;if(i.prototype=t,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=bi,i.clone=gt,i.abs=ei,i.acos=oi,i.acosh=si,i.add=hi,i.asin=ci,i.asinh=li,i.atan=ai,i.atanh=vi,i.atan2=yi,i.cbrt=pi,i.ceil=wi,i.cos=ki,i.cosh=di,i.div=gi,i.exp=nr,i.floor=tr,i.fromJSON=ir,i.hypot=rr,i.ln=ur,i.log=fr,i.log10=or,i.log2=er,i.max=sr,i.min=hr,i.mod=cr,i.mul=lr,i.pow=ar,i.random=vr,i.round=yr,i.sign=pr,i.sin=wr,i.sinh=br,i.sqrt=kr,i.sub=dr,i.tan=gr,i.tanh=nu,i.trunc=tu,void 0===n&&(n={}),n)for(f=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r81?[-1/0,1/0,NaN][t-82]:t>40?-(t-41):t);if(64&t)u=16&t,i=u?(7&t)-3:(15&t)-7,r=1;else{if(2===r)return t=88*t+o.indexOf(n.charAt(1)),new this(t>=2816?-(t-2816)-41:t+41);if(u=32&t,!(31&t))return n=w(n.slice(1),88,10).join(""),new this(u?"-"+n:n);i=15&t;r=i+1;i=1===i?o.indexOf(n.charAt(1)):2===i?88*o.indexOf(n.charAt(1))+o.indexOf(n.charAt(2)):+w(n.slice(1,r),88,10).join("");16&t&&(i=-i)}return n=w(n.slice(r),88,10).join(""),i=i-n.length+1,n=n+"e"+i,new this(u?"-"+n:n)}function rr(){var i,n,t=new this(0);for(u=!1,i=0;it;)u[t++]=1e7*Math.random()|0;else if(l&&l.getRandomValues)for(e=l.getRandomValues(new Uint32Array(i));i>t;)f=e[t],f>=429e7?e[t]=l.getRandomValues(new Uint32Array(1))[0]:u[t++]=f%1e7;else if(l&&l.randomBytes){for(e=l.randomBytes(i*=4);i>t;)f=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+((127&e[t+3])<<24),f>=214e7?l.randomBytes(4).copy(e,t):(u.push(f%1e7),t+=4);t=i/4}else{if(this.crypto)throw Error(st+"crypto unavailable");for(;i>t;)u[t++]=1e7*Math.random()|0}for(i=u[--t],n%=r,i&&n&&(f=h(10,r-n),u[t]=(i/f|0)*f);0===u[t];t--)u.pop();if(0>t)o=0,u=[0];else{for(o=-1;0===u[0];o-=r)u.shift();for(i=1,f=u[0];f>=10;f/=10)i++;r>i&&(o-=r-i)}return s.e=o,s.d=u,s}function yr(n){return i(n=new this(n),n.e+1,this.rounding)}function pr(n){return n=new this(n),n.d?n.d[0]?n.s:0*n.s:n.s||NaN}function wr(n){return new this(n).sin()}function br(n){return new this(n).sinh()}function kr(n){return new this(n).sqrt()}function dr(n,t){return new this(n).sub(t)}function gr(n){return new this(n).tan()}function nu(n){return new this(n).tanh()}function tu(n){return i(n=new this(n),n.e+1,1)}var ni,ti,b,it=9e15,g=1e9,o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%()*+,-./:;=?@[]^_`{|}~",et="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",ot="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",v={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-it,maxE:it,crypto:void 0},l="undefined"!=typeof crypto?crypto:null,u=!0,st="[DecimalError] ",nt=st+"Invalid argument: ",ii=st+"Precision limit exceeded",s=Math.floor,h=Math.pow,iu=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ru=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,uu=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,fu=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=1e7,r=7,eu=9007199254740991,ou=et.length-1,lt=ot.length-1,t={},f;if(t.absoluteValue=t.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),i(n)},t.ceil=function(){return i(new this.constructor(this),this.e+1,2)},t.comparedTo=t.cmp=function(n){var r,h,f,e,o=this,i=o.d,u=(n=new o.constructor(n)).d,t=o.s,s=n.s;if(!i||!u)return t&&s?t!==s?t:i===u?0:!i^0>t?1:-1:NaN;if(!i[0]||!u[0])return i[0]?t:u[0]?-s:0;if(t!==s)return t;if(o.e!==n.e)return o.e>n.e^0>t?1:-1;for(f=i.length,e=u.length,r=0,h=e>f?f:e;h>r;++r)if(i[r]!==u[r])return i[r]>u[r]^0>t?1:-1;return f===e?0:f>e^0>t?1:-1},t.cosine=t.cos=function(){var u,f,t=this,n=t.constructor;return t.d?t.d[0]?(u=n.precision,f=n.rounding,n.precision=u+Math.max(t.e,t.sd())+r,n.rounding=1,t=ri(n,kt(n,t)),n.precision=u,n.rounding=f,i(2==b||3==b?t.neg():t,u,f,!0)):new n(1):new n(NaN)},t.cubeRoot=t.cbrt=function(){var r,w,n,o,v,c,l,h,y,p,t=this,a=t.constructor;if(!t.isFinite()||t.isZero())return new a(t);for(u=!1,c=t.s*Math.pow(t.s*t,1/3),c&&Math.abs(c)!=1/0?o=new a(c.toString()):(n=e(t.d),r=t.e,(c=(r-n.length+1)%3)&&(n+=1==c||-2==c?"0":"00"),c=Math.pow(n,1/3),r=s((r+1)/3)-(r%3==(0>r?-1:2)),c==1/0?n="5e"+r:(n=c.toExponential(),n=n.slice(0,n.indexOf("e")+1)+r),o=new a(n),o.s=t.s),l=(r=a.precision)+3;;)if(h=o,y=h.times(h).times(h),p=y.plus(t),o=f(p.plus(t).times(h),p.plus(y),l+2,1),e(h.d).slice(0,l)===(n=e(o.d)).slice(0,l)){if(n=n.slice(l-3,l+1),"9999"!=n&&(v||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(i(o,r+1,1),w=!o.times(o).times(o).eq(t));break}if(!v&&(i(h,r+1,0),h.times(h).times(h).eq(t))){o=h;break}l+=4;v=1}return u=!0,i(o,r,a.rounding,w)},t.decimalPlaces=t.dp=function(){var n,i=this.d,t=NaN;if(i){if(n=i.length-1,t=(n-s(this.e/r))*r,n=i[n])for(;n%10==0;n/=10)t--;0>t&&(t=0)}return t},t.dividedBy=t.div=function(n){return f(this,new this.constructor(n))},t.dividedToIntegerBy=t.divToInt=function(n){var r=this,t=r.constructor;return i(f(r,new t(n),0,1,1),t.precision,t.rounding)},t.equals=t.eq=function(n){return 0===this.cmp(n)},t.floor=function(){return i(new this.constructor(this),this.e+1,3)},t.greaterThan=t.gt=function(n){return this.cmp(n)>0},t.greaterThanOrEqualTo=t.gte=function(n){var t=this.cmp(n);return 1==t||0===t},t.hyperbolicCosine=t.cosh=function(){var r,u,f,h,e,n=this,t=n.constructor,c=new t(1),o,l,s;if(!n.isFinite())return new t(n.s?1/0:NaN);if(n.isZero())return c;for(f=t.precision,h=t.rounding,t.precision=f+Math.max(n.e,n.sd())+4,t.rounding=1,e=n.d.length,32>e?(r=Math.ceil(e/3),u=Math.pow(4,-r).toString()):(r=16,u="2.3283064365386962890625e-10"),n=tt(t,1,n.times(u),new t(1),!0),l=r,s=new t(8);l--;)o=n.times(n),n=c.minus(o.times(s.minus(o.times(s))));return i(n,t.precision=f,t.rounding=h,!0)},t.hyperbolicSine=t.sinh=function(){var r,u,f,e,n=this,t=n.constructor;if(!n.isFinite()||n.isZero())return new t(n);if(u=t.precision,f=t.rounding,t.precision=u+Math.max(n.e,n.sd())+4,t.rounding=1,e=n.d.length,3>e)n=tt(t,2,n,n,!0);else{r=1.4*Math.sqrt(e);r=r>16?16:0|r;n=n.times(Math.pow(5,-r));n=tt(t,2,n,n,!0);for(var o,s=new t(5),h=new t(16),c=new t(20);r--;)o=n.times(n),n=n.times(s.plus(o.times(h.times(o).plus(c))))}return t.precision=u,t.rounding=f,i(n,u,f,!0)},t.hyperbolicTangent=t.tanh=function(){var i,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(i=n.precision,r=n.rounding,n.precision=i+7,n.rounding=1,f(t.sinh(),t.cosh(),n.precision=i,n.rounding=r)):new n(t.s)},t.inverseCosine=t.acos=function(){var u,t=this,n=t.constructor,f=t.abs().cmp(1),i=n.precision,r=n.rounding;return-1!==f?0===f?t.isNeg()?a(n,i,r):new n(0):new n(NaN):t.isZero()?a(n,i+4,r).times(.5):(n.precision=i+6,n.rounding=1,t=t.asin(),u=a(n,i+4,r).times(.5),n.precision=i,n.rounding=r,u.minus(t))},t.inverseHyperbolicCosine=t.acosh=function(){var i,r,n=this,t=n.constructor;return n.lte(1)?new t(n.eq(1)?0:NaN):n.isFinite()?(i=t.precision,r=t.rounding,t.precision=i+Math.max(Math.abs(n.e),n.sd())+4,t.rounding=1,u=!1,n=n.times(n).minus(1).sqrt().plus(n),u=!0,t.precision=i,t.rounding=r,n.ln()):new t(n)},t.inverseHyperbolicSine=t.asinh=function(){var i,r,n=this,t=n.constructor;return!n.isFinite()||n.isZero()?new t(n):(i=t.precision,r=t.rounding,t.precision=i+2*Math.max(Math.abs(n.e),n.sd())+6,t.rounding=1,u=!1,n=n.times(n).plus(1).sqrt().plus(n),u=!0,t.precision=i,t.rounding=r,n.ln())},t.inverseHyperbolicTangent=t.atanh=function(){var r,u,o,e,n=this,t=n.constructor;return n.isFinite()?n.e>=0?new t(n.abs().eq(1)?n.s/0:n.isZero()?n:NaN):(r=t.precision,u=t.rounding,e=n.sd(),Math.max(e,r)<2*-n.e-1?i(new t(n),r,u,!0):(t.precision=o=e-n.e,n=f(n.plus(1),new t(1).minus(n),o+r,1),t.precision=r+4,t.rounding=1,n=n.ln(),t.precision=r,t.rounding=u,n.times(.5))):new t(NaN)},t.inverseSine=t.asin=function(){var r,u,i,f,n=this,t=n.constructor;return n.isZero()?new t(n):(u=n.abs().cmp(1),i=t.precision,f=t.rounding,-1!==u?0===u?(r=a(t,i+4,f).times(.5),r.s=n.s,r):new t(NaN):(t.precision=i+6,t.rounding=1,n=n.div(new t(1).minus(n.times(n)).sqrt().plus(1)).atan(),t.precision=i,t.rounding=f,n.times(2)))},t.inverseTangent=t.atan=function(){var e,c,h,l,o,v,t,y,p,n=this,f=n.constructor,s=f.precision,w=f.rounding;if(n.isFinite()){if(n.isZero())return new f(n);if(n.abs().eq(1)&<>=s+4)return t=a(f,s+4,w).times(.25),t.s=n.s,t}else{if(!n.s)return new f(NaN);if(lt>=s+4)return t=a(f,s+4,w).times(.5),t.s=n.s,t}for(f.precision=y=s+10,f.rounding=1,h=Math.min(28,y/r+2|0),e=h;e;--e)n=n.div(n.times(n).plus(1).sqrt().plus(1));for(u=!1,c=Math.ceil(y/r),l=1,p=n.times(n),t=new f(n),o=n;-1!==e;)if(o=o.times(p),v=t.minus(o.div(l+=2)),o=o.times(p),t=v.plus(o.div(l+=2)),void 0!==t.d[c])for(e=c;t.d[e]===v.d[e]&&e--;);return h&&(t=t.times(2<this.d.length-2},t.isNaN=function(){return!this.s},t.isNegative=t.isNeg=function(){return this.s<0},t.isPositive=t.isPos=function(){return this.s>0},t.isZero=function(){return!!this.d&&0===this.d[0]},t.lessThan=t.lt=function(n){return this.cmp(n)<0},t.lessThanOrEqualTo=t.lte=function(n){return this.cmp(n)<1},t.logarithm=t.log=function(n){var l,t,a,o,p,v,r,s,c=this,h=c.constructor,y=h.precision,w=h.rounding;if(null==n)n=new h(10),l=!0;else{if(n=new h(n),t=n.d,n.s<0||!t||!t[0]||n.eq(1))return new h(NaN);l=n.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new h(t&&!t[0]?-1/0:1!=c.s?NaN:t?0:1/0);if(l)if(t.length>1)p=!0;else{for(o=t[0];o%10==0;)o/=10;p=1!==o}if(u=!1,r=y+5,v=d(c,r),a=l?ft(h,r+10):d(n,r),s=f(v,a,r,1),rt(s.d,o=y,w))do if(r+=10,v=d(c,r),a=l?ft(h,r+10):d(n,r),s=f(v,a,r,1),!p){+e(s.d).slice(o+1,o+15)+1==1e14&&(s=i(s,y+1,0));break}while(rt(s.d,o+=10,w));return u=!0,i(s,y,w)},t.minus=t.sub=function(n){var l,p,f,w,c,o,k,b,t,d,v,e,h=this,a=h.constructor;if(n=new a(n),!h.d||!n.d)return h.s&&n.s?h.d?n.s=-n.s:n=new a(n.d||h.s!==n.s?h:NaN):n=new a(NaN),n;if(h.s!=n.s)return n.s=-n.s,h.plus(n);if(t=h.d,e=n.d,k=a.precision,b=a.rounding,!t[0]||!e[0]){if(e[0])n.s=-n.s;else{if(!t[0])return new a(3===b?-0:0);n=new a(h)}return u?i(n,k,b):n}if(p=s(n.e/r),d=s(h.e/r),t=t.slice(),c=d-p){for(v=0>c,v?(l=t,c=-c,o=e.length):(l=e,p=d,o=t.length),f=Math.max(Math.ceil(k/r),o)+2,c>f&&(c=f,l.length=1),l.reverse(),f=c;f--;)l.push(0);l.reverse()}else{for(f=t.length,o=e.length,v=o>f,v&&(o=f),f=0;o>f;f++)if(t[f]!=e[f]){v=t[f]0;--f)t[o++]=0;for(f=e.length;f>c;){if(t[--f]f?(c=t,f=-f,e=h.length):(c=h,p=l,e=t.length),l=Math.ceil(w/r),e=l>e?l+1:e+1,f>e&&(f=e,c.length=1),c.reverse();f--;)c.push(0);c.reverse()}for(e=t.length,f=h.length,0>e-f&&(f=e,c=h,h=t,t=c),v=0;f;)v=(t[--f]=t[f]+h[f]+v)/y|0,t[f]%=y;for(v&&(t.unshift(v),++p),e=t.length;0==t[--e];)t.pop();return n.d=t,n.e=ut(t,p),u?i(n,w,b):n},t.precision=t.sd=function(n){var t,i=this;if(void 0!==n&&n!==!!n&&1!==n&&0!==n)throw Error(nt+n);return i.d?(t=at(i.d),n&&i.e+1>t&&(t=i.e+1)):t=NaN,t},t.round=function(){var n=this,t=n.constructor;return i(new t(n),n.e+1,t.rounding)},t.sine=t.sin=function(){var u,f,n=this,t=n.constructor;return n.isFinite()?n.isZero()?new t(n):(u=t.precision,f=t.rounding,t.precision=u+Math.max(n.e,n.sd())+r,t.rounding=1,n=fi(t,kt(t,n)),t.precision=u,t.rounding=f,i(b>2?n.neg():n,u,f,!0)):new t(NaN)},t.squareRoot=t.sqrt=function(){var p,n,l,r,y,c,h=this,a=h.d,t=h.e,o=h.s,v=h.constructor;if(1!==o||!a||!a[0])return new v(!o||0>o&&(!a||a[0])?NaN:a?h:1/0);for(u=!1,o=Math.sqrt(+h),0==o||o==1/0?(n=e(a),(n.length+t)%2==0&&(n+="0"),o=Math.sqrt(n),t=s((t+1)/2)-(0>t||t%2),o==1/0?n="1e"+t:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+t),r=new v(n)):r=new v(o.toString()),l=(t=v.precision)+3;;)if(c=r,r=c.plus(f(h,c,l+2,1)).times(.5),e(c.d).slice(0,l)===(n=e(r.d)).slice(0,l)){if(n=n.slice(l-3,l+1),"9999"!=n&&(y||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(i(r,t+1,1),p=!r.times(r).eq(h));break}if(!y&&(i(c,t+1,0),c.times(c).eq(h))){r=c;break}l+=4;y=1}return u=!0,i(r,t,v.rounding,p)},t.tangent=t.tan=function(){var r,u,n=this,t=n.constructor;return n.isFinite()?n.isZero()?new t(n):(r=t.precision,u=t.rounding,t.precision=r+10,t.rounding=1,n=n.sin(),n.s=1,n=f(n,new t(1).minus(n.times(n)).sqrt(),r+10,0),t.precision=r,t.rounding=u,i(2==b||4==b?n.neg():n,r,u,!0)):new t(NaN)},t.times=t.mul=function(n){var a,b,f,h,t,v,k,c,l,p=this,w=p.constructor,e=p.d,o=(n=new w(n)).d;if(n.s*=p.s,!(e&&e[0]&&o&&o[0]))return new w(!n.s||e&&!e[0]&&!o||o&&!o[0]&&!e?NaN:e&&o?0*n.s:n.s/0);for(b=s(p.e/r)+s(n.e/r),c=e.length,l=o.length,l>c&&(t=e,e=o,o=t,v=c,c=l,l=v),t=[],v=c+l,f=v;f--;)t.push(0);for(f=l;--f>=0;){for(a=0,h=c+f;h>f;)k=t[h]+o[f]*e[h-f-1]+a,t[h--]=k%y|0,a=k/y|0;t[h]=(t[h]+a)%y|0}for(;!t[--v];)t.pop();for(a?++b:t.shift(),f=t.length;!t[--f];)t.pop();return n.d=t,n.e=ut(t,b),u?i(n,w.precision,w.rounding):n},t.toBinary=function(n,t){return ct(this,2,n,t)},t.toDecimalPlaces=t.toDP=function(n,t){var r=this,u=r.constructor;return r=new u(r),void 0===n?r:(c(n,0,g),void 0===t?t=u.rounding:c(t,0,8),i(r,n+r.e+1,t))},t.toExponential=function(n,t){var u,r=this,f=r.constructor;return void 0===n?u=p(r,!0):(c(n,0,g),void 0===t?t=f.rounding:c(t,0,8),r=i(new f(r),n+1,t),u=p(r,!0,n+1)),r.isNeg()&&!r.isZero()?"-"+u:u},t.toFixed=function(n,t){var u,f,r=this,e=r.constructor;return void 0===n?u=p(r):(c(n,0,g),void 0===t?t=e.rounding:c(t,0,8),f=i(new e(r),n+r.e+1,t),u=p(f,!1,n+f.e+1)),r.isNeg()&&!r.isZero()?"-"+u:u},t.toFraction=function(n){var s,a,c,t,y,w,i,v,o,d,b,g,p=this,k=p.d,l=p.constructor;if(!k)return new l(p);if(o=a=new l(1),c=v=new l(0),s=new l(c),y=s.e=at(k)-p.e-1,w=y%r,s.d[0]=h(10,0>w?r+w:w),null==n)n=y>0?s:o;else{if(i=new l(n),!i.isInt()||i.lt(o))throw Error(nt+i);n=i.gt(s)?y>0?s:o:i}for(u=!1,i=new l(e(k)),d=l.precision,l.precision=y=k.length*r*2;b=f(i,s,0,1,1),t=a.plus(b.times(c)),1!=t.cmp(n);)a=c,c=t,t=o,o=v.plus(b.times(t)),v=t,t=s,s=i.minus(b.times(t)),i=t;return t=f(n.minus(a),c,0,1,1),v=v.plus(t.times(o)),a=a.plus(t.times(c)),v.s=o.s=p.s,g=f(o,c,y,1).minus(p).abs().cmp(f(v,a,y,1).minus(p).abs())<1?[o,c]:[v,a],l.precision=d,u=!0,g},t.toHexadecimal=t.toHex=function(n,t){return ct(this,16,n,t)},t.toJSON=function(){var h,n,r,i,c,t,u,l,f=this,s=f.s<0;if(!f.d)return o.charAt(f.s?s?82:83:84);if(n=f.e,1===f.d.length&&4>n&&n>=0&&(t=f.d[0],2857>t))return 41>t?o.charAt(s?t+41:t):(t-=41,s&&(t+=2816),i=t/88|0,o.charAt(i)+o.charAt(t-88*i));if(l=e(f.d),u="",!s&&8>=n&&n>=-7)i=64+n+7;else if(s&&4>=n&&n>=-3)i=80+n+3;else if(l.length===n+1)i=32*s;else if(i=32*s+16*(0>n),n=Math.abs(n),88>n)i+=1,u=o.charAt(n);else if(7744>n)i+=2,t=n/88|0,u=o.charAt(t)+o.charAt(n-88*t);else for(h=w(String(n),10,88),c=h.length,i+=c,r=0;c>r;r++)u+=o.charAt(h[r]);for(u=o.charAt(i)+u,h=w(l,10,88),c=h.length,r=0;c>r;r++)u+=o.charAt(h[r]);return u},t.toNearest=function(n,t){var r=this,e=r.constructor;if(r=new e(r),null==n){if(!r.d)return r;n=new e(1);t=e.rounding}else{if(n=new e(n),void 0!==t&&c(t,0,8),!r.d)return n.s?r:n;if(!n.d)return n.s&&(n.s=r.s),n}return n.d[0]?(u=!1,4>t&&(t=[4,5,7,8][t]),r=f(r,n,0,t,1).times(n),u=!0,i(r)):(n.s=r.s,r=n),r},t.toNumber=function(){return+this},t.toOctal=function(n,t){return ct(this,8,n,t)},t.toPower=t.pow=function(n){var l,a,o,c,v,y,w,t=this,f=t.constructor,p=+(n=new f(n));if(!(t.d&&n.d&&t.d[0]&&n.d[0]))return new f(h(+t,p));if(t=new f(t),t.eq(1))return t;if(o=f.precision,v=f.rounding,n.eq(1))return i(t,o,v);if(l=s(n.e/r),a=n.d.length-1,w=l>=a,y=t.s,w){if((a=0>p?-p:p)<=eu)return c=vt(f,t,a,o),n.s<0?new f(1).div(c):i(c,o,v)}else if(0>y)return new f(NaN);return y=0>y&&1&n.d[Math.max(l,a)]?-1:1,a=h(+t,p),l=0!=a&&isFinite(a)?new f(a+"").e:s(p*(Math.log("0."+e(t.d))/Math.LN10+t.e+1)),l>f.maxE+1||l0?y/0:0):(u=!1,f.rounding=t.s=1,a=Math.min(12,(l+"").length),c=ht(n.times(d(t,o+a)),o),c=i(c,o+5,1),rt(c.d,o,v)&&(l=o+10,c=i(ht(n.times(d(t,l+a)),l),l+5,1),+e(c.d).slice(o+1,o+15)+1==1e14&&(c=i(c,o+1,0))),c.s=y,u=!0,f.rounding=v,i(c,o,v))},t.toPrecision=function(n,t){var f,r=this,u=r.constructor;return void 0===n?f=p(r,r.e<=u.toExpNeg||r.e>=u.toExpPos):(c(n,1,g),void 0===t?t=u.rounding:c(t,0,8),r=i(new u(r),n,t),f=p(r,n<=r.e||r.e<=u.toExpNeg,n)),r.isNeg()&&!r.isZero()?"-"+f:f},t.toSignificantDigits=t.toSD=function(n,t){var u=this,r=u.constructor;return void 0===n?(n=r.precision,t=r.rounding):(c(n,1,g),void 0===t?t=r.rounding:c(t,0,8)),i(new r(u),n,t)},t.toString=function(){var n=this,t=n.constructor,i=p(n,n.e<=t.toExpNeg||n.e>=t.toExpPos);return n.isNeg()&&!n.isZero()?"-"+i:i},t.truncated=t.trunc=function(){return i(new this.constructor(this),this.e+1,1)},t.valueOf=function(){var n=this,t=n.constructor,i=p(n,n.e<=t.toExpNeg||n.e>=t.toExpPos);return n.isNeg()?"-"+i:i},f=function(){function n(n,t,i){var u,r=0,f=n.length;for(n=n.slice();f--;)u=n[f]*t+r,n[f]=u%i|0,r=u/i|0;return r&&n.unshift(r),n}function t(n,t,i,r){var u,f;if(i!=r)f=i>r?1:-1;else for(u=f=0;i>u;u++)if(n[u]!=t[u]){f=n[u]>t[u]?1:-1;break}return f}function u(n,t,i,r){for(var u=0;i--;)n[i]-=u,u=n[i]1;)n.shift()}return function(f,e,o,h,c,l){var g,et,w,v,it,ot,nt,ft,rt,ut,p,b,ht,tt,vt,ct,st,yt,d,lt,at=f.constructor,pt=f.s==e.s?1:-1,k=f.d,a=e.d;if(!(k&&k[0]&&a&&a[0]))return new at(f.s&&e.s&&(k?!a||k[0]!=a[0]:a)?k&&0==k[0]||!a?0*pt:pt/0:NaN);for(l?(it=1,et=f.e-e.e):(l=y,it=r,et=s(f.e/it)-s(e.e/it)),d=a.length,st=k.length,rt=new at(pt),ut=rt.d=[],w=0;a[w]==(k[w]||0);w++);if(a[w]>(k[w]||0)&&et--,null==o?(tt=o=at.precision,h=at.rounding):tt=c?o+(f.e-e.e)+1:o,0>tt)ut.push(1),ot=!0;else{if(tt=tt/it+2|0,w=0,1==d){for(v=0,a=a[0],tt++;(st>w||v)&&tt--;w++)vt=v*l+(k[w]||0),ut[w]=vt/a|0,v=vt%a|0;ot=v||st>w}else{for(v=l/(a[0]+1)|0,v>1&&(a=n(a,v,l),k=n(k,v,l),d=a.length,st=k.length),ct=d,p=k.slice(0,d),b=p.length;d>b;)p[b++]=0;lt=a.slice();lt.unshift(0);yt=a[0];a[1]>=l/2&&++yt;do v=0,g=t(a,p,d,b),0>g?(ht=p[0],d!=b&&(ht=ht*l+(p[1]||0)),v=ht/yt|0,v>1?(v>=l&&(v=l-1),nt=n(a,v,l),ft=nt.length,b=p.length,g=t(nt,p,ft,b),1==g&&(v--,u(nt,ft>d?lt:a,ft,l))):(0==v&&(g=v=1),nt=a.slice()),ft=nt.length,b>ft&&nt.unshift(0),u(p,nt,b,l),-1==g&&(b=p.length,g=t(a,p,d,b),1>g&&(v++,u(p,b>d?lt:a,b,l))),b=p.length):0===g&&(v++,p=[0]),ut[w++]=v,g&&p[0]?p[b++]=k[ct]||0:(p=[k[ct]],b=1);while((ct++=10;v/=10)w++;rt.e=w+et*it-1;i(rt,c?o+rt.e+1:o,h,ot)}return rt}}(),v=gt(v),et=new v(et),ot=new v(ot),Bridge.$Decimal=v,"function"==typeof define&&define.amd)define(function(){return v});else if("undefined"!=typeof module&&module.exports){if(module.exports=v,!l)try{l=require("crypto")}catch(su){}}else n||(n="undefined"!=typeof self&&self&&self.self==self?self:Function("return this")()),ti=n.Decimal,v.noConflict=function(){return n.Decimal=ti,v},n.Decimal=v}(Bridge.global);System.Decimal=function(n,t,i){var r;if(this.constructor!==System.Decimal)return new System.Decimal(n,t,i);if(n==null&&(n=0),typeof n=="string"){if(t=t||System.Globalization.CultureInfo.getCurrentCulture(),r=t&&t.getFormat(System.Globalization.NumberFormatInfo),r&&r.numberDecimalSeparator!=="."&&(n=n.replace(r.numberDecimalSeparator,".")),!/^\s*[+-]?(\d+|\d+.|\d*\.\d+)((e|E)[+-]?\d+)?\s*$/.test(n))throw new System.FormatException;n=n.replace(/\s/g,"")}if(i&&i.precision&&typeof n=="number"){var f=Bridge.Int.trunc(n),e=(f+"").length,u=i.precision-e;u<0&&(u=0);n=n.toFixed(u)}this.value=System.Decimal.getValue(n)};System.Decimal.$$name="System.Decimal";System.Decimal.prototype.$$name="System.Decimal";System.Decimal.$kind="struct";System.Decimal.prototype.$kind="struct";System.Decimal.$$inherits=[];Bridge.Class.addExtend(System.Decimal,[System.IComparable,System.IFormattable,System.IComparable$1(System.Decimal),System.IEquatable$1(System.Decimal)]);System.Decimal.$is=function(n){return n instanceof System.Decimal};System.Decimal.getDefaultValue=function(){return new System.Decimal(0)};System.Decimal.getValue=function(n){return Bridge.hasValue(n)?n instanceof System.Decimal?n.value:n instanceof System.Int64||n instanceof System.UInt64?new Bridge.$Decimal(n.toString()):new Bridge.$Decimal(n):this.getDefaultValue()};System.Decimal.create=function(n){return Bridge.hasValue(n)?n instanceof System.Decimal?n:new System.Decimal(n):null};System.Decimal.lift=function(n){return n==null?null:System.Decimal.create(n)};System.Decimal.prototype.toString=function(n,t){return!n&&!t?this.value.toString():Bridge.Int.format(this,n,t)};System.Decimal.prototype.toFloat=function(){return this.value.toNumber()};System.Decimal.prototype.toJSON=function(){return this.value.toNumber()};System.Decimal.prototype.format=function(n,t){return Bridge.Int.format(this.toFloat(),n,t)};System.Decimal.prototype.decimalPlaces=function(){return this.value.decimalPlaces()};System.Decimal.prototype.dividedToIntegerBy=function(n){return new System.Decimal(this.value.dividedToIntegerBy(System.Decimal.getValue(n)))};System.Decimal.prototype.exponential=function(){return new System.Decimal(this.value.exponential())};System.Decimal.prototype.abs=function(){return new System.Decimal(this.value.abs())};System.Decimal.prototype.floor=function(){return new System.Decimal(this.value.floor())};System.Decimal.prototype.ceil=function(){return new System.Decimal(this.value.ceil())};System.Decimal.prototype.trunc=function(){return new System.Decimal(this.value.trunc())};System.Decimal.round=function(n,t){var i,r;return n=System.Decimal.create(n),i=Bridge.$Decimal.rounding,Bridge.$Decimal.rounding=t,r=new System.Decimal(n.value.round()),Bridge.$Decimal.rounding=i,r};System.Decimal.toDecimalPlaces=function(n,t,i){n=System.Decimal.create(n);return new System.Decimal(n.value.toDecimalPlaces(t,i))};System.Decimal.prototype.compareTo=function(n){return this.value.comparedTo(System.Decimal.getValue(n))};System.Decimal.prototype.add=function(n){return new System.Decimal(this.value.plus(System.Decimal.getValue(n)))};System.Decimal.prototype.sub=function(n){return new System.Decimal(this.value.minus(System.Decimal.getValue(n)))};System.Decimal.prototype.isZero=function(){return this.value.isZero};System.Decimal.prototype.mul=function(n){return new System.Decimal(this.value.times(System.Decimal.getValue(n)))};System.Decimal.prototype.div=function(n){return new System.Decimal(this.value.dividedBy(System.Decimal.getValue(n)))};System.Decimal.prototype.mod=function(n){return new System.Decimal(this.value.modulo(System.Decimal.getValue(n)))};System.Decimal.prototype.neg=function(){return new System.Decimal(this.value.negated())};System.Decimal.prototype.inc=function(){return new System.Decimal(this.value.plus(System.Decimal.getValue(1)))};System.Decimal.prototype.dec=function(){return new System.Decimal(this.value.minus(System.Decimal.getValue(1)))};System.Decimal.prototype.sign=function(){return this.value.isZero()?0:this.value.isNegative()?-1:1};System.Decimal.prototype.clone=function(){return new System.Decimal(this)};System.Decimal.prototype.ne=function(n){return!!this.compareTo(n)};System.Decimal.prototype.lt=function(n){return this.compareTo(n)<0};System.Decimal.prototype.lte=function(n){return this.compareTo(n)<=0};System.Decimal.prototype.gt=function(n){return this.compareTo(n)>0};System.Decimal.prototype.gte=function(n){return this.compareTo(n)>=0};System.Decimal.prototype.equals=function(n){return!this.compareTo(n)};System.Decimal.prototype.equalsT=function(n){return!this.compareTo(n)};System.Decimal.prototype.getHashCode=function(){for(var n=this.sign()*397+this.value.e|0,t=0;t=0&&n[u]!==r;u--);if(u>=0){while(--u>=0&&n[u]===r)f++;if(f<=1)return!0}for(u=t+i;u=0?"-":"+")+Math.floor(Math.abs(p));break;case"zz":case"zzz":p=s/60;p=(p>=0?"-":"+")+System.String.alignString(Math.floor(Math.abs(p)).toString(),2,"0",2);n==="zzz"&&(p+=r.timeSeparator+System.String.alignString(Math.floor(Math.abs(s%60)).toString(),2,"0",2));break;case":":p=r.timeSeparator;break;case"/":p=r.dateSeparator;break;default:p=n.substr(1,n.length-1-(n.charAt(0)!=="\\"))}return p})},parse:function(n,t,i,r){var u=this.parseExact(n,null,t,i,!0);if(u!==null)return u;if(u=Date.parse(n),isNaN(u)){if(!r)throw new System.FormatException("String does not contain a valid string representation of a date and time.");}else return new Date(u)},parseExact:function(n,t,i,r,u){var ft,ct;if(t||(t=["G","g","F","f","D","d","R","r","s","S","U","u","O","o","Y","y","M","m","T","t"]),Bridge.isArray(t)){for(ft=0,ft;ft30?1900:2e3)+c)}else if(f==="MMM"||f==="MMMM"){for(l=0,ut=f==="MMM"?this.isUseGenitiveForm(t,k,3,"d")?y.abbreviatedMonthGenitiveNames:y.abbreviatedMonthNames:this.isUseGenitiveForm(t,k,4,"d")?y.monthGenitiveNames:y.monthNames,b=0;b12){o=!0;break}}else if(f==="MM"||f==="M"){if(l=this.subparseInt(n,e,f.length,2),l==null||l<1||l>12){o=!0;break}e+=l.length}else if(f==="dddd"||f==="ddd"){for(ut=f==="ddd"?y.abbreviatedDayNames:y.dayNames,b=0;b31){o=!0;break}e+=w.length}else if(f==="hh"||f==="h"){if(h=this.subparseInt(n,e,f.length,2),h==null||h<1||h>12){o=!0;break}e+=h.length}else if(f==="HH"||f==="H"){if(h=this.subparseInt(n,e,f.length,2),h==null||h<0||h>23){o=!0;break}e+=h.length}else if(f==="mm"||f==="m"){if(d=this.subparseInt(n,e,f.length,2),d==null||d<0||d>59)return null;e+=d.length}else if(f==="ss"||f==="s"){if(g=this.subparseInt(n,e,f.length,2),g==null||g<0||g>59){o=!0;break}e+=g.length}else if(f==="u"){if(v=this.subparseInt(n,e,1,7),v==null){o=!0;break}e+=v.length;v.length>3&&(v=v.substring(0,3))}else if(f==="fffffff"||f==="ffffff"||f==="fffff"||f==="ffff"||f==="fff"||f==="ff"||f==="f"){if(v=this.subparseInt(n,e,f.length,7),v==null){o=!0;break}e+=v.length;v.length>3&&(v=v.substring(0,3))}else if(f==="t"){if(n.substring(e,e+1).toLowerCase()===et.charAt(0).toLowerCase())nt=et;else if(n.substring(e,e+1).toLowerCase()===ot.charAt(0).toLowerCase())nt=ot;else{o=!0;break}e+=1}else if(f==="tt"){if(n.substring(e,e+2).toLowerCase()===et.toLowerCase())nt=et;else if(n.substring(e,e+2).toLowerCase()===ot.toLowerCase())nt=ot;else{o=!0;break}e+=2}else if(f==="z"||f==="zz"){if(it=n.charAt(e),it==="-")rt=!0;else if(it==="+")rt=!1;else{o=!0;break}if(e++,a=this.subparseInt(n,e,1,2),a==null||a>14){o=!0;break}e+=a.length;rt&&(a=-a)}else if(f==="zzz"){if(s=n.substring(e,e+6),e+=6,s.length!==6){o=!0;break}if(it=s.charAt(0),it==="-")rt=!0;else if(it==="+")rt=!1;else{o=!0;break}if(tt=1,a=this.subparseInt(s,tt,1,2),a==null||a>14){o=!0;break}if(tt+=a.length,rt&&(a=-a),s.charAt(tt)!==y.timeSeparator){o=!0;break}if(tt++,ht=this.subparseInt(s,tt,1,2),ht==null||a>59){o=!0;break}}else lt=!1;if(p||!lt){if(s=n.substring(e,e+f.length),!p&&(f===":"&&s!==y.timeSeparator||f==="/"&&s!==y.dateSeparator)||s!==f&&f!=="'"&&f!=='"'&&f!=="\\"){o=!0;break}if(p==="\\"&&(p=!1),f!=="'"&&f!=='"'&&f!=="\\")e+=f.length;else if(p===!1)p=f;else{if(p!==f){o=!0;break}p=!1}}}if(p&&(o=!0),o||(e!==n.length?o=!0:l===2?c%4==0&&c%100!=0||c%400==0?w>29&&(o=!0):w>28&&(o=!0):(l===4||l===6||l===9||l===11)&&w>30&&(o=!0)),o){if(u)return null;throw new System.FormatException("String does not contain a valid string representation of a date and time.");}return(h<12&&nt===ot?h=+h+12:h>11&&nt===et&&(h-=12),a===0&&ht===0&&!r)?new Date(c,l-1,w,h,d,g,v):new Date(Date.UTC(c,l-1,w,h-a,d-ht,g,v))},subparseInt:function(n,t,i,r){for(var f,u=r;u>=i;u--){if(f=n.substring(t,t+u),f.lengtht:!1},gte:function(n,t){return Bridge.hasValue$1(n,t)?n>=t:!1},lt:function(n,t){return Bridge.hasValue$1(n,t)?n12?this.getHours()-12:this.getHours()===0?12:this.getHours()},add:function(n){return new System.TimeSpan(this.ticks.add(n.ticks))},subtract:function(n){return new System.TimeSpan(this.ticks.sub(n.ticks))},duration:function(){return new System.TimeSpan(this.ticks.abs())},negate:function(){return new System.TimeSpan(this.ticks.neg())},compareTo:function(n){return this.ticks.compareTo(n.ticks)},equals:function(n){return n.ticks.eq(this.ticks)},equalsT:function(n){return n.ticks.eq(this.ticks)},format:function(n,t){return this.toString(n,t)},getHashCode:function(){return this.ticks.getHashCode()},toString:function(n,t){var i=this.ticks,f="",r=this,e=(t||System.Globalization.CultureInfo.getCurrentCulture()).getFormat(System.Globalization.DateTimeFormatInfo),u=function(n,t,i,r){return System.String.alignString((n|0).toString(),t||2,"0",i||2,r||!1)};return n?n.replace(/(\\.|'[^']*'|"[^"]*"|dd?|HH?|hh?|mm?|ss?|tt?|f{1,7}|\:|\/)/g,function(n){var t=n;switch(n){case"d":return r.getDays();case"dd":return u(r.getDays());case"H":return r.getHours();case"HH":return u(r.getHours());case"h":return r.get12HourHour();case"hh":return u(r.get12HourHour());case"m":return r.getMinutes();case"mm":return u(r.getMinutes());case"s":return r.getSeconds();case"ss":return u(r.getSeconds());case"t":return(r.getHours()<12?e.amDesignator:e.pmDesignator).substring(0,1);case"tt":return r.getHours()<12?e.amDesignator:e.pmDesignator;case"f":case"ff":case"fff":case"ffff":case"fffff":case"ffffff":case"fffffff":return u(r.getMilliseconds(),n.length,1,!0);default:return n.substr(1,n.length-1-(n.charAt(0)!=="\\"))}}):(i.abs().gte(864e9)&&(f+=u(i.toNumberDivided(864e9))+".",i=i.mod(864e9)),f+=u(i.toNumberDivided(36e9))+":",i=i.mod(36e9),f+=u(i.toNumberDivided(6e8)|0)+":",i=i.mod(6e8),f+=u(i.toNumberDivided(1e7)),i=i.mod(1e7),i.gt(0)&&(f+="."+u(i.toNumber(),7)),f)}});Bridge.Class.addExtend(System.TimeSpan,[System.IComparable$1(System.TimeSpan),System.IEquatable$1(System.TimeSpan)]);Bridge.define("System.Text.StringBuilder",{ctor:function(){this.$initialize();this.buffer=[];this.capacity=16;arguments.length===1?this.append(arguments[0]):arguments.length===2?(this.append(arguments[0]),this.setCapacity(arguments[1])):arguments.length===3&&this.append(arguments[0],arguments[1],arguments[2])},getLength:function(){if(this.buffer.length<2)return this.buffer[0]?this.buffer[0].length:0;var n=this.buffer.join("");return this.buffer=[],this.buffer[0]=n,n.length},getCapacity:function(){var n=this.getLength();return this.capacity>n?this.capacity:n},setCapacity:function(n){var t=this.getLength();n>t&&(this.capacity=n)},toString:function(){var n=this.buffer.join(""),t,i;return(this.buffer=[],this.buffer[0]=n,arguments.length===2)?(t=arguments[0],i=arguments[1],this.checkLimits(n,t,i),n.substr(t,i)):n},append:function(n){var i,t;if(n==null)return this;if(arguments.length===2){if(t=arguments[1],t===0)return this;if(t<0)throw new System.ArgumentOutOfRangeException("count","cannot be less than zero");n=Array(t+1).join(n).toString()}else if(arguments.length===3){if(i=arguments[1],t=arguments[2],t===0)return this;this.checkLimits(n,i,t);n=n.substr(i,t)}return this.buffer[this.buffer.length]=n,this},appendFormat:function(){return this.append(System.String.format.apply(System.String,arguments))},clear:function(){return this.buffer=[],this},appendLine:function(){return arguments.length===1&&this.append(arguments[0]),this.append("\r\n")},equals:function(n){return n==null?!1:n===this?!0:this.toString()===n.toString()},remove:function(n,t){var i=this.buffer.join("");return(this.checkLimits(i,n,t),i.length===t&&n===0)?this.clear():(t>0&&(this.buffer=[],this.buffer[0]=i.substring(0,n),this.buffer[1]=i.substring(n+t,i.length)),this)},insert:function(n,t){var r,i;if(t==null)return this;if(arguments.length===3){if(r=arguments[2],r===0)return this;if(r<0)throw new System.ArgumentOutOfRangeException("count","cannot be less than zero");t=Array(r+1).join(t).toString()}return i=this.buffer.join(""),this.buffer=[],n<1?(this.buffer[0]=t,this.buffer[1]=i):n>=i.length?(this.buffer[0]=i,this.buffer[1]=t):(this.buffer[0]=i.substring(0,n),this.buffer[1]=t,this.buffer[2]=i.substring(n,i.length)),this},replace:function(n,t){var f=new RegExp(n,"g"),i=this.buffer.join("");if(this.buffer=[],arguments.length===4){var r=arguments[2],u=arguments[3],e=i.substr(r,u);this.checkLimits(i,r,u);this.buffer[0]=i.substring(0,r);this.buffer[1]=e.replace(f,t);this.buffer[2]=i.substring(r+u,i.length)}else this.buffer[0]=i.replace(f,t);return this},checkLimits:function(n,t,i){if(i<0)throw new System.ArgumentOutOfRangeException("length","must be non-negative");if(t<0)throw new System.ArgumentOutOfRangeException("startIndex","startIndex cannot be less than zero");if(i>n.length-t)throw new System.ArgumentOutOfRangeException("Index and length must refer to a location within the string");}}),function(){var n=RegExp("[-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]","g"),t=function(t){return t.replace(n,"\\$&")};Bridge.regexpEscape=t}();System.Diagnostics.Debug={writeln:function(n){Bridge.Console.debug(n)},_fail:function(n){System.Diagnostics.Debug.writeln(n)},assert:function(n,t){n||(t="Assert failed: "+t,confirm(t+"\r\n\r\nBreak into debugger?")&&System.Diagnostics.Debug._fail(t))},fail:function(n){System.Diagnostics.Debug._fail(n)}};Bridge.define("System.Diagnostics.Stopwatch",{ctor:function(){this.$initialize();this._stopTime=System.Int64.Zero;this._startTime=System.Int64.Zero;this.isRunning=!1},reset:function(){this._stopTime=this._startTime=System.Diagnostics.Stopwatch.getTimestamp();this.isRunning=!1},ticks:function(){return(this.isRunning?System.Diagnostics.Stopwatch.getTimestamp():this._stopTime).sub(this._startTime)},milliseconds:function(){return this.ticks().mul(1e3).div(System.Diagnostics.Stopwatch.frequency)},timeSpan:function(){return new System.TimeSpan(this.milliseconds().mul(1e4))},start:function(){this.isRunning||(this._startTime=System.Diagnostics.Stopwatch.getTimestamp(),this.isRunning=!0)},stop:function(){this.isRunning&&(this._stopTime=System.Diagnostics.Stopwatch.getTimestamp(),this.isRunning=!1)},restart:function(){this.isRunning=!1;this.start()},statics:{startNew:function(){var n=new System.Diagnostics.Stopwatch;return n.start(),n}}});typeof window!="undefined"&&window.performance&&window.performance.now?(System.Diagnostics.Stopwatch.frequency=new System.Int64(1e6),System.Diagnostics.Stopwatch.isHighResolution=!0,System.Diagnostics.Stopwatch.getTimestamp=function(){return new System.Int64(Math.round(window.performance.now()*1e3))}):typeof process!="undefined"&&process.hrtime?(System.Diagnostics.Stopwatch.frequency=new System.Int64(1e9),System.Diagnostics.Stopwatch.isHighResolution=!0,System.Diagnostics.Stopwatch.getTimestamp=function(){var n=process.hrtime();return new System.Int64(n[0]).mul(1e9).add(n[1])}):(System.Diagnostics.Stopwatch.frequency=new System.Int64(1e3),System.Diagnostics.Stopwatch.isHighResolution=!1,System.Diagnostics.Stopwatch.getTimestamp=function(){return new System.Int64((new Date).valueOf())});System.Diagnostics.Contracts.Contract={reportFailure:function(n,t,i,r,u){var f=i.toString(),e,o;if(f=f.substring(f.indexOf("return")+7),f=f.substr(0,f.lastIndexOf(";")),e=f?"Contract '"+f+"' failed":"Contract failed",o=t?e+": "+t:e,u)throw new u(f,t);else throw new System.Diagnostics.Contracts.ContractException(n,o,t,f,r);},assert:function(n,t,i){t()||System.Diagnostics.Contracts.Contract.reportFailure(n,i,t,null)},requires:function(n,t,i){t()||System.Diagnostics.Contracts.Contract.reportFailure(0,i,t,null,n)},forAll:function(n,t,i){if(!i)throw new System.ArgumentNullException("predicate");for(;n=(n.$s?n.$s[0]:n.length))throw new System.ArgumentException("Index 0 out of range");var r=t[0],i;if(n.$s)for(i=1;i=n.$s[i])throw new System.ArgumentException("Index "+i+" out of range");r=r*n.$s[i]+t[i]}return r},$get:function(n){var t=this[System.Array.toIndex(this,n)];return typeof t!="undefined"?t:this.$v},get:function(n){var t,i,r;if(arguments.length<2)throw new System.ArgumentNullException("indices");for(t=Array.prototype.slice.call(arguments,1),i=0;i=(n.$s?n.$s.length:1))throw new System.IndexOutOfRangeException;return n.$s?n.$s[t]:n.length},getRank:function(n){return n.$s?n.$s.length:1},getLower:function(n,t){return System.Array.getLength(n,t),0},create:function(n,t){var i=[],h=arguments.length>2?1:0,r,f,e,u,o,s;for(i.$v=n,i.$s=[],i.get=System.Array.$get,i.set=System.Array.$set,r=2;r=0;f--)u=s%i.$s[f],o.unshift(u),s=Bridge.Int.div(s-u,i.$s[f]);for(e=t,u=0;un.length)throw new System.IndexOutOfRangeException;for(var u=Bridge.isFunction(t);--r>=0;)n[i+r]=u?t():t},copy:function(n,t,i,r,u){if(!i)throw new System.ArgumentNullException("dest","Value cannot be null");if(!n)throw new System.ArgumentNullException("src","Value cannot be null");if(t<0||r<0||u<0)throw new System.ArgumentOutOfRangeException("Number was less than the array's lower bound in the first dimension");if(u>n.length-t||u>i.length-r)throw new System.ArgumentException("Destination array was not long enough. Check destIndex and length, and the array's lower bounds");if(t=0)i[r+u]=n[t+u];else for(var f=0;f-1:i&&Bridge.isFunction(n[r="System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(i)+"$contains"])?n[r](t):Bridge.isFunction(n.contains)?n.contains(t):!1},remove:function(n,t,i){var u,r;if(Bridge.isArray(n)){if(r=System.Array.indexOf(n,t),r>-1)return n.splice(r,1),!0}else{if(i&&Bridge.isFunction(n[u="System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(i)+"$remove"]))return n[u](t);if(Bridge.isFunction(n.remove))return n.remove(t)}return!1},insert:function(n,t,i,r){var u;Bridge.isArray(n)?n.splice(t,0,i):r&&Bridge.isFunction(n[u="System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(r)+"$insert"])?n[u](t,i):Bridge.isFunction(n.insert)&&n.insert(t,i)},removeAt:function(n,t,i){var r;Bridge.isArray(n)?n.splice(t,1):i&&Bridge.isFunction(n[r="System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(i)+"$removeAt"])?n[r](t):Bridge.isFunction(n.removeAt)&&n.removeAt(t)},getItem:function(n,t,i){var r;return Bridge.isArray(n)?n[t]:Bridge.isFunction(n.get)?n.get(t):Bridge.isFunction(n.getItem)?n.getItem(t):i&&Bridge.isFunction(n[r="System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(i)+"$getItem"])?n[r](t):Bridge.isFunction(n.get_Item)?n.get_Item(t):void 0},setItem:function(n,t,i,r){var u;if(Bridge.isArray(n))n[t]=i;else if(Bridge.isFunction(n.set))n.set(t,i);else if(Bridge.isFunction(n.setItem))n.setItem(t,i);else{if(r&&Bridge.isFunction(n[u="System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(r)+"$setItem"]))return n[u](t,i);Bridge.isFunction(n.set_Item)&&n.set_Item(t,i)}},resize:function(n,t,i){var u;if(t<0)throw new System.ArgumentOutOfRangeException("newSize",null,null,t);var f=0,e=Bridge.isFunction(i),r=n.v;for(r?(f=r.length,r.length=t):r=new Array(t),u=f;u>1);try{h=u.compare(n[e],r)}catch(c){throw new System.InvalidOperationException("Failed to compare two elements in the array.",c);}if(h===0)return e;h<0?f=e+1:s=e-1}return~f},sort:function(n,t,i,r){var f,u;if(!n)throw new System.ArgumentNullException("array");if(arguments.length===2&&typeof t=="object"&&(r=t,t=null),Bridge.isNumber(t)||(t=0),Bridge.isNumber(i)||(i=n.length),r||(r=System.Collections.Generic.Comparer$1.$default),t===0&&i===n.length)n.sort(Bridge.fn.bind(r,r.compare));else for(f=n.slice(t,t+i),f.sort(Bridge.fn.bind(r,r.compare)),u=t;ur||r>t)||n[i]>t||(r=n[i]);return r},addRange:function(n,t){if(Bridge.isArray(t))n.push.apply(n,t);else{var i=Bridge.getEnumerator(t);try{while(i.moveNext())n.push(i.getCurrent())}finally{Bridge.is(i,System.IDisposable)&&i.dispose()}}},convertAll:function(n,t){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(t))throw new System.ArgumentNullException("converter");return n.map(t)},find:function(n,t,i){if(!Bridge.hasValue(t))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(i))throw new System.ArgumentNullException("match");for(var r=0;rn.length)throw new System.ArgumentOutOfRangeException("startIndex");if(i<0||t>n.length-i)throw new System.ArgumentOutOfRangeException("count");if(!Bridge.hasValue(r))throw new System.ArgumentNullException("match");for(f=t+i,u=t;u=0;r--)if(i(t[r]))return t[r];return Bridge.getDefaultValue(n)},findLastIndex:function(n,t,i,r){var f,u;if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(arguments.length===2?(r=t,t=n.length-1,i=n.length):arguments.length===3&&(r=i,i=t+1),!Bridge.hasValue(r))throw new System.ArgumentNullException("match");if(n.length===0){if(t!==-1)throw new System.ArgumentOutOfRangeException("startIndex");}else if(t<0||t>=n.length)throw new System.ArgumentOutOfRangeException("startIndex");if(i<0||t-i+1<0)throw new System.ArgumentOutOfRangeException("count");for(f=t-i,u=t;u>f;u--)if(r(n[u]))return u;return-1},forEach:function(n,t){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(t))throw new System.ArgumentNullException("action");for(var i=0;i=n.length&&n.length>0)throw new System.ArgumentOutOfRangeException("startIndex","out of range");if(r<0||r>n.length-i)throw new System.ArgumentOutOfRangeException("count","out of range");return System.Array.indexOf(n,t,i,r)},lastIndexOfT:function(n,t,i,r){var e,u,f;if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(arguments.length===2?(i=n.length-1,r=n.length):arguments.length===3&&(r=n.length===0?0:i+1),i<0||i>=n.length&&n.length>0)throw new System.ArgumentOutOfRangeException("startIndex","out of range");if(r<0||i-r+1<0)throw new System.ArgumentOutOfRangeException("count","out of range");for(e=i-r+1,u=i;u>=e;u--)if(f=n[u],f===t||System.Collections.Generic.EqualityComparer$1.$default.equals2(f,t))return u;return-1},trueForAll:function(n,t){if(!Bridge.hasValue(n))throw new System.ArgumentNullException("array");if(!Bridge.hasValue(t))throw new System.ArgumentNullException("match");for(var i=0;i=this.entries[r[t]].length-1)&&(i=-1,t++),t>=r.length)?!1:(i++,!0)},function(){return n(this.entries[r[t]][i])},function(){t=-1},null,this)},getEnumerator:function(){return this.getCustomEnumerator(function(n){return n})}}});Bridge.define("System.Collections.Generic.DictionaryCollection$1",function(n){return{inherits:[System.Collections.Generic.ICollection$1(n)],config:{alias:["getEnumerator","System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(n)+"$getEnumerator","getCount","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getCount","add","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$add","clear","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$clear","contains","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$contains","remove","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$remove"]},ctor:function(n,t){this.$initialize();this.dictionary=n;this.keys=t},getCount:function(){return this.dictionary.getCount()},getEnumerator:function(){return this.dictionary.getCustomEnumerator(this.keys?function(n){return n.key}:function(n){return n.value})},contains:function(n){return this.keys?this.dictionary.containsKey(n):this.dictionary.containsValue(n)},add:function(){throw new System.NotSupportedException;},clear:function(){throw new System.NotSupportedException;},remove:function(){throw new System.NotSupportedException;}}});Bridge.define("System.Collections.Generic.List$1",function(n){return{inherits:[System.Collections.Generic.ICollection$1(n),System.Collections.ICollection,System.Collections.Generic.IList$1(n)],config:{alias:["getItem","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$getItem","setItem","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$setItem","getCount","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getCount","getIsReadOnly","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getIsReadOnly","add","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$add","clear","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$clear","contains","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$contains","copyTo","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$copyTo","getEnumerator","System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(n)+"$getEnumerator","indexOf","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$indexOf","insert","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$insert","remove","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$remove","removeAt","System$Collections$Generic$IList$1$"+Bridge.getTypeAlias(n)+"$removeAt"]},ctor:function(n){this.$initialize();this.items=Object.prototype.toString.call(n)==="[object Array]"?System.Array.clone(n):Bridge.is(n,System.Collections.IEnumerable)?Bridge.toArray(n):[];this.clear.$clearCallbacks=[]},checkIndex:function(n){if(n<0||n>this.items.length-1)throw new System.ArgumentOutOfRangeException("Index out of range");},getCount:function(){return this.items.length},getIsReadOnly:function(){return!!this.readOnly},get:function(n){return this.checkIndex(n),this.items[n]},getItem:function(n){return this.get(n)},set:function(n,t){this.checkReadOnly();this.checkIndex(n);this.items[n]=t},setItem:function(n,t){this.set(n,t)},add:function(n){this.checkReadOnly();this.items.push(n)},addRange:function(n){this.checkReadOnly();for(var i=Bridge.toArray(n),t=0,r=i.length;t-1},copyTo:function(n,t){System.Array.copy(this.items,0,n,t,this.items.length)},getEnumerator:function(){return new Bridge.ArrayEnumerator(this.items,n)},getRange:function(t,i){Bridge.isDefined(t)||(t=0);Bridge.isDefined(i)||(i=this.items.length);t!==0&&this.checkIndex(t);this.checkIndex(t+i-1);for(var u=[],f=t+i,r=t;r=0;i--)if(n===this.items[i])return i;return-1},remove:function(n){this.checkReadOnly();var t=this.indexOf(n);return t<0?!1:(this.checkIndex(t),this.items.splice(t,1),!0)},removeAt:function(n){this.checkReadOnly();this.checkIndex(n);this.items.splice(n,1)},removeRange:function(n,t){this.checkReadOnly();this.checkIndex(n);this.items.splice(n,t)},reverse:function(){this.checkReadOnly();this.items.reverse()},slice:function(n,t){this.checkReadOnly();var i=this.$$name.substr(this.$$name.lastIndexOf("$")+1);return new(System.Collections.Generic.List$1(Bridge.unroll(i)))(this.items.slice(n,t))},sort:function(n){this.checkReadOnly();this.items.sort(n||System.Collections.Generic.Comparer$1.$default.compare)},splice:function(n,t,i){this.checkReadOnly();this.items.splice(n,t,i)},unshift:function(){this.checkReadOnly();this.items.unshift()},toArray:function(){return Bridge.toArray(this)},checkReadOnly:function(){if(this.readOnly)throw new System.NotSupportedException;},binarySearch:function(n,t,i,r){return arguments.length===1&&(i=n,n=null),arguments.length===2&&(i=n,r=t,n=null,t=null),Bridge.isNumber(n)||(n=0),Bridge.isNumber(t)||(t=this.items.length),r||(r=System.Collections.Generic.Comparer$1.$default),System.Array.binarySearch(this.items,n,t,i,r)},convertAll:function(n,t){var r,i;if(!Bridge.hasValue(t))throw new System.ArgumentNullException("converter is null.");for(r=new(System.Collections.Generic.List$1(n))(this.items.length),i=0;i0?t.setException(u):e?t.setCanceled():t.setResult(r))})})(i);return t.task},whenAny:function(n){if(Bridge.is(n,System.Collections.IEnumerable)?n=Bridge.toArray(n):Bridge.isArray(n)||(n=Array.prototype.slice.call(arguments,0)),!n.length)throw new System.ArgumentException("At least one task is required");for(var t=new System.Threading.Tasks.TaskCompletionSource,i=0;i=0?n:arguments.length+n]}}(t):typeof t!="function"&&(t=function(){return Array.prototype.slice.call(arguments,0)}),n.then(function(){u.setResult(t?t.apply(null,arguments):Array.prototype.slice.call(arguments,0))},function(){u.setException(i?i.apply(null,arguments):new Bridge.PromiseException(Array.prototype.slice.call(arguments,0)))},r),u.task}},continueWith:function(n,t){var i=new System.Threading.Tasks.TaskCompletionSource,r=this,u=t?function(){i.setResult(n(r))}:function(){try{i.setResult(n(r))}catch(t){i.setException(System.Exception.create(t))}};return this.isCompleted()?setTimeout(u,0):this.callbacks.push(u),i.task},start:function(){if(this.status!==System.Threading.Tasks.TaskStatus.created)throw new System.InvalidOperationException("Task was already started.");var n=this;this.status=System.Threading.Tasks.TaskStatus.running;setTimeout(function(){try{var t=n.action(n.state);delete n.action;delete n.state;n.complete(t)}catch(i){n.fail(new System.AggregateException(null,[System.Exception.create(i)]))}},0)},runCallbacks:function(){var n=this;setTimeout(function(){for(var t=0;t0?this.exception.innerExceptions.get(0):null:this.exception;default:throw new System.InvalidOperationException("Task is not yet completed.");}},getResult:function(){return this._getResult(!1)},dispose:function(){},getAwaiter:function(){return this},getAwaitedResult:function(){return this._getResult(!0)}});Bridge.define("System.Threading.Tasks.TaskStatus",{$kind:"enum",$statics:{created:0,waitingForActivation:1,waitingToRun:2,running:3,waitingForChildrenToComplete:4,ranToCompletion:5,canceled:6,faulted:7}});Bridge.define("System.Threading.Tasks.TaskCompletionSource",{ctor:function(){this.$initialize();this.task=new System.Threading.Tasks.Task;this.task.status=System.Threading.Tasks.TaskStatus.running},setCanceled:function(){if(!this.task.cancel())throw new System.InvalidOperationException("Task was already completed.");},setResult:function(n){if(!this.task.complete(n))throw new System.InvalidOperationException("Task was already completed.");},setException:function(n){if(!this.trySetException(n))throw new System.InvalidOperationException("Task was already completed.");},trySetCanceled:function(){return this.task.cancel()},trySetResult:function(n){return this.task.complete(n)},trySetException:function(n){return Bridge.is(n,System.Exception)&&(n=[n]),this.task.fail(new System.AggregateException(null,n))}});Bridge.define("System.Threading.CancellationTokenSource",{inherits:[System.IDisposable],config:{alias:["dispose","System$IDisposable$dispose"]},ctor:function(n){this.$initialize();this.timeout=typeof n=="number"&&n>=0?setTimeout(Bridge.fn.bind(this,this.cancel),n,-1):null;this.isCancellationRequested=!1;this.token=new System.Threading.CancellationToken(this);this.handlers=[]},cancel:function(n){var i,r,t;if(!this.isCancellationRequested){for(this.isCancellationRequested=!0,i=[],r=this.handlers,this.clean(),t=0;t0&&n!==-1)throw new System.AggregateException(null,i);}},cancelAfter:function(n){this.isCancellationRequested||(this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(Bridge.fn.bind(this,this.cancel),n,-1))},register:function(n,t){if(this.isCancellationRequested)return n(t),new System.Threading.CancellationTokenRegistration;var i={f:n,s:t};return this.handlers.push(i),new System.Threading.CancellationTokenRegistration(this,i)},deregister:function(n){var t=this.handlers.indexOf(n);t>=0&&this.handlers.splice(t,1)},dispose:function(){this.clean()},clean:function(){if(this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.handlers=[],this.links){for(var n=0;n19)return!1;r=/[^0-9 \-]+/;e=!0}if(!r.test(n))return!1;for(n=n.split(e?"-":/[- ]/).join(""),u=0,i=2-n.length%2;i<=n.length;i+=2)u+=parseInt(n.charAt(i-1));for(i=n.length%2+1;i0)},parse:function(n){if(n==null)throw new System.ArgumentNullException("input");var t={v:new System.Version.VersionResult};if(t.v.init("input",!0),!System.Version.tryParseVersion(n,t))throw t.v.getVersionParseException();return t.v.m_parsedVersion},tryParse:function(n,t){var i={v:new System.Version.VersionResult},r;return i.v.init("input",!1),r=System.Version.tryParseVersion(n,i),t.v=i.v.m_parsedVersion,r},tryParseVersion:function(n,t){var u={},f={},e={},o={},r,i;if(n==null)return t.v.setFailure(System.Version.ParseFailureKind.ArgumentNullException),!1;if(r=n.split(System.Version.separatorsArray),i=r.length,i<2||i>4)return t.v.setFailure(System.Version.ParseFailureKind.ArgumentException),!1;if(!System.Version.tryParseComponent(r[0],"version",t,u)||!System.Version.tryParseComponent(r[1],"version",t,f))return!1;if(i=i-2|0,i>0){if(!System.Version.tryParseComponent(r[2],"build",t,e))return!1;if(i=i-1|0,i>0)if(System.Version.tryParseComponent(r[3],"revision",t,o))t.v.m_parsedVersion=new System.Version.$ctor3(u.v,f.v,e.v,o.v);else return!1;else t.v.m_parsedVersion=new System.Version.$ctor2(u.v,f.v,e.v)}else t.v.m_parsedVersion=new System.Version.$ctor1(u.v,f.v);return!0},tryParseComponent:function(n,t,i,r){return System.Int32.tryParse(n,r)?r.v<0?(i.v.setFailure$1(System.Version.ParseFailureKind.ArgumentOutOfRangeException,t),!1):!0:(i.v.setFailure$1(System.Version.ParseFailureKind.FormatException,n),!1)},op_Equality:function(n,t){return Bridge.referenceEquals(n,null)?Bridge.referenceEquals(t,null):n.equalsT(t)},op_Inequality:function(n,t){return!System.Version.op_Equality(n,t)},op_LessThan:function(n,t){if(n==null)throw new System.ArgumentNullException("v1");return n.compareTo(t)<0},op_LessThanOrEqual:function(n,t){if(n==null)throw new System.ArgumentNullException("v1");return n.compareTo(t)<=0},op_GreaterThan:function(n,t){return System.Version.op_LessThan(t,n)},op_GreaterThanOrEqual:function(n,t){return System.Version.op_LessThanOrEqual(t,n)}},_Major:0,_Minor:0,_Build:-1,_Revision:-1,config:{alias:["clone","System$ICloneable$clone","compareTo","System$IComparable$1$System$Version$compareTo","equalsT","System$IEquatable$1$System$Version$equalsT"]},$ctor3:function(n,t,i,r){if(this.$initialize(),n<0)throw new System.ArgumentOutOfRangeException("major","Cannot be < 0");if(t<0)throw new System.ArgumentOutOfRangeException("minor","Cannot be < 0");if(i<0)throw new System.ArgumentOutOfRangeException("build","Cannot be < 0");if(r<0)throw new System.ArgumentOutOfRangeException("revision","Cannot be < 0");this._Major=n;this._Minor=t;this._Build=i;this._Revision=r},$ctor2:function(n,t,i){if(this.$initialize(),n<0)throw new System.ArgumentOutOfRangeException("major","Cannot be < 0");if(t<0)throw new System.ArgumentOutOfRangeException("minor","Cannot be < 0");if(i<0)throw new System.ArgumentOutOfRangeException("build","Cannot be < 0");this._Major=n;this._Minor=t;this._Build=i},$ctor1:function(n,t){if(this.$initialize(),n<0)throw new System.ArgumentOutOfRangeException("major","Cannot be < 0");if(t<0)throw new System.ArgumentOutOfRangeException("minor","Cannot be < 0");this._Major=n;this._Minor=t},$ctor4:function(n){this.$initialize();var t=System.Version.parse(n);this._Major=t.getMajor();this._Minor=t.getMinor();this._Build=t.getBuild();this._Revision=t.getRevision()},ctor:function(){this.$initialize();this._Major=0;this._Minor=0},getMajor:function(){return this._Major},getMinor:function(){return this._Minor},getBuild:function(){return this._Build},getRevision:function(){return this._Revision},getMajorRevision:function(){return Bridge.Int.sxs(this._Revision>>16&65535)},getMinorRevision:function(){return Bridge.Int.sxs(this._Revision&65535)},clone:function(){var n=new System.Version.ctor;return n._Major=this._Major,n._Minor=this._Minor,n._Build=this._Build,n._Revision=this._Revision,n},compareTo$1:function(n){if(n==null)return 1;var t=Bridge.as(n,System.Version);if(System.Version.op_Equality(t,null))throw new System.ArgumentException("version should be of System.Version type");return this._Major!==t._Major?this._Major>t._Major?1:-1:this._Minor!==t._Minor?this._Minor>t._Minor?1:-1:this._Build!==t._Build?this._Build>t._Build?1:-1:this._Revision!==t._Revision?this._Revision>t._Revision?1:-1:0},compareTo:function(n){return System.Version.op_Equality(n,null)?1:this._Major!==n._Major?this._Major>n._Major?1:-1:this._Minor!==n._Minor?this._Minor>n._Minor?1:-1:this._Build!==n._Build?this._Build>n._Build?1:-1:this._Revision!==n._Revision?this._Revision>n._Revision?1:-1:0},equals:function(n){return this.equalsT(Bridge.as(n,System.Version))},equalsT:function(n){return System.Version.op_Equality(n,null)?!1:this._Major!==n._Major||this._Minor!==n._Minor||this._Build!==n._Build||this._Revision!==n._Revision?!1:!0},getHashCode:function(){var n=0;return n=n|(this._Major&15)<<28,n=n|(this._Minor&255)<<20,n=n|(this._Build&255)<<12,n|this._Revision&4095},toString:function(){return this._Build===-1?this.toString$1(2):this._Revision===-1?this.toString$1(3):this.toString$1(4)},toString$1:function(n){var t;switch(n){case 0:return"";case 1:return this._Major.toString();case 2:return t=new System.Text.StringBuilder,System.Version.appendPositiveNumber(this._Major,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Minor,t),t.toString();default:if(this._Build===-1)throw new System.ArgumentException("Build should be > 0 if fieldCount > 2","fieldCount");if(n===3)return t=new System.Text.StringBuilder,System.Version.appendPositiveNumber(this._Major,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Minor,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Build,t),t.toString();if(this._Revision===-1)throw new System.ArgumentException("Revision should be > 0 if fieldCount > 3","fieldCount");if(n===4)return t=new System.Text.StringBuilder,System.Version.appendPositiveNumber(this._Major,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Minor,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Build,t),t.append(String.fromCharCode(46)),System.Version.appendPositiveNumber(this._Revision,t),t.toString();throw new System.ArgumentException("Should be < 5","fieldCount");}}});Bridge.define("System.Version.ParseFailureKind",{$kind:"enum",statics:{ArgumentNullException:0,ArgumentException:1,ArgumentOutOfRangeException:2,FormatException:3}});Bridge.define("System.Version.VersionResult",{$kind:"struct",statics:{getDefaultValue:function(){return new System.Version.VersionResult}},m_parsedVersion:null,m_failure:0,m_exceptionArgument:null,m_argumentName:null,m_canThrow:!1,ctor:function(){this.$initialize()},init:function(n,t){this.m_canThrow=t;this.m_argumentName=n},setFailure:function(n){this.setFailure$1(n,"")},setFailure$1:function(n,t){if(this.m_failure=n,this.m_exceptionArgument=t,this.m_canThrow)throw this.getVersionParseException();},getVersionParseException:function(){switch(this.m_failure){case System.Version.ParseFailureKind.ArgumentNullException:return new System.ArgumentNullException(this.m_argumentName);case System.Version.ParseFailureKind.ArgumentException:return new System.ArgumentException("VersionString");case System.Version.ParseFailureKind.ArgumentOutOfRangeException:return new System.ArgumentOutOfRangeException(this.m_exceptionArgument,"Cannot be < 0");case System.Version.ParseFailureKind.FormatException:try{System.Int32.parse(this.m_exceptionArgument)}catch(n){n=System.Exception.create(n);var t;if(Bridge.is(n,System.FormatException)||Bridge.is(n,System.OverflowException))return t=n;throw n;}return new System.FormatException("InvalidString");default:return new System.ArgumentException("VersionString")}},getHashCode:function(){return Bridge.addHash([5139482776,this.m_parsedVersion,this.m_failure,this.m_exceptionArgument,this.m_argumentName,this.m_canThrow])},equals:function(n){return Bridge.is(n,System.Version.VersionResult)?Bridge.equals(this.m_parsedVersion,n.m_parsedVersion)&&Bridge.equals(this.m_failure,n.m_failure)&&Bridge.equals(this.m_exceptionArgument,n.m_exceptionArgument)&&Bridge.equals(this.m_argumentName,n.m_argumentName)&&Bridge.equals(this.m_canThrow,n.m_canThrow):!1},$clone:function(n){var t=n||new System.Version.VersionResult;return t.m_parsedVersion=this.m_parsedVersion,t.m_failure=this.m_failure,t.m_exceptionArgument=this.m_exceptionArgument,t.m_argumentName=this.m_argumentName,t.m_canThrow=this.m_canThrow,t}});Bridge.define("System.Attribute",{statics:{getCustomAttributes:function(n,t){if(n==null)throw new System.ArgumentNullException("element");if(t==null)throw new System.ArgumentNullException("attributeType");var i=n.at||[];return t?i.filter(function(n){return Bridge.is(n,t)}):i},getCustomAttributes$1:function(n,t,i){if(n==null)throw new System.ArgumentNullException("element");if(t==null)throw new System.ArgumentNullException("attributeType");return n.getCustomAttributes(t||i)}}});Bridge.define("System.ComponentModel.INotifyPropertyChanged",{$kind:"interface"});Bridge.define("System.ComponentModel.PropertyChangedEventArgs",{ctor:function(n,t,i){this.$initialize();this.propertyName=n;this.newValue=t;this.oldValue=i}});t={};t.convert={typeCodes:{Empty:0,Object:1,DBNull:2,Boolean:3,Char:4,SByte:5,Byte:6,Int16:7,UInt16:8,Int32:9,UInt32:10,Int64:11,UInt64:12,Single:13,Double:14,Decimal:15,DateTime:16,String:18},toBoolean:function(n,i){var r,u;switch(typeof n){case"boolean":return n;case"number":return n!==0;case"string":if(r=n.toLowerCase().trim(),r==="true")return!0;if(r==="false")return!1;throw new System.FormatException("String was not recognized as a valid Boolean.");case"object":if(n==null)return!1;if(n instanceof System.Decimal)return!n.isZero();if(System.Int64.is64Bit(n))return n.ne(0)}return u=t.internal.suggestTypeCode(n),t.internal.throwInvalidCastEx(u,t.convert.typeCodes.Boolean),t.convert.convertToType(t.convert.typeCodes.Boolean,n,i||null)},toChar:function(n,i,r){var u=t.convert.typeCodes,f,e;if(n instanceof System.Decimal&&(n=n.toFloat()),(n instanceof System.Int64||n instanceof System.UInt64)&&(n=n.toNumber()),f=typeof n,r=r||t.internal.suggestTypeCode(n),r===u.String&&n==null&&(f="string"),r!==u.Object)switch(f){case"boolean":t.internal.throwInvalidCastEx(u.Boolean,u.Char);case"number":return e=t.internal.isFloatingType(r),(e||n%1!=0)&&t.internal.throwInvalidCastEx(r,u.Char),t.internal.validateNumberRange(n,u.Char,!0),n;case"string":if(n==null)throw new System.ArgumentNullException("value");if(n.length!==1)throw new System.FormatException("String must be exactly one character long.");return n.charCodeAt(0)}if(r===u.Object||f==="object"){if(n==null)return 0;Bridge.isDate(n)&&t.internal.throwInvalidCastEx(u.DateTime,u.Char)}return t.internal.throwInvalidCastEx(r,t.convert.typeCodes.Char),t.convert.convertToType(u.Char,n,i||null)},toSByte:function(n,i,r){return t.internal.toNumber(n,i||null,t.convert.typeCodes.SByte,r||null)},toByte:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Byte)},toInt16:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Int16)},toUInt16:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.UInt16)},toInt32:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Int32)},toUInt32:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.UInt32)},toInt64:function(n,i){var r=t.internal.toNumber(n,i||null,t.convert.typeCodes.Int64);return new System.Int64(r)},toUInt64:function(n,i){var r=t.internal.toNumber(n,i||null,t.convert.typeCodes.UInt64);return new System.UInt64(r)},toSingle:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Single)},toDouble:function(n,i){return t.internal.toNumber(n,i||null,t.convert.typeCodes.Double)},toDecimal:function(n,i){return n instanceof System.Decimal?n:new System.Decimal(t.internal.toNumber(n,i||null,t.convert.typeCodes.Decimal))},toDateTime:function(n,i){var r=t.convert.typeCodes,u,f;switch(typeof n){case"boolean":t.internal.throwInvalidCastEx(r.Boolean,r.DateTime);case"number":u=t.internal.suggestTypeCode(n);t.internal.throwInvalidCastEx(u,r.DateTime);case"string":return Bridge.Date.parse(n,i||null);case"object":if(n==null)return t.internal.getMinValue(r.DateTime);if(Bridge.isDate(n))return n;n instanceof System.Decimal&&t.internal.throwInvalidCastEx(r.Decimal,r.DateTime);n instanceof System.Int64&&t.internal.throwInvalidCastEx(r.Int64,r.DateTime);n instanceof System.UInt64&&t.internal.throwInvalidCastEx(r.UInt64,r.DateTime)}return f=t.internal.suggestTypeCode(n),t.internal.throwInvalidCastEx(f,t.convert.typeCodes.DateTime),t.convert.convertToType(r.DateTime,n,i||null)},toString:function(n,i,r){var u=t.convert.typeCodes,f=typeof n;switch(f){case"boolean":return n?"True":"False";case"number":return(r||null)===u.Char?String.fromCharCode(n):isNaN(n)?"NaN":(n%1!=0&&(n=parseFloat(n.toPrecision(15))),n.toString());case"string":return n;case"object":return n==null?"":Bridge.isDate(n)?Bridge.Date.format(n,null,i||null):n instanceof System.Decimal?n.isInteger()?n.toFixed(0,4):n.toPrecision(n.precision()):System.Int64.is64Bit(n)?n.toString():n.format?n.format(null,i||null):Bridge.getTypeName(n)}return t.convert.convertToType(t.convert.typeCodes.String,n,i||null)},toNumberInBase:function(n,i,r){var h,o,v,c,b,y,p,u,k,s,e,d;if(i!==2&&i!==8&&i!==10&&i!==16)throw new System.ArgumentException("Invalid Base.");if(h=t.convert.typeCodes,n==null)return r===h.Int64?System.Int64.Zero:r===h.UInt64?System.UInt64.Zero:0;if(n.length===0)throw new System.ArgumentOutOfRangeException("Index was out of range. Must be non-negative and less than the size of the collection.");n=n.toLowerCase();var l=t.internal.getMinValue(r),a=t.internal.getMaxValue(r),w=!1,f=0;if(n[f]==="-"){if(i!==10)throw new System.ArgumentException("String cannot contain a minus sign if the base is not 10.");if(l>=0)throw new System.OverflowException("The string was being parsed as an unsigned number and could not have a negative sign.");w=!0;++f}else n[f]==="+"&&++f;if(i===16&&n.length>=2&&n[f]==="0"&&n[f+1]==="x"&&(f+=2),i===2)o=t.internal.charsToCodes("01");else if(i===8)o=t.internal.charsToCodes("01234567");else if(i===10)o=t.internal.charsToCodes("0123456789");else if(i===16)o=t.internal.charsToCodes("0123456789abcdef");else throw new System.ArgumentException("Invalid Base.");for(v={},c=0;c=y&&s<=p))if(e===f)throw new System.FormatException("Could not find any recognizable digits.");else throw new System.FormatException("Additional non-parsable characters are at the end of the string.");if(d=r===h.Int64,u=d?new System.Int64(Bridge.$Long.fromString(n,!1,i)):new System.UInt64(Bridge.$Long.fromString(n,!0,i)),u.toString(i)!==n)throw new System.OverflowException("Value was either too large or too small.");return u}for(u=0,k=a-l+1,e=f;e=y&&s<=p){if(u*=i,u+=v[s],u>t.internal.typeRanges.Int64_MaxValue)throw new System.OverflowException("Value was either too large or too small.");}else if(e===f)throw new System.FormatException("Could not find any recognizable digits.");else throw new System.FormatException("Additional non-parsable characters are at the end of the string.");if(w&&(u*=-1),u>a&&i!==10&&l<0&&(u=u-k),ua)throw new System.OverflowException("Value was either too large or too small.");return u},toStringInBase:function(n,i,r){var w=t.convert.typeCodes,v,e,h,y,p,o,u,f,c;if(i!==2&&i!==8&&i!==10&&i!==16)throw new System.ArgumentException("Invalid Base.");var l=t.internal.getMinValue(r),a=t.internal.getMaxValue(r),s=System.Int64.is64Bit(n);if(s){if(n.lt(l)||n.gt(a))throw new System.OverflowException("Value was either too large or too small for an unsigned byte.");}else if(na)throw new System.OverflowException("Value was either too large or too small for an unsigned byte.");if(v=!1,s)return i===10?n.toString():n.value.toUnsigned().toString(i);if(n<0&&(i===10?(v=!0,n*=-1):n=a+1-l+n),i===2)e="01";else if(i===8)e="01234567";else if(i===10)e="0123456789";else if(i===16)e="0123456789abcdef";else throw new System.ArgumentException("Invalid Base.");for(h={},y=e.split(""),o=0;o0)f=n%i,n=(n-f)/i,c=h[f],u+=c;return v&&(u+="-"),u.split("").reverse().join("")},toBase64String:function(n,i,r,u){var f;if(n==null)throw new System.ArgumentNullException("inArray");if(i=i||0,r=r!=null?r:n.length,u=u||0,r<0)throw new System.ArgumentOutOfRangeException("length","Index was out of range. Must be non-negative and less than the size of the collection.");if(i<0)throw new System.ArgumentOutOfRangeException("offset","Value must be positive.");if(u<0||u>1)throw new System.ArgumentException("Illegal enum value.");if(f=n.length,i>f-r)throw new System.ArgumentOutOfRangeException("offset","Offset and length must refer to a position in the string.");if(f===0)return"";var o=u===1,s=t.internal.toBase64_CalculateAndValidateOutputLength(r,o),e=[];return e.length=s,t.internal.convertToBase64Array(e,n,i,r,o),e.join("")},toBase64CharArray:function(n,i,r,u,f,e){var o,s,c;if(n==null)throw new System.ArgumentNullException("inArray");if(u==null)throw new System.ArgumentNullException("outArray");if(r<0)throw new System.ArgumentOutOfRangeException("length","Index was out of range. Must be non-negative and less than the size of the collection.");if(i<0)throw new System.ArgumentOutOfRangeException("offsetIn","Value must be positive.");if(f<0)throw new System.ArgumentOutOfRangeException("offsetOut","Value must be positive.");if(e=e||0,e<0||e>1)throw new System.ArgumentException("Illegal enum value.");if(o=n.length,i>o-r)throw new System.ArgumentOutOfRangeException("offsetIn","Offset and length must refer to a position in the string.");if(o===0)return 0;var h=e===1,l=u.length,a=t.internal.toBase64_CalculateAndValidateOutputLength(r,h);if(f>l-a)throw new System.ArgumentOutOfRangeException("offsetOut","Either offset did not refer to a position in the string, or there is an insufficient length of destination character array.");return s=[],c=t.internal.convertToBase64Array(s,n,i,r,h),t.internal.charsToCodes(s,u,f),c},fromBase64String:function(n){if(n==null)throw new System.ArgumentNullException("s");var i=n.split("");return t.internal.fromBase64CharPtr(i,0,i.length)},fromBase64CharArray:function(n,i,r){if(n==null)throw new System.ArgumentNullException("inArray");if(r<0)throw new System.ArgumentOutOfRangeException("length","Index was out of range. Must be non-negative and less than the size of the collection.");if(i<0)throw new System.ArgumentOutOfRangeException("offset","Value must be positive.");if(i>n.length-r)throw new System.ArgumentOutOfRangeException("offset","Offset and length must refer to a position in the string.");var u=t.internal.codesToChars(n);return t.internal.fromBase64CharPtr(u,i,r)},convertToType:function(){throw new System.NotSupportedException("IConvertible interface is not supported.");}};t.internal={base64Table:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/","="],typeRanges:{Char_MinValue:0,Char_MaxValue:65535,Byte_MinValue:0,Byte_MaxValue:255,SByte_MinValue:-128,SByte_MaxValue:127,Int16_MinValue:-32768,Int16_MaxValue:32767,UInt16_MinValue:0,UInt16_MaxValue:65535,Int32_MinValue:-2147483648,Int32_MaxValue:2147483647,UInt32_MinValue:0,UInt32_MaxValue:4294967295,Int64_MinValue:System.Int64.MinValue,Int64_MaxValue:System.Int64.MaxValue,UInt64_MinValue:System.UInt64.MinValue,UInt64_MaxValue:System.UInt64.MaxValue,Single_MinValue:-340282347e30,Single_MaxValue:340282347e30,Double_MinValue:-17976931348623157e292,Double_MaxValue:17976931348623157e292,Decimal_MinValue:System.Decimal.MinValue,Decimal_MaxValue:System.Decimal.MaxValue},base64LineBreakPosition:76,getTypeCodeName:function(n){var r=t.convert.typeCodes,u,i,e,f;if(t.internal.typeCodeNames==null){u={};for(i in r)r.hasOwnProperty(i)&&(e=r[i],u[e]=i);t.internal.typeCodeNames=u}if(f=t.internal.typeCodeNames[n],f==null)throw System.ArgumentOutOfRangeException("typeCode","The specified typeCode is undefined.");return f},suggestTypeCode:function(n){var i=t.convert.typeCodes,r=typeof n;switch(r){case"boolean":return i.Boolean;case"number":return n%1!=0?i.Double:i.Int32;case"string":return i.String;case"object":if(Bridge.isDate(n))return i.DateTime;if(n!=null)return i.Object}return null},getMinValue:function(n){var i=t.convert.typeCodes,r;switch(n){case i.Char:return t.internal.typeRanges.Char_MinValue;case i.SByte:return t.internal.typeRanges.SByte_MinValue;case i.Byte:return t.internal.typeRanges.Byte_MinValue;case i.Int16:return t.internal.typeRanges.Int16_MinValue;case i.UInt16:return t.internal.typeRanges.UInt16_MinValue;case i.Int32:return t.internal.typeRanges.Int32_MinValue;case i.UInt32:return t.internal.typeRanges.UInt32_MinValue;case i.Int64:return t.internal.typeRanges.Int64_MinValue;case i.UInt64:return t.internal.typeRanges.UInt64_MinValue;case i.Single:return t.internal.typeRanges.Single_MinValue;case i.Double:return t.internal.typeRanges.Double_MinValue;case i.Decimal:return t.internal.typeRanges.Decimal_MinValue;case i.DateTime:return r=new Date(0),r.setFullYear(1),r;default:return null}},getMaxValue:function(n){var i=t.convert.typeCodes;switch(n){case i.Char:return t.internal.typeRanges.Char_MaxValue;case i.SByte:return t.internal.typeRanges.SByte_MaxValue;case i.Byte:return t.internal.typeRanges.Byte_MaxValue;case i.Int16:return t.internal.typeRanges.Int16_MaxValue;case i.UInt16:return t.internal.typeRanges.UInt16_MaxValue;case i.Int32:return t.internal.typeRanges.Int32_MaxValue;case i.UInt32:return t.internal.typeRanges.UInt32_MaxValue;case i.Int64:return t.internal.typeRanges.Int64_MaxValue;case i.UInt64:return t.internal.typeRanges.UInt64_MaxValue;case i.Single:return t.internal.typeRanges.Single_MaxValue;case i.Double:return t.internal.typeRanges.Double_MaxValue;case i.Decimal:return t.internal.typeRanges.Decimal_MaxValue;default:throw new System.ArgumentOutOfRangeException("typeCode","The specified typeCode is undefined.");}},isFloatingType:function(n){var i=t.convert.typeCodes;return n===i.Single||n===i.Double||n===i.Decimal},toNumber:function(n,i,r,u){var f=t.convert.typeCodes,e=typeof n,o=t.internal.isFloatingType(r),h,c,s;u===f.String&&(e="string");(System.Int64.is64Bit(n)||n instanceof System.Decimal)&&(e="number");switch(e){case"boolean":return n?1:0;case"number":return r===f.Decimal?(t.internal.validateNumberRange(n,r,!0),new System.Decimal(n,i)):r===f.Int64?(t.internal.validateNumberRange(n,r,!0),new System.Int64(n)):r===f.UInt64?(t.internal.validateNumberRange(n,r,!0),new System.UInt64(n)):(System.Int64.is64Bit(n)?n=n.toNumber():n instanceof System.Decimal&&(n=n.toFloat()),o||n%1==0||(n=t.internal.roundToInt(n,r)),o&&(h=t.internal.getMinValue(r),c=t.internal.getMaxValue(r),n>c?n=Infinity:nn||o.toNumber()n||o.toNumber()o)&&this.throwOverflow(f))},throwOverflow:function(n){throw new System.OverflowException("Value was either too large or too small for '"+n+"'.");},roundToInt:function(n,i){var r,f;if(n%1==0)return n;r=n>=0?Math.floor(n):-1*Math.floor(-n);var u=n-r,e=t.internal.getMinValue(i),o=t.internal.getMaxValue(i);if(n>=0){if(n.5||u===.5&&(r&1)!=0)&&++r,r}else if(n>=e-.5)return(u<-.5||u===-.5&&(r&1)!=0)&&--r,r;f=t.internal.getTypeCodeName(i);throw new System.OverflowException("Value was either too large or too small for an '"+f+"'.");},toBase64_CalculateAndValidateOutputLength:function(n,i){var f=t.internal.base64LineBreakPosition,r=~~(n/3)*4,u;if(r+=n%3!=0?4:0,r===0)return 0;if(i&&(u=~~(r/f),r%f==0&&--u,r+=u*2),r>2147483647)throw new System.OutOfMemoryException;return r},convertToBase64Array:function(n,i,r,u,f){for(var s=t.internal.base64Table,a=t.internal.base64LineBreakPosition,c=u%3,l=r+(u-c),h=0,e=0,o=r;o>2],n[e+1]=s[(i[o]&3)<<4|(i[o+1]&240)>>4],n[e+2]=s[(i[o+1]&15)<<2|(i[o+2]&192)>>6],n[e+3]=s[i[o+2]&63],e+=4;o=l;f&&c!==0&&h===t.internal.base64LineBreakPosition&&(n[e++]="\r",n[e++]="\n");switch(c){case 2:n[e]=s[(i[o]&252)>>2];n[e+1]=s[(i[o]&3)<<4|(i[o+1]&240)>>4];n[e+2]=s[(i[o+1]&15)<<2];n[e+3]=s[64];e+=4;break;case 1:n[e]=s[(i[o]&252)>>2];n[e+1]=s[(i[o]&3)<<4];n[e+2]=s[64];n[e+3]=s[64];e+=4}return e},fromBase64CharPtr:function(n,i,r){var u,f,e;if(r<0)throw new System.ArgumentOutOfRangeException("inputLength","Index was out of range. Must be non-negative and less than the size of the collection.");if(i<0)throw new System.ArgumentOutOfRangeException("offset","Value must be positive.");while(r>0){if(u=n[i+r-1],u!==" "&&u!=="\n"&&u!=="\r"&&u!=="\t")break;r--}if(f=t.internal.fromBase64_ComputeResultLength(n,i,r),0>f)throw new System.InvalidOperationException("Contract voilation: 0 <= resultLength.");return e=[],e.length=f,t.internal.fromBase64_Decode(n,i,r,e,0,f),e},fromBase64_Decode:function(n,t,i,r,u,f){for(var k=u,a="A".charCodeAt(0),v="a".charCodeAt(0),y="0".charCodeAt(0),p="=".charCodeAt(0),d="+".charCodeAt(0),g="/".charCodeAt(0),nt=" ".charCodeAt(0),tt="\t".charCodeAt(0),it="\n".charCodeAt(0),rt="\r".charCodeAt(0),w="Z".charCodeAt(0)-"A".charCodeAt(0),ut="9".charCodeAt(0)-"0".charCodeAt(0),h=t+i,l=u+f,o,e=255,b=!1,c=!1,s;;){if(t>=h){b=!0;break}if(o=n[t].charCodeAt(0),t++,o-a>>>0<=w)o-=a;else if(o-v>>>0<=w)o-=v-26;else if(o-y>>>0<=ut)o-=y-52;else switch(o){case d:o=62;break;case g:o=63;break;case rt:case it:case nt:case tt:continue;case p:c=!0;break;default:throw new System.FormatException("The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.");}if(c)break;if(e=e<<6|o,(e&2147483648)!=0){if(l-u<3)return-1;r[u]=255&e>>16;r[u+1]=255&e>>8;r[u+2]=255&e;u+=3;e=255}}if(!b&&!c)throw new System.InvalidOperationException("Contract violation: should never get here.");if(c){if(o!==p)throw new System.InvalidOperationException("Contract violation: currCode == intEq.");if(t===h){if(e<<=6,(e&2147483648)==0)throw new System.FormatException("Invalid length for a Base-64 char array or string.");if(l-u<2)return-1;r[u]=255&e>>16;r[u+1]=255&e>>8;u+=2;e=255}else{while(t>16;u++;e=255}else throw new System.FormatException("The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.");}}if(e!==255)throw new System.FormatException("Invalid length for a Base-64 char array or string.");return u-k},fromBase64_ComputeResultLength:function(n,t,i){var f;if(i<0)throw new System.ArgumentOutOfRangeException("inputLength","Index was out of range. Must be non-negative and less than the size of the collection.");for(var e=t+i,u=i,r=0;tu)throw new System.InvalidOperationException("Contract violation: 0 <= usefulInputLength.");if(0>r)throw new System.InvalidOperationException("Contract violation: 0 <= padding.");if(r!==0)if(r===1)r=2;else if(r===2)r=1;else throw new System.FormatException("The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.");return~~(u/4)*3+r},charsToCodes:function(n,t,i){if(n==null)return null;i=i||0;t==null&&(t=[],t.length=n.length);for(var r=0;r-1)throw new System.ArgumentException("Socket cannot have duplicate sub-protocols.","subProtocol");this.requestedSubProtocols.push(n)}});Bridge.define("System.Net.WebSockets.WebSocketReceiveResult",{ctor:function(n,t,i,r,u){this.$initialize();this.count=n;this.messageType=t;this.endOfMessage=i;this.closeStatus=r;this.closeStatusDescription=u},getCount:function(){return this.count},getMessageType:function(){return this.messageType},getEndOfMessage:function(){return this.endOfMessage},getCloseStatus:function(){return this.closeStatus},getCloseStatusDescription:function(){return this.closeStatusDescription}});Bridge.define("System.Uri",{ctor:function(n){this.$initialize();this.absoluteUri=n},getAbsoluteUri:function(){return this.absoluteUri}}),function(n,t){var f={Identity:function(n){return n},True:function(){return!0},Blank:function(){}},o={Boolean:"boolean",Number:"number",String:"string",Object:"object",Undefined:typeof t,Function:typeof function(){}},w={"":f.Identity},r={createLambda:function(n){var t,l,i,a,u,e,r,s,h,v,c;if(n==null)return f.Identity;if(typeof n===o.String){if(t=w[n],t!=null)return t;if(n.indexOf("=>")===-1){for(l=new RegExp("[$]+","g"),i=0;(a=l.exec(n))!=null;)u=a[0].length,u>i&&(i=u);for(e=[],r=1;r<=i;r++){for(s="",h=0;h(.*)/),t=new Function(c[1],"return "+c[2]),w[n]=t,t}return n},isIEnumerable:function(n){if(typeof Enumerator!==o.Undefined)try{return new Enumerator(n),!0}catch(t){}return!1},defineProperty:Object.defineProperties!=null?function(n,t,i){Object.defineProperty(n,t,{enumerable:!1,configurable:!0,writable:!0,value:i})}:function(n,t,i){n[t]=i},compare:function(n,t){return n===t?0:n>t?1:-1},dispose:function(n){n!=null&&n.dispose()}},l={Before:0,Running:1,After:2},u=function(n,t,i){var u=new b,r=l.Before;this.getCurrent=u.getCurrent;this.reset=function(){throw new Error("Reset is not supported");};this.moveNext=function(){try{switch(r){case l.Before:r=l.Running;n();case l.Running:return t.apply(u)?!0:(this.dispose(),!1);case l.After:return!1}}catch(i){this.dispose();throw i;}};this.dispose=function(){if(r==l.Running)try{i()}finally{r=l.After}};this.getCurrent$1=this.getCurrent;this.System$Collections$IEnumerator$getCurrent=this.getCurrent;this.System$Collections$IEnumerator$moveNext=this.moveNext;this.System$Collections$IEnumerator$reset=this.reset},b,i,k,s,a,y,e,h,c,p,v;u.$$inherits=[];Bridge.Class.addExtend(u,[System.IDisposable,System.Collections.IEnumerator]);b=function(){var n=null;this.getCurrent=function(){return n};this.yieldReturn=function(t){return n=t,!0};this.yieldBreak=function(){return!1}};i=function(n){this.getEnumerator=n};i.$$inherits=[];Bridge.Class.addExtend(i,[System.Collections.IEnumerable]);i.Utils={};i.Utils.createLambda=function(n){return r.createLambda(n)};i.Utils.createEnumerable=function(n){return new i(n)};i.Utils.createEnumerator=function(n,t,i){return new u(n,t,i)};i.Utils.extendTo=function(n){var u=n.prototype,o,t,f;n===Array?(o=e.prototype,r.defineProperty(u,"getSource",function(){return this})):(o=i.prototype,r.defineProperty(u,"getEnumerator",function(){return i.from(this).getEnumerator()}));for(t in o)(f=o[t],u[t]!=f)&&(u[t]==null||(t=t+"ByLinq",u[t]!=f))&&f instanceof Function&&r.defineProperty(u,t,f)};i.choice=function(){var n=arguments;return new i(function(){return new u(function(){n=n[0]instanceof Array?n[0]:n[0].getEnumerator!=null?n[0].toArray():n},function(){return this.yieldReturn(n[Math.floor(Math.random()*n.length)])},f.Blank)})};i.cycle=function(){var n=arguments;return new i(function(){var t=0;return new u(function(){n=n[0]instanceof Array?n[0]:n[0].getEnumerator!=null?n[0].toArray():n},function(){return t>=n.length&&(t=0),this.yieldReturn(n[t++])},f.Blank)})};k=new i(function(){return new u(f.Blank,function(){return!1},f.Blank)});i.empty=function(){return k};i.from=function(n){if(n==null)return i.empty();if(n instanceof i)return n;if(typeof n==o.Number||typeof n==o.Boolean)return i.repeat(n,1);if(typeof n==o.String)return new i(function(){var t=0;return new u(f.Blank,function(){return t=t?this.yieldReturn(n):this.yieldBreak()},f.Blank)})};i.repeat=function(n,t){return t!=null?i.repeat(n).take(t):new i(function(){return new u(f.Blank,function(){return this.yieldReturn(n)},f.Blank)})};i.repeatWithFinalize=function(n,t){return n=r.createLambda(n),t=r.createLambda(t),new i(function(){var i;return new u(function(){i=n()},function(){return this.yieldReturn(i)},function(){i!=null&&(t(i),i=null)})})};i.generate=function(n,t){return t!=null?i.generate(n).take(t):(n=r.createLambda(n),new i(function(){return new u(f.Blank,function(){return this.yieldReturn(n())},f.Blank)}))};i.toInfinity=function(n,t){return n==null&&(n=0),t==null&&(t=1),new i(function(){var i;return new u(function(){i=n-t},function(){return this.yieldReturn(i+=t)},f.Blank)})};i.toNegativeInfinity=function(n,t){return n==null&&(n=0),t==null&&(t=1),new i(function(){var i;return new u(function(){i=n+t},function(){return this.yieldReturn(i-=t)},f.Blank)})};i.unfold=function(n,t){return t=r.createLambda(t),new i(function(){var r=!0,i;return new u(f.Blank,function(){return r?(r=!1,i=n,this.yieldReturn(i)):(i=t(i),this.yieldReturn(i))},f.Blank)})};i.defer=function(n){return new i(function(){var t;return new u(function(){t=i.from(n()).getEnumerator()},function(){return t.moveNext()?this.yieldReturn(t.getCurrent()):this.yieldBreak()},function(){r.dispose(t)})})};i.prototype.traverseBreadthFirst=function(n,t){var f=this;return n=r.createLambda(n),t=r.createLambda(t),new i(function(){var e,s=0,o=[];return new u(function(){e=f.getEnumerator()},function(){for(;;){if(e.moveNext())return o.push(e.getCurrent()),this.yieldReturn(t(e.getCurrent(),s));var u=i.from(o).selectMany(function(t){return n(t)});if(u.any())s++,o=[],r.dispose(e),e=u.getEnumerator();else return!1}},function(){r.dispose(e)})})};i.prototype.traverseDepthFirst=function(n,t){var f=this;return n=r.createLambda(n),t=r.createLambda(t),new i(function(){var o=[],e;return new u(function(){e=f.getEnumerator()},function(){for(;;){if(e.moveNext()){var u=t(e.getCurrent(),o.length);return o.push(e),e=i.from(n(e.getCurrent())).getEnumerator(),this.yieldReturn(u)}if(o.length<=0)return!1;r.dispose(e);e=o.pop()}},function(){try{r.dispose(e)}finally{i.from(o).forEach(function(n){n.dispose()})}})})};i.prototype.flatten=function(){var n=this;return new i(function(){var e,t=null;return new u(function(){e=n.getEnumerator()},function(){for(;;){if(t!=null){if(t.moveNext())return this.yieldReturn(t.getCurrent());t=null}if(e.moveNext())if(e.getCurrent()instanceof Array){r.dispose(t);t=i.from(e.getCurrent()).selectMany(f.Identity).flatten().getEnumerator();continue}else return this.yieldReturn(e.getCurrent());return!1}},function(){try{r.dispose(e)}finally{r.dispose(t)}})})};i.prototype.pairwise=function(n){var t=this;return n=r.createLambda(n),new i(function(){var i;return new u(function(){i=t.getEnumerator();i.moveNext()},function(){var t=i.getCurrent();return i.moveNext()?this.yieldReturn(n(t,i.getCurrent())):!1},function(){r.dispose(i)})})};i.prototype.scan=function(n,t){var f,e;return t==null?(t=r.createLambda(n),f=!1):(t=r.createLambda(t),f=!0),e=this,new i(function(){var i,o,s=!0;return new u(function(){i=e.getEnumerator()},function(){if(s){if(s=!1,f)return this.yieldReturn(o=n);if(i.moveNext())return this.yieldReturn(o=i.getCurrent())}return i.moveNext()?this.yieldReturn(o=t(o,i.getCurrent())):!1},function(){r.dispose(i)})})};i.prototype.select=function(n){if(n=r.createLambda(n),n.length<=1)return new c(this,null,n);var t=this;return new i(function(){var i,f=0;return new u(function(){i=t.getEnumerator()},function(){return i.moveNext()?this.yieldReturn(n(i.getCurrent(),f++)):!1},function(){r.dispose(i)})})};i.prototype.selectMany=function(n,f){var e=this;return n=r.createLambda(n),f==null&&(f=function(n,t){return t}),f=r.createLambda(f),new i(function(){var s,o=t,h=0;return new u(function(){s=e.getEnumerator()},function(){if(o===t&&!s.moveNext())return!1;do{if(o==null){var u=n(s.getCurrent(),h++);o=i.from(u).getEnumerator()}if(o.moveNext())return this.yieldReturn(f(s.getCurrent(),o.getCurrent()));r.dispose(o);o=null}while(s.moveNext());return!1},function(){try{r.dispose(s)}finally{r.dispose(o)}})})};i.prototype.where=function(n){if(n=r.createLambda(n),n.length<=1)return new h(this,n);var t=this;return new i(function(){var i,f=0;return new u(function(){i=t.getEnumerator()},function(){while(i.moveNext())if(n(i.getCurrent(),f++))return this.yieldReturn(i.getCurrent());return!1},function(){r.dispose(i)})})};i.prototype.choose=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i,f=0;return new u(function(){i=t.getEnumerator()},function(){while(i.moveNext()){var t=n(i.getCurrent(),f++);if(t!=null)return this.yieldReturn(t)}return this.yieldBreak()},function(){r.dispose(i)})})};i.prototype.ofType=function(n){var t=this;return new i(function(){var i;return new u(function(){i=Bridge.getEnumerator(t)},function(){while(i.moveNext()){var t=Bridge.as(i.getCurrent(),n);if(Bridge.hasValue(t))return this.yieldReturn(t)}return!1},function(){r.dispose(i)})})};i.prototype.zip=function(){var e=arguments,n=r.createLambda(arguments[arguments.length-1]),t=this,f;return arguments.length==2?(f=arguments[0],new i(function(){var e,o,s=0;return new u(function(){e=t.getEnumerator();o=i.from(f).getEnumerator()},function(){return e.moveNext()&&o.moveNext()?this.yieldReturn(n(e.getCurrent(),o.getCurrent(),s++)):!1},function(){try{r.dispose(e)}finally{r.dispose(o)}})})):new i(function(){var f,o=0;return new u(function(){var n=i.make(t).concat(i.from(e).takeExceptLast().select(i.from)).select(function(n){return n.getEnumerator()}).toArray();f=i.from(n)},function(){if(f.all(function(n){return n.moveNext()})){var t=f.select(function(n){return n.getCurrent()}).toArray();return t.push(o++),this.yieldReturn(n.apply(null,t))}return this.yieldBreak()},function(){i.from(f).forEach(r.dispose)})})};i.prototype.merge=function(){var n=arguments,t=this;return new i(function(){var f,e=-1;return new u(function(){f=i.make(t).concat(i.from(n).select(i.from)).select(function(n){return n.getEnumerator()}).toArray()},function(){while(f.length>0){e=e>=f.length-1?0:e+1;var n=f[e];if(n.moveNext())return this.yieldReturn(n.getCurrent());n.dispose();f.splice(e--,1)}return this.yieldBreak()},function(){i.from(f).forEach(r.dispose)})})};i.prototype.join=function(n,e,o,s,h){e=r.createLambda(e);o=r.createLambda(o);s=r.createLambda(s);var c=this;return new i(function(){var l,v,a=null,y=0;return new u(function(){l=c.getEnumerator();v=i.from(n).toLookup(o,f.Identity,h)},function(){for(var n,i;;){if(a!=null){if(n=a[y++],n!==t)return this.yieldReturn(s(l.getCurrent(),n));n=null;y=0}if(l.moveNext())i=e(l.getCurrent()),a=v.get(i).toArray();else return!1}},function(){r.dispose(l)})})};i.prototype.groupJoin=function(n,t,e,o,s){t=r.createLambda(t);e=r.createLambda(e);o=r.createLambda(o);var h=this;return new i(function(){var c=h.getEnumerator(),l=null;return new u(function(){c=h.getEnumerator();l=i.from(n).toLookup(e,f.Identity,s)},function(){if(c.moveNext()){var n=l.get(t(c.getCurrent()));return this.yieldReturn(o(c.getCurrent(),n))}return!1},function(){r.dispose(c)})})};i.prototype.all=function(n){n=r.createLambda(n);var t=!0;return this.forEach(function(i){if(!n(i))return t=!1,!1}),t};i.prototype.any=function(n){n=r.createLambda(n);var t=this.getEnumerator();try{if(arguments.length==0)return t.moveNext();while(t.moveNext())if(n(t.getCurrent()))return!0;return!1}finally{r.dispose(t)}};i.prototype.isEmpty=function(){return!this.any()};i.prototype.concat=function(){var n=this,t,f;return arguments.length==1?(t=arguments[0],new i(function(){var e,f;return new u(function(){e=n.getEnumerator()},function(){if(f==null){if(e.moveNext())return this.yieldReturn(e.getCurrent());f=i.from(t).getEnumerator()}return f.moveNext()?this.yieldReturn(f.getCurrent()):!1},function(){try{r.dispose(e)}finally{r.dispose(f)}})})):(f=arguments,new i(function(){var t;return new u(function(){t=i.make(n).concat(i.from(f).select(i.from)).select(function(n){return n.getEnumerator()}).toArray()},function(){while(t.length>0){var n=t[0];if(n.moveNext())return this.yieldReturn(n.getCurrent());n.dispose();t.splice(0,1)}return this.yieldBreak()},function(){i.from(t).forEach(r.dispose)})}))};i.prototype.insert=function(n,t){var f=this;return new i(function(){var o,e,s=0,h=!1;return new u(function(){o=f.getEnumerator();e=i.from(t).getEnumerator()},function(){return s==n&&e.moveNext()?(h=!0,this.yieldReturn(e.getCurrent())):o.moveNext()?(s++,this.yieldReturn(o.getCurrent())):!h&&e.moveNext()?this.yieldReturn(e.getCurrent()):!1},function(){try{r.dispose(o)}finally{r.dispose(e)}})})};i.prototype.alternate=function(n){var t=this;return new i(function(){var f,e,s,o;return new u(function(){s=n instanceof Array||n.getEnumerator!=null?i.from(i.from(n).toArray()):i.make(n);e=t.getEnumerator();e.moveNext()&&(f=e.getCurrent())},function(){for(;;){if(o!=null){if(o.moveNext())return this.yieldReturn(o.getCurrent());o=null}if(f==null&&e.moveNext()){f=e.getCurrent();o=s.getEnumerator();continue}else if(f!=null){var n=f;return f=null,this.yieldReturn(n)}return this.yieldBreak()}},function(){try{r.dispose(e)}finally{r.dispose(o)}})})};i.prototype.contains=function(n,t){t=t||System.Collections.Generic.EqualityComparer$1.$default;var i=this.getEnumerator();try{while(i.moveNext())if(t.equals2(i.getCurrent(),n))return!0;return!1}finally{r.dispose(i)}};i.prototype.defaultIfEmpty=function(n){var f=this;return n===t&&(n=null),new i(function(){var t,i=!0;return new u(function(){t=f.getEnumerator()},function(){return t.moveNext()?(i=!1,this.yieldReturn(t.getCurrent())):i?(i=!1,this.yieldReturn(n)):!1},function(){r.dispose(t)})})};i.prototype.distinct=function(n){return this.except(i.empty(),n)};i.prototype.distinctUntilChanged=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i,f,e;return new u(function(){i=t.getEnumerator()},function(){while(i.moveNext()){var t=n(i.getCurrent());if(e)return e=!1,f=t,this.yieldReturn(i.getCurrent());if(f!==t)return f=t,this.yieldReturn(i.getCurrent())}return this.yieldBreak()},function(){r.dispose(i)})})};i.prototype.except=function(n,t){var f=this;return new i(function(){var o,e;return new u(function(){o=f.getEnumerator();e=new(System.Collections.Generic.Dictionary$2(Object,Object))(null,t);i.from(n).forEach(function(n){e.containsKey(n)||e.add(n)})},function(){while(o.moveNext()){var n=o.getCurrent();if(!e.containsKey(n))return e.add(n),this.yieldReturn(n)}return!1},function(){r.dispose(o)})})};i.prototype.intersect=function(n,t){var f=this;return new i(function(){var e,o,s;return new u(function(){e=f.getEnumerator();o=new(System.Collections.Generic.Dictionary$2(Object,Object))(null,t);i.from(n).forEach(function(n){o.containsKey(n)||o.add(n)});s=new(System.Collections.Generic.Dictionary$2(Object,Object))(null,t)},function(){while(e.moveNext()){var n=e.getCurrent();if(!s.containsKey(n)&&o.containsKey(n))return s.add(n),this.yieldReturn(n)}return!1},function(){r.dispose(e)})})};i.prototype.sequenceEqual=function(n,t){var f,u;t=t||System.Collections.Generic.EqualityComparer$1.$default;f=this.getEnumerator();try{u=i.from(n).getEnumerator();try{while(f.moveNext())if(!u.moveNext()||!t.equals2(f.getCurrent(),u.getCurrent()))return!1;return u.moveNext()?!1:!0}finally{r.dispose(u)}}finally{r.dispose(f)}};i.prototype.union=function(n,f){var e=this;return new i(function(){var h,o,s;return new u(function(){h=e.getEnumerator();s=new(System.Collections.Generic.Dictionary$2(Object,Object))(null,f)},function(){var r;if(o===t){while(h.moveNext())if(r=h.getCurrent(),!s.containsKey(r))return s.add(r),this.yieldReturn(r);o=i.from(n).getEnumerator()}while(o.moveNext())if(r=o.getCurrent(),!s.containsKey(r))return s.add(r),this.yieldReturn(r);return!1},function(){try{r.dispose(h)}finally{r.dispose(o)}})})};i.prototype.orderBy=function(n,t){return new s(this,n,t,!1)};i.prototype.orderByDescending=function(n,t){return new s(this,n,t,!0)};i.prototype.reverse=function(){var n=this;return new i(function(){var t,i;return new u(function(){t=n.toArray();i=t.length},function(){return i>0?this.yieldReturn(t[--i]):!1},f.Blank)})};i.prototype.shuffle=function(){var n=this;return new i(function(){var t;return new u(function(){t=n.toArray()},function(){if(t.length>0){var n=Math.floor(Math.random()*t.length);return this.yieldReturn(t.splice(n,1)[0])}return!1},f.Blank)})};i.prototype.weightedSample=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i,r=0;return new u(function(){i=t.choose(function(t){var i=n(t);return i<=0?null:(r+=i,{value:t,bound:r})}).toArray()},function(){var t;if(i.length>0){for(var f=Math.floor(Math.random()*r)+1,u=-1,n=i.length;n-u>1;)t=Math.floor((u+n)/2),i[t].bound>=f?n=t:u=t;return this.yieldReturn(i[n].value)}return this.yieldBreak()},f.Blank)})};i.prototype.groupBy=function(n,t,f,e){var o=this;return n=r.createLambda(n),t=r.createLambda(t),f!=null&&(f=r.createLambda(f)),new i(function(){var i;return new u(function(){i=o.toLookup(n,t,e).toEnumerable().getEnumerator()},function(){while(i.moveNext())return f==null?this.yieldReturn(i.getCurrent()):this.yieldReturn(f(i.getCurrent().key(),i.getCurrent()));return!1},function(){r.dispose(i)})})};i.prototype.partitionBy=function(n,t,f,e){var s=this,o;return n=r.createLambda(n),t=r.createLambda(t),e=e||System.Collections.Generic.EqualityComparer$1.$default,f==null?(o=!1,f=function(n,t){return new v(n,t)}):(o=!0,f=r.createLambda(f)),new i(function(){var h,l,c=[];return new u(function(){h=s.getEnumerator();h.moveNext()&&(l=n(h.getCurrent()),c.push(t(h.getCurrent())))},function(){for(var r,u;(r=h.moveNext())==!0;)if(e.equals2(l,n(h.getCurrent())))c.push(t(h.getCurrent()));else break;return c.length>0?(u=o?f(l,i.from(c)):f(l,c),r?(l=n(h.getCurrent()),c=[t(h.getCurrent())]):c=[],this.yieldReturn(u)):!1},function(){r.dispose(h)})})};i.prototype.buffer=function(n){var t=this;return new i(function(){var i;return new u(function(){i=t.getEnumerator()},function(){for(var t=[],r=0;i.moveNext();)if(t.push(i.getCurrent()),++r>=n)return this.yieldReturn(t);return t.length>0?this.yieldReturn(t):!1},function(){r.dispose(i)})})};i.prototype.aggregate=function(n,t,i){return i=r.createLambda(i),i(this.scan(n,t,i).last())};i.prototype.average=function(n,t){!n||t||Bridge.isFunction(n)||(t=n,n=null);n=r.createLambda(n);var i=t||0,u=0;if(this.forEach(function(t){t=n(t);t instanceof System.Decimal||System.Int64.is64Bit(t)?i=t.add(i):i instanceof System.Decimal||System.Int64.is64Bit(i)?i=i.add(t):i+=t;++u}),u===0)throw new System.InvalidOperationException("Sequence contains no elements");return i instanceof System.Decimal||System.Int64.is64Bit(i)?i.div(u):i/u};i.prototype.nullableAverage=function(n,t){return this.any(Bridge.isNull)?null:this.average(n,t)};i.prototype.count=function(n){n=n==null?f.True:r.createLambda(n);var t=0;return this.forEach(function(i,r){n(i,r)&&++t}),t};i.prototype.max=function(n){return n==null&&(n=f.Identity),this.select(n).aggregate(function(n,t){return Bridge.compare(n,t,!0)===1?n:t})};i.prototype.nullableMax=function(n){return this.any(Bridge.isNull)?null:this.max(n)};i.prototype.min=function(n){return n==null&&(n=f.Identity),this.select(n).aggregate(function(n,t){return Bridge.compare(n,t,!0)===-1?n:t})};i.prototype.nullableMin=function(n){return this.any(Bridge.isNull)?null:this.min(n)};i.prototype.maxBy=function(n){return n=r.createLambda(n),this.aggregate(function(t,i){return Bridge.compare(n(t),n(i),!0)===1?t:i})};i.prototype.minBy=function(n){return n=r.createLambda(n),this.aggregate(function(t,i){return Bridge.compare(n(t),n(i),!0)===-1?t:i})};i.prototype.sum=function(n,t){!n||t||Bridge.isFunction(n)||(t=n,n=null);n==null&&(n=f.Identity);var i=this.select(n).aggregate(0,function(n,t){return n instanceof System.Decimal||System.Int64.is64Bit(n)?n.add(t):t instanceof System.Decimal||System.Int64.is64Bit(t)?t.add(n):n+t});return i===0&&t?t:i};i.prototype.nullableSum=function(n,t){return this.any(Bridge.isNull)?null:this.sum(n,t)};i.prototype.elementAt=function(n){var t,i=!1;if(this.forEach(function(r,u){if(u==n)return t=r,i=!0,!1}),!i)throw new Error("index is less than 0 or greater than or equal to the number of elements in source.");return t};i.prototype.elementAtOrDefault=function(n,i){i===t&&(i=null);var r,u=!1;return this.forEach(function(t,i){if(i==n)return r=t,u=!0,!1}),u?r:i};i.prototype.first=function(n){if(n!=null)return this.where(n).first();var t,i=!1;if(this.forEach(function(n){return t=n,i=!0,!1}),!i)throw new Error("first:No element satisfies the condition.");return t};i.prototype.firstOrDefault=function(n,i){if(i===t&&(i=null),n!=null)return this.where(n).firstOrDefault(null,i);var r,u=!1;return this.forEach(function(n){return r=n,u=!0,!1}),u?r:i};i.prototype.last=function(n){if(n!=null)return this.where(n).last();var t,i=!1;if(this.forEach(function(n){i=!0;t=n}),!i)throw new Error("last:No element satisfies the condition.");return t};i.prototype.lastOrDefault=function(n,i){if(i===t&&(i=null),n!=null)return this.where(n).lastOrDefault(null,i);var r,u=!1;return this.forEach(function(n){u=!0;r=n}),u?r:i};i.prototype.single=function(n){if(n!=null)return this.where(n).single();var i,t=!1;if(this.forEach(function(n){if(t)throw new Error("single:sequence contains more than one element.");else t=!0,i=n}),!t)throw new Error("single:No element satisfies the condition.");return i};i.prototype.singleOrDefault=function(n,i){if(i===t&&(i=null),n!=null)return this.where(n).singleOrDefault(null,i);var u,r=!1;return this.forEach(function(n){if(r)throw new Error("single:sequence contains more than one element.");else r=!0,u=n}),r?u:i};i.prototype.skip=function(n){var t=this;return new i(function(){var i,f=0;return new u(function(){for(i=t.getEnumerator();f++")})};i.prototype.force=function(){var n=this.getEnumerator();try{while(n.moveNext());}finally{r.dispose(n)}};i.prototype.letBind=function(n){n=r.createLambda(n);var t=this;return new i(function(){var f;return new u(function(){f=i.from(n(t)).getEnumerator()},function(){return f.moveNext()?this.yieldReturn(f.getCurrent()):!1},function(){r.dispose(f)})})};i.prototype.share=function(){var i=this,n,t=!1;return new y(function(){return new u(function(){n==null&&(n=i.getEnumerator())},function(){if(t)throw new Error("enumerator is disposed");return n.moveNext()?this.yieldReturn(n.getCurrent()):!1},f.Blank)},function(){t=!0;r.dispose(n)})};i.prototype.memoize=function(){var e=this,n,t,i=!1;return new y(function(){var r=-1;return new u(function(){t==null&&(t=e.getEnumerator(),n=[])},function(){if(i)throw new Error("enumerator is disposed");return(r++,n.length<=r)?t.moveNext()?this.yieldReturn(n[r]=t.getCurrent()):!1:this.yieldReturn(n[r])},f.Blank)},function(){i=!0;r.dispose(t);n=null})};i.prototype.catchError=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i;return new u(function(){i=t.getEnumerator()},function(){try{return i.moveNext()?this.yieldReturn(i.getCurrent()):!1}catch(t){return n(t),!1}},function(){r.dispose(i)})})};i.prototype.finallyAction=function(n){n=r.createLambda(n);var t=this;return new i(function(){var i;return new u(function(){i=t.getEnumerator()},function(){return i.moveNext()?this.yieldReturn(i.getCurrent()):!1},function(){try{r.dispose(i)}finally{n()}})})};i.prototype.log=function(n){return n=r.createLambda(n),this.doAction(function(t){typeof console!==o.Undefined&&console.log(n(t))})};i.prototype.trace=function(n,t){return n==null&&(n="Trace"),t=r.createLambda(t),this.doAction(function(i){typeof console!==o.Undefined&&console.log(n,t(i))})};s=function(n,t,i,u,f){this.source=n;this.keySelector=r.createLambda(t);this.comparer=i||System.Collections.Generic.Comparer$1.$default;this.descending=u;this.parent=f};s.prototype=new i;s.prototype.createOrderedEnumerable=function(n,t,i){return new s(this.source,n,t,i,this)};s.prototype.thenBy=function(n,t){return this.createOrderedEnumerable(n,t,!1)};s.prototype.thenByDescending=function(n,t){return this.createOrderedEnumerable(n,t,!0)};s.prototype.getEnumerator=function(){var i=this,t,n,r=0;return new u(function(){t=[];n=[];i.source.forEach(function(i,r){t.push(i);n.push(r)});var r=a.create(i,null);r.GenerateKeys(t);n.sort(function(n,t){return r.compare(n,t)})},function(){return r0:i.prototype.any.apply(this,arguments)};e.prototype.count=function(n){return n==null?this.getSource().length:i.prototype.count.apply(this,arguments)};e.prototype.elementAt=function(n){var t=this.getSource();return 0<=n&&n0?t[0]:i.prototype.first.apply(this,arguments)};e.prototype.firstOrDefault=function(n,r){if(r===t&&(r=null),n!=null)return i.prototype.firstOrDefault.apply(this,arguments);var u=this.getSource();return u.length>0?u[0]:r};e.prototype.last=function(n){var t=this.getSource();return n==null&&t.length>0?t[t.length-1]:i.prototype.last.apply(this,arguments)};e.prototype.lastOrDefault=function(n,r){if(r===t&&(r=null),n!=null)return i.prototype.lastOrDefault.apply(this,arguments);var u=this.getSource();return u.length>0?u[u.length-1]:r};e.prototype.skip=function(n){var t=this.getSource();return new i(function(){var i;return new u(function(){i=n<0?0:n},function(){return i0?this.yieldReturn(n[--t]):!1},f.Blank)})};e.prototype.sequenceEqual=function(n,t){return(n instanceof e||n instanceof Array)&&t==null&&i.from(n).count()!=this.count()?!1:i.prototype.sequenceEqual.apply(this,arguments)};e.prototype.toJoinedString=function(n,t){var r=this.getSource();return t!=null||!(r instanceof Array)?i.prototype.toJoinedString.apply(this,arguments):(n==null&&(n=""),r.join(n))};e.prototype.getEnumerator=function(){return new Bridge.ArrayEnumerator(this.getSource())};h=function(n,t){this.prevSource=n;this.prevPredicate=t};h.prototype=new i;h.prototype.where=function(n){if(n=r.createLambda(n),n.length<=1){var t=this.prevPredicate,u=function(i){return t(i)&&n(i)};return new h(this.prevSource,u)}return i.prototype.where.call(this,n)};h.prototype.select=function(n){return n=r.createLambda(n),n.length<=1?new c(this.prevSource,this.prevPredicate,n):i.prototype.select.call(this,n)};h.prototype.getEnumerator=function(){var t=this.prevPredicate,i=this.prevSource,n;return new u(function(){n=i.getEnumerator()},function(){while(n.moveNext())if(t(n.getCurrent()))return this.yieldReturn(n.getCurrent());return!1},function(){r.dispose(n)})};c=function(n,t,i){this.prevSource=n;this.prevPredicate=t;this.prevSelector=i};c.prototype=new i;c.prototype.where=function(n){return n=r.createLambda(n),n.length<=1?new h(this,n):i.prototype.where.call(this,n)};c.prototype.select=function(n){if(n=r.createLambda(n),n.length<=1){var t=this.prevSelector,u=function(i){return n(t(i))};return new c(this.prevSource,this.prevPredicate,u)}return i.prototype.select.call(this,n)};c.prototype.getEnumerator=function(){var t=this.prevPredicate,i=this.prevSelector,f=this.prevSource,n;return new u(function(){n=f.getEnumerator()},function(){while(n.moveNext())if(t==null||t(n.getCurrent()))return this.yieldReturn(i(n.getCurrent()));return!1},function(){r.dispose(n)})};p=function(n,t){this.count=function(){return n.getCount()};this.get=function(t){var r={v:null},u=n.tryGetValue(t,r);return i.from(u?r.v:[])};this.contains=function(t){return n.containsKey(t)};this.toEnumerable=function(){return i.from(t).select(function(t){return new v(t,n.get(t))})};this.getEnumerator=function(){return this.toEnumerable().getEnumerator()}};p.$$inherits=[];Bridge.Class.addExtend(p,[System.Collections.IEnumerable]);v=function(n,t){this.key=function(){return n};e.call(this,t)};v.prototype=new e;v.$$inherits=[];Bridge.Class.addExtend(v,[System.Collections.IEnumerable]);Bridge.Linq={};Bridge.Linq.Enumerable=i;System.Linq={};System.Linq.Enumerable=i}(Bridge.global);Bridge.define("System.Guid",{inherits:function(){return[System.IEquatable$1(System.Guid),System.IComparable$1(System.Guid),System.IFormattable]},$kind:"struct",statics:{error1:"Byte array for GUID must be exactly {0} bytes long",valid:null,split:null,nonFormat:null,replace:null,rnd:null,config:{init:function(){this.valid=new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$","i");this.split=new RegExp("^(.{8})(.{4})(.{4})(.{4})(.{12})$");this.nonFormat=new RegExp("^[{(]?([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})[)}]?$","i");this.replace=new RegExp("-","g");this.rnd=new System.Random.ctor;this.empty=new System.Guid.ctor}},parse:function(n){return System.Guid.parseExact(n,null)},parseExact:function(n,t){var i=new System.Guid.ctor;return i.parseInternal(n,t,!0),i},tryParse:function(n,t){return System.Guid.tryParseExact(n,null,t)},tryParseExact:function(n,t,i){return i.v=new System.Guid.ctor,i.v.parseInternal(n,t,!1)},newGuid:function(){var n=System.Array.init(16,0);return System.Guid.rnd.nextBytes(n),n[7]=(n[7]&15|64)&255,n[8]=(n[8]&191|128)&255,new System.Guid.$ctor1(n)},makeBinary:function(n){return System.Int32.format(n&255,"x2")},op_Equality:function(n,t){return Bridge.referenceEquals(n,null)?Bridge.referenceEquals(t,null):n.equalsT(t)},op_Inequality:function(n,t){return!System.Guid.op_Equality(n,t)},getDefaultValue:function(){return new System.Guid}},_a:0,_b:0,_c:0,_d:0,_e:0,_f:0,_g:0,_h:0,_i:0,_j:0,_k:0,config:{alias:["equalsT","System$IEquatable$1$System$Guid$equalsT","compareTo","System$IComparable$1$System$Guid$compareTo","format","System$IFormattable$format"]},$ctor4:function(n){this.$initialize();(new System.Guid.ctor).$clone(this);this.parseInternal(n,null,!0)},$ctor1:function(n){if(this.$initialize(),n==null)throw new System.ArgumentNullException("b");if(n.length!==16)throw new System.ArgumentException(System.String.format(System.Guid.error1,16));this._a=n[3]<<24|n[2]<<16|n[1]<<8|n[0];this._b=Bridge.Int.sxs((n[5]<<8|n[4])&65535);this._c=Bridge.Int.sxs((n[7]<<8|n[6])&65535);this._d=n[8];this._e=n[9];this._f=n[10];this._g=n[11];this._h=n[12];this._i=n[13];this._j=n[14];this._k=n[15]},$ctor5:function(n,t,i,r,u,f,e,o,s,h,c){this.$initialize();this._a=n|0;this._b=Bridge.Int.sxs(t&65535);this._c=Bridge.Int.sxs(i&65535);this._d=r;this._e=u;this._f=f;this._g=e;this._h=o;this._i=s;this._j=h;this._k=c},$ctor3:function(n,t,i,r){if(this.$initialize(),r==null)throw new System.ArgumentNullException("d");if(r.length!==8)throw new System.ArgumentException(System.String.format(System.Guid.error1,8));this._a=n;this._b=t;this._c=i;this._d=r[0];this._e=r[1];this._f=r[2];this._g=r[3];this._h=r[4];this._i=r[5];this._j=r[6];this._k=r[7]},$ctor2:function(n,t,i,r,u,f,e,o,s,h,c){this.$initialize();this._a=n;this._b=t;this._c=i;this._d=r;this._e=u;this._f=f;this._g=e;this._h=o;this._i=s;this._j=h;this._k=c},ctor:function(){this.$initialize()},equalsT:function(n){return this._a!==n._a||this._b!==n._b||this._c!==n._c||this._d!==n._d||this._e!==n._e||this._f!==n._f||this._g!==n._g||this._h!==n._h||this._i!==n._i||this._j!==n._j||this._k!==n._k?!1:!0},compareTo:function(n){return System.String.compare(this.toString(),n.toString())},toString:function(){return this.format$1(null)},toString$1:function(n){return this.format$1(n)},format:function(n){return this.format$1(n)},toByteArray:function(){var n=System.Array.init(16,0);return n[0]=this._a&255,n[1]=this._a>>8&255,n[2]=this._a>>16&255,n[3]=this._a>>24&255,n[4]=this._b&255,n[5]=this._b>>8&255,n[6]=this._c&255,n[7]=this._c>>8&255,n[8]=this._d,n[9]=this._e,n[10]=this._f,n[11]=this._g,n[12]=this._h,n[13]=this._i,n[14]=this._j,n[15]=this._k,n},parseInternal:function(n,t,i){var u=null,f,r,e,o;if(System.String.isNullOrEmpty(n))throw new System.ArgumentNullException("input");if(System.String.isNullOrEmpty(t)?(f=System.Guid.nonFormat.exec(n),f!=null&&(u=f.slice(1).join("-").toLowerCase())):(t=t.toUpperCase(),r=!1,Bridge.referenceEquals(t,"N")?(e=System.Guid.split.exec(n),e!=null&&(r=!0,n=e.slice(1).join("-"))):Bridge.referenceEquals(t,"B")||Bridge.referenceEquals(t,"P")?(o=Bridge.referenceEquals(t,"B")?[123,125]:[40,41],n.charCodeAt(0)===o[0]&&n.charCodeAt(n.length-1|0)===o[1]&&(r=!0,n=n.substr(1,n.length-2|0))):r=!0,r&&n.match(System.Guid.valid)!=null&&(u=n.toLowerCase())),u!=null)return this.fromString(u),!0;if(i)throw new System.FormatException("input is not in a recognized format");return!1},format$1:function(n){var t=System.String.concat(System.UInt32.format(this._a>>>0,"x8"),System.UInt16.format(this._b&65535,"x4"),System.UInt16.format(this._c&65535,"x4"));t=System.String.concat(t,[this._d,this._e,this._f,this._g,this._h,this._i,this._j,this._k].map(System.Guid.makeBinary).join(""));t=System.Guid.split.exec(t).slice(1).join("-");switch(n){case"n":case"N":return t.replace(System.Guid.replace,"");case"b":case"B":return System.String.concat(String.fromCharCode(123),t,String.fromCharCode(125));case"p":case"P":return System.String.concat(String.fromCharCode(40),t,String.fromCharCode(41));default:return t}},fromString:function(n){var t,i;if(!System.String.isNullOrEmpty(n)){for(n=n.replace(System.Guid.replace,""),t=System.Array.init(8,0),this._a=System.UInt32.parse(n.substr(0,8),16)|0,this._b=Bridge.Int.sxs(System.UInt16.parse(n.substr(8,4),16)&65535),this._c=Bridge.Int.sxs(System.UInt16.parse(n.substr(12,4),16)&65535),i=8;i<16;i=i+1|0)t[i-8|0]=System.Byte.parse(n.substr(i*2|0,2),16);this._d=t[0];this._e=t[1];this._f=t[2];this._g=t[3];this._h=t[4];this._i=t[5];this._j=t[6];this._k=t[7]}},getHashCode:function(){return Bridge.addHash([1684632903,this._a,this._b,this._c,this._d,this._e,this._f,this._g,this._h,this._i,this._j,this._k])},$clone:function(){return this}});Bridge.define("System.Text.RegularExpressions.Regex",{statics:{_cacheSize:15,_defaultMatchTimeout:System.TimeSpan.fromMilliseconds(-1),getCacheSize:function(){return System.Text.RegularExpressions.Regex._cacheSize},setCacheSize:function(n){if(n<0)throw new System.ArgumentOutOfRangeException("value");System.Text.RegularExpressions.Regex._cacheSize=n},escape:function(n){if(n==null)throw new System.ArgumentNullException("str");return System.Text.RegularExpressions.RegexParser.escape(n)},unescape:function(n){if(n==null)throw new System.ArgumentNullException("str");return System.Text.RegularExpressions.RegexParser.unescape(n)},isMatch:function(n,t){var i=System.Text.RegularExpressions;return i.Regex.isMatch$2(n,t,i.RegexOptions.None,i.Regex._defaultMatchTimeout)},isMatch$1:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.isMatch$2(n,t,i,r.Regex._defaultMatchTimeout)},isMatch$2:function(n,t,i,r){var u=new System.Text.RegularExpressions.Regex.$ctor3(t,i,r,!0);return u.isMatch(n)},match:function(n,t){var i=System.Text.RegularExpressions;return i.Regex.match$2(n,t,i.RegexOptions.None,i.Regex._defaultMatchTimeout)},match$1:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.match$2(n,t,i,r.Regex._defaultMatchTimeout)},match$2:function(n,t,i,r){var u=new System.Text.RegularExpressions.Regex.$ctor3(t,i,r,!0);return u.match(n)},matches:function(n,t){var i=System.Text.RegularExpressions;return i.Regex.matches$2(n,t,i.RegexOptions.None,i.Regex._defaultMatchTimeout)},matches$1:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.matches$2(n,t,i,r.Regex._defaultMatchTimeout)},matches$2:function(n,t,i,r){var u=new System.Text.RegularExpressions.Regex.$ctor3(t,i,r,!0);return u.matches(n)},replace:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.replace$2(n,t,i,r.RegexOptions.None,r.Regex._defaultMatchTimeout)},replace$1:function(n,t,i,r){var u=System.Text.RegularExpressions;return u.Regex.replace$2(n,t,i,r,u.Regex._defaultMatchTimeout)},replace$2:function(n,t,i,r,u){var f=new System.Text.RegularExpressions.Regex.$ctor3(t,r,u,!0);return f.replace(n,i)},replace$3:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.replace$5(n,t,i,r.RegexOptions.None,r.Regex._defaultMatchTimeout)},replace$4:function(n,t,i,r){var u=System.Text.RegularExpressions;return u.Regex.replace$5(n,t,i,r,u.Regex._defaultMatchTimeout)},replace$5:function(n,t,i,r,u){var f=new System.Text.RegularExpressions.Regex.$ctor3(t,r,u,!0);return f.replace$3(n,i)},split:function(n,t){var i=System.Text.RegularExpressions;return i.Regex.split$2(n,t,i.RegexOptions.None,i.Regex._defaultMatchTimeout)},split$1:function(n,t,i){var r=System.Text.RegularExpressions;return r.Regex.split$2(n,t,i,r.Regex._defaultMatchTimeout)},split$2:function(n,t,i,r){var u=new System.Text.RegularExpressions.Regex.$ctor3(t,i,r,!0);return u.split(n)}},_pattern:"",_matchTimeout:System.TimeSpan.fromMilliseconds(-1),_runner:null,_caps:null,_capsize:0,_capnames:null,_capslist:null,config:{init:function(){this._options=System.Text.RegularExpressions.RegexOptions.None}},ctor:function(n){this.$ctor1(n,System.Text.RegularExpressions.RegexOptions.None)},$ctor1:function(n,t){this.$ctor2(n,t,System.TimeSpan.fromMilliseconds(-1))},$ctor2:function(n,t,i){this.$ctor3(n,t,i,!1)},$ctor3:function(n,t,i){var r,u,f;if(this.$initialize(),r=System.Text.RegularExpressions,n==null)throw new System.ArgumentNullException("pattern");if(t>10!=0)throw new System.ArgumentOutOfRangeException("options");if((t&r.RegexOptions.ECMAScript)!=0&&(t&~(r.RegexOptions.ECMAScript|r.RegexOptions.IgnoreCase|r.RegexOptions.Multiline|r.RegexOptions.CultureInvariant))!=0)throw new System.ArgumentOutOfRangeException("options");if(u=System.Text.RegularExpressions.RegexOptions.IgnoreCase|System.Text.RegularExpressions.RegexOptions.Multiline|System.Text.RegularExpressions.RegexOptions.Singleline|System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace|System.Text.RegularExpressions.RegexOptions.ExplicitCapture,(t|u)!==u)throw new System.NotSupportedException("Specified Regex options are not supported.");this._validateMatchTimeout(i);this._pattern=n;this._options=t;this._matchTimeout=i;this._runner=new r.RegexRunner(this);f=this._runner.parsePattern();this._capnames=f.sparseSettings.sparseSlotNameMap;this._capslist=f.sparseSettings.sparseSlotNameMap.keys;this._capsize=this._capslist.length},getMatchTimeout:function(){return this._matchTimeout},getOptions:function(){return this._options},getRightToLeft:function(){return(this._options&System.Text.RegularExpressions.RegexOptions.RightToLeft)!=0},isMatch:function(n){if(n==null)throw new System.ArgumentNullException("input");var t=this.getRightToLeft()?n.length:0;return this.isMatch$1(n,t)},isMatch$1:function(n,t){if(n==null)throw new System.ArgumentNullException("input");var i=this._runner.run(!0,-1,n,0,n.length,t);return i==null},match:function(n){if(n==null)throw new System.ArgumentNullException("input");var t=this.getRightToLeft()?n.length:0;return this.match$1(n,t)},match$1:function(n,t){if(n==null)throw new System.ArgumentNullException("input");return this._runner.run(!1,-1,n,0,n.length,t)},match$2:function(n,t,i){if(n==null)throw new System.ArgumentNullException("input");var r=this.getRightToLeft()?t+i:t;return this._runner.run(!1,-1,n,t,i,r)},matches:function(n){if(n==null)throw new System.ArgumentNullException("input");var t=this.getRightToLeft()?n.length:0;return this.matches$1(n,t)},matches$1:function(n,t){if(n==null)throw new System.ArgumentNullException("input");return new System.Text.RegularExpressions.MatchCollection(this,n,0,n.length,t)},getGroupNames:function(){if(this._capslist==null){for(var i=System.Globalization.CultureInfo.invariantCulture,t=[],r=this._capsize,n=0;n=0&&n=0&&n"9"||i<"0")return-1;t*=10;t+=i-"0"}return t>=0&&t0)||!(t<=2147483646)))throw new System.ArgumentOutOfRangeException("matchTimeout");}});Bridge.define("System.Text.RegularExpressions.Capture",{_text:"",_index:0,_length:0,ctor:function(n,t,i){this.$initialize();this._text=n;this._index=t;this._length=i},getIndex:function(){return this._index},getLength:function(){return this._length},getValue:function(){return this._text.substr(this._index,this._length)},toString:function(){return this.getValue()},_getOriginalString:function(){return this._text},_getLeftSubstring:function(){return this._text.slice(0,_index)},_getRightSubstring:function(){return this._text.slice(this._index+this._length,this._text.length)}});Bridge.define("System.Text.RegularExpressions.CaptureCollection",{inherits:function(){return[System.Collections.ICollection]},config:{alias:["getEnumerator","System$Collections$IEnumerable$getEnumerator","getCount","System$Collections$ICollection$getCount"]},_group:null,_capcount:0,_captures:null,ctor:function(n){this.$initialize();this._group=n;this._capcount=n._capcount},getSyncRoot:function(){return this._group},getIsSynchronized:function(){return!1},getIsReadOnly:function(){return!0},getCount:function(){return this._capcount},get:function(n){if(n===this._capcount-1&&n>=0)return this._group;if(n>=this._capcount||n<0)throw new System.ArgumentOutOfRangeException("i");return this._ensureCapturesInited(),this._captures[n]},copyTo:function(n,t){if(n==null)throw new System.ArgumentNullException("array");if(n.length0&&(t[this._capcount-1]=this._group);this._captures=t}}});Bridge.define("System.Text.RegularExpressions.CaptureEnumerator",{inherits:function(){return[System.Collections.IEnumerator]},config:{alias:["getCurrent","System$Collections$IEnumerator$getCurrent","moveNext","System$Collections$IEnumerator$moveNext","reset","System$Collections$IEnumerator$reset"]},_captureColl:null,_curindex:0,ctor:function(n){this.$initialize();this._curindex=-1;this._captureColl=n},moveNext:function(){var n=this._captureColl.getCount();return this._curindex>=n?!1:(this._curindex++,this._curindex=this._captureColl.getCount())throw new System.InvalidOperationException("Enumeration has either not started or has already finished.");return this._captureColl.get(this._curindex)},reset:function(){this._curindex=-1}});Bridge.define("System.Text.RegularExpressions.Group",{inherits:function(){return[System.Text.RegularExpressions.Capture]},statics:{config:{init:function(){var n=new System.Text.RegularExpressions.Group("",[],0);this.getEmpty=function(){return n}}},synchronized:function(n){if(n==null)throw new System.ArgumentNullException("group");var t=n.getCaptures();return t.getCount()>0&&t.get(0),n}},_caps:null,_capcount:0,_capColl:null,ctor:function(n,t,i){this.$initialize();var r=System.Text.RegularExpressions,u=i===0?0:t[(i-1)*2],f=i===0?0:t[i*2-1];r.Capture.ctor.call(this,n,u,f);this._caps=t;this._capcount=i},getSuccess:function(){return this._capcount!==0},getCaptures:function(){return this._capColl==null&&(this._capColl=new System.Text.RegularExpressions.CaptureCollection(this)),this._capColl}});Bridge.define("System.Text.RegularExpressions.GroupCollection",{inherits:function(){return[System.Collections.ICollection]},config:{alias:["getEnumerator","System$Collections$IEnumerable$getEnumerator","getCount","System$Collections$ICollection$getCount"]},_match:null,_captureMap:null,_groups:null,ctor:function(n,t){this.$initialize();this._match=n;this._captureMap=t},getSyncRoot:function(){return this._match},getIsSynchronized:function(){return!1},getIsReadOnly:function(){return!0},getCount:function(){return this._match._matchcount.length},get:function(n){return this._getGroup(n)},getByName:function(n){if(this._match._regex==null)return System.Text.RegularExpressions.Group.getEmpty();var t=this._match._regex.groupNumberFromName(n);return this._getGroup(t)},copyTo:function(n,t){var r,f,u,i;if(n==null)throw new System.ArgumentNullException("array");if(r=this.getCount(),n.length=this._match._matchcount.length||n<0?System.Text.RegularExpressions.Group.getEmpty():this._getGroupImpl(n),t},_getGroupImpl:function(n){return n===0?this._match:(this._ensureGroupsInited(),this._groups[n])},_ensureGroupsInited:function(){var n,i,r,u,t;if(this._groups==null){for(n=[],n.length=this._match._matchcount.length,n.length>0&&(n[0]=this._match),t=0;t=n?!1:(this._curindex++,this._curindex=this._groupColl.getCount())throw new System.InvalidOperationException("Enumeration has either not started or has already finished.");return this._groupColl.get(this._curindex)},reset:function(){this._curindex=-1}});Bridge.define("System.Text.RegularExpressions.Match",{inherits:function(){return[System.Text.RegularExpressions.Group]},statics:{config:{init:function(){var n=new System.Text.RegularExpressions.Match(null,1,"",0,0,0);this.getEmpty=function(){return n}}},synchronized:function(n){if(n==null)throw new System.ArgumentNullException("match");for(var i=n.getGroups(),u=i.getCount(),r,t=0;t0&&this._matches[n][this._matchcount[n]*2-1]!==-2},_addMatch:function(n,t,i){var r,e,f,u;if(this._matches[n]==null&&(this._matches[n]=new Array(2)),r=this._matchcount[n],r*2+2>this._matches[n].length){for(e=this._matches[n],f=new Array(r*8),u=0;ut.Length)throw new System.ArgumentOutOfRangeException("startat");this._regex=n;this._input=t;this._beginning=i;this._length=r;this._startat=u;this._prevlen=-1;this._matches=[]},getCount:function(){return this._done||this._getMatch(2147483647),this._matches.length},getSyncRoot:function(){return this},getIsSynchronized:function(){return!1},getIsReadOnly:function(){return!0},get:function(n){var t=this._getMatch(n);if(t==null)throw new System.ArgumentOutOfRangeException("i");return t},copyTo:function(n,t){var r,f,u,i;if(n==null)throw new System.ArgumentNullException("array");if(r=this.getCount(),n.lengthn)return this._matches[n];if(this._done)return null;var t;do{if(t=this._regex._runner.run(!1,this._prevLen,this._input,this._beginning,this._length,this._startat),!t.getSuccess())return this._done=!0,null;this._matches.push(t);this._prevLen=t._length;this._startat=t._textpos}while(this._matches.length<=n);return t}});Bridge.define("System.Text.RegularExpressions.MatchEnumerator",{inherits:function(){return[System.Collections.IEnumerator]},config:{alias:["getCurrent","System$Collections$IEnumerator$getCurrent","moveNext","System$Collections$IEnumerator$moveNext","reset","System$Collections$IEnumerator$reset"]},_matchcoll:null,_match:null,_curindex:0,_done:!1,ctor:function(n){this.$initialize();this._matchcoll=n},moveNext:function(){return this._done?!1:(this._match=this._matchcoll._getMatch(this._curindex),this._curindex++,this._match==null)?(this._done=!0,!1):!0},getCurrent:function(){if(this._match==null)throw new System.InvalidOperationException("Enumeration has either not started or has already finished.");return this._match},reset:function(){this._curindex=0;this._done=!1;this._match=null}});Bridge.define("System.Text.RegularExpressions.RegexOptions",{statics:{None:0,IgnoreCase:1,Multiline:2,ExplicitCapture:4,Compiled:8,Singleline:16,IgnorePatternWhitespace:32,RightToLeft:64,ECMAScript:256,CultureInvariant:512},$kind:"enum",$flags:!0});Bridge.define("System.Text.RegularExpressions.RegexRunner",{statics:{},_runregex:null,_netEngine:null,_runtext:"",_runtextpos:0,_runtextbeg:0,_runtextend:0,_runtextstart:0,_quick:!1,_prevlen:0,ctor:function(n){if(this.$initialize(),n==null)throw new System.ArgumentNullException("regex");this._runregex=n;var i=n.getOptions(),t=System.Text.RegularExpressions.RegexOptions,r=(i&t.IgnoreCase)===t.IgnoreCase,u=(i&t.Multiline)===t.Multiline,f=(i&t.Singleline)===t.Singleline,e=(i&t.IgnorePatternWhitespace)===t.IgnorePatternWhitespace,o=(i&t.ExplicitCapture)===t.ExplicitCapture,s=n._matchTimeout.getTotalMilliseconds();this._netEngine=new System.Text.RegularExpressions.RegexEngine(n._pattern,r,u,f,e,o,s)},run:function(n,t,i,r,u,f){var e,o,s,h;if(f<0||f>i.Length)throw new System.ArgumentOutOfRangeException("start","Start index cannot be less than 0 or greater than input length.");if(u<0||u>i.Length)throw new ArgumentOutOfRangeException("length","Length cannot be less than 0 or exceed input length.");if(this._runtext=i,this._runtextbeg=r,this._runtextend=r+u,this._runtextstart=f,this._quick=n,this._prevlen=t,this._runregex.getRightToLeft()?(e=this._runtextbeg,o=-1):(e=this._runtextend,o=1),this._prevlen===0){if(this._runtextstart===e)return System.Text.RegularExpressions.Match.getEmpty();this._runtextstart+=o}return s=this._netEngine.match(this._runtext,this._runtextstart),h=this._convertNetEngineResults(s),h},parsePattern:function(){return this._netEngine.parsePattern()},_convertNetEngineResults:function(n){var f,i,t,e,o,r,u,s;if(n.success&&this._quick)return null;if(!n.success)return System.Text.RegularExpressions.Match.getEmpty();for(f=this.parsePattern(),i=f.sparseSettings.isSparse?new System.Text.RegularExpressions.MatchSparse(this._runregex,f.sparseSettings.sparseSlotMap,n.groups.length,this._runtext,0,this._runtext.length,this._runtextstart):new System.Text.RegularExpressions.Match(this._runregex,n.groups.length,this._runtext,0,this._runtext.length,this._runtextstart),r=0;r=System.Text.RegularExpressions.RegexParser._E}},_caps:null,_capsize:0,_capnames:null,_pattern:"",_currentPos:0,_concatenation:null,_culture:null,config:{init:function(){this._options=System.Text.RegularExpressions.RegexOptions.None}},ctor:function(n){this.$initialize();this._culture=n;this._caps={}},_noteCaptures:function(n,t,i){this._caps=n;this._capsize=t;this._capnames=i},_setPattern:function(n){n==null&&(n="");this._pattern=n||"";this._currentPos=0},_scanReplacement:function(){this._concatenation=new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Concatenate,this._options);for(var n,t,i;;){if(n=this._charsRight(),n===0)break;for(t=this._textpos();n>0&&this._rightChar()!=="$";)this._moveRight(),n--;this._addConcatenate(t,this._textpos()-t);n>0&&this._moveRightGetChar()==="$"&&(i=this._scanDollar(),this._concatenation.addChild(i))}return this._concatenation},_addConcatenate:function(n,t){var i,r,u;t!==0&&(t>1?(r=this._pattern.slice(n,n+t),i=new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Multi,this._options,r)):(u=this._pattern[n],i=new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.One,this._options,u)),this._concatenation.addChild(i))},_useOptionE:function(){return(this._options&System.Text.RegularExpressions.RegexOptions.ECMAScript)!=0},_makeException:function(n){return new System.ArgumentException("Incorrect pattern. "+n)},_scanDollar:function(){var o=214748364,n,f,i,e,h;if(this._charsRight()===0)return new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.One,this._options,"$");var t=this._rightChar(),r,s=this._textpos(),u=s;if(t==="{"&&this._charsRight()>1?(r=!0,this._moveRight(),t=this._rightChar()):r=!1,t>="0"&&t<="9"){if(!r&&this._useOptionE()){for(n=-1,i=t-"0",this._moveRight(),this._isCaptureSlot(i)&&(n=i,u=this._textpos());this._charsRight()>0&&(t=this._rightChar())>="0"&&t<="9";){if(f=t-"0",i>o||i===o&&f>7)throw this._makeException("Capture group is out of range.");i=i*10+f;this._moveRight();this._isCaptureSlot(i)&&(n=i,u=this._textpos())}if(this._textto(u),n>=0)return new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Ref,this._options,n)}else if(n=this._scanDecimal(),(!r||this._charsRight()>0&&this._moveRightGetChar()==="}")&&this._isCaptureSlot(n))return new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Ref,this._options,n)}else if(r&&this._isWordChar(t)){if(e=this._scanCapname(),this._charsRight()>0&&this._moveRightGetChar()==="}"&&this._isCaptureName(e))return h=this._captureSlotFromName(e),new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Ref,this._options,h)}else if(!r){n=1;switch(t){case"$":return this._moveRight(),new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.One,this._options,"$");case"&":n=0;break;case"`":n=System.Text.RegularExpressions.RegexReplacement.LeftPortion;break;case"'":n=System.Text.RegularExpressions.RegexReplacement.RightPortion;break;case"+":n=System.Text.RegularExpressions.RegexReplacement.LastGroup;break;case"_":n=System.Text.RegularExpressions.RegexReplacement.WholeString}if(n!==1)return this._moveRight(),new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.Ref,this._options,n)}return this._textto(s),new System.Text.RegularExpressions.RegexNode(System.Text.RegularExpressions.RegexNode.One,this._options,"$")},_scanDecimal:function(){for(var r=214748364,n=0,t,i;this._charsRight()>0;){if(t=this._rightChar(),t<"0"||t>"9")break;if(i=t-"0",this._moveRight(),n>r||n===r&&i>7)throw this._makeException("Capture group is out of range.");n*=10;n+=i}return n},_scanOctal:function(){var i,n,t;for(t=3,t>this._charsRight()&&(t=this._charsRight()),n=0;t>0&&(i=this._rightChar()-"0")<=7;t-=1)if(this._moveRight(),n*=8,n+=i,this._useOptionE()&&n>=32)break;return n&=255,String.fromCharCode(n)},_scanHex:function(n){var t,i;if(t=0,this._charsRight()>=n)for(;n>0&&(i=this._hexDigit(this._moveRightGetChar()))>=0;n-=1)t*=16,t+=i;if(n>0)throw this._makeException("Insufficient hexadecimal digits.");return t},_hexDigit:function(n){var t,i=n.charCodeAt(0);return(t=i-"0".charCodeAt(0))<=9?t:(t=i-"a".charCodeAt(0))<=5?t+10:(t=i-"A".charCodeAt(0))<=5?t+10:-1},_scanControl:function(){if(this._charsRight()<=0)throw this._makeException("Missing control character.");var t=this._moveRightGetChar(),n=t.charCodeAt(0);if(n>="a".charCodeAt(0)&&n<="z".charCodeAt(0)&&(n=n-("a".charCodeAt(0)-"A".charCodeAt(0))),(n=n-"@".charCodeAt(0))<" ".charCodeAt(0))return String.fromCharCode(n);throw this._makeException("Unrecognized control character.");},_scanCapname:function(){for(var n=this._textpos();this._charsRight()>0;)if(!this._isWordChar(this._moveRightGetChar())){this._moveLeft();break}return _pattern.slice(n,this._textpos())},_scanCharEscape:function(){var n=this._moveRightGetChar(),t;if(n>="0"&&n<="7")return this._moveLeft(),this._scanOctal();switch(n){case"x":return this._scanHex(2);case"u":return this._scanHex(4);case"a":return"\x07";case"b":return"\b";case"e":return"\x1b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\x0b";case"c":return this._scanControl();default:if(t=n==="8"||n==="9"||n==="_",t||!this._useOptionE()&&this._isWordChar(n))throw this._makeException("Unrecognized escape sequence \\"+n+".");return n}},_captureSlotFromName:function(n){return this._capnames[n]},_isCaptureSlot:function(n){return this._caps!=null?this._caps[n]!=null:n>=0&&n0?!0:!1}});Bridge.define("System.Text.RegularExpressions.RegexReplacement",{statics:{replace:function(n,t,i,r,u){var f,o,e,s,h,c,l;if(n==null)throw new System.ArgumentNullException("evaluator");if(r<-1)throw new System.ArgumentOutOfRangeException("count","Count cannot be less than -1.");if(u<0||u>i.length)throw new System.ArgumentOutOfRangeException("startat","Start index cannot be less than 0 or greater than input length.");if(r===0)return i;if(f=t.match$1(i,u),f.getSuccess()){if(o="",t.getRightToLeft()){c=[];e=i.length;do{if(s=f.getIndex(),h=f.getLength(),s+h!==e&&c.push(i.slice(s+h,e)),e=s,c.push(n(f)),--r==0)break;f=f.nextMatch()}while(f.getSuccess());for(o=new StringBuilder,e>0&&(o+=o.slice(0,e)),l=c.length-1;l>=0;l--)o+=c[l]}else{e=0;do{if(s=f.getIndex(),h=f.getLength(),s!==e&&(o+=i.slice(e,s)),e=s+h,o+=n(f),--r==0)break;f=f.nextMatch()}while(f.getSuccess());et.length)throw new System.ArgumentOutOfRangeException("startat","Start index cannot be less than 0 or greater than input length.");if(f=[],i===1)return f.push(t),f;if(--i,u=n.match$1(t,r),u.getSuccess())if(n.getRightToLeft()){for(o=t.length;;){for(s=u.getIndex(),c=u.getLength(),h=u.getGroups(),l=h.getCount(),f.push(t.slice(s+c,o)),o=s,e=1;e0&&(e.push(u.length),u.push(r),r="");f=o._m;i!=null&&f>=0&&(f=i[f]);e.push(-System.Text.RegularExpressions.RegexReplacement.Specials-1-f);break;default:throw new System.ArgumentException("Replacement error.");}}r.length>0&&(e.push(u.length),u.push(r));this._strings=u;this._rules=e},getPattern:function(){return _rep},replacement:function(n){return this._replacementImpl("",n)},replace:function(n,t,i,r){var u,e,f,o,s,h,c;if(i<-1)throw new System.ArgumentOutOfRangeException("count","Count cannot be less than -1.");if(r<0||r>t.length)throw new System.ArgumentOutOfRangeException("startat","Start index cannot be less than 0 or greater than input length.");if(i===0)return t;if(u=n.match$1(t,r),u.getSuccess()){if(e="",n.getRightToLeft()){h=[];f=t.length;do{if(o=u.getIndex(),s=u.getLength(),o+s!==f&&h.push(t.slice(o+s,f)),f=o,this._replacementImplRTL(h,u),--i==0)break;u=u.nextMatch()}while(u.getSuccess());for(f>0&&(e+=e.slice(0,f)),c=h.length-1;c>=0;c--)e+=h[c]}else{f=0;do{if(o=u.getIndex(),s=u.getLength(),o!==f&&(e+=t.slice(f,o)),f=o+s,e=this._replacementImpl(e,u),--i==0)break;u=u.nextMatch()}while(u.getSuccess());f=0)n+=this._strings[i];else if(i<-u)n+=t._groupToStringImpl(-u-1-i);else switch(-u-1-i){case System.Text.RegularExpressions.RegexReplacement.LeftPortion:n+=t._getLeftSubstring();break;case System.Text.RegularExpressions.RegexReplacement.RightPortion:n+=t._getRightSubstring();break;case System.Text.RegularExpressions.RegexReplacement.LastGroup:n+=t._lastGroupToStringImpl();break;case System.Text.RegularExpressions.RegexReplacement.WholeString:n+=t._getOriginalString()}return n},_replacementImplRTL:function(n,t){for(var u=System.Text.RegularExpressions.RegexReplacement.Specials,i,r=_rules.length-1;r>=0;r--)if(i=this._rules[r],i>=0)n.push(this._strings[i]);else if(i<-u)n.push(t._groupToStringImpl(-u-1-i));else switch(-u-1-i){case System.Text.RegularExpressions.RegexReplacement.LeftPortion:n.push(t._getLeftSubstring());break;case System.Text.RegularExpressions.RegexReplacement.RightPortion:n.push(t._getRightSubstring());break;case System.Text.RegularExpressions.RegexReplacement.LastGroup:n.push(t._lastGroupToStringImpl());break;case System.Text.RegularExpressions.RegexReplacement.WholeString:n.push(t._getOriginalString())}}});Bridge.define("System.Text.RegularExpressions.RegexEngine",{_pattern:"",_patternInfo:null,_text:"",_textStart:0,_timeoutMs:-1,_timeoutTime:-1,_settings:null,_branchType:{base:0,offset:1,lazy:2,greedy:3,or:4},_branchResultKind:{ok:1,endPass:2,nextPass:3,nextBranch:4},ctor:function(n,t,i,r,u,f,e){if(this.$initialize(),n==null)throw new System.ArgumentNullException("pattern");this._pattern=n;this._timeoutMs=e;this._settings={ignoreCase:t,multiline:i,singleline:r,ignoreWhitespace:u,explicitCapture:f}},match:function(n,t){var i;if(n==null)throw new System.ArgumentNullException("text");if(t!=null&&(t<0||t>n.length))throw new System.ArgumentOutOfRangeException("textStart","Start index cannot be less than 0 or greater than input length.");return(this._text=n,this._textStart=t,this._timeoutTime=this._timeoutMs>0?(new Date).getTime()+System.Convert.toInt32(this._timeoutMs+.5):-1,i=this.parsePattern(),i.shouldFail)?this._getEmptyMatch():(this._checkTimeout(),this._scanAndTransformResult(t,i.tokens,!1,null))},parsePattern:function(){if(this._patternInfo==null){var n=System.Text.RegularExpressions.RegexEngineParser,t=n.parsePattern(this._pattern,this._cloneSettings(this._settings));this._patternInfo=t}return this._patternInfo},_scanAndTransformResult:function(n,t,i,r){var u=this._scan(n,this._text.length,t,i,r);return this._collectScanResults(u,n)},_scan:function(n,t,i,r,u){var c=this._branchResultKind,f=[],e,h,o;if(f.grCaptureCache={},e=null,h=null,i.length===0)return o=new System.Text.RegularExpressions.RegexEngineState,o.capIndex=n,o.txtIndex=n,o.capLength=0,o;var l=r?this._branchType.base:this._branchType.offset,a=this._patternInfo.isContiguous?n:t,s=new System.Text.RegularExpressions.RegexEngineBranch(l,n,n,a);for(s.pushPass(0,i,this._cloneSettings(this._settings)),s.started=!0,s.state.txtIndex=n,f.push(s);f.length;){if(e=f[f.length-1],h=this._scanBranch(t,f,e),h===c.ok&&(u==null||e.state.capLength===u))return e.state;this._advanceToNextBranch(f,e);this._checkTimeout()}return null},_scanBranch:function(n,t,i){var r=this._branchResultKind,u,f;if(i.mustFail)return i.mustFail=!1,r.nextBranch;while(i.hasPass()){if(u=i.peekPass(),u.tokens==null||u.tokens.length===0)f=r.endPass;else{if(this._addAlternationBranches(t,i,u)===r.nextBranch)return r.nextBranch;f=this._scanPass(n,t,i,u)}switch(f){case r.nextBranch:return f;case r.nextPass:continue;case r.endPass:case r.ok:i.popPass();break;default:throw new System.InvalidOperationException("Unexpected branch result.");}}return r.ok},_scanPass:function(n,t,i,r){for(var f=this._branchResultKind,s=r.tokens.length,o,u,e;r.index1){for(r=0;rt.max&&n.pop();else if(n.pop(),!t.isNotFailing){i=n[n.length-1];this._advanceToNextBranch(n,i);return}}},_collectScanResults:function(n,t){var o=this._patternInfo.groups,a=this._text,l={},s,f,h={},r,e,i,u,c=this._getEmptyMatch();if(n!=null){for(s=n.groups,this._fillMatch(c,n.capIndex,n.capLength,t),u=0;u0&&(e=i.captures[i.captures.length-1],i.capIndex=e.capIndex,i.capLength=e.capLength,i.value=e.value,i.success=!0),l[r.name]=!0,i.descriptor=r,c.groups.push(i))}return c},_scanToken:function(n,t,i,r,u){var f=System.Text.RegularExpressions.RegexEngineParser.tokenTypes,e=this._branchResultKind;switch(u.type){case f.group:case f.groupImnsx:case f.alternationGroup:return this._scanGroupToken(n,t,i,r,u);case f.groupImnsxMisc:return this._scanGroupImnsxToken(u.group.constructs,r.settings);case f.charGroup:return this._scanCharGroupToken(t,i,r,u,!1);case f.charNegativeGroup:return this._scanCharNegativeGroupToken(t,i,r,u,!1);case f.escChar:case f.escCharOctal:case f.escCharHex:case f.escCharUnicode:case f.escCharCtrl:return this._scanLiteral(n,t,i,r,u.data.ch);case f.escCharOther:case f.escCharClass:return this._scanEscapeToken(t,i,r,u);case f.escCharClassCategory:throw new System.NotSupportedException("Unicode Category constructions are not supported.");case f.escCharClassBlock:throw new System.NotSupportedException("Unicode Named block constructions are not supported.");case f.escCharClassDot:return this._scanDotToken(n,t,i,r);case f.escBackrefNumber:return this._scanBackrefNumberToken(n,t,i,r,u);case f.escBackrefName:return this._scanBackrefNameToken(n,t,i,r,u);case f.anchor:case f.escAnchor:return this._scanAnchorToken(n,t,i,r,u);case f.groupConstruct:case f.groupConstructName:case f.groupConstructImnsx:case f.groupConstructImnsxMisc:return e.ok;case f.alternationGroupCondition:case f.alternationGroupRefNameCondition:case f.alternationGroupRefNumberCondition:return this._scanAlternationConditionToken(n,t,i,r,u);case f.alternation:return e.endPass;case f.commentInline:case f.commentXMode:return e.ok;default:return this._scanLiteral(n,t,i,r,u.value)}},_scanGroupToken:function(n,t,i,r,u){var h=System.Text.RegularExpressions.RegexEngineParser.tokenTypes,c=this._branchResultKind,o=i.state.txtIndex,l,f;if(r.onHold){if(u.type===h.group){var a=u.group.rawIndex,s=r.onHoldTextIndex,v=o-s,e=t.grCaptureCache[a];if(e==null&&(e={},t.grCaptureCache[a]=e),l=s.toString()+"_"+v.toString(),e[l]==null)e[l]=!0;else return c.nextBranch;u.group.constructs.emptyCapture||(u.group.isBalancing?i.state.logCaptureGroupBalancing(u.group,s):i.state.logCaptureGroup(u.group,s,v))}return r.onHold=!1,r.onHoldTextIndex=-1,c.ok}if(u.type===h.group||u.type===h.groupImnsx){if(f=u.group.constructs,this._scanGroupImnsxToken(f,r.settings),f.isPositiveLookahead||f.isNegativeLookahead||f.isPositiveLookbehind||f.isNegativeLookbehind)return this._scanLook(i,o,n,u);if(f.isNonbacktracking)return this._scanNonBacktracking(i,o,n,u)}return r.onHoldTextIndex=o,r.onHold=!0,i.pushPass(0,u.children,this._cloneSettings(r.settings)),c.nextPass},_scanGroupImnsxToken:function(n,t){var i=this._branchResultKind;return n.isIgnoreCase!=null&&(t.ignoreCase=n.isIgnoreCase),n.isMultiline!=null&&(t.multiline=n.isMultiline),n.isSingleLine!=null&&(t.singleline=n.isSingleLine),n.isIgnoreWhitespace!=null&&(t.ignoreWhitespace=n.isIgnoreWhitespace),n.isExplicitCapture!=null&&(t.explicitCapture=n.isExplicitCapture),i.ok},_scanAlternationConditionToken:function(n,t,i,r,u){var o=System.Text.RegularExpressions.RegexEngineParser.tokenTypes,f=this._branchResultKind,c=u.children,l=i.state.txtIndex,e=f.nextBranch,s,h;return u.type===o.alternationGroupRefNameCondition||u.type===o.alternationGroupRefNumberCondition?(s=i.state.resolveBackref(u.data.packedSlotId),e=s!=null?f.ok:f.nextBranch):(h=this._scan(l,n,c,!0,null),this._combineScanResults(i,h)&&(e=f.ok)),e===f.nextBranch&&r.tokens.noAlternation&&(e=f.endPass),e},_scanLook:function(n,t,i,r){var u=r.group.constructs,e=this._branchResultKind,f=r.children,o,s,h=u.isPositiveLookahead||u.isNegativeLookahead,c=u.isPositiveLookbehind||u.isNegativeLookbehind;return h||c?(f=f.slice(1,f.length),o=u.isPositiveLookahead||u.isPositiveLookbehind,s=h?this._scanLookAhead(n,t,i,f):this._scanLookBehind(n,t,i,f),o===s?e.ok:e.nextBranch):null},_scanLookAhead:function(n,t,i,r){var u=this._scan(t,i,r,!0,null);return this._combineScanResults(n,u)},_scanLookBehind:function(n,t,i,r){for(var u=t,f,e;u>=0;){if(f=t-u,e=this._scan(u,i,r,!0,f),this._combineScanResults(n,e))return!0;--u}return!1},_scanNonBacktracking:function(n,t,i,r){var e=this._branchResultKind,u=r.children,f;return(u=u.slice(1,u.length),f=this._scan(t,i,u,!0,null),!f)?e.nextBranch:(n.state.logCapture(f.capLength),e.ok)},_scanLiteral:function(n,t,i,r,u){var e=this._branchResultKind,o=i.state.txtIndex,f;if(o+u.length>n)return e.nextBranch;if(r.settings.ignoreCase){for(f=0;fh)break;if(h<=v.m)return u||t.state.logCapture(1),f.ok}c==null&&i.settings.ignoreCase&&(c=e.toUpperCase(),e=e===c?e.toLowerCase():c,h=e.charCodeAt(0))}return f.nextBranch},_scanCharNegativeGroupToken:function(n,t,i,r,u){var f=this._branchResultKind,o=t.state.txtIndex,s=this._text[o],e;return s==null?f.nextBranch:(e=this._scanCharGroupToken(n,t,i,r,!0),e===f.ok)?f.nextBranch:(u||t.state.logCapture(1),f.ok)},_scanEscapeToken:function(n,t,i,r){return this._scanWithJsRegex(n,t,i,r)},_scanDotToken:function(n,t,i,r){var u=this._branchResultKind,f=i.state.txtIndex;if(r.settings.singleline){if(f0&&this._scanWithJsRegex2(f-1,"\\w")===e.ok,s=this._scanWithJsRegex2(f,"\\w")===e.ok,o===s==(u.value==="\\B"))return e.ok}else if(u.value==="^"){if(f===0||r.settings.multiline&&this._text[f-1]==="\n")return e.ok}else if(u.value==="$"){if(f===n||r.settings.multiline&&this._text[f]==="\n")return e.ok}else if(u.value==="\\A"){if(f===0)return e.ok}else if(u.value==="\\z"){if(f===n)return e.ok}else if(u.value==="\\Z"){if(f===n||f===n-1&&this._text[f]==="\n")return e.ok}else if(u.value==="\\G")return e.ok;return e.nextBranch},_cloneSettings:function(n){return{ignoreCase:n.ignoreCase,multiline:n.multiline,singleline:n.singleline,ignoreWhitespace:n.ignoreWhitespace,explicitCapture:n.explicitCapture}},_combineScanResults:function(n,t){if(t!=null){for(var u=n.state.groups,r=t.groups,f=r.length,i=0;i=this._timeoutTime)throw new System.RegexMatchTimeoutException(this._text,this._pattern,System.TimeSpan.fromMilliseconds(this._timeoutMs));}}});Bridge.define("System.Text.RegularExpressions.RegexEngineBranch",{type:0,value:0,min:0,max:0,isStarted:!1,isNotFailing:!1,state:null,ctor:function(n,t,i,r,u){this.$initialize();this.type=n;this.value=t;this.min=i;this.max=r;this.state=u!=null?u.clone():new System.Text.RegularExpressions.RegexEngineState},pushPass:function(n,t,i){var r=new System.Text.RegularExpressions.RegexEnginePass(n,t,i);this.state.passes.push(r)},peekPass:function(){return this.state.passes[this.state.passes.length-1]},popPass:function(){return this.state.passes.pop()},hasPass:function(){return this.state.passes.length>0},clone:function(){var n=new System.Text.RegularExpressions.RegexEngineBranch(this.type,this.value,this.min,this.max,this.state);return n.isNotFailing=this.isNotFailing,n}});Bridge.define("System.Text.RegularExpressions.RegexEngineState",{txtIndex:0,capIndex:null,capLength:0,passes:null,groups:null,ctor:function(){this.$initialize();this.passes=[];this.groups=[]},logCapture:function(n){this.capIndex==null&&(this.capIndex=this.txtIndex);this.txtIndex+=n;this.capLength+=n},logCaptureGroup:function(n,t,i){this.groups.push({rawIndex:n.rawIndex,slotId:n.packedSlotId,capIndex:t,capLength:i})},logCaptureGroupBalancing:function(n,t){for(var s=n.balancingSlotId,r=this.groups,i=r.length-1,u,f,e,o;i>=0;){if(r[i].slotId===s){u=r[i];f=i;break}--i}return u!=null&&f!=null?(r.splice(f,1),n.constructs.name1!=null&&(e=u.capIndex+u.capLength,o=t-e,this.logCaptureGroup(n,e,o)),!0):!1},resolveBackref:function(n){for(var i=this.groups,t=i.length-1;t>=0;){if(i[t].slotId===n)return i[t];--t}return null},clone:function(){var t=new System.Text.RegularExpressions.RegexEngineState,e,u;t.txtIndex=this.txtIndex;t.capIndex=this.capIndex;t.capLength=this.capLength;for(var o=t.passes,f=this.passes,r=f.length,i,n=0;n0&&!e.qtoken&&(a=t[o-1],a.type===s.literal&&!a.qtoken)){a.value+=e.value;a.length+=e.length;t.splice(o,1);--o;continue}}else if(e.type===s.alternationGroupCondition&&e.data!=null)if(e.data.number!=null){if(h=i.getPackedSlotIdBySlotNumber(e.data.number),h==null)throw new System.ArgumentException("Reference to undefined group number "+c+".");e.data.packedSlotId=h;l._updatePatternToken(e,s.alternationGroupRefNumberCondition,e.index,e.length,e.value)}else h=i.getPackedSlotIdBySlotName(e.data.name),h!=null?(e.data.packedSlotId=h,l._updatePatternToken(e,s.alternationGroupRefNameCondition,e.index,e.length,e.value)):delete e.data;e.children&&e.children.length&&(v=e.type===s.group?[e.group.rawIndex]:[],v=v.concat(u),y=e.localSettings||n,l._transformRawTokens(y,e.children,i,r,v,f+1),n.shouldFail=n.shouldFail||y.shouldFail,n.isContiguous=n.isContiguous||y.isContiguous);e.type===s.group&&r.push(e.group.packedSlotId)}},_fillGroupDescriptors:function(n,t){var f=System.Text.RegularExpressions.RegexEngineParser,i,r,u;for(f._fillGroupStructure(t,n,null),u=1,r=0;r1&&(i.isSparse=!0);i.lastSlot=t},_addSparseSlotForSameNamedGroups:function(n,t,i,r){var o=System.Text.RegularExpressions.RegexEngineParser,u,f,e;if(o._addSparseSlot(n[0],t,i,r),f=n[0].sparseSlotId,e=n[0].packedSlotId,n.length>1)for(u=1;u":t.isNonbacktracking=!0;break;case"?<=":t.isPositiveLookbehind=!0;break;case"?2)throw new System.ArgumentException("Invalid group name.");i[0].length&&(t.name1=i[0],h=o._validateGroupName(i[0]),t.isNumberName1=h.isNumberName);i.length===2&&(t.name2=i[1],c=o._validateGroupName(i[1]),t.isNumberName2=c.isNumberName)}else if(n.type===f.groupConstructImnsx||n.type===f.groupConstructImnsxMisc)for(var l=n.type===f.groupConstructImnsx?1:0,a=n.length-1-l,u=!0,r,e=1;e<=a;e++)r=n.value[e],r==="-"?u=!1:r==="i"?t.isIgnoreCase=u:r==="m"?t.isMultiline=u:r==="n"?t.isExplicitCapture=u:r==="s"?t.isSingleLine=u:r==="x"&&(t.isIgnoreWhitespace=u);return t},_validateGroupName:function(n){var t,i,r;if(!n||!n.length)throw new System.ArgumentException("Invalid group name: Group names must begin with a word character.");if(t=n[0]>="0"&&n[0]<="9",t&&(i=System.Text.RegularExpressions.RegexEngineParser,r=i._matchChars(n,0,n.length,i._decSymbols),r.matchLength!==n.length))throw new System.ArgumentException("Invalid group name: Group names must begin with a word character.");return{isNumberName:t}},_fillBalancingGroupInfo:function(n,t){for(var i,r=0;r=1&&i.getPackedSlotIdBySlotNumber(f)!=null)continue;if(f<=9)throw new System.ArgumentException("Reference to undefined group number "+f.toString()+".");if(e=u._parseOctalCharToken(r.value,0,r.length),e==null)throw new System.ArgumentException("Unrecognized escape sequence "+r.value.slice(0,2)+".");h=r.length-e.length;u._modifyPatternToken(r,n,s.escCharOctal,null,e.length);r.data=e.data;h>0&&(c=u._createPatternToken(n,s.literal,r.index+r.length,h),t.splice(o+1,0,c))}r.children&&r.children.length&&u._preTransformBackrefTokens(n,r.children,i)}},_updateGroupDescriptors:function(n,t){for(var o=System.Text.RegularExpressions.RegexEngineParser,e=o.tokenTypes,r,i,f,h,c,s=t||0,u=0;un.length)throw new System.ArgumentOutOfRangeException("startIndex");if(rn.length)throw new System.ArgumentOutOfRangeException("endIndex");for(var f=System.Text.RegularExpressions.RegexEngineParser,h=f.tokenTypes,s=[],o,e,u=i;u=0){++u;continue}o=e==="."?f._parseDotToken(n,u,r):e==="\\"?f._parseEscapeToken(n,u,r):e==="["?f._parseCharRangeToken(n,u,r):e==="^"||e==="$"?f._parseAnchorToken(n,u):e==="("?f._parseGroupToken(n,t,u,r):e==="|"?f._parseAlternationToken(n,u):e==="#"&&t.ignoreWhitespace?f._parseXModeCommentToken(n,u,r):f._parseQuantifierToken(n,u,r);o==null&&(o=f._createPatternToken(n,h.literal,u,1));o!=null&&(s.push(o),u+=o.length)}return s},_parseEscapeToken:function(n,t,i){var u=System.Text.RegularExpressions.RegexEngineParser,o=u.tokenTypes,f=n[t],h,c,l,s,y,e,a,r,v;if(f!=="\\")return null;if(t+1>=i)throw new System.ArgumentException("Illegal \\ at end of pattern.");if(f=n[t+1],f>="1"&&f<="9")return h=u._matchChars(n,t+1,i,u._decSymbols,3),c=u._createPatternToken(n,o.escBackrefNumber,t,1+h.matchLength),c.data={number:parseInt(h.match,10)},c;if(u._escapedAnchors.indexOf(f)>=0)return u._createPatternToken(n,o.escAnchor,t,2);if(l=u._parseEscapedChar(n,t,i),l!=null)return l;if(f==="k"){if(t+2":"'",e=u._matchUntil(n,t+3,i,y),e.unmatchLength===1&&e.matchLength>0)))return a=u._createPatternToken(n,o.escBackrefName,t,3+e.matchLength+1),a.data={name:e.match},a;throw new System.ArgumentException("Malformed \\k<...> named back reference.");}if(r=f.charCodeAt(0),r>=0&&r<48||r>57&&r<65||r>90&&r<95||r===96||r>122&&r<128)return v=u._createPatternToken(n,o.escChar,t,2),v.data={n:r,ch:f},v;throw new System.ArgumentException("Unrecognized escape sequence \\"+f+".");},_parseOctalCharToken:function(n,t,i){var r=System.Text.RegularExpressions.RegexEngineParser,s=r.tokenTypes,u=n[t];if(u==="\\"&&t+1="0"&&u<="7")){var f=r._matchChars(n,t+1,i,r._octSymbols,3),e=parseInt(f.match,8),o=r._createPatternToken(n,s.escCharOctal,t,1+f.matchLength);return o.data={n:e,ch:String.fromCharCode(e)},o}return null},_parseEscapedChar:function(n,t,i){var r=System.Text.RegularExpressions.RegexEngineParser,o=r.tokenTypes,f,u=n[t],a,v,h,c,y,p,e,s,l;if(u!=="\\"||t+1>=i)return null;if(u=n[t+1],r._escapedChars.indexOf(u)>=0){if(u==="x"){if(a=r._matchChars(n,t+2,i,r._hexSymbols,2),a.matchLength!==2)throw new System.ArgumentException("Insufficient hexadecimal digits.");return v=parseInt(a.match,16),f=r._createPatternToken(n,o.escCharHex,t,4),f.data={n:v,ch:String.fromCharCode(v)},f}if(u==="c"){if(t+2>=i)throw new System.ArgumentException("Missing control character.");if(h=n[t+2],h=h.toUpperCase(),c=this._controlChars.indexOf(h),c>=0)return f=r._createPatternToken(n,o.escCharCtrl,t,3),f.data={n:c,ch:String.fromCharCode(c)},f;throw new System.ArgumentException("Unrecognized control character.");}else if(u==="u"){if(y=r._matchChars(n,t+2,i,r._hexSymbols,4),y.matchLength!==4)throw new System.ArgumentException("Insufficient hexadecimal digits.");return p=parseInt(y.match,16),f=r._createPatternToken(n,o.escCharUnicode,t,6),f.data={n:p,ch:String.fromCharCode(p)},f}f=r._createPatternToken(n,o.escChar,t,2);switch(u){case"a":e=7;break;case"b":e=8;break;case"t":e=9;break;case"r":e=13;break;case"v":e=11;break;case"f":e=12;break;case"n":e=10;break;case"e":e=27;break;default:throw new System.ArgumentException("Unexpected escaped char: '"+u+"'.");}return f.data={n:e,ch:String.fromCharCode(e)},f}if(u>="0"&&u<="7")return r._parseOctalCharToken(n,t,i);if(r._escapedCharClasses.indexOf(u)>=0){if(u==="p"||u==="P"){if(s=r._matchUntil(n,t+2,i,"}"),s.matchLength<2||s.match[0]!=="{"||s.unmatchLength!==1)throw new System.ArgumentException("Incomplete p{X} character escape.");if(l=s.match.slice(1),r._unicodeCategories.indexOf(l)>=0)return r._createPatternToken(n,o.escCharClassCategory,t,2+s.matchLength+1);if(r._namedCharBlocks.indexOf(l)>=0)return r._createPatternToken(n,o.escCharClassBlock,t,2+s.matchLength+1);throw new System.ArgumentException("Unknown property '"+l+"'.");}return r._createPatternToken(n,o.escCharClass,t,2)}return r._escapedSpecialSymbols.indexOf(u)>=0?(f=r._createPatternToken(n,o.escCharOther,t,2),f.data={n:u.charCodeAt(0),ch:u},f):null},_parseCharRangeToken:function(n,t,i){var e=System.Text.RegularExpressions.RegexEngineParser,a=e.tokenTypes,u=[],v,o,f,y=!1,p=!1,w=!1,s=n[t],r,h,c,b,l,k;if(s!=="[")return null;for(r=t+1,h=-1,rb){h=r;break}else f=e._createPatternToken(n,a.literal,r,1),c=1;if(p)throw new System.ArgumentException("A subtraction must be the last element in a character class.");u.length>1&&(v=e._parseCharIntervalToken(n,u[u.length-2],u[u.length-1],f),v!=null&&(u.pop(),u.pop(),f=v));f!=null&&(u.push(f),r+=c)}if(h<0||u.length<1)throw new System.ArgumentException("Unterminated [] set.");return l=y?e._createPatternToken(n,a.charNegativeGroup,t,1+h-t,u,"[^","]"):e._createPatternToken(n,a.charGroup,t,1+h-t,u,"[","]"),k=e._tidyCharRange(u),l.data={ranges:k},o!=null&&(l.data.substractToken=o),l},_parseCharIntervalToken:function(n,t,i,r){var h=System.Text.RegularExpressions.RegexEngineParser,u=h.tokenTypes,f,o,e,s;if(i.type!==u.literal||i.value!=="-"||t.type!==u.literal&&t.type!==u.escChar&&t.type!==u.escCharOctal&&t.type!==u.escCharHex&&t.type!==u.escCharCtrl&&t.type!==u.escCharUnicode&&t.type!==u.escCharOther||r.type!==u.literal&&r.type!==u.escChar&&r.type!==u.escCharOctal&&r.type!==u.escCharHex&&r.type!==u.escCharCtrl&&r.type!==u.escCharUnicode&&r.type!==u.escCharOther)return null;if(t.type===u.literal?(f=t.value.charCodeAt(0),o=t.value):(f=t.data.n,o=t.data.ch),r.type===u.literal?(e=r.value.charCodeAt(0),s=r.value):(e=r.data.n,s=r.data.ch),f>e)throw new System.NotSupportedException("[x-y] range in reverse order.");var l=t.index,a=t.length+i.length+r.length,c=h._createPatternToken(n,u.charInterval,l,a,[t,i,r],"","");return c.data={startN:f,startCh:o,endN:e,endCh:s},c},_tidyCharRange:function(n){for(var l=System.Text.RegularExpressions.RegexEngineParser,i=l.tokenTypes,f,e,o,t,r=[],a=[],s,h,c,v,u=0;ue)break;r.splice(f,0,{n:e,m:o})}for(u=0;u1+s.m)break;c++;h.m>s.m&&(s.m=h.m)}c>0&&r.splice(u+1,c)}return a.length>0&&(v="["+l._constructPattern(a)+"]",r.charClassToken=l._createPatternToken(v,i.charGroup,0,v.length,n,"[","]")),r},_parseDotToken:function(n,t){var i=System.Text.RegularExpressions.RegexEngineParser,r=i.tokenTypes,u=n[t];return u!=="."?null:i._createPatternToken(n,r.escCharClassDot,t,1)},_parseAnchorToken:function(n,t){var i=System.Text.RegularExpressions.RegexEngineParser,u=i.tokenTypes,r=n[t];return r!=="^"&&r!=="$"?null:i._createPatternToken(n,u.anchor,t,1)},_updateSettingsFromConstructs:function(n,t){t.isIgnoreWhitespace!=null&&(n.ignoreWhitespace=t.isIgnoreWhitespace);t.isExplicitCapture!=null&&(n.explicitCapture=t.isExplicitCapture)},_parseGroupToken:function(n,t,i,r){var s=System.Text.RegularExpressions.RegexEngineParser,u=s.tokenTypes,a={ignoreWhitespace:t.ignoreWhitespace,explicitCapture:t.explicitCapture},e=n[i],h,c,l,ft,et,p,w,ot,b,nt;if(e!=="(")return null;var k=1,y=!1,d=i+1,o=-1,g=!1,tt=!1,it=!1,rt=!1,ut=!1,v=null,f=s._parseGroupConstructToken(n,a,i+1,r);for(f!=null&&(v=this._fillGroupConstructs(f),d+=f.length,f.type===u.commentInline?g=!0:f.type===u.alternationGroupCondition?tt=!0:f.type===u.groupConstructImnsx?(this._updateSettingsFromConstructs(a,v),rt=!0):f.type===u.groupConstructImnsxMisc&&(this._updateSettingsFromConstructs(t,v),it=!0)),a.explicitCapture&&(v==null||v.name1==null)&&(ut=!0),h=d;h1))throw new System.ArgumentException("Too many | in (?()|).");if(w===0)throw new System.NotSupportedException("Alternation group without | is not supported.");ot=s._createPatternToken(n,u.alternationGroup,i,1+o-i,l,"(",")");c=ot}else b=u.group,it?b=u.groupImnsxMisc:rt&&(b=u.groupImnsx),nt=s._createPatternToken(n,b,i,1+o-i,l,"(",")"),nt.localSettings=a,c=nt}return ut&&(c.isNonCapturingExplicit=!0),c},_parseGroupConstructToken:function(n,t,i,r){var f=System.Text.RegularExpressions.RegexEngineParser,o=f.tokenTypes,u=n[i],h,c,s,l,e,a,v;if(u!=="?"||i+1>=r)return null;if(u=n[i+1],u===":"||u==="="||u==="!"||u===">")return f._createPatternToken(n,o.groupConstruct,i,2);if(u==="#")return f._createPatternToken(n,o.commentInline,i,2);if(u==="(")return f._parseAlternationGroupConditionToken(n,t,i,r);if(u==="<"&&i+2":u,s=f._matchUntil(n,i+2,r,c),s.unmatchLength!==1||s.matchLength===0)throw new System.ArgumentException("Unrecognized grouping construct.");if(l=s.match.slice(0,1),"`~@#$%^&*()+{}[]|\\/|'\";:,.?".indexOf(l)>=0)throw new System.ArgumentException("Invalid group name: Group names must begin with a word character.");return f._createPatternToken(n,o.groupConstructName,i,2+s.matchLength+1)}if(e=f._matchChars(n,i+1,r,"imnsx-"),e.matchLength>0&&(e.unmatchCh===":"||e.unmatchCh===")"))return a=e.unmatchCh===":"?o.groupConstructImnsx:o.groupConstructImnsxMisc,v=e.unmatchCh===":"?1:0,f._createPatternToken(n,a,i,1+e.matchLength+v);throw new System.ArgumentException("Unrecognized grouping construct.");},_parseQuantifierToken:function(n,t,i){var f=System.Text.RegularExpressions.RegexEngineParser,s=f.tokenTypes,r=null,e=n[t],u,o,h,c;if(e==="*"||e==="+"||e==="?")r=f._createPatternToken(n,s.quantifier,t,1),r.data={val:e};else if(e==="{"&&(u=f._matchChars(n,t+1,i,f._decSymbols),u.matchLength!==0))if(u.unmatchCh==="}")r=f._createPatternToken(n,s.quantifierN,t,1+u.matchLength+1),r.data={n:parseInt(u.match,10)};else if(u.unmatchCh===","&&(o=f._matchChars(n,u.unmatchIndex+1,i,f._decSymbols),o.unmatchCh==="}"&&(r=f._createPatternToken(n,s.quantifierNM,t,1+u.matchLength+1+o.matchLength+1),r.data={n:parseInt(u.match,10),m:null},o.matchLength!==0&&(r.data.m=parseInt(o.match,10),r.data.n>r.data.m))))throw new System.ArgumentException("Illegal {x,y} with x > y.");return r!=null&&(h=t+r.length,h=r||n[i+1]!=="("||(f=s._parseGroupToken(n,t,i+1,r),f==null))return null;if(f.type===u.commentInline)throw new System.ArgumentException("Alternation conditions cannot be comments.");if(e=f.children,e&&e.length){if(h=e[0],h.type===u.groupConstructName)throw new System.ArgumentException("Alternation conditions do not capture and cannot be named.");if((h.type===u.groupConstruct||h.type===u.groupConstructImnsx)&&(l=s._findFirstGroupWithoutConstructs(e),l!=null&&(l.isEmptyCapturing=!0)),h.type===u.literal)if(o=f.value.slice(1,f.value.length-1),v=o[0]>="0"&&o[0]<="9",v){if(y=s._matchChars(o,0,o.length,s._decSymbols),y.matchLength!==o.length)throw new System.ArgumentException("Malformed Alternation group number: "+o+".");p=parseInt(o,10);c={number:p}}else c={name:o}}return e.length&&(e[0].type===u.groupConstruct||e[0].type===u.groupConstructImnsx)||(h=s._createPatternToken("?:",u.groupConstruct,0,2),e.splice(0,0,h)),a=s._createPatternToken(n,u.alternationGroupCondition,f.index-1,1+f.length,[f],"?",""),c!=null&&(a.data=c),a},_findFirstGroupWithoutConstructs:function(n){for(var f=System.Text.RegularExpressions.RegexEngineParser,u=f.tokenTypes,i=null,t,r=0;r0&&(o.children=u,o.childrenPrefix=f,o.childrenPostfix=e),o},_modifyPatternToken:function(n,t,i,r,u){i!=null&&(n.type=i);(r!=null||u!=null)&&(r!=null&&(n.index=r),u!=null&&(n.length=u),n.value=t.slice(n.index,n.index+n.length))},_updatePatternToken:function(n,t,i,r,u){n.type=t;n.index=i;n.length=r;n.value=u},_matchChars:function(n,t,i,r,u){var f={match:"",matchIndex:-1,matchLength:0,unmatchCh:"",unmatchIndex:-1,unmatchLength:0},e=t,o;for(u!=null&&u>=0&&(i=t+u);et&&(f.match=n.slice(t,e),f.matchIndex=t,f.matchLength=e-t),f},_matchUntil:function(n,t,i,r,u){var f={match:"",matchIndex:-1,matchLength:0,unmatchCh:"",unmatchIndex:-1,unmatchLength:0},e=t,o;for(u!=null&&u>=0&&(i=t+u);e=0){f.unmatchCh=o;f.unmatchIndex=e;f.unmatchLength=1;break}e++}return e>t&&(f.match=n.slice(t,e),f.matchIndex=t,f.matchLength=e-t),f}}});Bridge.define("System.Random",{statics:{MBIG:2147483647,MSEED:161803398,MZ:0},inext:0,inextp:0,seedArray:null,config:{init:function(){this.seedArray=System.Array.init(56,0)}},ctor:function(){System.Random.$ctor1.call(this,System.Int64.clip32(System.Int64((new Date).getTime()).mul(1e4)))},$ctor1:function(n){var e,u,i,o,r,f,t;for(this.$initialize(),o=n===-2147483648?2147483647:Math.abs(n),u=System.Random.MSEED-o|0,this.seedArray[55]=u,i=1,r=1;r<55;r=r+1|0)e=(21*r|0)%55,this.seedArray[e]=i,i=u-i|0,i<0&&(i=i+System.Random.MBIG|0),u=this.seedArray[e];for(f=1;f<5;f=f+1|0)for(t=1;t<56;t=t+1|0)this.seedArray[t]=this.seedArray[t]-this.seedArray[1+(t+30|0)%55|0]|0,this.seedArray[t]<0&&(this.seedArray[t]=this.seedArray[t]+System.Random.MBIG|0);this.inext=0;this.inextp=21;n=1},sample:function(){return this.internalSample()*46566128752457969e-26},internalSample:function(){var n,t=this.inext,i=this.inextp;return(t=t+1|0)>=56&&(t=1),(i=i+1|0)>=56&&(i=1),n=this.seedArray[t]-this.seedArray[i]|0,n===System.Random.MBIG&&(n=n-1|0),n<0&&(n=n+System.Random.MBIG|0),this.seedArray[t]=n,this.inext=t,this.inextp=i,n},next:function(){return this.internalSample()},next$2:function(n,t){if(n>t)throw new System.ArgumentOutOfRangeException("minValue","'minValue' cannot be greater than maxValue.");var i=System.Int64(t).sub(System.Int64(n));return i.lte(System.Int64(2147483647))?Bridge.Int.clip32(this.sample()*System.Int64.toNumber(i))+n|0:System.Int64.clip32(Bridge.Int.clip64(this.getSampleForLargeRange()*System.Int64.toNumber(i)).add(System.Int64(n)))},next$1:function(n){if(n<0)throw new System.ArgumentOutOfRangeException("maxValue","'maxValue' must be greater than zero.");return Bridge.Int.clip32(this.sample()*n)},getSampleForLargeRange:function(){var n=this.internalSample(),i=this.internalSample()%2==0?!0:!1,t;return i&&(n=-n|0),t=n,t+=2147483646,t/4294967293},nextDouble:function(){return this.sample()},nextBytes:function(n){if(n==null)throw new System.ArgumentNullException("buffer");for(var t=0;t0?(Bridge.Int.div(n-1|0,t)|0)+1|0:0}},m_array:null,m_length:0,_version:0,config:{alias:["getCount","System$Collections$ICollection$getCount","clone","System$ICloneable$clone","getIsReadOnly","System$Collections$ICollection$getIsReadOnly","getEnumerator","System$Collections$IEnumerable$getEnumerator"]},$ctor3:function(n){System.Collections.BitArray.$ctor4.call(this,n,!1)},$ctor4:function(n,t){var r,i;if(this.$initialize(),n<0)throw new System.ArgumentOutOfRangeException("length","Index is less than zero.");for(this.m_array=System.Array.init(System.Collections.BitArray.getArrayLength(n,System.Collections.BitArray.BitsPerInt32),0),this.m_length=n,r=t?-1:0,i=0;i268435455)throw new System.ArgumentException(System.String.format("The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue.",System.Collections.BitArray.BitsPerByte),"bytes");for(this.m_array=System.Array.init(System.Collections.BitArray.getArrayLength(n.length,System.Collections.BitArray.BytesPerInt32),0),this.m_length=n.length*System.Collections.BitArray.BitsPerByte|0,i=0,t=0;(n.length-t|0)>=4;)this.m_array[Bridge.identity(i,i=i+1|0)]=n[t]&255|(n[t+1|0]&255)<<8|(n[t+2|0]&255)<<16|(n[t+3|0]&255)<<24,t=t+4|0;r=n.length-t|0;r===3&&(this.m_array[i]=(n[t+2|0]&255)<<16,r=2);r===2&&(this.m_array[i]=this.m_array[i]|(n[t+1|0]&255)<<8,r=1);r===1&&(this.m_array[i]=this.m_array[i]|n[t]&255);this._version=0},ctor:function(n){if(this.$initialize(),n==null)throw new System.ArgumentNullException("values");this.m_array=System.Array.init(System.Collections.BitArray.getArrayLength(n.length,System.Collections.BitArray.BitsPerInt32),0);this.m_length=n.length;for(var t=0;t67108863)throw new System.ArgumentException(System.String.format("The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue.",System.Collections.BitArray.BitsPerInt32),"values");this.m_array=System.Array.init(n.length,0);this.m_length=n.length*System.Collections.BitArray.BitsPerInt32|0;System.Array.copy(n,0,this.m_array,0,n.length);this._version=0},$ctor2:function(n){if(this.$initialize(),n==null)throw new System.ArgumentNullException("bits");var t=System.Collections.BitArray.getArrayLength(n.m_length,System.Collections.BitArray.BitsPerInt32);this.m_array=System.Array.init(t,0);this.m_length=n.m_length;System.Array.copy(n.m_array,0,this.m_array,0,t);this._version=n._version},getItem:function(n){return this.get(n)},setItem:function(n,t){this.set(n,t)},getLength:function(){return this.m_length},setLength:function(n){var t,r,i,u;if(n<0)throw new System.ArgumentOutOfRangeException("value","Non-negative number required.");t=System.Collections.BitArray.getArrayLength(n,System.Collections.BitArray.BitsPerInt32);(t>this.m_array.length||(t+System.Collections.BitArray._ShrinkThreshold|0)this.m_array.length?this.m_array.length:t),this.m_array=r);n>this.m_length&&(i=System.Collections.BitArray.getArrayLength(this.m_length,System.Collections.BitArray.BitsPerInt32)-1|0,u=this.m_length%32,u>0&&(this.m_array[i]=this.m_array[i]&((1<=this.getLength())throw new System.ArgumentOutOfRangeException("index","Index was out of range. Must be non-negative and less than the size of the collection.");return(this.m_array[Bridge.Int.div(n,32)|0]&1<=this.getLength())throw new System.ArgumentOutOfRangeException("index","Index was out of range. Must be non-negative and less than the size of the collection.");this.m_array[Bridge.Int.div(n,32)|0]=t?this.m_array[Bridge.Int.div(n,32)|0]|1<=this.bitarray.getCount())throw new System.InvalidOperationException("Enumeration already finished.");return this.currentElement},moveNext:function(){if(this.version!==this.bitarray._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");return this.index<(this.bitarray.getCount()-1|0)?(this.index=this.index+1|0,this.currentElement=this.bitarray.get(this.index),!0):(this.index=this.bitarray.getCount(),!1)},reset:function(){if(this.version!==this.bitarray._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");this.index=-1}});Bridge.define("System.Collections.Generic.BitHelper",{statics:{MarkedBitFlag:1,IntSize:32,toIntArrayLength:function(n){return n>0?(Bridge.Int.div(n-1|0,System.Collections.Generic.BitHelper.IntSize)|0)+1|0:0}},_length:0,_array:null,ctor:function(n,t){this.$initialize();this._array=n;this._length=t},markBit:function(n){var t=Bridge.Int.div(n,System.Collections.Generic.BitHelper.IntSize)|0,i;t=0&&(i=System.Collections.Generic.BitHelper.MarkedBitFlag<=0?(i=System.Collections.Generic.BitHelper.MarkedBitFlag<>>0>e&&(o=e<=r?r+1|0:e),System.Array.resize(f,o,Bridge.getDefaultValue(n))),f.v[Bridge.identity(r,r=r+1|0)]=u[Bridge.geti(u,"System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(n)+"$getCurrent$1","getCurrent$1")]();return i.v=r,f.v}}finally{Bridge.hasValue(u)&&u.dispose()}return i.v=0,System.Array.init(0,function(){return Bridge.getDefaultValue(n)})}}});Bridge.define("System.Collections.Generic.HashSet$1",function(n){return{inherits:[System.Collections.Generic.ICollection$1(n),System.Collections.Generic.ISet$1(n)],statics:{Lower31BitMask:2147483647,ShrinkThreshold:3,hashSetEquals:function(t,i,r){var u,f,e,s,h,o,c;if(t==null)return i==null;if(i==null)return!1;if(System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(t,i)){if(t.getCount()!==i.getCount())return!1;for(u=Bridge.getEnumerator(i);u.moveNext();)if(s=u.getCurrent(),!t.contains(s))return!1;return!0}for(f=Bridge.getEnumerator(i);f.moveNext();){for(h=f.getCurrent(),o=!1,e=Bridge.getEnumerator(t);e.moveNext();)if(c=e.getCurrent(),r["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](h,c)){o=!0;break}if(!o)return!1}return!0},areEqualityComparersEqual:function(n,t){return Bridge.equals(n.getComparer(),t.getComparer())}},_buckets:null,_slots:null,_count:0,_lastIndex:0,_freeList:0,_comparer:null,_version:0,config:{alias:["System$Collections$Generic$ICollection$1$T$add","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$add","clear","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$clear","contains","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$contains","copyTo","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$copyTo","remove","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$remove","getCount","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getCount","getIsReadOnly","System$Collections$Generic$ICollection$1$"+Bridge.getTypeAlias(n)+"$getIsReadOnly","System$Collections$Generic$IEnumerable$1$T$getEnumerator","System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(n)+"$getEnumerator","add","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$add","unionWith","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$unionWith","intersectWith","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$intersectWith","exceptWith","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$exceptWith","symmetricExceptWith","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$symmetricExceptWith","isSubsetOf","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$isSubsetOf","isProperSubsetOf","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$isProperSubsetOf","isSupersetOf","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$isSupersetOf","isProperSupersetOf","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$isProperSupersetOf","overlaps","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$overlaps","setEquals","System$Collections$Generic$ISet$1$"+Bridge.getTypeAlias(n)+"$setEquals"]},ctor:function(){System.Collections.Generic.HashSet$1(n).$ctor3.call(this,System.Collections.Generic.EqualityComparer$1(n).def)},$ctor3:function(t){this.$initialize();t==null&&(t=System.Collections.Generic.EqualityComparer$1(n).def);this._comparer=t;this._lastIndex=0;this._count=0;this._freeList=-1;this._version=0},$ctor1:function(t){System.Collections.Generic.HashSet$1(n).$ctor2.call(this,t,System.Collections.Generic.EqualityComparer$1(n).def)},$ctor2:function(t,i){if(System.Collections.Generic.HashSet$1(n).$ctor3.call(this,i),t==null)throw new System.ArgumentNullException("collection");var r=0,u=Bridge.as(t,System.Collections.Generic.ICollection$1(n));u!=null&&(r=System.Array.getCount(u,n));this.initialize(r);this.unionWith(t);(this._count===0&&this._slots.length>System.Collections.HashHelpers.getMinPrime()||this._count>0&&(Bridge.Int.div(this._slots.length,this._count)|0)>System.Collections.Generic.HashSet$1(n).ShrinkThreshold)&&this.trimExcess()},getCount:function(){return this._count},getIsReadOnly:function(){return!1},getComparer:function(){return this._comparer},System$Collections$Generic$ICollection$1$T$add:function(n){this.addIfNotPresent(n)},add:function(n){return this.addIfNotPresent(n)},clear:function(){var t,i;if(this._lastIndex>0){for(t=0;t=0;i=this._slots[i].next)if(this._slots[i].hashCode===r&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[i].value,t))return!0;return!1},copyTo:function(n,t){this.copyTo$2(n,t,this._count)},copyTo$1:function(n){this.copyTo$2(n,0,this._count)},copyTo$2:function(n,t,i){var u,r;if(n==null)throw new System.ArgumentNullException("array");if(t<0)throw new System.ArgumentOutOfRangeException("arrayIndex");if(i<0)throw new System.ArgumentOutOfRangeException("count");if(t>n.length||i>(n.length-t|0))throw new System.ArgumentException("Destination array is not long enough to copy all the items in the collection. Check array index and length.");for(u=0,r=0;r=0&&(n[t+u|0]=this._slots[r].value,u=u+1|0)},remove:function(t){var i;if(this._buckets!=null){var u=this.internalGetHashCode(t),f=u%this._buckets.length,r=-1;for(i=this._buckets[f]-1|0;i>=0;r=i,i=this._slots[i].next)if(this._slots[i].hashCode===u&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[i].value,t))return r<0?this._buckets[f]=this._slots[i].next+1|0:this._slots[r].next=this._slots[i].next,this._slots[i].hashCode=-1,this._slots[i].value=Bridge.getDefaultValue(n),this._slots[i].next=this._freeList,this._count=this._count-1|0,this._version=this._version+1|0,this._count===0?(this._lastIndex=0,this._freeList=-1):this._freeList=i,!0}return!1},getEnumerator:function(){return new(System.Collections.Generic.HashSet$1.Enumerator(n).$ctor1)(this)},System$Collections$Generic$IEnumerable$1$T$getEnumerator:function(){return new(System.Collections.Generic.HashSet$1.Enumerator(n).$ctor1)(this)},System$Collections$IEnumerable$getEnumerator:function(){return new(System.Collections.Generic.HashSet$1.Enumerator(n).$ctor1)(this)},unionWith:function(t){var i,r;if(t==null)throw new System.ArgumentNullException("other");for(i=Bridge.getEnumerator(t,null,n);i.moveNext();)r=i.getCurrent(),this.addIfNotPresent(r)},intersectWith:function(t){var r,i;if(t==null)throw new System.ArgumentNullException("other");if(this._count!==0){if(r=Bridge.as(t,System.Collections.Generic.ICollection$1(n)),r!=null){if(System.Array.getCount(r,n)===0){this.clear();return}if(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i)){this.intersectWithHashSetWithSameEC(i);return}}this.intersectWithEnumerable(t)}},exceptWith:function(t){var i,r;if(t==null)throw new System.ArgumentNullException("other");if(this._count!==0){if(Bridge.referenceEquals(t,this)){this.clear();return}for(i=Bridge.getEnumerator(t,null,n);i.moveNext();)r=i.getCurrent(),this.remove(r)}},symmetricExceptWith:function(t){if(t==null)throw new System.ArgumentNullException("other");if(this._count===0){this.unionWith(t);return}if(Bridge.referenceEquals(t,this)){this.clear();return}var i=Bridge.as(t,System.Collections.Generic.HashSet$1(n));i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i)?this.symmetricExceptWithUniqueHashSet(i):this.symmetricExceptWithEnumerable(t)},isSubsetOf:function(t){var i,r;if(t==null)throw new System.ArgumentNullException("other");return this._count===0?!0:(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i)?this._count>i.getCount()?!1:this.isSubsetOfHashSetWithSameEC(i):(r=this.checkUniqueAndUnfoundElements(t,!1).$clone(),r.uniqueCount===this._count&&r.unfoundCount>=0))},isProperSubsetOf:function(t){var r,i,u;if(t==null)throw new System.ArgumentNullException("other");if(r=Bridge.as(t,System.Collections.Generic.ICollection$1(n)),r!=null){if(this._count===0)return System.Array.getCount(r,n)>0;if(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i))return this._count>=i.getCount()?!1:this.isSubsetOfHashSetWithSameEC(i)}return u=this.checkUniqueAndUnfoundElements(t,!1).$clone(),u.uniqueCount===this._count&&u.unfoundCount>0},isSupersetOf:function(t){var r,i;if(t==null)throw new System.ArgumentNullException("other");if(r=Bridge.as(t,System.Collections.Generic.ICollection$1(n)),r!=null){if(System.Array.getCount(r,n)===0)return!0;if(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i)&&i.getCount()>this._count)return!1}return this.containsAllElements(t)},isProperSupersetOf:function(t){var r,i,u;if(t==null)throw new System.ArgumentNullException("other");if(this._count===0)return!1;if(r=Bridge.as(t,System.Collections.Generic.ICollection$1(n)),r!=null){if(System.Array.getCount(r,n)===0)return!0;if(i=Bridge.as(t,System.Collections.Generic.HashSet$1(n)),i!=null&&System.Collections.Generic.HashSet$1(n).areEqualityComparersEqual(this,i))return i.getCount()>=this._count?!1:this.containsAllElements(i)}return u=this.checkUniqueAndUnfoundElements(t,!0).$clone(),u.uniqueCount0)?!1:(u=this.checkUniqueAndUnfoundElements(t,!0).$clone(),u.uniqueCount===this._count&&u.unfoundCount===0)},removeWhere:function(n){var i,t,r;if(Bridge.staticEquals(n,null))throw new System.ArgumentNullException("match");for(i=0,t=0;t=0&&(r=this._slots[t].value,n(r)&&this.remove(r)&&(i=i+1|0));return i},trimExcess:function(){var i,e;if(this._count===0)this._buckets=null,this._slots=null,this._version=this._version+1|0;else{var u=System.Collections.HashHelpers.getPrime(this._count),r=System.Array.init(u,function(){return new(System.Collections.Generic.HashSet$1.Slot(n))}),f=System.Array.init(u,0),t=0;for(i=0;i=0&&(r[t]=this._slots[i].$clone(),e=r[t].hashCode%u,r[t].next=f[e]-1|0,f[e]=t+1|0,t=t+1|0);this._lastIndex=t;this._slots=r;this._buckets=f;this._freeList=-1}},initialize:function(t){var i=System.Collections.HashHelpers.getPrime(t);this._buckets=System.Array.init(i,0);this._slots=System.Array.init(i,function(){return new(System.Collections.Generic.HashSet$1.Slot(n))})},increaseCapacity:function(){var n=System.Collections.HashHelpers.expandPrime(this._count);if(n<=this._count)throw new System.ArgumentException("HashSet capacity is too big.");this.setCapacity(n,!1)},setCapacity:function(t,i){var r=System.Array.init(t,function(){return new(System.Collections.Generic.HashSet$1.Slot(n))}),e,u,o,f,s;if(this._slots!=null)for(e=0;e=0;r=this._slots[r].next)if(this._slots[r].hashCode===u&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[r].value,t))return!1;return this._freeList>=0?(i=this._freeList,this._freeList=this._slots[i].next):(this._lastIndex===this._slots.length&&(this.increaseCapacity(),f=u%this._buckets.length),i=this._lastIndex,this._lastIndex=this._lastIndex+1|0),this._slots[i].hashCode=u,this._slots[i].value=t,this._slots[i].next=this._buckets[f]-1|0,this._buckets[f]=i+1|0,this._count=this._count+1|0,this._version=this._version+1|0,!0},containsAllElements:function(t){for(var r,i=Bridge.getEnumerator(t,null,n);i.moveNext();)if(r=i.getCurrent(),!this.contains(r))return!1;return!0},isSubsetOfHashSetWithSameEC:function(n){for(var i,t=Bridge.getEnumerator(this);t.moveNext();)if(i=t.getCurrent(),!n.contains(i))return!1;return!0},intersectWithHashSetWithSameEC:function(n){for(var i,t=0;t=0&&(i=this._slots[t].value,n.contains(i)||this.remove(i))},intersectWithEnumerable:function(t){for(var e=this._lastIndex,o=System.Collections.Generic.BitHelper.toIntArrayLength(e),h=System.Array.init(o,0),s,f,i,u=new System.Collections.Generic.BitHelper(h,o),r=Bridge.getEnumerator(t,null,n);r.moveNext();)s=r.getCurrent(),f=this.internalIndexOf(s),f>=0&&u.markBit(f);for(i=0;i=0&&!u.isMarked(i)&&this.remove(this._slots[i].value)},internalIndexOf:function(t){for(var r=this.internalGetHashCode(t),i=this._buckets[r%this._buckets.length]-1|0;i>=0;i=this._slots[i].next)if(this._slots[i].hashCode===r&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[i].value,t))return i;return-1},symmetricExceptWithUniqueHashSet:function(n){for(var i,t=Bridge.getEnumerator(n);t.moveNext();)i=t.getCurrent(),this.remove(i)||this.addIfNotPresent(i)},symmetricExceptWithEnumerable:function(t){var f,e=this._lastIndex,u=System.Collections.Generic.BitHelper.toIntArrayLength(e),o,s,c=System.Array.init(u,0),h,i;for(o=new System.Collections.Generic.BitHelper(c,u),h=System.Array.init(u,0),s=new System.Collections.Generic.BitHelper(h,u),f=Bridge.getEnumerator(t,null,n);f.moveNext();){var l=f.getCurrent(),r={v:0},a=this.addOrGetLocation(l,r);a?s.markBit(r.v):r.v=0;u=this._slots[u].next)if(this._slots[u].hashCode===f&&this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$equals2"](this._slots[u].value,t))return i.v=u,!1;return this._freeList>=0?(r=this._freeList,this._freeList=this._slots[r].next):(this._lastIndex===this._slots.length&&(this.increaseCapacity(),e=f%this._buckets.length),r=this._lastIndex,this._lastIndex=this._lastIndex+1|0),this._slots[r].hashCode=f,this._slots[r].value=t,this._slots[r].next=this._buckets[e]-1|0,this._buckets[e]=r+1|0,this._count=this._count+1|0,this._version=this._version+1|0,i.v=r,!0},checkUniqueAndUnfoundElements:function(t,i){var s,h,r=new(System.Collections.Generic.HashSet$1.ElementCount(n)),u,v,f,e,a,o;if(this._count===0){for(u=0,s=Bridge.getEnumerator(t,null,n);s.moveNext();){v=s.getCurrent();u=u+1|0;break}return r.uniqueCount=0,r.unfoundCount=u,r.$clone()}var y=this._lastIndex,l=System.Collections.Generic.BitHelper.toIntArrayLength(y),c,p=System.Array.init(l,0);for(c=new System.Collections.Generic.BitHelper(p,l),f=0,e=0,h=Bridge.getEnumerator(t,null,n);h.moveNext();)if(a=h.getCurrent(),o=this.internalIndexOf(a),o>=0)c.isMarked(o)||(c.markBit(o),e=e+1|0);else if(f=f+1|0,i)break;return r.uniqueCount=e,r.unfoundCount=f,r.$clone()},toArray:function(){var t=System.Array.init(this.getCount(),function(){return Bridge.getDefaultValue(n)});return this.copyTo$1(t),t},internalGetHashCode:function(t){return t==null?0:this._comparer["System$Collections$Generic$IEqualityComparer$1$"+Bridge.getTypeAlias(n)+"$getHashCode2"](t)&System.Collections.Generic.HashSet$1(n).Lower31BitMask}}});Bridge.define("System.Collections.Generic.HashSet$1.ElementCount",function(n){return{$kind:"struct",statics:{getDefaultValue:function(){return new(System.Collections.Generic.HashSet$1.ElementCount(n))}},uniqueCount:0,unfoundCount:0,ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([4920463385,this.uniqueCount,this.unfoundCount])},equals:function(t){return Bridge.is(t,System.Collections.Generic.HashSet$1.ElementCount(n))?Bridge.equals(this.uniqueCount,t.uniqueCount)&&Bridge.equals(this.unfoundCount,t.unfoundCount):!1},$clone:function(t){var i=t||new(System.Collections.Generic.HashSet$1.ElementCount(n));return i.uniqueCount=this.uniqueCount,i.unfoundCount=this.unfoundCount,i}}});Bridge.define("System.Collections.Generic.HashSet$1.Enumerator",function(n){return{inherits:[System.Collections.Generic.IEnumerator$1(n)],$kind:"struct",statics:{getDefaultValue:function(){return new(System.Collections.Generic.HashSet$1.Enumerator(n))}},_set:null,_index:0,_version:0,_current:Bridge.getDefaultValue(n),config:{alias:["dispose","System$IDisposable$dispose","moveNext","System$Collections$IEnumerator$moveNext","getCurrent","System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(n)+"$getCurrent$1"]},$ctor1:function(t){this.$initialize();this._set=t;this._index=0;this._version=t._version;this._current=Bridge.getDefaultValue(n)},ctor:function(){this.$initialize()},getCurrent:function(){return this._current},System$Collections$IEnumerator$getCurrent:function(){if(this._index===0||this._index===(this._set._lastIndex+1|0))throw new System.InvalidOperationException("Enumeration has either not started or has already finished.");return this.getCurrent()},dispose:function(){},moveNext:function(){if(this._version!==this._set._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");while(this._index=0)return this._current=this._set._slots[this._index].value,this._index=this._index+1|0,!0;this._index=this._index+1|0}return this._index=this._set._lastIndex+1|0,this._current=Bridge.getDefaultValue(n),!1},System$Collections$IEnumerator$reset:function(){if(this._version!==this._set._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");this._index=0;this._current=Bridge.getDefaultValue(n)},getHashCode:function(){return Bridge.addHash([3788985113,this._set,this._index,this._version,this._current])},equals:function(t){return Bridge.is(t,System.Collections.Generic.HashSet$1.Enumerator(n))?Bridge.equals(this._set,t._set)&&Bridge.equals(this._index,t._index)&&Bridge.equals(this._version,t._version)&&Bridge.equals(this._current,t._current):!1},$clone:function(t){var i=t||new(System.Collections.Generic.HashSet$1.Enumerator(n));return i._set=this._set,i._index=this._index,i._version=this._version,i._current=this._current,i}}});Bridge.define("System.Collections.Generic.HashSet$1.Slot",function(n){return{$kind:"struct",statics:{getDefaultValue:function(){return new(System.Collections.Generic.HashSet$1.Slot(n))}},hashCode:0,value:Bridge.getDefaultValue(n),next:0,ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([1953459283,this.hashCode,this.value,this.next])},equals:function(t){return Bridge.is(t,System.Collections.Generic.HashSet$1.Slot(n))?Bridge.equals(this.hashCode,t.hashCode)&&Bridge.equals(this.value,t.value)&&Bridge.equals(this.next,t.next):!1},$clone:function(t){var i=t||new(System.Collections.Generic.HashSet$1.Slot(n));return i.hashCode=this.hashCode,i.value=this.value,i.next=this.next,i}}});Bridge.define("System.Collections.Generic.Queue$1",function(n){return{inherits:[System.Collections.Generic.IEnumerable$1(n),System.Collections.ICollection],statics:{MinimumGrow:4,GrowFactor:200,DefaultCapacity:4},_array:null,_head:0,_tail:0,_size:0,_version:0,config:{alias:["getCount","System$Collections$ICollection$getCount","getIsReadOnly","System$Collections$ICollection$getIsReadOnly","System$Collections$Generic$IEnumerable$1$T$getEnumerator","System$Collections$Generic$IEnumerable$1$"+Bridge.getTypeAlias(n)+"$getEnumerator"]},ctor:function(){this.$initialize();this._array=System.Array.init(0,function(){return Bridge.getDefaultValue(n)})},$ctor2:function(t){if(this.$initialize(),t<0)throw new System.ArgumentOutOfRangeException("capacity","Non-negative number required.");this._array=System.Array.init(t,function(){return Bridge.getDefaultValue(n)})},$ctor1:function(t){if(this.$initialize(),t==null)throw new System.ArgumentNullException("collection");this._array=System.Array.init(System.Collections.Generic.Queue$1(n).DefaultCapacity,function(){return Bridge.getDefaultValue(n)});var i=Bridge.getEnumerator(t,null,n);try{while(i.System$Collections$IEnumerator$moveNext())this.enqueue(i[Bridge.geti(i,"System$Collections$Generic$IEnumerator$1$"+Bridge.getTypeAlias(n)+"$getCurrent$1","getCurrent$1")]())}finally{Bridge.hasValue(i)&&i.dispose()}},getCount:function(){return this._size},getIsReadOnly:function(){return!1},clear:function(){this._headn.length)throw new System.ArgumentOutOfRangeException("arrayIndex","Index was out of range. Must be non-negative and less than the size of the collection.");if(r=n.length,(r-t|0)0&&System.Array.copy(this._array,0,n,(t+this._array.length|0)-this._head|0,i))},enqueue:function(t){if(this._size===this._array.length){var i=Bridge.Int.div(this._array.length*System.Collections.Generic.Queue$1(n).GrowFactor|0,100)|0;i<(this._array.length+System.Collections.Generic.Queue$1(n).MinimumGrow|0)&&(i=this._array.length+System.Collections.Generic.Queue$1(n).MinimumGrow|0);this.setCapacity(i)}this._array[this._tail]=t;this._tail=this.moveNext(this._tail);this._size=this._size+1|0;this._version=this._version+1|0},getEnumerator:function(){return new(System.Collections.Generic.Queue$1.Enumerator(n).$ctor1)(this)},System$Collections$Generic$IEnumerable$1$T$getEnumerator:function(){return new(System.Collections.Generic.Queue$1.Enumerator(n).$ctor1)(this)},System$Collections$IEnumerable$getEnumerator:function(){return new(System.Collections.Generic.Queue$1.Enumerator(n).$ctor1)(this)},dequeue:function(){if(this._size===0)throw new System.InvalidOperationException("Queue empty.");var t=this._array[this._head];return this._array[this._head]=Bridge.getDefaultValue(n),this._head=this.moveNext(this._head),this._size=this._size-1|0,this._version=this._version+1|0,t},peek:function(){if(this._size===0)throw new System.InvalidOperationException("Queue empty.");return this._array[this._head]},contains:function(t){for(var i=this._head,r=this._size,u=System.Collections.Generic.EqualityComparer$1(n).def;Bridge.identity(r,r=r-1|0)>0;){if(t==null){if(this._array[i]==null)return!0}else if(this._array[i]!=null&&u.equals2(this._array[i],t))return!0;i=this.moveNext(i)}return!1},getElement:function(n){return this._array[(this._head+n|0)%this._array.length]},toArray:function(){var t=System.Array.init(this._size,function(){return Bridge.getDefaultValue(n)});return this._size===0?t:(this._head0&&(this._head0;)if(t==null){if(this._array[i]==null)return!0}else if(this._array[i]!=null&&r.equals2(this._array[i],t))return!0;return!1},copyTo:function(n,t){var i,u,r;if(n==null)throw new System.ArgumentNullException("array");if(t<0||t>n.length)throw new System.ArgumentOutOfRangeException("arrayIndex","Non-negative number required.");if((n.length-t|0)n.length)throw new System.ArgumentOutOfRangeException("arrayIndex","Non-negative number required.");if((n.length-t|0)=0,t&&(this._currentElement=this._stack._array[this._index]),t):this._index===-1?!1:(t=(this._index=this._index-1|0)>=0,this._currentElement=t?this._stack._array[this._index]:Bridge.getDefaultValue(n),t)},System$Collections$IEnumerator$reset:function(){if(this._version!==this._stack._version)throw new System.InvalidOperationException("Collection was modified; enumeration operation may not execute.");this._index=-2;this._currentElement=Bridge.getDefaultValue(n)},getHashCode:function(){return Bridge.addHash([3788985113,this._stack,this._index,this._version,this._currentElement])},equals:function(t){return Bridge.is(t,System.Collections.Generic.Stack$1.Enumerator(n))?Bridge.equals(this._stack,t._stack)&&Bridge.equals(this._index,t._index)&&Bridge.equals(this._version,t._version)&&Bridge.equals(this._currentElement,t._currentElement):!1},$clone:function(t){var i=t||new(System.Collections.Generic.Stack$1.Enumerator(n));return i._stack=this._stack,i._index=this._index,i._version=this._version,i._currentElement=this._currentElement,i}}});Bridge.define("System.Collections.HashHelpers",{statics:{HashPrime:101,primes:null,MaxPrimeArrayLength:2146435069,config:{init:function(){this.primes=[3,7,11,17,23,29,37,47,59,71,89,107,131,163,197,239,293,353,431,521,631,761,919,1103,1327,1597,1931,2333,2801,3371,4049,4861,5839,7013,8419,10103,12143,14591,17519,21023,25229,30293,36353,43627,52361,62851,75431,90523,108631,130363,156437,187751,225307,270371,324449,389357,467237,560689,672827,807403,968897,1162687,1395263,1674319,2009191,2411033,2893249,3471899,4166287,4999559,5999471,7199369]}},isPrime:function(n){var i,t;if((n&1)!=0){for(i=Bridge.Int.clip32(Math.sqrt(n)),t=3;t<=i;t=t+2|0)if(n%t==0)return!1;return!0}return n===2},getPrime:function(n){var i,r,t;if(n<0)throw new System.ArgumentException("Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.");for(i=0;i=n)return r;for(t=n|1;t<2147483647;t=t+2|0)if(System.Collections.HashHelpers.isPrime(t)&&(t-1|0)%System.Collections.HashHelpers.HashPrime!=0)return t;return n},getMinPrime:function(){return System.Collections.HashHelpers.primes[0]},expandPrime:function(n){var t=2*n|0;return t>>>0>System.Collections.HashHelpers.MaxPrimeArrayLength&&System.Collections.HashHelpers.MaxPrimeArrayLength>n?System.Collections.HashHelpers.MaxPrimeArrayLength:System.Collections.HashHelpers.getPrime(t)}}})}); Bridge.assembly("OrgChart.Layout",function($asm){"use strict";Bridge.define("OrgChart.Annotations.CanBeNullAttribute",{inherits:[System.Attribute]});Bridge.define("OrgChart.Annotations.ContractAnnotationAttribute",{inherits:[System.Attribute],config:{properties:{Contract:null,ForceFullStates:!1}},ctor:function(contract){OrgChart.Annotations.ContractAnnotationAttribute.$ctor1.call(this,contract,!1)},$ctor1:function(contract,forceFullStates){this.$initialize();System.Attribute.ctor.call(this);this.setContract(contract);this.setForceFullStates(forceFullStates)}});Bridge.define("OrgChart.Annotations.NotNullAttribute",{inherits:[System.Attribute]});Bridge.define("OrgChart.Annotations.PureAttribute",{inherits:[System.Attribute]});Bridge.define("OrgChart.Layout.Boundary",{Left:null,Right:null,m_spacerMerger:null,config:{properties:{BoundingRect:null},init:function(){this.BoundingRect=new OrgChart.Layout.Rect}},ctor:function(){OrgChart.Layout.Boundary.$ctor1.call(this,!0)},$ctor1:function(frompublic){this.$initialize();this.Left=new(System.Collections.Generic.List$1(OrgChart.Layout.Boundary.Step));this.Right=new(System.Collections.Generic.List$1(OrgChart.Layout.Boundary.Step));frompublic&&(this.m_spacerMerger=new OrgChart.Layout.Boundary.$ctor1(!1))},PrepareForHorizontalLayout:function(node){if(this.Prepare(node),!node.getElement().DisableCollisionDetection){var rect=node.getState();this.Left.add(new OrgChart.Layout.Boundary.Step.$ctor1(node,rect.getLeft(),rect.getTop(),rect.getBottom()));this.Right.add(new OrgChart.Layout.Boundary.Step.$ctor1(node,rect.getRight(),rect.getTop(),rect.getBottom()))}},Prepare:function(node){this.Left.clear();this.Right.clear();this.setBoundingRect(new OrgChart.Layout.Rect.$ctor1(node.getState().TopLeft,node.getState().Size))},VerticalMergeFrom:function(other){this.setBoundingRect(OrgChart.Layout.Rect.op_Addition(this.getBoundingRect(),other.getBoundingRect()))},MergeFrom:function(other){var merge,my,th,theirWins;if(other.getBoundingRect().getTop()>=other.getBoundingRect().getBottom())throw new System.ArgumentException("Cannot merge boundary of height "+System.Double.format(other.getBoundingRect().getBottom()-other.getBoundingRect().getTop(),"G"));for(merge=114;merge!==0;){for(var mySteps=merge===114?this.Right:this.Left,theirSteps=merge===114?other.Right:other.Left,i=0,k=0;k=th.X;OrgChart.Layout.LayoutAlgorithm.IsEqual(my.Top,th.Top)?OrgChart.Layout.LayoutAlgorithm.IsEqual(my.Bottom,th.Bottom)?(theirWins&&mySteps.setItem(i,th),i=i+1|0,k=k+1|0,this.ValidateState()):my.Bottomth.Bottom?(theirWins&&(mySteps.setItem(i,my.ChangeBottom(th.Top)),mySteps.insert(i+1|0,th),mySteps.insert(i+2|0,my.ChangeTop(th.Bottom)),i=i+2|0),k=k+1|0,this.ValidateState()):my.Bottom>th.Bottom?(theirWins?(mySteps.setItem(i,my.ChangeTop(th.Bottom)),mySteps.insert(i,th)):mySteps.insert(i,th.ChangeBottom(my.Top)),i=i+1|0,k=k+1|0,this.ValidateState()):(theirWins?mySteps.setItem(i,th.ChangeBottom(my.Bottom)):(mySteps.insert(i,th.ChangeBottom(my.Top)),i=i+1|0),theirSteps.setItem(k,th.ChangeTop(my.Bottom)),i=i+1|0,this.ValidateState())}if(i===mySteps.getCount())while(koffense&&(offense=diff)),my.Bottom>=th.Bottom&&(k=k+1|0),th.Bottom>=my.Bottom&&(i=i+1|0));return offense},ReloadFromBranch:function(branchRoot){for(var left,newLeft,i1,right,newRight,leftmost=System.Double.max,rightmost=System.Double.min,i=0;i=0)||!(box.Size.Width<=1e9)||!(box.Size.Height>=0)||!(box.Size.Width<=1e9))throw new System.InvalidOperationException(System.String.format("Box {0} has invalid size: {1}x{2}",box.Id,box.Size.Width,box.Size.Height));},PreprocessVisualTree:function(state,visualTree){var defaultStrategy=state.getDiagram().getLayoutSettings().RequireDefaultLayoutStrategy(),defaultAssistantsStrategy=state.getDiagram().getLayoutSettings().RequireDefaultAssistantLayoutStrategy(),regular=new(System.Collections.Generic.Stack$1(OrgChart.Layout.LayoutStrategyBase).ctor),assistants;regular.push(defaultStrategy);assistants=new(System.Collections.Generic.Stack$1(OrgChart.Layout.LayoutStrategyBase).ctor);assistants.push(defaultAssistantsStrategy);visualTree.IterateParentFirst(function(node){var strategy,suggestedStrategyId;return node.getState().IsHidden?!1:(strategy=null,Bridge.staticEquals(state.getLayoutOptimizerFunc(),null)||(suggestedStrategyId=state.getLayoutOptimizerFunc()(node),System.String.isNullOrEmpty(suggestedStrategyId)||(strategy=state.getDiagram().getLayoutSettings().getLayoutStrategies().get(suggestedStrategyId))),node.getIsAssistantRoot()?(strategy==null&&(strategy=node.getParentNode().getElement().AssistantLayoutStrategyId!=null?state.getDiagram().getLayoutSettings().getLayoutStrategies().get(node.getParentNode().getElement().AssistantLayoutStrategyId):assistants.peek()),assistants.push(strategy)):(strategy==null&&(strategy=node.getElement().LayoutStrategyId!=null?state.getDiagram().getLayoutSettings().getLayoutStrategies().get(node.getElement().LayoutStrategyId):regular.peek()),regular.push(strategy),strategy.getSupportsAssistants()||node.SuppressAssistants()),node.getState().setEffectiveLayoutStrategy(strategy),node.getState().RequireLayoutStrategy().PreProcessThisNode(state,node),!node.getElement().IsCollapsed&&node.getChildCount()>0||node.getAssistantsRoot()!=null)},function(node){node.getState().IsHidden||(node.getIsAssistantRoot()?assistants.pop():regular.pop())})},HorizontalLayout:function(state,branchRoot){if(branchRoot.getState().IsHidden)throw new System.InvalidOperationException(System.String.format("Branch root {0} does not affect layout",branchRoot.getElement().Id));var level=state.PushLayoutLevel(branchRoot);try{(branchRoot.getLevel()===0||(branchRoot.getState().NumberOfSiblings>0||branchRoot.getAssistantsRoot()!=null)&&!branchRoot.getElement().IsCollapsed)&&branchRoot.getState().RequireLayoutStrategy().ApplyHorizontalLayout(state,level)}finally{state.PopLayoutLevel()}},VerticalLayout:function(state,branchRoot){if(branchRoot.getState().IsHidden)throw new System.InvalidOperationException(System.String.format("Branch root {0} does not affect layout",branchRoot.getElement().Id));var level=state.PushLayoutLevel(branchRoot);try{(branchRoot.getLevel()===0||(branchRoot.getState().NumberOfSiblings>0||branchRoot.getAssistantsRoot()!=null)&&!branchRoot.getElement().IsCollapsed)&&branchRoot.getState().RequireLayoutStrategy().ApplyVerticalLayout(state,level)}finally{state.PopLayoutLevel()}},RouteConnectors:function(state,visualTree){visualTree.IterateParentFirst(function(node){return node.getElement().IsCollapsed||node.getState().NumberOfSiblings===0&&node.getAssistantsRoot()==null?!1:node.getLevel()===0?!0:!node.getElement().IsSpecial||node.getIsAssistantRoot()?(node.getState().RequireLayoutStrategy().RouteConnectors(state,node),!0):!1})},MoveChildrenOnly:function(state,layoutLevel,offset){var $t,children=layoutLevel.BranchRoot.getChildren(),action,child;if(children==null||System.Array.getCount(children,OrgChart.Layout.BoxTree.Node)===0)throw new System.InvalidOperationException("Should never be invoked when children not set");for(action=function(node){return node.getState().IsHidden||(node.getState().TopLeft=node.getState().TopLeft.MoveH(offset),node.getState().BranchExterior=node.getState().BranchExterior.MoveH(offset)),!0},$t=Bridge.getEnumerator(children,OrgChart.Layout.BoxTree.Node);$t.moveNext();)child=$t.getCurrent(),child.IterateChildFirst(action);layoutLevel.Boundary.ReloadFromBranch(layoutLevel.BranchRoot);layoutLevel.BranchRoot.getState().BranchExterior=layoutLevel.Boundary.getBoundingRect()},MoveOneChild:function(state,root,offset){root.IterateChildFirst(function(node){return node.getState().IsHidden||(node.getState().TopLeft=node.getState().TopLeft.MoveH(offset),node.getState().BranchExterior=node.getState().BranchExterior.MoveH(offset)),!0})},MoveBranch:function(state,layoutLevel,offset){OrgChart.Layout.LayoutAlgorithm.MoveOneChild(state,layoutLevel.BranchRoot,offset);layoutLevel.Boundary.ReloadFromBranch(layoutLevel.BranchRoot);layoutLevel.BranchRoot.getState().BranchExterior=layoutLevel.Boundary.getBoundingRect()},AlignHorizontalCenters:function(state,level,subset){for(var $t1,center=System.Double.min,child,c,leftmost,rightmost,diff,$t=Bridge.getEnumerator(subset,OrgChart.Layout.BoxTree.Node);$t.moveNext();)child=$t.getCurrent(),c=child.getState().getCenterH(),c>center&&(center=c);for(leftmost=System.Double.max,rightmost=System.Double.min,$t1=Bridge.getEnumerator(subset,OrgChart.Layout.BoxTree.Node);$t1.moveNext();){var child1=$t1.getCurrent(),frame=child1.getState(),c1=frame.getCenterH();OrgChart.Layout.LayoutAlgorithm.IsEqual(c1,center)||(diff=center-c1,OrgChart.Layout.LayoutAlgorithm.MoveOneChild(state,child1,diff));leftmost=Math.min(leftmost,child1.getState().BranchExterior.getLeft());rightmost=Math.max(rightmost,child1.getState().BranchExterior.getRight())}return level.Boundary.ReloadFromBranch(level.BranchRoot),new OrgChart.Layout.Dimensions.$ctor1(leftmost,rightmost)},CopyExteriorFrom:function(state,other){state.TopLeft=other.TopLeft;state.Size=other.Size;state.BranchExterior=other.BranchExterior;state.SiblingsRowV=other.SiblingsRowV},IsMinValue:function(value){return value<=System.Double.min+494065645841247e-338},IsMaxValue:function(value){return value>=System.Double.max-494065645841247e-338},IsZero:function(value){return value<=494065645841247e-338&&value>=-494065645841247e-338},IsEqual:function(value,other){return Math.abs(value-other)<=494065645841247e-338},MoveTo:function(state,x,y){state.TopLeft=new OrgChart.Layout.Point.$ctor1(x,y)},AdjustSpacer:function(state,x,y,w,h){state.TopLeft=new OrgChart.Layout.Point.$ctor1(x,y);state.Size=new OrgChart.Layout.Size.$ctor1(w,h);state.BranchExterior=new OrgChart.Layout.Rect.$ctor3(x,y,w,h)}}});Bridge.ns("OrgChart.Layout.LayoutAlgorithm",$asm.$);Bridge.apply($asm.$.OrgChart.Layout.LayoutAlgorithm,{f1:function(node){return node.getState().IsHidden=node.getParentNode()!=null&&(node.getParentNode().getState().IsHidden||node.getParentNode().getElement().IsCollapsed),!0},f2:function(x){return x.getIsDataBound()},f3:function(node){return OrgChart.Layout.LayoutAlgorithm.MoveTo(node.getState(),0,0),node.getState().Size=node.getElement().Size,node.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor1(new OrgChart.Layout.Point.$ctor1(0,0),node.getElement().Size),!0}});Bridge.define("OrgChart.Layout.LayoutState",{m_layoutStack:null,m_pooledBoundaries:null,m_currentOperation:0,config:{events:{BoundaryChanged:null,OperationChanged:null},properties:{Diagram:null,BoxSizeFunc:null,LayoutOptimizerFunc:null},init:function(){this.m_layoutStack=new(System.Collections.Generic.Stack$1(OrgChart.Layout.LayoutState.LayoutLevel).ctor);this.m_pooledBoundaries=new(System.Collections.Generic.Stack$1(OrgChart.Layout.Boundary).ctor)}},ctor:function(diagram){this.$initialize();this.setDiagram(diagram)},getCurrentOperation:function(){return this.m_currentOperation},setCurrentOperation:function(value){this.m_currentOperation=value;Bridge.staticEquals(this.OperationChanged,null)?null:this.OperationChanged(this,new OrgChart.Layout.LayoutStateOperationChangedEventArgs(this))},AttachVisualTree:function(tree){while(this.m_pooledBoundaries.getCount()0){higherLevel=this.m_layoutStack.peek();switch(this.getCurrentOperation()){case OrgChart.Layout.LayoutState.Operation.VerticalLayout:higherLevel.Boundary.VerticalMergeFrom(innerLevel.Boundary);higherLevel.BranchRoot.getState().BranchExterior=higherLevel.Boundary.getBoundingRect();break;case OrgChart.Layout.LayoutState.Operation.HorizontalLayout:Bridge.referenceEquals(higherLevel.BranchRoot.getAssistantsRoot(),innerLevel.BranchRoot)||(strategy=higherLevel.BranchRoot.getState().RequireLayoutStrategy(),overlap=higherLevel.Boundary.ComputeOverlap(innerLevel.Boundary,strategy.SiblingSpacing,this.getDiagram().getLayoutSettings().getBranchSpacing()),overlap>0&&(OrgChart.Layout.LayoutAlgorithm.MoveBranch(this,innerLevel,overlap),Bridge.staticEquals(this.BoundaryChanged,null)?null:this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(innerLevel.Boundary,innerLevel,this))));higherLevel.Boundary.MergeFrom(innerLevel.Boundary);higherLevel.BranchRoot.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor3(higherLevel.Boundary.getBoundingRect().getLeft(),higherLevel.BranchRoot.getState().BranchExterior.getTop(),higherLevel.Boundary.getBoundingRect().Size.Width,higherLevel.BranchRoot.getState().BranchExterior.Size.Height);break;default:throw new System.InvalidOperationException("This operation can only be invoked when performing vertical or horizontal layouts");}Bridge.staticEquals(this.BoundaryChanged,null)?null:this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(higherLevel.Boundary,higherLevel,this))}this.m_pooledBoundaries.push(innerLevel.Boundary)}});Bridge.define("OrgChart.Layout.LayoutState.LayoutLevel",{BranchRoot:null,Boundary:null,ctor:function(node,boundary){this.$initialize();this.BranchRoot=node;this.Boundary=boundary}});Bridge.define("OrgChart.Layout.LayoutState.Operation",{$kind:"enum",statics:{Idle:0,Preparing:1,PreprocessVisualTree:2,VerticalLayout:3,HorizontalLayout:4,ConnectorsLayout:5,Completed:6}});Bridge.define("OrgChart.Layout.LayoutStateOperationChangedEventArgs",{State:null,ctor:function(state){this.$initialize();this.State=state}});Bridge.define("OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.GroupIterator",{m_numberOfSiblings:0,m_numberOfGroups:0,Group:0,FromIndex:0,Count:0,MaxOnLeft:0,ctor:function(numberOfSiblings,numberOfGroups){this.$initialize();this.m_numberOfSiblings=numberOfSiblings;this.m_numberOfGroups=numberOfGroups},CountInGroup:function(){for(var countInRow=this.m_numberOfGroups*2|0,result=0,countToThisGroup=(this.Group*2|0)+2|0,firstInRow=0,countInThisRow;;){if(countInThisRow=firstInRow>=(this.m_numberOfSiblings-countInRow|0)?this.m_numberOfSiblings-firstInRow|0:countInRow,countInThisRow>=countToThisGroup)result=result+2|0;else{countToThisGroup=countToThisGroup-1|0;countInThisRow>=countToThisGroup&&(result=result+1|0);break}firstInRow=firstInRow+countInRow|0}return result},NextGroup:function(){return this.FromIndex=this.FromIndex+this.Count|0,this.FromIndex>0&&(this.Group=this.Group+1|0),this.Count=this.CountInGroup(),this.MaxOnLeft=(Bridge.Int.div(this.Count,2)|0)+this.Count%2|0,this.Count!==0}});Bridge.define("OrgChart.Layout.NodeLayoutInfo",{IsHidden:!1,NumberOfSiblings:0,NumberOfSiblingRows:0,NumberOfSiblingColumns:0,Connector:null,m_effectiveLayoutStrategy:null,config:{init:function(){this.TopLeft=new OrgChart.Layout.Point;this.Size=new OrgChart.Layout.Size;this.BranchExterior=new OrgChart.Layout.Rect;this.SiblingsRowV=new OrgChart.Layout.Dimensions}},setEffectiveLayoutStrategy:function(value){this.m_effectiveLayoutStrategy=value},getLeft:function(){return this.TopLeft.X},getRight:function(){return this.TopLeft.X+this.Size.Width},getTop:function(){return this.TopLeft.Y},getBottom:function(){return this.TopLeft.Y+this.Size.Height},getCenterH:function(){return this.TopLeft.X+this.Size.Width/2},getCenterV:function(){return this.TopLeft.Y+this.Size.Height/2},RequireLayoutStrategy:function(){if(this.m_effectiveLayoutStrategy==null)throw new System.Exception("effectiveLayoutStrategy is not set");return this.m_effectiveLayoutStrategy}});Bridge.define("OrgChart.Layout.Point",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Point}},X:0,Y:0,$ctor1:function(x,y){this.$initialize();this.X=x;this.Y=y},ctor:function(){this.$initialize()},MoveH:function(offsetX){return new OrgChart.Layout.Point.$ctor1(this.X+offsetX,this.Y)},getHashCode:function(){return Bridge.addHash([1852403652,this.X,this.Y])},equals:function(o){return Bridge.is(o,OrgChart.Layout.Point)?Bridge.equals(this.X,o.X)&&Bridge.equals(this.Y,o.Y):!1},$clone:function(to){var s=to||new OrgChart.Layout.Point;return s.X=this.X,s.Y=this.Y,s}});Bridge.define("OrgChart.Layout.Rect",{$kind:"struct",statics:{op_Addition:function(x,y){var left=Math.min(x.getLeft(),y.getLeft()),top=Math.min(x.getTop(),y.getTop()),right=Math.max(x.getRight(),y.getRight()),bottom=Math.max(x.getBottom(),y.getBottom());return new OrgChart.Layout.Rect.$ctor3(left,top,right-left,bottom-top)},getDefaultValue:function(){return new OrgChart.Layout.Rect}},config:{init:function(){this.TopLeft=new OrgChart.Layout.Point;this.Size=new OrgChart.Layout.Size}},$ctor3:function(x,y,w,h){if(this.$initialize(),w<0)throw new System.ArgumentOutOfRangeException("w");if(h<0)throw new System.ArgumentOutOfRangeException("h");this.TopLeft=new OrgChart.Layout.Point.$ctor1(x,y);this.Size=new OrgChart.Layout.Size.$ctor1(w,h)},$ctor1:function(topLeft,size){this.$initialize();this.TopLeft=topLeft;this.Size=size},$ctor2:function(size){this.$initialize();this.TopLeft=new OrgChart.Layout.Point.$ctor1(0,0);this.Size=size},ctor:function(){this.$initialize()},getBottomRight:function(){return new OrgChart.Layout.Point.$ctor1(this.TopLeft.X+this.Size.Width,this.TopLeft.Y+this.Size.Height)},getLeft:function(){return this.TopLeft.X},getRight:function(){return this.TopLeft.X+this.Size.Width},getCenterH:function(){return this.TopLeft.X+this.Size.Width/2},getCenterV:function(){return this.TopLeft.Y+this.Size.Height/2},getTop:function(){return this.TopLeft.Y},getBottom:function(){return this.TopLeft.Y+this.Size.Height},MoveH:function(offsetX){return new OrgChart.Layout.Rect.$ctor1(new OrgChart.Layout.Point.$ctor1(this.getLeft()+offsetX,this.getTop()),this.Size)},getHashCode:function(){return Bridge.addHash([1952671058,this.TopLeft,this.Size])},equals:function(o){return Bridge.is(o,OrgChart.Layout.Rect)?Bridge.equals(this.TopLeft,o.TopLeft)&&Bridge.equals(this.Size,o.Size):!1},$clone:function(to){var s=to||new OrgChart.Layout.Rect;return s.TopLeft=this.TopLeft,s.Size=this.Size,s}});Bridge.define("OrgChart.Layout.Size",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Size}},Width:0,Height:0,$ctor1:function(w,h){this.$initialize();this.Width=w;this.Height=h},ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([1702521171,this.Width,this.Height])},equals:function(o){return Bridge.is(o,OrgChart.Layout.Size)?Bridge.equals(this.Width,o.Width)&&Bridge.equals(this.Height,o.Height):!1},$clone:function(to){var s=to||new OrgChart.Layout.Size;return s.Width=this.Width,s.Height=this.Height,s}});Bridge.define("OrgChart.Layout.StackOrientation",{$kind:"enum",statics:{InvalidValue:0,SingleRowHorizontal:1,SingleColumnVertical:2}});Bridge.define("OrgChart.Test.TestDataGen",{statics:{GenerateBoxSizes:function(boxContainer){var $t,seed=0,random,box;for(System.Diagnostics.Debug.writeln(seed.toString()),random=new System.Random.$ctor1(seed),$t=Bridge.getEnumerator(boxContainer.getBoxesById().System$Collections$Generic$IDictionary$2$System$Int32$OrgChart$Layout$Box$getValues(),OrgChart.Layout.Box);$t.moveNext();)box=$t.getCurrent(),box.IsSpecial||(box.Size=new OrgChart.Layout.Size.$ctor1(50+random.next$1(50)|0,50+random.next$1(50)|0))}},GenerateDataItems:function(dataSource,count,percentAssistants){for(var item,$t=Bridge.getEnumerator(this.GenerateRandomDataItems(count,percentAssistants));$t.moveNext();)item=$t.getCurrent(),dataSource.Items.add(item.getId(),item)},GenerateRandomDataItems:function(itemCount,percentAssistants){var random,items,i,firstInLayer,prevLayerSize,layerSize,i1,parentIndex,i2,assistantCount,i3;if(itemCount<0)throw new System.ArgumentOutOfRangeException("itemCount","Count must be zero or positive",null,itemCount);for(random=new System.Random.$ctor1(0),items=new(System.Collections.Generic.List$1(OrgChart.Test.TestDataItem))(itemCount),i=0;i0)for(assistantCount=Math.min(items.getCount(),Bridge.Int.clip32(Math.ceil((items.getCount()*percentAssistants|0)/100))),i3=0;i30){node.getState().NumberOfSiblingColumns=1;node.getState().NumberOfSiblingRows=Bridge.Int.div(node.getState().NumberOfSiblings,2)|0;node.getState().NumberOfSiblings%2!=0&&(node.getState().NumberOfSiblingRows=node.getState().NumberOfSiblingRows+1|0);var spacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1);node.AddRegularChild(spacer)}},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,prevRowBottom,maxOnLeft,i,rowExterior,i2,child2,frame2;if(node.getLevel()===0)throw new System.InvalidOperationException("Should never be invoked on root node");for(prevRowBottom=node.getState().SiblingsRowV.To,maxOnLeft=this.MaxOnLeft(node),i=0;iframe.getBottom()?OrgChart.Layout.LayoutAlgorithm.MoveTo(frame,frame.getLeft(),frame2.getCenterV()-frame.Size.Height/2):frame2.getBottom()0&&node.getState().NumberOfSiblings>0&&(carrier=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter=node.getState().getCenterH(),diff=desiredCenter-carrier,OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff))},RouteConnectors:function(state,node){var count=node.getState().NumberOfSiblings,i,to,y;if(count!==0){this.NeedCarrierProtector(node)&&(count=count+1|0);var segments=System.Array.init(count,function(){return new OrgChart.Layout.Edge}),ix=0,maxOnLeft=this.MaxOnLeft(node),carrier=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node).getState(),from=carrier.getCenterH(),isLeft=!0,countOnThisSide=0,bottomMost=System.Double.min;for(i=0;i0&&(node.getState().NumberOfSiblings=node.getElement().IsCollapsed?0:node.getChildCount(),node.getElement().IsCollapsed||(verticalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(verticalSpacer),horizontalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(horizontalSpacer)))},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,siblingsRowExterior,top,i,child,rect,i1,child1;if(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getAssistantsRoot()!=null&&(OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(node.getAssistantsRoot().getState(),node.getState()),OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,node.getAssistantsRoot())),node.getState().NumberOfSiblings!==0){for(siblingsRowExterior=OrgChart.Layout.Dimensions.MinMax(),top=node.getAssistantsRoot()==null?node.getState().SiblingsRowV.To+this.ParentChildSpacing:node.getState().BranchExterior.getBottom()+this.ParentChildSpacing,i=0;i0&&node.getChildCount()>0){var rect=node.getState(),leftmost=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),rightmost=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter=node.getState().NumberOfSiblings===1||this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Center?leftmost+(rightmost-leftmost)/2:this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Left?leftmost+this.ChildConnectorHookLength:rightmost-this.ChildConnectorHookLength,center=rect.getCenterH(),diff=center-desiredCenter;OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff);verticalSpacer=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node);OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(verticalSpacer.getState(),center-this.ParentConnectorShield/2,rect.getBottom(),this.ParentConnectorShield,System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rect.getBottom());state.MergeSpacer(verticalSpacer);firstInRow=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState();horizontalSpacer=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings+1|0,OrgChart.Layout.BoxTree.Node);OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(horizontalSpacer.getState(),firstInRow.getLeft(),firstInRow.SiblingsRowV.From-this.ParentChildSpacing,System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().getRight()-firstInRow.getLeft(),this.ParentChildSpacing);state.MergeSpacer(horizontalSpacer)}},RouteConnectors:function(state,node){var normalChildCount=node.getState().NumberOfSiblings,count=normalChildCount===0?0:normalChildCount===1?1:2+normalChildCount|0,space,i,childRect,childCenter;if(count===0){node.getState().Connector=null;return}var segments=System.Array.init(count,function(){return new OrgChart.Layout.Edge}),rootRect=node.getState(),center=rootRect.getCenterH();if(node.getChildren()==null)throw new System.Exception("State is present, but children not set");if(count===1)segments[0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()),new OrgChart.Layout.Point.$ctor1(center,System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getTop()));else{for(space=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rootRect.getBottom(),segments[0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()),new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()+space-this.ChildConnectorHookLength)),i=0;iframe.getBottom()?OrgChart.Layout.LayoutAlgorithm.MoveTo(frame,frame.getLeft(),frame2.getCenterV()-frame.Size.Height/2):frame2.getBottom()0&&node.getLevel()>0){node.getState().NumberOfSiblingColumns=1;node.getState().NumberOfSiblingRows=node.getChildCount();var verticalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1);node.AddRegularChild(verticalSpacer)}},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,prevRowExterior,row,rowExterior,childBranchBottom;for(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getAssistantsRoot()!=null&&(OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(node.getAssistantsRoot().getState(),node.getState()),OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,node.getAssistantsRoot())),prevRowExterior=new OrgChart.Layout.Dimensions.$ctor1(node.getState().SiblingsRowV.From,node.getAssistantsRoot()==null?node.getState().SiblingsRowV.To:node.getState().BranchExterior.getBottom()),row=0;row0&&node.getChildCount()>0){if(rect=node.getState(),this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Left)desiredLeft=rect.getCenterH()+this.ParentConnectorShield/2,diff=desiredLeft-edges.From;else if(this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Right)desiredRight=rect.getCenterH()-this.ParentConnectorShield/2,diff=desiredRight-edges.To;else throw new System.InvalidOperationException("Invalid ParentAlignment setting");OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff);verticalSpacer=node.getLevel()>0?System.Array.getItem(node.getChildren(),node.getChildCount()-1|0,OrgChart.Layout.BoxTree.Node):null;verticalSpacer!=null&&(spacerTop=node.getState().getBottom(),spacerBottom=System.Array.getItem(node.getChildren(),node.getChildCount()-2|0,OrgChart.Layout.BoxTree.Node).getState().getBottom(),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(verticalSpacer.getState(),rect.getCenterH()-this.ParentConnectorShield/2,spacerTop,this.ParentConnectorShield,spacerBottom-spacerTop),state.MergeSpacer(verticalSpacer))}},EnumerateColumn:function(branchRoot){for(var $yield=[],i=0;i0&&this.Orientation!==OrgChart.Layout.StackOrientation.SingleRowHorizontal&&this.Orientation!==OrgChart.Layout.StackOrientation.SingleColumnVertical)throw new System.InvalidOperationException("Unsupported value for orientation: "+System.Enum.toString(OrgChart.Layout.StackOrientation,this.Orientation));},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,siblingsRowExterior,top,i,child,rect,i1,child1,prevRowExterior,row,rowExterior,childBranchBottom;if(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getState().NumberOfSiblings!==0)if(siblingsRowExterior=OrgChart.Layout.Dimensions.MinMax(),this.Orientation===OrgChart.Layout.StackOrientation.SingleRowHorizontal){for(top=node.getAssistantsRoot()==null?node.getState().SiblingsRowV.To+this.ParentChildSpacing:node.getState().BranchExterior.getBottom()+this.ParentChildSpacing,i=0;i0)if(this.Orientation===OrgChart.Layout.StackOrientation.SingleRowHorizontal){width=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().getRight()-System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getLeft();node.getState().Size=new OrgChart.Layout.Size.$ctor1(Math.max(node.getState().Size.Width,width),node.getState().Size.Height);var center=(System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getLeft()+System.Array.getItem(node.getChildren(),node.getChildCount()-1|0,OrgChart.Layout.BoxTree.Node).getState().getRight())/2,desiredCenter=node.getState().getCenterH(),diff=desiredCenter-center;OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff)}else if(this.Orientation===OrgChart.Layout.StackOrientation.SingleColumnVertical){OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(state,level,node.getChildren());var center1=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter1=node.getState().getCenterH(),diff1=desiredCenter1-center1;OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff1)}},RouteConnectors:function(){}});Bridge.define("OrgChart.Test.TestDataItem",{inherits:[OrgChart.Layout.IChartDataItem],config:{properties:{Id:null,IsAssistant:!1,ParentId:null,String1:null,String2:null,Date1:null},alias:["getId","OrgChart$Layout$IChartDataItem$getId","setId","OrgChart$Layout$IChartDataItem$setId","getIsAssistant","OrgChart$Layout$IChartDataItem$getIsAssistant","setIsAssistant","OrgChart$Layout$IChartDataItem$setIsAssistant"],init:function(){this.Date1=new Date(-864e13)}}});Bridge.define("OrgChart.Test.TestDataSource",{inherits:[OrgChart.Layout.IChartDataSource],Items:null,config:{alias:["getAllDataItemIds","OrgChart$Layout$IChartDataSource$getAllDataItemIds","getGetParentKeyFunc","OrgChart$Layout$IChartDataSource$getGetParentKeyFunc","getGetDataItemFunc","OrgChart$Layout$IChartDataSource$getGetDataItemFunc"],init:function(){this.Items=new(System.Collections.Generic.Dictionary$2(String,OrgChart.Test.TestDataItem))}},getAllDataItemIds:function(){return System.Linq.Enumerable.from(this.Items.getKeys()).orderBy($asm.$.OrgChart.Test.TestDataSource.f1)},getGetParentKeyFunc:function(){return Bridge.fn.bind(this,this.GetParentKey)},getGetDataItemFunc:function(){return Bridge.fn.bind(this,this.GetDataItem)},GetParentKey:function(itemId){return this.Items.get(itemId).getParentId()},GetDataItem:function(itemId){return this.Items.get(itemId)}});Bridge.ns("OrgChart.Test.TestDataSource",$asm.$);Bridge.apply($asm.$.OrgChart.Test.TestDataSource,{f1:function(x){return x}});Bridge.define("OrgChart.Layout.MultiLineFishboneLayoutStrategy",{inherits:[OrgChart.Layout.LinearLayoutStrategy],MaxGroups:4,getSupportsAssistants:function(){return!0},PreProcessThisNode:function(state,node){var parentSpacer,i,verticalSpacer,horizontalSpacer;if(this.MaxGroups<=0)throw new System.InvalidOperationException("MaxGroups must be a positive value");if(node.getChildCount()<=(this.MaxGroups*2|0)){OrgChart.Layout.LinearLayoutStrategy.prototype.PreProcessThisNode.call(this,state,node);return}if(node.getState().NumberOfSiblings=node.getChildCount(),node.getState().NumberOfSiblings>0){for(node.getState().NumberOfSiblingColumns=this.MaxGroups,node.getState().NumberOfSiblingRows=Bridge.Int.div(node.getState().NumberOfSiblings,this.MaxGroups*2|0)|0,node.getState().NumberOfSiblings%(this.MaxGroups*2|0)!=0&&(node.getState().NumberOfSiblingRows=node.getState().NumberOfSiblingRows+1|0),parentSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(parentSpacer),i=0;i1&&(horizontalSpacer=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,node.getElement().Id,!1),node.AddRegularChild(horizontalSpacer))}},ApplyVerticalLayout:function(state,level){var node=level.BranchRoot,adapter;if(node.getState().NumberOfSiblings<=(this.MaxGroups*2|0)){OrgChart.Layout.LinearLayoutStrategy.prototype.ApplyVerticalLayout.call(this,state,level);return}for(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getAssistantsRoot()!=null&&(OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(node.getAssistantsRoot().getState(),node.getState()),OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,node.getAssistantsRoot())),adapter=new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter(node);adapter.NextGroup();)OrgChart.Layout.LayoutAlgorithm.VerticalLayout(state,adapter.SpecialRoot)},ApplyHorizontalLayout:function(state,level){var node=level.BranchRoot,adapter,rect,diff,carrier,desiredCenter1,ix,verticalSpacer;if(node.getState().NumberOfSiblings<=(this.MaxGroups*2|0)){OrgChart.Layout.LinearLayoutStrategy.prototype.ApplyHorizontalLayout.call(this,state,level);return}for(node.getLevel()===0&&(node.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(node.getState().getTop(),node.getState().getBottom())),node.getAssistantsRoot()!=null&&OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,node.getAssistantsRoot()),adapter=new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter(node);adapter.NextGroup();)OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,adapter.SpecialRoot);if(rect=node.getState(),node.getLevel()>0){if(node.getState().NumberOfSiblingColumns>1){var leftCarrier=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings+1|0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),rightCarrier=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings+node.getState().NumberOfSiblingColumns|0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter=node.getState().NumberOfSiblings===1||this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Center?leftCarrier+(rightCarrier-leftCarrier)/2:this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Left?leftCarrier+this.ChildConnectorHookLength:rightCarrier-this.ChildConnectorHookLength;diff=rect.getCenterH()-desiredCenter}else carrier=System.Array.getItem(node.getChildren(),1+node.getState().NumberOfSiblings|0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),desiredCenter1=rect.getCenterH(),diff=desiredCenter1-carrier;OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff)}if(node.getLevel()>0&&(ix=node.getState().NumberOfSiblings,verticalSpacer=System.Array.getItem(node.getChildren(),ix,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(verticalSpacer.getState(),rect.getCenterH()-this.ParentConnectorShield/2,rect.getBottom(),this.ParentConnectorShield,System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rect.getBottom()),state.MergeSpacer(verticalSpacer),ix=ix+1|0,ix=ix+node.getState().NumberOfSiblingColumns|0,node.getState().NumberOfSiblingColumns>1)){var horizontalSpacer=System.Array.getItem(node.getChildren(),ix,OrgChart.Layout.BoxTree.Node),leftmost=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings+1|0,OrgChart.Layout.BoxTree.Node).getState().TopLeft,rightmost=System.Array.getItem(node.getChildren(),ix-1|0,OrgChart.Layout.BoxTree.Node).getState().getRight();OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(horizontalSpacer.getState(),leftmost.X,leftmost.Y-this.ParentChildSpacing,rightmost-leftmost.X,this.ParentChildSpacing);state.MergeSpacer(horizontalSpacer)}},RouteConnectors:function(state,node){var count,iterator,i,to,y,leftGroup,rightGroup;if(node.getState().NumberOfSiblings<=(this.MaxGroups*2|0)){OrgChart.Layout.LinearLayoutStrategy.prototype.RouteConnectors.call(this,state,node);return}count=(1+node.getState().NumberOfSiblings|0)+node.getState().NumberOfSiblingColumns|0;node.getState().NumberOfSiblingColumns>1&&(count=count+1|0);var segments=System.Array.init(count,function(){return new OrgChart.Layout.Edge}),rootRect=node.getState(),center=rootRect.getCenterH(),ix=0,space=System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rootRect.getBottom();for(segments[Bridge.identity(ix,ix=ix+1|0)]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()),new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()+space-this.ChildConnectorHookLength)),iterator=new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.GroupIterator(node.getState().NumberOfSiblings,node.getState().NumberOfSiblingColumns);iterator.NextGroup();){var carrier=System.Array.getItem(node.getChildren(),(1+node.getState().NumberOfSiblings|0)+iterator.Group|0,OrgChart.Layout.BoxTree.Node).getState(),from=carrier.getCenterH(),isLeft=!0,countOnThisSide=0;for(i=iterator.FromIndex;i<(iterator.FromIndex+iterator.Count|0);i=i+1|0)to=isLeft?System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getRight():System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getLeft(),y=System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getCenterV(),segments[Bridge.identity(ix,ix=ix+1|0)]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(from,y),new OrgChart.Layout.Point.$ctor1(to,y)),(countOnThisSide=countOnThisSide+1|0)===iterator.MaxOnLeft&&(countOnThisSide=0,isLeft&&(segments[(1+node.getState().NumberOfSiblings|0)+iterator.Group|0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(carrier.getCenterH(),carrier.getTop()-this.ChildConnectorHookLength),new OrgChart.Layout.Point.$ctor1(carrier.getCenterH(),System.Array.getItem(node.getChildren(),i,OrgChart.Layout.BoxTree.Node).getState().getCenterV()))),isLeft=!isLeft)}ix=ix+node.getState().NumberOfSiblingColumns|0;node.getState().NumberOfSiblingColumns>1&&(leftGroup=System.Array.getItem(node.getChildren(),1+node.getState().NumberOfSiblings|0,OrgChart.Layout.BoxTree.Node).getState(),rightGroup=System.Array.getItem(node.getChildren(),((1+node.getState().NumberOfSiblings|0)+node.getState().NumberOfSiblingColumns|0)-1|0,OrgChart.Layout.BoxTree.Node).getState(),segments[ix]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(leftGroup.getCenterH(),leftGroup.getTop()-this.ChildConnectorHookLength),new OrgChart.Layout.Point.$ctor1(rightGroup.getCenterH(),rightGroup.getTop()-this.ChildConnectorHookLength)));node.getState().Connector=new OrgChart.Layout.Connector(segments)}});Bridge.define("OrgChart.Layout.MultiLineHangerLayoutStrategy",{inherits:[OrgChart.Layout.LinearLayoutStrategy],MaxSiblingsPerRow:4,getSupportsAssistants:function(){return!0},PreProcessThisNode:function(state,node){var lastRowBoxCount,ix,siblingSpacer,verticalSpacer,i,horizontalSpacer;if(this.MaxSiblingsPerRow<=0||this.MaxSiblingsPerRow%2!=0)throw new System.InvalidOperationException("MaxSiblingsPerRow must be a positive even value");if(node.getChildCount()<=this.MaxSiblingsPerRow){OrgChart.Layout.LinearLayoutStrategy.prototype.PreProcessThisNode.call(this,state,node);return}if(node.getState().NumberOfSiblings=node.getChildCount(),node.getState().NumberOfSiblings>0){for(lastRowBoxCount=node.getChildCount()%this.MaxSiblingsPerRow,node.getState().NumberOfSiblingColumns=1+this.MaxSiblingsPerRow|0,node.getState().NumberOfSiblingRows=Bridge.Int.div(node.getChildCount(),this.MaxSiblingsPerRow)|0,lastRowBoxCount!==0&&(node.getState().NumberOfSiblingRows=node.getState().NumberOfSiblingRows+1|0),node.getState().NumberOfSiblings=node.getChildCount()+node.getState().NumberOfSiblingRows|0,lastRowBoxCount>0&&lastRowBoxCount<=(Bridge.Int.div(this.MaxSiblingsPerRow,2)|0)&&(node.getState().NumberOfSiblings=node.getState().NumberOfSiblings-1|0),ix=Bridge.Int.div(this.MaxSiblingsPerRow,2)|0;ix=node.getState().NumberOfSiblings)break;child=System.Array.getItem(node.getChildren(),ix,OrgChart.Layout.BoxTree.Node);OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(state,child)}OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(state,level,this.EnumerateColumn(node,col))}var rect=node.getState(),spacer=System.Array.getItem(node.getChildren(),Bridge.Int.div(node.getState().NumberOfSiblingColumns,2)|0,OrgChart.Layout.BoxTree.Node),desiredCenter=spacer.getState().getCenterH(),diff=rect.getCenterH()-desiredCenter;for(OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(state,level,diff),verticalSpacer=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(verticalSpacer.getState(),rect.getCenterH()-this.ParentConnectorShield/2,rect.getBottom(),this.ParentConnectorShield,System.Array.getItem(node.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-rect.getBottom()),state.MergeSpacer(verticalSpacer),spacing=this.ParentChildSpacing,firstInRowIndex=0;firstInRowIndex=verticalSpacer.getState().getRight()?lastInRow.getRight()-firstInRow.getLeft():verticalSpacer.getState().getRight()-firstInRow.getLeft();OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(horizontalSpacer.getState(),firstInRow.getLeft(),firstInRow.SiblingsRowV.From-spacing,width,spacing);state.MergeSpacer(horizontalSpacer);spacing=this.SiblingSpacing}},EnumerateColumn:function(branchRoot,col){for(var ix,$yield=[],row=0;row=branchRoot.getState().NumberOfSiblings)break;$yield.push(System.Array.getItem(branchRoot.getChildren(),ix,OrgChart.Layout.BoxTree.Node))}return System.Array.toEnumerable($yield)},RouteConnectors:function(state,node){var $t,count,child,ix,i,child1,childRect,childCenter,lastChildHookIndex,firstInRowIndex,firstInRow,lastInRow;if(node.getState().NumberOfSiblings<=this.MaxSiblingsPerRow){OrgChart.Layout.LinearLayoutStrategy.prototype.RouteConnectors.call(this,state,node);return}for(count=1+node.getState().NumberOfSiblingRows|0,$t=Bridge.getEnumerator(node.getChildren(),OrgChart.Layout.BoxTree.Node);$t.moveNext();)child=$t.getCurrent(),child.getElement().IsSpecial||(count=count+1|0);var segments=System.Array.init(count,function(){return new OrgChart.Layout.Edge}),rootRect=node.getState(),center=rootRect.getCenterH(),verticalCarrierHeight=System.Array.getItem(node.getChildren(),node.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-this.ChildConnectorHookLength-rootRect.getBottom();for(segments[0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()),new OrgChart.Layout.Point.$ctor1(center,rootRect.getBottom()+verticalCarrierHeight)),ix=1,i=0;i=a)return"vstack";for(var h=0,d=0;d=h?4>=a?"vstack":8>=a?"fishbone1":"fishbone2":"hanger4"},boxSizeFunc:function(b){b=RPOrgChart.diagram.getBoxes().getBoxesByDataId().getItem(b).Id;return RPOrgChart.diagram.getBoxes().getBoxesById().getItem(b).Size},getBoxElementSize:function(b){b=RPOrgChart.graph.model.cells[b].geometry; return new OrgChart.Layout.Size.$ctor1(b.width,b.height)},positionBoxes:function(){var b=RPOrgChart.diagram,a=new OrgChart.Layout.LayoutState(b);a.addOperationChanged(RPOrgChart.onLayoutStateChanged);a.BoxSizeFunc=Bridge.fn.bind(this,RPOrgChart.boxSizeFunc,null,!0);a.LayoutOptimizerFunc=Bridge.fn.bind(this,RPOrgChart.getBranchOptimizerFunc(),null,!0);OrgChart.Layout.LayoutAlgorithm.Apply(a);a=OrgChart.Layout.LayoutAlgorithm.ComputeBranchVisualBoundingRect(b.getVisualTree());var h=-a.getLeft()+a.getTop(), d=RPOrgChart.graph,x=d.model.cells,u=[];b.getVisualTree().IterateParentFirst(function(f){if(f.State.IsHidden)return!1;var B=f.Element;if(B.getIsDataBound()){B=x[B.DataId];var C=B.geometry.clone();C.x=f.State.TopLeft.X+h;C.y=f.State.TopLeft.Y;d.model.setGeometry(B,C)}return!0});b.getVisualTree().IterateParentFirst(function(f){var B=RPOrgChart.correctY?Math.min(0,-(RPOrgChart.parentChildSpacing/2)+5):0;if(null!=f.State.Connector){var C=function(l,m){for(var v=l.geometry.clone(),D=0;m&&D=l.x&&m.x<=l.x+l.width&&m.y>=l.y&&m.y<=l.y+l.height},n=x[f.Element.DataId],k=d.getOutgoingEdges(n);k={};for(var r=0;rA||t==A&&p>z){var e=c.From;c.From=c.To;c.To=e}}for(r=0;r=F&&E<=p&&w>=p?(w=new mxPoint(p,F),u.push(w),w.mark=c.mark|g.mark,g=k[p+","+F],null!=g?g.mark|=w.mark:k[p+","+F]=w):t==A&&p<=E&&z>=E&&F<=t&&J>=t&&(w=new mxPoint(E,t),u.push(w),w.mark=c.mark|g.mark,g=k[E+","+t],null!=g?g.mark|=w.mark:k[E+","+t]=w)}}var y=[],q;for(q in k)y.push(k[q]);y.sort(function(l,m){var v=l.y-m.y;return 0==v?l.x-m.x:v});k=d.getOutgoingEdges(n);if(2==y.length&&1==k.length)C(k[0],y);else{f=function(l){for(var m=0;mc;)if(c++,p=f(r),null==p)n.pop(),r=n[n.length-1];else if(n.push(p),r=p,I(q,p))break;if(2c&&n[q].x