@datagrok/curves 1.2.11 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.js CHANGED
@@ -1,2 +1,2 @@
1
- var curves;(()=>{var __webpack_modules__={78:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";function copyInto(e,t){for(var n=0;n<t.length;n++)e[n]=t[n]}function limitedMemoryBFGS(e,t){var n=+new Date,r=t.length,o=numeric.rep([r],0);e.getGradient(t,o);var i=numeric.clone(o),a=numeric.clone(t),u=numeric.clone(o);numeric.diveq(u,numeric.norm2(u));var s=[],c=[],l=[],f=(backtrackingLineSearch(e,u,o,t),e.getValue(t));o=e.getGradient(t,o);for(var m=f,h=0;h<100;h++){var d;if(new Date,s.length<4)s.unshift(numeric.sub(t,a)),c.unshift(numeric.sub(o,i));else{for(var p=s.pop(),g=c.pop(),v=0;v<r;v++)p[v]=t[v]-a[v],g[v]=o[v]-i[v];s.unshift(p),c.unshift(g)}copyInto(a,t),copyInto(i,o);var y=0,A=0;for(v=0;v<r;v++)y+=s[0][v]*c[0][v],A+=c[0][v]*c[0][v];var x=y/A;l.unshift(1/y),copyInto(u,o);for(var w=[],b=0;b<s.length;b++){var C=0;for(v=0;v<r;v++)C+=s[b][v]*u[v];for(C*=l[b],w.push(C),v=0;v<r;v++)u[v]+=c[b][v]*-C}for(v=0;v<r;v++)u[v]*=x;for(b=s.length-1;b>=0;b--){var T=0;for(v=0;v<r;v++)T+=c[b][v]*u[v];for(T*=l[b],C=w[b],v=0;v<r;v++)u[v]+=s[b][v]*(C-T)}for(v=0;v<r;v++)u[v]=-u[v];if(backtrackingLineSearch(e,u,o,t),f=e.getValue(t),o=e.getGradient(t,o),2*(f-m)<=1e-4*(Math.abs(f)+Math.abs(m)+1e-5))return d=+new Date,!0;var _=numeric.norm2(o);if(_<.001)return d=+new Date,!0;if(0==_)return d=+new Date,!0;m=f}return d=+new Date,console.log("Finished iterations "+(d-n)),!0}function backtrackingLineSearch(e,t,n,r){var o=r.length,i=0,a=1,u=0,s=e.getValue(r),c=s,l=numeric.norm2(t);l>100&&numeric.muleq(t,100/l);for(var f=0,m=0;m<o;m++)f+=n[m]*t[m];var h=0;for(m=0;m<o;m++){var d=Math.abs(t[m]/Math.max(Math.abs(r[m]),1));d>h&&(h=d)}for(var p=1e-4/h,g=0;g<25;g++){for(m=0;m<o;m++)r[m]+=(a-i)*t[m];if(a<p)return 0;var v=e.getValue(r);if(v>=s+1e-4*a*f)return a;if(isFinite(v))if(1==a)u=-f/(2*(v-s-f));else{var y=v-s-a*f,A=c-s-i*f,x=1/(a*a),w=1/(i*i),b=1/(a-i),C=b*(y*x-A*w),T=b*(-y*i*x+A*a*w);if(0==C)u=-f/(2*T);else{var _=T*T-3*C*f;u=_<0?.5*a:T<=0?(-T+Math.sqrt(_))/(3*C):-f/(T+Math.sqrt(_))}u>.5*a&&(u=.5*a)}else u=.2*a;c=v,i=a,a=Math.max(u,.1*a)}}__webpack_require__.d(__webpack_exports__,{U:()=>limitedMemoryBFGS});var quadratic={getValue:function(e){var t=e[0],n=e[1];return-3*t*t-4*n*n+2*t-4*n+18},getGradient:function(e,t){return t[0]=-6*e[0]+2,t[1]=-8*e[1]-4,t}};function doubleExp(e){for(var t=Array(e),n=0;n<e;n++)t[n]=Math.log(Math.random())*(Math.random()>.5?1:-1);return t}var ridgeRegression={covariates:[],responses:[],originalParameters:doubleExp(100),sample:function(e,t){for(var n=0;n<e;n++){var r=doubleExp(100);this.responses.push(numeric.dot(r,this.originalParameters)+t()),this.covariates.push(r)}},getValue:function(e){for(var t=0,n=0;n<this.covariates.length;n++){var r=this.responses[n]-numeric.dot(this.covariates[n],e);t+=-.5*r*r}return t},getGradient:function(e,t){for(var n=0;n<this.covariates.length;n++){var r=this.responses[n]-numeric.dot(this.covariates[n],e);numeric.addeq(t,numeric.mul(this.covariates[n],r))}return t}},numeric="undefined"==typeof exports?function(){}:exports;void 0!==__webpack_require__.g&&(__webpack_require__.g.numeric=numeric),numeric.version="1.2.6",numeric.bench=function(e,t){var n,r,o;for(void 0===t&&(t=15),r=.5,n=new Date;;){for(o=r*=2;o>3;o-=4)e(),e(),e(),e();for(;o>0;)e(),o--;if(new Date-n>t)break}for(o=r;o>3;o-=4)e(),e(),e(),e();for(;o>0;)e(),o--;return 1e3*(3*r-1)/(new Date-n)},numeric._myIndexOf=function(e){var t,n=this.length;for(t=0;t<n;++t)if(this[t]===e)return t;return-1},numeric.myIndexOf=Array.prototype.indexOf?Array.prototype.indexOf:numeric._myIndexOf,numeric.Function=Function,numeric.precision=4,numeric.largeArray=50,numeric.prettyPrint=function(e){function t(e){if(0===e)return"0";if(isNaN(e))return"NaN";if(e<0)return"-"+t(-e);if(isFinite(e)){var n=Math.floor(Math.log(e)/Math.log(10)),r=e/Math.pow(10,n),o=r.toPrecision(numeric.precision);return 10===parseFloat(o)&&(n++,o=(r=1).toPrecision(numeric.precision)),parseFloat(o).toString()+"e"+n.toString()}return"Infinity"}var n=[];return function e(r){var o;if(void 0===r)return n.push(Array(numeric.precision+8).join(" ")),!1;if("string"==typeof r)return n.push('"'+r+'"'),!1;if("boolean"==typeof r)return n.push(r.toString()),!1;if("number"==typeof r){var i=t(r),a=r.toPrecision(numeric.precision),u=parseFloat(r.toString()).toString(),s=[i,a,u,parseFloat(a).toString(),parseFloat(u).toString()];for(o=1;o<s.length;o++)s[o].length<i.length&&(i=s[o]);return n.push(Array(numeric.precision+8-i.length).join(" ")+i),!1}if(null===r)return n.push("null"),!1;if("function"==typeof r){n.push(r.toString());var c=!1;for(o in r)r.hasOwnProperty(o)&&(c?n.push(",\n"):n.push("\n{"),c=!0,n.push(o),n.push(": \n"),e(r[o]));return c&&n.push("}\n"),!0}if(r instanceof Array){if(r.length>numeric.largeArray)return n.push("...Large Array..."),!0;for(c=!1,n.push("["),o=0;o<r.length;o++)o>0&&(n.push(","),c&&n.push("\n ")),c=e(r[o]);return n.push("]"),!0}for(o in n.push("{"),c=!1,r)r.hasOwnProperty(o)&&(c&&n.push(",\n"),c=!0,n.push(o),n.push(": \n"),e(r[o]));return n.push("}"),!0}(e),n.join("")},numeric.parseDate=function(e){return function e(t){if("string"==typeof t)return Date.parse(t.replace(/-/g,"/"));if(t instanceof Array){var n,r=[];for(n=0;n<t.length;n++)r[n]=e(t[n]);return r}throw new Error("parseDate: parameter must be arrays of strings")}(e)},numeric.parseFloat=function(e){return function e(t){if("string"==typeof t)return parseFloat(t);if(t instanceof Array){var n,r=[];for(n=0;n<t.length;n++)r[n]=e(t[n]);return r}throw new Error("parseFloat: parameter must be arrays of strings")}(e)},numeric.parseCSV=function(e){var t,n,r,o=e.split("\n"),i=[],a=/(([^'",]*)|('[^']*')|("[^"]*")),/g,u=/^\s*(([+-]?[0-9]+(\.[0-9]*)?(e[+-]?[0-9]+)?)|([+-]?[0-9]*(\.[0-9]+)?(e[+-]?[0-9]+)?))\s*$/,s=0;for(n=0;n<o.length;n++){var c,l=(o[n]+",").match(a);if(l.length>0){for(i[s]=[],t=0;t<l.length;t++)c=(r=l[t]).substr(0,r.length-1),u.test(c)?i[s][t]=parseFloat(c):i[s][t]=c;s++}}return i},numeric.toCSV=function(e){var t,n,r,o,i,a=numeric.dim(e);for(r=a[0],a[1],i=[],t=0;t<r;t++){for(o=[],n=0;n<r;n++)o[n]=e[t][n].toString();i[t]=o.join(", ")}return i.join("\n")+"\n"},numeric.getURL=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(),t},numeric.imageURL=function(e){function t(e,t,n){void 0===t&&(t=0),void 0===n&&(n=e.length);var r,o=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],i=-1;for(e.length,r=t;r<n;r++)i=i>>>8^o[255&(i^e[r])];return-1^i}var n,r,o,i,a,u,s,c,l,f,m=e[0].length,h=e[0][0].length,d=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,h>>24&255,h>>16&255,h>>8&255,255&h,m>>24&255,m>>16&255,m>>8&255,255&m,8,2,0,0,0,-1,-2,-3,-4,-5,-6,-7,-8,73,68,65,84,8,29];for(f=t(d,12,29),d[29]=f>>24&255,d[30]=f>>16&255,d[31]=f>>8&255,d[32]=255&f,n=1,r=0,s=0;s<m;s++){for(s<m-1?d.push(0):d.push(1),a=3*h+1+(0===s)&255,u=3*h+1+(0===s)>>8&255,d.push(a),d.push(u),d.push(255&~a),d.push(255&~u),0===s&&d.push(0),c=0;c<h;c++)for(o=0;o<3;o++)r=(r+(n=(n+(a=(a=e[o][s][c])>255?255:a<0?0:Math.round(a)))%65521))%65521,d.push(a);d.push(0)}return l=(r<<16)+n,d.push(l>>24&255),d.push(l>>16&255),d.push(l>>8&255),d.push(255&l),i=d.length-41,d[33]=i>>24&255,d[34]=i>>16&255,d[35]=i>>8&255,d[36]=255&i,f=t(d,37),d.push(f>>24&255),d.push(f>>16&255),d.push(f>>8&255),d.push(255&f),d.push(0),d.push(0),d.push(0),d.push(0),d.push(73),d.push(69),d.push(78),d.push(68),d.push(174),d.push(66),d.push(96),d.push(130),"data:image/png;base64,"+function(e){var t,n,r,o,i,a,u,s=e.length,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="";for(t=0;t<s;t+=3)i=((3&(n=e[t]))<<4)+((r=e[t+1])>>4),a=((15&r)<<2)+((o=e[t+2])>>6),u=63&o,t+1>=s?a=u=64:t+2>=s&&(u=64),l+=c.charAt(n>>2)+c.charAt(i)+c.charAt(a)+c.charAt(u);return l}(d)},numeric._dim=function(e){for(var t=[];"object"==typeof e;)t.push(e.length),e=e[0];return t},numeric.dim=function(e){var t;return"object"==typeof e?"object"==typeof(t=e[0])?"object"==typeof t[0]?numeric._dim(e):[e.length,t.length]:[e.length]:[]},numeric.mapreduce=function(e,t){return Function("x","accum","_s","_k",'if(typeof accum === "undefined") accum = '+t+';\nif(typeof x === "number") { var xi = x; '+e+'; return accum; }\nif(typeof _s === "undefined") _s = numeric.dim(x);\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i,xi;\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) {\n accum = arguments.callee(x[i],accum,_s,_k+1);\n } return accum;\n}\nfor(i=_n-1;i>=1;i-=2) { \n xi = x[i];\n '+e+";\n xi = x[i-1];\n "+e+";\n}\nif(i === 0) {\n xi = x[i];\n "+e+"\n}\nreturn accum;")},numeric.mapreduce2=function(e,t){return Function("x","var n = x.length;\nvar i,xi;\n"+t+";\nfor(i=n-1;i!==-1;--i) { \n xi = x[i];\n "+e+";\n}\nreturn accum;")},numeric.same=function e(t,n){var r,o;if(t instanceof Array&&n instanceof Array){if((o=t.length)!==n.length)return!1;for(r=0;r<o;r++)if(t[r]!==n[r]){if("object"!=typeof t[r])return!1;if(!e(t[r],n[r]))return!1}return!0}return!1},numeric.rep=function(e,t,n){void 0===n&&(n=0);var r,o=e[n],i=Array(o);if(n===e.length-1){for(r=o-2;r>=0;r-=2)i[r+1]=t,i[r]=t;return-1===r&&(i[0]=t),i}for(r=o-1;r>=0;r--)i[r]=numeric.rep(e,t,n+1);return i},numeric.dotMMsmall=function(e,t){var n,r,o,i,a,u,s,c,l,f,m;for(i=e.length,a=t.length,u=t[0].length,s=Array(i),n=i-1;n>=0;n--){for(c=Array(u),l=e[n],o=u-1;o>=0;o--){for(f=l[a-1]*t[a-1][o],r=a-2;r>=1;r-=2)m=r-1,f+=l[r]*t[r][o]+l[m]*t[m][o];0===r&&(f+=l[0]*t[0][o]),c[o]=f}s[n]=c}return s},numeric._getCol=function(e,t,n){var r;for(r=e.length-1;r>0;--r)n[r]=e[r][t],n[--r]=e[r][t];0===r&&(n[0]=e[0][t])},numeric.dotMMbig=function(e,t){var n,r,o,i=numeric._getCol,a=t.length,u=Array(a),s=e.length,c=t[0].length,l=new Array(s),f=numeric.dotVV;for(--a,r=--s;-1!==r;--r)l[r]=Array(c);for(r=--c;-1!==r;--r)for(i(t,r,u),o=s;-1!==o;--o)n=e[o],l[o][r]=f(n,u);return l},numeric.dotMV=function(e,t){var n,r=e.length,o=(t.length,Array(r)),i=numeric.dotVV;for(n=r-1;n>=0;n--)o[n]=i(e[n],t);return o},numeric.dotVM=function(e,t){var n,r,o,i,a,u,s;for(o=e.length,i=t[0].length,a=Array(i),r=i-1;r>=0;r--){for(u=e[o-1]*t[o-1][r],n=o-2;n>=1;n-=2)s=n-1,u+=e[n]*t[n][r]+e[s]*t[s][r];0===n&&(u+=e[0]*t[0][r]),a[r]=u}return a},numeric.dotVV=function(e,t){var n,r,o=e.length,i=e[o-1]*t[o-1];for(n=o-2;n>=1;n-=2)r=n-1,i+=e[n]*t[n]+e[r]*t[r];return 0===n&&(i+=e[0]*t[0]),i},numeric.dot=function(e,t){var n=numeric.dim;switch(1e3*n(e).length+n(t).length){case 2002:return t.length<10?numeric.dotMMsmall(e,t):numeric.dotMMbig(e,t);case 2001:return numeric.dotMV(e,t);case 1002:return numeric.dotVM(e,t);case 1001:return numeric.dotVV(e,t);case 1e3:return numeric.mulVS(e,t);case 1:return numeric.mulSV(e,t);case 0:return e*t;default:throw new Error("numeric.dot only works on vectors and matrices")}},numeric.diag=function(e){var t,n,r,o,i=e.length,a=Array(i);for(t=i-1;t>=0;t--){for(o=Array(i),n=t+2,r=i-1;r>=n;r-=2)o[r]=0,o[r-1]=0;for(r>t&&(o[r]=0),o[t]=e[t],r=t-1;r>=1;r-=2)o[r]=0,o[r-1]=0;0===r&&(o[0]=0),a[t]=o}return a},numeric.getDiag=function(e){var t,n=Math.min(e.length,e[0].length),r=Array(n);for(t=n-1;t>=1;--t)r[t]=e[t][t],r[--t]=e[t][t];return 0===t&&(r[0]=e[0][0]),r},numeric.identity=function(e){return numeric.diag(numeric.rep([e],1))},numeric.pointwise=function(e,t,n){void 0===n&&(n="");var r,o,i=[],a=/\[i\]$/,u="",s=!1;for(r=0;r<e.length;r++)a.test(e[r])?u=o=e[r].substring(0,e[r].length-3):o=e[r],"ret"===o&&(s=!0),i.push(o);return i[e.length]="_s",i[e.length+1]="_k",i[e.length+2]='if(typeof _s === "undefined") _s = numeric.dim('+u+');\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i'+(s?"":", ret = Array(_n)")+";\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) ret[i] = arguments.callee("+e.join(",")+",_s,_k+1);\n return ret;\n}\n"+n+"\nfor(i=_n-1;i!==-1;--i) {\n "+t+"\n}\nreturn ret;",Function.apply(null,i)},numeric.pointwise2=function(e,t,n){void 0===n&&(n="");var r,o,i=[],a=/\[i\]$/,u="",s=!1;for(r=0;r<e.length;r++)a.test(e[r])?u=o=e[r].substring(0,e[r].length-3):o=e[r],"ret"===o&&(s=!0),i.push(o);return i[e.length]="var _n = "+u+".length;\nvar i"+(s?"":", ret = Array(_n)")+";\n"+n+"\nfor(i=_n-1;i!==-1;--i) {\n"+t+"\n}\nreturn ret;",Function.apply(null,i)},numeric._biforeach=function e(t,n,r,o,i){var a;if(o!==r.length-1)for(a=r[o]-1;a>=0;a--)e("object"==typeof t?t[a]:t,"object"==typeof n?n[a]:n,r,o+1,i);else i(t,n)},numeric._biforeach2=function e(t,n,r,o,i){if(o===r.length-1)return i(t,n);var a,u=r[o],s=Array(u);for(a=u-1;a>=0;--a)s[a]=e("object"==typeof t?t[a]:t,"object"==typeof n?n[a]:n,r,o+1,i);return s},numeric._foreach=function e(t,n,r,o){var i;if(r!==n.length-1)for(i=n[r]-1;i>=0;i--)e(t[i],n,r+1,o);else o(t)},numeric._foreach2=function e(t,n,r,o){if(r===n.length-1)return o(t);var i,a=n[r],u=Array(a);for(i=a-1;i>=0;i--)u[i]=e(t[i],n,r+1,o);return u},numeric.ops2={add:"+",sub:"-",mul:"*",div:"/",mod:"%",and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">=",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"},numeric.opseq={addeq:"+=",subeq:"-=",muleq:"*=",diveq:"/=",modeq:"%=",lshifteq:"<<=",rshifteq:">>=",rrshifteq:">>>=",bandeq:"&=",boreq:"|=",bxoreq:"^="},numeric.mathfuns=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","isNaN","isFinite"],numeric.mathfuns2=["atan2","pow","max","min"],numeric.ops1={neg:"-",not:"!",bnot:"~",clone:""},numeric.mapreducers={any:["if(xi) return true;","var accum = false;"],all:["if(!xi) return false;","var accum = true;"],sum:["accum += xi;","var accum = 0;"],prod:["accum *= xi;","var accum = 1;"],norm2Squared:["accum += xi*xi;","var accum = 0;"],norminf:["accum = max(accum,abs(xi));","var accum = 0, max = Math.max, abs = Math.abs;"],norm1:["accum += abs(xi)","var accum = 0, abs = Math.abs;"],sup:["accum = max(accum,xi);","var accum = -Infinity, max = Math.max;"],inf:["accum = min(accum,xi);","var accum = Infinity, min = Math.min;"]},function(){var e,t;for(e=0;e<numeric.mathfuns2.length;++e)t=numeric.mathfuns2[e],numeric.ops2[t]=t;for(e in numeric.ops2)if(numeric.ops2.hasOwnProperty(e)){t=numeric.ops2[e];var n,r,o="";-1!==numeric.myIndexOf.call(numeric.mathfuns2,e)?(o="var "+t+" = Math."+t+";\n",n=function(e,n,r){return e+" = "+t+"("+n+","+r+")"},r=function(e,n){return e+" = "+t+"("+e+","+n+")"}):(n=function(e,n,r){return e+" = "+n+" "+t+" "+r},r=numeric.opseq.hasOwnProperty(e+"eq")?function(e,n){return e+" "+t+"= "+n}:function(e,n){return e+" = "+e+" "+t+" "+n}),numeric[e+"VV"]=numeric.pointwise2(["x[i]","y[i]"],n("ret[i]","x[i]","y[i]"),o),numeric[e+"SV"]=numeric.pointwise2(["x","y[i]"],n("ret[i]","x","y[i]"),o),numeric[e+"VS"]=numeric.pointwise2(["x[i]","y"],n("ret[i]","x[i]","y"),o),numeric[e]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar VV = numeric."+e+"VV, VS = numeric."+e+"VS, SV = numeric."+e+'SV;\nvar dim = numeric.dim;\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof x === "object") {\n if(typeof y === "object") x = numeric._biforeach2(x,y,dim(x),0,VV);\n else x = numeric._biforeach2(x,y,dim(x),0,VS);\n } else if(typeof y === "object") x = numeric._biforeach2(x,y,dim(y),0,SV);\n else '+r("x","y")+"\n}\nreturn x;\n"),numeric[t]=numeric[e],numeric[e+"eqV"]=numeric.pointwise2(["ret[i]","x[i]"],r("ret[i]","x[i]"),o),numeric[e+"eqS"]=numeric.pointwise2(["ret[i]","x"],r("ret[i]","x"),o),numeric[e+"eq"]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar V = numeric."+e+"eqV, S = numeric."+e+'eqS\nvar s = numeric.dim(x);\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof y === "object") numeric._biforeach(x,y,s,0,V);\n else numeric._biforeach(x,y,s,0,S);\n}\nreturn x;\n')}for(e=0;e<numeric.mathfuns2.length;++e)t=numeric.mathfuns2[e],delete numeric.ops2[t];for(e=0;e<numeric.mathfuns.length;++e)t=numeric.mathfuns[e],numeric.ops1[t]=t;for(e in numeric.ops1)numeric.ops1.hasOwnProperty(e)&&(o="",t=numeric.ops1[e],-1!==numeric.myIndexOf.call(numeric.mathfuns,e)&&Math.hasOwnProperty(t)&&(o="var "+t+" = Math."+t+";\n"),numeric[e+"eqV"]=numeric.pointwise2(["ret[i]"],"ret[i] = "+t+"(ret[i]);",o),numeric[e+"eq"]=Function("x",'if(typeof x !== "object") return '+t+"x\nvar i;\nvar V = numeric."+e+"eqV;\nvar s = numeric.dim(x);\nnumeric._foreach(x,s,0,V);\nreturn x;\n"),numeric[e+"V"]=numeric.pointwise2(["x[i]"],"ret[i] = "+t+"(x[i]);",o),numeric[e]=Function("x",'if(typeof x !== "object") return '+t+"(x)\nvar i;\nvar V = numeric."+e+"V;\nvar s = numeric.dim(x);\nreturn numeric._foreach2(x,s,0,V);\n"));for(e=0;e<numeric.mathfuns.length;++e)t=numeric.mathfuns[e],delete numeric.ops1[t];for(e in numeric.mapreducers)numeric.mapreducers.hasOwnProperty(e)&&(t=numeric.mapreducers[e],numeric[e+"V"]=numeric.mapreduce2(t[0],t[1]),numeric[e]=Function("x","s","k",t[1]+'if(typeof x !== "object") { xi = x;\n'+t[0]+';\n return accum;\n}if(typeof s === "undefined") s = numeric.dim(x);\nif(typeof k === "undefined") k = 0;\nif(k === s.length-1) return numeric.'+e+"V(x);\nvar xi;\nvar n = x.length, i;\nfor(i=n-1;i!==-1;--i) {\n xi = arguments.callee(x[i]);\n"+t[0]+";\n}\nreturn accum;\n"))}(),numeric.truncVV=numeric.pointwise(["x[i]","y[i]"],"ret[i] = round(x[i]/y[i])*y[i];","var round = Math.round;"),numeric.truncVS=numeric.pointwise(["x[i]","y"],"ret[i] = round(x[i]/y)*y;","var round = Math.round;"),numeric.truncSV=numeric.pointwise(["x","y[i]"],"ret[i] = round(x/y[i])*y[i];","var round = Math.round;"),numeric.trunc=function(e,t){return"object"==typeof e?"object"==typeof t?numeric.truncVV(e,t):numeric.truncVS(e,t):"object"==typeof t?numeric.truncSV(e,t):Math.round(e/t)*t},numeric.inv=function(e){var t,n,r,o,i,a,u,s=numeric.dim(e),c=Math.abs,l=s[0],f=s[1],m=numeric.clone(e),h=numeric.identity(l);for(a=0;a<f;++a){var d=-1,p=-1;for(i=a;i!==l;++i)(u=c(m[i][a]))>p&&(d=i,p=u);for(n=m[d],m[d]=m[a],m[a]=n,o=h[d],h[d]=h[a],h[a]=o,e=n[a],u=a;u!==f;++u)n[u]/=e;for(u=f-1;-1!==u;--u)o[u]/=e;for(i=l-1;-1!==i;--i)if(i!==a){for(t=m[i],r=h[i],e=t[a],u=a+1;u!==f;++u)t[u]-=n[u]*e;for(u=f-1;u>0;--u)r[u]-=o[u]*e,r[--u]-=o[u]*e;0===u&&(r[0]-=o[0]*e)}}return h},numeric.det=function(e){var t=numeric.dim(e);if(2!==t.length||t[0]!==t[1])throw new Error("numeric: det() only works on square matrices");var n,r,o,i,a,u,s,c,l=t[0],f=1,m=numeric.clone(e);for(r=0;r<l-1;r++){for(o=r,n=r+1;n<l;n++)Math.abs(m[n][r])>Math.abs(m[o][r])&&(o=n);for(o!==r&&(s=m[o],m[o]=m[r],m[r]=s,f*=-1),i=m[r],n=r+1;n<l;n++){for(u=(a=m[n])[r]/i[r],o=r+1;o<l-1;o+=2)c=o+1,a[o]-=i[o]*u,a[c]-=i[c]*u;o!==l&&(a[o]-=i[o]*u)}if(0===i[r])return 0;f*=i[r]}return f*m[r][r]},numeric.transpose=function(e){var t,n,r,o,i,a=e.length,u=e[0].length,s=Array(u);for(n=0;n<u;n++)s[n]=Array(a);for(t=a-1;t>=1;t-=2){for(o=e[t],r=e[t-1],n=u-1;n>=1;--n)(i=s[n])[t]=o[n],i[t-1]=r[n],(i=s[--n])[t]=o[n],i[t-1]=r[n];0===n&&((i=s[0])[t]=o[0],i[t-1]=r[0])}if(0===t){for(r=e[0],n=u-1;n>=1;--n)s[n][0]=r[n],s[--n][0]=r[n];0===n&&(s[0][0]=r[0])}return s},numeric.negtranspose=function(e){var t,n,r,o,i,a=e.length,u=e[0].length,s=Array(u);for(n=0;n<u;n++)s[n]=Array(a);for(t=a-1;t>=1;t-=2){for(o=e[t],r=e[t-1],n=u-1;n>=1;--n)(i=s[n])[t]=-o[n],i[t-1]=-r[n],(i=s[--n])[t]=-o[n],i[t-1]=-r[n];0===n&&((i=s[0])[t]=-o[0],i[t-1]=-r[0])}if(0===t){for(r=e[0],n=u-1;n>=1;--n)s[n][0]=-r[n],s[--n][0]=-r[n];0===n&&(s[0][0]=-r[0])}return s},numeric._random=function e(t,n){var r,o,i=t[n],a=Array(i);if(n===t.length-1){for(o=Math.random,r=i-1;r>=1;r-=2)a[r]=o(),a[r-1]=o();return 0===r&&(a[0]=o()),a}for(r=i-1;r>=0;r--)a[r]=e(t,n+1);return a},numeric.random=function(e){return numeric._random(e,0)},numeric.norm2=function(e){return Math.sqrt(numeric.norm2Squared(e))},numeric.linspace=function(e,t,n){if(void 0===n&&(n=Math.max(Math.round(t-e)+1,1)),n<2)return 1===n?[e]:[];var r,o=Array(n);for(r=--n;r>=0;r--)o[r]=(r*t+(n-r)*e)/n;return o},numeric.getBlock=function(e,t,n){var r=numeric.dim(e);return function e(o,i){var a,u=t[i],s=n[i]-u,c=Array(s);if(i===r.length-1){for(a=s;a>=0;a--)c[a]=o[a+u];return c}for(a=s;a>=0;a--)c[a]=e(o[a+u],i+1);return c}(e,0)},numeric.setBlock=function(e,t,n,r){var o=numeric.dim(e);return function e(r,i,a){var u,s=t[a],c=n[a]-s;if(a===o.length-1)for(u=c;u>=0;u--)r[u+s]=i[u];for(u=c;u>=0;u--)e(r[u+s],i[u],a+1)}(e,r,0),e},numeric.getRange=function(e,t,n){var r,o,i,a,u=t.length,s=n.length,c=Array(u);for(r=u-1;-1!==r;--r)for(c[r]=Array(s),i=c[r],a=e[t[r]],o=s-1;-1!==o;--o)i[o]=a[n[o]];return c},numeric.blockMatrix=function(e){var t=numeric.dim(e);if(t.length<4)return numeric.blockMatrix([e]);var n,r,o,i,a,u=t[0],s=t[1];for(n=0,r=0,o=0;o<u;++o)n+=e[o][0].length;for(i=0;i<s;++i)r+=e[0][i][0].length;var c=Array(n);for(o=0;o<n;++o)c[o]=Array(r);var l,f,m,h,d,p=0;for(o=0;o<u;++o){for(l=r,i=s-1;-1!==i;--i)for(l-=(a=e[o][i])[0].length,m=a.length-1;-1!==m;--m)for(d=a[m],f=c[p+m],h=d.length-1;-1!==h;--h)f[l+h]=d[h];p+=e[o][0].length}return c},numeric.tensor=function(e,t){if("number"==typeof e||"number"==typeof t)return numeric.mul(e,t);var n=numeric.dim(e),r=numeric.dim(t);if(1!==n.length||1!==r.length)throw new Error("numeric: tensor product is only defined for vectors");var o,i,a,u,s=n[0],c=r[0],l=Array(s);for(i=s-1;i>=0;i--){for(o=Array(c),u=e[i],a=c-1;a>=3;--a)o[a]=u*t[a],o[--a]=u*t[a],o[--a]=u*t[a],o[--a]=u*t[a];for(;a>=0;)o[a]=u*t[a],--a;l[i]=o}return l},numeric.T=function(e,t){this.x=e,this.y=t},numeric.t=function(e,t){return new numeric.T(e,t)},numeric.Tbinop=function(e,t,n,r,o){var i;if(numeric.indexOf,"string"!=typeof o)for(i in o="",numeric)numeric.hasOwnProperty(i)&&(e.indexOf(i)>=0||t.indexOf(i)>=0||n.indexOf(i)>=0||r.indexOf(i)>=0)&&i.length>1&&(o+="var "+i+" = numeric."+i+";\n");return Function(["y"],"var x = this;\nif(!(y instanceof numeric.T)) { y = new numeric.T(y); }\n"+o+"\nif(x.y) { if(y.y) { return new numeric.T("+r+");\n }\n return new numeric.T("+n+");\n}\nif(y.y) {\n return new numeric.T("+t+");\n}\nreturn new numeric.T("+e+");\n")},numeric.T.prototype.add=numeric.Tbinop("add(x.x,y.x)","add(x.x,y.x),y.y","add(x.x,y.x),x.y","add(x.x,y.x),add(x.y,y.y)"),numeric.T.prototype.sub=numeric.Tbinop("sub(x.x,y.x)","sub(x.x,y.x),neg(y.y)","sub(x.x,y.x),x.y","sub(x.x,y.x),sub(x.y,y.y)"),numeric.T.prototype.mul=numeric.Tbinop("mul(x.x,y.x)","mul(x.x,y.x),mul(x.x,y.y)","mul(x.x,y.x),mul(x.y,y.x)","sub(mul(x.x,y.x),mul(x.y,y.y)),add(mul(x.x,y.y),mul(x.y,y.x))"),numeric.T.prototype.reciprocal=function(){var e=numeric.mul,t=numeric.div;if(this.y){var n=numeric.add(e(this.x,this.x),e(this.y,this.y));return new numeric.T(t(this.x,n),t(numeric.neg(this.y),n))}return new T(t(1,this.x))},numeric.T.prototype.div=function(e){if(e instanceof numeric.T||(e=new numeric.T(e)),e.y)return this.mul(e.reciprocal());var t=numeric.div;return this.y?new numeric.T(t(this.x,e.x),t(this.y,e.x)):new numeric.T(t(this.x,e.x))},numeric.T.prototype.dot=numeric.Tbinop("dot(x.x,y.x)","dot(x.x,y.x),dot(x.x,y.y)","dot(x.x,y.x),dot(x.y,y.x)","sub(dot(x.x,y.x),dot(x.y,y.y)),add(dot(x.x,y.y),dot(x.y,y.x))"),numeric.T.prototype.transpose=function(){var e=numeric.transpose,t=this.x,n=this.y;return n?new numeric.T(e(t),e(n)):new numeric.T(e(t))},numeric.T.prototype.transjugate=function(){var e=numeric.transpose,t=this.x,n=this.y;return n?new numeric.T(e(t),numeric.negtranspose(n)):new numeric.T(e(t))},numeric.Tunop=function(e,t,n){return"string"!=typeof n&&(n=""),Function("var x = this;\n"+n+"\nif(x.y) { "+t+";\n}\n"+e+";\n")},numeric.T.prototype.exp=numeric.Tunop("return new numeric.T(ex)","return new numeric.T(mul(cos(x.y),ex),mul(sin(x.y),ex))","var ex = numeric.exp(x.x), cos = numeric.cos, sin = numeric.sin, mul = numeric.mul;"),numeric.T.prototype.conj=numeric.Tunop("return new numeric.T(x.x);","return new numeric.T(x.x,numeric.neg(x.y));"),numeric.T.prototype.neg=numeric.Tunop("return new numeric.T(neg(x.x));","return new numeric.T(neg(x.x),neg(x.y));","var neg = numeric.neg;"),numeric.T.prototype.sin=numeric.Tunop("return new numeric.T(numeric.sin(x.x))","return x.exp().sub(x.neg().exp()).div(new numeric.T(0,2));"),numeric.T.prototype.cos=numeric.Tunop("return new numeric.T(numeric.cos(x.x))","return x.exp().add(x.neg().exp()).div(2);"),numeric.T.prototype.abs=numeric.Tunop("return new numeric.T(numeric.abs(x.x));","return new numeric.T(numeric.sqrt(numeric.add(mul(x.x,x.x),mul(x.y,x.y))));","var mul = numeric.mul;"),numeric.T.prototype.log=numeric.Tunop("return new numeric.T(numeric.log(x.x));","var theta = new numeric.T(numeric.atan2(x.y,x.x)), r = x.abs();\nreturn new numeric.T(numeric.log(r.x),theta.x);"),numeric.T.prototype.norm2=numeric.Tunop("return numeric.norm2(x.x);","var f = numeric.norm2Squared;\nreturn Math.sqrt(f(x.x)+f(x.y));"),numeric.T.prototype.inv=function(){var e=this;if(void 0===e.y)return new numeric.T(numeric.inv(e.x));var t,n,r,o,i,a,u,s,c,l,f,m,h,d,p,g,v,y,A=e.x.length,x=numeric.identity(A),w=numeric.rep([A,A],0),b=numeric.clone(e.x),C=numeric.clone(e.y);for(c=0;c<A;c++){for(m=(d=b[c][c])*d+(p=C[c][c])*p,f=c,l=c+1;l<A;l++)(h=(d=b[l][c])*d+(p=C[l][c])*p)>m&&(f=l,m=h);for(f!==c&&(y=b[c],b[c]=b[f],b[f]=y,y=C[c],C[c]=C[f],C[f]=y,y=x[c],x[c]=x[f],x[f]=y,y=w[c],w[c]=w[f],w[f]=y),t=b[c],n=C[c],i=x[c],a=w[c],d=t[c],p=n[c],l=c+1;l<A;l++)g=t[l],v=n[l],t[l]=(g*d+v*p)/m,n[l]=(v*d-g*p)/m;for(l=0;l<A;l++)g=i[l],v=a[l],i[l]=(g*d+v*p)/m,a[l]=(v*d-g*p)/m;for(l=c+1;l<A;l++){for(r=b[l],o=C[l],u=x[l],s=w[l],d=r[c],p=o[c],f=c+1;f<A;f++)g=t[f],v=n[f],r[f]-=g*d-v*p,o[f]-=v*d+g*p;for(f=0;f<A;f++)g=i[f],v=a[f],u[f]-=g*d-v*p,s[f]-=v*d+g*p}}for(c=A-1;c>0;c--)for(i=x[c],a=w[c],l=c-1;l>=0;l--)for(u=x[l],s=w[l],d=b[l][c],p=C[l][c],f=A-1;f>=0;f--)g=i[f],v=a[f],u[f]-=d*g-p*v,s[f]-=d*v+p*g;return new numeric.T(x,w)},numeric.T.prototype.get=function(e){var t,n=this.x,r=this.y,o=0,i=e.length;if(r){for(;o<i;)n=n[t=e[o]],r=r[t],o++;return new numeric.T(n,r)}for(;o<i;)n=n[t=e[o]],o++;return new numeric.T(n)},numeric.T.prototype.set=function(e,t){var n,r=this.x,o=this.y,i=0,a=e.length,u=t.x,s=t.y;if(0===a)return s?this.y=s:o&&(this.y=void 0),this.x=r,this;if(s){for(o||(o=numeric.rep(numeric.dim(r),0),this.y=o);i<a-1;)r=r[n=e[i]],o=o[n],i++;return r[n=e[i]]=u,o[n]=s,this}if(o){for(;i<a-1;)r=r[n=e[i]],o=o[n],i++;return r[n=e[i]]=u,o[n]=u instanceof Array?numeric.rep(numeric.dim(u),0):0,this}for(;i<a-1;)r=r[n=e[i]],i++;return r[n=e[i]]=u,this},numeric.T.prototype.getRows=function(e,t){var n,r,o=t-e+1,i=Array(o),a=this.x,u=this.y;for(n=e;n<=t;n++)i[n-e]=a[n];if(u){for(r=Array(o),n=e;n<=t;n++)r[n-e]=u[n];return new numeric.T(i,r)}return new numeric.T(i)},numeric.T.prototype.setRows=function(e,t,n){var r,o=this.x,i=this.y,a=n.x,u=n.y;for(r=e;r<=t;r++)o[r]=a[r-e];if(u)for(i||(i=numeric.rep(numeric.dim(o),0),this.y=i),r=e;r<=t;r++)i[r]=u[r-e];else if(i)for(r=e;r<=t;r++)i[r]=numeric.rep([a[r-e].length],0);return this},numeric.T.prototype.getRow=function(e){var t=this.x,n=this.y;return n?new numeric.T(t[e],n[e]):new numeric.T(t[e])},numeric.T.prototype.setRow=function(e,t){var n=this.x,r=this.y,o=t.x,i=t.y;return n[e]=o,i?(r||(r=numeric.rep(numeric.dim(n),0),this.y=r),r[e]=i):r&&(r=numeric.rep([o.length],0)),this},numeric.T.prototype.getBlock=function(e,t){var n=this.x,r=this.y,o=numeric.getBlock;return r?new numeric.T(o(n,e,t),o(r,e,t)):new numeric.T(o(n,e,t))},numeric.T.prototype.setBlock=function(e,t,n){n instanceof numeric.T||(n=new numeric.T(n));var r=this.x,o=this.y,i=numeric.setBlock,a=n.x,u=n.y;if(u)return o||(this.y=numeric.rep(numeric.dim(this),0),o=this.y),i(r,e,t,a),i(o,e,t,u),this;i(r,e,t,a),o&&i(o,e,t,numeric.rep(numeric.dim(a),0))},numeric.T.rep=function(e,t){var n=numeric.T;t instanceof n||(t=new n(t));var r=t.x,o=t.y,i=numeric.rep;return o?new n(i(e,r),i(e,o)):new n(i(e,r))},numeric.T.diag=function(e){e instanceof numeric.T||(e=new numeric.T(e));var t=e.x,n=e.y,r=numeric.diag;return n?new numeric.T(r(t),r(n)):new numeric.T(r(t))},numeric.T.eig=function(){if(this.y)throw new Error("eig: not implemented for complex matrices.");return numeric.eig(this.x)},numeric.T.identity=function(e){return new numeric.T(numeric.identity(e))},numeric.T.prototype.getDiag=function(){var e=numeric,t=this.x,n=this.y;return n?new e.T(e.getDiag(t),e.getDiag(n)):new e.T(e.getDiag(t))},numeric.house=function(e){var t=numeric.clone(e),n=(e[0]>=0?1:-1)*numeric.norm2(e);t[0]+=n;var r=numeric.norm2(t);if(0===r)throw new Error("eig: internal error");return numeric.div(t,r)},numeric.toUpperHessenberg=function(e){var t=numeric.dim(e);if(2!==t.length||t[0]!==t[1])throw new Error("numeric: toUpperHessenberg() only works on square matrices");var n,r,o,i,a,u,s,c,l,f,m=t[0],h=numeric.clone(e),d=numeric.identity(m);for(r=0;r<m-2;r++){for(i=Array(m-r-1),n=r+1;n<m;n++)i[n-r-1]=h[n][r];if(numeric.norm2(i)>0){for(a=numeric.house(i),u=numeric.getBlock(h,[r+1,r],[m-1,m-1]),s=numeric.tensor(a,numeric.dot(a,u)),n=r+1;n<m;n++)for(c=h[n],l=s[n-r-1],o=r;o<m;o++)c[o]-=2*l[o-r];for(u=numeric.getBlock(h,[0,r+1],[m-1,m-1]),s=numeric.tensor(numeric.dot(u,a),a),n=0;n<m;n++)for(c=h[n],l=s[n],o=r+1;o<m;o++)c[o]-=2*l[o-r-1];for(u=Array(m-r-1),n=r+1;n<m;n++)u[n-r-1]=d[n];for(s=numeric.tensor(a,numeric.dot(a,u)),n=r+1;n<m;n++)for(f=d[n],l=s[n-r-1],o=0;o<m;o++)f[o]-=2*l[o]}}return{H:h,Q:d}},numeric.epsilon=2220446049250313e-31,numeric.QRFrancis=function(e,t){void 0===t&&(t=1e4),e=numeric.clone(e),numeric.clone(e);var n,r,o,i,a,u,s,c,l,f,m,h,d,p,g,v,y,A,x=numeric.dim(e)[0],w=numeric.identity(x);if(x<3)return{Q:w,B:[[0,x-1]]};var b=numeric.epsilon;for(A=0;A<t;A++){for(v=0;v<x-1;v++)if(Math.abs(e[v+1][v])<b*(Math.abs(e[v][v])+Math.abs(e[v+1][v+1]))){var C=numeric.QRFrancis(numeric.getBlock(e,[0,0],[v,v]),t),T=numeric.QRFrancis(numeric.getBlock(e,[v+1,v+1],[x-1,x-1]),t);for(h=Array(v+1),g=0;g<=v;g++)h[g]=w[g];for(d=numeric.dot(C.Q,h),g=0;g<=v;g++)w[g]=d[g];for(h=Array(x-v-1),g=v+1;g<x;g++)h[g-v-1]=w[g];for(d=numeric.dot(T.Q,h),g=v+1;g<x;g++)w[g]=d[g-v-1];return{Q:w,B:C.B.concat(numeric.add(T.B,v+1))}}var _,S,I;for(o=e[x-2][x-2],i=e[x-2][x-1],a=e[x-1][x-2],c=o+(u=e[x-1][x-1]),s=o*u-i*a,l=numeric.getBlock(e,[0,0],[2,2]),c*c>=4*s?(_=.5*(c+Math.sqrt(c*c-4*s)),S=.5*(c-Math.sqrt(c*c-4*s)),l=numeric.add(numeric.sub(numeric.dot(l,l),numeric.mul(l,_+S)),numeric.diag(numeric.rep([3],_*S)))):l=numeric.add(numeric.sub(numeric.dot(l,l),numeric.mul(l,c)),numeric.diag(numeric.rep([3],s))),n=[l[0][0],l[1][0],l[2][0]],r=numeric.house(n),h=[e[0],e[1],e[2]],d=numeric.tensor(r,numeric.dot(r,h)),g=0;g<3;g++)for(m=e[g],p=d[g],y=0;y<x;y++)m[y]-=2*p[y];for(h=numeric.getBlock(e,[0,0],[x-1,2]),d=numeric.tensor(numeric.dot(h,r),r),g=0;g<x;g++)for(m=e[g],p=d[g],y=0;y<3;y++)m[y]-=2*p[y];for(h=[w[0],w[1],w[2]],d=numeric.tensor(r,numeric.dot(r,h)),g=0;g<3;g++)for(f=w[g],p=d[g],y=0;y<x;y++)f[y]-=2*p[y];for(v=0;v<x-2;v++){for(y=v;y<=v+1;y++)if(Math.abs(e[y+1][y])<b*(Math.abs(e[y][y])+Math.abs(e[y+1][y+1]))){for(C=numeric.QRFrancis(numeric.getBlock(e,[0,0],[y,y]),t),T=numeric.QRFrancis(numeric.getBlock(e,[y+1,y+1],[x-1,x-1]),t),h=Array(y+1),g=0;g<=y;g++)h[g]=w[g];for(d=numeric.dot(C.Q,h),g=0;g<=y;g++)w[g]=d[g];for(h=Array(x-y-1),g=y+1;g<x;g++)h[g-y-1]=w[g];for(d=numeric.dot(T.Q,h),g=y+1;g<x;g++)w[g]=d[g-y-1];return{Q:w,B:C.B.concat(numeric.add(T.B,y+1))}}for(I=Math.min(x-1,v+3),n=Array(I-v),g=v+1;g<=I;g++)n[g-v-1]=e[g][v];for(r=numeric.house(n),h=numeric.getBlock(e,[v+1,v],[I,x-1]),d=numeric.tensor(r,numeric.dot(r,h)),g=v+1;g<=I;g++)for(m=e[g],p=d[g-v-1],y=v;y<x;y++)m[y]-=2*p[y-v];for(h=numeric.getBlock(e,[0,v+1],[x-1,I]),d=numeric.tensor(numeric.dot(h,r),r),g=0;g<x;g++)for(m=e[g],p=d[g],y=v+1;y<=I;y++)m[y]-=2*p[y-v-1];for(h=Array(I-v),g=v+1;g<=I;g++)h[g-v-1]=w[g];for(d=numeric.tensor(r,numeric.dot(r,h)),g=v+1;g<=I;g++)for(f=w[g],p=d[g-v-1],y=0;y<x;y++)f[y]-=2*p[y]}}throw new Error("numeric: eigenvalue iteration does not converge -- increase maxiter?")},numeric.eig=function(e,t){var n,r,o,i,a,u,s,c,l,f,m,h,d,p,g,v,y=numeric.toUpperHessenberg(e),A=numeric.QRFrancis(y.H,t),x=numeric.T,w=e.length,b=A.B,C=numeric.dot(A.Q,numeric.dot(y.H,numeric.transpose(A.Q))),T=new x(numeric.dot(A.Q,y.Q)),_=b.length,S=Math.sqrt;for(r=0;r<_;r++)if((n=b[r][0])!==b[r][1]){if(i=n+1,a=C[n][n],u=C[n][i],s=C[i][n],c=C[i][i],0===u&&0===s)continue;(f=(l=-a-c)*l-4*(a*c-u*s))>=0?((g=(a-(m=l<0?-.5*(l-S(f)):-.5*(l+S(f))))*(a-m)+u*u)>(v=s*s+(c-m)*(c-m))?(d=(a-m)/(g=S(g)),p=u/g):(d=s/(v=S(v)),p=(c-m)/v),o=new x([[p,-d],[d,p]]),T.setRows(n,i,o.dot(T.getRows(n,i)))):(m=-.5*l,h=.5*S(-f),(g=(a-m)*(a-m)+u*u)>(v=s*s+(c-m)*(c-m))?(d=(a-m)/(g=S(g+h*h)),p=u/g,m=0,h/=g):(d=s/(v=S(v+h*h)),p=(c-m)/v,m=h/v,h=0),o=new x([[p,-d],[d,p]],[[m,h],[h,-m]]),T.setRows(n,i,o.dot(T.getRows(n,i))))}var I=T.dot(e).dot(T.transjugate()),O=(w=e.length,numeric.T.identity(w));for(i=0;i<w;i++)if(i>0)for(r=i-1;r>=0;r--){var k=I.get([r,r]),E=I.get([i,i]);numeric.neq(k.x,E.x)||numeric.neq(k.y,E.y)?(m=I.getRow(r).getBlock([r],[i-1]),h=O.getRow(i).getBlock([r],[i-1]),O.set([i,r],I.get([r,i]).neg().sub(m.dot(h)).div(k.sub(E)))):O.setRow(i,O.getRow(r))}for(i=0;i<w;i++)m=O.getRow(i),O.setRow(i,m.div(m.norm2()));return O=O.transpose(),O=T.transjugate().dot(O),{lambda:I.getDiag(),E:O}},numeric.ccsSparse=function(e){var t,n,r,o=e.length,i=[];for(n=o-1;-1!==n;--n)for(r in t=e[n]){for(r=parseInt(r);r>=i.length;)i[i.length]=0;0!==t[r]&&i[r]++}var a=i.length,u=Array(a+1);for(u[0]=0,n=0;n<a;++n)u[n+1]=u[n]+i[n];var s=Array(u[a]),c=Array(u[a]);for(n=o-1;-1!==n;--n)for(r in t=e[n])0!==t[r]&&(i[r]--,s[u[r]+i[r]]=n,c[u[r]+i[r]]=t[r]);return[u,s,c]},numeric.ccsFull=function(e){var t,n,r,o,i=e[0],a=e[1],u=e[2],s=numeric.ccsDim(e),c=s[0],l=s[1],f=numeric.rep([c,l],0);for(t=0;t<l;t++)for(r=i[t],o=i[t+1],n=r;n<o;++n)f[a[n]][t]=u[n];return f},numeric.ccsTSolve=function(e,t,n,r,o){function i(e){var t;if(0===n[e]){for(n[e]=1,t=h[e];t<h[e+1];++t)i(d[t]);o[y]=e,++y}}var a,u,s,c,l,f,m,h=e[0],d=e[1],p=e[2],g=h.length-1,v=Math.max,y=0;for(void 0===r&&(n=numeric.rep([g],0)),void 0===r&&(r=numeric.linspace(0,n.length-1)),void 0===o&&(o=[]),a=r.length-1;-1!==a;--a)i(r[a]);for(o.length=y,a=o.length-1;-1!==a;--a)n[o[a]]=0;for(a=r.length-1;-1!==a;--a)u=r[a],n[u]=t[u];for(a=o.length-1;-1!==a;--a){for(u=o[a],s=h[u],c=v(h[u+1],s),l=s;l!==c;++l)if(d[l]===u){n[u]/=p[l];break}for(m=n[u],l=s;l!==c;++l)(f=d[l])!==u&&(n[f]-=m*p[l])}return n},numeric.ccsDFS=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS.prototype.dfs=function(e,t,n,r,o,i){var a,u,s,c=0,l=o.length,f=this.k,m=this.k1,h=this.j;if(0===r[e])for(r[e]=1,h[0]=e,f[0]=u=t[e],m[0]=s=t[e+1];;)if(u>=s){if(o[l]=h[c],0===c)return;++l,u=f[--c],s=m[c]}else 0===r[a=i[n[u]]]?(r[a]=1,f[c]=u,h[++c]=a,u=t[a],m[c]=s=t[a+1]):++u},numeric.ccsLPSolve=function(e,t,n,r,o,i,a){var u,s,c,l,f,m,h,d,p,g=e[0],v=e[1],y=e[2],A=(g.length,t[0]),x=t[1],w=t[2];for(s=A[o],c=A[o+1],r.length=0,u=s;u<c;++u)a.dfs(i[x[u]],g,v,n,r,i);for(u=r.length-1;-1!==u;--u)n[r[u]]=0;for(u=s;u!==c;++u)n[l=i[x[u]]]=w[u];for(u=r.length-1;-1!==u;--u){for(f=g[l=r[u]],m=g[l+1],h=f;h<m;++h)if(i[v[h]]===l){n[l]/=y[h];break}for(p=n[l],h=f;h<m;++h)(d=i[v[h]])!==l&&(n[d]-=p*y[h])}return n},numeric.ccsLUP1=function(e,t){var n,r,o,i,a,u,s,c=e[0].length-1,l=[numeric.rep([c+1],0),[],[]],f=[numeric.rep([c+1],0),[],[]],m=l[0],h=l[1],d=l[2],p=f[0],g=f[1],v=f[2],y=numeric.rep([c],0),A=numeric.rep([c],0),x=numeric.ccsLPSolve,w=(Math.max,Math.abs),b=numeric.linspace(0,c-1),C=numeric.linspace(0,c-1),T=new numeric.ccsDFS(c);for(void 0===t&&(t=1),n=0;n<c;++n){for(x(l,e,y,A,n,C,T),i=-1,a=-1,r=A.length-1;-1!==r;--r)(o=A[r])<=n||(u=w(y[o]))>i&&(a=o,i=u);for(w(y[n])<t*i&&(r=b[n],i=b[a],b[n]=i,C[i]=n,b[a]=r,C[r]=a,i=y[n],y[n]=y[a],y[a]=i),i=m[n],a=p[n],s=y[n],h[i]=b[n],d[i]=1,++i,r=A.length-1;-1!==r;--r)u=y[o=A[r]],A[r]=0,y[o]=0,o<=n?(g[a]=o,v[a]=u,++a):(h[i]=b[o],d[i]=u/s,++i);m[n+1]=i,p[n+1]=a}for(r=h.length-1;-1!==r;--r)h[r]=C[h[r]];return{L:l,U:f,P:b,Pinv:C}},numeric.ccsDFS0=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS0.prototype.dfs=function(e,t,n,r,o,i,a){var u,s,c,l=0,f=o.length,m=this.k,h=this.k1,d=this.j;if(0===r[e])for(r[e]=1,d[0]=e,m[0]=s=t[i[e]],h[0]=c=t[i[e]+1];;){if(isNaN(s))throw new Error("Ow!");if(s>=c){if(o[f]=i[d[l]],0===l)return;++f,s=m[--l],c=h[l]}else 0===r[u=n[s]]?(r[u]=1,m[l]=s,d[++l]=u,s=t[u=i[u]],h[l]=c=t[u+1]):++s}},numeric.ccsLPSolve0=function(e,t,n,r,o,i,a,u){var s,c,l,f,m,h,d,p,g,v=e[0],y=e[1],A=e[2],x=(v.length,t[0]),w=t[1],b=t[2];for(c=x[o],l=x[o+1],r.length=0,s=c;s<l;++s)u.dfs(w[s],v,y,n,r,i,a);for(s=r.length-1;-1!==s;--s)n[a[f=r[s]]]=0;for(s=c;s!==l;++s)n[f=w[s]]=b[s];for(s=r.length-1;-1!==s;--s){for(p=a[f=r[s]],m=v[f],h=v[f+1],d=m;d<h;++d)if(y[d]===p){n[p]/=A[d];break}for(g=n[p],d=m;d<h;++d)n[y[d]]-=g*A[d];n[p]=g}},numeric.ccsLUP0=function(e,t){var n,r,o,i,a,u,s,c=e[0].length-1,l=[numeric.rep([c+1],0),[],[]],f=[numeric.rep([c+1],0),[],[]],m=l[0],h=l[1],d=l[2],p=f[0],g=f[1],v=f[2],y=numeric.rep([c],0),A=numeric.rep([c],0),x=numeric.ccsLPSolve0,w=(Math.max,Math.abs),b=numeric.linspace(0,c-1),C=numeric.linspace(0,c-1),T=new numeric.ccsDFS0(c);for(void 0===t&&(t=1),n=0;n<c;++n){for(x(l,e,y,A,n,C,b,T),i=-1,a=-1,r=A.length-1;-1!==r;--r)(o=A[r])<=n||(u=w(y[b[o]]))>i&&(a=o,i=u);for(w(y[b[n]])<t*i&&(r=b[n],i=b[a],b[n]=i,C[i]=n,b[a]=r,C[r]=a),i=m[n],a=p[n],s=y[b[n]],h[i]=b[n],d[i]=1,++i,r=A.length-1;-1!==r;--r)u=y[b[o=A[r]]],A[r]=0,y[b[o]]=0,o<=n?(g[a]=o,v[a]=u,++a):(h[i]=b[o],d[i]=u/s,++i);m[n+1]=i,p[n+1]=a}for(r=h.length-1;-1!==r;--r)h[r]=C[h[r]];return{L:l,U:f,P:b,Pinv:C}},numeric.ccsLUP=numeric.ccsLUP0,numeric.ccsDim=function(e){return[numeric.sup(e[1])+1,e[0].length-1]},numeric.ccsGetBlock=function(e,t,n){var r=numeric.ccsDim(e),o=r[0],i=r[1];void 0===t?t=numeric.linspace(0,o-1):"number"==typeof t&&(t=[t]),void 0===n?n=numeric.linspace(0,i-1):"number"==typeof n&&(n=[n]);var a,u,s,c,l=t.length,f=n.length,m=numeric.rep([i],0),h=[],d=[],p=[m,h,d],g=e[0],v=e[1],y=e[2],A=numeric.rep([o],0),x=0,w=numeric.rep([o],0);for(u=0;u<f;++u){var b=g[c=n[u]],C=g[c+1];for(a=b;a<C;++a)w[s=v[a]]=1,A[s]=y[a];for(a=0;a<l;++a)w[t[a]]&&(h[x]=a,d[x]=A[t[a]],++x);for(a=b;a<C;++a)w[s=v[a]]=0;m[u+1]=x}return p},numeric.ccsDot=function(e,t){var n,r,o,i,a,u,s,c,l,f,m,h=e[0],d=e[1],p=e[2],g=t[0],v=t[1],y=t[2],A=numeric.ccsDim(e),x=numeric.ccsDim(t),w=A[0],b=(A[1],x[1]),C=numeric.rep([w],0),T=numeric.rep([w],0),_=Array(w),S=numeric.rep([b],0),I=[],O=[],k=[S,I,O];for(o=0;o!==b;++o){for(i=g[o],a=g[o+1],l=0,r=i;r<a;++r)for(f=v[r],m=y[r],u=h[f],s=h[f+1],n=u;n<s;++n)0===T[c=d[n]]&&(_[l]=c,T[c]=1,l+=1),C[c]=C[c]+p[n]*m;for(a=(i=S[o])+l,S[o+1]=a,r=l-1;-1!==r;--r)m=i+r,n=_[r],I[m]=n,O[m]=C[n],T[n]=0,C[n]=0;S[o+1]=S[o]+l}return k},numeric.ccsLUPSolve=function(e,t){var n=e.L,r=e.U,o=(e.P,t[0]),i=!1;"object"!=typeof o&&(o=(t=[[0,t.length],numeric.linspace(0,t.length-1),t])[0],i=!0);var a,u,s,c,l,f,m=t[1],h=t[2],d=n[0].length-1,p=o.length-1,g=numeric.rep([d],0),v=Array(d),y=numeric.rep([d],0),A=Array(d),x=numeric.rep([p+1],0),w=[],b=[],C=numeric.ccsTSolve,T=0;for(a=0;a<p;++a){for(l=0,s=o[a],c=o[a+1],u=s;u<c;++u)f=e.Pinv[m[u]],A[l]=f,y[f]=h[u],++l;for(A.length=l,C(n,y,g,A,v),u=A.length-1;-1!==u;--u)y[A[u]]=0;if(C(r,g,y,v,A),i)return y;for(u=v.length-1;-1!==u;--u)g[v[u]]=0;for(u=A.length-1;-1!==u;--u)f=A[u],w[T]=f,b[T]=y[f],y[f]=0,++T;x[a+1]=T}return[x,w,b]},numeric.ccsbinop=function(e,t){return void 0===t&&(t=""),Function("X","Y","var Xi = X[0], Xj = X[1], Xv = X[2];\nvar Yi = Y[0], Yj = Y[1], Yv = Y[2];\nvar n = Xi.length-1,m = Math.max(numeric.sup(Xj),numeric.sup(Yj))+1;\nvar Zi = numeric.rep([n+1],0), Zj = [], Zv = [];\nvar x = numeric.rep([m],0),y = numeric.rep([m],0);\nvar xk,yk,zk;\nvar i,j,j0,j1,k,p=0;\n"+t+"for(i=0;i<n;++i) {\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Xj[j];\n x[k] = 1;\n Zj[p] = k;\n ++p;\n }\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Yj[j];\n y[k] = Yv[j];\n if(x[k] === 0) {\n Zj[p] = k;\n ++p;\n }\n }\n Zi[i+1] = p;\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = Xv[j];\n j0 = Zi[i]; j1 = Zi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Zj[j];\n xk = x[k];\n yk = y[k];\n"+e+"\n Zv[j] = zk;\n }\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = 0;\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) y[Yj[j]] = 0;\n}\nreturn [Zi,Zj,Zv];")},function(){var k,A,B,C;for(k in numeric.ops2)A=isFinite(eval("1"+numeric.ops2[k]+"0"))?"[Y[0],Y[1],numeric."+k+"(X,Y[2])]":"NaN",B=isFinite(eval("0"+numeric.ops2[k]+"1"))?"[X[0],X[1],numeric."+k+"(X[2],Y)]":"NaN",C=isFinite(eval("1"+numeric.ops2[k]+"0"))&&isFinite(eval("0"+numeric.ops2[k]+"1"))?"numeric.ccs"+k+"MM(X,Y)":"NaN",numeric["ccs"+k+"MM"]=numeric.ccsbinop("zk = xk "+numeric.ops2[k]+"yk;"),numeric["ccs"+k]=Function("X","Y",'if(typeof X === "number") return '+A+';\nif(typeof Y === "number") return '+B+";\nreturn "+C+";\n")}(),numeric.ccsScatter=function(e){var t,n=e[0],r=e[1],o=e[2],i=numeric.sup(r)+1,a=n.length,u=numeric.rep([i],0),s=Array(a),c=Array(a),l=numeric.rep([i],0);for(t=0;t<a;++t)l[r[t]]++;for(t=0;t<i;++t)u[t+1]=u[t]+l[t];var f,m,h=u.slice(0);for(t=0;t<a;++t)s[f=h[m=r[t]]]=n[t],c[f]=o[t],h[m]=h[m]+1;return[u,s,c]},numeric.ccsGather=function(e){var t,n,r,o,i,a=e[0],u=e[1],s=e[2],c=a.length-1,l=u.length,f=Array(l),m=Array(l),h=Array(l);for(i=0,t=0;t<c;++t)for(r=a[t],o=a[t+1],n=r;n!==o;++n)m[i]=t,f[i]=u[n],h[i]=s[n],++i;return[f,m,h]},numeric.sdim=function e(t,n,r){if(void 0===n&&(n=[]),"object"!=typeof t)return n;var o;for(o in void 0===r&&(r=0),r in n||(n[r]=0),t.length>n[r]&&(n[r]=t.length),t)t.hasOwnProperty(o)&&e(t[o],n,r+1);return n},numeric.sclone=function e(t,n,r){void 0===n&&(n=0),void 0===r&&(r=numeric.sdim(t).length);var o,i=Array(t.length);if(n===r-1){for(o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);return i}for(o in t)t.hasOwnProperty(o)&&(i[o]=e(t[o],n+1,r));return i},numeric.sdiag=function(e){var t,n,r=e.length,o=Array(r);for(t=r-1;t>=1;t-=2)n=t-1,o[t]=[],o[t][t]=e[t],o[n]=[],o[n][n]=e[n];return 0===t&&(o[0]=[],o[0][0]=e[t]),o},numeric.sidentity=function(e){return numeric.sdiag(numeric.rep([e],1))},numeric.stranspose=function(e){var t,n,r,o=[];for(t in e.length,e)if(e.hasOwnProperty(t))for(n in r=e[t])r.hasOwnProperty(n)&&("object"!=typeof o[n]&&(o[n]=[]),o[n][t]=r[n]);return o},numeric.sLUP=function(e,t){throw new Error("The function numeric.sLUP had a bug in it and has been removed. Please use the new numeric.ccsLUP function instead.")},numeric.sdotMM=function(e,t){var n,r,o,i,a,u,s,c=e.length,l=(t.length,numeric.stranspose(t)),f=l.length,m=Array(c);for(o=c-1;o>=0;o--){for(s=[],n=e[o],a=f-1;a>=0;a--){for(i in u=0,r=l[a],n)n.hasOwnProperty(i)&&i in r&&(u+=n[i]*r[i]);u&&(s[a]=u)}m[o]=s}return m},numeric.sdotMV=function(e,t){var n,r,o,i,a=e.length,u=Array(a);for(r=a-1;r>=0;r--){for(o in i=0,n=e[r])n.hasOwnProperty(o)&&t[o]&&(i+=n[o]*t[o]);i&&(u[r]=i)}return u},numeric.sdotVM=function(e,t){var n,r,o,i,a=[];for(n in e)if(e.hasOwnProperty(n))for(r in o=t[n],i=e[n],o)o.hasOwnProperty(r)&&(a[r]||(a[r]=0),a[r]+=i*o[r]);return a},numeric.sdotVV=function(e,t){var n,r=0;for(n in e)e[n]&&t[n]&&(r+=e[n]*t[n]);return r},numeric.sdot=function(e,t){var n=numeric.sdim(e).length,r=numeric.sdim(t).length;switch(1e3*n+r){case 0:return e*t;case 1001:return numeric.sdotVV(e,t);case 2001:return numeric.sdotMV(e,t);case 1002:return numeric.sdotVM(e,t);case 2002:return numeric.sdotMM(e,t);default:throw new Error("numeric.sdot not implemented for tensors of order "+n+" and "+r)}},numeric.sscatter=function(e){var t,n,r,o,i=e[0].length,a=e.length,u=[];for(n=i-1;n>=0;--n)if(e[a-1][n]){for(o=u,r=0;r<a-2;r++)o[t=e[r][n]]||(o[t]=[]),o=o[t];o[e[r][n]]=e[r+1][n]}return u},numeric.sgather=function e(t,n,r){var o,i,a;for(i in void 0===n&&(n=[]),void 0===r&&(r=[]),o=r.length,t)if(t.hasOwnProperty(i))if(r[o]=parseInt(i),"number"==typeof(a=t[i])){if(a){if(0===n.length)for(i=o+1;i>=0;--i)n[i]=[];for(i=o;i>=0;--i)n[i].push(r[i]);n[o+1].push(a)}}else e(a,n,r);return r.length>o&&r.pop(),n},numeric.cLU=function(e){var t,n,r,o,i,a,u=e[0],s=e[1],c=e[2],l=u.length,f=0;for(t=0;t<l;t++)u[t]>f&&(f=u[t]);f++;var m,h=Array(f),d=Array(f),p=numeric.rep([f],1/0),g=numeric.rep([f],-1/0);for(r=0;r<l;r++)t=u[r],(n=s[r])<p[t]&&(p[t]=n),n>g[t]&&(g[t]=n);for(t=0;t<f-1;t++)g[t]>g[t+1]&&(g[t+1]=g[t]);for(t=f-1;t>=1;t--)p[t]<p[t-1]&&(p[t-1]=p[t]);for(t=0;t<f;t++)d[t]=numeric.rep([g[t]-p[t]+1],0),h[t]=numeric.rep([t-p[t]],0),p[t],g[t];for(r=0;r<l;r++)d[t=u[r]][s[r]-p[t]]=c[r];for(t=0;t<f-1;t++)for(o=t-p[t],A=d[t],n=t+1;p[n]<=t&&n<f;n++)if(i=t-p[n],a=g[t]-t,m=(x=d[n])[i]/A[o]){for(r=1;r<=a;r++)x[r+i]-=m*A[r+o];h[n][t-p[n]]=m}var v,y,A=[],x=[],w=[],b=[],C=[],T=[];for(l=0,v=0,t=0;t<f;t++){for(o=p[t],i=g[t],y=d[t],n=t;n<=i;n++)y[n-o]&&(A[l]=t,x[l]=n,w[l]=y[n-o],l++);for(y=h[t],n=o;n<t;n++)y[n-o]&&(b[v]=t,C[v]=n,T[v]=y[n-o],v++);b[v]=t,C[v]=t,T[v]=1,v++}return{U:[A,x,w],L:[b,C,T]}},numeric.cLUsolve=function(e,t){var n,r,o=e.L,i=e.U,a=numeric.clone(t),u=o[0],s=o[1],c=o[2],l=i[0],f=i[1],m=i[2],h=l.length,d=(u.length,a.length);for(r=0,n=0;n<d;n++){for(;s[r]<n;)a[n]-=c[r]*a[s[r]],r++;r++}for(r=h-1,n=d-1;n>=0;n--){for(;f[r]>n;)a[n]-=m[r]*a[f[r]],r--;a[n]/=m[r],r--}return a},numeric.cgrid=function(e,t){"number"==typeof e&&(e=[e,e]);var n,r,o,i=numeric.rep(e,-1);for("function"!=typeof t&&(t="L"===t?function(t,n){return t>=e[0]/2||n<e[1]/2}:function(e,t){return!0}),o=0,n=1;n<e[0]-1;n++)for(r=1;r<e[1]-1;r++)t(n,r)&&(i[n][r]=o,o++);return i},numeric.cdelsq=function(e){var t,n,r,o,i,a=[[-1,0],[0,-1],[0,1],[1,0]],u=numeric.dim(e),s=u[0],c=u[1],l=[],f=[],m=[];for(t=1;t<s-1;t++)for(n=1;n<c-1;n++)if(!(e[t][n]<0)){for(r=0;r<4;r++)o=t+a[r][0],i=n+a[r][1],e[o][i]<0||(l.push(e[t][n]),f.push(e[o][i]),m.push(-1));l.push(e[t][n]),f.push(e[t][n]),m.push(4)}return[l,f,m]},numeric.cdotMV=function(e,t){var n,r,o,i=e[0],a=e[1],u=e[2],s=i.length;for(o=0,r=0;r<s;r++)i[r]>o&&(o=i[r]);for(o++,n=numeric.rep([o],0),r=0;r<s;r++)n[i[r]]+=u[r]*t[a[r]];return n},numeric.Spline=function(e,t,n,r,o){this.x=e,this.yl=t,this.yr=n,this.kl=r,this.kr=o},numeric.Spline.prototype._at=function(e,t){var n,r,o,i=this.x,a=this.yl,u=this.yr,s=this.kl,c=this.kr,l=numeric.add,f=numeric.sub,m=numeric.mul;n=f(m(s[t],i[t+1]-i[t]),f(u[t+1],a[t])),r=l(m(c[t+1],i[t]-i[t+1]),f(u[t+1],a[t]));var h=(o=(e-i[t])/(i[t+1]-i[t]))*(1-o);return l(l(l(m(1-o,a[t]),m(o,u[t+1])),m(n,h*(1-o))),m(r,h*o))},numeric.Spline.prototype.at=function(e){if("number"==typeof e){var t,n,r,o=this.x,i=o.length,a=Math.floor;for(t=0,n=i-1;n-t>1;)o[r=a((t+n)/2)]<=e?t=r:n=r;return this._at(e,t)}i=e.length;var u,s=Array(i);for(u=i-1;-1!==u;--u)s[u]=this.at(e[u]);return s},numeric.Spline.prototype.diff=function(){var e,t,n,r=this.x,o=this.yl,i=this.yr,a=this.kl,u=this.kr,s=o.length,c=a,l=u,f=Array(s),m=Array(s),h=numeric.add,d=numeric.mul,p=numeric.div,g=numeric.sub;for(e=s-1;-1!==e;--e)t=r[e+1]-r[e],n=g(i[e+1],o[e]),f[e]=p(h(d(n,6),d(a[e],-4*t),d(u[e+1],-2*t)),t*t),m[e+1]=p(h(d(n,-6),d(a[e],2*t),d(u[e+1],4*t)),t*t);return new numeric.Spline(r,c,l,f,m)},numeric.Spline.prototype.roots=function(){var e=[],t=this.x,n=this.yl,r=this.yr,o=this.kl,i=this.kr;"number"==typeof n[0]&&(n=[n],r=[r],o=[o],i=[i]);var a,u,s,c,l,f,m,h,d,p,g,v,y,A,x,w,b,C,T,_,S,I,O,k,E=n.length,M=t.length-1,B=(e=Array(E),Math.sqrt);for(a=0;a!==E;++a){for(c=n[a],l=r[a],f=o[a],m=i[a],h=[],u=0;u!==M;u++){for(u>0&&l[u]*c[u]<0&&h.push(t[u]),w=t[u+1]-t[u],t[u],g=c[u],v=l[u+1],d=f[u]/w,y=(p=m[u+1]/w)+3*g+2*d-3*v,A=3*(p+d+2*(g-v)),(x=(k=d-p+3*(g-v))*k+12*p*g)<=0?b=(C=y/A)>t[u]&&C<t[u+1]?[t[u],C,t[u+1]]:[t[u],t[u+1]]:(C=(y-B(x))/A,T=(y+B(x))/A,b=[t[u]],C>t[u]&&C<t[u+1]&&b.push(C),T>t[u]&&T<t[u+1]&&b.push(T),b.push(t[u+1])),S=b[0],C=this._at(S,u),s=0;s<b.length-1;s++)if(I=b[s+1],T=this._at(I,u),0!==C)if(0===T||C*T>0)S=I,C=T;else{for(var N=0;!((O=(C*I-T*S)/(C-T))<=S||O>=I);)if((_=this._at(O,u))*T>0)I=O,T=_,-1===N&&(C*=.5),N=-1;else{if(!(_*C>0))break;S=O,C=_,1===N&&(T*=.5),N=1}h.push(O),S=b[s+1],C=this._at(S,u)}else h.push(S),S=I,C=T;0===T&&h.push(I)}e[a]=h}return"number"==typeof this.yl[0]?e[0]:e},numeric.spline=function(e,t,n,r){var o,i=e.length,a=[],u=[],s=[],c=numeric.sub,l=numeric.mul,f=numeric.add;for(o=i-2;o>=0;o--)u[o]=e[o+1]-e[o],s[o]=c(t[o+1],t[o]);"string"!=typeof n&&"string"!=typeof r||(n=r="periodic");var m=[[],[],[]];switch(typeof n){case"undefined":a[0]=l(3/(u[0]*u[0]),s[0]),m[0].push(0,0),m[1].push(0,1),m[2].push(2/u[0],1/u[0]);break;case"string":a[0]=f(l(3/(u[i-2]*u[i-2]),s[i-2]),l(3/(u[0]*u[0]),s[0])),m[0].push(0,0,0),m[1].push(i-2,0,1),m[2].push(1/u[i-2],2/u[i-2]+2/u[0],1/u[0]);break;default:a[0]=n,m[0].push(0),m[1].push(0),m[2].push(1)}for(o=1;o<i-1;o++)a[o]=f(l(3/(u[o-1]*u[o-1]),s[o-1]),l(3/(u[o]*u[o]),s[o])),m[0].push(o,o,o),m[1].push(o-1,o,o+1),m[2].push(1/u[o-1],2/u[o-1]+2/u[o],1/u[o]);switch(typeof r){case"undefined":a[i-1]=l(3/(u[i-2]*u[i-2]),s[i-2]),m[0].push(i-1,i-1),m[1].push(i-2,i-1),m[2].push(1/u[i-2],2/u[i-2]);break;case"string":m[1][m[1].length-1]=0;break;default:a[i-1]=r,m[0].push(i-1),m[1].push(i-1),m[2].push(1)}a="number"!=typeof a[0]?numeric.transpose(a):[a];var h=Array(a.length);if("string"==typeof n)for(o=h.length-1;-1!==o;--o)h[o]=numeric.ccsLUPSolve(numeric.ccsLUP(numeric.ccsScatter(m)),a[o]),h[o][i-1]=h[o][0];else for(o=h.length-1;-1!==o;--o)h[o]=numeric.cLUsolve(numeric.cLU(m),a[o]);return h="number"==typeof t[0]?h[0]:numeric.transpose(h),new numeric.Spline(e,t,t,h,h)},numeric.fftpow2=function e(t,n){var r=t.length;if(1!==r){var o,i,a=Math.cos,u=Math.sin,s=Array(r/2),c=Array(r/2),l=Array(r/2),f=Array(r/2);for(i=r/2,o=r-1;-1!==o;--o)l[--i]=t[o],f[i]=n[o],--o,s[i]=t[o],c[i]=n[o];e(s,c),e(l,f),i=r/2;var m,h,d,p=-6.283185307179586/r;for(o=r-1;-1!==o;--o)-1==--i&&(i=r/2-1),h=a(m=p*o),d=u(m),t[o]=s[i]+h*l[i]-d*f[i],n[o]=c[i]+h*f[i]+d*l[i]}},numeric._ifftpow2=function e(t,n){var r=t.length;if(1!==r){var o,i,a=Math.cos,u=Math.sin,s=Array(r/2),c=Array(r/2),l=Array(r/2),f=Array(r/2);for(i=r/2,o=r-1;-1!==o;--o)l[--i]=t[o],f[i]=n[o],--o,s[i]=t[o],c[i]=n[o];e(s,c),e(l,f),i=r/2;var m,h,d,p=6.283185307179586/r;for(o=r-1;-1!==o;--o)-1==--i&&(i=r/2-1),h=a(m=p*o),d=u(m),t[o]=s[i]+h*l[i]-d*f[i],n[o]=c[i]+h*f[i]+d*l[i]}},numeric.ifftpow2=function(e,t){numeric._ifftpow2(e,t),numeric.diveq(e,e.length),numeric.diveq(t,t.length)},numeric.convpow2=function(e,t,n,r){var o,i,a,u,s;for(numeric.fftpow2(e,t),numeric.fftpow2(n,r),o=e.length-1;-1!==o;--o)i=e[o],u=t[o],a=n[o],s=r[o],e[o]=i*a-u*s,t[o]=i*s+u*a;numeric.ifftpow2(e,t)},numeric.T.prototype.fft=function(){var e,t,n=this.x,r=this.y,o=n.length,i=Math.log,a=i(2),u=Math.ceil(i(2*o-1)/a),s=Math.pow(2,u),c=numeric.rep([s],0),l=numeric.rep([s],0),f=Math.cos,m=Math.sin,h=-3.141592653589793/o,d=numeric.rep([s],0),p=numeric.rep([s],0);for(Math.floor(o/2),e=0;e<o;e++)d[e]=n[e];if(void 0!==r)for(e=0;e<o;e++)p[e]=r[e];for(c[0]=1,e=1;e<=s/2;e++)t=h*e*e,c[e]=f(t),l[e]=m(t),c[s-e]=f(t),l[s-e]=m(t);var g=new numeric.T(d,p),v=new numeric.T(c,l);return g=g.mul(v),numeric.convpow2(g.x,g.y,numeric.clone(v.x),numeric.neg(v.y)),(g=g.mul(v)).x.length=o,g.y.length=o,g},numeric.T.prototype.ifft=function(){var e,t,n=this.x,r=this.y,o=n.length,i=Math.log,a=i(2),u=Math.ceil(i(2*o-1)/a),s=Math.pow(2,u),c=numeric.rep([s],0),l=numeric.rep([s],0),f=Math.cos,m=Math.sin,h=3.141592653589793/o,d=numeric.rep([s],0),p=numeric.rep([s],0);for(Math.floor(o/2),e=0;e<o;e++)d[e]=n[e];if(void 0!==r)for(e=0;e<o;e++)p[e]=r[e];for(c[0]=1,e=1;e<=s/2;e++)t=h*e*e,c[e]=f(t),l[e]=m(t),c[s-e]=f(t),l[s-e]=m(t);var g=new numeric.T(d,p),v=new numeric.T(c,l);return g=g.mul(v),numeric.convpow2(g.x,g.y,numeric.clone(v.x),numeric.neg(v.y)),(g=g.mul(v)).x.length=o,g.y.length=o,g.div(o)},numeric.gradient=function(e,t){var n=t.length,r=e(t);if(isNaN(r))throw new Error("gradient: f(x) is a NaN!");var o,i,a,u,s,c,l,f,m,h=Math.max,d=numeric.clone(t),p=Array(n),g=(numeric.div,numeric.sub,h=Math.max,Math.abs),v=Math.min,y=0;for(o=0;o<n;o++)for(var A=h(1e-6*r,1e-8);;){if(++y>20)throw new Error("Numerical gradient fails");if(d[o]=t[o]+A,i=e(d),d[o]=t[o]-A,a=e(d),d[o]=t[o],isNaN(i)||isNaN(a))A/=16;else{if(p[o]=(i-a)/(2*A),u=t[o]-A,s=t[o],c=t[o]+A,l=(i-r)/A,f=(r-a)/A,m=h(g(p[o]),g(r),g(i),g(a),g(u),g(s),g(c),1e-8),!(v(h(g(l-p[o]),g(f-p[o]),g(l-f))/m,A/m)>.001))break;A/=16}}return p},numeric.uncmin=function(e,t,n,r,o,i,a){var u=numeric.gradient;void 0===a&&(a={}),void 0===n&&(n=1e-8),void 0===r&&(r=function(t){return u(e,t)}),void 0===o&&(o=1e3);var s,c,l=(t=numeric.clone(t)).length,f=e(t);if(isNaN(f))throw new Error("uncmin: f(x0) is a NaN!");var m=Math.max,h=numeric.norm2;n=m(n,numeric.epsilon);var d,p,g,v,y,A,x,w,b,C,T=a.Hinv||numeric.identity(l),_=numeric.dot,S=(numeric.inv,numeric.sub),I=numeric.add,O=numeric.tensor,k=numeric.div,E=numeric.mul,M=numeric.all,B=numeric.isFinite,N=numeric.neg,R=0,L="";for(p=r(t);R<o;){if("function"==typeof i&&i(R,t,f,p,T)){L="Callback returned true";break}if(!M(B(p))){L="Gradient has Infinity or NaN";break}if(!M(B(d=N(_(T,p))))){L="Search direction has Infinity or NaN";break}if((C=h(d))<n){L="Newton step smaller than tol";break}for(b=1,c=_(p,d),y=t;R<o&&!(b*C<n)&&(y=I(t,v=E(d,b)),(s=e(y))-f>=.1*b*c||isNaN(s));)b*=.5,++R;if(b*C<n){L="Line search step size smaller than tol";break}if(R===o){L="maxit reached during line search";break}w=_(A=S(g=r(y),p),v),x=_(T,A),T=S(I(T,E((w+_(A,x))/(w*w),O(v,v))),k(I(O(x,v),O(v,x)),w)),t=y,f=s,p=g,++R}return{solution:t,f,gradient:p,invHessian:T,iterations:R,message:L}},numeric.Dopri=function(e,t,n,r,o,i,a){this.x=e,this.y=t,this.f=n,this.ymid=r,this.iterations=o,this.events=a,this.message=i},numeric.Dopri.prototype._at=function(e,t){function n(e){return e*e}var r,o,i,a,u,s,c,l,f,m=this,h=m.x,d=m.y,p=m.f,g=m.ymid,v=(h.length,Math.floor,numeric.add),y=numeric.mul,A=numeric.sub;return r=h[t],o=h[t+1],a=d[t],u=d[t+1],i=r+.5*(o-r),s=g[t],c=A(p[t],y(a,1/(r-i)+2/(r-o))),l=A(p[t+1],y(u,1/(o-i)+2/(o-r))),v(v(v(v(y(a,(f=[n(e-o)*(e-i)/n(r-o)/(r-i),n(e-r)*n(e-o)/n(r-i)/n(o-i),n(e-r)*(e-i)/n(o-r)/(o-i),(e-r)*n(e-o)*(e-i)/n(r-o)/(r-i),(e-o)*n(e-r)*(e-i)/n(r-o)/(o-i)])[0]),y(s,f[1])),y(u,f[2])),y(c,f[3])),y(l,f[4]))},numeric.Dopri.prototype.at=function(e){var t,n,r,o=Math.floor;if("number"!=typeof e){var i=e.length,a=Array(i);for(t=i-1;-1!==t;--t)a[t]=this.at(e[t]);return a}var u=this.x;for(t=0,n=u.length-1;n-t>1;)u[r=o(.5*(t+n))]<=e?t=r:n=r;return this._at(e,t)},numeric.dopri=function(e,t,n,r,o,i,a){void 0===o&&(o=1e-6),void 0===i&&(i=1e3);var u,s,c,l,f,m,h,d,p,g,v,y,A,x=[e],w=[n],b=[r(e,n)],C=[],T=[.075,.225],_=[44/45,-56/15,32/9],S=[19372/6561,-25360/2187,64448/6561,-212/729],I=[9017/3168,-355/33,46732/5247,49/176,-5103/18656],O=[35/384,0,500/1113,125/192,-2187/6784,11/84],k=[.10013431883002395,0,.3918321794184259,-.02982460176594817,.05893268337240795,-.04497888809104361,.023904308236133973],E=[.2,.3,.8,8/9,1,1],M=[-71/57600,0,71/16695,-71/1920,17253/339200,-22/525,.025],B=0,N=(t-e)/10,R=0,L=numeric.add,P=numeric.mul,j=(Math.max,Math.min),q=Math.abs,F=numeric.norminf,D=Math.pow,V=numeric.any,Y=numeric.lt,U=numeric.and,G=(numeric.sub,new numeric.Dopri(x,w,b,C,-1,""));for("function"==typeof a&&(v=a(e,n));e<t&&R<i;)if(++R,e+N>t&&(N=t-e),u=r(e+E[0]*N,L(n,P(.2*N,b[B]))),s=r(e+E[1]*N,L(L(n,P(T[0]*N,b[B])),P(T[1]*N,u))),c=r(e+E[2]*N,L(L(L(n,P(_[0]*N,b[B])),P(_[1]*N,u)),P(_[2]*N,s))),l=r(e+E[3]*N,L(L(L(L(n,P(S[0]*N,b[B])),P(S[1]*N,u)),P(S[2]*N,s)),P(S[3]*N,c))),f=r(e+E[4]*N,L(L(L(L(L(n,P(I[0]*N,b[B])),P(I[1]*N,u)),P(I[2]*N,s)),P(I[3]*N,c)),P(I[4]*N,l))),m=r(e+N,p=L(L(L(L(L(n,P(b[B],N*O[0])),P(s,N*O[2])),P(c,N*O[3])),P(l,N*O[4])),P(f,N*O[5]))),(g="number"==typeof(h=L(L(L(L(L(P(b[B],N*M[0]),P(s,N*M[2])),P(c,N*M[3])),P(l,N*M[4])),P(f,N*M[5])),P(m,N*M[6])))?q(h):F(h))>o){if(e+(N=.2*N*D(o/g,.25))===e){G.msg="Step size became too small";break}}else{if(C[B]=L(L(L(L(L(L(n,P(b[B],N*k[0])),P(s,N*k[2])),P(c,N*k[3])),P(l,N*k[4])),P(f,N*k[5])),P(m,N*k[6])),x[++B]=e+N,w[B]=p,b[B]=m,"function"==typeof a){var X,W,H=e,z=e+.5*N;if(y=a(z,C[B-1]),V(A=U(Y(v,0),Y(0,y)))||(H=z,v=y,y=a(z=e+N,p),A=U(Y(v,0),Y(0,y))),V(A)){for(var $,K,Q=0,Z=1,J=1;;){if("number"==typeof v)W=(J*y*H-Z*v*z)/(J*y-Z*v);else for(W=z,d=v.length-1;-1!==d;--d)v[d]<0&&y[d]>0&&(W=j(W,(J*y[d]*H-Z*v[d]*z)/(J*y[d]-Z*v[d])));if(W<=H||W>=z)break;K=a(W,X=G._at(W,B-1)),V($=U(Y(v,0),Y(0,K)))?(z=W,y=K,A=$,J=1,-1===Q?Z*=.5:Z=1,Q=-1):(H=W,v=K,Z=1,1===Q?J*=.5:J=1,Q=1)}return p=G._at(.5*(e+W),B-1),G.f[B]=r(W,X),G.x[B]=W,G.y[B]=X,G.ymid[B-1]=p,G.events=A,G.iterations=R,G}}e+=N,n=p,v=y,N=j(.8*N*D(o/g,.25),4*N)}return G.iterations=R,G},numeric.LU=function(e,t){t=t||!1;var n,r,o,i,a,u,s,c,l,f=Math.abs,m=e.length,h=m-1,d=new Array(m);for(t||(e=numeric.clone(e)),o=0;o<m;++o){for(s=o,l=f((u=e[o])[o]),r=o+1;r<m;++r)l<(i=f(e[r][o]))&&(l=i,s=r);for(d[o]=s,s!=o&&(e[o]=e[s],e[s]=u,u=e[o]),a=u[o],n=o+1;n<m;++n)e[n][o]/=a;for(n=o+1;n<m;++n){for(c=e[n],r=o+1;r<h;++r)c[r]-=c[o]*u[r],c[++r]-=c[o]*u[r];r===h&&(c[r]-=c[o]*u[r])}}return{LU:e,P:d}},numeric.LUsolve=function(e,t){var n,r,o,i,a,u=e.LU,s=u.length,c=numeric.clone(t),l=e.P;for(n=s-1;-1!==n;--n)c[n]=t[n];for(n=0;n<s;++n)for(o=l[n],l[n]!==n&&(a=c[n],c[n]=c[o],c[o]=a),i=u[n],r=0;r<n;++r)c[n]-=c[r]*i[r];for(n=s-1;n>=0;--n){for(i=u[n],r=n+1;r<s;++r)c[n]-=c[r]*i[r];c[n]/=i[n]}return c},numeric.solve=function(e,t,n){return numeric.LUsolve(numeric.LU(e,n),t)},numeric.echelonize=function(e){var t,n,r,o,i,a,u,s,c=numeric.dim(e),l=c[0],f=c[1],m=numeric.identity(l),h=Array(l),d=Math.abs,p=numeric.diveq;for(e=numeric.clone(e),t=0;t<l;++t){for(r=0,i=e[t],a=m[t],n=1;n<f;++n)d(i[r])<d(i[n])&&(r=n);for(h[t]=r,p(a,i[r]),p(i,i[r]),n=0;n<l;++n)if(n!==t){for(s=(u=e[n])[r],o=f-1;-1!==o;--o)u[o]-=i[o]*s;for(u=m[n],o=l-1;-1!==o;--o)u[o]-=a[o]*s}}return{I:m,A:e,P:h}},numeric.__solveLP=function(e,t,n,r,o,i,a){var u,s,c,l,f=numeric.sum,m=(numeric.log,numeric.mul),h=numeric.sub,d=numeric.dot,p=numeric.div,g=numeric.add,v=e.length,y=n.length,A=!1,x=1,w=(numeric.transpose(t),numeric.svd,numeric.transpose),b=(numeric.leq,Math.sqrt),C=Math.abs,T=(numeric.muleq,numeric.norminf,numeric.any,Math.min),_=numeric.all,S=numeric.gt,I=Array(v),O=Array(y),k=(numeric.rep([y],1),numeric.solve),E=h(n,d(t,i)),M=d(e,e);for(c=0;c<o;++c){var B,N;for(B=y-1;-1!==B;--B)O[B]=p(t[B],E[B]);var R=w(O);for(B=v-1;-1!==B;--B)I[B]=f(R[B]);x=.25*C(M/d(e,I));var L=100*b(M/d(I,I));for((!isFinite(x)||x>L)&&(x=L),l=g(e,m(x,I)),s=d(R,O),B=v-1;-1!==B;--B)s[B][B]+=1;N=k(s,p(l,x),!0);var P=p(E,d(t,N)),j=1;for(B=y-1;-1!==B;--B)P[B]<0&&(j=T(j,-.999*P[B]));if(u=h(i,m(N,j)),!_(S(E=h(n,d(t,u)),0)))return{solution:i,message:"",iterations:c};if(i=u,x<r)return{solution:u,message:"",iterations:c};if(a){var q=d(e,l),F=d(t,l);for(A=!0,B=y-1;-1!==B;--B)if(q*F[B]<0){A=!1;break}}else A=!(i[v-1]>=0);if(A)return{solution:u,message:"Unbounded",iterations:c}}return{solution:i,message:"maximum iteration count exceeded",iterations:c}},numeric._solveLP=function(e,t,n,r,o){var i=e.length,a=n.length,u=(numeric.sum,numeric.log,numeric.mul,numeric.sub),s=numeric.dot,c=(numeric.div,numeric.add,numeric.rep([i],0).concat([1])),l=numeric.rep([a,1],-1),f=numeric.blockMatrix([[t,l]]),m=n,h=numeric.rep([i],0).concat(Math.max(0,numeric.sup(numeric.neg(n)))+1),d=numeric.__solveLP(c,f,m,r,o,h,!1),p=numeric.clone(d.solution);if(p.length=i,numeric.inf(u(n,s(t,p)))<0)return{solution:NaN,message:"Infeasible",iterations:d.iterations};var g=numeric.__solveLP(e,t,n,r,o-d.iterations,p,!0);return g.iterations+=d.iterations,g},numeric.solveLP=function(e,t,n,r,o,i,a){if(void 0===a&&(a=1e3),void 0===i&&(i=numeric.epsilon),void 0===r)return numeric._solveLP(e,t,n,i,a);var u,s=r.length,c=r[0].length,l=t.length,f=numeric.echelonize(r),m=numeric.rep([c],0),h=f.P,d=[];for(u=h.length-1;-1!==u;--u)m[h[u]]=1;for(u=c-1;-1!==u;--u)0===m[u]&&d.push(u);var p=numeric.getRange,g=numeric.linspace(0,s-1),v=numeric.linspace(0,l-1),y=p(r,g,d),A=p(t,v,h),x=p(t,v,d),w=numeric.dot,b=numeric.sub,C=w(A,f.I),T=b(x,w(C,y)),_=b(n,w(C,o)),S=Array(h.length),I=Array(d.length);for(u=h.length-1;-1!==u;--u)S[u]=e[h[u]];for(u=d.length-1;-1!==u;--u)I[u]=e[d[u]];var O=b(I,w(S,w(f.I,y))),k=numeric._solveLP(O,T,_,i,a),E=k.solution;if(E!=E)return k;var M=w(f.I,b(o,w(y,E))),B=Array(e.length);for(u=h.length-1;-1!==u;--u)B[h[u]]=M[u];for(u=d.length-1;-1!==u;--u)B[d[u]]=E[u];return{solution:B,message:k.message,iterations:k.iterations}},numeric.MPStoLP=function(e){function t(t){throw new Error("MPStoLP: "+t+"\nLine "+n+": "+e[n]+"\nCurrent state: "+u[a]+"\n")}e instanceof String&&e.split("\n");var n,r,o,i,a=0,u=["Initial state","NAME","ROWS","COLUMNS","RHS","BOUNDS","ENDATA"],s=e.length,c=0,l={},f=[],m=0,h={},d=0,p=[],g=[],v=[];for(n=0;n<s;++n){var y=(o=e[n]).match(/\S*/g),A=[];for(r=0;r<y.length;++r)""!==y[r]&&A.push(y[r]);if(0!==A.length){for(r=0;r<u.length&&o.substr(0,u[r].length)!==u[r];++r);if(r<u.length){if(a=r,1===r&&(i=A[1]),6===r)return{name:i,c:p,A:numeric.transpose(g),b:v,rows:l,vars:h}}else switch(a){case 0:case 1:t("Unexpected line");case 2:switch(A[0]){case"N":0===c?c=A[1]:t("Two or more N rows");break;case"L":l[A[1]]=m,f[m]=1,v[m]=0,++m;break;case"G":l[A[1]]=m,f[m]=-1,v[m]=0,++m;break;case"E":l[A[1]]=m,f[m]=0,v[m]=0,++m;break;default:t("Parse error "+numeric.prettyPrint(A))}break;case 3:h.hasOwnProperty(A[0])||(h[A[0]]=d,p[d]=0,g[d]=numeric.rep([m],0),++d);var x=h[A[0]];for(r=1;r<A.length;r+=2)if(A[r]!==c){var w=l[A[r]];g[x][w]=(f[w]<0?-1:1)*parseFloat(A[r+1])}else p[x]=parseFloat(A[r+1]);break;case 4:for(r=1;r<A.length;r+=2)v[l[A[r]]]=(f[l[A[r]]]<0?-1:1)*parseFloat(A[r+1]);break;case 5:break;case 6:t("Internal error")}}}t("Reached end of file without ENDATA")},numeric.seedrandom={pow:Math.pow,random:Math.random},function(e,t,n,r,o,i,a){function u(e){var t,r,o=this,i=e.length,a=0,u=o.i=o.j=o.m=0;for(o.S=[],o.c=[],i||(e=[i++]);a<n;)o.S[a]=a++;for(a=0;a<n;a++)u=l(u+(t=o.S[a])+e[a%i]),r=o.S[u],o.S[a]=r,o.S[u]=t;o.g=function(e){var t=o.S,r=l(o.i+1),i=t[r],a=l(o.j+i),u=t[a];t[r]=u,t[a]=i;for(var s=t[l(i+u)];--e;)r=l(r+1),u=t[a=l(a+(i=t[r]))],t[r]=u,t[a]=i,s=s*n+t[l(i+u)];return o.i=r,o.j=a,s},o.g(n)}function s(e,t,n,r,o){if(n=[],o=typeof e,t&&"object"==o)for(r in e)if(r.indexOf("S")<5)try{n.push(s(e[r],t-1))}catch(e){}return n.length?n:e+("string"!=o?"\0":"")}function c(e,t,n,r){for(e+="",n=0,r=0;r<e.length;r++)t[l(r)]=l((n^=19*t[l(r)])+e.charCodeAt(r));for(r in e="",t)e+=String.fromCharCode(t[r]);return e}function l(e){return e&n-1}t.seedrandom=function(r,l){var f,m=[];return r=c(s(l?[r,e]:arguments.length?r:[(new Date).getTime(),e,window],3),m),c((f=new u(m)).S,e),t.random=function(){for(var e=f.g(6),t=a,r=0;e<o;)e=(e+r)*n,t*=n,r=f.g(1);for(;e>=i;)e/=2,t/=2,r>>>=1;return(e+r)/t},r},a=t.pow(n,6),o=t.pow(2,o),i=2*o,c(t.random(),e)}([],numeric.seedrandom,256,0,52),function(e){function t(e){if("object"!=typeof e)return e;var n,r=[],o=e.length;for(n=0;n<o;n++)r[n+1]=t(e[n]);return r}function n(e){if("object"!=typeof e)return e;var t,r=[],o=e.length;for(t=1;t<o;t++)r[t-1]=n(e[t]);return r}e.solveQP=function(e,r,o,i,a,u){e=t(e),r=t(r),o=t(o);var s,c,l,f,m,h=[],d=[],p=[],g=[],v=[];if(a=a||0,u=u?t(u):[void 0,0],i=i?t(i):[],c=e.length-1,l=o[1].length-1,!i)for(s=1;s<=l;s+=1)i[s]=0;for(s=1;s<=l;s+=1)d[s]=0;for(f=Math.min(c,l),s=1;s<=c;s+=1)p[s]=0;for(h[1]=0,s=1;s<=2*c+f*(f+5)/2+2*l+1;s+=1)g[s]=0;for(s=1;s<=2;s+=1)v[s]=0;return function(e,t,n,r,o,i,a,u,s,c,l,f,m,h,d,p){function g(){for(h[1]=h[1]+1,C=E,w=1;w<=c;w+=1){for(C+=1,P=-u[w],b=1;b<=r;b+=1)P+=a[b][w]*o[b];if(Math.abs(P)<G&&(P=0),w>l)d[C]=P;else if(d[C]=-Math.abs(P),P>0){for(b=1;b<=r;b+=1)a[b][w]=-a[b][w];u[w]=-u[w]}}for(w=1;w<=m;w+=1)d[E+f[w]]=0;for(B=0,L=0,w=1;w<=c;w+=1)d[E+w]<L*d[R+w]&&(B=w,L=d[E+w]/d[R+w]);return 0===B?999:0}function v(){for(w=1;w<=r;w+=1){for(P=0,b=1;b<=r;b+=1)P+=e[b][w]*a[b][B];d[w]=P}for(T=I,w=1;w<=r;w+=1)d[T+w]=0;for(b=m+1;b<=r;b+=1)for(w=1;w<=r;w+=1)d[T+w]=d[T+w]+e[w][b]*d[b];for(Y=!0,w=m;w>=1;w-=1){for(P=d[w],T=(C=k+w*(w+3)/2)-w,b=w+1;b<=m;b+=1)P-=d[C]*d[O+b],C+=b;if(P/=d[T],d[O+w]=P,f[w]<l)break;if(P<0)break;Y=!1,S=w}if(!Y)for(j=d[M+S]/d[O+S],w=1;w<=m&&!(f[w]<l)&&!(d[O+w]<0);w+=1)(L=d[M+w]/d[O+w])<j&&(j=L,S=w);for(P=0,w=I+1;w<=I+r;w+=1)P+=d[w]*d[w];if(Math.abs(P)<=G){if(Y)return p[1]=1,999;for(w=1;w<=m;w+=1)d[M+w]=d[M+w]-j*d[O+w];return d[M+m+1]=d[M+m+1]+j,700}for(P=0,w=1;w<=r;w+=1)P+=d[I+w]*a[w][B];for(q=-d[E+B]/P,U=!0,Y||j<q&&(q=j,U=!1),w=1;w<=r;w+=1)o[w]=o[w]+q*d[I+w],Math.abs(o[w])<G&&(o[w]=0);for(i[1]=i[1]+q*P*(q/2+d[M+m+1]),w=1;w<=m;w+=1)d[M+w]=d[M+w]-q*d[O+w];if(d[M+m+1]=d[M+m+1]+q,!U){for(P=-u[B],b=1;b<=r;b+=1)P+=o[b]*a[b][B];if(B>l)d[E+B]=P;else if(d[E+B]=-Math.abs(P),P>0){for(b=1;b<=r;b+=1)a[b][B]=-a[b][B];u[B]=-u[B]}return 700}for(f[m+=1]=B,C=k+(m-1)*m/2+1,w=1;w<=m-1;w+=1)d[C]=d[w],C+=1;if(m===r)d[C]=d[r];else{for(w=r;w>=m+1&&0!==d[w]&&(F=Math.max(Math.abs(d[w-1]),Math.abs(d[w])),D=Math.min(Math.abs(d[w-1]),Math.abs(d[w])),L=d[w-1]>=0?Math.abs(F*Math.sqrt(1+D*D/(F*F))):-Math.abs(F*Math.sqrt(1+D*D/(F*F))),F=d[w-1]/L,D=d[w]/L,1!==F);w-=1)if(0===F)for(d[w-1]=D*L,b=1;b<=r;b+=1)L=e[b][w-1],e[b][w-1]=e[b][w],e[b][w]=L;else for(d[w-1]=L,V=D/(1+F),b=1;b<=r;b+=1)L=F*e[b][w-1]+D*e[b][w],e[b][w]=V*(e[b][w-1]+L)-e[b][w],e[b][w-1]=L;d[C]=d[m]}return 0}function y(){if(0===d[T=(C=k+S*(S+1)/2+1)+S])return 798;if(F=Math.max(Math.abs(d[T-1]),Math.abs(d[T])),D=Math.min(Math.abs(d[T-1]),Math.abs(d[T])),L=d[T-1]>=0?Math.abs(F*Math.sqrt(1+D*D/(F*F))):-Math.abs(F*Math.sqrt(1+D*D/(F*F))),F=d[T-1]/L,D=d[T]/L,1===F)return 798;if(0===F){for(w=S+1;w<=m;w+=1)L=d[T-1],d[T-1]=d[T],d[T]=L,T+=w;for(w=1;w<=r;w+=1)L=e[w][S],e[w][S]=e[w][S+1],e[w][S+1]=L}else{for(V=D/(1+F),w=S+1;w<=m;w+=1)L=F*d[T-1]+D*d[T],d[T]=V*(d[T-1]+L)-d[T],d[T-1]=L,T+=w;for(w=1;w<=r;w+=1)L=F*e[w][S]+D*e[w][S+1],e[w][S+1]=V*(e[w][S]+L)-e[w][S+1],e[w][S]=L}return 0}function A(){for(T=C-S,w=1;w<=S;w+=1)d[T]=d[C],C+=1,T+=1;return d[M+S]=d[M+S+1],f[S]=f[S+1],(S+=1)<m?797:0}function x(){return d[M+m]=d[M+m+1],d[M+m+1]=0,f[m]=0,m-=1,h[2]=h[2]+1,0}var w,b,C,T,_,S,I,O,k,E,M,B,N,R,L,P,j,q,F,D,V,Y,U,G,X,W,H;N=Math.min(r,c),C=2*r+N*(N+5)/2+2*c+1,G=1e-60;do{X=1+.1*(G+=G),W=1+.2*G}while(X<=1||W<=1);for(w=1;w<=r;w+=1)d[w]=t[w];for(w=r+1;w<=C;w+=1)d[w]=0;for(w=1;w<=c;w+=1)f[w]=0;if(_=[],0===p[1]){if(function(e,t,n,r){var o,i,a,u,s,c;for(i=1;i<=n;i+=1){if(r[1]=i,c=0,(a=i-1)<1){if((c=e[i][i]-c)<=0)break;e[i][i]=Math.sqrt(c)}else{for(u=1;u<=a;u+=1){for(s=e[u][i],o=1;o<u;o+=1)s-=e[o][i]*e[o][u];s/=e[u][u],e[u][i]=s,c+=s*s}if((c=e[i][i]-c)<=0)break;e[i][i]=Math.sqrt(c)}r[1]=0}}(e,0,r,_),0!==_[1])return void(p[1]=2);(function(e,t,n,r){var o,i,a,u;for(i=1;i<=n;i+=1){for(u=0,o=1;o<i;o+=1)u+=e[o][i]*r[o];r[i]=(r[i]-u)/e[i][i]}for(a=1;a<=n;a+=1)for(r[i=n+1-a]=r[i]/e[i][i],u=-r[i],o=1;o<i;o+=1)r[o]=r[o]+u*e[o][i]})(e,0,r,t),function(e,t,n){var r,o,i,a,u;for(i=1;i<=n;i+=1){for(e[i][i]=1/e[i][i],u=-e[i][i],r=1;r<i;r+=1)e[r][i]=u*e[r][i];if(n<(a=i+1))break;for(o=a;o<=n;o+=1)for(u=e[i][o],e[i][o]=0,r=1;r<=i;r+=1)e[r][o]=e[r][o]+u*e[r][i]}}(e,0,r)}else{for(b=1;b<=r;b+=1)for(o[b]=0,w=1;w<=b;w+=1)o[b]=o[b]+e[w][b]*t[w];for(b=1;b<=r;b+=1)for(t[b]=0,w=b;w<=r;w+=1)t[b]=t[b]+e[b][w]*o[w]}for(i[1]=0,b=1;b<=r;b+=1)for(o[b]=t[b],i[1]=i[1]+d[b]*o[b],d[b]=0,w=b+1;w<=r;w+=1)e[w][b]=0;for(i[1]=-i[1]/2,p[1]=0,R=(E=(k=(M=(O=(I=r)+r)+N)+N+1)+N*(N+1)/2)+c,w=1;w<=c;w+=1){for(P=0,b=1;b<=r;b+=1)P+=a[b][w]*a[b][w];d[R+w]=Math.sqrt(P)}for(m=0,h[1]=0,h[2]=0,H=0;;){if(999===(H=g()))return;for(;0!==(H=v());){if(999===H)return;if(700===H)if(S===m)x();else{for(;y(),797===(H=A()););x()}}}}(e,r,0,c,p,h,o,i,0,l,a,d,0,v,g,u),m="",1===u[1]&&(m="constraints are inconsistent, no solution!"),2===u[1]&&(m="matrix D in quadratic function is not positive definite!"),{solution:n(p),value:n(h),unconstrained_solution:n(r),iterations:n(v),iact:n(d),message:m}}}(numeric),numeric.svd=function(e){function t(e,t){return(e=Math.abs(e))>(t=Math.abs(t))?e*Math.sqrt(1+t*t/e/e):0==t?e:t*Math.sqrt(1+e*e/t/t)}var n,r=numeric.epsilon,o=1e-64/r,i=0,a=0,u=0,s=0,c=0,l=numeric.clone(e),f=l.length,m=l[0].length;if(f<m)throw"Need more rows than columns";var h=new Array(m),d=new Array(m);for(a=0;a<m;a++)h[a]=d[a]=0;var p=numeric.rep([m,m],0),g=0,v=0,y=0,A=0,x=0,w=0,b=0;for(a=0;a<m;a++){for(h[a]=v,b=0,c=a+1,u=a;u<f;u++)b+=l[u][a]*l[u][a];if(b<=o)v=0;else for(g=l[a][a],v=Math.sqrt(b),g>=0&&(v=-v),y=g*v-b,l[a][a]=g-v,u=c;u<m;u++){for(b=0,s=a;s<f;s++)b+=l[s][a]*l[s][u];for(g=b/y,s=a;s<f;s++)l[s][u]+=g*l[s][a]}for(d[a]=v,b=0,u=c;u<m;u++)b+=l[a][u]*l[a][u];if(b<=o)v=0;else{for(g=l[a][a+1],v=Math.sqrt(b),g>=0&&(v=-v),y=g*v-b,l[a][a+1]=g-v,u=c;u<m;u++)h[u]=l[a][u]/y;for(u=c;u<f;u++){for(b=0,s=c;s<m;s++)b+=l[u][s]*l[a][s];for(s=c;s<m;s++)l[u][s]+=b*h[s]}}(x=Math.abs(d[a])+Math.abs(h[a]))>A&&(A=x)}for(a=m-1;-1!=a;a+=-1){if(0!=v){for(y=v*l[a][a+1],u=c;u<m;u++)p[u][a]=l[a][u]/y;for(u=c;u<m;u++){for(b=0,s=c;s<m;s++)b+=l[a][s]*p[s][u];for(s=c;s<m;s++)p[s][u]+=b*p[s][a]}}for(u=c;u<m;u++)p[a][u]=0,p[u][a]=0;p[a][a]=1,v=h[a],c=a}for(a=m-1;-1!=a;a+=-1){for(c=a+1,v=d[a],u=c;u<m;u++)l[a][u]=0;if(0!=v){for(y=l[a][a]*v,u=c;u<m;u++){for(b=0,s=c;s<f;s++)b+=l[s][a]*l[s][u];for(g=b/y,s=a;s<f;s++)l[s][u]+=g*l[s][a]}for(u=a;u<f;u++)l[u][a]=l[u][a]/v}else for(u=a;u<f;u++)l[u][a]=0;l[a][a]+=1}for(r*=A,s=m-1;-1!=s;s+=-1)for(var C=0;C<50;C++){var T=!1;for(c=s;-1!=c;c+=-1){if(Math.abs(h[c])<=r){T=!0;break}if(Math.abs(d[c-1])<=r)break}if(!T){i=0,b=1;var _=c-1;for(a=c;a<s+1&&(g=b*h[a],h[a]=i*h[a],!(Math.abs(g)<=r));a++)for(y=t(g,v=d[a]),d[a]=y,i=v/y,b=-g/y,u=0;u<f;u++)x=l[u][_],w=l[u][a],l[u][_]=x*i+w*b,l[u][a]=-x*b+w*i}if(w=d[s],c==s){if(w<0)for(d[s]=-w,u=0;u<m;u++)p[u][s]=-p[u][s];break}if(C>=49)throw"Error: no convergence.";for(A=d[c],v=t(g=(((x=d[s-1])-w)*(x+w)+((v=h[s-1])-(y=h[s]))*(v+y))/(2*y*x),1),g=g<0?((A-w)*(A+w)+y*(x/(g-v)-y))/A:((A-w)*(A+w)+y*(x/(g+v)-y))/A,i=1,b=1,a=c+1;a<s+1;a++){for(v=h[a],x=d[a],y=b*v,v*=i,w=t(g,y),h[a-1]=w,g=A*(i=g/w)+v*(b=y/w),v=-A*b+v*i,y=x*b,x*=i,u=0;u<m;u++)A=p[u][a-1],w=p[u][a],p[u][a-1]=A*i+w*b,p[u][a]=-A*b+w*i;for(w=t(g,y),d[a-1]=w,g=(i=g/w)*v+(b=y/w)*x,A=-b*v+i*x,u=0;u<f;u++)x=l[u][a-1],w=l[u][a],l[u][a-1]=x*i+w*b,l[u][a]=-x*b+w*i}h[c]=0,h[s]=g,d[s]=A}for(a=0;a<d.length;a++)d[a]<r&&(d[a]=0);for(a=0;a<m;a++)for(u=a-1;u>=0;u--)if(d[u]<d[a]){for(i=d[u],d[u]=d[a],d[a]=i,s=0;s<l.length;s++)n=l[s][a],l[s][a]=l[s][u],l[s][u]=n;for(s=0;s<p.length;s++)n=p[s][a],p[s][a]=p[s][u],p[s][u]=n;a=u}return{U:l,S:d,V:p}}},111:(e,t,n)=>{"use strict";function r(e){e.sort();const t=e[Math.trunc(e.length/4)],n=e.length%2==0?(e[Math.trunc(e.length/2)]+e[Math.trunc(e.length/2)-1])/2:e[Math.trunc(e.length/2)],r=e[Math.trunc(3*e.length/4)],i=1.5*(r-t);let a=o(e,r+i);a<0&&(a=~a);let u=e[Math.max(0,a-1)];u<r&&(u=r);let s=o(e,t-i);s<0&&(s=~s);let c=e[s];return c>t&&(c=t),{q1:t,q2:n,q3:r,lowerAdjacentValue:c,upperAdjacentValue:u}}function o(e,t,n=0,r){if(0===e.length)return-1;if(void 0===r&&(r=e.length-1),t<e[n])return-1;if(t>e[r])return-(r+1);for(;r-n>1;){const o=Math.trunc((r+n)/2);if(t===e[o])return o;t<e[o]?r=o:n=o}return e[n]===t?n:0===e[r]?r:t<e[n]?-(n+1):-(r+1)}n.d(t,{G:()=>r})},114:(e,t,n)=>{"use strict";n.d(t,{XD:()=>he,Qc:()=>me,vK:()=>de,d8:()=>le,yB:()=>Ae,j2:()=>ce,cY:()=>pe,js:()=>se,Kp:()=>fe,kW:()=>ve,iC:()=>Se,K0:()=>ye,ue:()=>Oe,hR:()=>Ie,ZY:()=>_e,aC:()=>ke,sw:()=>ge});var r,o,i,a,u,s,c,l,f,m,h,d,p,g,v,y,A,x,w,b,C,T,_,S,I,O,k,E,M,B,N,R,L=n(976);function P(e,t=!1){return DG.toJs(e)}function j(e){return DG.toDart(e)}(u=r||(r={})).KEY="key",u.PIVOT="pivot",u.FIRST="first",u.TOTAL_COUNT="count",u.VALUE_COUNT="values",u.UNIQUE_COUNT="unique",u.MISSING_VALUE_COUNT="nulls",u.MIN="min",u.MAX="max",u.SUM="sum",u.MED="med",u.AVG="avg",u.STDEV="stdev",u.VARIANCE="variance",u.SKEW="skew",u.KURT="kurt",u.Q1="q1",u.Q2="q2",u.Q3="q3",u.SELECTED_ROWS_COUNT="#selected",function(e){e.CONCAT_ALL="concat all",e.CONCAT_UNIQUE="concat unique",e.LONGEST="longest",e.SHORTEST="shortest",e.MOST_FREQUENT="most frequent",e.CONCAT_COUNTS="concat counts"}(o||(o={})),function(e){e.TOTAL_COUNT="count",e.VALUE_COUNT="values",e.UNIQUE_COUNT="unique",e.MISSING_VALUE_COUNT="nulls"}(i||(i={})),function(e){e.CURRENT_ROW_TO_ROW="row to row",e.CURRENT_ROW_TO_SELECTION="row to selection",e.CURRENT_ROW_TO_FILTER="row to filter",e.MOUSE_OVER_ROW_TO_SELECTION="mouse-over to selection",e.MOUSE_OVER_ROW_TO_FILTER="mouse-over to filter",e.FILTER_TO_FILTER="filter to filter",e.FILTER_TO_SELECTION="filter to selection",e.SELECTION_TO_FILTER="selection to filter",e.SELECTION_TO_SELECTION="selection to selection"}(a||(a={})),(p=s||(s={})).INNER="inner",p.OUTER="outer",p.LEFT="left",p.RIGHT="right",function(e){e.STRING="string",e.INT="int",e.FLOAT="double",e.BOOL="bool",e.BYTE_ARRAY="byte_array",e.DATE_TIME="datetime",e.BIG_INT="bigint",e.QNUM="qnum",e.DATA_FRAME="dataframe",e.OBJECT="object"}(c||(c={})),(d=l||(l={})).INT="int",d.BIG_INT="bigint",d.FLOAT="double",d.NUM="num",d.QNUM="qnum",d.BOOL="bool",d.STRING="string",d.STRING_LIST="string_list",d.DATE_TIME="datetime",d.OBJECT="object",d.BYTE_ARRAY="byte_array",d.DATA_FRAME="dataframe",d.DATA_FRAME_LIST="dataframe_list",d.CELL="cell",d.COLUMN="column",d.COLUMN_LIST="column_list",d.GRAPHICS="graphics",d.ROW_FILTER="tablerowfiltercall",d.COLUMN_FILTER="colfiltercall",d.BIT_SET="bitset",d.MAP="map",d.DYNAMIC="dynamic",d.VIEWER="viewer",d.LIST="list",d.SEM_VALUE="semantic_value",d.FUNC="func",d.FUNC_CALL="funccall",d.PROPERTY="property",d.CATEGORICAL="categorical",d.NUMERICAL="numerical",d.GRID_CELL_RENDER_ARGS="GridCellRenderArgs",d.VIEW="view",d.TABLE_VIEW="TableView",d.USER="User",d.MENU="Menu",d.PROJECT="Project",d.SEMANTIC_VALUE="semantic_value",d.EVENT_DATA="event_data",d.PROGRESS_INDICATOR="progressindicator",d.CREDENTIALS="Credentials",d.SCRIPT_ENVIRONMENT="ScriptEnvironment",d.NOTEBOOK="Notebook",f||(f={}),function(e){e.DEMO_PATH="demoPath",e.IS_DEMO_SCRIPT="isDemoScript"}(m||(m={})),function(e){e.HISTOGRAM="histogram",e.CATEGORICAL="categorical",e.MULTI_VALUE="multi-value",e.BOOL_COLUMNS="bool-columns",e.FREE_TEXT="free-text",e.COLUMN_FREE_TEXT="column-free-text",e.SUBSTRUCTURE="Chem:substructureFilter"}(h||(h={})),new Set([l.INT,l.BIG_INT,l.FLOAT,l.NUM,l.BOOL,l.STRING]),function(e){e.STRING="string",e.INT="int",e.FLOAT="double",e.BOOL="bool",e.DATE_TIME="datetime",e.BIG_INT="bigint",e.COLUMN="column",e.COLUMN_LIST="column_list",e.DATA_FRAME="dataframe"}(g||(g={})),function(e){e.TABLE_VIEW="TableView"}(v||(v={})),(R=y||(y={})).DEBUG="debug",R.INFO="info",R.WARNING="warning",R.ERROR="error",R.AUDIT="audit",R.USAGE="usage",(N=A||(A={})).HISTOGRAM="Histogram",N.BAR_CHART="Bar chart",N.BOX_PLOT="Box plot",N.CALENDAR="Calendar",N.CORR_PLOT="Correlation plot",N.DENSITY_PLOT="Density plot",N.FILTERS="Filters",N.FORM="Form",N.GLOBE="Globe",N.GRID="Grid",N.GOOGLE_MAP="Google map",N.HEAT_MAP="Heat map",N.LINE_CHART="Line chart",N.SHAPE_MAP="Shape Map",N.MARKUP="Markup",N.MATRIX_PLOT="Matrix plot",N.NETWORK_DIAGRAM="Network diagram",N.PC_PLOT="PC Plot",N.PIE_CHART="Pie chart",N.SCATTER_PLOT="Scatter plot",N.SCATTER_PLOT_3D="3d scatter plot",N.STATISTICS="Statistics",N.TILE_VIEWER="Tile Viewer",N.TREE_MAP="Tree map",N.TRELLIS_PLOT="Trellis plot",N.WORD_CLOUD="Word cloud",N.TIMELINES="TimelinesViewer",N.RADAR_VIEWER="RadarViewer",N.SURFACE_PLOT="SurfacePlot",N.SCAFFOLD_TREE="Scaffold Tree",function(e){e.LINE="Line Chart",e.AREA="Area Chart",e.BAR="Bar Chart",e.STACKED_BAR="Stacked Bar Chart",e.STACKED_AREA="Stacked Area Chart"}(x||(x={})),(B=w||(w={})).TANIMOTO="tanimoto",B.DICE="dice",B.COSINE="cosine",B.SOKAL="sokal",B.RUSSEL="russel",B.ROGOT_GOLDBERG="rogot-goldberg",B.KULCZYNSKI="kulczynski",B.MC_CONNAUGHEY="mc-connaughey",B.ASYMMETRIC="asymmetric",B.BRAUN_BLANQUET="braun-blanquet",function(e){e.Sketch="Sketch",e.Categorical="Categorical"}(b||(b={})),function(e){e.WELLS="wells",e.DEMOG="demog",e.BIOSENSOR="biosensor",e.RANDOM_WALK="random walk",e.GEO="geo",e.MOLECULES="molecules",e.DOSE_RESPONSE="dose-response"}(C||(C={})),function(e){e.LEFT="left",e.RIGHT="right",e.TOP="up",e.DOWN="down",e.FILL="fill"}(T||(T={})),function(e){e.LEFT="left",e.RIGHT="right",e.TOP="top",e.BOTTOM="bottom"}(_||(_={})),function(e){e.CATEGORICAL="Categorical",e.CONDITIONAL="Conditional",e.LINEAR="Linear",e.OFF="Off"}(S||(S={})),function(e){e.JAVASCRIPT="javascript",e.JULIA="julia",e.OCTAVE="octave",e.PYTHON="python",e.R="r",e.NODE="nodejs",e.GROK="grok"}(I||(I={})),function(e){e.CONTAINS_MISSING_VALUES="containsMissingValues",e.COLUMN_NAME="columnName",e.COLUMN_IS_NUMERICAL="columnIsNumerical",e.COLUMN_IS_CATEGORICAL="columnIsCategorical",e.NOT_EMPTY="notEmpty"}(O||(O={})),function(e){e.CIRCLE="circle",e.CIRCLE_BORDER="circle border",e.SQUARE="square",e.SQUARE_BORDER="square border",e.CROSS_BORDER="cross border",e.CROSS_X_BORDER="cross x border",e.OUTLIER="outlier",e.DIAMOND="diamond",e.DIAMOND_BORDER="diamond border",e.TRIANGLE_TOP="triangle top",e.TRIANGLE_RIGHT="triangle right",e.TRIANGLE_BOTTOM="triangle bottom",e.TRIANGLE_LEFT="triangle left",e.TRIANGLE_TOP_BORDER="triangle top border",e.TRIANGLE_RIGHT_BORDER="triangle right border",e.TRIANGLE_BOTTOM_BORDER="triangle bottom border",e.TRIANGLE_LEFT_BORDER="triangle left border",e.ASTERISK="asterisk",e.STAR="star",e.DOT="dot",e.GRADIENT="gradient"}(k||(k={})),function(e){e.STATUS_NEW="new",e.STATUS_ACTIVE="active",e.STATUS_BLOCKED="blocked",e.STATUS_GUEST="guest"}(E||(E={})),function(e){e.EDIT="Edit",e.VIEW="View",e.SHARE="Share",e.DELETE="Delete"}(M||(M={})),n(701),n(442),$,dayjs,n(126);var q=n(379),F=n.n(q),D=n(911);F()(D.Z,{insert:"head",singleton:!1}),D.Z.locals;var V=n(686);F()(V.Z,{insert:"head",singleton:!1}),V.Z.locals;var Y=n(181);F()(Y.Z,{insert:"head",singleton:!1}),Y.Z.locals;var U=n(782);F()(U.Z,{insert:"head",singleton:!1}),U.Z.locals;let G=window;class X{static getCellColor(e){return G.grok_Color_FromCell(e.dart)}static getCellColorHtml(e){return X.toHtml(X.getCellColor(e))}static getCategoryColor(e,t){return G.grok_Color_FromCategory(e.dart,t)}static a(e){return e>>24&255}static r(e){return e>>16&255}static g(e){return e>>8&255}static b(e){return 255&e}static getCategoricalColor(e){return X.categoricalPalette[e%X.categoricalPalette.length]}static getContrastColor(e){return G.grok_Color_GetContrastColor(e)}static toHtml(e){return G.grok_Color_ToHtml(e)}static fromHtml(e){return G.grok_Color_FromHtml(e)}static toRgb(e){return null===e?"":`rgb(${X.r(e)},${X.g(e)},${X.b(e)})`}static get categoricalPalette(){return G.grok_Color_CategoricalPalette()}static scaleColor(e,t,n,r,o){return G.grok_Color_ScaleColor(e,t,n,r||null,o||null)}static scale(e,t,n){return t===n?t:(e-t)/(n-t)}static get gray(){return 4286611584}static get lightLightGray(){return 4293980400}static get lightGray(){return 4292072403}static get darkGray(){return 4286808963}static get blue(){return 4278190335}static get green(){return 4278255360}static get darkGreen(){return 4278215680}static get black(){return 4278190080}static get yellow(){return 4294967040}static get white(){return 4294967295}static get red(){return 4294901760}static get darkRed(){return 4287299584}static get maroon(){return 4286578688}static get olive(){return 4286611456}static get orange(){return 4294944e3}static get darkOrange(){return 4294937600}static get lightBlue(){return 4289583334}static get darkBlue(){return 4278190240}static get purple(){return 4286578816}static get whitesmoke(){return 4294309365}static get navy(){return 4278190208}static get cyan(){return 4278255615}static get filteredRows(){return 4280252340}static get filteredOutRows(){return X.lightLightGray}static get selectedRows(){return X.darkOrange}static get missingValueRows(){return X.filteredOutRows}static get mouseOverRows(){return 4289374890}static get currentRow(){return 4281907e3}static get histogramBar(){return X.filteredRows}static get barChart(){return 4280590881}static get scatterPlotMarker(){return 4282411420}static get scatterPlotSelection(){return 2150773298}static get scatterPlotZoom(){return 2153931264}static get areaSelection(){return X.lightBlue}static get rowSelection(){return 1625087136}static get colSelection(){return 1625087136}static get areaZoom(){return 2150773298}static get gridWarningBackground(){return 4294949287}static get success(){return 4282167667}static get failure(){return 4293617511}}let W=window,H=new Float64Array(4);class z{constructor(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r}static fromPoints(e,t,n,r){let o=Math.min(e,n),i=Math.min(t,r);return new z(o,i,Math.max(e,n)-o,Math.max(t,r)-i)}static fromXYArrays(e,t){let n=e[0],r=t[0],o=e[0],i=t[0];for(let a=1;a<e.length;a++)n=Math.min(n,e[a]),r=Math.min(r,t[a]),o=Math.max(o,e[a]),i=Math.max(i,t[a]);return new z(n,r,o-n,i-r)}static fromDart(e){return W.grok_Rect_Pack(e,H),new z(H[0],H[1],H[2],H[3])}static toDart(e){return H[0]=e.x,H[1]=e.y,H[2]=e.width,H[3]=e.height,W.grok_Rect_Unpack(H)}toDart(){return H[0]=this.x,H[1]=this.y,H[2]=this.width,H[3]=this.height,W.grok_Rect_Unpack(H)}fromCenterSize(e,t,n,r){return new z(e-n/2,t-r/2,n,r)}get midX(){return this.x+this.width/2}get midY(){return this.y+this.height/2}get minX(){return this.x}get maxX(){return this.x+this.width}get minY(){return this.y}get maxY(){return this.bottom}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}move(e,t){return new z(this.x+e,this.y+t,this.width,this.height)}getTop(e){return new z(this.left,this.top,this.width,e)}getBottom(e){return new z(this.left,this.bottom-e,this.width,e)}getLeft(e){return new z(this.left,this.top,e,this.height)}getRight(e){return new z(this.right-e,this.top,e,this.height)}getTopLeft(e,t){return new z(this.left,this.top,e,t)}getTopRight(e,t){return new z(this.right-e,this.top,e,t)}getBottomLeft(e,t){return new z(this.left,this.bottom-t,e,t)}getBottomRight(e,t){return new z(this.right-e,this.bottom-t,e,t)}cutLeft(e){return new z(this.left+e,this.top,this.width-e,this.height)}cutTop(e){return new z(this.left,this.top+e,this.width,this.height-e)}cutBottom(e){return new z(this.left,this.top,this.width,this.height-e)}cutRight(e){return new z(this.left,this.top,this.width-e,this.height)}below(e){return new z(this.left,this.bottom,this.width,e)}above(e){return new z(this.left,this.top-e,this.width,e)}toTheLeft(e){return new z(this.left-e,this.top,e,this.height)}toTheRight(e){return new z(this.right,this.top,e,this.height)}toTheTop(e){return this.above(e)}toTheBottom(e){return this.below(e)}getTopScaled(e){return this.getTop(this.height*e)}getBottomScaled(e){return this.getBottom(this.height*e)}getLeftScaled(e){return this.getLeft(this.width*e)}getRightScaled(e){return this.getRight(this.width*e)}getTopPart(e,t){return new z(this.left,this.top+this.height/e*t,this.width,this.height/e)}getLeftPart(e,t){return new z(this.left+this.width/e*t,this.top,this.width/e,this.height)}getGridPart(e,t,n,r){return new z(this.left+this.width/e*n,this.top+this.height/t*r,this.width/e,this.height/r)}inflate(e,t){return new z(this.left-e,this.top-t,this.width+2*e,this.height+2*t)}inflateSize(e,t){return new z(this.left,this.top,this.width+e,this.height+t)}inflateRel(e,t){return this.inflate(this.width*(e-1),this.height*(t-1))}fitSquare(){const e=Math.min(this.width,this.height);return new z(this.left+(this.width-e)/2,this.top+(this.height-e)/2,e,e)}fit(e,t){return e/t>this.width/this.height?this.fromCenterSize(this.midX,this.midY,this.width,t*(this.width/e)):this.fromCenterSize(this.midX,this.midY,e*(this.height/t),this.height)}contains(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom}containsPoint(e){return this.contains(e.x,e.y)}union(e){return z.fromPoints(Math.min(this.minX,e.minX),Math.min(this.minY,e.minY),Math.max(this.maxX,e.maxX),Math.max(this.maxY,e.maxY))}}let K=window;var Q,Z;CanvasRenderingContext2D.prototype.setFillStyle=function(e){return this.fillStyle=e,this},CanvasRenderingContext2D.prototype.setStrokeStyle=function(e){return this.strokeStyle=e,this},CanvasRenderingContext2D.prototype.roundRect=function(e,t,n,r,o){return n<2*o&&(o=n/2),r<2*o&&(o=r/2),this.beginPath(),this.moveTo(e+o,t),this.arcTo(e+n,t,e+n,t+r,o),this.arcTo(e+n,t+r,e,t+r,o),this.arcTo(e,t+r,e,t,o),this.arcTo(e,t,e+n,t,o),this.closePath(),this},CanvasRenderingContext2D.prototype.line=function(e,t,n,r,o){return this.beginPath(),this.strokeStyle=X.toRgb(o),this.moveTo(e,t),this.lineTo(n,r),this.stroke(),this},CanvasRenderingContext2D.prototype.polygon=function(e){this.beginPath();const t=e[e.length-1];this.moveTo(t.x,t.y);for(let t of e)this.lineTo(t.x,t.y);return this.closePath(),this},function(e){function t(e,t,n,r,o,i,a,u=!1,s=!1){K.grok_Paint_HorzAxis(e,t,n,r,o,i,a,u,s)}function n(e,t,n,r,o,i,a,u=!1,s=!1){K.grok_Paint_VertAxis(e,t,n,r,o,i,a,u,s)}e.coordinateGrid=function(e,r,o,i,a){null!=o&&t(e,r.minX,r.maxX,o.x,o.y,o.width,o.height),null!=i&&n(e,r.minY,r.maxY,i.x,i.y,i.width,i.height)},e.horzAxis=t,e.vertAxis=n,e.roundRect=function(e,t,n,r,o,i){return r<2*i&&(i=r/2),o<2*i&&(i=o/2),e.beginPath(),e.moveTo(t+i,n),e.arcTo(t+r,n,t+r,n+o,i),e.arcTo(t+r,n+o,t,n+o,i),e.arcTo(t,n+o,t,n,i),e.arcTo(t,n,t+r,n,i),e.closePath(),e},e.marker=function(e,t,n,r,o,i){K.grok_Paint_Marker(e,t,n,r,o,i)},e.pngImage=function(e,t,n){let r=new FileReader;r.readAsBinaryString(new Blob([n])),r.onload=function(){let n=new Image;n.onload=function(){t=new z(t.x,t.y,t.width,t.height).fit(n.width,n.height),e.drawImage(n,t.x,t.y,t.width,t.height)},n.src="data:image/jpeg;base64,"+window.btoa(r.result)}}}(Q||(Q={})),Symbol.iterator,function(e){e.renderToCanvas=function(e,t=1){return K.grok_HtmlUtils_RenderToCanvas(e,t)},e.htmlGetBounds=function(e){return z.fromDart(K.grok_HtmlUtils_HtmlGetBounds(e))}}(Z||(Z={}));const J=new Proxy(class{constructor(e,t=null,n=null){this.dart=e,this.objectName=t,this.valueType=n}keys(){return ee(K.grok_Map_Keys(this.dart))}values(){return ee(P(K.grok_Map_Values(this.dart)))}*[Symbol.iterator](){for(let e of this.keys()){const t=P(K.grok_Map_Get(this.dart,e));yield[e,P(t)]}}entries(){return this}forEach(e){for(const[t,n]of this)e(t,P(n))}delete(e){return P(K.grok_Map_Delete(this.dart,j(e)))}get(e){return P(K.grok_Map_Get(this.dart,e))}has(e){return K.grok_Map_Has(this.dart,j(e))}set(e,t){return K.grok_Map_Set(this.dart,e,j(t)),this}clear(){K.grok_Map_Clear(this.dart)}size(){return P(K.grok_Map_Size(this.dart))}},{construct:(e,t)=>new Proxy(new e(...t),{get:function(e,t){const n=e[t];return"function"==typeof n?function(...t){return n.apply(e,t)}:P(K.grok_Map_Get(e.dart,t))},set:function(e,t,n){const r=typeof n;if(e.valueType&&e.valueType!==r)throw new Error(`Entries of ${e.objectName} require type '${e.valueType}', passed '${r}'`);return K.grok_Map_Set(e.dart,t,j(n)),!0},deleteProperty:function(e,t){return K.grok_Map_Delete(e.dart,j(t)),!0},has:function(e,t){return K.grok_Map_Has(e.dart,j(t))},getOwnPropertyDescriptor:(e,t)=>({enumerable:!0,configurable:!0}),ownKeys:function(e){return Array.from(e.keys())}})});function ee(e){let t={};return t[Symbol.iterator]=()=>function(e){let t=K.grok_Iterable_Get_Iterator(e);return{next:function(){return K.grok_Iterator_MoveNext(t)?{value:P(K.grok_Iterator_Current(t)),done:!1}:{done:!0}}}}(e),t}var te;!function(e){e.isInBenchmark=!1}(te||(te={}));class ne{}ne.Description="description",ne.CreatedBy="createdBy",ne.SemanticDetectionDuration=".semantic-detection-duration",ne.Tooltip=".tooltip",ne.TooltipVisibility=".tooltip-visibility",ne.TooltipForm=".tooltip-form",ne.RowGroupTooltip=".row-group-tooltip",ne.ValueFunction=".value-function",ne.ColorCoding=".color-coding",ne.ColorCodingType=".color-coding-type",ne.ColorCodingText=".color-coding-text",ne.ColorCodingLinear=".color-coding-linear",ne.ColorCodingConditional=".color-coding-conditional",ne.ColorCodingCategorical=".color-coding-categorical",ne.ColorCodingValueColumn=".color-coding-value-column",ne.ColorCodingSchemeMax=".color-coding-scheme-max",ne.ColorCodingSchemeMin=".color-coding-scheme-min",ne.DefaultAxisType=".default-axis-type",ne.MarkerCoding=".marker-coding",ne.HelpUrl="help.url",ne.OriginalTableName=".orig.table.name",ne.OriginalViewName=".orig.view.name",ne.CellRenderer="cell.renderer",ne.Domains="domains",ne.Quality="quality",ne.Notation="notation",ne.LayoutColumnId="layout-column-id",ne.Units="units",ne.Format="format",ne.TooltipType=".tooltip-type",ne.Markup="markup",ne.SourcePrecision=".source-precision",ne.Formula="formula",ne.Choices=".choices",ne.CategoryOrder=".category-order",ne.DefaultFilter=".default-filter",ne.IgnoreCustomFilter=".ignore-custom-filter",ne.CustomFilterType=".custom-filter-type",ne.Charts=".charts",ne.AutoChoices=".auto-choices",ne.ImportTime="import-time",ne.Source="source",ne.SourceUri="source.uri",ne.SourceFile="source.file",ne.Db="Db",ne.DbSchema="DbSchema",ne.DbTable="DbTable",ne.DbColumn="DbColumn",ne.DbPath="DbPath",ne.SparqlEndpoint="sparql.endpoint",ne.SparqlOntology="sparql.ontology",ne.AggregationPivotValues="aggr.pivot.values",ne.AggregationSourceTableName="aggr.src.table.name",ne.AggregationSourceColumnName="aggr.src.col.name",ne.AggregationType="aggr.type",ne.PredictiveModel="predictive.model",ne.Id=".id",ne.TableInfo=".table-info",ne.VariableName=".VariableName",ne.DataConnectionId=".data-connection-id",ne.DataConnection=".data-connection",ne.DataSource=".DataSource",ne.DataSchema=".DataSchema",ne.DataQueryId=".DataQuery.id",ne.DataQueryName="DataQuery.name",ne.DataQueryCall=".DataQuery.query.call",ne.Presentation=".presentation",ne.QueryJson=".query-json",ne.Expression="expression",ne.TableSchema="table_schema",ne.ReferencesTable="references_table",ne.ReferencesColumn="references_column",ne.ChemDescriptor="chem-descriptor",ne.ChemFingerprinter="chem-fingerprinter",ne.DataHistory=".history",ne.CreationScript=".script",ne.DataSync=".data-sync",ne.IsDbEntity=".db.entity",ne.IsDbView=".db.view",ne.ColumnConverter=".column.converter",ne.ValueValidators=".value-validators",ne.MultiValueSeparator=".multi-value-separator",ne.FriendlyName="friendlyName",ne.AllowRename=".allow-rename",ne.EditableBy="editableBy",ne.PinIfEditable="pinIfEditable",ne.IncludeInCsvExport=".includeInCsvExport",ne.IncludeInBinaryExport=".includeInBinaryExport";class re{}re.SemType="semType",re.Columns="columns",re.Category="category",re.Optional="optional",re.Type="type",re.Format="format",re.AllowNulls="allowNulls",re.Action="action",re.Choices="choices",re.Suggestions="suggestions",re.Min="min",re.Max="max",re.Validators="validators",re.Caption="caption",re.Postfix="postfix",re.Units="units",re.Editor="editor",re.Nullable="nullable",window,Symbol.iterator,Symbol.iterator,new DataView(new ArrayBuffer(8));let oe=window;class ie{constructor(e){this.dart=e,this.options=new J(oe.grok_Property_Get_Options(this.dart))}get get(){return oe.grok_Property_Get_Get(this.dart)}set get(e){oe.grok_Property_Set_Get(this.dart,e)}get set(){return oe.grok_Property_Get_Set(this.dart)}set set(e){oe.grok_Property_Set_Set(this.dart,e)}get name(){return oe.grok_Property_Get_Name(this.dart)}set name(e){oe.grok_Property_Set_Name(this.dart,e)}get caption(){return oe.grok_Property_Get_Caption(this.dart)}get category(){return oe.grok_Property_Get_Category(this.dart)}set category(e){oe.grok_Property_Set_Category(this.dart,e)}get propertyType(){return oe.grok_Property_Get_PropertyType(this.dart)}set propertyType(e){oe.grok_Property_Set_PropertyType(this.dart,e)}get semType(){return oe.grok_Property_Get_SemType(this.dart)}set semType(e){oe.grok_Property_Set_SemType(this.dart,e)}get description(){return oe.grok_Property_Get_Description(this.dart)}set description(e){oe.grok_Property_Set_Description(this.dart,e)}get defaultValue(){return oe.grok_Property_Get_DefaultValue(this.dart)}set defaultValue(e){oe.grok_Property_Set_DefaultValue(this.dart,e)}get editor(){return oe.grok_Property_Get(this.dart,"editor")}set editor(e){oe.grok_Property_Set(this.dart,"editor",e)}get choices(){return oe.grok_Property_Get_Choices(this.dart)}set choices(e){oe.grok_Property_Set_Choices(this.dart,e)}get columnFilter(){return oe.grok_Property_Get_ColumnTypeFilter(this.dart)}fromOptions(e){return e&&oe.grok_Property_Options(this.dart,e),this}static create(e,t,n,r,o=null){return new ie(oe.grok_Property(e,t,n,r,o))}static int(e,t,n,r){return ie.create(e,l.INT,t,n,r)}static float(e,t,n,r){return ie.create(e,l.FLOAT,t,n,r)}static string(e,t,n,r){return ie.create(e,l.STRING,t,n,r)}static bool(e,t,n,r){return ie.create(e,l.BOOL,t,n,r)}static dateTime(e,t,n,r){return ie.create(e,l.DATE_TIME,t,n,r)}static js(e,t,n){return ie.create(e,t,(t=>t[e]),(function(t,n){t[e]=n}),null==n?void 0:n.defaultValue).fromOptions(n)}static jsInt(e,t){return ie.js(e,l.INT,t)}static jsBool(e,t){return ie.js(e,l.BOOL,t)}static jsFloat(e,t){return ie.js(e,l.FLOAT,t)}static jsString(e,t){return ie.js(e,l.STRING,t)}static jsDateTime(e,t){return ie.js(e,l.DATE_TIME,t)}static fromOptions(e){return ie.js(e.name,e.type,e)}static registerAttachedProperty(e,t){oe.grok_Property_RegisterAttachedProperty(e,t.dart)}}var ae=n(78),ue=n(162);const se={CONSTANT:"constant",PROPORTIONAL:"proportional"},ce="fit",le="fit",fe=".fit",me="rgba(255,191,63,0.4)",he="rgba(255,238,204,0.3)",de={TOP:"top",BOTTOM:"bottom"};class pe{constructor(){this.chartOptions={},this.seriesOptions={},this.series=[]}}const ge=[ie.js("rSquared",l.FLOAT,{userEditable:!1}),ie.js("auc",l.FLOAT,{userEditable:!1}),ie.js("interceptY",l.FLOAT,{userEditable:!1}),ie.js("interceptX",l.FLOAT,{userEditable:!1}),ie.js("slope",l.FLOAT,{userEditable:!1}),ie.js("top",l.FLOAT,{userEditable:!1}),ie.js("bottom",l.FLOAT,{userEditable:!1})],ve=[ie.js("minX",l.FLOAT,{description:"Minimum value of the X axis",nullable:!0}),ie.js("minY",l.FLOAT,{description:"Minimum value of the Y axis",nullable:!0}),ie.js("maxX",l.FLOAT,{description:"Maximum value of the X axis",nullable:!0}),ie.js("maxY",l.FLOAT,{description:"Maximum value of the Y axis",nullable:!0}),ie.js("title",l.STRING,{nullable:!0}),ie.js("xAxisName",l.STRING,{description:"Label to show on the X axis. If not specified, corresponding data column name is used",nullable:!0}),ie.js("yAxisName",l.STRING,{description:"Label to show on the Y axis. If not specified, corresponding data column name is used",nullable:!0}),ie.js("logX",l.BOOL,{description:"Whether the X axis should be logarithmic",defaultValue:!1}),ie.js("logY",l.BOOL,{description:"Whether the Y axis should be logarithmic",defaultValue:!1}),ie.js("showStatistics",l.STRING_LIST,{description:"Whether specific statistics should be rendered",choices:ge.map((e=>e.name)),inputType:"MultiChoice"})],ye=[ie.js("fitFunction",l.STRING,{category:"Fitting",choices:["sigmoid","linear"],defaultValue:"sigmoid"}),ie.js("pointColor",l.STRING,{category:"Rendering",nullable:!0,inputType:"Color"}),ie.js("fitLineColor",l.STRING,{category:"Rendering",nullable:!0,inputType:"Color"}),ie.js("errorModel",l.STRING,{category:"Fitting",defaultValue:"constant",choices:["constant","proportional"],nullable:!1}),ie.js("clickToToggle",l.BOOL,{category:"Fitting",description:"Click on a point to mark it as outlier and refit",nullable:!0,defaultValue:!1}),ie.js("showFitLine",l.BOOL,{category:"Fitting",defaultValue:!0}),ie.js("showPoints",l.STRING,{category:"Fitting",description:"Whether points/candlesticks/none should be rendered",defaultValue:"points",choices:["points","candlesticks","both"]}),ie.js("showCurveConfidenceInterval",l.BOOL,{category:"Fitting",description:"Whether confidence intervals should be rendered",defaultValue:!1,caption:"Confidence interval"}),ie.js("markerType",l.STRING,{category:"Rendering",defaultValue:"circle",choices:["asterisk","circle","cross border","diamond","square","star","triangle bottom","triangle left","triangle right","triangle top"],nullable:!1}),ie.js("lineStyle",l.STRING,{category:"Rendering",defaultValue:"solid",choices:["solid","dotted","dashed","dashdotted"],nullable:!1}),ie.js("droplines",l.STRING_LIST,{description:"Whether specific droplines should be rendered",choices:["IC50"],inputType:"MultiChoice"})],Ae="sigmoid";class xe{}class we extends xe{constructor(e,t,n,r){super(),this._name=e,this._parameterNames=r,this.y=t,this.getInitialParameters=n}get name(){return this._name}get parameterNames(){return this._parameterNames}y(e,t){throw new Error("Not implemented")}getInitialParameters(e,t){throw new Error("Not implemented")}}const be={linear:new class extends xe{get name(){return"linear"}get parameterNames(){return["Slope","Intercept"]}y(e,t){throw new Error("Not implemented")}getInitialParameters(e,t){throw new Error("Not implemented")}},sigmoid:new class extends xe{get name(){return Ae}get parameterNames(){return["Top","Bottom","Slope","IC50"]}y(e,t){return function(e,t){const n=e[0],r=e[1],o=e[2],i=e[3];return i+(n-i)/(1+Math.pow(10,(t-o)*r))}(e,t)}getInitialParameters(e,t){const n=L.Rect.fromXYArrays(e,t),r=(n.bottom-n.top)/2+n.top;let o=n.bottom-n.top,i=0;for(let n=0;n<e.length;n++){const e=Math.abs(t[n]-r);e<o&&(o=e,i=n)}const a=e[i],u=t[0]>t[t.length-1]?1:-1;return[n.bottom,u,a,n.top]}}};function Ce(e){let t;switch(e){case se.CONSTANT:t=Ne;break;case se.PROPORTIONAL:t=Re;break;default:t=Ne}return t}function Te(e,t,n,r){return{getValue:r=>n(t,e,r).value,getGradient:(o,i)=>{for(let a=0;a<o.length;a++)i[a]=r.includes(a)?0:Be(n,t,e,o,a);return i}}}function _e(e){if("string"==typeof e)return be[e];if(!be[e.name]){const t=e.name,n=e.parameterNames,r=e.function.split("=>").map((e=>e.trim())),o=e.getInitialParameters.split("=>").map((e=>e.trim())),i=new Function(r[0].slice(1,r[0].length-1),`${r[1].includes(";")?"":"return "}${r[1]}`),a=new Function(o[0].slice(1,o[0].length-1),`return ${o[1]}`),u=new we(t,i,a,n);be[t]=u}return be[e.name]}function Se(e,t,n,r){var o,i;const a=t.y,u=t.getInitialParameters(e.x,e.y),s=Ce(n),c=[];let l=!0;for(;l;){const t=Te(e,a,s,c);if((0,ae.U)(t,u),(0,ae.U)(t,u),l=!1,!r)break;for(let e=0;e<r.length;e++){if(void 0!==(null===(o=r[e])||void 0===o?void 0:o.max)&&u[e]>r[e].max){l=!0,c.push(e),u[e]=r[e].max;break}if(void 0!==(null===(i=r[e])||void 0===i?void 0:i.min)&&u[e]<r[e].min){l=!0,c.push(e),u[e]=r[e].min;break}}}return{fittedCurve:Ie(a,u),parameters:u}}function Ie(e,t){return n=>e(t,n)}function Oe(e,t,n,r=.05,o){const i=Ce(o),a=o===se.PROPORTIONAL?i(n,e,t).mult:i(n,e,t).const,u=ue.normal.inv(1-r/2,0,1);return{confidenceTop:e=>{const r=n(t,e);return o===se.CONSTANT?r+u*a:r+u*Math.abs(r)*a},confidenceBottom:e=>{const r=n(t,e);return o===se.CONSTANT?r-u*a:r-u*Math.abs(r)*a}}}function ke(e,t,n,r=!0){const o=Ie(n,t);return{rSquared:r?Me(o,e):void 0,auc:r?Ee(o,e):void 0,interceptX:t[2],interceptY:o(t[2]),slope:t[1],top:t[0],bottom:t[3]}}function Ee(e,t){let n=0;const r=Math.min(...t.x),o=Math.max(...t.x),i=(o-r)/1e3;for(let t=r;t<o;t+=i)n+=i*e(t);return n}function Me(e,t){let n=0,r=0;const o=ue.mean(t.y);for(let i=0;i<t.x.length;i++)n+=Math.pow(t.y[i]-e(t.x[i]),2),r+=Math.pow(t.y[i]-o,2);return 1-n/r}function Be(e,t,n,r,o){const i=1e-4*r[o]==0?.001:1e-4*r[o],a=[],u=[];for(let e=0;e<r.length;e++)e===o?(a.push(r[e]+i),u.push(r[e]-i)):(a.push(r[e]),u.push(r[e]));return(e(t,n,a).value-e(t,n,u).value)/(2*i)}function Ne(e,t,n){const r=Math.PI;let o=0,i=0,a=0;const u=new Float32Array(t.x.length);for(let r=0;r<t.x.length;r++){const o=t.y[r],i=e(n,t.x[r]);u[r]=Math.pow(o-i,2)}for(let e=0;e<u.length;e++)i+=u[e];i/=u.length,o=Math.sqrt(i);for(let e=0;e<u.length;e++)a+=u[e]/i+Math.log(2*r*i);return{value:-a,const:o,mult:0}}function Re(e,t,n){const r=Math.PI;let o=0,i=0,a=0;const u=new Float32Array(t.x.length);for(let r=0;r<t.x.length;r++){const o=t.y[r],i=e(n,t.x[r]);u[r]=Math.pow(o-i,2)}for(let e=0;e<u.length;e++)i+=u[e];i/=u.length,o=Math.sqrt(i);for(let e=0;e<u.length;e++)a+=u[e]/i+Math.log(2*r*i);return{value:-a,const:0,mult:o}}},416:(e,t,n)=>{"use strict";n.d(t,{LC:()=>d,PK:()=>h,TL:()=>a,Y6:()=>f,dU:()=>l,hq:()=>s,jG:()=>u,kG:()=>m,tq:()=>p});var r=n(976),o=n(114);function i(e){const t={};for(const n of e)null!==n.defaultValue&&(t[n.name]=n.defaultValue);return t}function a(){return{chartOptions:i(o.kW),seriesOptions:i(o.K0)}}function u(e){var t,n;return JSON.parse(null!==(t=(n=e.tags)[o.Kp])&&void 0!==t?t:n[o.Kp]=JSON.stringify(a()))}function s(e){var t,n;return JSON.parse(null!==(t=(n=e.tags)[o.Kp])&&void 0!==t?t:n[o.Kp]=JSON.stringify(a()))}function c(e){const t=[],n=[];for(let r=0;r<e.length;r++)t[r]=e[r].x,n[r]=e[r].y;return{xs:t,ys:n}}function l(e){var t;const n=e.chartOptions;if((null===(t=e.series)||void 0===t?void 0:t.length)&&0!==e.series.length){const{xs:t,ys:o}=c(e.series[0].points);let i=r.Rect.fromXYArrays(t,o);for(let t=1;t<e.series.length;t++){const{xs:n,ys:o}=c(e.series[t].points);i=i.union(r.Rect.fromXYArrays(n,o))}return n?function(e,t){let n=e.x,o=e.y,i=e.width,a=e.height;return void 0!==t.minX&&null!==t.minX&&(!t.logX||t.logX&&t.minX>0)&&(i+=n-t.minX,n=t.minX),void 0!==t.maxX&&null!==t.maxX&&(!t.logX||t.logX&&t.maxX>0)&&(i+=t.maxX-(n+i)),void 0!==t.minY&&null!==t.minY&&(!t.logY||t.logY&&t.minY>0)&&(a+=o-t.minY,o=t.minY),void 0!==t.maxY&&null!==t.maxY&&(!t.logY||t.logY&&t.maxY>0)&&(a+=t.maxY-(o+a)),new r.Rect(n,o,i,a)}(i,n):i}return new r.Rect(0,0,1,1)}function f(e){return(0,o.ZY)(e.fitFunction)}function m(e,t){return(0,o.hR)(t.y,e.parameters)}function h(e,t,n){var r;const i={x:e.points.filter((e=>!e.outlier)).map((e=>(null==n?void 0:n.logX)?Math.log10(e.x):e.x)),y:e.points.filter((e=>!e.outlier)).map((e=>(null==n?void 0:n.logY)?Math.log10(e.y):e.y))};var a;return e.parameterBounds&&(null==n?void 0:n.logX)&&(e.parameterBounds[2]=((a=e.parameterBounds[2])&&(void 0!==a.max&&(a.max=Math.log10(a.max)),void 0!==a.min&&(a.min=0===a.min?-Number.MAX_VALUE:Math.log10(a.min))),a)),(0,o.iC)(function(e){const t={x:[],y:[]},n={x:[e.x[0]],y:[e.y[0]]};for(let r=1;r<e.x.length;r++){if(e.x[r]===n.x[0]){n.x[n.x.length]=e.x[r],n.y[n.y.length]=e.y[r];continue}const o=Math.floor(n.y.length/2),i=n.y.sort(((e,t)=>e-t)),a=i.length%2==0?(i[o-1]+i[o])/2:i[o];t.x[t.x.length]=n.x[0],t.y[t.y.length]=a,n.x=[e.x[r]],n.y=[e.y[r]]}return t}(i),t,null!==(r=e.errorModel)&&void 0!==r?r:o.js.CONSTANT,e.parameterBounds)}function d(e,t,n,r){var i;const a=n?{x:e.points.map((e=>(null==r?void 0:r.logX)?Math.log10(e.x):e.x)),y:e.points.map((e=>(null==r?void 0:r.logY)?Math.log10(e.y):e.y))}:{x:e.points.filter((e=>!e.outlier)).map((e=>(null==r?void 0:r.logX)?Math.log10(e.x):e.x)),y:e.points.filter((e=>!e.outlier)).map((e=>(null==r?void 0:r.logY)?Math.log10(e.y):e.y))};return e.parameters||(e.parameters=h(e,t).parameters),(0,o.ue)(a,e.parameters,t.y,.05,null!==(i=e.errorModel)&&void 0!==i?i:o.js.CONSTANT)}function p(e,t){const n={x:e.points.filter((e=>!e.outlier)).map((e=>e.x)),y:e.points.filter((e=>!e.outlier)).map((e=>e.y))};return e.parameters||(e.parameters=h(e,t).parameters),(0,o.aC)(n,e.parameters,t.y,!0)}},766:(e,t,n)=>{"use strict";n.d(t,{l:()=>u});var r=n(976);const o=1e-30,i=new class{screenToWorld(e,t,n,r,o){return n+(o?1-e/t:e/t)*(r-n)}worldToScreen(e,t,n,r,o){return o?(1-(e-n)/(r-n))*t:(e-n)/(r-n)*t}},a=new class{screenToWorld(e,t,n,r,i){n=n<o?o:n;const a=Math.log(r),u=Math.log(n);return Math.exp(u+(a-u)*(i?t-e:e)/t)}worldToScreen(e,t,n,r,i){if(e<=0)return NaN;if(Math.abs(e-n)<o)return i?t:0;if(Math.abs(e-r)<o)return i?0:t;n=n<o?o:n,e=e<o?o:e;const a=t*Math.log(e/n)/Math.log(r/n);return i?t-a:a}};class u{get xt(){return this.logX?a:i}get yt(){return this.logY?a:i}constructor(e,t,n=!1,r=!1){this.logX=!1,this.logY=!1,this.inverseX=!1,this.inverseY=!1,this.world=e,this.screen=t,this.logX=n,this.logY=r}xToScreen(e){return this.screen.left+this.xt.worldToScreen(e,this.screen.width,this.world.minX,this.world.maxX,this.inverseX)}yToScreen(e){return this.screen.top+this.yt.worldToScreen(e,this.screen.height,this.world.minY,this.world.maxY,!this.inverseY)}xToWorld(e){return this.xt.screenToWorld(e-this.screen.left,this.screen.width,this.world.minX,this.world.maxX,this.inverseX)}yToWorld(e){return this.yt.screenToWorld(e-this.screen.top,this.screen.height,this.world.minY,this.world.maxY,!this.inverseY)}toScreen(e){return new r.Point(this.xToScreen(e.x),this.yToScreen(e.y))}toWorld(e){return new r.Point(this.xToWorld(e.x),this.yToWorld(e.y))}drawCoordinateGrid(e,t,n){t&&r.Paint.horzAxis(e,this.world.minX,this.world.maxX,t.x,t.y,t.width,t.height,this.logX,this.inverseX),n&&r.Paint.vertAxis(e,this.world.minY,this.world.maxY,n.x,n.y,n.width,n.height,this.logY,this.inverseY)}}},911:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(15),o=n.n(r),i=n(645),a=n.n(i)()(o());a.push([e.id,".ui-breadcrumbs {\n padding: 0 .5rem;\n display: flex;\n flex-wrap: wrap;\n list-style: none;\n margin: 0;\n font-size: 13px;\n align-items: center;\n}\n\n.ui-breadcrumbs-element:last-child a {\n color: var(--grey-6);\n cursor: default;\n}\n\n.ui-breadcrumbs i {\n font-size: 10px;\n font-weight: bold;\n color: var(--grey-3);\n padding: 0 12px;\n cursor: default;\n}\n","",{version:3,sources:["webpack://./node_modules/datagrok-api/css/breadcrumbs.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,SAAS;IACT,eAAe;IACf,mBAAmB;AACvB;;AAEA;IACI,oBAAoB;IACpB,eAAe;AACnB;;AAEA;IACI,eAAe;IACf,iBAAiB;IACjB,oBAAoB;IACpB,eAAe;IACf,eAAe;AACnB",sourcesContent:[".ui-breadcrumbs {\n padding: 0 .5rem;\n display: flex;\n flex-wrap: wrap;\n list-style: none;\n margin: 0;\n font-size: 13px;\n align-items: center;\n}\n\n.ui-breadcrumbs-element:last-child a {\n color: var(--grey-6);\n cursor: default;\n}\n\n.ui-breadcrumbs i {\n font-size: 10px;\n font-weight: bold;\n color: var(--grey-3);\n padding: 0 12px;\n cursor: default;\n}\n"],sourceRoot:""}]);const u=a},686:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(15),o=n.n(r),i=n(645),a=n.n(i)()(o());a.push([e.id,".ui-drop-down-root {\n position: relative;\n display: flex;\n align-items: center;\n min-width: initial;\n width: initial;\n padding: 0 7px 0 2px;\n margin: 2px 11px 2px 2px;\n}\n\n.ui-drop-down-root::after {\n content: ' ';\n margin-right: 2px;\n border-width: 4px 4px 0 4px;\n border-style: solid;\n border-color: #40607f transparent transparent transparent;\n}\n\n.ui-drop-down-root.ui-drop-down-root-expanded {\n z-index: 4000;\n box-shadow: 0px 0px 2px #40607F;\n border-radius: 1px;\n background-color: #ECEFF2;\n flex-grow: 1;\n}\n\n.ui-drop-down-root.ui-drop-down-root-expanded::before {\n content: ' ';\n bottom: -1px;\n left: 0;\n position: absolute;\n width: 100%;\n height: 5px;\n z-index: 4002;\n background-color: #ECEFF2;\n}\n\n.ui-drop-down-content {\n position: absolute;\n left: 0px;\n top: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n box-shadow: 0px 0px 2px #40607F;\n z-index: 4000;\n background: #ECEFF2;\n min-width: 110px;\n width: max-content;\n padding: 10px 12px;\n visibility: hidden;\n}\n\n.d4-ribbon-item > .ui-drop-down-root {\n margin-right: 11px;\n}\n","",{version:3,sources:["webpack://./node_modules/datagrok-api/css/drop-down.css"],names:[],mappings:"AAAA;IACI,kBAAkB;IAClB,aAAa;IACb,mBAAmB;IACnB,kBAAkB;IAClB,cAAc;IACd,oBAAoB;IACpB,wBAAwB;AAC5B;;AAEA;IACI,YAAY;IACZ,iBAAiB;IACjB,2BAA2B;IAC3B,mBAAmB;IACnB,yDAAyD;AAC7D;;AAEA;IACI,aAAa;IACb,+BAA+B;IAC/B,kBAAkB;IAClB,yBAAyB;IACzB,YAAY;AAChB;;AAEA;IACI,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,kBAAkB;IAClB,WAAW;IACX,WAAW;IACX,aAAa;IACb,yBAAyB;AAC7B;;AAEA;IACI,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,aAAa;IACb,uBAAuB;IACvB,mBAAmB;IACnB,+BAA+B;IAC/B,aAAa;IACb,mBAAmB;IACnB,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;AACtB",sourcesContent:[".ui-drop-down-root {\n position: relative;\n display: flex;\n align-items: center;\n min-width: initial;\n width: initial;\n padding: 0 7px 0 2px;\n margin: 2px 11px 2px 2px;\n}\n\n.ui-drop-down-root::after {\n content: ' ';\n margin-right: 2px;\n border-width: 4px 4px 0 4px;\n border-style: solid;\n border-color: #40607f transparent transparent transparent;\n}\n\n.ui-drop-down-root.ui-drop-down-root-expanded {\n z-index: 4000;\n box-shadow: 0px 0px 2px #40607F;\n border-radius: 1px;\n background-color: #ECEFF2;\n flex-grow: 1;\n}\n\n.ui-drop-down-root.ui-drop-down-root-expanded::before {\n content: ' ';\n bottom: -1px;\n left: 0;\n position: absolute;\n width: 100%;\n height: 5px;\n z-index: 4002;\n background-color: #ECEFF2;\n}\n\n.ui-drop-down-content {\n position: absolute;\n left: 0px;\n top: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n box-shadow: 0px 0px 2px #40607F;\n z-index: 4000;\n background: #ECEFF2;\n min-width: 110px;\n width: max-content;\n padding: 10px 12px;\n visibility: hidden;\n}\n\n.d4-ribbon-item > .ui-drop-down-root {\n margin-right: 11px;\n}\n"],sourceRoot:""}]);const u=a},782:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(15),o=n.n(r),i=n(645),a=n.n(i)()(o());a.push([e.id,".ui-input-root.ui-input-tags {\n flex-direction: column;\n}\n\n.ui-tag-list {\n position: relative;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n padding: 4px 0;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root {\n max-width: initial;\n width: 100%;\n flex-grow: 1;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root:last-child {\n padding: 0;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root:last-child > label.ui-input-label {\n display: none;\n}\n\n.ui-tag {\n color: var(--grey-5);\n display: inline-flex;\n padding: 3px 6px;\n align-items: center;\n text-align: center;\n line-height: 1;\n background-color: var(--grey-1);\n margin: 1px;\n text-decoration: none;\n white-space: nowrap;\n border-radius: 2px;\n font-size: 12px;\n}\n\n.ui-tag span {\n white-space: nowrap;\n overflow: hidden;\n max-width: 200px;\n text-overflow: ellipsis;\n}\n\n.ui-tag > input {\n max-width: 65px;\n font-size: 12px;\n height: 11px;\n max-height: 11px;\n padding: 0;\n margin: 0;\n}\n\n.ui-tag > input:focus {\n background:none;\n outline: none;\n border: none;\n border-bottom: 1px solid var(--blue-1);\n}\n","",{version:3,sources:["webpack://./node_modules/datagrok-api/css/tags-input.css"],names:[],mappings:"AAAA;IACI,sBAAsB;AAC1B;;AAEA;IACI,kBAAkB;IAClB,aAAa;IACb,mBAAmB;IACnB,eAAe;IACf,cAAc;AAClB;;AAEA;IACI,kBAAkB;IAClB,WAAW;IACX,YAAY;AAChB;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,aAAa;AACjB;;AAEA;IACI,oBAAoB;IACpB,oBAAoB;IACpB,gBAAgB;IAChB,mBAAmB;IACnB,kBAAkB;IAClB,cAAc;IACd,+BAA+B;IAC/B,WAAW;IACX,qBAAqB;IACrB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;AACnB;;AAEA;IACI,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,uBAAuB;AAC3B;;AAEA;IACI,eAAe;IACf,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,SAAS;AACb;;AAEA;IACI,eAAe;IACf,aAAa;IACb,YAAY;IACZ,sCAAsC;AAC1C",sourcesContent:[".ui-input-root.ui-input-tags {\n flex-direction: column;\n}\n\n.ui-tag-list {\n position: relative;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n padding: 4px 0;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root {\n max-width: initial;\n width: 100%;\n flex-grow: 1;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root:last-child {\n padding: 0;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root:last-child > label.ui-input-label {\n display: none;\n}\n\n.ui-tag {\n color: var(--grey-5);\n display: inline-flex;\n padding: 3px 6px;\n align-items: center;\n text-align: center;\n line-height: 1;\n background-color: var(--grey-1);\n margin: 1px;\n text-decoration: none;\n white-space: nowrap;\n border-radius: 2px;\n font-size: 12px;\n}\n\n.ui-tag span {\n white-space: nowrap;\n overflow: hidden;\n max-width: 200px;\n text-overflow: ellipsis;\n}\n\n.ui-tag > input {\n max-width: 65px;\n font-size: 12px;\n height: 11px;\n max-height: 11px;\n padding: 0;\n margin: 0;\n}\n\n.ui-tag > input:focus {\n background:none;\n outline: none;\n border: none;\n border-bottom: 1px solid var(--blue-1);\n}\n"],sourceRoot:""}]);const u=a},181:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(15),o=n.n(r),i=n(645),a=n.n(i)()(o());a.push([e.id,".typeahead-standalone {\n display: flex;\n position: relative;\n flex-grow: 0;\n}\n\n.ui-form .ui-input-root > .typeahead-standalone {\n flex-grow: 1;\n}\n\n.ui-form.ui-form-condensed .typeahead-standalone.ui-input-root {\n padding: 0;\n}\n\n.ui-form.ui-form-condensed > .ui-input-root > .typeahead-standalone .tt-hint {\n line-height: 1.25;\n}\n\n.typeahead-standalone .ui-input-editor{\n position: relative;\n z-index: 1;\n min-width: 30px;\n flex-grow: 1;\n padding: 0 4px;\n background: transparent;\n}\n\n.typeahead-standalone .tt-hint {\n background: #fff;\n color: silver;\n cursor: default;\n left: 0;\n position: absolute;\n user-select: none;\n z-index: 0;\n padding: 6px 4px;\n border: none;\n}\n\n.typeahead-standalone .ui-input-list {\n display: block;\n position: absolute;\n width: 100%;\n left: 0px;\n z-index: 4000;\n background: white;\n top: 28px;\n box-shadow: 0px 2px 4px var(--grey-3);\n transition: box-shadow 200ms ease-in-out;\n}\n\n.tt-suggestion {\n background: white;\n color: var(--grey-6);\n padding: 4px;\n}\n\n.tt-suggestion:hover {\n cursor: pointer;\n background: var(--grey-1);\n color: var(--grey-6);\n padding: 4px;\n}\n\n.typeahead-standalone > .ui-input-list.tt-hide {\n display: none;\n}\n\n.tt-suggestion.tt-selected {\n cursor: pointer;\n background: var(--grey-1);\n color: var(--grey-6);\n padding: 4px;\n}\n\n.typeahead-standalone .ui-input-list .tt-suggestion .tt-highlight {\n font-weight: 900;\n}\n","",{version:3,sources:["webpack://./node_modules/datagrok-api/css/typeahead-input.css"],names:[],mappings:"AAAA;IACI,aAAa;IACb,kBAAkB;IAClB,YAAY;AAChB;;AAEA;IACI,YAAY;AAChB;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,kBAAkB;IAClB,UAAU;IACV,eAAe;IACf,YAAY;IACZ,cAAc;IACd,uBAAuB;AAC3B;;AAEA;IACI,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,OAAO;IACP,kBAAkB;IAClB,iBAAiB;IACjB,UAAU;IACV,gBAAgB;IAChB,YAAY;AAChB;;AAEA;IACI,cAAc;IACd,kBAAkB;IAClB,WAAW;IACX,SAAS;IACT,aAAa;IACb,iBAAiB;IACjB,SAAS;IACT,qCAAqC;IACrC,wCAAwC;AAC5C;;AAEA;IACI,iBAAiB;IACjB,oBAAoB;IACpB,YAAY;AAChB;;AAEA;IACI,eAAe;IACf,yBAAyB;IACzB,oBAAoB;IACpB,YAAY;AAChB;;AAEA;IACI,aAAa;AACjB;;AAEA;IACI,eAAe;IACf,yBAAyB;IACzB,oBAAoB;IACpB,YAAY;AAChB;;AAEA;IACI,gBAAgB;AACpB",sourcesContent:[".typeahead-standalone {\n display: flex;\n position: relative;\n flex-grow: 0;\n}\n\n.ui-form .ui-input-root > .typeahead-standalone {\n flex-grow: 1;\n}\n\n.ui-form.ui-form-condensed .typeahead-standalone.ui-input-root {\n padding: 0;\n}\n\n.ui-form.ui-form-condensed > .ui-input-root > .typeahead-standalone .tt-hint {\n line-height: 1.25;\n}\n\n.typeahead-standalone .ui-input-editor{\n position: relative;\n z-index: 1;\n min-width: 30px;\n flex-grow: 1;\n padding: 0 4px;\n background: transparent;\n}\n\n.typeahead-standalone .tt-hint {\n background: #fff;\n color: silver;\n cursor: default;\n left: 0;\n position: absolute;\n user-select: none;\n z-index: 0;\n padding: 6px 4px;\n border: none;\n}\n\n.typeahead-standalone .ui-input-list {\n display: block;\n position: absolute;\n width: 100%;\n left: 0px;\n z-index: 4000;\n background: white;\n top: 28px;\n box-shadow: 0px 2px 4px var(--grey-3);\n transition: box-shadow 200ms ease-in-out;\n}\n\n.tt-suggestion {\n background: white;\n color: var(--grey-6);\n padding: 4px;\n}\n\n.tt-suggestion:hover {\n cursor: pointer;\n background: var(--grey-1);\n color: var(--grey-6);\n padding: 4px;\n}\n\n.typeahead-standalone > .ui-input-list.tt-hide {\n display: none;\n}\n\n.tt-suggestion.tt-selected {\n cursor: pointer;\n background: var(--grey-1);\n color: var(--grey-6);\n padding: 4px;\n}\n\n.typeahead-standalone .ui-input-list .tt-suggestion .tt-highlight {\n font-weight: 900;\n}\n"],sourceRoot:""}]);const u=a},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var a=this[i][0];null!=a&&(o[a]=!0)}for(var u=0;u<e.length;u++){var s=[].concat(e[u]);r&&o[s[0]]||(n&&(s[2]?s[2]="".concat(n," and ").concat(s[2]):s[2]=n),t.push(s))}},t}},15:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}e.exports=function(e){var n,r,o=(r=4,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(n,r)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[1],a=o[3];if(!a)return i;if("function"==typeof btoa){var u=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(u),c="/*# ".concat(s," */"),l=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[i].concat(l).concat([c]).join("\n")}return[i].join("\n")}},162:function(e){var t;e.exports=(t=function(e,t){var n=Array.prototype.concat,r=Array.prototype.slice,o=Object.prototype.toString;function i(t,n){var r=t>n?t:n;return e.pow(10,17-~~(e.log(r>0?r:-r)*e.LOG10E))}var a=Array.isArray||function(e){return"[object Array]"===o.call(e)};function u(e){return"[object Function]"===o.call(e)}function s(e){return"number"==typeof e&&e-e==0}function c(){return new c._init(arguments)}function l(){return 0}function f(){return 1}function m(e,t){return e===t?1:0}c.fn=c.prototype,c._init=function(e){if(a(e[0]))if(a(e[0][0])){u(e[1])&&(e[0]=c.map(e[0],e[1]));for(var t=0;t<e[0].length;t++)this[t]=e[0][t];this.length=e[0].length}else this[0]=u(e[1])?c.map(e[0],e[1]):e[0],this.length=1;else if(s(e[0]))this[0]=c.seq.apply(null,e),this.length=1;else{if(e[0]instanceof c)return c(e[0].toArray());this[0]=[],this.length=1}return this},c._init.prototype=c.prototype,c._init.constructor=c,c.utils={calcRdx:i,isArray:a,isFunction:u,isNumber:s,toVector:function(e){return n.apply([],e)}},c._random_fn=e.random,c.setRandom=function(e){if("function"!=typeof e)throw new TypeError("fn is not a function");c._random_fn=e},c.extend=function(e){var t,n;if(1===arguments.length){for(n in e)c[n]=e[n];return this}for(t=1;t<arguments.length;t++)for(n in arguments[t])e[n]=arguments[t][n];return e},c.rows=function(e){return e.length||1},c.cols=function(e){return e[0].length||1},c.dimensions=function(e){return{rows:c.rows(e),cols:c.cols(e)}},c.row=function(e,t){return a(t)?t.map((function(t){return c.row(e,t)})):e[t]},c.rowa=function(e,t){return c.row(e,t)},c.col=function(e,t){if(a(t)){var n=c.arange(e.length).map((function(){return new Array(t.length)}));return t.forEach((function(t,r){c.arange(e.length).forEach((function(o){n[o][r]=e[o][t]}))})),n}for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=[e[o][t]];return r},c.cola=function(e,t){return c.col(e,t).map((function(e){return e[0]}))},c.diag=function(e){for(var t=c.rows(e),n=new Array(t),r=0;r<t;r++)n[r]=[e[r][r]];return n},c.antidiag=function(e){for(var t=c.rows(e)-1,n=new Array(t),r=0;t>=0;t--,r++)n[r]=[e[r][t]];return n},c.transpose=function(e){var t,n,r,o,i,u=[];for(a(e[0])||(e=[e]),n=e.length,r=e[0].length,i=0;i<r;i++){for(t=new Array(n),o=0;o<n;o++)t[o]=e[o][i];u.push(t)}return 1===u.length?u[0]:u},c.map=function(e,t,n){var r,o,i,u,s;for(a(e[0])||(e=[e]),o=e.length,i=e[0].length,u=n?e:new Array(o),r=0;r<o;r++)for(u[r]||(u[r]=new Array(i)),s=0;s<i;s++)u[r][s]=t(e[r][s],r,s);return 1===u.length?u[0]:u},c.cumreduce=function(e,t,n){var r,o,i,u,s;for(a(e[0])||(e=[e]),o=e.length,i=e[0].length,u=n?e:new Array(o),r=0;r<o;r++)for(u[r]||(u[r]=new Array(i)),i>0&&(u[r][0]=e[r][0]),s=1;s<i;s++)u[r][s]=t(u[r][s-1],e[r][s]);return 1===u.length?u[0]:u},c.alter=function(e,t){return c.map(e,t,!0)},c.create=function(e,t,n){var r,o,i=new Array(e);for(u(t)&&(n=t,t=e),r=0;r<e;r++)for(i[r]=new Array(t),o=0;o<t;o++)i[r][o]=n(r,o);return i},c.zeros=function(e,t){return s(t)||(t=e),c.create(e,t,l)},c.ones=function(e,t){return s(t)||(t=e),c.create(e,t,f)},c.rand=function(e,t){return s(t)||(t=e),c.create(e,t,c._random_fn)},c.identity=function(e,t){return s(t)||(t=e),c.create(e,t,m)},c.symmetric=function(e){var t,n,r=e.length;if(e.length!==e[0].length)return!1;for(t=0;t<r;t++)for(n=0;n<r;n++)if(e[n][t]!==e[t][n])return!1;return!0},c.clear=function(e){return c.alter(e,l)},c.seq=function(e,t,n,r){u(r)||(r=!1);var o,a=[],s=i(e,t),c=(t*s-e*s)/((n-1)*s),l=e;for(o=0;l<=t&&o<n;l=(e*s+c*s*++o)/s)a.push(r?r(l,o):l);return a},c.arange=function(e,n,r){var o,i=[];if(r=r||1,n===t&&(n=e,e=0),e===n||0===r)return[];if(e<n&&r<0)return[];if(e>n&&r>0)return[];if(r>0)for(o=e;o<n;o+=r)i.push(o);else for(o=e;o>n;o+=r)i.push(o);return i},c.slice=function(){function e(e,n,r,o){var i,a=[],u=e.length;if(n===t&&r===t&&o===t)return c.copy(e);if(o=o||1,(n=(n=n||0)>=0?n:u+n)===(r=(r=r||e.length)>=0?r:u+r)||0===o)return[];if(n<r&&o<0)return[];if(n>r&&o>0)return[];if(o>0)for(i=n;i<r;i+=o)a.push(e[i]);else for(i=n;i>r;i+=o)a.push(e[i]);return a}return function(t,n){var r,o;return s((n=n||{}).row)?s(n.col)?t[n.row][n.col]:e(c.rowa(t,n.row),(r=n.col||{}).start,r.end,r.step):s(n.col)?e(c.cola(t,n.col),(o=n.row||{}).start,o.end,o.step):(o=n.row||{},r=n.col||{},e(t,o.start,o.end,o.step).map((function(t){return e(t,r.start,r.end,r.step)})))}}(),c.sliceAssign=function(n,r,o){var i,a;if(s(r.row)){if(s(r.col))return n[r.row][r.col]=o;r.col=r.col||{},r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,i=c.arange(r.col.start,e.min(n.length,r.col.end),r.col.step);var u=r.row;return i.forEach((function(e,t){n[u][e]=o[t]})),n}if(s(r.col)){r.row=r.row||{},r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,a=c.arange(r.row.start,e.min(n[0].length,r.row.end),r.row.step);var l=r.col;return a.forEach((function(e,t){n[e][l]=o[t]})),n}return o[0].length===t&&(o=[o]),r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,a=c.arange(r.row.start,e.min(n.length,r.row.end),r.row.step),i=c.arange(r.col.start,e.min(n[0].length,r.col.end),r.col.step),a.forEach((function(e,t){i.forEach((function(r,i){n[e][r]=o[t][i]}))})),n},c.diagonal=function(e){var t=c.zeros(e.length,e.length);return e.forEach((function(e,n){t[n][n]=e})),t},c.copy=function(e){return e.map((function(e){return s(e)?e:e.map((function(e){return e}))}))};var h=c.prototype;return h.length=0,h.push=Array.prototype.push,h.sort=Array.prototype.sort,h.splice=Array.prototype.splice,h.slice=Array.prototype.slice,h.toArray=function(){return this.length>1?r.call(this):r.call(this)[0]},h.map=function(e,t){return c(c.map(this,e,t))},h.cumreduce=function(e,t){return c(c.cumreduce(this,e,t))},h.alter=function(e){return c.alter(this,e),this},function(e){for(var t=0;t<e.length;t++)!function(e){h[e]=function(t){var n,r=this;return t?(setTimeout((function(){t.call(r,h[e].call(r))})),this):(n=c[e](this),a(n)?c(n):n)}}(e[t])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(e){for(var t=0;t<e.length;t++)!function(e){h[e]=function(t,n){var r=this;return n?(setTimeout((function(){n.call(r,h[e].call(r,t))})),this):c(c[e](this,t))}}(e[t])}("row col".split(" ")),function(e){for(var t=0;t<e.length;t++)!function(e){h[e]=function(){return c(c[e].apply(null,arguments))}}(e[t])}("create zeros ones rand identity".split(" ")),c}(Math),function(e,t){var n=e.utils.isFunction;function r(e,t){return e-t}function o(e,n,r){return t.max(n,t.min(e,r))}e.sum=function(e){for(var t=0,n=e.length;--n>=0;)t+=e[n];return t},e.sumsqrd=function(e){for(var t=0,n=e.length;--n>=0;)t+=e[n]*e[n];return t},e.sumsqerr=function(t){for(var n,r=e.mean(t),o=0,i=t.length;--i>=0;)o+=(n=t[i]-r)*n;return o},e.sumrow=function(e){for(var t=0,n=e.length;--n>=0;)t+=e[n];return t},e.product=function(e){for(var t=1,n=e.length;--n>=0;)t*=e[n];return t},e.min=function(e){for(var t=e[0],n=0;++n<e.length;)e[n]<t&&(t=e[n]);return t},e.max=function(e){for(var t=e[0],n=0;++n<e.length;)e[n]>t&&(t=e[n]);return t},e.unique=function(e){for(var t={},n=[],r=0;r<e.length;r++)t[e[r]]||(t[e[r]]=!0,n.push(e[r]));return n},e.mean=function(t){return e.sum(t)/t.length},e.meansqerr=function(t){return e.sumsqerr(t)/t.length},e.geomean=function(n){var r=n.map(t.log),o=e.mean(r);return t.exp(o)},e.median=function(e){var t=e.length,n=e.slice().sort(r);return 1&t?n[t/2|0]:(n[t/2-1]+n[t/2])/2},e.cumsum=function(t){return e.cumreduce(t,(function(e,t){return e+t}))},e.cumprod=function(t){return e.cumreduce(t,(function(e,t){return e*t}))},e.diff=function(e){var t,n=[],r=e.length;for(t=1;t<r;t++)n.push(e[t]-e[t-1]);return n},e.rank=function(e){var t,n=[],o={};for(t=0;t<e.length;t++)o[s=e[t]]?o[s]++:(o[s]=1,n.push(s));var i=n.sort(r),a={},u=1;for(t=0;t<i.length;t++){var s,c=o[s=i[t]],l=(u+(u+c-1))/2;a[s]=l,u+=c}return e.map((function(e){return a[e]}))},e.mode=function(e){var t,n=e.length,o=e.slice().sort(r),i=1,a=0,u=0,s=[];for(t=0;t<n;t++)o[t]===o[t+1]?i++:(i>a?(s=[o[t]],a=i,u=0):i===a&&(s.push(o[t]),u++),i=1);return 0===u?s[0]:s},e.range=function(t){return e.max(t)-e.min(t)},e.variance=function(t,n){return e.sumsqerr(t)/(t.length-(n?1:0))},e.pooledvariance=function(t){return t.reduce((function(t,n){return t+e.sumsqerr(n)}),0)/(t.reduce((function(e,t){return e+t.length}),0)-t.length)},e.deviation=function(t){for(var n=e.mean(t),r=t.length,o=new Array(r),i=0;i<r;i++)o[i]=t[i]-n;return o},e.stdev=function(n,r){return t.sqrt(e.variance(n,r))},e.pooledstdev=function(n){return t.sqrt(e.pooledvariance(n))},e.meandev=function(n){for(var r=e.mean(n),o=[],i=n.length-1;i>=0;i--)o.push(t.abs(n[i]-r));return e.mean(o)},e.meddev=function(n){for(var r=e.median(n),o=[],i=n.length-1;i>=0;i--)o.push(t.abs(n[i]-r));return e.median(o)},e.coeffvar=function(t){return e.stdev(t)/e.mean(t)},e.quartiles=function(e){var n=e.length,o=e.slice().sort(r);return[o[t.round(n/4)-1],o[t.round(n/2)-1],o[t.round(3*n/4)-1]]},e.quantiles=function(e,n,i,a){var u,s,c,l,f,m=e.slice().sort(r),h=[n.length],d=e.length;for(void 0===i&&(i=3/8),void 0===a&&(a=3/8),u=0;u<n.length;u++)c=d*(s=n[u])+(i+s*(1-i-a)),l=t.floor(o(c,1,d-1)),f=o(c-l,0,1),h[u]=(1-f)*m[l-1]+f*m[l];return h},e.percentile=function(e,t,n){var o=e.slice().sort(r),i=t*(o.length+(n?1:-1))+(n?0:1),a=parseInt(i),u=i-a;return a+1<o.length?o[a-1]+u*(o[a]-o[a-1]):o[a-1]},e.percentileOfScore=function(e,t,n){var r,o,i=0,a=e.length,u=!1;for("strict"===n&&(u=!0),o=0;o<a;o++)r=e[o],(u&&r<t||!u&&r<=t)&&i++;return i/a},e.histogram=function(n,r){r=r||4;var o,i=e.min(n),a=(e.max(n)-i)/r,u=n.length,s=[];for(o=0;o<r;o++)s[o]=0;for(o=0;o<u;o++)s[t.min(t.floor((n[o]-i)/a),r-1)]+=1;return s},e.covariance=function(t,n){var r,o=e.mean(t),i=e.mean(n),a=t.length,u=new Array(a);for(r=0;r<a;r++)u[r]=(t[r]-o)*(n[r]-i);return e.sum(u)/(a-1)},e.corrcoeff=function(t,n){return e.covariance(t,n)/e.stdev(t,1)/e.stdev(n,1)},e.spearmancoeff=function(t,n){return t=e.rank(t),n=e.rank(n),e.corrcoeff(t,n)},e.stanMoment=function(n,r){for(var o=e.mean(n),i=e.stdev(n),a=n.length,u=0,s=0;s<a;s++)u+=t.pow((n[s]-o)/i,r);return u/n.length},e.skewness=function(t){return e.stanMoment(t,3)},e.kurtosis=function(t){return e.stanMoment(t,4)-3};var i=e.prototype;!function(t){for(var r=0;r<t.length;r++)!function(t){i[t]=function(r,o){var a=[],u=0,s=this;if(n(r)&&(o=r,r=!1),o)return setTimeout((function(){o.call(s,i[t].call(s,r))})),this;if(this.length>1){for(s=!0===r?this:this.transpose();u<s.length;u++)a[u]=e[t](s[u]);return a}return e[t](this[0],r)}}(t[r])}("cumsum cumprod".split(" ")),function(t){for(var r=0;r<t.length;r++)!function(t){i[t]=function(r,o){var a=[],u=0,s=this;if(n(r)&&(o=r,r=!1),o)return setTimeout((function(){o.call(s,i[t].call(s,r))})),this;if(this.length>1){for("sumrow"!==t&&(s=!0===r?this:this.transpose());u<s.length;u++)a[u]=e[t](s[u]);return!0===r?e[t](e.utils.toVector(a)):a}return e[t](this[0],r)}}(t[r])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(t){for(var r=0;r<t.length;r++)!function(t){i[t]=function(){var r,o=[],a=0,u=this,s=Array.prototype.slice.call(arguments);if(n(s[s.length-1])){r=s[s.length-1];var c=s.slice(0,s.length-1);return setTimeout((function(){r.call(u,i[t].apply(u,c))})),this}r=void 0;var l=function(n){return e[t].apply(u,[n].concat(s))};if(this.length>1){for(u=u.transpose();a<u.length;a++)o[a]=l(u[a]);return o}return l(this[0])}}(t[r])}("quantiles percentileOfScore".split(" "))}(t,Math),function(e,t){e.gammaln=function(e){var n,r,o,i=0,a=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],u=1.000000000190015;for(o=(r=n=e)+5.5,o-=(n+.5)*t.log(o);i<6;i++)u+=a[i]/++r;return t.log(2.5066282746310007*u/n)-o},e.loggam=function(e){var n,r,o,i,a,u,s,c=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(n=e,s=0,1==e||2==e)return 0;for(e<=7&&(n=e+(s=t.floor(7-e))),r=1/(n*n),o=2*t.PI,a=c[9],u=8;u>=0;u--)a*=r,a+=c[u];if(i=a/n+.5*t.log(o)+(n-.5)*t.log(n)-n,e<=7)for(u=1;u<=s;u++)i-=t.log(n-1),n-=1;return i},e.gammafn=function(e){var n,r,o,i,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],u=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,c=0,l=0,f=0,m=e;if(e>171.6243769536076)return 1/0;if(m<=0){if(!(i=m%1+36e-17))return 1/0;s=(1&m?-1:1)*t.PI/t.sin(t.PI*i),m=1-m}for(o=m,r=m<1?m++:(m-=c=(0|m)-1)-1,n=0;n<8;++n)f=(f+a[n])*r,l=l*r+u[n];if(i=f/l+1,o<m)i/=o;else if(o>m)for(n=0;n<c;++n)i*=m,m++;return s&&(i=s/i),i},e.gammap=function(t,n){return e.lowRegGamma(t,n)*e.gammafn(t)},e.lowRegGamma=function(n,r){var o,i=e.gammaln(n),a=n,u=1/n,s=u,c=r+1-n,l=1/1e-30,f=1/c,m=f,h=1,d=-~(8.5*t.log(n>=1?n:1/n)+.4*n+17);if(r<0||n<=0)return NaN;if(r<n+1){for(;h<=d;h++)u+=s*=r/++a;return u*t.exp(-r+n*t.log(r)-i)}for(;h<=d;h++)m*=(f=1/(f=(o=-h*(h-n))*f+(c+=2)))*(l=c+o/l);return 1-m*t.exp(-r+n*t.log(r)-i)},e.factorialln=function(t){return t<0?NaN:e.gammaln(t+1)},e.factorial=function(t){return t<0?NaN:e.gammafn(t+1)},e.combination=function(n,r){return n>170||r>170?t.exp(e.combinationln(n,r)):e.factorial(n)/e.factorial(r)/e.factorial(n-r)},e.combinationln=function(t,n){return e.factorialln(t)-e.factorialln(n)-e.factorialln(t-n)},e.permutation=function(t,n){return e.factorial(t)/e.factorial(t-n)},e.betafn=function(n,r){if(!(n<=0||r<=0))return n+r>170?t.exp(e.betaln(n,r)):e.gammafn(n)*e.gammafn(r)/e.gammafn(n+r)},e.betaln=function(t,n){return e.gammaln(t)+e.gammaln(n)-e.gammaln(t+n)},e.betacf=function(e,n,r){var o,i,a,u,s=1e-30,c=1,l=n+r,f=n+1,m=n-1,h=1,d=1-l*e/f;for(t.abs(d)<s&&(d=s),u=d=1/d;c<=100&&(d=1+(i=c*(r-c)*e/((m+(o=2*c))*(n+o)))*d,t.abs(d)<s&&(d=s),h=1+i/h,t.abs(h)<s&&(h=s),u*=(d=1/d)*h,d=1+(i=-(n+c)*(l+c)*e/((n+o)*(f+o)))*d,t.abs(d)<s&&(d=s),h=1+i/h,t.abs(h)<s&&(h=s),u*=a=(d=1/d)*h,!(t.abs(a-1)<3e-7));c++);return u},e.gammapinv=function(n,r){var o,i,a,u,s,c,l=0,f=r-1,m=e.gammaln(r);if(n>=1)return t.max(100,r+100*t.sqrt(r));if(n<=0)return 0;for(r>1?(s=t.log(f),c=t.exp(f*(s-1)-m),u=n<.5?n:1-n,o=(2.30753+.27061*(i=t.sqrt(-2*t.log(u))))/(1+i*(.99229+.04481*i))-i,n<.5&&(o=-o),o=t.max(.001,r*t.pow(1-1/(9*r)-o/(3*t.sqrt(r)),3))):o=n<(i=1-r*(.253+.12*r))?t.pow(n/i,1/r):1-t.log(1-(n-i)/(1-i));l<12;l++){if(o<=0)return 0;if((o-=i=(a=(e.lowRegGamma(r,o)-n)/(i=r>1?c*t.exp(-(o-f)+f*(t.log(o)-s)):t.exp(-o+f*t.log(o)-m)))/(1-.5*t.min(1,a*((r-1)/o-1))))<=0&&(o=.5*(o+i)),t.abs(i)<1e-8*o)break}return o},e.erf=function(e){var n,r,o,i,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],u=a.length-1,s=!1,c=0,l=0;for(e<0&&(e=-e,s=!0),r=4*(n=2/(2+e))-2;u>0;u--)o=c,c=r*c-l+a[u],l=o;return i=n*t.exp(-e*e+.5*(a[0]+r*c)-l),s?i-1:1-i},e.erfc=function(t){return 1-e.erf(t)},e.erfcinv=function(n){var r,o,i,a,u=0;if(n>=2)return-100;if(n<=0)return 100;for(a=n<1?n:2-n,r=-.70711*((2.30753+.27061*(i=t.sqrt(-2*t.log(a/2))))/(1+i*(.99229+.04481*i))-i);u<2;u++)r+=(o=e.erfc(r)-a)/(1.1283791670955126*t.exp(-r*r)-r*o);return n<1?r:-r},e.ibetainv=function(n,r,o){var i,a,u,s,c,l,f,m,h,d,p=r-1,g=o-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(r>=1&&o>=1?(u=n<.5?n:1-n,l=(2.30753+.27061*(s=t.sqrt(-2*t.log(u))))/(1+s*(.99229+.04481*s))-s,n<.5&&(l=-l),f=(l*l-3)/6,m=2/(1/(2*r-1)+1/(2*o-1)),h=l*t.sqrt(f+m)/m-(1/(2*o-1)-1/(2*r-1))*(f+5/6-2/(3*m)),l=r/(r+o*t.exp(2*h))):(i=t.log(r/(r+o)),a=t.log(o/(r+o)),l=n<(s=t.exp(r*i)/r)/(h=s+(c=t.exp(o*a)/o))?t.pow(r*h*n,1/r):1-t.pow(o*h*(1-n),1/o)),d=-e.gammaln(r)-e.gammaln(o)+e.gammaln(r+o);v<10;v++){if(0===l||1===l)return l;if((l-=s=(c=(e.ibeta(l,r,o)-n)/(s=t.exp(p*t.log(l)+g*t.log(1-l)+d)))/(1-.5*t.min(1,c*(p/l-g/(1-l)))))<=0&&(l=.5*(l+s)),l>=1&&(l=.5*(l+s+1)),t.abs(s)<1e-8*l&&v>0)break}return l},e.ibeta=function(n,r,o){var i=0===n||1===n?0:t.exp(e.gammaln(r+o)-e.gammaln(r)-e.gammaln(o)+r*t.log(n)+o*t.log(1-n));return!(n<0||n>1)&&(n<(r+1)/(r+o+2)?i*e.betacf(n,r,o)/r:1-i*e.betacf(1-n,o,r)/o)},e.randn=function(n,r){var o,i,a,u,s;if(r||(r=n),n)return e.create(n,r,(function(){return e.randn()}));do{o=e._random_fn(),i=1.7156*(e._random_fn()-.5),s=(a=o-.449871)*a+(u=t.abs(i)+.386595)*(.196*u-.25472*a)}while(s>.27597&&(s>.27846||i*i>-4*t.log(o)*o*o));return i/o},e.randg=function(n,r,o){var i,a,u,s,c,l,f=n;if(o||(o=r),n||(n=1),r)return(l=e.zeros(r,o)).alter((function(){return e.randg(n)})),l;n<1&&(n+=1),i=n-1/3,a=1/t.sqrt(9*i);do{do{s=1+a*(c=e.randn())}while(s<=0);s*=s*s,u=e._random_fn()}while(u>1-.331*t.pow(c,4)&&t.log(u)>.5*c*c+i*(1-s+t.log(s)));if(n==f)return i*s;do{u=e._random_fn()}while(0===u);return t.pow(u,1/f)*i*s},function(t){for(var n=0;n<t.length;n++)!function(t){e.fn[t]=function(){return e(e.map(this,(function(n){return e[t](n)})))}}(t[n])}("gammaln gammafn factorial factorialln".split(" ")),function(t){for(var n=0;n<t.length;n++)!function(t){e.fn[t]=function(){return e(e[t].apply(null,arguments))}}(t[n])}("randn".split(" "))}(t,Math),function(e,t){function n(e,n,r,o){for(var i,a=0,u=1,s=1,c=1,l=0,f=0;t.abs((s-f)/s)>o;)f=s,u=c+(i=-(n+l)*(n+r+l)*e/(n+2*l)/(n+2*l+1))*u,s=(a=s+i*a)+(i=(l+=1)*(r-l)*e/(n+2*l-1)/(n+2*l))*s,a/=c=u+i*c,u/=c,s/=c,c=1;return s/n}function r(n,r,o){var i=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],a=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],u=.5*n;if(u>=8)return 1;var s,c=2*e.normal.cdf(u,0,1,1,0)-1;c=c>=t.exp(-50/o)?t.pow(c,o):0;for(var l=u,f=(8-u)/(s=n>3?2:3),m=l+f,h=0,d=o-1,p=1;p<=s;p++){for(var g=0,v=.5*(m+l),y=.5*(m-l),A=1;A<=12;A++){var x,w=v+y*(6<A?i[(x=12-A+1)-1]:-i[(x=A)-1]),b=w*w;if(b>60)break;var C=2*e.normal.cdf(w,0,1,1,0)*.5-2*e.normal.cdf(w,n,1,1,0)*.5;C>=t.exp(-30/d)&&(g+=C=a[x-1]*t.exp(-.5*b)*t.pow(C,d))}h+=g*=2*y*o/t.sqrt(2*t.PI),l=m,m+=f}return(c+=h)<=t.exp(-30/r)?0:(c=t.pow(c,r))>=1?1:c}!function(t){for(var n=0;n<t.length;n++)!function(t){e[t]=function e(t,n,r){return this instanceof e?(this._a=t,this._b=n,this._c=r,this):new e(t,n,r)},e.fn[t]=function(n,r,o){var i=e[t](n,r,o);return i.data=this,i},e[t].prototype.sample=function(n){var r=this._a,o=this._b,i=this._c;return n?e.alter(n,(function(){return e[t].sample(r,o,i)})):e[t].sample(r,o,i)},function(n){for(var r=0;r<n.length;r++)!function(n){e[t].prototype[n]=function(r){var o=this._a,i=this._b,a=this._c;return r||0===r||(r=this.data),"number"!=typeof r?e.fn.map.call(r,(function(r){return e[t][n](r,o,i,a)})):e[t][n](r,o,i,a)}}(n[r])}("pdf cdf inv".split(" ")),function(n){for(var r=0;r<n.length;r++)!function(n){e[t].prototype[n]=function(){return e[t][n](this._a,this._b,this._c)}}(n[r])}("mean median mode variance".split(" "))}(t[n])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),e.extend(e.beta,{pdf:function(n,r,o){return n>1||n<0?0:1==r&&1==o?1:r<512&&o<512?t.pow(n,r-1)*t.pow(1-n,o-1)/e.betafn(r,o):t.exp((r-1)*t.log(n)+(o-1)*t.log(1-n)-e.betaln(r,o))},cdf:function(t,n,r){return t>1||t<0?1*(t>1):e.ibeta(t,n,r)},inv:function(t,n,r){return e.ibetainv(t,n,r)},mean:function(e,t){return e/(e+t)},median:function(t,n){return e.ibetainv(.5,t,n)},mode:function(e,t){return(e-1)/(e+t-2)},sample:function(t,n){var r=e.randg(t);return r/(r+e.randg(n))},variance:function(e,n){return e*n/(t.pow(e+n,2)*(e+n+1))}}),e.extend(e.centralF,{pdf:function(n,r,o){var i;return n<0?0:r<=2?0===n&&r<2?1/0:0===n&&2===r?1:1/e.betafn(r/2,o/2)*t.pow(r/o,r/2)*t.pow(n,r/2-1)*t.pow(1+r/o*n,-(r+o)/2):(i=r*n/(o+n*r),r*(o/(o+n*r))/2*e.binomial.pdf((r-2)/2,(r+o-2)/2,i))},cdf:function(t,n,r){return t<0?0:e.ibeta(n*t/(n*t+r),n/2,r/2)},inv:function(t,n,r){return r/(n*(1/e.ibetainv(t,n/2,r/2)-1))},mean:function(e,t){return t>2?t/(t-2):void 0},mode:function(e,t){return e>2?t*(e-2)/(e*(t+2)):void 0},sample:function(t,n){return 2*e.randg(t/2)/t/(2*e.randg(n/2)/n)},variance:function(e,t){if(!(t<=4))return 2*t*t*(e+t-2)/(e*(t-2)*(t-2)*(t-4))}}),e.extend(e.cauchy,{pdf:function(e,n,r){return r<0?0:r/(t.pow(e-n,2)+t.pow(r,2))/t.PI},cdf:function(e,n,r){return t.atan((e-n)/r)/t.PI+.5},inv:function(e,n,r){return n+r*t.tan(t.PI*(e-.5))},median:function(e){return e},mode:function(e){return e},sample:function(n,r){return e.randn()*t.sqrt(1/(2*e.randg(.5)))*r+n}}),e.extend(e.chisquare,{pdf:function(n,r){return n<0?0:0===n&&2===r?.5:t.exp((r/2-1)*t.log(n)-n/2-r/2*t.log(2)-e.gammaln(r/2))},cdf:function(t,n){return t<0?0:e.lowRegGamma(n/2,t/2)},inv:function(t,n){return 2*e.gammapinv(t,.5*n)},mean:function(e){return e},median:function(e){return e*t.pow(1-2/(9*e),3)},mode:function(e){return e-2>0?e-2:0},sample:function(t){return 2*e.randg(t/2)},variance:function(e){return 2*e}}),e.extend(e.exponential,{pdf:function(e,n){return e<0?0:n*t.exp(-n*e)},cdf:function(e,n){return e<0?0:1-t.exp(-n*e)},inv:function(e,n){return-t.log(1-e)/n},mean:function(e){return 1/e},median:function(e){return 1/e*t.log(2)},mode:function(){return 0},sample:function(n){return-1/n*t.log(e._random_fn())},variance:function(e){return t.pow(e,-2)}}),e.extend(e.gamma,{pdf:function(n,r,o){return n<0?0:0===n&&1===r?1/o:t.exp((r-1)*t.log(n)-n/o-e.gammaln(r)-r*t.log(o))},cdf:function(t,n,r){return t<0?0:e.lowRegGamma(n,t/r)},inv:function(t,n,r){return e.gammapinv(t,n)*r},mean:function(e,t){return e*t},mode:function(e,t){if(e>1)return(e-1)*t},sample:function(t,n){return e.randg(t)*n},variance:function(e,t){return e*t*t}}),e.extend(e.invgamma,{pdf:function(n,r,o){return n<=0?0:t.exp(-(r+1)*t.log(n)-o/n-e.gammaln(r)+r*t.log(o))},cdf:function(t,n,r){return t<=0?0:1-e.lowRegGamma(n,r/t)},inv:function(t,n,r){return r/e.gammapinv(1-t,n)},mean:function(e,t){return e>1?t/(e-1):void 0},mode:function(e,t){return t/(e+1)},sample:function(t,n){return n/e.randg(t)},variance:function(e,t){if(!(e<=2))return t*t/((e-1)*(e-1)*(e-2))}}),e.extend(e.kumaraswamy,{pdf:function(e,n,r){return 0===e&&1===n?r:1===e&&1===r?n:t.exp(t.log(n)+t.log(r)+(n-1)*t.log(e)+(r-1)*t.log(1-t.pow(e,n)))},cdf:function(e,n,r){return e<0?0:e>1?1:1-t.pow(1-t.pow(e,n),r)},inv:function(e,n,r){return t.pow(1-t.pow(1-e,1/r),1/n)},mean:function(t,n){return n*e.gammafn(1+1/t)*e.gammafn(n)/e.gammafn(1+1/t+n)},median:function(e,n){return t.pow(1-t.pow(2,-1/n),1/e)},mode:function(e,n){if(e>=1&&n>=1&&1!==e&&1!==n)return t.pow((e-1)/(e*n-1),1/e)},variance:function(){throw new Error("variance not yet implemented")}}),e.extend(e.lognormal,{pdf:function(e,n,r){return e<=0?0:t.exp(-t.log(e)-.5*t.log(2*t.PI)-t.log(r)-t.pow(t.log(e)-n,2)/(2*r*r))},cdf:function(n,r,o){return n<0?0:.5+.5*e.erf((t.log(n)-r)/t.sqrt(2*o*o))},inv:function(n,r,o){return t.exp(-1.4142135623730951*o*e.erfcinv(2*n)+r)},mean:function(e,n){return t.exp(e+n*n/2)},median:function(e){return t.exp(e)},mode:function(e,n){return t.exp(e-n*n)},sample:function(n,r){return t.exp(e.randn()*r+n)},variance:function(e,n){return(t.exp(n*n)-1)*t.exp(2*e+n*n)}}),e.extend(e.noncentralt,{pdf:function(n,r,o){return t.abs(o)<1e-14?e.studentt.pdf(n,r):t.abs(n)<1e-14?t.exp(e.gammaln((r+1)/2)-o*o/2-.5*t.log(t.PI*r)-e.gammaln(r/2)):r/n*(e.noncentralt.cdf(n*t.sqrt(1+2/r),r+2,o)-e.noncentralt.cdf(n,r,o))},cdf:function(n,r,o){var i=1e-14;if(t.abs(o)<i)return e.studentt.cdf(n,r);var a=!1;n<0&&(a=!0,o=-o);for(var u=e.normal.cdf(-o,0,1),s=i+1,c=s,l=n*n/(n*n+r),f=0,m=t.exp(-o*o/2),h=t.exp(-o*o/2-.5*t.log(2)-e.gammaln(1.5))*o;f<200||c>i||s>i;)c=s,f>0&&(m*=o*o/(2*f),h*=o*o/(2*(f+.5))),u+=.5*(s=m*e.beta.cdf(l,f+.5,r/2)+h*e.beta.cdf(l,f+1,r/2)),f++;return a?1-u:u}}),e.extend(e.normal,{pdf:function(e,n,r){return t.exp(-.5*t.log(2*t.PI)-t.log(r)-t.pow(e-n,2)/(2*r*r))},cdf:function(n,r,o){return.5*(1+e.erf((n-r)/t.sqrt(2*o*o)))},inv:function(t,n,r){return-1.4142135623730951*r*e.erfcinv(2*t)+n},mean:function(e){return e},median:function(e){return e},mode:function(e){return e},sample:function(t,n){return e.randn()*n+t},variance:function(e,t){return t*t}}),e.extend(e.pareto,{pdf:function(e,n,r){return e<n?0:r*t.pow(n,r)/t.pow(e,r+1)},cdf:function(e,n,r){return e<n?0:1-t.pow(n/e,r)},inv:function(e,n,r){return n/t.pow(1-e,1/r)},mean:function(e,n){if(!(n<=1))return n*t.pow(e,n)/(n-1)},median:function(e,n){return e*(n*t.SQRT2)},mode:function(e){return e},variance:function(e,n){if(!(n<=2))return e*e*n/(t.pow(n-1,2)*(n-2))}}),e.extend(e.studentt,{pdf:function(n,r){return r=r>1e100?1e100:r,1/(t.sqrt(r)*e.betafn(.5,r/2))*t.pow(1+n*n/r,-(r+1)/2)},cdf:function(n,r){var o=r/2;return e.ibeta((n+t.sqrt(n*n+r))/(2*t.sqrt(n*n+r)),o,o)},inv:function(n,r){var o=e.ibetainv(2*t.min(n,1-n),.5*r,.5);return o=t.sqrt(r*(1-o)/o),n>.5?o:-o},mean:function(e){return e>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return e.randn()*t.sqrt(n/(2*e.randg(n/2)))},variance:function(e){return e>2?e/(e-2):e>1?1/0:void 0}}),e.extend(e.weibull,{pdf:function(e,n,r){return e<0||n<0||r<0?0:r/n*t.pow(e/n,r-1)*t.exp(-t.pow(e/n,r))},cdf:function(e,n,r){return e<0?0:1-t.exp(-t.pow(e/n,r))},inv:function(e,n,r){return n*t.pow(-t.log(1-e),1/r)},mean:function(t,n){return t*e.gammafn(1+1/n)},median:function(e,n){return e*t.pow(t.log(2),1/n)},mode:function(e,n){return n<=1?0:e*t.pow((n-1)/n,1/n)},sample:function(n,r){return n*t.pow(-t.log(e._random_fn()),1/r)},variance:function(n,r){return n*n*e.gammafn(1+2/r)-t.pow(e.weibull.mean(n,r),2)}}),e.extend(e.uniform,{pdf:function(e,t,n){return e<t||e>n?0:1/(n-t)},cdf:function(e,t,n){return e<t?0:e<n?(e-t)/(n-t):1},inv:function(e,t,n){return t+e*(n-t)},mean:function(e,t){return.5*(e+t)},median:function(t,n){return e.mean(t,n)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(t,n){return t/2+n/2+(n/2-t/2)*(2*e._random_fn()-1)},variance:function(e,n){return t.pow(n-e,2)/12}}),e.extend(e.binomial,{pdf:function(n,r,o){return 0===o||1===o?r*o===n?1:0:e.combination(r,n)*t.pow(o,n)*t.pow(1-o,r-n)},cdf:function(r,o,i){var a,u=1e-10;if(r<0)return 0;if(r>=o)return 1;if(i<0||i>1||o<=0)return NaN;var s=i,c=(r=t.floor(r))+1,l=o-r,f=c+l,m=t.exp(e.gammaln(f)-e.gammaln(l)-e.gammaln(c)+c*t.log(s)+l*t.log(1-s));return a=s<(c+1)/(f+2)?m*n(s,c,l,u):1-m*n(1-s,l,c,u),t.round(1/u*(1-a))/(1/u)}}),e.extend(e.negbin,{pdf:function(n,r,o){return n===n>>>0&&(n<0?0:e.combination(n+r-1,r-1)*t.pow(1-o,n)*t.pow(o,r))},cdf:function(t,n,r){var o=0,i=0;if(t<0)return 0;for(;i<=t;i++)o+=e.negbin.pdf(i,n,r);return o}}),e.extend(e.hypgeom,{pdf:function(n,r,o,i){if(n!=n|0)return!1;if(n<0||n<o-(r-i))return 0;if(n>i||n>o)return 0;if(2*o>r)return 2*i>r?e.hypgeom.pdf(r-o-i+n,r,r-o,r-i):e.hypgeom.pdf(i-n,r,r-o,i);if(2*i>r)return e.hypgeom.pdf(o-n,r,o,r-i);if(o<i)return e.hypgeom.pdf(n,r,i,o);for(var a=1,u=0,s=0;s<n;s++){for(;a>1&&u<i;)a*=1-o/(r-u),u++;a*=(i-s)*(o-s)/((s+1)*(r-o-i+s+1))}for(;u<i;u++)a*=1-o/(r-u);return t.min(1,t.max(0,a))},cdf:function(n,r,o,i){if(n<0||n<o-(r-i))return 0;if(n>=i||n>=o)return 1;if(2*o>r)return 2*i>r?e.hypgeom.cdf(r-o-i+n,r,r-o,r-i):1-e.hypgeom.cdf(i-n-1,r,r-o,i);if(2*i>r)return 1-e.hypgeom.cdf(o-n-1,r,o,r-i);if(o<i)return e.hypgeom.cdf(n,r,i,o);for(var a=1,u=1,s=0,c=0;c<n;c++){for(;a>1&&s<i;){var l=1-o/(r-s);u*=l,a*=l,s++}a+=u*=(i-c)*(o-c)/((c+1)*(r-o-i+c+1))}for(;s<i;s++)a*=1-o/(r-s);return t.min(1,t.max(0,a))}}),e.extend(e.poisson,{pdf:function(n,r){return r<0||n%1!=0||n<0?0:t.pow(r,n)*t.exp(-r)/e.factorial(n)},cdf:function(t,n){var r=[],o=0;if(t<0)return 0;for(;o<=t;o++)r.push(e.poisson.pdf(o,n));return e.sum(r)},mean:function(e){return e},variance:function(e){return e},sampleSmall:function(n){var r=1,o=0,i=t.exp(-n);do{o++,r*=e._random_fn()}while(r>i);return o-1},sampleLarge:function(n){var r,o,i,a,u,s,c,l,f,m,h=n;for(a=t.sqrt(h),u=t.log(h),s=.02483*(c=.931+2.53*a)-.059,l=1.1239+1.1328/(c-3.4),f=.9277-3.6224/(c-2);;){if(o=t.random()-.5,i=t.random(),m=.5-t.abs(o),r=t.floor((2*s/m+c)*o+h+.43),m>=.07&&i<=f)return r;if(!(r<0||m<.013&&i>m)&&t.log(i)+t.log(l)-t.log(s/(m*m)+c)<=r*u-h-e.loggam(r+1))return r}},sample:function(e){return e<10?this.sampleSmall(e):this.sampleLarge(e)}}),e.extend(e.triangular,{pdf:function(e,t,n,r){return n<=t||r<t||r>n?NaN:e<t||e>n?0:e<r?2*(e-t)/((n-t)*(r-t)):e===r?2/(n-t):2*(n-e)/((n-t)*(n-r))},cdf:function(e,n,r,o){return r<=n||o<n||o>r?NaN:e<=n?0:e>=r?1:e<=o?t.pow(e-n,2)/((r-n)*(o-n)):1-t.pow(r-e,2)/((r-n)*(r-o))},inv:function(e,n,r,o){return r<=n||o<n||o>r?NaN:e<=(o-n)/(r-n)?n+(r-n)*t.sqrt(e*((o-n)/(r-n))):n+(r-n)*(1-t.sqrt((1-e)*(1-(o-n)/(r-n))))},mean:function(e,t,n){return(e+t+n)/3},median:function(e,n,r){return r<=(e+n)/2?n-t.sqrt((n-e)*(n-r))/t.sqrt(2):r>(e+n)/2?e+t.sqrt((n-e)*(r-e))/t.sqrt(2):void 0},mode:function(e,t,n){return n},sample:function(n,r,o){var i=e._random_fn();return i<(o-n)/(r-n)?n+t.sqrt(i*(r-n)*(o-n)):r-t.sqrt((1-i)*(r-n)*(r-o))},variance:function(e,t,n){return(e*e+t*t+n*n-e*t-e*n-t*n)/18}}),e.extend(e.arcsine,{pdf:function(e,n,r){return r<=n?NaN:e<=n||e>=r?0:2/t.PI*t.pow(t.pow(r-n,2)-t.pow(2*e-n-r,2),-.5)},cdf:function(e,n,r){return e<n?0:e<r?2/t.PI*t.asin(t.sqrt((e-n)/(r-n))):1},inv:function(e,n,r){return n+(.5-.5*t.cos(t.PI*e))*(r-n)},mean:function(e,t){return t<=e?NaN:(e+t)/2},median:function(e,t){return t<=e?NaN:(e+t)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(n,r){return(n+r)/2+(r-n)/2*t.sin(2*t.PI*e.uniform.sample(0,1))},variance:function(e,n){return n<=e?NaN:t.pow(n-e,2)/8}}),e.extend(e.laplace,{pdf:function(e,n,r){return r<=0?0:t.exp(-t.abs(e-n)/r)/(2*r)},cdf:function(e,n,r){return r<=0?0:e<n?.5*t.exp((e-n)/r):1-.5*t.exp(-(e-n)/r)},mean:function(e){return e},median:function(e){return e},mode:function(e){return e},variance:function(e,t){return 2*t*t},sample:function(n,r){var o,i=e._random_fn()-.5;return n-r*((o=i)/t.abs(o))*t.log(1-2*t.abs(i))}}),e.extend(e.tukey,{cdf:function(n,o,i){var a=o,u=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],s=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(i<2||a<2)return NaN;if(!Number.isFinite(n))return 1;if(i>25e3)return r(n,1,a);var c,l=.5*i,f=l*t.log(i)-i*t.log(2)-e.gammaln(l),m=l-1,h=.25*i;c=i<=100?1:i<=800?.5:i<=5e3?.25:.125,f+=t.log(c);for(var d=0,p=1;p<=50;p++){for(var g=0,v=(2*p-1)*c,y=1;y<=16;y++){var A,x;8<y?(A=y-8-1,x=f+m*t.log(v+u[A]*c)-(u[A]*c+v)*h):(A=y-1,x=f+m*t.log(v-u[A]*c)+(u[A]*c-v)*h),x>=-30&&(g+=r(8<y?n*t.sqrt(.5*(u[A]*c+v)):n*t.sqrt(.5*(-u[A]*c+v)),1,a)*s[A]*t.exp(x))}if(p*c>=1&&g<=1e-14)break;d+=g}if(g>1e-14)throw new Error("tukey.cdf failed to converge");return d>1&&(d=1),d},inv:function(n,r,o){if(o<2||r<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var i,a=function(e,n,r){var o=.5-.5*e,i=t.sqrt(t.log(1/(o*o))),a=i+((((-453642210148e-16*i-.204231210125)*i-.342242088547)*i-1)*i+.322232421088)/((((.0038560700634*i+.10353775285)*i+.531103462366)*i+.588581570495)*i+.099348462606);r<120&&(a+=(a*a*a+a)/r/4);var u=.8832-.2368*a;return r<120&&(u+=-1.214/r+1.208*a/r),a*(u*t.log(n-1)+1.4142)}(n,r,o),u=e.tukey.cdf(a,r,o)-n;i=u>0?t.max(0,a-1):a+1;for(var s,c=e.tukey.cdf(i,r,o)-n,l=1;l<50;l++)if(s=i-c*(i-a)/(c-u),u=c,a=i,s<0&&(s=0,c=-n),c=e.tukey.cdf(s,r,o)-n,i=s,t.abs(i-a)<1e-4)return s;throw new Error("tukey.inv failed to converge")}})}(t,Math),function(e,t){var n,r,o=Array.prototype.push,i=e.utils.isArray;function a(t){return i(t)||t instanceof e}e.extend({add:function(t,n){return a(n)?(a(n[0])||(n=[n]),e.map(t,(function(e,t,r){return e+n[t][r]}))):e.map(t,(function(e){return e+n}))},subtract:function(t,n){return a(n)?(a(n[0])||(n=[n]),e.map(t,(function(e,t,r){return e-n[t][r]||0}))):e.map(t,(function(e){return e-n}))},divide:function(t,n){return a(n)?(a(n[0])||(n=[n]),e.multiply(t,e.inv(n))):e.map(t,(function(e){return e/n}))},multiply:function(t,n){var r,o,i,u,s,c,l,f;if(void 0===t.length&&void 0===n.length)return t*n;if(s=t.length,c=t[0].length,l=e.zeros(s,i=a(n)?n[0].length:c),f=0,a(n)){for(;f<i;f++)for(r=0;r<s;r++){for(u=0,o=0;o<c;o++)u+=t[r][o]*n[o][f];l[r][f]=u}return 1===s&&1===f?l[0][0]:l}return e.map(t,(function(e){return e*n}))},outer:function(t,n){return e.multiply(t.map((function(e){return[e]})),[n])},dot:function(t,n){a(t[0])||(t=[t]),a(n[0])||(n=[n]);for(var r,o,i=1===t[0].length&&1!==t.length?e.transpose(t):t,u=1===n[0].length&&1!==n.length?e.transpose(n):n,s=[],c=0,l=i.length,f=i[0].length;c<l;c++){for(s[c]=[],r=0,o=0;o<f;o++)r+=i[c][o]*u[c][o];s[c]=r}return 1===s.length?s[0]:s},pow:function(n,r){return e.map(n,(function(e){return t.pow(e,r)}))},exp:function(n){return e.map(n,(function(e){return t.exp(e)}))},log:function(n){return e.map(n,(function(e){return t.log(e)}))},abs:function(n){return e.map(n,(function(e){return t.abs(e)}))},norm:function(e,n){var r=0,o=0;for(isNaN(n)&&(n=2),a(e[0])&&(e=e[0]);o<e.length;o++)r+=t.pow(t.abs(e[o]),n);return t.pow(r,1/n)},angle:function(n,r){return t.acos(e.dot(n,r)/(e.norm(n)*e.norm(r)))},aug:function(e,t){var n,r=[];for(n=0;n<e.length;n++)r.push(e[n].slice());for(n=0;n<r.length;n++)o.apply(r[n],t[n]);return r},inv:function(t){for(var n,r=t.length,o=t[0].length,i=e.identity(r,o),a=e.gauss_jordan(t,i),u=[],s=0;s<r;s++)for(u[s]=[],n=o;n<a[0].length;n++)u[s][n-o]=a[s][n];return u},det:function e(t){if(2===t.length)return t[0][0]*t[1][1]-t[0][1]*t[1][0];for(var n=0,r=0;r<t.length;r++){for(var o=[],i=1;i<t.length;i++){o[i-1]=[];for(var a=0;a<t.length;a++)a<r?o[i-1][a]=t[i][a]:a>r&&(o[i-1][a-1]=t[i][a])}var u=r%2?-1:1;n+=e(o)*t[0][r]*u}return n},gauss_elimination:function(n,r){var o,i,a,u,s=0,c=0,l=n.length,f=n[0].length,m=1,h=0,d=[];for(o=(n=e.aug(n,r))[0].length,s=0;s<l;s++){for(i=n[s][s],c=s,u=s+1;u<f;u++)i<t.abs(n[u][s])&&(i=n[u][s],c=u);if(c!=s)for(u=0;u<o;u++)a=n[s][u],n[s][u]=n[c][u],n[c][u]=a;for(c=s+1;c<l;c++)for(m=n[c][s]/n[s][s],u=s;u<o;u++)n[c][u]=n[c][u]-m*n[s][u]}for(s=l-1;s>=0;s--){for(h=0,c=s+1;c<=l-1;c++)h+=d[c]*n[s][c];d[s]=(n[s][o-1]-h)/n[s][s]}return d},gauss_jordan:function(n,r){var o,i,a,u=e.aug(n,r),s=u.length,c=u[0].length,l=0;for(i=0;i<s;i++){var f=i;for(a=i+1;a<s;a++)t.abs(u[a][i])>t.abs(u[f][i])&&(f=a);var m=u[i];for(u[i]=u[f],u[f]=m,a=i+1;a<s;a++)for(l=u[a][i]/u[i][i],o=i;o<c;o++)u[a][o]-=u[i][o]*l}for(i=s-1;i>=0;i--){for(l=u[i][i],a=0;a<i;a++)for(o=c-1;o>i-1;o--)u[a][o]-=u[i][o]*u[a][i]/l;for(u[i][i]/=l,o=s;o<c;o++)u[i][o]/=l}return u},triaUpSolve:function(t,n){var r,o=t[0].length,i=e.zeros(1,o)[0],a=!1;return null!=n[0].length&&(n=n.map((function(e){return e[0]})),a=!0),e.arange(o-1,-1,-1).forEach((function(a){r=e.arange(a+1,o).map((function(e){return i[e]*t[a][e]})),i[a]=(n[a]-e.sum(r))/t[a][a]})),a?i.map((function(e){return[e]})):i},triaLowSolve:function(t,n){var r,o=t[0].length,i=e.zeros(1,o)[0],a=!1;return null!=n[0].length&&(n=n.map((function(e){return e[0]})),a=!0),e.arange(o).forEach((function(o){r=e.arange(o).map((function(e){return t[o][e]*i[e]})),i[o]=(n[o]-e.sum(r))/t[o][o]})),a?i.map((function(e){return[e]})):i},lu:function(t){var n,r=t.length,o=e.identity(r),i=e.zeros(t.length,t[0].length);return e.arange(r).forEach((function(e){i[0][e]=t[0][e]})),e.arange(1,r).forEach((function(a){e.arange(a).forEach((function(r){n=e.arange(r).map((function(e){return o[a][e]*i[e][r]})),o[a][r]=(t[a][r]-e.sum(n))/i[r][r]})),e.arange(a,r).forEach((function(r){n=e.arange(a).map((function(e){return o[a][e]*i[e][r]})),i[a][r]=t[n.length][r]-e.sum(n)}))})),[o,i]},cholesky:function(n){var r,o=n.length,i=e.zeros(n.length,n[0].length);return e.arange(o).forEach((function(a){r=e.arange(a).map((function(e){return t.pow(i[a][e],2)})),i[a][a]=t.sqrt(n[a][a]-e.sum(r)),e.arange(a+1,o).forEach((function(t){r=e.arange(a).map((function(e){return i[a][e]*i[t][e]})),i[t][a]=(n[a][t]-e.sum(r))/i[a][a]}))})),i},gauss_jacobi:function(n,r,o,i){for(var a,u,s,c,l=0,f=0,m=n.length,h=[],d=[],p=[];l<m;l++)for(h[l]=[],d[l]=[],p[l]=[],f=0;f<m;f++)l>f?(h[l][f]=n[l][f],d[l][f]=p[l][f]=0):l<f?(d[l][f]=n[l][f],h[l][f]=p[l][f]=0):(p[l][f]=n[l][f],h[l][f]=d[l][f]=0);for(s=e.multiply(e.multiply(e.inv(p),e.add(h,d)),-1),u=e.multiply(e.inv(p),r),a=o,c=e.add(e.multiply(s,o),u),l=2;t.abs(e.norm(e.subtract(c,a)))>i;)a=c,c=e.add(e.multiply(s,a),u),l++;return c},gauss_seidel:function(n,r,o,i){for(var a,u,s,c,l,f=0,m=n.length,h=[],d=[],p=[];f<m;f++)for(h[f]=[],d[f]=[],p[f]=[],a=0;a<m;a++)f>a?(h[f][a]=n[f][a],d[f][a]=p[f][a]=0):f<a?(d[f][a]=n[f][a],h[f][a]=p[f][a]=0):(p[f][a]=n[f][a],h[f][a]=d[f][a]=0);for(c=e.multiply(e.multiply(e.inv(e.add(p,h)),d),-1),s=e.multiply(e.inv(e.add(p,h)),r),u=o,l=e.add(e.multiply(c,o),s),f=2;t.abs(e.norm(e.subtract(l,u)))>i;)u=l,l=e.add(e.multiply(c,u),s),f+=1;return l},SOR:function(n,r,o,i,a){for(var u,s,c,l,f,m=0,h=n.length,d=[],p=[],g=[];m<h;m++)for(d[m]=[],p[m]=[],g[m]=[],u=0;u<h;u++)m>u?(d[m][u]=n[m][u],p[m][u]=g[m][u]=0):m<u?(p[m][u]=n[m][u],d[m][u]=g[m][u]=0):(g[m][u]=n[m][u],d[m][u]=p[m][u]=0);for(l=e.multiply(e.inv(e.add(g,e.multiply(d,a))),e.subtract(e.multiply(g,1-a),e.multiply(p,a))),c=e.multiply(e.multiply(e.inv(e.add(g,e.multiply(d,a))),r),a),s=o,f=e.add(e.multiply(l,o),c),m=2;t.abs(e.norm(e.subtract(f,s)))>i;)s=f,f=e.add(e.multiply(l,s),c),m++;return f},householder:function(n){for(var r,o,i,a,u=n.length,s=n[0].length,c=0,l=[],f=[];c<u-1;c++){for(r=0,a=c+1;a<s;a++)r+=n[a][c]*n[a][c];for(r=(n[c+1][c]>0?-1:1)*t.sqrt(r),o=t.sqrt((r*r-n[c+1][c]*r)/2),(l=e.zeros(u,1))[c+1][0]=(n[c+1][c]-r)/(2*o),i=c+2;i<u;i++)l[i][0]=n[i][c]/(2*o);f=e.subtract(e.identity(u,s),e.multiply(e.multiply(l,e.transpose(l)),2)),n=e.multiply(f,e.multiply(n,f))}return n},QR:(n=e.sum,r=e.arange,function(o){var i,a,u,s=o.length,c=o[0].length,l=e.zeros(c,c);for(o=e.copy(o),a=0;a<c;a++){for(l[a][a]=t.sqrt(n(r(s).map((function(e){return o[e][a]*o[e][a]})))),i=0;i<s;i++)o[i][a]=o[i][a]/l[a][a];for(u=a+1;u<c;u++)for(l[a][u]=n(r(s).map((function(e){return o[e][a]*o[e][u]}))),i=0;i<s;i++)o[i][u]=o[i][u]-o[i][a]*l[a][u]}return[o,l]}),lstsq:function(t,n){var r=!1;void 0===n[0].length&&(n=n.map((function(e){return[e]})),r=!0);var o=e.QR(t),i=o[0],a=o[1],u=t[0].length,s=e.slice(i,{col:{end:u}}),c=function(t){var n=(t=e.copy(t)).length,r=e.identity(n);return e.arange(n-1,-1,-1).forEach((function(n){e.sliceAssign(r,{row:n},e.divide(e.slice(r,{row:n}),t[n][n])),e.sliceAssign(t,{row:n},e.divide(e.slice(t,{row:n}),t[n][n])),e.arange(n).forEach((function(o){var i=e.multiply(t[o][n],-1),a=e.slice(t,{row:o}),u=e.multiply(e.slice(t,{row:n}),i);e.sliceAssign(t,{row:o},e.add(a,u));var s=e.slice(r,{row:o}),c=e.multiply(e.slice(r,{row:n}),i);e.sliceAssign(r,{row:o},e.add(s,c))}))})),r}(e.slice(a,{row:{end:u}})),l=e.transpose(s);void 0===l[0].length&&(l=[l]);var f=e.multiply(e.multiply(c,l),n);return void 0===f.length&&(f=[[f]]),r?f.map((function(e){return e[0]})):f},jacobi:function(n){for(var r,o,i,a,u,s,c,l=1,f=n.length,m=e.identity(f,f),h=[];1===l;){for(u=n[0][1],i=0,a=1,r=0;r<f;r++)for(o=0;o<f;o++)r!=o&&u<t.abs(n[r][o])&&(u=t.abs(n[r][o]),i=r,a=o);for(s=n[i][i]===n[a][a]?n[i][a]>0?t.PI/4:-t.PI/4:t.atan(2*n[i][a]/(n[i][i]-n[a][a]))/2,(c=e.identity(f,f))[i][i]=t.cos(s),c[i][a]=-t.sin(s),c[a][i]=t.sin(s),c[a][a]=t.cos(s),m=e.multiply(m,c),n=e.multiply(e.multiply(e.inv(c),n),c),l=0,r=1;r<f;r++)for(o=1;o<f;o++)r!=o&&t.abs(n[r][o])>.001&&(l=1)}for(r=0;r<f;r++)h.push(n[r][r]);return[m,h]},rungekutta:function(e,t,n,r,o,i){var a,u,s;if(2===i)for(;r<=n;)o+=((a=t*e(r,o))+(u=t*e(r+t,o+a)))/2,r+=t;if(4===i)for(;r<=n;)o+=((a=t*e(r,o))+2*(u=t*e(r+t/2,o+a/2))+2*(s=t*e(r+t/2,o+u/2))+t*e(r+t,o+s))/6,r+=t;return o},romberg:function(e,n,r,o){for(var i,a,u,s,c,l=0,f=(r-n)/2,m=[],h=[],d=[];l<o/2;){for(c=e(n),u=n,s=0;u<=r;u+=f,s++)m[s]=u;for(i=m.length,u=1;u<i-1;u++)c+=(u%2!=0?4:2)*e(m[u]);c=f/3*(c+e(r)),d[l]=c,f/=2,l++}for(a=d.length,i=1;1!==a;){for(u=0;u<a-1;u++)h[u]=(t.pow(4,i)*d[u+1]-d[u])/(t.pow(4,i)-1);a=h.length,d=h,h=[],i++}return d},richardson:function(e,n,r,o){function i(e,t){for(var n,r=0,o=e.length;r<o;r++)e[r]===t&&(n=r);return n}for(var a,u,s,c,l,f=t.abs(r-e[i(e,r)+1]),m=0,h=[],d=[];o>=f;)a=i(e,r+o),u=i(e,r),h[m]=(n[a]-2*n[u]+n[2*u-a])/(o*o),o/=2,m++;for(c=h.length,s=1;1!=c;){for(l=0;l<c-1;l++)d[l]=(t.pow(4,s)*h[l+1]-h[l])/(t.pow(4,s)-1);c=d.length,h=d,d=[],s++}return h},simpson:function(e,t,n,r){for(var o,i=(n-t)/r,a=e(t),u=[],s=t,c=0,l=1;s<=n;s+=i,c++)u[c]=s;for(o=u.length;l<o-1;l++)a+=(l%2!=0?4:2)*e(u[l]);return i/3*(a+e(n))},hermite:function(e,t,n,r){for(var o,i=e.length,a=0,u=0,s=[],c=[],l=[],f=[];u<i;u++){for(s[u]=1,o=0;o<i;o++)u!=o&&(s[u]*=(r-e[o])/(e[u]-e[o]));for(c[u]=0,o=0;o<i;o++)u!=o&&(c[u]+=1/(e[u]-e[o]));l[u]=(1-2*(r-e[u])*c[u])*(s[u]*s[u]),f[u]=(r-e[u])*(s[u]*s[u]),a+=l[u]*t[u]+f[u]*n[u]}return a},lagrange:function(e,t,n){for(var r,o,i=0,a=0,u=e.length;a<u;a++){for(o=t[a],r=0;r<u;r++)a!=r&&(o*=(n-e[r])/(e[a]-e[r]));i+=o}return i},cubic_spline:function(t,n,r){for(var o,i,a=t.length,u=0,s=[],c=[],l=[],f=[],m=[],h=[];u<a-1;u++)f[u]=t[u+1]-t[u];for(l[0]=0,u=1;u<a-1;u++)l[u]=3/f[u]*(n[u+1]-n[u])-3/f[u-1]*(n[u]-n[u-1]);for(u=1;u<a-1;u++)s[u]=[],c[u]=[],s[u][u-1]=f[u-1],s[u][u]=2*(f[u-1]+f[u]),s[u][u+1]=f[u],c[u][0]=l[u];for(i=e.multiply(e.inv(s),c),o=0;o<a-1;o++)m[o]=(n[o+1]-n[o])/f[o]-f[o]*(i[o+1][0]+2*i[o][0])/3,h[o]=(i[o+1][0]-i[o][0])/(3*f[o]);for(o=0;o<a&&!(t[o]>r);o++);return n[o-=1]+(r-t[o])*m[o]+e.sq(r-t[o])*i[o]+(r-t[o])*e.sq(r-t[o])*h[o]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(t){var n,r,o,i,a,u=t.length,s=t[0].length,c=0,l=[],f=[],m=[],h=[],d=[],p=[],g=[];for(c=0;c<u;c++)l[c]=e.sum(t[c])/s;for(c=0;c<s;c++)for(d[c]=[],n=0;n<u;n++)d[c][n]=t[n][c]-l[n];for(d=e.transpose(d),c=0;c<u;c++)for(p[c]=[],n=0;n<u;n++)p[c][n]=e.dot([d[c]],[d[n]])/(s-1);for(a=(o=e.jacobi(p))[0],f=o[1],g=e.transpose(a),c=0;c<f.length;c++)for(n=c;n<f.length;n++)f[c]<f[n]&&(r=f[c],f[c]=f[n],f[n]=r,m=g[c],g[c]=g[n],g[n]=m);for(i=e.transpose(d),c=0;c<u;c++)for(h[c]=[],n=0;n<i.length;n++)h[c][n]=e.dot([g[c]],[i[n]]);return[t,f,g,h]}}),function(t){for(var n=0;n<t.length;n++)!function(t){e.fn[t]=function(n,r){var o=this;return r?(setTimeout((function(){r.call(o,e.fn[t].call(o,n))}),15),this):"number"==typeof e[t](this,n)?e[t](this,n):e(e[t](this,n))}}(t[n])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(t,Math),function(e,t){var n=[].slice,r=e.utils.isNumber,o=e.utils.isArray;function i(e,n,r,o){if(e>1||r>1||e<=0||r<=0)throw new Error("Proportions should be greater than 0 and less than 1");var i=(e*n+r*o)/(n+o);return(e-r)/t.sqrt(i*(1-i)*(1/n+1/o))}e.extend({zscore:function(){var t=n.call(arguments);return r(t[1])?(t[0]-t[1])/t[2]:(t[0]-e.mean(t[1]))/e.stdev(t[1],t[2])},ztest:function(){var r,i=n.call(arguments);return o(i[1])?(r=e.zscore(i[0],i[1],i[3]),1===i[2]?e.normal.cdf(-t.abs(r),0,1):2*e.normal.cdf(-t.abs(r),0,1)):i.length>2?(r=e.zscore(i[0],i[1],i[2]),1===i[3]?e.normal.cdf(-t.abs(r),0,1):2*e.normal.cdf(-t.abs(r),0,1)):(r=i[0],1===i[1]?e.normal.cdf(-t.abs(r),0,1):2*e.normal.cdf(-t.abs(r),0,1))}}),e.extend(e.fn,{zscore:function(e,t){return(e-this.mean())/this.stdev(t)},ztest:function(n,r,o){var i=t.abs(this.zscore(n,o));return 1===r?e.normal.cdf(-i,0,1):2*e.normal.cdf(-i,0,1)}}),e.extend({tscore:function(){var r=n.call(arguments);return 4===r.length?(r[0]-r[1])/(r[2]/t.sqrt(r[3])):(r[0]-e.mean(r[1]))/(e.stdev(r[1],!0)/t.sqrt(r[1].length))},ttest:function(){var o,i=n.call(arguments);return 5===i.length?(o=t.abs(e.tscore(i[0],i[1],i[2],i[3])),1===i[4]?e.studentt.cdf(-o,i[3]-1):2*e.studentt.cdf(-o,i[3]-1)):r(i[1])?(o=t.abs(i[0]),1==i[2]?e.studentt.cdf(-o,i[1]-1):2*e.studentt.cdf(-o,i[1]-1)):(o=t.abs(e.tscore(i[0],i[1])),1==i[2]?e.studentt.cdf(-o,i[1].length-1):2*e.studentt.cdf(-o,i[1].length-1))}}),e.extend(e.fn,{tscore:function(e){return(e-this.mean())/(this.stdev(!0)/t.sqrt(this.cols()))},ttest:function(n,r){return 1===r?1-e.studentt.cdf(t.abs(this.tscore(n)),this.cols()-1):2*e.studentt.cdf(-t.abs(this.tscore(n)),this.cols()-1)}}),e.extend({anovafscore:function(){var r,o,i,a,u,s,c,l,f=n.call(arguments);if(1===f.length){for(u=new Array(f[0].length),c=0;c<f[0].length;c++)u[c]=f[0][c];f=u}for(o=new Array,c=0;c<f.length;c++)o=o.concat(f[c]);for(i=e.mean(o),r=0,c=0;c<f.length;c++)r+=f[c].length*t.pow(e.mean(f[c])-i,2);for(r/=f.length-1,s=0,c=0;c<f.length;c++)for(a=e.mean(f[c]),l=0;l<f[c].length;l++)s+=t.pow(f[c][l]-a,2);return r/(s/(o.length-f.length))},anovaftest:function(){var t,o,i,a,u=n.call(arguments);if(r(u[0]))return 1-e.centralF.cdf(u[0],u[1],u[2]);var s=e.anovafscore(u);for(t=u.length-1,i=0,a=0;a<u.length;a++)i+=u[a].length;return o=i-t-1,1-e.centralF.cdf(s,t,o)},ftest:function(t,n,r){return 1-e.centralF.cdf(t,n,r)}}),e.extend(e.fn,{anovafscore:function(){return e.anovafscore(this.toArray())},anovaftes:function(){var t,n=0;for(t=0;t<this.length;t++)n+=this[t].length;return e.ftest(this.anovafscore(),this.length-1,n-this.length)}}),e.extend({qscore:function(){var o,i,a,u,s,c=n.call(arguments);return r(c[0])?(o=c[0],i=c[1],a=c[2],u=c[3],s=c[4]):(o=e.mean(c[0]),i=e.mean(c[1]),a=c[0].length,u=c[1].length,s=c[2]),t.abs(o-i)/(s*t.sqrt((1/a+1/u)/2))},qtest:function(){var t,r=n.call(arguments);3===r.length?(t=r[0],r=r.slice(1)):7===r.length?(t=e.qscore(r[0],r[1],r[2],r[3],r[4]),r=r.slice(5)):(t=e.qscore(r[0],r[1],r[2]),r=r.slice(3));var o=r[0],i=r[1];return 1-e.tukey.cdf(t,i,o-i)},tukeyhsd:function(t){for(var n=e.pooledstdev(t),r=t.map((function(t){return e.mean(t)})),o=t.reduce((function(e,t){return e+t.length}),0),i=[],a=0;a<t.length;++a)for(var u=a+1;u<t.length;++u){var s=e.qtest(r[a],r[u],t[a].length,t[u].length,n,o,t.length);i.push([[a,u],s])}return i}}),e.extend({normalci:function(){var r,o=n.call(arguments),i=new Array(2);return r=4===o.length?t.abs(e.normal.inv(o[1]/2,0,1)*o[2]/t.sqrt(o[3])):t.abs(e.normal.inv(o[1]/2,0,1)*e.stdev(o[2])/t.sqrt(o[2].length)),i[0]=o[0]-r,i[1]=o[0]+r,i},tci:function(){var r,o=n.call(arguments),i=new Array(2);return r=4===o.length?t.abs(e.studentt.inv(o[1]/2,o[3]-1)*o[2]/t.sqrt(o[3])):t.abs(e.studentt.inv(o[1]/2,o[2].length-1)*e.stdev(o[2],!0)/t.sqrt(o[2].length)),i[0]=o[0]-r,i[1]=o[0]+r,i},significant:function(e,t){return e<t}}),e.extend(e.fn,{normalci:function(t,n){return e.normalci(t,n,this.toArray())},tci:function(t,n){return e.tci(t,n,this.toArray())}}),e.extend(e.fn,{oneSidedDifferenceOfProportions:function(t,n,r,o){var a=i(t,n,r,o);return e.ztest(a,1)},twoSidedDifferenceOfProportions:function(t,n,r,o){var a=i(t,n,r,o);return e.ztest(a,2)}})}(t,Math),t.models=function(){function e(e,n){var r=e.length,o=n[0].length-1,i=r-o-1,a=t.lstsq(n,e),u=t.multiply(n,a.map((function(e){return[e]}))).map((function(e){return e[0]})),s=t.subtract(e,u),c=t.mean(e),l=t.sum(u.map((function(e){return Math.pow(e-c,2)}))),f=t.sum(e.map((function(e,t){return Math.pow(e-u[t],2)}))),m=l+f;return{exog:n,endog:e,nobs:r,df_model:o,df_resid:i,coef:a,predict:u,resid:s,ybar:c,SST:m,SSE:l,SSR:f,R2:l/m}}function n(n){var r,o,i=(r=n.exog,o=r[0].length,t.arange(o).map((function(n){var i=t.arange(o).filter((function(e){return e!==n}));return e(t.col(r,n).map((function(e){return e[0]})),t.col(r,i))}))),a=Math.sqrt(n.SSR/n.df_resid),u=i.map((function(e){var t=e.SST,n=e.R2;return a/Math.sqrt(t*(1-n))})),s=n.coef.map((function(e,t){return(e-0)/u[t]})),c=s.map((function(e){var r=t.studentt.cdf(e,n.df_resid);return 2*(r>.5?1-r:r)})),l=t.studentt.inv(.975,n.df_resid),f=n.coef.map((function(e,t){var n=l*u[t];return[e-n,e+n]}));return{se:u,t:s,p:c,sigmaHat:a,interval95:f}}return{ols:function(r,o){var i=e(r,o),a=n(i),u=function(e){var n,r,o,i=e.R2/e.df_model/((1-e.R2)/e.df_resid);return{F_statistic:i,pvalue:1-(n=i,r=e.df_model,o=e.df_resid,t.beta.cdf(n/(o/r+n),r/2,o/2))}}(i),s=1-(1-i.R2)*((i.nobs-1)/i.df_resid);return i.t=a,i.f=u,i.adjust_R2=s,i}}}(),t.extend({buildxmatrix:function(){for(var e=new Array(arguments.length),n=0;n<arguments.length;n++)e[n]=[1].concat(arguments[n]);return t(e)},builddxmatrix:function(){for(var e=new Array(arguments[0].length),n=0;n<arguments[0].length;n++)e[n]=[1].concat(arguments[0][n]);return t(e)},buildjxmatrix:function(e){for(var n=new Array(e.length),r=0;r<e.length;r++)n[r]=e[r];return t.builddxmatrix(n)},buildymatrix:function(e){return t(e).transpose()},buildjymatrix:function(e){return e.transpose()},matrixmult:function(e,n){var r,o,i,a,u;if(e.cols()==n.rows()){if(n.rows()>1){for(a=[],r=0;r<e.rows();r++)for(a[r]=[],o=0;o<n.cols();o++){for(u=0,i=0;i<e.cols();i++)u+=e.toArray()[r][i]*n.toArray()[i][o];a[r][o]=u}return t(a)}for(a=[],r=0;r<e.rows();r++)for(a[r]=[],o=0;o<n.cols();o++){for(u=0,i=0;i<e.cols();i++)u+=e.toArray()[r][i]*n.toArray()[o];a[r][o]=u}return t(a)}},regress:function(e,n){var r=t.xtranspxinv(e),o=e.transpose(),i=t.matrixmult(t(r),o);return t.matrixmult(i,n)},regresst:function(e,n,r){var o=t.regress(e,n),i={anova:{}},a=t.jMatYBar(e,o);i.yBar=a;var u=n.mean();i.anova.residuals=t.residuals(n,a),i.anova.ssr=t.ssr(a,u),i.anova.msr=i.anova.ssr/(e[0].length-1),i.anova.sse=t.sse(n,a),i.anova.mse=i.anova.sse/(n.length-(e[0].length-1)-1),i.anova.sst=t.sst(n,u),i.anova.mst=i.anova.sst/(n.length-1),i.anova.r2=1-i.anova.sse/i.anova.sst,i.anova.r2<0&&(i.anova.r2=0),i.anova.fratio=i.anova.msr/i.anova.mse,i.anova.pvalue=t.anovaftest(i.anova.fratio,e[0].length-1,n.length-(e[0].length-1)-1),i.anova.rmse=Math.sqrt(i.anova.mse),i.anova.r2adj=1-i.anova.mse/i.anova.mst,i.anova.r2adj<0&&(i.anova.r2adj=0),i.stats=new Array(e[0].length);for(var s,c,l,f=t.xtranspxinv(e),m=0;m<o.length;m++)s=Math.sqrt(i.anova.mse*Math.abs(f[m][m])),c=Math.abs(o[m]/s),l=t.ttest(c,n.length-e[0].length-1,r),i.stats[m]=[o[m],s,c,l];return i.regress=o,i},xtranspx:function(e){return t.matrixmult(e.transpose(),e)},xtranspxinv:function(e){var n=t.matrixmult(e.transpose(),e);return t.inv(n)},jMatYBar:function(e,n){var r=t.matrixmult(e,n);return new t(r)},residuals:function(e,n){return t.matrixsubtract(e,n)},ssr:function(e,t){for(var n=0,r=0;r<e.length;r++)n+=Math.pow(e[r]-t,2);return n},sse:function(e,t){for(var n=0,r=0;r<e.length;r++)n+=Math.pow(e[r]-t[r],2);return n},sst:function(e,t){for(var n=0,r=0;r<e.length;r++)n+=Math.pow(e[r]-t,2);return n},matrixsubtract:function(e,n){for(var r=new Array(e.length),o=0;o<e.length;o++){r[o]=new Array(e[o].length);for(var i=0;i<e[o].length;i++)r[o][i]=e[o][i]-n[o][i]}return t(r)}}),t.jStat=t,t)},379:(e,t,n)=>{"use strict";var r,o=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),i=[];function a(e){for(var t=-1,n=0;n<i.length;n++)if(i[n].identifier===e){t=n;break}return t}function u(e,t){for(var n={},r=[],o=0;o<e.length;o++){var u=e[o],s=t.base?u[0]+t.base:u[0],c=n[s]||0,l="".concat(s," ").concat(c);n[s]=c+1;var f=a(l),m={css:u[1],media:u[2],sourceMap:u[3]};-1!==f?(i[f].references++,i[f].updater(m)):i.push({identifier:l,updater:p(m,t),references:1}),r.push(l)}return r}function s(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var a=o(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var c,l=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function f(e,t,n,r){var o=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=l(t,o);else{var i=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}function m(e,t,n){var r=n.css,o=n.media,i=n.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var h=null,d=0;function p(e,t){var n,r,o;if(t.singleton){var i=d++;n=h||(h=s(t)),r=f.bind(null,n,i,!1),o=f.bind(null,n,i,!0)}else n=s(t),r=m.bind(null,n,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r));var n=u(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var o=a(n[r]);i[o].references--}for(var s=u(e,t),c=0;c<n.length;c++){var l=a(n[c]);0===i[l].references&&(i[l].updater(),i.splice(l,1))}n=s}}}},184:(e,t,n)=>{"use strict";n.d(t,{$:()=>a});var r=n(976),o=n(870),i=n(559);class a extends r.JsViewer{constructor(e){super(),this.canvas=o.canvas(),this.gridCellStyle=r.GridCellStyle.create(),this.renderer=e,this.root.append(this.canvas),this.canvas.style.width="100%",this.canvas.style.height="100%",o.tools.handleResize(this.canvas,((e,t)=>{this.canvas.width=e,this.canvas.height=t,this.render()}));const t=e=>t=>{this.gridCell&&e(this.gridCell,t)};this.canvas.onmousemove=t(this.renderer.onMouseMove),this.canvas.onmouseenter=t(this.renderer.onMouseEnter),this.canvas.onmouseleave=t(this.renderer.onMouseLeave)}static fromGridCell(e){const t=new a(new i.cv);return t.gridCell=e,t.render(),t}render(){if(!this.gridCell)return;const e=this.canvas.getContext("2d");e.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderer.renderInternal(e,0,0,this.canvas.width,this.canvas.height,this.gridCell.dart,this.gridCellStyle)}}},840:(e,t,n)=>{"use strict";n.d(t,{DI:()=>a}),n(976);var r=n(469),o=n(526),i=(n(114),n(414),function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))});function a(){return i(this,void 0,void 0,(function*(){r.shell.windows.showContextPanel=!0;const e=yield r.data.loadTable(`${o._package.webRoot}files/curves-demo.csv`);r.shell.addTableView(e)}))}},188:(e,t,n)=>{"use strict";n.d(t,{No:()=>v,Z:()=>w,hS:()=>g});var r=n(976),o=n(870),i=n(416),a=n(114),u=n(559),s=n(184),c=n(711);const l=".sourceColumn",f=".statistics",m="chartOptions",h="seriesOptions";var d;!function(e){e.DATAFRAME="Dataframe",e.COLUMN="Column",e.CELL="Cell"}(d||(d={}));const p={count:"totalCount",nulls:"missingValueCount",unique:"uniqueCount",values:"valueCount",min:"min",max:"max",sum:"sum",avg:"avg",stdev:"stdev",variance:"variance",skew:"skew",kurt:"kurt",med:"med",q1:"q1",q2:"q2",q3:"q3"};function g(e,t){const n=(0,i.Y6)(e);return e.parameters?t.logX&&e.parameters[2]>0&&(e.parameters[2]=Math.log10(e.parameters[2])):e.parameters=(0,i.PK)(e,n,t).parameters,(0,i.tq)(e,n)}function v(e,t){var n,o,i;const a={logX:null===(n=e.chartOptions)||void 0===n?void 0:n.logX,logY:null===(o=e.chartOptions)||void 0===o?void 0:o.logY},u=[],s=[],c=[],l=[],f=[],m=[],h=[];for(let t=0;t<(null===(i=e.series)||void 0===i?void 0:i.length);t++){const n=g(e.series[t],a);u[t]=n.rSquared,s[t]=n.auc,c[t]=n.interceptX,l[t]=n.interceptY,f[t]=n.slope,m[t]=n.top,h[t]=n.bottom}return{rSquared:r.Column.fromList(r.COLUMN_TYPE.FLOAT,"rSquared",u).stats[p[t]],auc:r.Column.fromList(r.COLUMN_TYPE.FLOAT,"auc",s).stats[p[t]],interceptX:r.Column.fromList(r.COLUMN_TYPE.FLOAT,"interceptX",c).stats[p[t]],interceptY:r.Column.fromList(r.COLUMN_TYPE.FLOAT,"interceptY",l).stats[p[t]],slope:r.Column.fromList(r.COLUMN_TYPE.FLOAT,"slope",f).stats[p[t]],top:r.Column.fromList(r.COLUMN_TYPE.FLOAT,"top",m).stats[p[t]],bottom:r.Column.fromList(r.COLUMN_TYPE.FLOAT,"bottom",h).stats[p[t]]}}function y(e,t,n,o){var i;const a=e.grid,s=r.Column.float(`${e.name}_${n.name}_${t.name}`,null===(i=e.column)||void 0===i?void 0:i.length);s.tags[l]=e.name,s.tags[".seriesNumber"]=o,s.tags[f]=t.name,s.init((n=>{var i,s;const l=r.GridCell.fromColumnRow(a,e.name,a.tableRowToGrid(n));if(""===l.cell.value)return null;const f=l.cell.column.getTag(u.Rj)===u.NH?(0,c.f)(l.cell.value):(0,u.W$)(l);if(void 0===f.series[o])return null;const m={logX:null===(i=f.chartOptions)||void 0===i?void 0:i.logX,logY:null===(s=f.chartOptions)||void 0===s?void 0:s.logY},h=g(f.series[o],m);return t.get(h)})),a.dataFrame.columns.insert(s,e.idx)}function A(e){for(let t=0;t<e.length;t++){const n=e.get(t);if(""===n)continue;const r=(0,c.f)(n);e.set(t,JSON.stringify(r))}e.setTag(u.Rj,"")}function x(e,t,n,r){var o;void 0===e.cell.column.temp[`${m}-custom-title`]&&function(e){var t,n;const r=e.columns.bySemTypeAll(a.j2);for(let e=0;e<r.length;e++){a.kW.map((t=>{r[e].temp[`${m}-custom-${t.name}`]=!1})),a.K0.map((t=>{r[e].temp[`${h}-custom-${t.name}`]=!1})),r[e].getTag(u.Rj)===u.NH&&A(r[e]);for(let o=0;o<r[e].length;o++){if(""===r[e].get(o))continue;const i=null!==(n=JSON.parse(null!==(t=r[e].get(o))&&void 0!==t?t:"{}"))&&void 0!==n?n:{};a.kW.map((t=>{i.chartOptions&&void 0!==i.chartOptions[t.name]&&(r[e].temp[`${m}-custom-${t.name}`]=!0)})),a.K0.map((t=>{if(i.series)for(const n of i.series)void 0!==n[t.name]&&(r[e].temp[`${h}-custom-${t.name}`]=!0)}))}}}(e.cell.dataFrame);const s=t.property.name,c=r===d.DATAFRAME?(0,i.jG)(e.cell.dataFrame):(0,i.hq)(e.cell.column);if(n===m?c.chartOptions[s]=t.value:n===h&&(c.seriesOptions[s]=t.value),r===d.CELL){const r=e.cell.value;if(""===r)return;const i=null!==(o=JSON.parse(null!=r?r:"{}"))&&void 0!==o?o:{};!function(e,t,n){const r=t.property.name;if(n===m){if(void 0===e.chartOptions)return;e.chartOptions[r]=t.value}else if(n===h){if(void 0===e.series)return;for(let n=0;n<e.series.length;n++)e.series[n][r]=t.value}}(i,t,n),e.cell.value=JSON.stringify(i)}else{let t;r===d.DATAFRAME?(e.cell.dataFrame.tags[a.Kp]=JSON.stringify(c),t=e.cell.dataFrame.columns.bySemTypeAll(a.j2)):(e.cell.column.tags[a.Kp]=JSON.stringify(c),t=[e.cell.column]);for(let e=0;e<t.length;e++){if(r===d.DATAFRAME){const r=(0,i.hq)(t[e]);n===m?delete r.chartOptions[s]:delete r.seriesOptions[s],t[e].tags[a.Kp]=JSON.stringify(r)}!1!==t[e].temp[`${n}-custom-${s}`]&&(t[e].init((r=>{var o,i;const a=t[e].get(r);if(""===a)return a;const u=null!==(i=JSON.parse(null!==(o=t[e].get(r))&&void 0!==o?o:"{}"))&&void 0!==i?i:{};if(n===m){if(void 0===u.chartOptions)return a;if(void 0===u.chartOptions[s])return a;delete u.chartOptions[s]}else{if(void 0===u.series)return a;let e=!1;for(const t of u.series)void 0!==t[s]&&(delete t[s],e=!0);if(u.seriesOptions&&delete u.seriesOptions[s],!e)return a}return JSON.stringify(u)})),t[e].temp[`${n}-custom-${s}`]=!1)}}e.grid.invalidate()}class w extends r.ObjectHandler{get type(){return"GridCell"}isApplicable(e){return e instanceof r.GridCell&&e.cellType===a.d8}renderProperties(e,t=null){var n,d,p,A,w,b;const C=o.accordion("Curves property panel"),T=r.Property.js("level",r.TYPE.STRING,{description:"Controls the level at which properties will be switched",defaultValue:"Column",choices:["Dataframe","Column","Cell"],nullable:!1}),_=o.input.forProperty(T);o.tooltip.bind(_.captionLabel,"Controls the level at which properties will be switched");const S=(0,u.W$)(e),I=(0,i.hq)(e.cell.column),O=(0,i.jG)(e.cell.dataFrame),k={onValueChanged:t=>x(e,t,h,_.value)},E={onValueChanged:t=>x(e,t,m,_.value)};(0,u.fi)(null===(n=O.seriesOptions)||void 0===n?void 0:n.pointColor)||(0,u.fi)(null===(d=I.seriesOptions)||void 0===d?void 0:d.pointColor)||(S.seriesOptions?(0,u.fi)(S.seriesOptions.pointColor)||(S.seriesOptions.pointColor=r.Color.toHtml(r.Color.getCategoricalColor(0))):(0,u.fi)(S.series?S.series[0].pointColor:"")||(S.series[0].pointColor=r.Color.toHtml(r.Color.getCategoricalColor(0)))),(0,u.fi)(null===(p=O.seriesOptions)||void 0===p?void 0:p.fitLineColor)||(0,u.fi)(null===(A=I.seriesOptions)||void 0===A?void 0:A.fitLineColor)||(S.seriesOptions?(0,u.fi)(S.seriesOptions.fitLineColor)||(S.seriesOptions.fitLineColor=r.Color.toHtml(r.Color.getCategoricalColor(0))):(0,u.fi)(S.series?S.series[0].fitLineColor:"")||(S.series[0].fitLineColor=r.Color.toHtml(r.Color.getCategoricalColor(0)))),(0,u.BI)(a.K0,I.seriesOptions,S.seriesOptions?S.seriesOptions:S.series&&null!==(w=S.series[0])&&void 0!==w?w:{}),(0,u.BI)(a.K0,O.seriesOptions,S.seriesOptions?S.seriesOptions:S.series&&null!==(b=S.series[0])&&void 0!==b?b:{}),(0,u.BI)(a.kW,I.chartOptions,S.chartOptions?S.chartOptions:{}),(0,u.BI)(a.kW,O.chartOptions,S.chartOptions?S.chartOptions:{}),C.addPane("Options",(()=>o.divV([_.root,o.h3("Series options"),o.input.form(S.seriesOptions?S.seriesOptions:S.series[0],a.K0,k),o.h3("Chart options"),o.input.form(S.chartOptions,a.kW,E)])));const M=r.Property.js("series",r.TYPE.STRING,{description:"Controls whether to show series statistics or aggregated statistics",defaultValue:"All",choices:["all","aggregated"],nullable:!1}),B=o.input.forProperty(M,null,{onValueChanged(e){C.getPane("Fit").root.lastElementChild.replaceChildren(L())}}),N=r.Property.js("aggregation type",r.TYPE.STRING,{description:"Controls which aggregation to use on the series statistics",defaultValue:"med",choices:Object.values(r.STATS),nullable:!1}),R=o.input.forProperty(N,null,{onValueChanged(e){C.getPane("Fit").root.lastElementChild.replaceChildren(L())}});function L(){var t,n,i;const s=o.divV("aggregated"===B.stringValue?[B.root,R.root]:[B.root]);if("all"===B.stringValue){const u={logX:null===(t=S.chartOptions)||void 0===t?void 0:t.logX,logY:null===(n=S.chartOptions)||void 0===n?void 0:n.logY};for(let t=0;t<S.series.length;t++){const n=S.series[t],c=g(n,u),l=n.fitLineColor&&r.Color.fromHtml(n.fitLineColor)?n.fitLineColor:r.Color.toHtml(r.Color.getCategoricalColor(t));s.appendChild(o.panel([o.h1(null!==(i=n.name)&&void 0!==i?i:"series "+t,{style:{color:l}}),o.input.form(c,a.sw,{onCreated:r=>r.root.appendChild(o.iconFA("plus",(()=>y(e.gridColumn,r.property,n,t)),`Calculate ${r.property.name} for the whole column`))})]))}}else{const t=v(S,R.stringValue);s.appendChild(o.panel([o.h1(`series ${R.stringValue}`),o.input.form(t,a.sw,{onCreated:t=>t.root.appendChild(o.iconFA("plus",(()=>function(e,t,n){var o;const i=e.grid,a=r.Column.float(`${e.name}_${n}_${t.name}`,null===(o=e.column)||void 0===o?void 0:o.length);a.tags[l]=e.name,a.tags[".seriesAggregation"]=n,a.tags[f]=t.name,a.init((o=>{const a=r.GridCell.fromColumnRow(i,e.name,i.tableRowToGrid(o));if(""===a.cell.value)return null;const s=v(a.cell.column.getTag(u.Rj)===u.NH?(0,c.f)(a.cell.value):(0,u.W$)(a),n);return t.get(s)})),i.dataFrame.columns.insert(a,e.idx)}(e.gridColumn,t.property,R.stringValue)),`Calculate ${t.property.name} for the whole column`))})]))}return s}return C.addPane("Fit",(()=>L())),C.addPane("Chart",(()=>s.$.fromGridCell(e).root)),C.root}}},711:(e,t,n)=>{"use strict";n.d(t,{f:()=>c});var r=n(976),o=n(114);const i={x:"xAxis",y:"yAxis"},a={min:"min",max:"max"};function u(e){var t,n,i;const a=null===(n=null===(t=e.getElementsByTagName("params")[0])||void 0===t?void 0:t.childNodes[0].nodeValue)||void 0===n?void 0:n.split(",").map(Number);let u=null===(i=e.getElementsByTagName("function")[0])||void 0===i?void 0:i.getAttribute("type");u=u&&"sigif"!==u?u:o.yB;const s=e.getElementsByTagName("settings")[0].getAttribute("markerColor"),c=e.getElementsByTagName("settings")[0].getAttribute("color"),l=!!e.getElementsByTagName("settings")[0].getAttribute("drawLine"),f={name:e.getAttribute("name"),fitFunction:u,markerType:r.MARKER_TYPE.CIRCLE,pointColor:s,fitLineColor:c,showFitLine:l,showPoints:"points",showCurveConfidenceInterval:!1,clickToToggle:!1};return a&&(f.parameters=[a[2],a[1],a[0],a[3]]),f}function s(e){const t=function(e){var t,n,r;const o=null===(t=e.getElementsByTagName("x")[0].childNodes[0].nodeValue)||void 0===t?void 0:t.split(","),i=null===(n=e.getElementsByTagName("y")[0].childNodes[0].nodeValue)||void 0===n?void 0:n.split(","),a=null===(r=e.getElementsByTagName("mask")[0].childNodes[0].nodeValue)||void 0===r?void 0:r.split(""),u=[];for(let e=0;e<o.length;e++)u[e]={x:+o[e],y:+i[e],outlier:!Boolean(a[e])};return u}(e),n=u(e),r={points:t};return Object.assign(r,n),r}function c(e){const t=(new DOMParser).parseFromString(e,"text/xml"),n=t.getElementsByTagName("grid")[0],r=(c=t.getElementsByTagName("settings")[0],{minX:+(o=n).getElementsByTagName(i.x)[0].getAttribute(a.min),minY:+o.getElementsByTagName(i.y)[0].getAttribute(a.min),maxX:+o.getElementsByTagName(i.x)[0].getAttribute(a.max),maxY:+o.getElementsByTagName(i.y)[0].getAttribute(a.max),xAxisName:c.getAttribute("xLabel"),yAxisName:c.getAttribute("yLabel"),logX:!!c.getAttribute("logX")});var o,c;const l=t.getElementsByTagName("seriesCollection")[0],f=u(l.getElementsByTagName("series")[0]),m=function(e){const t=[],n=e.getElementsByTagName("series").length;for(let r=0;r<n;r++){const n=e.getElementsByTagName("series")[r];t[r]=s(n)}return t}(l);return{chartOptions:r,seriesOptions:f,series:m}}},559:(e,t,n)=>{"use strict";n.d(t,{cv:()=>R,Rj:()=>g,NH:()=>v,W$:()=>T,fi:()=>S,BI:()=>C});var r=n(976),o=n(469),i=n(870),a=n(114),u=n(111),s=n(766);const c=window,l=new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});class f{static getUniqueName(e,t,n){return c.grok_Utils_GetUniqueName(e,t,null==n?void 0:n.auto,null==n?void 0:n.idx,null==n?void 0:n.render,null==n?void 0:n.choices)}static isEmpty(e){return null==e||""==e}static formatNumber(e){return l.format(e)}}var m=n(416),h=n(711),d=n(184),p=n(188);const g=".fitChartFormat",v="3dx",y=100,A=18,x=4,w=3.5,b={solid:[],dotted:[1,1],dashed:[5,5],dashdotted:[5,5,2,5]};function C(e,t,n){if(t&&n)for(const r of e)!(r.name in n)&&r.name in t&&(n[r.name]=t[r.name])}function T(e){var t,n,o,i,u,s;const c=(null===(n=null===(t=e.cell)||void 0===t?void 0:t.column)||void 0===n?void 0:n.type)===r.TYPE.STRING?e.cell.column.getTag(g)===v?(0,h.f)(e.cell.value):null!==(i=JSON.parse(null!==(o=e.cell.value)&&void 0!==o?o:"{}"))&&void 0!==i?i:{}:(0,m.TL)(),l=e.cell.column?(0,m.hq)(e.cell.column):{},f=e.cell.column?(0,m.jG)(e.cell.dataFrame):{};null!==(u=c.series)&&void 0!==u||(c.series=[]),null!==(s=c.chartOptions)&&void 0!==s||(c.chartOptions=l.chartOptions),C(a.kW,l.chartOptions,c.chartOptions),C(a.kW,f.chartOptions,c.chartOptions);for(const e of c.series)C(a.K0,l.seriesOptions,e),C(a.K0,f.seriesOptions,e);return c}function _(e,t,n){if(e.width<y||e.height<55)return[e,void 0,void 0];const r=t?45:38,o=t?30:15,i=n?25:5;return[e.cutLeft(r).cutBottom(o).cutTop(i).cutRight(A),e.getBottom(o).getTop(i).cutLeft(r).cutRight(A),e.getLeft(r).getRight(A).cutBottom(o).cutTop(i)]}function S(e){return null!=e&&""!==e&&void 0!==r.Color.fromHtml(e)}function I(e,t,n,r){e.moveTo(r.xToScreen(t)-x/2,r.yToScreen(n)),e.lineTo(r.xToScreen(t)+x/2,r.yToScreen(n))}function O(e,t,n,o,i,a){I(e,t,n.lowerAdjacentValue,o),e.moveTo(o.xToScreen(t),o.yToScreen(n.lowerAdjacentValue)),e.lineTo(o.xToScreen(t),o.yToScreen(n.upperAdjacentValue)),I(e,t,n.upperAdjacentValue,o),r.Paint.marker(e,r.MARKER_TYPE.CIRCLE,o.xToScreen(t),o.yToScreen(n.q2),a,w*i)}function k(e,t,n,o,i,a){for(let i=0;i<t.points.length;i++){const u=t.points[i],s=u.outlier?r.Color.red:u.color&&r.Color.fromHtml(u.color)?r.Color.fromHtml(u.color):a,c=u.marker?u.marker:t.markerType,l=u.outlier?12*o:u.size?u.size:4*o;r.Paint.marker(e,u.outlier?r.MARKER_TYPE.OUTLIER:c,n.xToScreen(u.x),n.yToScreen(u.y),s,l),u.stdev&&!u.outlier&&(e.strokeStyle=r.Color.toHtml(s),e.beginPath(),e.moveTo(n.xToScreen(u.x),n.yToScreen(u.y+u.stdev)),e.lineTo(n.xToScreen(u.x),n.yToScreen(u.y-u.stdev)),e.stroke())}}function E(e,t,n,o,i){for(let a=0,s=null;a<t.points.length;a++){const c=t.points[a];if(c.outlier)continue;const l=a+1<t.points.length&&t.points[a+1].x===c.x;if(!s&&l)s=a;else if(null!==s&&!l){const l=[];for(let e=s,n=0;e<=a;e++,n++)l[n]=t.points[e].y;const f=(0,u.G)(l);if(e.beginPath(),O(e,c.x,f,n,o,i),e.stroke(),"both"===t.showPoints)for(let i=0;i<l.length;i++)(l[i]<f.lowerAdjacentValue||l[i]>f.upperAdjacentValue)&&r.Paint.marker(e,r.MARKER_TYPE.OUTLIER,n.xToScreen(c.x),n.yToScreen(l[i]),t.pointColor?r.Color.fromHtml(t.pointColor):r.Color.scatterPlotMarker,6*o);s=null}}}function M(e,t,n,r,o,i,u,s){e.beginPath();const c=i?u?45:38:0,l=i?A:0,f=o===a.vK.TOP?t.confidenceTop:t.confidenceBottom;for(let t=c;t<=n.width-l;t++){const o=n.x+t,i=s.logX?Math.log10(r.xToWorld(o)):r.xToWorld(o),a=s.logY?r.yToScreen(Math.pow(10,f(i))):r.yToScreen(f(i));t===c?e.moveTo(o,a):e.lineTo(o,a)}e.stroke()}function B(e,t,n,r,o,i,a){e.beginPath();const u=o?i?45:38:0,s=o?A:0;for(let o=u;o<=n.width-s;o++){const i=n.x+o,s=a.logX?Math.log10(r.xToWorld(i)):r.xToWorld(i),c=a.logY?r.yToScreen(Math.pow(10,t.confidenceTop(s))):r.yToScreen(t.confidenceTop(s));o===u?e.moveTo(i,c):e.lineTo(i,c)}for(let o=n.width-s;o>=u;o--){const i=n.x+o,u=a.logX?Math.log10(r.xToWorld(i)):r.xToWorld(i),s=a.logY?r.yToScreen(Math.pow(10,t.confidenceBottom(u))):r.yToScreen(t.confidenceBottom(u));e.lineTo(i,s)}e.closePath(),e.fill()}function N(e,t,n,r,o,i){i.logX&&(n=Math.pow(10,n));const a=i.logX?Math.log10(n):n,u=i.logY?Math.pow(10,o(a)):o(a);e.moveTo(t.xToScreen(r.minX),t.yToScreen(u)),e.lineTo(t.xToScreen(n),t.yToScreen(u)),e.lineTo(t.xToScreen(n),t.yToScreen(r.minY))}class R extends r.GridCellRenderer{get name(){return a.d8}get cellType(){return a.d8}getDefaultSize(e){return{width:220,height:150}}onClick(e,t){var n,r,i,a,u,c,l,f;if(!e.cell.value)return;const d=e.cell.column.getTag(g)===v?(0,h.f)(e.cell.value):T(e);if(null===(n=d.series)||void 0===n?void 0:n.some((e=>0===e.points.length)))return;o.shell.o=e;const A=e.bounds.inflate(-6,-6),x=_(A,e.bounds.width>=180&&e.bounds.height>=140,e.bounds.width>=275&&e.bounds.height>=225)[0],w=(0,m.dU)(d),b=new s.l(w,x,null!==(i=null===(r=d.chartOptions)||void 0===r?void 0:r.logX)&&void 0!==i&&i,null!==(u=null===(a=d.chartOptions)||void 0===a?void 0:a.logY)&&void 0!==u&&u);for(let n=0;n<(null===(c=d.series)||void 0===c?void 0:c.length);n++)if(!(!d.series[n].clickToToggle||"points"!==d.series[n].showPoints||A.width<y||A.height<55))for(let r=0;r<d.series[n].points.length;r++){const o=d.series[n].points[r],i=b.xToScreen(o.x),a=b.yToScreen(o.y),u=(o.outlier?12:4)/2+2;if(t.offsetX>=i-u&&t.offsetX<=i+u&&t.offsetY>=a-u&&t.offsetY<=a+u){o.outlier=!o.outlier;const t=e.grid.dataFrame.columns.byTags({".sourceColumn":e.cell.column.name});if(t)for(const r of t){const t={logX:null===(l=d.chartOptions)||void 0===l?void 0:l.logX,logY:null===(f=d.chartOptions)||void 0===f?void 0:f.logY},o=null!==r.tags[".seriesAggregation"]?(0,p.No)(d,r.tags[".seriesAggregation"]):r.tags[".seriesNumber"]===n?(0,p.hS)(d.series[n],t):null;null!==o&&r.set(e.cell.rowIndex,o[r.tags[".statistics"]])}if(e.cell.column.getTag(g)!==v){const t=JSON.parse(e.cell.value);t.series[n].points[r].outlier=o.outlier,e.cell.value=JSON.stringify(t)}return}}}onDoubleClick(e,t){if(!e.cell.value)return;const n=d.$.fromGridCell(e),r=i.dialog({title:"Edit chart"}).add(n.root).show({resizable:!0}).root.getElementsByClassName("d4-dialog-contents dlg-edit-chart")[0].firstChild;n.canvas.width=r.clientWidth,n.canvas.height=r.clientHeight,n.render(),r.style.width="100%",r.style.height="100%",i.tools.handleResize(r,((e,t)=>{n.canvas.width=e,n.canvas.height=t,n.render()}))}renderCurves(e,t,n,o,i,u){var c,l,h,d,p,g,v,x,w,C,T,S,I,O,R,L,P,j,q,F,D,V;e.save(),e.beginPath(),e.rect(t,n,o,i),e.clip();const Y=new r.Rect(t,n,o,i).inflate(-6,-6),U=Y.width>=y&&Y.height>=55,G=o>=180&&i>=140&&!!(null===(c=u.chartOptions)||void 0===c?void 0:c.xAxisName)&&!!u.chartOptions.yAxisName,X=o>=275&&i>=225&&!!(null===(l=u.chartOptions)||void 0===l?void 0:l.title),[W,H,z]=_(Y,G,X),$=(0,m.dU)(u);$.x<=0&&u.chartOptions&&(u.chartOptions.logX=!1),$.y<=0&&u.chartOptions&&(u.chartOptions.logY=!1);const K=new s.l($,W,null!==(d=null===(h=u.chartOptions)||void 0===h?void 0:h.logX)&&void 0!==d&&d,null!==(g=null===(p=u.chartOptions)||void 0===p?void 0:p.logY)&&void 0!==g&&g),Q=Math.min(W.width,W.height),Z=Q>100?1:.2+Q/100*.8,J={logX:null===(v=u.chartOptions)||void 0===v?void 0:v.logX,logY:null===(x=u.chartOptions)||void 0===x?void 0:x.logY};e.save(),e.font='11px Roboto, "Roboto Local"',K.drawCoordinateGrid(e,H,z),e.restore();for(let t=0;t<(null===(w=u.series)||void 0===w?void 0:w.length);t++){const n=u.series[t];(o<70||i<45)&&(n.showPoints="",u.chartOptions&&(u.chartOptions.showStatistics=[])),n.points.sort(((e,t)=>e.x-t.x));let s=!0;const c=(0,m.Y6)(n);let l;if(n.parameters)(null===(C=u.chartOptions)||void 0===C?void 0:C.logX)&&n.parameters[2]>0&&(n.parameters[2]=Math.log10(n.parameters[2])),l=(0,m.kG)(n,c);else{const e=(0,m.PK)(n,c,J);l=e.fittedCurve,n.parameters=e.parameters,s=!1}if(null===(T=n.showPoints)||void 0===T||T){const o=n.pointColor&&r.Color.fromHtml(n.pointColor)?n.pointColor:r.Color.toHtml(r.Color.getCategoricalColor(t));e.strokeStyle=o,"points"===n.showPoints?k(e,n,K,Z,0,r.Color.fromHtml(o)):["candlesticks","both"].includes(n.showPoints)&&E(e,n,K,Z,r.Color.fromHtml(o))}if(null===(S=n.showFitLine)||void 0===S||S){const o=n.fitLineColor&&r.Color.fromHtml(n.fitLineColor)?n.fitLineColor:r.Color.toHtml(r.Color.getCategoricalColor(t));e.save(),e.strokeStyle=o,e.lineWidth=2*Z,e.beginPath(),n.lineStyle&&e.setLineDash(b[n.lineStyle]);const i=U?G?45:38:0,a=U?A:0;for(let t=i;t<=Y.width-a;t++){const n=Y.x+t,r=(null===(I=u.chartOptions)||void 0===I?void 0:I.logX)?Math.log10(K.xToWorld(n)):K.xToWorld(n),o=(null===(O=u.chartOptions)||void 0===O?void 0:O.logY)?K.yToScreen(Math.pow(10,l(r))):K.yToScreen(l(r));t===i?e.moveTo(n,o):e.lineTo(n,o)}e.stroke(),e.restore()}if((null===(R=n.showFitLine)||void 0===R||R)&&null!==(L=n.showCurveConfidenceInterval)&&void 0!==L&&L){e.strokeStyle=null!==(P=n.confidenceIntervalColor)&&void 0!==P?P:a.Qc,e.fillStyle=null!==(j=n.confidenceIntervalColor)&&void 0!==j?j:a.XD;const t=(0,m.LC)(n,c,s,J);M(e,t,Y,K,a.vK.TOP,U,G,J),M(e,t,Y,K,a.vK.BOTTOM,U,G,J),B(e,t,Y,K,U,G,J)}if(n.droplines&&G){e.save(),e.strokeStyle="blue",e.lineWidth=Z,e.beginPath(),e.setLineDash([5,5]);for(let t=0;t<n.droplines.length;t++)"IC50"===n.droplines[t]&&N(e,K,n.parameters[2],$,l,J);e.stroke(),e.restore()}if(null===(q=u.chartOptions)||void 0===q?void 0:q.showStatistics){const o=(0,m.tq)(n,c);for(let i=0;i<u.chartOptions.showStatistics.length;i++){const s=u.chartOptions.showStatistics[i],c=a.sw.find((e=>e.name===s));if(c){const a=f.formatNumber(c.get(o)),u=n.fitLineColor&&r.Color.fromHtml(n.fitLineColor)?n.fitLineColor:r.Color.toHtml(r.Color.getCategoricalColor(t));e.fillStyle=u,e.textAlign="left",e.fillText(c.name+": "+a,W.x+5,W.y+20+20*i)}}}}if(X&&(e.font='12px Roboto, "Roboto Local"',e.textAlign="center",e.fillStyle="black",e.fillText(null===(F=u.chartOptions)||void 0===F?void 0:F.title,W.midX-5,n+15)),G){e.font='11px Roboto, "Roboto Local"',e.textAlign="center",e.fillStyle="black",e.fillText(null===(D=u.chartOptions)||void 0===D?void 0:D.xAxisName,W.midX-5,n+i-10),e.translate(t,n),e.rotate(-Math.PI/2);const r=X?25:5;e.fillText(null===(V=u.chartOptions)||void 0===V?void 0:V.yAxisName,-(W.height/2+r+15),15),e.restore()}e.restore()}render(e,t,n,r,o,i,a){var u,s;if(r<20||o<10)return;if(!i.cell.value)return;const c=(null===(u=i.cell.column)||void 0===u?void 0:u.getTag(g))===v?(0,h.f)(i.cell.value):T(i);(null===(s=c.series)||void 0===s?void 0:s.some((e=>0===e.points.length)))||this.renderCurves(e,t,n,r,o,c)}onMouseMove(e,t){var n,r,o,a,u;if(!e.cell.value)return;if(e.bounds.width<70||e.bounds.height<45){const n=i.canvas(300,200);this.render(n.getContext("2d"),0,0,300,200,e,null);const r=i.divV([n]);i.tooltip.show(r,t.x,t.y)}const c=e.cell.column.getTag(g)===v?(0,h.f)(e.cell.value):T(e),l=e.bounds.inflate(-6,-6),f=_(l,e.bounds.width>=180&&e.bounds.height>=140,e.bounds.width>=275&&e.bounds.height>=225)[0],d=(0,m.dU)(c),p=new s.l(d,f,null!==(r=null===(n=c.chartOptions)||void 0===n?void 0:n.logX)&&void 0!==r&&r,null!==(a=null===(o=c.chartOptions)||void 0===o?void 0:o.logY)&&void 0!==a&&a);for(let e=0;e<(null===(u=c.series)||void 0===u?void 0:u.length);e++)if(!(!c.series[e].clickToToggle||"points"!==c.series[e].showPoints||l.width<y||l.height<55))for(let n=0;n<c.series[e].points.length;n++){const r=c.series[e].points[n],o=p.xToScreen(r.x),i=p.yToScreen(r.y),a=(r.outlier?12:4)/2+2;if(t.offsetX>=o-a&&t.offsetX<=o+a&&t.offsetY>=i-a&&t.offsetY<=i+a)return void(document.body.style.cursor="pointer")}document.body.style.cursor="default"}}},526:(e,t,n)=>{"use strict";n.r(t),n.d(t,{_FitViewer:()=>p,_initCurves:()=>v,_package:()=>h,curveFitDemo:()=>g,fitCellRenderer:()=>d});var r=n(976),o=n(188),i=n(559),a=n(184),u=n(114),s=n(442),c=n(701);class l extends a.${constructor(){super(new i.cv),this.showSelectedRowsCurves=!1,this.showCurrentRowCurve=!0,this.showMouseOverRowCurve=!0,this.rows=[],this.data=new u.cY,this.curvesColumnName=this.column("curves"),this.showSelectedRowsCurves=this.bool("showSelectedRowsCurves",!1,{description:"Adds curves from the selected rows"}),this.showCurrentRowCurve=this.bool("showCurrentRowCurve",!0),this.showMouseOverRowCurve=this.bool("showMouseOverRowCurve",!0);for(const e of u.kW)this.addProperty(e.name,e.propertyType,e.defaultValue,e.options)}static fromChartData(e){let t=new l;return t.data=e,t.render(),t}applyViewerProperties(){(0,i.BI)(u.kW,this,this.data.chartOptions)}createChartData(){var e,t;this.rows.length=0,this.showCurrentRowCurve&&-1!==this.dataFrame.currentRowIdx&&this.rows.push(this.dataFrame.currentRowIdx),this.showMouseOverRowCurve&&-1!==this.dataFrame.mouseOverRowIdx&&this.rows.push(this.dataFrame.mouseOverRowIdx),this.showSelectedRowsCurves&&-1!==this.dataFrame.mouseOverRowIdx&&this.rows.push(...this.dataFrame.selection.getSelectedIndexes()),this.data=new u.cY;const n=null===(e=this.tableView)||void 0===e?void 0:e.grid;for(let e of this.rows){const r=(0,i.W$)(n.cell(this.curvesColumnName,n.tableRowToGrid(e)));null===(t=this.data.series)||void 0===t||t.push(...r.series)}}onPropertyChanged(e){this.applyViewerProperties(),this.render()}onTableAttached(){var e,t,n;const r=null===(e=this.tableView)||void 0===e?void 0:e.grid;null!==(t=this.curvesColumnName)&&void 0!==t||(this.curvesColumnName=null===(n=this.dataFrame.columns.bySemType(u.j2))||void 0===n?void 0:n.name),(0,c.merge)(this.dataFrame.onCurrentCellChanged,r.onCellMouseEnter,this.dataFrame.onSelectionChanged).pipe((0,s.debounce)((e=>(0,c.interval)(50)))).subscribe((e=>{this.createChartData(),this.render()}))}render(){const e=this.canvas.getContext("2d");e.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderer.renderCurves(e,0,0,this.canvas.width,this.canvas.height,this.data)}}var f=n(840),m=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))};const h=new r.Package;function d(){return new i.cv}function p(){return new l}function g(){return m(this,void 0,void 0,(function*(){yield(0,f.DI)()}))}function v(){r.ObjectHandler.register(new o.Z)}},126:function(e){var t;t=()=>(()=>{"use strict";var e,t={588:(e,t,n)=>{n.d(t,{default:()=>l});const r=(...e)=>{},o=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=e=>null!==e&&"Object"===(null==e?void 0:e.constructor.name),a=(e="")=>e.normalize("NFD").replace(/\p{Diacritic}/gu,""),u=(e,t)=>{const n=e.length;if(!n)return[];if(i(e[0])){for(let r=0;r<n;r++)if(!(t in e[r]))throw new Error("e03");return e}return e.reduce((function(e,n){return e.push({[t]:n&&"string"==typeof n?n:JSON.stringify(n)}),e}),[])},s={get:async function(e,t){return async function(e){const t=await e.text(),n=t&&JSON.parse(t);return e.ok?n:Promise.reject(n&&n.message||e.statusText)}(await fetch(e,t||{method:"GET"}))}},c=(e={})=>{const{hasDiacritics:t}=e;let n={};const r=String.fromCharCode(0);function o(e=""){return e=`${e}`,t&&(e=a(e)),e.toLowerCase().trim().split(/\s+/)}return{add:function(e,t="",i){if(!e)return;let a,u=n;(e=e.constructor===Array?e:[e]).forEach((e=>{o("string"==typeof e?e:e[t]).filter((e=>e)).forEach((t=>{u=n;for(let e=0,n=t.length;e<n;e++)a=t[e],u=u[a]||(u[a]={});const o="string"==typeof e?e:i&&i(e)||JSON.stringify(e);u[r]?u[r][o]=e:u[r]={[o]:e}}))}))},clear:function(){n={}},search:function(e,t){const i=o(e),a=[];let u={};i.forEach((e=>{a.push(function(e){let t,o=n,i={};for(let n=0,r=e.length;n<r;n++)if(t=e[n],o=o[t],void 0===o)return{};const a=[o],u=[e];let s;for(;a.length;)for(s in e=u.pop(),o=a.pop(),o)s!==r?(a.push(o[s]),u.push(e+s)):i=Object.assign(i,o[r]);return i}(e))})),u=a.reduce(((e,t)=>{const n={};return Object.keys(e).filter((e=>t[e])).forEach((t=>{n[t]=e[t]})),n})),u=Object.values(u);const s=u.length;return t&&s>t&&(u.length=t),{suggestions:u,count:s}}}};function l(e){var t,n,l;if(!e.input)throw new Error("e01");if(!i(e.source))throw new Error("e02");const f=document,m=f.createElement("div"),h=e.debounceRemote||100,d=e.preventSubmit||!1,p=e.minLength||1,g=!1!==e.hint,v=e.autoSelect||!1,y=e.templates,A=c({hasDiacritics:e.diacritics}),x=e.source.identifier||"label",w=e.source.groupIdentifier||"",b=e=>`${e[x]}`,C=e.display||b,T=e.source.identity||b,_=e.onSubmit||r,S=(null===(t=e.source.dataTokens)||void 0===t?void 0:t.constructor)===Array?e.source.dataTokens:void 0,I=e.source.transform||(e=>e),O=e.source.local||null,k=(null===(n=e.source.remote)||void 0===n?void 0:n.url)&&e.source.remote.wildcard?e.source.remote:null,E=(null===(l=e.source.prefetch)||void 0===l?void 0:l.url)?{when:"onInit",done:!1,...e.source.prefetch}:null,M={wrapper:"",input:"tt-input",hint:"tt-hint",highlight:"tt-highlight",hide:"tt-hide",show:"tt-show",list:"tt-list",selected:"tt-selected",header:"tt-header",footer:"tt-footer",loader:"tt-loader",suggestion:"tt-suggestion",group:"tt-group",empty:"tt-empty",notFound:"tt-notFound",...e.classNames||{}};if(!O&&!E&&!k)throw new Error("e02");const B={query:"",items:[],count:0,limit:e.limit||5};let N,R,L={},P={},j=!1,q="";y&&(y.header="function"==typeof y.header?y.header:void 0,y.footer="function"==typeof y.footer?y.footer:void 0,y.notFound="function"==typeof y.notFound?y.notFound:void 0,y.group="function"==typeof y.group?y.group:void 0,y.suggestion="function"==typeof y.suggestion?y.suggestion:void 0,y.loader="function"==typeof y.loader?y.loader:void 0,y.empty="function"==typeof y.empty?y.empty:void 0);const F=(e=[])=>{ie(u(e,x))};O&&F(O);const D=e.input;D.classList.add(M.input);const V=window.getComputedStyle(D),Y=f.createElement("div");Y.className=`typeahead-standalone${e.className?` ${e.className}`:""}${M.wrapper?` ${M.wrapper}`:""}`,B.container=Y;const U=D.parentNode,G=[...U.children].indexOf(D);U.removeChild(D),Y.appendChild(D),U.insertBefore(Y,U.children[G]);const X=D.cloneNode();function W(){if(!E||E.done)return;let e=[];s.get("function"==typeof E.url?E.url():E.url,null==E?void 0:E.requestOptions).then((t=>{e=I(t),e=u(e,x),ie(e)}),(e=>{console.error("e04",e)})).finally((()=>{"function"==typeof E.process&&E.process(e)})),E.done=!0}g&&function(e){["id","name","placeholder","required","aria-label"].forEach((t=>e.removeAttribute(t))),e.setAttribute("readonly","true"),e.setAttribute("aria-hidden","true"),e.style.marginTop=`-${D.offsetHeight+parseInt(V.marginBottom)}px`,e.tabIndex=-1,e.className=M.hint,D.after(e)}(X),m.classList.add(M.list,M.hide),m.tabIndex=0,m.setAttribute("aria-label","menu-options"),m.setAttribute("role","listbox"),m.style.position="absolute",m.style.width=`${D.offsetWidth}px`,m.style.marginTop=`${D.offsetHeight+parseInt(V.marginTop)}px`,Y.appendChild(m),E&&"onInit"===E.when&&W();const H=()=>{m.classList.remove(M.hide)},z=()=>{R&&window.clearTimeout(R)},$=()=>{B.items=[],X.value="",q="",m.classList.add(M.hide)},K=()=>{D.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:"insertCompositionText",data:D.value}))},Q=(e=!1)=>{if(!B.items.length&&B.query){$(),Z();const t=(null==y?void 0:y.notFound)&&y.notFound(B);if(!t)return!0;const n=e=>{const t=f.createElement("div");t.classList.add(M.notFound),le(t,e),m.appendChild(t)};return k?(L[JSON.stringify(B.query)]||e&&!j)&&n(t):n(t),H(),!0}},Z=()=>{for(;m.firstChild;)m.firstChild.remove()},J=()=>{if(!(null==y?void 0:y.loader))return;if(!j){const e=m.querySelector(`.${M.loader}`);return void(e&&m.removeChild(e))}const e=f.createElement("div");e.classList.add(M.loader),le(e,y.loader()),(null==y?void 0:y.footer)?m.insertBefore(e,m.querySelector(`.${M.footer}`)):m.appendChild(e)},ee=()=>{var t;if(Q())return;Z();const n=e=>{const t=f.createElement("div");return t.classList.add(M.suggestion),t.setAttribute("role","option"),t.setAttribute("aria-selected","false"),t.setAttribute("aria-label",C(e)),(null==y?void 0:y.suggestion)?le(t,y.suggestion(e,B)):t.textContent=e[x]||"",t},r=e=>{const t=f.createElement("div");return t.classList.add(M.group),t.setAttribute("role","group"),t.setAttribute("aria-label",e),(null==y?void 0:y.group)?le(t,y.group(e,B)):t.textContent=e||"",t},o=f.createDocumentFragment(),i=[];if(null==y?void 0:y.header){const e=f.createElement("div");e.classList.add(M.header),e.setAttribute("role","presentation"),le(e,y.header(B))&&o.appendChild(e)}for(const[t,a]of B.items.entries()){if(t===B.limit)break;if(a[w]&&!i.includes(a[w])){i.push(a[w]);const e=r(a[w]);o.appendChild(e)}const u=n(a);u.addEventListener("click",(e=>{$(),N=a,D.value=C(a,e),K()})),a===N&&(u.classList.add(M.selected),u.setAttribute("aria-selected","true")),o.appendChild(u),e.highlight&&se(u,B.query)}if(null==y?void 0:y.footer){const e=f.createElement("div");e.classList.add(M.footer),e.setAttribute("role","presentation"),le(e,y.footer(B))&&o.appendChild(e)}m.appendChild(o),g&&ce(N||B.items[0]),null===(t=m.querySelector(`.${M.selected}`))||void 0===t||t.scrollIntoView({block:"nearest"}),H()},te=()=>{var e,t;z();const n=D.value.replace(/\s{2,}/g," ").trim();if((null==y?void 0:y.empty)&&!n.length){const t=y.empty(B);if(B.query="",null===(e=B.defaultItems)||void 0===e?void 0:e.length)return B.items=u(I(B.defaultItems),x),ee();$(),Z();const n=f.createElement("div");return n.classList.add(M.empty),le(n,t),t&&m.appendChild(n),H()}if(n.length>=p){B.query=n,re();const e=JSON.stringify(B.query);k&&B.items.length<B.limit&&(null===(t=P[e])||void 0===t?void 0:t.length)&&re(P[e]),ee(),R=window.setTimeout((function(){B.items.length<B.limit&&!j&&oe()}),h)}else B.query="",$()},ne=(t="")=>(e.diacritics&&(t=a(t)),t.toLowerCase()),re=e=>{let{suggestions:t,count:n}=A.search(B.query,B.limit);if(null==e?void 0:e.length){e.push(...t);const r={};e.forEach((e=>{r[T(e)]=e})),t=Object.values(r),n=t.length}ae(t),w&&ue(t),B.items=t,B.count=n,N=void 0,v&&B.items.length&&(N=B.items[0])},oe=()=>{if(!k)return;j=!0;const e=B.query,t=JSON.stringify(e);if(L[t]||!B.query.length)return j=!1,void Q(!0);J();let n=[];s.get(("function"==typeof k.url?k.url():k.url).replace(k.wildcard,e),null==k?void 0:k.requestOptions).then((e=>{n=I(e),n=u(n,x),ie(n)}),(e=>{console.error("e05",e)})).finally((()=>{L[t]=!0,P[t]=n||[],j=!1,J(),n.length&&B.query.length&&(re(n),ee()),B.query.length&&e!==B.query&&oe(),Q(!0)}))};function ie(e){e.length&&(A.add(e,x,T),S&&S.forEach((t=>{A.add(e,t,T)})))}const ae=e=>{e.sort(((e,t)=>{const n=e[x].toLowerCase().startsWith(B.query.toLowerCase()),r=t[x].toLowerCase().startsWith(B.query.toLowerCase());return n&&!r||n&&e[x].length<t[x].length?-1:0}))},ue=e=>{e.sort(((e,t)=>!e[w]||e[w]<t[w]?-1:e[w]>t[w]?1:0))},se=(t,n)=>{const r=(e,t)=>{let n;for(let o=0;o<e.childNodes.length;o++)n=e.childNodes[o],3===n.nodeType?o+=t(n)?1:0:r(n,t)},i=((e,t)=>{const n=o(e);return new RegExp("("+n+")","i")})(n);n&&r(t,(t=>{var n;let r=i.exec(t.data);e.diacritics&&!r&&(r=i.exec(a(t.data)));const o=f.createElement("span");if(o.className=M.highlight,r){const e=t.splitText(r.index);e.splitText(r[0].length),o.appendChild(e.cloneNode(!0)),null===(n=null==t?void 0:t.parentNode)||void 0===n||n.replaceChild(o,e)}return!!r}))},ce=t=>{const n=D.value;if(n&&C(t)!==n&&0===ne(C(t)).indexOf(ne(n).replace(/\s{2,}/g," ").trimStart())){const r=C(t),i=new RegExp(o(B.query),"i");let u=i.exec(r);e.diacritics&&!u&&(u=i.exec(a(r))),u&&(X.value=n.replace(/\s?$/,"")+r.substring(u[0].length))}else X.value=""},le=(e,t)=>{const n=f.createElement("template");return n.innerHTML=t,e.appendChild(n.content),t};m.addEventListener("mousedown",(function(e){e.stopPropagation(),e.preventDefault()}));const fe=e=>{$(),A.clear(),O&&!e&&F(O),L={},P={},E&&(E.done=!1)};return D.addEventListener("keydown",(e=>{if(!D.value.length||"Escape"===e.key)return $();if(B.items.length&&("ArrowUp"===e.key||"ArrowDown"===e.key))return"ArrowDown"===e.key?(e=>{const t=B.items.length>=B.limit?B.limit:B.items.length;if(!N)return N=B.items[0],void(D.value=C(N,e));if(N===B.items[t-1])return N=void 0,void(D.value=q);for(let e=0;e<t-1;e++)if(N===B.items[e]){N=B.items[e+1];break}D.value=C(N,e)})(e):(e=>{const t=B.items.length>=B.limit?B.limit:B.items.length;if(N===B.items[0])return N=void 0,void(D.value=q);if(N){for(let e=t-1;e>0;e--)if(N===B.items[e]||1===e){N=B.items[e-1];break}}else N=B.items[t-1];D.value=C(N,e)})(e),ee(),e.preventDefault(),void e.stopPropagation();const t=function(t=!1){if(!N&&t&&B.items.length&&(N=B.items[0]),N)return $(),D.value=C(N,e),K(),N};if("Enter"===e.key)return d&&e.preventDefault(),void _(e,t());"Tab"!==e.key||m.classList.contains(M.hide)||(e.preventDefault(),t(!0))})),D.addEventListener("input",(e=>{("insertCompositionText"!==e.inputType||e.isComposing)&&(q=D.value,te())})),D.addEventListener("blur",(()=>{setTimeout((()=>{f.activeElement!==D&&$()}),50)})),D.addEventListener("focus",(()=>{E&&"onFocus"===E.when&&W(),te()})),{addToIndex:F,reset:fe,destroy:()=>{z(),fe(),Y.replaceWith(D.cloneNode())}}}}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.m=t,e=[],r.O=(t,n,o,i)=>{if(!n){var a=1/0;for(l=0;l<e.length;l++){for(var[n,o,i]=e[l],u=!0,s=0;s<n.length;s++)(!1&i||a>=i)&&Object.keys(r.O).every((e=>r.O[e](n[s])))?n.splice(s--,1):(u=!1,i<a&&(a=i));if(u){e.splice(l--,1);var c=o();void 0!==c&&(t=c)}}return t}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[n,o,i]},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={179:0,53:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var o,i,[a,u,s]=n,c=0;if(a.some((t=>0!==e[t]))){for(o in u)r.o(u,o)&&(r.m[o]=u[o]);if(s)var l=s(r)}for(t&&t(n);c<a.length;c++)i=a[c],r.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return r.O(l)},n=this.webpackChunktypeahead=this.webpackChunktypeahead||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var o=r.O(void 0,[53],(()=>r(588)));return(o=r.O(o)).default})(),e.exports=t()},976:e=>{"use strict";e.exports=DG},469:e=>{"use strict";e.exports=grok},701:e=>{"use strict";e.exports=rxjs},442:e=>{"use strict";e.exports=rxjs.operators},870:e=>{"use strict";e.exports=ui},414:e=>{"use strict";e.exports=wu}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={id:e,exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nc=void 0;var __webpack_exports__=__webpack_require__(526);curves=__webpack_exports__})();
1
+ var curves;(()=>{var __webpack_modules__={78:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";function copyInto(e,t){for(var n=0;n<t.length;n++)e[n]=t[n]}function limitedMemoryBFGS(e,t){var n=+new Date,r=t.length,o=numeric.rep([r],0);e.getGradient(t,o);var i=numeric.clone(o),a=numeric.clone(t),u=numeric.clone(o);numeric.diveq(u,numeric.norm2(u));var s=[],c=[],l=[],f=(backtrackingLineSearch(e,u,o,t),e.getValue(t));o=e.getGradient(t,o);for(var m=f,h=0;h<100;h++){var d;if(new Date,s.length<4)s.unshift(numeric.sub(t,a)),c.unshift(numeric.sub(o,i));else{for(var p=s.pop(),g=c.pop(),v=0;v<r;v++)p[v]=t[v]-a[v],g[v]=o[v]-i[v];s.unshift(p),c.unshift(g)}copyInto(a,t),copyInto(i,o);var y=0,A=0;for(v=0;v<r;v++)y+=s[0][v]*c[0][v],A+=c[0][v]*c[0][v];var x=y/A;l.unshift(1/y),copyInto(u,o);for(var w=[],b=0;b<s.length;b++){var C=0;for(v=0;v<r;v++)C+=s[b][v]*u[v];for(C*=l[b],w.push(C),v=0;v<r;v++)u[v]+=c[b][v]*-C}for(v=0;v<r;v++)u[v]*=x;for(b=s.length-1;b>=0;b--){var T=0;for(v=0;v<r;v++)T+=c[b][v]*u[v];for(T*=l[b],C=w[b],v=0;v<r;v++)u[v]+=s[b][v]*(C-T)}for(v=0;v<r;v++)u[v]=-u[v];if(backtrackingLineSearch(e,u,o,t),f=e.getValue(t),o=e.getGradient(t,o),2*(f-m)<=1e-4*(Math.abs(f)+Math.abs(m)+1e-5))return d=+new Date,!0;var _=numeric.norm2(o);if(_<.001)return d=+new Date,!0;if(0==_)return d=+new Date,!0;m=f}return d=+new Date,console.log("Finished iterations "+(d-n)),!0}function backtrackingLineSearch(e,t,n,r){var o=r.length,i=0,a=1,u=0,s=e.getValue(r),c=s,l=numeric.norm2(t);l>100&&numeric.muleq(t,100/l);for(var f=0,m=0;m<o;m++)f+=n[m]*t[m];var h=0;for(m=0;m<o;m++){var d=Math.abs(t[m]/Math.max(Math.abs(r[m]),1));d>h&&(h=d)}for(var p=1e-4/h,g=0;g<25;g++){for(m=0;m<o;m++)r[m]+=(a-i)*t[m];if(a<p)return 0;var v=e.getValue(r);if(v>=s+1e-4*a*f)return a;if(isFinite(v))if(1==a)u=-f/(2*(v-s-f));else{var y=v-s-a*f,A=c-s-i*f,x=1/(a*a),w=1/(i*i),b=1/(a-i),C=b*(y*x-A*w),T=b*(-y*i*x+A*a*w);if(0==C)u=-f/(2*T);else{var _=T*T-3*C*f;u=_<0?.5*a:T<=0?(-T+Math.sqrt(_))/(3*C):-f/(T+Math.sqrt(_))}u>.5*a&&(u=.5*a)}else u=.2*a;c=v,i=a,a=Math.max(u,.1*a)}}__webpack_require__.d(__webpack_exports__,{U:()=>limitedMemoryBFGS});var quadratic={getValue:function(e){var t=e[0],n=e[1];return-3*t*t-4*n*n+2*t-4*n+18},getGradient:function(e,t){return t[0]=-6*e[0]+2,t[1]=-8*e[1]-4,t}};function doubleExp(e){for(var t=Array(e),n=0;n<e;n++)t[n]=Math.log(Math.random())*(Math.random()>.5?1:-1);return t}var ridgeRegression={covariates:[],responses:[],originalParameters:doubleExp(100),sample:function(e,t){for(var n=0;n<e;n++){var r=doubleExp(100);this.responses.push(numeric.dot(r,this.originalParameters)+t()),this.covariates.push(r)}},getValue:function(e){for(var t=0,n=0;n<this.covariates.length;n++){var r=this.responses[n]-numeric.dot(this.covariates[n],e);t+=-.5*r*r}return t},getGradient:function(e,t){for(var n=0;n<this.covariates.length;n++){var r=this.responses[n]-numeric.dot(this.covariates[n],e);numeric.addeq(t,numeric.mul(this.covariates[n],r))}return t}},numeric="undefined"==typeof exports?function(){}:exports;void 0!==__webpack_require__.g&&(__webpack_require__.g.numeric=numeric),numeric.version="1.2.6",numeric.bench=function(e,t){var n,r,o;for(void 0===t&&(t=15),r=.5,n=new Date;;){for(o=r*=2;o>3;o-=4)e(),e(),e(),e();for(;o>0;)e(),o--;if(new Date-n>t)break}for(o=r;o>3;o-=4)e(),e(),e(),e();for(;o>0;)e(),o--;return 1e3*(3*r-1)/(new Date-n)},numeric._myIndexOf=function(e){var t,n=this.length;for(t=0;t<n;++t)if(this[t]===e)return t;return-1},numeric.myIndexOf=Array.prototype.indexOf?Array.prototype.indexOf:numeric._myIndexOf,numeric.Function=Function,numeric.precision=4,numeric.largeArray=50,numeric.prettyPrint=function(e){function t(e){if(0===e)return"0";if(isNaN(e))return"NaN";if(e<0)return"-"+t(-e);if(isFinite(e)){var n=Math.floor(Math.log(e)/Math.log(10)),r=e/Math.pow(10,n),o=r.toPrecision(numeric.precision);return 10===parseFloat(o)&&(n++,o=(r=1).toPrecision(numeric.precision)),parseFloat(o).toString()+"e"+n.toString()}return"Infinity"}var n=[];return function e(r){var o;if(void 0===r)return n.push(Array(numeric.precision+8).join(" ")),!1;if("string"==typeof r)return n.push('"'+r+'"'),!1;if("boolean"==typeof r)return n.push(r.toString()),!1;if("number"==typeof r){var i=t(r),a=r.toPrecision(numeric.precision),u=parseFloat(r.toString()).toString(),s=[i,a,u,parseFloat(a).toString(),parseFloat(u).toString()];for(o=1;o<s.length;o++)s[o].length<i.length&&(i=s[o]);return n.push(Array(numeric.precision+8-i.length).join(" ")+i),!1}if(null===r)return n.push("null"),!1;if("function"==typeof r){n.push(r.toString());var c=!1;for(o in r)r.hasOwnProperty(o)&&(c?n.push(",\n"):n.push("\n{"),c=!0,n.push(o),n.push(": \n"),e(r[o]));return c&&n.push("}\n"),!0}if(r instanceof Array){if(r.length>numeric.largeArray)return n.push("...Large Array..."),!0;for(c=!1,n.push("["),o=0;o<r.length;o++)o>0&&(n.push(","),c&&n.push("\n ")),c=e(r[o]);return n.push("]"),!0}for(o in n.push("{"),c=!1,r)r.hasOwnProperty(o)&&(c&&n.push(",\n"),c=!0,n.push(o),n.push(": \n"),e(r[o]));return n.push("}"),!0}(e),n.join("")},numeric.parseDate=function(e){return function e(t){if("string"==typeof t)return Date.parse(t.replace(/-/g,"/"));if(t instanceof Array){var n,r=[];for(n=0;n<t.length;n++)r[n]=e(t[n]);return r}throw new Error("parseDate: parameter must be arrays of strings")}(e)},numeric.parseFloat=function(e){return function e(t){if("string"==typeof t)return parseFloat(t);if(t instanceof Array){var n,r=[];for(n=0;n<t.length;n++)r[n]=e(t[n]);return r}throw new Error("parseFloat: parameter must be arrays of strings")}(e)},numeric.parseCSV=function(e){var t,n,r,o=e.split("\n"),i=[],a=/(([^'",]*)|('[^']*')|("[^"]*")),/g,u=/^\s*(([+-]?[0-9]+(\.[0-9]*)?(e[+-]?[0-9]+)?)|([+-]?[0-9]*(\.[0-9]+)?(e[+-]?[0-9]+)?))\s*$/,s=0;for(n=0;n<o.length;n++){var c,l=(o[n]+",").match(a);if(l.length>0){for(i[s]=[],t=0;t<l.length;t++)c=(r=l[t]).substr(0,r.length-1),u.test(c)?i[s][t]=parseFloat(c):i[s][t]=c;s++}}return i},numeric.toCSV=function(e){var t,n,r,o,i,a=numeric.dim(e);for(r=a[0],a[1],i=[],t=0;t<r;t++){for(o=[],n=0;n<r;n++)o[n]=e[t][n].toString();i[t]=o.join(", ")}return i.join("\n")+"\n"},numeric.getURL=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(),t},numeric.imageURL=function(e){function t(e,t,n){void 0===t&&(t=0),void 0===n&&(n=e.length);var r,o=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],i=-1;for(e.length,r=t;r<n;r++)i=i>>>8^o[255&(i^e[r])];return-1^i}var n,r,o,i,a,u,s,c,l,f,m=e[0].length,h=e[0][0].length,d=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,h>>24&255,h>>16&255,h>>8&255,255&h,m>>24&255,m>>16&255,m>>8&255,255&m,8,2,0,0,0,-1,-2,-3,-4,-5,-6,-7,-8,73,68,65,84,8,29];for(f=t(d,12,29),d[29]=f>>24&255,d[30]=f>>16&255,d[31]=f>>8&255,d[32]=255&f,n=1,r=0,s=0;s<m;s++){for(s<m-1?d.push(0):d.push(1),a=3*h+1+(0===s)&255,u=3*h+1+(0===s)>>8&255,d.push(a),d.push(u),d.push(255&~a),d.push(255&~u),0===s&&d.push(0),c=0;c<h;c++)for(o=0;o<3;o++)r=(r+(n=(n+(a=(a=e[o][s][c])>255?255:a<0?0:Math.round(a)))%65521))%65521,d.push(a);d.push(0)}return l=(r<<16)+n,d.push(l>>24&255),d.push(l>>16&255),d.push(l>>8&255),d.push(255&l),i=d.length-41,d[33]=i>>24&255,d[34]=i>>16&255,d[35]=i>>8&255,d[36]=255&i,f=t(d,37),d.push(f>>24&255),d.push(f>>16&255),d.push(f>>8&255),d.push(255&f),d.push(0),d.push(0),d.push(0),d.push(0),d.push(73),d.push(69),d.push(78),d.push(68),d.push(174),d.push(66),d.push(96),d.push(130),"data:image/png;base64,"+function(e){var t,n,r,o,i,a,u,s=e.length,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="";for(t=0;t<s;t+=3)i=((3&(n=e[t]))<<4)+((r=e[t+1])>>4),a=((15&r)<<2)+((o=e[t+2])>>6),u=63&o,t+1>=s?a=u=64:t+2>=s&&(u=64),l+=c.charAt(n>>2)+c.charAt(i)+c.charAt(a)+c.charAt(u);return l}(d)},numeric._dim=function(e){for(var t=[];"object"==typeof e;)t.push(e.length),e=e[0];return t},numeric.dim=function(e){var t;return"object"==typeof e?"object"==typeof(t=e[0])?"object"==typeof t[0]?numeric._dim(e):[e.length,t.length]:[e.length]:[]},numeric.mapreduce=function(e,t){return Function("x","accum","_s","_k",'if(typeof accum === "undefined") accum = '+t+';\nif(typeof x === "number") { var xi = x; '+e+'; return accum; }\nif(typeof _s === "undefined") _s = numeric.dim(x);\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i,xi;\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) {\n accum = arguments.callee(x[i],accum,_s,_k+1);\n } return accum;\n}\nfor(i=_n-1;i>=1;i-=2) { \n xi = x[i];\n '+e+";\n xi = x[i-1];\n "+e+";\n}\nif(i === 0) {\n xi = x[i];\n "+e+"\n}\nreturn accum;")},numeric.mapreduce2=function(e,t){return Function("x","var n = x.length;\nvar i,xi;\n"+t+";\nfor(i=n-1;i!==-1;--i) { \n xi = x[i];\n "+e+";\n}\nreturn accum;")},numeric.same=function e(t,n){var r,o;if(t instanceof Array&&n instanceof Array){if((o=t.length)!==n.length)return!1;for(r=0;r<o;r++)if(t[r]!==n[r]){if("object"!=typeof t[r])return!1;if(!e(t[r],n[r]))return!1}return!0}return!1},numeric.rep=function(e,t,n){void 0===n&&(n=0);var r,o=e[n],i=Array(o);if(n===e.length-1){for(r=o-2;r>=0;r-=2)i[r+1]=t,i[r]=t;return-1===r&&(i[0]=t),i}for(r=o-1;r>=0;r--)i[r]=numeric.rep(e,t,n+1);return i},numeric.dotMMsmall=function(e,t){var n,r,o,i,a,u,s,c,l,f,m;for(i=e.length,a=t.length,u=t[0].length,s=Array(i),n=i-1;n>=0;n--){for(c=Array(u),l=e[n],o=u-1;o>=0;o--){for(f=l[a-1]*t[a-1][o],r=a-2;r>=1;r-=2)m=r-1,f+=l[r]*t[r][o]+l[m]*t[m][o];0===r&&(f+=l[0]*t[0][o]),c[o]=f}s[n]=c}return s},numeric._getCol=function(e,t,n){var r;for(r=e.length-1;r>0;--r)n[r]=e[r][t],n[--r]=e[r][t];0===r&&(n[0]=e[0][t])},numeric.dotMMbig=function(e,t){var n,r,o,i=numeric._getCol,a=t.length,u=Array(a),s=e.length,c=t[0].length,l=new Array(s),f=numeric.dotVV;for(--a,r=--s;-1!==r;--r)l[r]=Array(c);for(r=--c;-1!==r;--r)for(i(t,r,u),o=s;-1!==o;--o)n=e[o],l[o][r]=f(n,u);return l},numeric.dotMV=function(e,t){var n,r=e.length,o=(t.length,Array(r)),i=numeric.dotVV;for(n=r-1;n>=0;n--)o[n]=i(e[n],t);return o},numeric.dotVM=function(e,t){var n,r,o,i,a,u,s;for(o=e.length,i=t[0].length,a=Array(i),r=i-1;r>=0;r--){for(u=e[o-1]*t[o-1][r],n=o-2;n>=1;n-=2)s=n-1,u+=e[n]*t[n][r]+e[s]*t[s][r];0===n&&(u+=e[0]*t[0][r]),a[r]=u}return a},numeric.dotVV=function(e,t){var n,r,o=e.length,i=e[o-1]*t[o-1];for(n=o-2;n>=1;n-=2)r=n-1,i+=e[n]*t[n]+e[r]*t[r];return 0===n&&(i+=e[0]*t[0]),i},numeric.dot=function(e,t){var n=numeric.dim;switch(1e3*n(e).length+n(t).length){case 2002:return t.length<10?numeric.dotMMsmall(e,t):numeric.dotMMbig(e,t);case 2001:return numeric.dotMV(e,t);case 1002:return numeric.dotVM(e,t);case 1001:return numeric.dotVV(e,t);case 1e3:return numeric.mulVS(e,t);case 1:return numeric.mulSV(e,t);case 0:return e*t;default:throw new Error("numeric.dot only works on vectors and matrices")}},numeric.diag=function(e){var t,n,r,o,i=e.length,a=Array(i);for(t=i-1;t>=0;t--){for(o=Array(i),n=t+2,r=i-1;r>=n;r-=2)o[r]=0,o[r-1]=0;for(r>t&&(o[r]=0),o[t]=e[t],r=t-1;r>=1;r-=2)o[r]=0,o[r-1]=0;0===r&&(o[0]=0),a[t]=o}return a},numeric.getDiag=function(e){var t,n=Math.min(e.length,e[0].length),r=Array(n);for(t=n-1;t>=1;--t)r[t]=e[t][t],r[--t]=e[t][t];return 0===t&&(r[0]=e[0][0]),r},numeric.identity=function(e){return numeric.diag(numeric.rep([e],1))},numeric.pointwise=function(e,t,n){void 0===n&&(n="");var r,o,i=[],a=/\[i\]$/,u="",s=!1;for(r=0;r<e.length;r++)a.test(e[r])?u=o=e[r].substring(0,e[r].length-3):o=e[r],"ret"===o&&(s=!0),i.push(o);return i[e.length]="_s",i[e.length+1]="_k",i[e.length+2]='if(typeof _s === "undefined") _s = numeric.dim('+u+');\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i'+(s?"":", ret = Array(_n)")+";\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) ret[i] = arguments.callee("+e.join(",")+",_s,_k+1);\n return ret;\n}\n"+n+"\nfor(i=_n-1;i!==-1;--i) {\n "+t+"\n}\nreturn ret;",Function.apply(null,i)},numeric.pointwise2=function(e,t,n){void 0===n&&(n="");var r,o,i=[],a=/\[i\]$/,u="",s=!1;for(r=0;r<e.length;r++)a.test(e[r])?u=o=e[r].substring(0,e[r].length-3):o=e[r],"ret"===o&&(s=!0),i.push(o);return i[e.length]="var _n = "+u+".length;\nvar i"+(s?"":", ret = Array(_n)")+";\n"+n+"\nfor(i=_n-1;i!==-1;--i) {\n"+t+"\n}\nreturn ret;",Function.apply(null,i)},numeric._biforeach=function e(t,n,r,o,i){var a;if(o!==r.length-1)for(a=r[o]-1;a>=0;a--)e("object"==typeof t?t[a]:t,"object"==typeof n?n[a]:n,r,o+1,i);else i(t,n)},numeric._biforeach2=function e(t,n,r,o,i){if(o===r.length-1)return i(t,n);var a,u=r[o],s=Array(u);for(a=u-1;a>=0;--a)s[a]=e("object"==typeof t?t[a]:t,"object"==typeof n?n[a]:n,r,o+1,i);return s},numeric._foreach=function e(t,n,r,o){var i;if(r!==n.length-1)for(i=n[r]-1;i>=0;i--)e(t[i],n,r+1,o);else o(t)},numeric._foreach2=function e(t,n,r,o){if(r===n.length-1)return o(t);var i,a=n[r],u=Array(a);for(i=a-1;i>=0;i--)u[i]=e(t[i],n,r+1,o);return u},numeric.ops2={add:"+",sub:"-",mul:"*",div:"/",mod:"%",and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">=",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"},numeric.opseq={addeq:"+=",subeq:"-=",muleq:"*=",diveq:"/=",modeq:"%=",lshifteq:"<<=",rshifteq:">>=",rrshifteq:">>>=",bandeq:"&=",boreq:"|=",bxoreq:"^="},numeric.mathfuns=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","isNaN","isFinite"],numeric.mathfuns2=["atan2","pow","max","min"],numeric.ops1={neg:"-",not:"!",bnot:"~",clone:""},numeric.mapreducers={any:["if(xi) return true;","var accum = false;"],all:["if(!xi) return false;","var accum = true;"],sum:["accum += xi;","var accum = 0;"],prod:["accum *= xi;","var accum = 1;"],norm2Squared:["accum += xi*xi;","var accum = 0;"],norminf:["accum = max(accum,abs(xi));","var accum = 0, max = Math.max, abs = Math.abs;"],norm1:["accum += abs(xi)","var accum = 0, abs = Math.abs;"],sup:["accum = max(accum,xi);","var accum = -Infinity, max = Math.max;"],inf:["accum = min(accum,xi);","var accum = Infinity, min = Math.min;"]},function(){var e,t;for(e=0;e<numeric.mathfuns2.length;++e)t=numeric.mathfuns2[e],numeric.ops2[t]=t;for(e in numeric.ops2)if(numeric.ops2.hasOwnProperty(e)){t=numeric.ops2[e];var n,r,o="";-1!==numeric.myIndexOf.call(numeric.mathfuns2,e)?(o="var "+t+" = Math."+t+";\n",n=function(e,n,r){return e+" = "+t+"("+n+","+r+")"},r=function(e,n){return e+" = "+t+"("+e+","+n+")"}):(n=function(e,n,r){return e+" = "+n+" "+t+" "+r},r=numeric.opseq.hasOwnProperty(e+"eq")?function(e,n){return e+" "+t+"= "+n}:function(e,n){return e+" = "+e+" "+t+" "+n}),numeric[e+"VV"]=numeric.pointwise2(["x[i]","y[i]"],n("ret[i]","x[i]","y[i]"),o),numeric[e+"SV"]=numeric.pointwise2(["x","y[i]"],n("ret[i]","x","y[i]"),o),numeric[e+"VS"]=numeric.pointwise2(["x[i]","y"],n("ret[i]","x[i]","y"),o),numeric[e]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar VV = numeric."+e+"VV, VS = numeric."+e+"VS, SV = numeric."+e+'SV;\nvar dim = numeric.dim;\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof x === "object") {\n if(typeof y === "object") x = numeric._biforeach2(x,y,dim(x),0,VV);\n else x = numeric._biforeach2(x,y,dim(x),0,VS);\n } else if(typeof y === "object") x = numeric._biforeach2(x,y,dim(y),0,SV);\n else '+r("x","y")+"\n}\nreturn x;\n"),numeric[t]=numeric[e],numeric[e+"eqV"]=numeric.pointwise2(["ret[i]","x[i]"],r("ret[i]","x[i]"),o),numeric[e+"eqS"]=numeric.pointwise2(["ret[i]","x"],r("ret[i]","x"),o),numeric[e+"eq"]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar V = numeric."+e+"eqV, S = numeric."+e+'eqS\nvar s = numeric.dim(x);\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof y === "object") numeric._biforeach(x,y,s,0,V);\n else numeric._biforeach(x,y,s,0,S);\n}\nreturn x;\n')}for(e=0;e<numeric.mathfuns2.length;++e)t=numeric.mathfuns2[e],delete numeric.ops2[t];for(e=0;e<numeric.mathfuns.length;++e)t=numeric.mathfuns[e],numeric.ops1[t]=t;for(e in numeric.ops1)numeric.ops1.hasOwnProperty(e)&&(o="",t=numeric.ops1[e],-1!==numeric.myIndexOf.call(numeric.mathfuns,e)&&Math.hasOwnProperty(t)&&(o="var "+t+" = Math."+t+";\n"),numeric[e+"eqV"]=numeric.pointwise2(["ret[i]"],"ret[i] = "+t+"(ret[i]);",o),numeric[e+"eq"]=Function("x",'if(typeof x !== "object") return '+t+"x\nvar i;\nvar V = numeric."+e+"eqV;\nvar s = numeric.dim(x);\nnumeric._foreach(x,s,0,V);\nreturn x;\n"),numeric[e+"V"]=numeric.pointwise2(["x[i]"],"ret[i] = "+t+"(x[i]);",o),numeric[e]=Function("x",'if(typeof x !== "object") return '+t+"(x)\nvar i;\nvar V = numeric."+e+"V;\nvar s = numeric.dim(x);\nreturn numeric._foreach2(x,s,0,V);\n"));for(e=0;e<numeric.mathfuns.length;++e)t=numeric.mathfuns[e],delete numeric.ops1[t];for(e in numeric.mapreducers)numeric.mapreducers.hasOwnProperty(e)&&(t=numeric.mapreducers[e],numeric[e+"V"]=numeric.mapreduce2(t[0],t[1]),numeric[e]=Function("x","s","k",t[1]+'if(typeof x !== "object") { xi = x;\n'+t[0]+';\n return accum;\n}if(typeof s === "undefined") s = numeric.dim(x);\nif(typeof k === "undefined") k = 0;\nif(k === s.length-1) return numeric.'+e+"V(x);\nvar xi;\nvar n = x.length, i;\nfor(i=n-1;i!==-1;--i) {\n xi = arguments.callee(x[i]);\n"+t[0]+";\n}\nreturn accum;\n"))}(),numeric.truncVV=numeric.pointwise(["x[i]","y[i]"],"ret[i] = round(x[i]/y[i])*y[i];","var round = Math.round;"),numeric.truncVS=numeric.pointwise(["x[i]","y"],"ret[i] = round(x[i]/y)*y;","var round = Math.round;"),numeric.truncSV=numeric.pointwise(["x","y[i]"],"ret[i] = round(x/y[i])*y[i];","var round = Math.round;"),numeric.trunc=function(e,t){return"object"==typeof e?"object"==typeof t?numeric.truncVV(e,t):numeric.truncVS(e,t):"object"==typeof t?numeric.truncSV(e,t):Math.round(e/t)*t},numeric.inv=function(e){var t,n,r,o,i,a,u,s=numeric.dim(e),c=Math.abs,l=s[0],f=s[1],m=numeric.clone(e),h=numeric.identity(l);for(a=0;a<f;++a){var d=-1,p=-1;for(i=a;i!==l;++i)(u=c(m[i][a]))>p&&(d=i,p=u);for(n=m[d],m[d]=m[a],m[a]=n,o=h[d],h[d]=h[a],h[a]=o,e=n[a],u=a;u!==f;++u)n[u]/=e;for(u=f-1;-1!==u;--u)o[u]/=e;for(i=l-1;-1!==i;--i)if(i!==a){for(t=m[i],r=h[i],e=t[a],u=a+1;u!==f;++u)t[u]-=n[u]*e;for(u=f-1;u>0;--u)r[u]-=o[u]*e,r[--u]-=o[u]*e;0===u&&(r[0]-=o[0]*e)}}return h},numeric.det=function(e){var t=numeric.dim(e);if(2!==t.length||t[0]!==t[1])throw new Error("numeric: det() only works on square matrices");var n,r,o,i,a,u,s,c,l=t[0],f=1,m=numeric.clone(e);for(r=0;r<l-1;r++){for(o=r,n=r+1;n<l;n++)Math.abs(m[n][r])>Math.abs(m[o][r])&&(o=n);for(o!==r&&(s=m[o],m[o]=m[r],m[r]=s,f*=-1),i=m[r],n=r+1;n<l;n++){for(u=(a=m[n])[r]/i[r],o=r+1;o<l-1;o+=2)c=o+1,a[o]-=i[o]*u,a[c]-=i[c]*u;o!==l&&(a[o]-=i[o]*u)}if(0===i[r])return 0;f*=i[r]}return f*m[r][r]},numeric.transpose=function(e){var t,n,r,o,i,a=e.length,u=e[0].length,s=Array(u);for(n=0;n<u;n++)s[n]=Array(a);for(t=a-1;t>=1;t-=2){for(o=e[t],r=e[t-1],n=u-1;n>=1;--n)(i=s[n])[t]=o[n],i[t-1]=r[n],(i=s[--n])[t]=o[n],i[t-1]=r[n];0===n&&((i=s[0])[t]=o[0],i[t-1]=r[0])}if(0===t){for(r=e[0],n=u-1;n>=1;--n)s[n][0]=r[n],s[--n][0]=r[n];0===n&&(s[0][0]=r[0])}return s},numeric.negtranspose=function(e){var t,n,r,o,i,a=e.length,u=e[0].length,s=Array(u);for(n=0;n<u;n++)s[n]=Array(a);for(t=a-1;t>=1;t-=2){for(o=e[t],r=e[t-1],n=u-1;n>=1;--n)(i=s[n])[t]=-o[n],i[t-1]=-r[n],(i=s[--n])[t]=-o[n],i[t-1]=-r[n];0===n&&((i=s[0])[t]=-o[0],i[t-1]=-r[0])}if(0===t){for(r=e[0],n=u-1;n>=1;--n)s[n][0]=-r[n],s[--n][0]=-r[n];0===n&&(s[0][0]=-r[0])}return s},numeric._random=function e(t,n){var r,o,i=t[n],a=Array(i);if(n===t.length-1){for(o=Math.random,r=i-1;r>=1;r-=2)a[r]=o(),a[r-1]=o();return 0===r&&(a[0]=o()),a}for(r=i-1;r>=0;r--)a[r]=e(t,n+1);return a},numeric.random=function(e){return numeric._random(e,0)},numeric.norm2=function(e){return Math.sqrt(numeric.norm2Squared(e))},numeric.linspace=function(e,t,n){if(void 0===n&&(n=Math.max(Math.round(t-e)+1,1)),n<2)return 1===n?[e]:[];var r,o=Array(n);for(r=--n;r>=0;r--)o[r]=(r*t+(n-r)*e)/n;return o},numeric.getBlock=function(e,t,n){var r=numeric.dim(e);return function e(o,i){var a,u=t[i],s=n[i]-u,c=Array(s);if(i===r.length-1){for(a=s;a>=0;a--)c[a]=o[a+u];return c}for(a=s;a>=0;a--)c[a]=e(o[a+u],i+1);return c}(e,0)},numeric.setBlock=function(e,t,n,r){var o=numeric.dim(e);return function e(r,i,a){var u,s=t[a],c=n[a]-s;if(a===o.length-1)for(u=c;u>=0;u--)r[u+s]=i[u];for(u=c;u>=0;u--)e(r[u+s],i[u],a+1)}(e,r,0),e},numeric.getRange=function(e,t,n){var r,o,i,a,u=t.length,s=n.length,c=Array(u);for(r=u-1;-1!==r;--r)for(c[r]=Array(s),i=c[r],a=e[t[r]],o=s-1;-1!==o;--o)i[o]=a[n[o]];return c},numeric.blockMatrix=function(e){var t=numeric.dim(e);if(t.length<4)return numeric.blockMatrix([e]);var n,r,o,i,a,u=t[0],s=t[1];for(n=0,r=0,o=0;o<u;++o)n+=e[o][0].length;for(i=0;i<s;++i)r+=e[0][i][0].length;var c=Array(n);for(o=0;o<n;++o)c[o]=Array(r);var l,f,m,h,d,p=0;for(o=0;o<u;++o){for(l=r,i=s-1;-1!==i;--i)for(l-=(a=e[o][i])[0].length,m=a.length-1;-1!==m;--m)for(d=a[m],f=c[p+m],h=d.length-1;-1!==h;--h)f[l+h]=d[h];p+=e[o][0].length}return c},numeric.tensor=function(e,t){if("number"==typeof e||"number"==typeof t)return numeric.mul(e,t);var n=numeric.dim(e),r=numeric.dim(t);if(1!==n.length||1!==r.length)throw new Error("numeric: tensor product is only defined for vectors");var o,i,a,u,s=n[0],c=r[0],l=Array(s);for(i=s-1;i>=0;i--){for(o=Array(c),u=e[i],a=c-1;a>=3;--a)o[a]=u*t[a],o[--a]=u*t[a],o[--a]=u*t[a],o[--a]=u*t[a];for(;a>=0;)o[a]=u*t[a],--a;l[i]=o}return l},numeric.T=function(e,t){this.x=e,this.y=t},numeric.t=function(e,t){return new numeric.T(e,t)},numeric.Tbinop=function(e,t,n,r,o){var i;if(numeric.indexOf,"string"!=typeof o)for(i in o="",numeric)numeric.hasOwnProperty(i)&&(e.indexOf(i)>=0||t.indexOf(i)>=0||n.indexOf(i)>=0||r.indexOf(i)>=0)&&i.length>1&&(o+="var "+i+" = numeric."+i+";\n");return Function(["y"],"var x = this;\nif(!(y instanceof numeric.T)) { y = new numeric.T(y); }\n"+o+"\nif(x.y) { if(y.y) { return new numeric.T("+r+");\n }\n return new numeric.T("+n+");\n}\nif(y.y) {\n return new numeric.T("+t+");\n}\nreturn new numeric.T("+e+");\n")},numeric.T.prototype.add=numeric.Tbinop("add(x.x,y.x)","add(x.x,y.x),y.y","add(x.x,y.x),x.y","add(x.x,y.x),add(x.y,y.y)"),numeric.T.prototype.sub=numeric.Tbinop("sub(x.x,y.x)","sub(x.x,y.x),neg(y.y)","sub(x.x,y.x),x.y","sub(x.x,y.x),sub(x.y,y.y)"),numeric.T.prototype.mul=numeric.Tbinop("mul(x.x,y.x)","mul(x.x,y.x),mul(x.x,y.y)","mul(x.x,y.x),mul(x.y,y.x)","sub(mul(x.x,y.x),mul(x.y,y.y)),add(mul(x.x,y.y),mul(x.y,y.x))"),numeric.T.prototype.reciprocal=function(){var e=numeric.mul,t=numeric.div;if(this.y){var n=numeric.add(e(this.x,this.x),e(this.y,this.y));return new numeric.T(t(this.x,n),t(numeric.neg(this.y),n))}return new T(t(1,this.x))},numeric.T.prototype.div=function(e){if(e instanceof numeric.T||(e=new numeric.T(e)),e.y)return this.mul(e.reciprocal());var t=numeric.div;return this.y?new numeric.T(t(this.x,e.x),t(this.y,e.x)):new numeric.T(t(this.x,e.x))},numeric.T.prototype.dot=numeric.Tbinop("dot(x.x,y.x)","dot(x.x,y.x),dot(x.x,y.y)","dot(x.x,y.x),dot(x.y,y.x)","sub(dot(x.x,y.x),dot(x.y,y.y)),add(dot(x.x,y.y),dot(x.y,y.x))"),numeric.T.prototype.transpose=function(){var e=numeric.transpose,t=this.x,n=this.y;return n?new numeric.T(e(t),e(n)):new numeric.T(e(t))},numeric.T.prototype.transjugate=function(){var e=numeric.transpose,t=this.x,n=this.y;return n?new numeric.T(e(t),numeric.negtranspose(n)):new numeric.T(e(t))},numeric.Tunop=function(e,t,n){return"string"!=typeof n&&(n=""),Function("var x = this;\n"+n+"\nif(x.y) { "+t+";\n}\n"+e+";\n")},numeric.T.prototype.exp=numeric.Tunop("return new numeric.T(ex)","return new numeric.T(mul(cos(x.y),ex),mul(sin(x.y),ex))","var ex = numeric.exp(x.x), cos = numeric.cos, sin = numeric.sin, mul = numeric.mul;"),numeric.T.prototype.conj=numeric.Tunop("return new numeric.T(x.x);","return new numeric.T(x.x,numeric.neg(x.y));"),numeric.T.prototype.neg=numeric.Tunop("return new numeric.T(neg(x.x));","return new numeric.T(neg(x.x),neg(x.y));","var neg = numeric.neg;"),numeric.T.prototype.sin=numeric.Tunop("return new numeric.T(numeric.sin(x.x))","return x.exp().sub(x.neg().exp()).div(new numeric.T(0,2));"),numeric.T.prototype.cos=numeric.Tunop("return new numeric.T(numeric.cos(x.x))","return x.exp().add(x.neg().exp()).div(2);"),numeric.T.prototype.abs=numeric.Tunop("return new numeric.T(numeric.abs(x.x));","return new numeric.T(numeric.sqrt(numeric.add(mul(x.x,x.x),mul(x.y,x.y))));","var mul = numeric.mul;"),numeric.T.prototype.log=numeric.Tunop("return new numeric.T(numeric.log(x.x));","var theta = new numeric.T(numeric.atan2(x.y,x.x)), r = x.abs();\nreturn new numeric.T(numeric.log(r.x),theta.x);"),numeric.T.prototype.norm2=numeric.Tunop("return numeric.norm2(x.x);","var f = numeric.norm2Squared;\nreturn Math.sqrt(f(x.x)+f(x.y));"),numeric.T.prototype.inv=function(){var e=this;if(void 0===e.y)return new numeric.T(numeric.inv(e.x));var t,n,r,o,i,a,u,s,c,l,f,m,h,d,p,g,v,y,A=e.x.length,x=numeric.identity(A),w=numeric.rep([A,A],0),b=numeric.clone(e.x),C=numeric.clone(e.y);for(c=0;c<A;c++){for(m=(d=b[c][c])*d+(p=C[c][c])*p,f=c,l=c+1;l<A;l++)(h=(d=b[l][c])*d+(p=C[l][c])*p)>m&&(f=l,m=h);for(f!==c&&(y=b[c],b[c]=b[f],b[f]=y,y=C[c],C[c]=C[f],C[f]=y,y=x[c],x[c]=x[f],x[f]=y,y=w[c],w[c]=w[f],w[f]=y),t=b[c],n=C[c],i=x[c],a=w[c],d=t[c],p=n[c],l=c+1;l<A;l++)g=t[l],v=n[l],t[l]=(g*d+v*p)/m,n[l]=(v*d-g*p)/m;for(l=0;l<A;l++)g=i[l],v=a[l],i[l]=(g*d+v*p)/m,a[l]=(v*d-g*p)/m;for(l=c+1;l<A;l++){for(r=b[l],o=C[l],u=x[l],s=w[l],d=r[c],p=o[c],f=c+1;f<A;f++)g=t[f],v=n[f],r[f]-=g*d-v*p,o[f]-=v*d+g*p;for(f=0;f<A;f++)g=i[f],v=a[f],u[f]-=g*d-v*p,s[f]-=v*d+g*p}}for(c=A-1;c>0;c--)for(i=x[c],a=w[c],l=c-1;l>=0;l--)for(u=x[l],s=w[l],d=b[l][c],p=C[l][c],f=A-1;f>=0;f--)g=i[f],v=a[f],u[f]-=d*g-p*v,s[f]-=d*v+p*g;return new numeric.T(x,w)},numeric.T.prototype.get=function(e){var t,n=this.x,r=this.y,o=0,i=e.length;if(r){for(;o<i;)n=n[t=e[o]],r=r[t],o++;return new numeric.T(n,r)}for(;o<i;)n=n[t=e[o]],o++;return new numeric.T(n)},numeric.T.prototype.set=function(e,t){var n,r=this.x,o=this.y,i=0,a=e.length,u=t.x,s=t.y;if(0===a)return s?this.y=s:o&&(this.y=void 0),this.x=r,this;if(s){for(o||(o=numeric.rep(numeric.dim(r),0),this.y=o);i<a-1;)r=r[n=e[i]],o=o[n],i++;return r[n=e[i]]=u,o[n]=s,this}if(o){for(;i<a-1;)r=r[n=e[i]],o=o[n],i++;return r[n=e[i]]=u,o[n]=u instanceof Array?numeric.rep(numeric.dim(u),0):0,this}for(;i<a-1;)r=r[n=e[i]],i++;return r[n=e[i]]=u,this},numeric.T.prototype.getRows=function(e,t){var n,r,o=t-e+1,i=Array(o),a=this.x,u=this.y;for(n=e;n<=t;n++)i[n-e]=a[n];if(u){for(r=Array(o),n=e;n<=t;n++)r[n-e]=u[n];return new numeric.T(i,r)}return new numeric.T(i)},numeric.T.prototype.setRows=function(e,t,n){var r,o=this.x,i=this.y,a=n.x,u=n.y;for(r=e;r<=t;r++)o[r]=a[r-e];if(u)for(i||(i=numeric.rep(numeric.dim(o),0),this.y=i),r=e;r<=t;r++)i[r]=u[r-e];else if(i)for(r=e;r<=t;r++)i[r]=numeric.rep([a[r-e].length],0);return this},numeric.T.prototype.getRow=function(e){var t=this.x,n=this.y;return n?new numeric.T(t[e],n[e]):new numeric.T(t[e])},numeric.T.prototype.setRow=function(e,t){var n=this.x,r=this.y,o=t.x,i=t.y;return n[e]=o,i?(r||(r=numeric.rep(numeric.dim(n),0),this.y=r),r[e]=i):r&&(r=numeric.rep([o.length],0)),this},numeric.T.prototype.getBlock=function(e,t){var n=this.x,r=this.y,o=numeric.getBlock;return r?new numeric.T(o(n,e,t),o(r,e,t)):new numeric.T(o(n,e,t))},numeric.T.prototype.setBlock=function(e,t,n){n instanceof numeric.T||(n=new numeric.T(n));var r=this.x,o=this.y,i=numeric.setBlock,a=n.x,u=n.y;if(u)return o||(this.y=numeric.rep(numeric.dim(this),0),o=this.y),i(r,e,t,a),i(o,e,t,u),this;i(r,e,t,a),o&&i(o,e,t,numeric.rep(numeric.dim(a),0))},numeric.T.rep=function(e,t){var n=numeric.T;t instanceof n||(t=new n(t));var r=t.x,o=t.y,i=numeric.rep;return o?new n(i(e,r),i(e,o)):new n(i(e,r))},numeric.T.diag=function(e){e instanceof numeric.T||(e=new numeric.T(e));var t=e.x,n=e.y,r=numeric.diag;return n?new numeric.T(r(t),r(n)):new numeric.T(r(t))},numeric.T.eig=function(){if(this.y)throw new Error("eig: not implemented for complex matrices.");return numeric.eig(this.x)},numeric.T.identity=function(e){return new numeric.T(numeric.identity(e))},numeric.T.prototype.getDiag=function(){var e=numeric,t=this.x,n=this.y;return n?new e.T(e.getDiag(t),e.getDiag(n)):new e.T(e.getDiag(t))},numeric.house=function(e){var t=numeric.clone(e),n=(e[0]>=0?1:-1)*numeric.norm2(e);t[0]+=n;var r=numeric.norm2(t);if(0===r)throw new Error("eig: internal error");return numeric.div(t,r)},numeric.toUpperHessenberg=function(e){var t=numeric.dim(e);if(2!==t.length||t[0]!==t[1])throw new Error("numeric: toUpperHessenberg() only works on square matrices");var n,r,o,i,a,u,s,c,l,f,m=t[0],h=numeric.clone(e),d=numeric.identity(m);for(r=0;r<m-2;r++){for(i=Array(m-r-1),n=r+1;n<m;n++)i[n-r-1]=h[n][r];if(numeric.norm2(i)>0){for(a=numeric.house(i),u=numeric.getBlock(h,[r+1,r],[m-1,m-1]),s=numeric.tensor(a,numeric.dot(a,u)),n=r+1;n<m;n++)for(c=h[n],l=s[n-r-1],o=r;o<m;o++)c[o]-=2*l[o-r];for(u=numeric.getBlock(h,[0,r+1],[m-1,m-1]),s=numeric.tensor(numeric.dot(u,a),a),n=0;n<m;n++)for(c=h[n],l=s[n],o=r+1;o<m;o++)c[o]-=2*l[o-r-1];for(u=Array(m-r-1),n=r+1;n<m;n++)u[n-r-1]=d[n];for(s=numeric.tensor(a,numeric.dot(a,u)),n=r+1;n<m;n++)for(f=d[n],l=s[n-r-1],o=0;o<m;o++)f[o]-=2*l[o]}}return{H:h,Q:d}},numeric.epsilon=2220446049250313e-31,numeric.QRFrancis=function(e,t){void 0===t&&(t=1e4),e=numeric.clone(e),numeric.clone(e);var n,r,o,i,a,u,s,c,l,f,m,h,d,p,g,v,y,A,x=numeric.dim(e)[0],w=numeric.identity(x);if(x<3)return{Q:w,B:[[0,x-1]]};var b=numeric.epsilon;for(A=0;A<t;A++){for(v=0;v<x-1;v++)if(Math.abs(e[v+1][v])<b*(Math.abs(e[v][v])+Math.abs(e[v+1][v+1]))){var C=numeric.QRFrancis(numeric.getBlock(e,[0,0],[v,v]),t),T=numeric.QRFrancis(numeric.getBlock(e,[v+1,v+1],[x-1,x-1]),t);for(h=Array(v+1),g=0;g<=v;g++)h[g]=w[g];for(d=numeric.dot(C.Q,h),g=0;g<=v;g++)w[g]=d[g];for(h=Array(x-v-1),g=v+1;g<x;g++)h[g-v-1]=w[g];for(d=numeric.dot(T.Q,h),g=v+1;g<x;g++)w[g]=d[g-v-1];return{Q:w,B:C.B.concat(numeric.add(T.B,v+1))}}var _,S,I;for(o=e[x-2][x-2],i=e[x-2][x-1],a=e[x-1][x-2],c=o+(u=e[x-1][x-1]),s=o*u-i*a,l=numeric.getBlock(e,[0,0],[2,2]),c*c>=4*s?(_=.5*(c+Math.sqrt(c*c-4*s)),S=.5*(c-Math.sqrt(c*c-4*s)),l=numeric.add(numeric.sub(numeric.dot(l,l),numeric.mul(l,_+S)),numeric.diag(numeric.rep([3],_*S)))):l=numeric.add(numeric.sub(numeric.dot(l,l),numeric.mul(l,c)),numeric.diag(numeric.rep([3],s))),n=[l[0][0],l[1][0],l[2][0]],r=numeric.house(n),h=[e[0],e[1],e[2]],d=numeric.tensor(r,numeric.dot(r,h)),g=0;g<3;g++)for(m=e[g],p=d[g],y=0;y<x;y++)m[y]-=2*p[y];for(h=numeric.getBlock(e,[0,0],[x-1,2]),d=numeric.tensor(numeric.dot(h,r),r),g=0;g<x;g++)for(m=e[g],p=d[g],y=0;y<3;y++)m[y]-=2*p[y];for(h=[w[0],w[1],w[2]],d=numeric.tensor(r,numeric.dot(r,h)),g=0;g<3;g++)for(f=w[g],p=d[g],y=0;y<x;y++)f[y]-=2*p[y];for(v=0;v<x-2;v++){for(y=v;y<=v+1;y++)if(Math.abs(e[y+1][y])<b*(Math.abs(e[y][y])+Math.abs(e[y+1][y+1]))){for(C=numeric.QRFrancis(numeric.getBlock(e,[0,0],[y,y]),t),T=numeric.QRFrancis(numeric.getBlock(e,[y+1,y+1],[x-1,x-1]),t),h=Array(y+1),g=0;g<=y;g++)h[g]=w[g];for(d=numeric.dot(C.Q,h),g=0;g<=y;g++)w[g]=d[g];for(h=Array(x-y-1),g=y+1;g<x;g++)h[g-y-1]=w[g];for(d=numeric.dot(T.Q,h),g=y+1;g<x;g++)w[g]=d[g-y-1];return{Q:w,B:C.B.concat(numeric.add(T.B,y+1))}}for(I=Math.min(x-1,v+3),n=Array(I-v),g=v+1;g<=I;g++)n[g-v-1]=e[g][v];for(r=numeric.house(n),h=numeric.getBlock(e,[v+1,v],[I,x-1]),d=numeric.tensor(r,numeric.dot(r,h)),g=v+1;g<=I;g++)for(m=e[g],p=d[g-v-1],y=v;y<x;y++)m[y]-=2*p[y-v];for(h=numeric.getBlock(e,[0,v+1],[x-1,I]),d=numeric.tensor(numeric.dot(h,r),r),g=0;g<x;g++)for(m=e[g],p=d[g],y=v+1;y<=I;y++)m[y]-=2*p[y-v-1];for(h=Array(I-v),g=v+1;g<=I;g++)h[g-v-1]=w[g];for(d=numeric.tensor(r,numeric.dot(r,h)),g=v+1;g<=I;g++)for(f=w[g],p=d[g-v-1],y=0;y<x;y++)f[y]-=2*p[y]}}throw new Error("numeric: eigenvalue iteration does not converge -- increase maxiter?")},numeric.eig=function(e,t){var n,r,o,i,a,u,s,c,l,f,m,h,d,p,g,v,y=numeric.toUpperHessenberg(e),A=numeric.QRFrancis(y.H,t),x=numeric.T,w=e.length,b=A.B,C=numeric.dot(A.Q,numeric.dot(y.H,numeric.transpose(A.Q))),T=new x(numeric.dot(A.Q,y.Q)),_=b.length,S=Math.sqrt;for(r=0;r<_;r++)if((n=b[r][0])!==b[r][1]){if(i=n+1,a=C[n][n],u=C[n][i],s=C[i][n],c=C[i][i],0===u&&0===s)continue;(f=(l=-a-c)*l-4*(a*c-u*s))>=0?((g=(a-(m=l<0?-.5*(l-S(f)):-.5*(l+S(f))))*(a-m)+u*u)>(v=s*s+(c-m)*(c-m))?(d=(a-m)/(g=S(g)),p=u/g):(d=s/(v=S(v)),p=(c-m)/v),o=new x([[p,-d],[d,p]]),T.setRows(n,i,o.dot(T.getRows(n,i)))):(m=-.5*l,h=.5*S(-f),(g=(a-m)*(a-m)+u*u)>(v=s*s+(c-m)*(c-m))?(d=(a-m)/(g=S(g+h*h)),p=u/g,m=0,h/=g):(d=s/(v=S(v+h*h)),p=(c-m)/v,m=h/v,h=0),o=new x([[p,-d],[d,p]],[[m,h],[h,-m]]),T.setRows(n,i,o.dot(T.getRows(n,i))))}var I=T.dot(e).dot(T.transjugate()),O=(w=e.length,numeric.T.identity(w));for(i=0;i<w;i++)if(i>0)for(r=i-1;r>=0;r--){var k=I.get([r,r]),E=I.get([i,i]);numeric.neq(k.x,E.x)||numeric.neq(k.y,E.y)?(m=I.getRow(r).getBlock([r],[i-1]),h=O.getRow(i).getBlock([r],[i-1]),O.set([i,r],I.get([r,i]).neg().sub(m.dot(h)).div(k.sub(E)))):O.setRow(i,O.getRow(r))}for(i=0;i<w;i++)m=O.getRow(i),O.setRow(i,m.div(m.norm2()));return O=O.transpose(),O=T.transjugate().dot(O),{lambda:I.getDiag(),E:O}},numeric.ccsSparse=function(e){var t,n,r,o=e.length,i=[];for(n=o-1;-1!==n;--n)for(r in t=e[n]){for(r=parseInt(r);r>=i.length;)i[i.length]=0;0!==t[r]&&i[r]++}var a=i.length,u=Array(a+1);for(u[0]=0,n=0;n<a;++n)u[n+1]=u[n]+i[n];var s=Array(u[a]),c=Array(u[a]);for(n=o-1;-1!==n;--n)for(r in t=e[n])0!==t[r]&&(i[r]--,s[u[r]+i[r]]=n,c[u[r]+i[r]]=t[r]);return[u,s,c]},numeric.ccsFull=function(e){var t,n,r,o,i=e[0],a=e[1],u=e[2],s=numeric.ccsDim(e),c=s[0],l=s[1],f=numeric.rep([c,l],0);for(t=0;t<l;t++)for(r=i[t],o=i[t+1],n=r;n<o;++n)f[a[n]][t]=u[n];return f},numeric.ccsTSolve=function(e,t,n,r,o){function i(e){var t;if(0===n[e]){for(n[e]=1,t=h[e];t<h[e+1];++t)i(d[t]);o[y]=e,++y}}var a,u,s,c,l,f,m,h=e[0],d=e[1],p=e[2],g=h.length-1,v=Math.max,y=0;for(void 0===r&&(n=numeric.rep([g],0)),void 0===r&&(r=numeric.linspace(0,n.length-1)),void 0===o&&(o=[]),a=r.length-1;-1!==a;--a)i(r[a]);for(o.length=y,a=o.length-1;-1!==a;--a)n[o[a]]=0;for(a=r.length-1;-1!==a;--a)u=r[a],n[u]=t[u];for(a=o.length-1;-1!==a;--a){for(u=o[a],s=h[u],c=v(h[u+1],s),l=s;l!==c;++l)if(d[l]===u){n[u]/=p[l];break}for(m=n[u],l=s;l!==c;++l)(f=d[l])!==u&&(n[f]-=m*p[l])}return n},numeric.ccsDFS=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS.prototype.dfs=function(e,t,n,r,o,i){var a,u,s,c=0,l=o.length,f=this.k,m=this.k1,h=this.j;if(0===r[e])for(r[e]=1,h[0]=e,f[0]=u=t[e],m[0]=s=t[e+1];;)if(u>=s){if(o[l]=h[c],0===c)return;++l,u=f[--c],s=m[c]}else 0===r[a=i[n[u]]]?(r[a]=1,f[c]=u,h[++c]=a,u=t[a],m[c]=s=t[a+1]):++u},numeric.ccsLPSolve=function(e,t,n,r,o,i,a){var u,s,c,l,f,m,h,d,p,g=e[0],v=e[1],y=e[2],A=(g.length,t[0]),x=t[1],w=t[2];for(s=A[o],c=A[o+1],r.length=0,u=s;u<c;++u)a.dfs(i[x[u]],g,v,n,r,i);for(u=r.length-1;-1!==u;--u)n[r[u]]=0;for(u=s;u!==c;++u)n[l=i[x[u]]]=w[u];for(u=r.length-1;-1!==u;--u){for(f=g[l=r[u]],m=g[l+1],h=f;h<m;++h)if(i[v[h]]===l){n[l]/=y[h];break}for(p=n[l],h=f;h<m;++h)(d=i[v[h]])!==l&&(n[d]-=p*y[h])}return n},numeric.ccsLUP1=function(e,t){var n,r,o,i,a,u,s,c=e[0].length-1,l=[numeric.rep([c+1],0),[],[]],f=[numeric.rep([c+1],0),[],[]],m=l[0],h=l[1],d=l[2],p=f[0],g=f[1],v=f[2],y=numeric.rep([c],0),A=numeric.rep([c],0),x=numeric.ccsLPSolve,w=(Math.max,Math.abs),b=numeric.linspace(0,c-1),C=numeric.linspace(0,c-1),T=new numeric.ccsDFS(c);for(void 0===t&&(t=1),n=0;n<c;++n){for(x(l,e,y,A,n,C,T),i=-1,a=-1,r=A.length-1;-1!==r;--r)(o=A[r])<=n||(u=w(y[o]))>i&&(a=o,i=u);for(w(y[n])<t*i&&(r=b[n],i=b[a],b[n]=i,C[i]=n,b[a]=r,C[r]=a,i=y[n],y[n]=y[a],y[a]=i),i=m[n],a=p[n],s=y[n],h[i]=b[n],d[i]=1,++i,r=A.length-1;-1!==r;--r)u=y[o=A[r]],A[r]=0,y[o]=0,o<=n?(g[a]=o,v[a]=u,++a):(h[i]=b[o],d[i]=u/s,++i);m[n+1]=i,p[n+1]=a}for(r=h.length-1;-1!==r;--r)h[r]=C[h[r]];return{L:l,U:f,P:b,Pinv:C}},numeric.ccsDFS0=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS0.prototype.dfs=function(e,t,n,r,o,i,a){var u,s,c,l=0,f=o.length,m=this.k,h=this.k1,d=this.j;if(0===r[e])for(r[e]=1,d[0]=e,m[0]=s=t[i[e]],h[0]=c=t[i[e]+1];;){if(isNaN(s))throw new Error("Ow!");if(s>=c){if(o[f]=i[d[l]],0===l)return;++f,s=m[--l],c=h[l]}else 0===r[u=n[s]]?(r[u]=1,m[l]=s,d[++l]=u,s=t[u=i[u]],h[l]=c=t[u+1]):++s}},numeric.ccsLPSolve0=function(e,t,n,r,o,i,a,u){var s,c,l,f,m,h,d,p,g,v=e[0],y=e[1],A=e[2],x=(v.length,t[0]),w=t[1],b=t[2];for(c=x[o],l=x[o+1],r.length=0,s=c;s<l;++s)u.dfs(w[s],v,y,n,r,i,a);for(s=r.length-1;-1!==s;--s)n[a[f=r[s]]]=0;for(s=c;s!==l;++s)n[f=w[s]]=b[s];for(s=r.length-1;-1!==s;--s){for(p=a[f=r[s]],m=v[f],h=v[f+1],d=m;d<h;++d)if(y[d]===p){n[p]/=A[d];break}for(g=n[p],d=m;d<h;++d)n[y[d]]-=g*A[d];n[p]=g}},numeric.ccsLUP0=function(e,t){var n,r,o,i,a,u,s,c=e[0].length-1,l=[numeric.rep([c+1],0),[],[]],f=[numeric.rep([c+1],0),[],[]],m=l[0],h=l[1],d=l[2],p=f[0],g=f[1],v=f[2],y=numeric.rep([c],0),A=numeric.rep([c],0),x=numeric.ccsLPSolve0,w=(Math.max,Math.abs),b=numeric.linspace(0,c-1),C=numeric.linspace(0,c-1),T=new numeric.ccsDFS0(c);for(void 0===t&&(t=1),n=0;n<c;++n){for(x(l,e,y,A,n,C,b,T),i=-1,a=-1,r=A.length-1;-1!==r;--r)(o=A[r])<=n||(u=w(y[b[o]]))>i&&(a=o,i=u);for(w(y[b[n]])<t*i&&(r=b[n],i=b[a],b[n]=i,C[i]=n,b[a]=r,C[r]=a),i=m[n],a=p[n],s=y[b[n]],h[i]=b[n],d[i]=1,++i,r=A.length-1;-1!==r;--r)u=y[b[o=A[r]]],A[r]=0,y[b[o]]=0,o<=n?(g[a]=o,v[a]=u,++a):(h[i]=b[o],d[i]=u/s,++i);m[n+1]=i,p[n+1]=a}for(r=h.length-1;-1!==r;--r)h[r]=C[h[r]];return{L:l,U:f,P:b,Pinv:C}},numeric.ccsLUP=numeric.ccsLUP0,numeric.ccsDim=function(e){return[numeric.sup(e[1])+1,e[0].length-1]},numeric.ccsGetBlock=function(e,t,n){var r=numeric.ccsDim(e),o=r[0],i=r[1];void 0===t?t=numeric.linspace(0,o-1):"number"==typeof t&&(t=[t]),void 0===n?n=numeric.linspace(0,i-1):"number"==typeof n&&(n=[n]);var a,u,s,c,l=t.length,f=n.length,m=numeric.rep([i],0),h=[],d=[],p=[m,h,d],g=e[0],v=e[1],y=e[2],A=numeric.rep([o],0),x=0,w=numeric.rep([o],0);for(u=0;u<f;++u){var b=g[c=n[u]],C=g[c+1];for(a=b;a<C;++a)w[s=v[a]]=1,A[s]=y[a];for(a=0;a<l;++a)w[t[a]]&&(h[x]=a,d[x]=A[t[a]],++x);for(a=b;a<C;++a)w[s=v[a]]=0;m[u+1]=x}return p},numeric.ccsDot=function(e,t){var n,r,o,i,a,u,s,c,l,f,m,h=e[0],d=e[1],p=e[2],g=t[0],v=t[1],y=t[2],A=numeric.ccsDim(e),x=numeric.ccsDim(t),w=A[0],b=(A[1],x[1]),C=numeric.rep([w],0),T=numeric.rep([w],0),_=Array(w),S=numeric.rep([b],0),I=[],O=[],k=[S,I,O];for(o=0;o!==b;++o){for(i=g[o],a=g[o+1],l=0,r=i;r<a;++r)for(f=v[r],m=y[r],u=h[f],s=h[f+1],n=u;n<s;++n)0===T[c=d[n]]&&(_[l]=c,T[c]=1,l+=1),C[c]=C[c]+p[n]*m;for(a=(i=S[o])+l,S[o+1]=a,r=l-1;-1!==r;--r)m=i+r,n=_[r],I[m]=n,O[m]=C[n],T[n]=0,C[n]=0;S[o+1]=S[o]+l}return k},numeric.ccsLUPSolve=function(e,t){var n=e.L,r=e.U,o=(e.P,t[0]),i=!1;"object"!=typeof o&&(o=(t=[[0,t.length],numeric.linspace(0,t.length-1),t])[0],i=!0);var a,u,s,c,l,f,m=t[1],h=t[2],d=n[0].length-1,p=o.length-1,g=numeric.rep([d],0),v=Array(d),y=numeric.rep([d],0),A=Array(d),x=numeric.rep([p+1],0),w=[],b=[],C=numeric.ccsTSolve,T=0;for(a=0;a<p;++a){for(l=0,s=o[a],c=o[a+1],u=s;u<c;++u)f=e.Pinv[m[u]],A[l]=f,y[f]=h[u],++l;for(A.length=l,C(n,y,g,A,v),u=A.length-1;-1!==u;--u)y[A[u]]=0;if(C(r,g,y,v,A),i)return y;for(u=v.length-1;-1!==u;--u)g[v[u]]=0;for(u=A.length-1;-1!==u;--u)f=A[u],w[T]=f,b[T]=y[f],y[f]=0,++T;x[a+1]=T}return[x,w,b]},numeric.ccsbinop=function(e,t){return void 0===t&&(t=""),Function("X","Y","var Xi = X[0], Xj = X[1], Xv = X[2];\nvar Yi = Y[0], Yj = Y[1], Yv = Y[2];\nvar n = Xi.length-1,m = Math.max(numeric.sup(Xj),numeric.sup(Yj))+1;\nvar Zi = numeric.rep([n+1],0), Zj = [], Zv = [];\nvar x = numeric.rep([m],0),y = numeric.rep([m],0);\nvar xk,yk,zk;\nvar i,j,j0,j1,k,p=0;\n"+t+"for(i=0;i<n;++i) {\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Xj[j];\n x[k] = 1;\n Zj[p] = k;\n ++p;\n }\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Yj[j];\n y[k] = Yv[j];\n if(x[k] === 0) {\n Zj[p] = k;\n ++p;\n }\n }\n Zi[i+1] = p;\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = Xv[j];\n j0 = Zi[i]; j1 = Zi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Zj[j];\n xk = x[k];\n yk = y[k];\n"+e+"\n Zv[j] = zk;\n }\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = 0;\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) y[Yj[j]] = 0;\n}\nreturn [Zi,Zj,Zv];")},function(){var k,A,B,C;for(k in numeric.ops2)A=isFinite(eval("1"+numeric.ops2[k]+"0"))?"[Y[0],Y[1],numeric."+k+"(X,Y[2])]":"NaN",B=isFinite(eval("0"+numeric.ops2[k]+"1"))?"[X[0],X[1],numeric."+k+"(X[2],Y)]":"NaN",C=isFinite(eval("1"+numeric.ops2[k]+"0"))&&isFinite(eval("0"+numeric.ops2[k]+"1"))?"numeric.ccs"+k+"MM(X,Y)":"NaN",numeric["ccs"+k+"MM"]=numeric.ccsbinop("zk = xk "+numeric.ops2[k]+"yk;"),numeric["ccs"+k]=Function("X","Y",'if(typeof X === "number") return '+A+';\nif(typeof Y === "number") return '+B+";\nreturn "+C+";\n")}(),numeric.ccsScatter=function(e){var t,n=e[0],r=e[1],o=e[2],i=numeric.sup(r)+1,a=n.length,u=numeric.rep([i],0),s=Array(a),c=Array(a),l=numeric.rep([i],0);for(t=0;t<a;++t)l[r[t]]++;for(t=0;t<i;++t)u[t+1]=u[t]+l[t];var f,m,h=u.slice(0);for(t=0;t<a;++t)s[f=h[m=r[t]]]=n[t],c[f]=o[t],h[m]=h[m]+1;return[u,s,c]},numeric.ccsGather=function(e){var t,n,r,o,i,a=e[0],u=e[1],s=e[2],c=a.length-1,l=u.length,f=Array(l),m=Array(l),h=Array(l);for(i=0,t=0;t<c;++t)for(r=a[t],o=a[t+1],n=r;n!==o;++n)m[i]=t,f[i]=u[n],h[i]=s[n],++i;return[f,m,h]},numeric.sdim=function e(t,n,r){if(void 0===n&&(n=[]),"object"!=typeof t)return n;var o;for(o in void 0===r&&(r=0),r in n||(n[r]=0),t.length>n[r]&&(n[r]=t.length),t)t.hasOwnProperty(o)&&e(t[o],n,r+1);return n},numeric.sclone=function e(t,n,r){void 0===n&&(n=0),void 0===r&&(r=numeric.sdim(t).length);var o,i=Array(t.length);if(n===r-1){for(o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);return i}for(o in t)t.hasOwnProperty(o)&&(i[o]=e(t[o],n+1,r));return i},numeric.sdiag=function(e){var t,n,r=e.length,o=Array(r);for(t=r-1;t>=1;t-=2)n=t-1,o[t]=[],o[t][t]=e[t],o[n]=[],o[n][n]=e[n];return 0===t&&(o[0]=[],o[0][0]=e[t]),o},numeric.sidentity=function(e){return numeric.sdiag(numeric.rep([e],1))},numeric.stranspose=function(e){var t,n,r,o=[];for(t in e.length,e)if(e.hasOwnProperty(t))for(n in r=e[t])r.hasOwnProperty(n)&&("object"!=typeof o[n]&&(o[n]=[]),o[n][t]=r[n]);return o},numeric.sLUP=function(e,t){throw new Error("The function numeric.sLUP had a bug in it and has been removed. Please use the new numeric.ccsLUP function instead.")},numeric.sdotMM=function(e,t){var n,r,o,i,a,u,s,c=e.length,l=(t.length,numeric.stranspose(t)),f=l.length,m=Array(c);for(o=c-1;o>=0;o--){for(s=[],n=e[o],a=f-1;a>=0;a--){for(i in u=0,r=l[a],n)n.hasOwnProperty(i)&&i in r&&(u+=n[i]*r[i]);u&&(s[a]=u)}m[o]=s}return m},numeric.sdotMV=function(e,t){var n,r,o,i,a=e.length,u=Array(a);for(r=a-1;r>=0;r--){for(o in i=0,n=e[r])n.hasOwnProperty(o)&&t[o]&&(i+=n[o]*t[o]);i&&(u[r]=i)}return u},numeric.sdotVM=function(e,t){var n,r,o,i,a=[];for(n in e)if(e.hasOwnProperty(n))for(r in o=t[n],i=e[n],o)o.hasOwnProperty(r)&&(a[r]||(a[r]=0),a[r]+=i*o[r]);return a},numeric.sdotVV=function(e,t){var n,r=0;for(n in e)e[n]&&t[n]&&(r+=e[n]*t[n]);return r},numeric.sdot=function(e,t){var n=numeric.sdim(e).length,r=numeric.sdim(t).length;switch(1e3*n+r){case 0:return e*t;case 1001:return numeric.sdotVV(e,t);case 2001:return numeric.sdotMV(e,t);case 1002:return numeric.sdotVM(e,t);case 2002:return numeric.sdotMM(e,t);default:throw new Error("numeric.sdot not implemented for tensors of order "+n+" and "+r)}},numeric.sscatter=function(e){var t,n,r,o,i=e[0].length,a=e.length,u=[];for(n=i-1;n>=0;--n)if(e[a-1][n]){for(o=u,r=0;r<a-2;r++)o[t=e[r][n]]||(o[t]=[]),o=o[t];o[e[r][n]]=e[r+1][n]}return u},numeric.sgather=function e(t,n,r){var o,i,a;for(i in void 0===n&&(n=[]),void 0===r&&(r=[]),o=r.length,t)if(t.hasOwnProperty(i))if(r[o]=parseInt(i),"number"==typeof(a=t[i])){if(a){if(0===n.length)for(i=o+1;i>=0;--i)n[i]=[];for(i=o;i>=0;--i)n[i].push(r[i]);n[o+1].push(a)}}else e(a,n,r);return r.length>o&&r.pop(),n},numeric.cLU=function(e){var t,n,r,o,i,a,u=e[0],s=e[1],c=e[2],l=u.length,f=0;for(t=0;t<l;t++)u[t]>f&&(f=u[t]);f++;var m,h=Array(f),d=Array(f),p=numeric.rep([f],1/0),g=numeric.rep([f],-1/0);for(r=0;r<l;r++)t=u[r],(n=s[r])<p[t]&&(p[t]=n),n>g[t]&&(g[t]=n);for(t=0;t<f-1;t++)g[t]>g[t+1]&&(g[t+1]=g[t]);for(t=f-1;t>=1;t--)p[t]<p[t-1]&&(p[t-1]=p[t]);for(t=0;t<f;t++)d[t]=numeric.rep([g[t]-p[t]+1],0),h[t]=numeric.rep([t-p[t]],0),p[t],g[t];for(r=0;r<l;r++)d[t=u[r]][s[r]-p[t]]=c[r];for(t=0;t<f-1;t++)for(o=t-p[t],A=d[t],n=t+1;p[n]<=t&&n<f;n++)if(i=t-p[n],a=g[t]-t,m=(x=d[n])[i]/A[o]){for(r=1;r<=a;r++)x[r+i]-=m*A[r+o];h[n][t-p[n]]=m}var v,y,A=[],x=[],w=[],b=[],C=[],T=[];for(l=0,v=0,t=0;t<f;t++){for(o=p[t],i=g[t],y=d[t],n=t;n<=i;n++)y[n-o]&&(A[l]=t,x[l]=n,w[l]=y[n-o],l++);for(y=h[t],n=o;n<t;n++)y[n-o]&&(b[v]=t,C[v]=n,T[v]=y[n-o],v++);b[v]=t,C[v]=t,T[v]=1,v++}return{U:[A,x,w],L:[b,C,T]}},numeric.cLUsolve=function(e,t){var n,r,o=e.L,i=e.U,a=numeric.clone(t),u=o[0],s=o[1],c=o[2],l=i[0],f=i[1],m=i[2],h=l.length,d=(u.length,a.length);for(r=0,n=0;n<d;n++){for(;s[r]<n;)a[n]-=c[r]*a[s[r]],r++;r++}for(r=h-1,n=d-1;n>=0;n--){for(;f[r]>n;)a[n]-=m[r]*a[f[r]],r--;a[n]/=m[r],r--}return a},numeric.cgrid=function(e,t){"number"==typeof e&&(e=[e,e]);var n,r,o,i=numeric.rep(e,-1);for("function"!=typeof t&&(t="L"===t?function(t,n){return t>=e[0]/2||n<e[1]/2}:function(e,t){return!0}),o=0,n=1;n<e[0]-1;n++)for(r=1;r<e[1]-1;r++)t(n,r)&&(i[n][r]=o,o++);return i},numeric.cdelsq=function(e){var t,n,r,o,i,a=[[-1,0],[0,-1],[0,1],[1,0]],u=numeric.dim(e),s=u[0],c=u[1],l=[],f=[],m=[];for(t=1;t<s-1;t++)for(n=1;n<c-1;n++)if(!(e[t][n]<0)){for(r=0;r<4;r++)o=t+a[r][0],i=n+a[r][1],e[o][i]<0||(l.push(e[t][n]),f.push(e[o][i]),m.push(-1));l.push(e[t][n]),f.push(e[t][n]),m.push(4)}return[l,f,m]},numeric.cdotMV=function(e,t){var n,r,o,i=e[0],a=e[1],u=e[2],s=i.length;for(o=0,r=0;r<s;r++)i[r]>o&&(o=i[r]);for(o++,n=numeric.rep([o],0),r=0;r<s;r++)n[i[r]]+=u[r]*t[a[r]];return n},numeric.Spline=function(e,t,n,r,o){this.x=e,this.yl=t,this.yr=n,this.kl=r,this.kr=o},numeric.Spline.prototype._at=function(e,t){var n,r,o,i=this.x,a=this.yl,u=this.yr,s=this.kl,c=this.kr,l=numeric.add,f=numeric.sub,m=numeric.mul;n=f(m(s[t],i[t+1]-i[t]),f(u[t+1],a[t])),r=l(m(c[t+1],i[t]-i[t+1]),f(u[t+1],a[t]));var h=(o=(e-i[t])/(i[t+1]-i[t]))*(1-o);return l(l(l(m(1-o,a[t]),m(o,u[t+1])),m(n,h*(1-o))),m(r,h*o))},numeric.Spline.prototype.at=function(e){if("number"==typeof e){var t,n,r,o=this.x,i=o.length,a=Math.floor;for(t=0,n=i-1;n-t>1;)o[r=a((t+n)/2)]<=e?t=r:n=r;return this._at(e,t)}i=e.length;var u,s=Array(i);for(u=i-1;-1!==u;--u)s[u]=this.at(e[u]);return s},numeric.Spline.prototype.diff=function(){var e,t,n,r=this.x,o=this.yl,i=this.yr,a=this.kl,u=this.kr,s=o.length,c=a,l=u,f=Array(s),m=Array(s),h=numeric.add,d=numeric.mul,p=numeric.div,g=numeric.sub;for(e=s-1;-1!==e;--e)t=r[e+1]-r[e],n=g(i[e+1],o[e]),f[e]=p(h(d(n,6),d(a[e],-4*t),d(u[e+1],-2*t)),t*t),m[e+1]=p(h(d(n,-6),d(a[e],2*t),d(u[e+1],4*t)),t*t);return new numeric.Spline(r,c,l,f,m)},numeric.Spline.prototype.roots=function(){var e=[],t=this.x,n=this.yl,r=this.yr,o=this.kl,i=this.kr;"number"==typeof n[0]&&(n=[n],r=[r],o=[o],i=[i]);var a,u,s,c,l,f,m,h,d,p,g,v,y,A,x,w,b,C,T,_,S,I,O,k,E=n.length,M=t.length-1,B=(e=Array(E),Math.sqrt);for(a=0;a!==E;++a){for(c=n[a],l=r[a],f=o[a],m=i[a],h=[],u=0;u!==M;u++){for(u>0&&l[u]*c[u]<0&&h.push(t[u]),w=t[u+1]-t[u],t[u],g=c[u],v=l[u+1],d=f[u]/w,y=(p=m[u+1]/w)+3*g+2*d-3*v,A=3*(p+d+2*(g-v)),(x=(k=d-p+3*(g-v))*k+12*p*g)<=0?b=(C=y/A)>t[u]&&C<t[u+1]?[t[u],C,t[u+1]]:[t[u],t[u+1]]:(C=(y-B(x))/A,T=(y+B(x))/A,b=[t[u]],C>t[u]&&C<t[u+1]&&b.push(C),T>t[u]&&T<t[u+1]&&b.push(T),b.push(t[u+1])),S=b[0],C=this._at(S,u),s=0;s<b.length-1;s++)if(I=b[s+1],T=this._at(I,u),0!==C)if(0===T||C*T>0)S=I,C=T;else{for(var R=0;!((O=(C*I-T*S)/(C-T))<=S||O>=I);)if((_=this._at(O,u))*T>0)I=O,T=_,-1===R&&(C*=.5),R=-1;else{if(!(_*C>0))break;S=O,C=_,1===R&&(T*=.5),R=1}h.push(O),S=b[s+1],C=this._at(S,u)}else h.push(S),S=I,C=T;0===T&&h.push(I)}e[a]=h}return"number"==typeof this.yl[0]?e[0]:e},numeric.spline=function(e,t,n,r){var o,i=e.length,a=[],u=[],s=[],c=numeric.sub,l=numeric.mul,f=numeric.add;for(o=i-2;o>=0;o--)u[o]=e[o+1]-e[o],s[o]=c(t[o+1],t[o]);"string"!=typeof n&&"string"!=typeof r||(n=r="periodic");var m=[[],[],[]];switch(typeof n){case"undefined":a[0]=l(3/(u[0]*u[0]),s[0]),m[0].push(0,0),m[1].push(0,1),m[2].push(2/u[0],1/u[0]);break;case"string":a[0]=f(l(3/(u[i-2]*u[i-2]),s[i-2]),l(3/(u[0]*u[0]),s[0])),m[0].push(0,0,0),m[1].push(i-2,0,1),m[2].push(1/u[i-2],2/u[i-2]+2/u[0],1/u[0]);break;default:a[0]=n,m[0].push(0),m[1].push(0),m[2].push(1)}for(o=1;o<i-1;o++)a[o]=f(l(3/(u[o-1]*u[o-1]),s[o-1]),l(3/(u[o]*u[o]),s[o])),m[0].push(o,o,o),m[1].push(o-1,o,o+1),m[2].push(1/u[o-1],2/u[o-1]+2/u[o],1/u[o]);switch(typeof r){case"undefined":a[i-1]=l(3/(u[i-2]*u[i-2]),s[i-2]),m[0].push(i-1,i-1),m[1].push(i-2,i-1),m[2].push(1/u[i-2],2/u[i-2]);break;case"string":m[1][m[1].length-1]=0;break;default:a[i-1]=r,m[0].push(i-1),m[1].push(i-1),m[2].push(1)}a="number"!=typeof a[0]?numeric.transpose(a):[a];var h=Array(a.length);if("string"==typeof n)for(o=h.length-1;-1!==o;--o)h[o]=numeric.ccsLUPSolve(numeric.ccsLUP(numeric.ccsScatter(m)),a[o]),h[o][i-1]=h[o][0];else for(o=h.length-1;-1!==o;--o)h[o]=numeric.cLUsolve(numeric.cLU(m),a[o]);return h="number"==typeof t[0]?h[0]:numeric.transpose(h),new numeric.Spline(e,t,t,h,h)},numeric.fftpow2=function e(t,n){var r=t.length;if(1!==r){var o,i,a=Math.cos,u=Math.sin,s=Array(r/2),c=Array(r/2),l=Array(r/2),f=Array(r/2);for(i=r/2,o=r-1;-1!==o;--o)l[--i]=t[o],f[i]=n[o],--o,s[i]=t[o],c[i]=n[o];e(s,c),e(l,f),i=r/2;var m,h,d,p=-6.283185307179586/r;for(o=r-1;-1!==o;--o)-1==--i&&(i=r/2-1),h=a(m=p*o),d=u(m),t[o]=s[i]+h*l[i]-d*f[i],n[o]=c[i]+h*f[i]+d*l[i]}},numeric._ifftpow2=function e(t,n){var r=t.length;if(1!==r){var o,i,a=Math.cos,u=Math.sin,s=Array(r/2),c=Array(r/2),l=Array(r/2),f=Array(r/2);for(i=r/2,o=r-1;-1!==o;--o)l[--i]=t[o],f[i]=n[o],--o,s[i]=t[o],c[i]=n[o];e(s,c),e(l,f),i=r/2;var m,h,d,p=6.283185307179586/r;for(o=r-1;-1!==o;--o)-1==--i&&(i=r/2-1),h=a(m=p*o),d=u(m),t[o]=s[i]+h*l[i]-d*f[i],n[o]=c[i]+h*f[i]+d*l[i]}},numeric.ifftpow2=function(e,t){numeric._ifftpow2(e,t),numeric.diveq(e,e.length),numeric.diveq(t,t.length)},numeric.convpow2=function(e,t,n,r){var o,i,a,u,s;for(numeric.fftpow2(e,t),numeric.fftpow2(n,r),o=e.length-1;-1!==o;--o)i=e[o],u=t[o],a=n[o],s=r[o],e[o]=i*a-u*s,t[o]=i*s+u*a;numeric.ifftpow2(e,t)},numeric.T.prototype.fft=function(){var e,t,n=this.x,r=this.y,o=n.length,i=Math.log,a=i(2),u=Math.ceil(i(2*o-1)/a),s=Math.pow(2,u),c=numeric.rep([s],0),l=numeric.rep([s],0),f=Math.cos,m=Math.sin,h=-3.141592653589793/o,d=numeric.rep([s],0),p=numeric.rep([s],0);for(Math.floor(o/2),e=0;e<o;e++)d[e]=n[e];if(void 0!==r)for(e=0;e<o;e++)p[e]=r[e];for(c[0]=1,e=1;e<=s/2;e++)t=h*e*e,c[e]=f(t),l[e]=m(t),c[s-e]=f(t),l[s-e]=m(t);var g=new numeric.T(d,p),v=new numeric.T(c,l);return g=g.mul(v),numeric.convpow2(g.x,g.y,numeric.clone(v.x),numeric.neg(v.y)),(g=g.mul(v)).x.length=o,g.y.length=o,g},numeric.T.prototype.ifft=function(){var e,t,n=this.x,r=this.y,o=n.length,i=Math.log,a=i(2),u=Math.ceil(i(2*o-1)/a),s=Math.pow(2,u),c=numeric.rep([s],0),l=numeric.rep([s],0),f=Math.cos,m=Math.sin,h=3.141592653589793/o,d=numeric.rep([s],0),p=numeric.rep([s],0);for(Math.floor(o/2),e=0;e<o;e++)d[e]=n[e];if(void 0!==r)for(e=0;e<o;e++)p[e]=r[e];for(c[0]=1,e=1;e<=s/2;e++)t=h*e*e,c[e]=f(t),l[e]=m(t),c[s-e]=f(t),l[s-e]=m(t);var g=new numeric.T(d,p),v=new numeric.T(c,l);return g=g.mul(v),numeric.convpow2(g.x,g.y,numeric.clone(v.x),numeric.neg(v.y)),(g=g.mul(v)).x.length=o,g.y.length=o,g.div(o)},numeric.gradient=function(e,t){var n=t.length,r=e(t);if(isNaN(r))throw new Error("gradient: f(x) is a NaN!");var o,i,a,u,s,c,l,f,m,h=Math.max,d=numeric.clone(t),p=Array(n),g=(numeric.div,numeric.sub,h=Math.max,Math.abs),v=Math.min,y=0;for(o=0;o<n;o++)for(var A=h(1e-6*r,1e-8);;){if(++y>20)throw new Error("Numerical gradient fails");if(d[o]=t[o]+A,i=e(d),d[o]=t[o]-A,a=e(d),d[o]=t[o],isNaN(i)||isNaN(a))A/=16;else{if(p[o]=(i-a)/(2*A),u=t[o]-A,s=t[o],c=t[o]+A,l=(i-r)/A,f=(r-a)/A,m=h(g(p[o]),g(r),g(i),g(a),g(u),g(s),g(c),1e-8),!(v(h(g(l-p[o]),g(f-p[o]),g(l-f))/m,A/m)>.001))break;A/=16}}return p},numeric.uncmin=function(e,t,n,r,o,i,a){var u=numeric.gradient;void 0===a&&(a={}),void 0===n&&(n=1e-8),void 0===r&&(r=function(t){return u(e,t)}),void 0===o&&(o=1e3);var s,c,l=(t=numeric.clone(t)).length,f=e(t);if(isNaN(f))throw new Error("uncmin: f(x0) is a NaN!");var m=Math.max,h=numeric.norm2;n=m(n,numeric.epsilon);var d,p,g,v,y,A,x,w,b,C,T=a.Hinv||numeric.identity(l),_=numeric.dot,S=(numeric.inv,numeric.sub),I=numeric.add,O=numeric.tensor,k=numeric.div,E=numeric.mul,M=numeric.all,B=numeric.isFinite,R=numeric.neg,N=0,L="";for(p=r(t);N<o;){if("function"==typeof i&&i(N,t,f,p,T)){L="Callback returned true";break}if(!M(B(p))){L="Gradient has Infinity or NaN";break}if(!M(B(d=R(_(T,p))))){L="Search direction has Infinity or NaN";break}if((C=h(d))<n){L="Newton step smaller than tol";break}for(b=1,c=_(p,d),y=t;N<o&&!(b*C<n)&&(y=I(t,v=E(d,b)),(s=e(y))-f>=.1*b*c||isNaN(s));)b*=.5,++N;if(b*C<n){L="Line search step size smaller than tol";break}if(N===o){L="maxit reached during line search";break}w=_(A=S(g=r(y),p),v),x=_(T,A),T=S(I(T,E((w+_(A,x))/(w*w),O(v,v))),k(I(O(x,v),O(v,x)),w)),t=y,f=s,p=g,++N}return{solution:t,f,gradient:p,invHessian:T,iterations:N,message:L}},numeric.Dopri=function(e,t,n,r,o,i,a){this.x=e,this.y=t,this.f=n,this.ymid=r,this.iterations=o,this.events=a,this.message=i},numeric.Dopri.prototype._at=function(e,t){function n(e){return e*e}var r,o,i,a,u,s,c,l,f,m=this,h=m.x,d=m.y,p=m.f,g=m.ymid,v=(h.length,Math.floor,numeric.add),y=numeric.mul,A=numeric.sub;return r=h[t],o=h[t+1],a=d[t],u=d[t+1],i=r+.5*(o-r),s=g[t],c=A(p[t],y(a,1/(r-i)+2/(r-o))),l=A(p[t+1],y(u,1/(o-i)+2/(o-r))),v(v(v(v(y(a,(f=[n(e-o)*(e-i)/n(r-o)/(r-i),n(e-r)*n(e-o)/n(r-i)/n(o-i),n(e-r)*(e-i)/n(o-r)/(o-i),(e-r)*n(e-o)*(e-i)/n(r-o)/(r-i),(e-o)*n(e-r)*(e-i)/n(r-o)/(o-i)])[0]),y(s,f[1])),y(u,f[2])),y(c,f[3])),y(l,f[4]))},numeric.Dopri.prototype.at=function(e){var t,n,r,o=Math.floor;if("number"!=typeof e){var i=e.length,a=Array(i);for(t=i-1;-1!==t;--t)a[t]=this.at(e[t]);return a}var u=this.x;for(t=0,n=u.length-1;n-t>1;)u[r=o(.5*(t+n))]<=e?t=r:n=r;return this._at(e,t)},numeric.dopri=function(e,t,n,r,o,i,a){void 0===o&&(o=1e-6),void 0===i&&(i=1e3);var u,s,c,l,f,m,h,d,p,g,v,y,A,x=[e],w=[n],b=[r(e,n)],C=[],T=[.075,.225],_=[44/45,-56/15,32/9],S=[19372/6561,-25360/2187,64448/6561,-212/729],I=[9017/3168,-355/33,46732/5247,49/176,-5103/18656],O=[35/384,0,500/1113,125/192,-2187/6784,11/84],k=[.10013431883002395,0,.3918321794184259,-.02982460176594817,.05893268337240795,-.04497888809104361,.023904308236133973],E=[.2,.3,.8,8/9,1,1],M=[-71/57600,0,71/16695,-71/1920,17253/339200,-22/525,.025],B=0,R=(t-e)/10,N=0,L=numeric.add,P=numeric.mul,j=(Math.max,Math.min),q=Math.abs,F=numeric.norminf,D=Math.pow,V=numeric.any,Y=numeric.lt,U=numeric.and,G=(numeric.sub,new numeric.Dopri(x,w,b,C,-1,""));for("function"==typeof a&&(v=a(e,n));e<t&&N<i;)if(++N,e+R>t&&(R=t-e),u=r(e+E[0]*R,L(n,P(.2*R,b[B]))),s=r(e+E[1]*R,L(L(n,P(T[0]*R,b[B])),P(T[1]*R,u))),c=r(e+E[2]*R,L(L(L(n,P(_[0]*R,b[B])),P(_[1]*R,u)),P(_[2]*R,s))),l=r(e+E[3]*R,L(L(L(L(n,P(S[0]*R,b[B])),P(S[1]*R,u)),P(S[2]*R,s)),P(S[3]*R,c))),f=r(e+E[4]*R,L(L(L(L(L(n,P(I[0]*R,b[B])),P(I[1]*R,u)),P(I[2]*R,s)),P(I[3]*R,c)),P(I[4]*R,l))),m=r(e+R,p=L(L(L(L(L(n,P(b[B],R*O[0])),P(s,R*O[2])),P(c,R*O[3])),P(l,R*O[4])),P(f,R*O[5]))),(g="number"==typeof(h=L(L(L(L(L(P(b[B],R*M[0]),P(s,R*M[2])),P(c,R*M[3])),P(l,R*M[4])),P(f,R*M[5])),P(m,R*M[6])))?q(h):F(h))>o){if(e+(R=.2*R*D(o/g,.25))===e){G.msg="Step size became too small";break}}else{if(C[B]=L(L(L(L(L(L(n,P(b[B],R*k[0])),P(s,R*k[2])),P(c,R*k[3])),P(l,R*k[4])),P(f,R*k[5])),P(m,R*k[6])),x[++B]=e+R,w[B]=p,b[B]=m,"function"==typeof a){var X,W,H=e,z=e+.5*R;if(y=a(z,C[B-1]),V(A=U(Y(v,0),Y(0,y)))||(H=z,v=y,y=a(z=e+R,p),A=U(Y(v,0),Y(0,y))),V(A)){for(var $,K,Q=0,Z=1,J=1;;){if("number"==typeof v)W=(J*y*H-Z*v*z)/(J*y-Z*v);else for(W=z,d=v.length-1;-1!==d;--d)v[d]<0&&y[d]>0&&(W=j(W,(J*y[d]*H-Z*v[d]*z)/(J*y[d]-Z*v[d])));if(W<=H||W>=z)break;K=a(W,X=G._at(W,B-1)),V($=U(Y(v,0),Y(0,K)))?(z=W,y=K,A=$,J=1,-1===Q?Z*=.5:Z=1,Q=-1):(H=W,v=K,Z=1,1===Q?J*=.5:J=1,Q=1)}return p=G._at(.5*(e+W),B-1),G.f[B]=r(W,X),G.x[B]=W,G.y[B]=X,G.ymid[B-1]=p,G.events=A,G.iterations=N,G}}e+=R,n=p,v=y,R=j(.8*R*D(o/g,.25),4*R)}return G.iterations=N,G},numeric.LU=function(e,t){t=t||!1;var n,r,o,i,a,u,s,c,l,f=Math.abs,m=e.length,h=m-1,d=new Array(m);for(t||(e=numeric.clone(e)),o=0;o<m;++o){for(s=o,l=f((u=e[o])[o]),r=o+1;r<m;++r)l<(i=f(e[r][o]))&&(l=i,s=r);for(d[o]=s,s!=o&&(e[o]=e[s],e[s]=u,u=e[o]),a=u[o],n=o+1;n<m;++n)e[n][o]/=a;for(n=o+1;n<m;++n){for(c=e[n],r=o+1;r<h;++r)c[r]-=c[o]*u[r],c[++r]-=c[o]*u[r];r===h&&(c[r]-=c[o]*u[r])}}return{LU:e,P:d}},numeric.LUsolve=function(e,t){var n,r,o,i,a,u=e.LU,s=u.length,c=numeric.clone(t),l=e.P;for(n=s-1;-1!==n;--n)c[n]=t[n];for(n=0;n<s;++n)for(o=l[n],l[n]!==n&&(a=c[n],c[n]=c[o],c[o]=a),i=u[n],r=0;r<n;++r)c[n]-=c[r]*i[r];for(n=s-1;n>=0;--n){for(i=u[n],r=n+1;r<s;++r)c[n]-=c[r]*i[r];c[n]/=i[n]}return c},numeric.solve=function(e,t,n){return numeric.LUsolve(numeric.LU(e,n),t)},numeric.echelonize=function(e){var t,n,r,o,i,a,u,s,c=numeric.dim(e),l=c[0],f=c[1],m=numeric.identity(l),h=Array(l),d=Math.abs,p=numeric.diveq;for(e=numeric.clone(e),t=0;t<l;++t){for(r=0,i=e[t],a=m[t],n=1;n<f;++n)d(i[r])<d(i[n])&&(r=n);for(h[t]=r,p(a,i[r]),p(i,i[r]),n=0;n<l;++n)if(n!==t){for(s=(u=e[n])[r],o=f-1;-1!==o;--o)u[o]-=i[o]*s;for(u=m[n],o=l-1;-1!==o;--o)u[o]-=a[o]*s}}return{I:m,A:e,P:h}},numeric.__solveLP=function(e,t,n,r,o,i,a){var u,s,c,l,f=numeric.sum,m=(numeric.log,numeric.mul),h=numeric.sub,d=numeric.dot,p=numeric.div,g=numeric.add,v=e.length,y=n.length,A=!1,x=1,w=(numeric.transpose(t),numeric.svd,numeric.transpose),b=(numeric.leq,Math.sqrt),C=Math.abs,T=(numeric.muleq,numeric.norminf,numeric.any,Math.min),_=numeric.all,S=numeric.gt,I=Array(v),O=Array(y),k=(numeric.rep([y],1),numeric.solve),E=h(n,d(t,i)),M=d(e,e);for(c=0;c<o;++c){var B,R;for(B=y-1;-1!==B;--B)O[B]=p(t[B],E[B]);var N=w(O);for(B=v-1;-1!==B;--B)I[B]=f(N[B]);x=.25*C(M/d(e,I));var L=100*b(M/d(I,I));for((!isFinite(x)||x>L)&&(x=L),l=g(e,m(x,I)),s=d(N,O),B=v-1;-1!==B;--B)s[B][B]+=1;R=k(s,p(l,x),!0);var P=p(E,d(t,R)),j=1;for(B=y-1;-1!==B;--B)P[B]<0&&(j=T(j,-.999*P[B]));if(u=h(i,m(R,j)),!_(S(E=h(n,d(t,u)),0)))return{solution:i,message:"",iterations:c};if(i=u,x<r)return{solution:u,message:"",iterations:c};if(a){var q=d(e,l),F=d(t,l);for(A=!0,B=y-1;-1!==B;--B)if(q*F[B]<0){A=!1;break}}else A=!(i[v-1]>=0);if(A)return{solution:u,message:"Unbounded",iterations:c}}return{solution:i,message:"maximum iteration count exceeded",iterations:c}},numeric._solveLP=function(e,t,n,r,o){var i=e.length,a=n.length,u=(numeric.sum,numeric.log,numeric.mul,numeric.sub),s=numeric.dot,c=(numeric.div,numeric.add,numeric.rep([i],0).concat([1])),l=numeric.rep([a,1],-1),f=numeric.blockMatrix([[t,l]]),m=n,h=numeric.rep([i],0).concat(Math.max(0,numeric.sup(numeric.neg(n)))+1),d=numeric.__solveLP(c,f,m,r,o,h,!1),p=numeric.clone(d.solution);if(p.length=i,numeric.inf(u(n,s(t,p)))<0)return{solution:NaN,message:"Infeasible",iterations:d.iterations};var g=numeric.__solveLP(e,t,n,r,o-d.iterations,p,!0);return g.iterations+=d.iterations,g},numeric.solveLP=function(e,t,n,r,o,i,a){if(void 0===a&&(a=1e3),void 0===i&&(i=numeric.epsilon),void 0===r)return numeric._solveLP(e,t,n,i,a);var u,s=r.length,c=r[0].length,l=t.length,f=numeric.echelonize(r),m=numeric.rep([c],0),h=f.P,d=[];for(u=h.length-1;-1!==u;--u)m[h[u]]=1;for(u=c-1;-1!==u;--u)0===m[u]&&d.push(u);var p=numeric.getRange,g=numeric.linspace(0,s-1),v=numeric.linspace(0,l-1),y=p(r,g,d),A=p(t,v,h),x=p(t,v,d),w=numeric.dot,b=numeric.sub,C=w(A,f.I),T=b(x,w(C,y)),_=b(n,w(C,o)),S=Array(h.length),I=Array(d.length);for(u=h.length-1;-1!==u;--u)S[u]=e[h[u]];for(u=d.length-1;-1!==u;--u)I[u]=e[d[u]];var O=b(I,w(S,w(f.I,y))),k=numeric._solveLP(O,T,_,i,a),E=k.solution;if(E!=E)return k;var M=w(f.I,b(o,w(y,E))),B=Array(e.length);for(u=h.length-1;-1!==u;--u)B[h[u]]=M[u];for(u=d.length-1;-1!==u;--u)B[d[u]]=E[u];return{solution:B,message:k.message,iterations:k.iterations}},numeric.MPStoLP=function(e){function t(t){throw new Error("MPStoLP: "+t+"\nLine "+n+": "+e[n]+"\nCurrent state: "+u[a]+"\n")}e instanceof String&&e.split("\n");var n,r,o,i,a=0,u=["Initial state","NAME","ROWS","COLUMNS","RHS","BOUNDS","ENDATA"],s=e.length,c=0,l={},f=[],m=0,h={},d=0,p=[],g=[],v=[];for(n=0;n<s;++n){var y=(o=e[n]).match(/\S*/g),A=[];for(r=0;r<y.length;++r)""!==y[r]&&A.push(y[r]);if(0!==A.length){for(r=0;r<u.length&&o.substr(0,u[r].length)!==u[r];++r);if(r<u.length){if(a=r,1===r&&(i=A[1]),6===r)return{name:i,c:p,A:numeric.transpose(g),b:v,rows:l,vars:h}}else switch(a){case 0:case 1:t("Unexpected line");case 2:switch(A[0]){case"N":0===c?c=A[1]:t("Two or more N rows");break;case"L":l[A[1]]=m,f[m]=1,v[m]=0,++m;break;case"G":l[A[1]]=m,f[m]=-1,v[m]=0,++m;break;case"E":l[A[1]]=m,f[m]=0,v[m]=0,++m;break;default:t("Parse error "+numeric.prettyPrint(A))}break;case 3:h.hasOwnProperty(A[0])||(h[A[0]]=d,p[d]=0,g[d]=numeric.rep([m],0),++d);var x=h[A[0]];for(r=1;r<A.length;r+=2)if(A[r]!==c){var w=l[A[r]];g[x][w]=(f[w]<0?-1:1)*parseFloat(A[r+1])}else p[x]=parseFloat(A[r+1]);break;case 4:for(r=1;r<A.length;r+=2)v[l[A[r]]]=(f[l[A[r]]]<0?-1:1)*parseFloat(A[r+1]);break;case 5:break;case 6:t("Internal error")}}}t("Reached end of file without ENDATA")},numeric.seedrandom={pow:Math.pow,random:Math.random},function(e,t,n,r,o,i,a){function u(e){var t,r,o=this,i=e.length,a=0,u=o.i=o.j=o.m=0;for(o.S=[],o.c=[],i||(e=[i++]);a<n;)o.S[a]=a++;for(a=0;a<n;a++)u=l(u+(t=o.S[a])+e[a%i]),r=o.S[u],o.S[a]=r,o.S[u]=t;o.g=function(e){var t=o.S,r=l(o.i+1),i=t[r],a=l(o.j+i),u=t[a];t[r]=u,t[a]=i;for(var s=t[l(i+u)];--e;)r=l(r+1),u=t[a=l(a+(i=t[r]))],t[r]=u,t[a]=i,s=s*n+t[l(i+u)];return o.i=r,o.j=a,s},o.g(n)}function s(e,t,n,r,o){if(n=[],o=typeof e,t&&"object"==o)for(r in e)if(r.indexOf("S")<5)try{n.push(s(e[r],t-1))}catch(e){}return n.length?n:e+("string"!=o?"\0":"")}function c(e,t,n,r){for(e+="",n=0,r=0;r<e.length;r++)t[l(r)]=l((n^=19*t[l(r)])+e.charCodeAt(r));for(r in e="",t)e+=String.fromCharCode(t[r]);return e}function l(e){return e&n-1}t.seedrandom=function(r,l){var f,m=[];return r=c(s(l?[r,e]:arguments.length?r:[(new Date).getTime(),e,window],3),m),c((f=new u(m)).S,e),t.random=function(){for(var e=f.g(6),t=a,r=0;e<o;)e=(e+r)*n,t*=n,r=f.g(1);for(;e>=i;)e/=2,t/=2,r>>>=1;return(e+r)/t},r},a=t.pow(n,6),o=t.pow(2,o),i=2*o,c(t.random(),e)}([],numeric.seedrandom,256,0,52),function(e){function t(e){if("object"!=typeof e)return e;var n,r=[],o=e.length;for(n=0;n<o;n++)r[n+1]=t(e[n]);return r}function n(e){if("object"!=typeof e)return e;var t,r=[],o=e.length;for(t=1;t<o;t++)r[t-1]=n(e[t]);return r}e.solveQP=function(e,r,o,i,a,u){e=t(e),r=t(r),o=t(o);var s,c,l,f,m,h=[],d=[],p=[],g=[],v=[];if(a=a||0,u=u?t(u):[void 0,0],i=i?t(i):[],c=e.length-1,l=o[1].length-1,!i)for(s=1;s<=l;s+=1)i[s]=0;for(s=1;s<=l;s+=1)d[s]=0;for(f=Math.min(c,l),s=1;s<=c;s+=1)p[s]=0;for(h[1]=0,s=1;s<=2*c+f*(f+5)/2+2*l+1;s+=1)g[s]=0;for(s=1;s<=2;s+=1)v[s]=0;return function(e,t,n,r,o,i,a,u,s,c,l,f,m,h,d,p){function g(){for(h[1]=h[1]+1,C=E,w=1;w<=c;w+=1){for(C+=1,P=-u[w],b=1;b<=r;b+=1)P+=a[b][w]*o[b];if(Math.abs(P)<G&&(P=0),w>l)d[C]=P;else if(d[C]=-Math.abs(P),P>0){for(b=1;b<=r;b+=1)a[b][w]=-a[b][w];u[w]=-u[w]}}for(w=1;w<=m;w+=1)d[E+f[w]]=0;for(B=0,L=0,w=1;w<=c;w+=1)d[E+w]<L*d[N+w]&&(B=w,L=d[E+w]/d[N+w]);return 0===B?999:0}function v(){for(w=1;w<=r;w+=1){for(P=0,b=1;b<=r;b+=1)P+=e[b][w]*a[b][B];d[w]=P}for(T=I,w=1;w<=r;w+=1)d[T+w]=0;for(b=m+1;b<=r;b+=1)for(w=1;w<=r;w+=1)d[T+w]=d[T+w]+e[w][b]*d[b];for(Y=!0,w=m;w>=1;w-=1){for(P=d[w],T=(C=k+w*(w+3)/2)-w,b=w+1;b<=m;b+=1)P-=d[C]*d[O+b],C+=b;if(P/=d[T],d[O+w]=P,f[w]<l)break;if(P<0)break;Y=!1,S=w}if(!Y)for(j=d[M+S]/d[O+S],w=1;w<=m&&!(f[w]<l)&&!(d[O+w]<0);w+=1)(L=d[M+w]/d[O+w])<j&&(j=L,S=w);for(P=0,w=I+1;w<=I+r;w+=1)P+=d[w]*d[w];if(Math.abs(P)<=G){if(Y)return p[1]=1,999;for(w=1;w<=m;w+=1)d[M+w]=d[M+w]-j*d[O+w];return d[M+m+1]=d[M+m+1]+j,700}for(P=0,w=1;w<=r;w+=1)P+=d[I+w]*a[w][B];for(q=-d[E+B]/P,U=!0,Y||j<q&&(q=j,U=!1),w=1;w<=r;w+=1)o[w]=o[w]+q*d[I+w],Math.abs(o[w])<G&&(o[w]=0);for(i[1]=i[1]+q*P*(q/2+d[M+m+1]),w=1;w<=m;w+=1)d[M+w]=d[M+w]-q*d[O+w];if(d[M+m+1]=d[M+m+1]+q,!U){for(P=-u[B],b=1;b<=r;b+=1)P+=o[b]*a[b][B];if(B>l)d[E+B]=P;else if(d[E+B]=-Math.abs(P),P>0){for(b=1;b<=r;b+=1)a[b][B]=-a[b][B];u[B]=-u[B]}return 700}for(f[m+=1]=B,C=k+(m-1)*m/2+1,w=1;w<=m-1;w+=1)d[C]=d[w],C+=1;if(m===r)d[C]=d[r];else{for(w=r;w>=m+1&&0!==d[w]&&(F=Math.max(Math.abs(d[w-1]),Math.abs(d[w])),D=Math.min(Math.abs(d[w-1]),Math.abs(d[w])),L=d[w-1]>=0?Math.abs(F*Math.sqrt(1+D*D/(F*F))):-Math.abs(F*Math.sqrt(1+D*D/(F*F))),F=d[w-1]/L,D=d[w]/L,1!==F);w-=1)if(0===F)for(d[w-1]=D*L,b=1;b<=r;b+=1)L=e[b][w-1],e[b][w-1]=e[b][w],e[b][w]=L;else for(d[w-1]=L,V=D/(1+F),b=1;b<=r;b+=1)L=F*e[b][w-1]+D*e[b][w],e[b][w]=V*(e[b][w-1]+L)-e[b][w],e[b][w-1]=L;d[C]=d[m]}return 0}function y(){if(0===d[T=(C=k+S*(S+1)/2+1)+S])return 798;if(F=Math.max(Math.abs(d[T-1]),Math.abs(d[T])),D=Math.min(Math.abs(d[T-1]),Math.abs(d[T])),L=d[T-1]>=0?Math.abs(F*Math.sqrt(1+D*D/(F*F))):-Math.abs(F*Math.sqrt(1+D*D/(F*F))),F=d[T-1]/L,D=d[T]/L,1===F)return 798;if(0===F){for(w=S+1;w<=m;w+=1)L=d[T-1],d[T-1]=d[T],d[T]=L,T+=w;for(w=1;w<=r;w+=1)L=e[w][S],e[w][S]=e[w][S+1],e[w][S+1]=L}else{for(V=D/(1+F),w=S+1;w<=m;w+=1)L=F*d[T-1]+D*d[T],d[T]=V*(d[T-1]+L)-d[T],d[T-1]=L,T+=w;for(w=1;w<=r;w+=1)L=F*e[w][S]+D*e[w][S+1],e[w][S+1]=V*(e[w][S]+L)-e[w][S+1],e[w][S]=L}return 0}function A(){for(T=C-S,w=1;w<=S;w+=1)d[T]=d[C],C+=1,T+=1;return d[M+S]=d[M+S+1],f[S]=f[S+1],(S+=1)<m?797:0}function x(){return d[M+m]=d[M+m+1],d[M+m+1]=0,f[m]=0,m-=1,h[2]=h[2]+1,0}var w,b,C,T,_,S,I,O,k,E,M,B,R,N,L,P,j,q,F,D,V,Y,U,G,X,W,H;R=Math.min(r,c),C=2*r+R*(R+5)/2+2*c+1,G=1e-60;do{X=1+.1*(G+=G),W=1+.2*G}while(X<=1||W<=1);for(w=1;w<=r;w+=1)d[w]=t[w];for(w=r+1;w<=C;w+=1)d[w]=0;for(w=1;w<=c;w+=1)f[w]=0;if(_=[],0===p[1]){if(function(e,t,n,r){var o,i,a,u,s,c;for(i=1;i<=n;i+=1){if(r[1]=i,c=0,(a=i-1)<1){if((c=e[i][i]-c)<=0)break;e[i][i]=Math.sqrt(c)}else{for(u=1;u<=a;u+=1){for(s=e[u][i],o=1;o<u;o+=1)s-=e[o][i]*e[o][u];s/=e[u][u],e[u][i]=s,c+=s*s}if((c=e[i][i]-c)<=0)break;e[i][i]=Math.sqrt(c)}r[1]=0}}(e,0,r,_),0!==_[1])return void(p[1]=2);(function(e,t,n,r){var o,i,a,u;for(i=1;i<=n;i+=1){for(u=0,o=1;o<i;o+=1)u+=e[o][i]*r[o];r[i]=(r[i]-u)/e[i][i]}for(a=1;a<=n;a+=1)for(r[i=n+1-a]=r[i]/e[i][i],u=-r[i],o=1;o<i;o+=1)r[o]=r[o]+u*e[o][i]})(e,0,r,t),function(e,t,n){var r,o,i,a,u;for(i=1;i<=n;i+=1){for(e[i][i]=1/e[i][i],u=-e[i][i],r=1;r<i;r+=1)e[r][i]=u*e[r][i];if(n<(a=i+1))break;for(o=a;o<=n;o+=1)for(u=e[i][o],e[i][o]=0,r=1;r<=i;r+=1)e[r][o]=e[r][o]+u*e[r][i]}}(e,0,r)}else{for(b=1;b<=r;b+=1)for(o[b]=0,w=1;w<=b;w+=1)o[b]=o[b]+e[w][b]*t[w];for(b=1;b<=r;b+=1)for(t[b]=0,w=b;w<=r;w+=1)t[b]=t[b]+e[b][w]*o[w]}for(i[1]=0,b=1;b<=r;b+=1)for(o[b]=t[b],i[1]=i[1]+d[b]*o[b],d[b]=0,w=b+1;w<=r;w+=1)e[w][b]=0;for(i[1]=-i[1]/2,p[1]=0,N=(E=(k=(M=(O=(I=r)+r)+R)+R+1)+R*(R+1)/2)+c,w=1;w<=c;w+=1){for(P=0,b=1;b<=r;b+=1)P+=a[b][w]*a[b][w];d[N+w]=Math.sqrt(P)}for(m=0,h[1]=0,h[2]=0,H=0;;){if(999===(H=g()))return;for(;0!==(H=v());){if(999===H)return;if(700===H)if(S===m)x();else{for(;y(),797===(H=A()););x()}}}}(e,r,0,c,p,h,o,i,0,l,a,d,0,v,g,u),m="",1===u[1]&&(m="constraints are inconsistent, no solution!"),2===u[1]&&(m="matrix D in quadratic function is not positive definite!"),{solution:n(p),value:n(h),unconstrained_solution:n(r),iterations:n(v),iact:n(d),message:m}}}(numeric),numeric.svd=function(e){function t(e,t){return(e=Math.abs(e))>(t=Math.abs(t))?e*Math.sqrt(1+t*t/e/e):0==t?e:t*Math.sqrt(1+e*e/t/t)}var n,r=numeric.epsilon,o=1e-64/r,i=0,a=0,u=0,s=0,c=0,l=numeric.clone(e),f=l.length,m=l[0].length;if(f<m)throw"Need more rows than columns";var h=new Array(m),d=new Array(m);for(a=0;a<m;a++)h[a]=d[a]=0;var p=numeric.rep([m,m],0),g=0,v=0,y=0,A=0,x=0,w=0,b=0;for(a=0;a<m;a++){for(h[a]=v,b=0,c=a+1,u=a;u<f;u++)b+=l[u][a]*l[u][a];if(b<=o)v=0;else for(g=l[a][a],v=Math.sqrt(b),g>=0&&(v=-v),y=g*v-b,l[a][a]=g-v,u=c;u<m;u++){for(b=0,s=a;s<f;s++)b+=l[s][a]*l[s][u];for(g=b/y,s=a;s<f;s++)l[s][u]+=g*l[s][a]}for(d[a]=v,b=0,u=c;u<m;u++)b+=l[a][u]*l[a][u];if(b<=o)v=0;else{for(g=l[a][a+1],v=Math.sqrt(b),g>=0&&(v=-v),y=g*v-b,l[a][a+1]=g-v,u=c;u<m;u++)h[u]=l[a][u]/y;for(u=c;u<f;u++){for(b=0,s=c;s<m;s++)b+=l[u][s]*l[a][s];for(s=c;s<m;s++)l[u][s]+=b*h[s]}}(x=Math.abs(d[a])+Math.abs(h[a]))>A&&(A=x)}for(a=m-1;-1!=a;a+=-1){if(0!=v){for(y=v*l[a][a+1],u=c;u<m;u++)p[u][a]=l[a][u]/y;for(u=c;u<m;u++){for(b=0,s=c;s<m;s++)b+=l[a][s]*p[s][u];for(s=c;s<m;s++)p[s][u]+=b*p[s][a]}}for(u=c;u<m;u++)p[a][u]=0,p[u][a]=0;p[a][a]=1,v=h[a],c=a}for(a=m-1;-1!=a;a+=-1){for(c=a+1,v=d[a],u=c;u<m;u++)l[a][u]=0;if(0!=v){for(y=l[a][a]*v,u=c;u<m;u++){for(b=0,s=c;s<f;s++)b+=l[s][a]*l[s][u];for(g=b/y,s=a;s<f;s++)l[s][u]+=g*l[s][a]}for(u=a;u<f;u++)l[u][a]=l[u][a]/v}else for(u=a;u<f;u++)l[u][a]=0;l[a][a]+=1}for(r*=A,s=m-1;-1!=s;s+=-1)for(var C=0;C<50;C++){var T=!1;for(c=s;-1!=c;c+=-1){if(Math.abs(h[c])<=r){T=!0;break}if(Math.abs(d[c-1])<=r)break}if(!T){i=0,b=1;var _=c-1;for(a=c;a<s+1&&(g=b*h[a],h[a]=i*h[a],!(Math.abs(g)<=r));a++)for(y=t(g,v=d[a]),d[a]=y,i=v/y,b=-g/y,u=0;u<f;u++)x=l[u][_],w=l[u][a],l[u][_]=x*i+w*b,l[u][a]=-x*b+w*i}if(w=d[s],c==s){if(w<0)for(d[s]=-w,u=0;u<m;u++)p[u][s]=-p[u][s];break}if(C>=49)throw"Error: no convergence.";for(A=d[c],v=t(g=(((x=d[s-1])-w)*(x+w)+((v=h[s-1])-(y=h[s]))*(v+y))/(2*y*x),1),g=g<0?((A-w)*(A+w)+y*(x/(g-v)-y))/A:((A-w)*(A+w)+y*(x/(g+v)-y))/A,i=1,b=1,a=c+1;a<s+1;a++){for(v=h[a],x=d[a],y=b*v,v*=i,w=t(g,y),h[a-1]=w,g=A*(i=g/w)+v*(b=y/w),v=-A*b+v*i,y=x*b,x*=i,u=0;u<m;u++)A=p[u][a-1],w=p[u][a],p[u][a-1]=A*i+w*b,p[u][a]=-A*b+w*i;for(w=t(g,y),d[a-1]=w,g=(i=g/w)*v+(b=y/w)*x,A=-b*v+i*x,u=0;u<f;u++)x=l[u][a-1],w=l[u][a],l[u][a-1]=x*i+w*b,l[u][a]=-x*b+w*i}h[c]=0,h[s]=g,d[s]=A}for(a=0;a<d.length;a++)d[a]<r&&(d[a]=0);for(a=0;a<m;a++)for(u=a-1;u>=0;u--)if(d[u]<d[a]){for(i=d[u],d[u]=d[a],d[a]=i,s=0;s<l.length;s++)n=l[s][a],l[s][a]=l[s][u],l[s][u]=n;for(s=0;s<p.length;s++)n=p[s][a],p[s][a]=p[s][u],p[s][u]=n;a=u}return{U:l,S:d,V:p}}},111:(e,t,n)=>{"use strict";function r(e){e.sort();const t=e[Math.trunc(e.length/4)],n=e.length%2==0?(e[Math.trunc(e.length/2)]+e[Math.trunc(e.length/2)-1])/2:e[Math.trunc(e.length/2)],r=e[Math.trunc(3*e.length/4)],i=1.5*(r-t);let a=o(e,r+i);a<0&&(a=~a);let u=e[Math.max(0,a-1)];u<r&&(u=r);let s=o(e,t-i);s<0&&(s=~s);let c=e[s];return c>t&&(c=t),{q1:t,q2:n,q3:r,lowerAdjacentValue:c,upperAdjacentValue:u}}function o(e,t,n=0,r){if(0===e.length)return-1;if(void 0===r&&(r=e.length-1),t<e[n])return-1;if(t>e[r])return-(r+1);for(;r-n>1;){const o=Math.trunc((r+n)/2);if(t===e[o])return o;t<e[o]?r=o:n=o}return e[n]===t?n:0===e[r]?r:t<e[n]?-(n+1):-(r+1)}n.d(t,{G:()=>r})},114:(e,t,n)=>{"use strict";n.d(t,{XD:()=>de,Qc:()=>he,vK:()=>pe,d8:()=>fe,yB:()=>xe,j2:()=>le,cY:()=>ge,js:()=>ce,Kp:()=>me,kW:()=>ye,iC:()=>Ie,K0:()=>Ae,ue:()=>ke,hR:()=>Oe,ZY:()=>Se,aC:()=>Ee,sw:()=>ve});var r,o,i,a,u,s,c,l,f,m,h,d,p,g,v,y,A,x,w,b,C,T,_,S,I,O,k,E,M,B,R,N,L=n(976);function P(e,t=!1){return DG.toJs(e)}function j(e){return DG.toDart(e)}(u=r||(r={})).KEY="key",u.PIVOT="pivot",u.FIRST="first",u.TOTAL_COUNT="count",u.VALUE_COUNT="values",u.UNIQUE_COUNT="unique",u.MISSING_VALUE_COUNT="nulls",u.MIN="min",u.MAX="max",u.SUM="sum",u.MED="med",u.AVG="avg",u.STDEV="stdev",u.VARIANCE="variance",u.SKEW="skew",u.KURT="kurt",u.Q1="q1",u.Q2="q2",u.Q3="q3",u.SELECTED_ROWS_COUNT="#selected",function(e){e.CONCAT_ALL="concat all",e.CONCAT_UNIQUE="concat unique",e.LONGEST="longest",e.SHORTEST="shortest",e.MOST_FREQUENT="most frequent",e.CONCAT_COUNTS="concat counts"}(o||(o={})),function(e){e.TOTAL_COUNT="count",e.VALUE_COUNT="values",e.UNIQUE_COUNT="unique",e.MISSING_VALUE_COUNT="nulls"}(i||(i={})),function(e){e.CURRENT_ROW_TO_ROW="row to row",e.CURRENT_ROW_TO_SELECTION="row to selection",e.CURRENT_ROW_TO_FILTER="row to filter",e.MOUSE_OVER_ROW_TO_SELECTION="mouse-over to selection",e.MOUSE_OVER_ROW_TO_FILTER="mouse-over to filter",e.FILTER_TO_FILTER="filter to filter",e.FILTER_TO_SELECTION="filter to selection",e.SELECTION_TO_FILTER="selection to filter",e.SELECTION_TO_SELECTION="selection to selection"}(a||(a={})),(p=s||(s={})).INNER="inner",p.OUTER="outer",p.LEFT="left",p.RIGHT="right",function(e){e.STRING="string",e.INT="int",e.FLOAT="double",e.BOOL="bool",e.BYTE_ARRAY="byte_array",e.DATE_TIME="datetime",e.BIG_INT="bigint",e.QNUM="qnum",e.DATA_FRAME="dataframe",e.OBJECT="object"}(c||(c={})),(d=l||(l={})).INT="int",d.BIG_INT="bigint",d.FLOAT="double",d.NUM="num",d.QNUM="qnum",d.BOOL="bool",d.STRING="string",d.STRING_LIST="string_list",d.DATE_TIME="datetime",d.OBJECT="object",d.BYTE_ARRAY="byte_array",d.DATA_FRAME="dataframe",d.DATA_FRAME_LIST="dataframe_list",d.CELL="cell",d.COLUMN="column",d.COLUMN_LIST="column_list",d.GRAPHICS="graphics",d.ROW_FILTER="tablerowfiltercall",d.COLUMN_FILTER="colfiltercall",d.BIT_SET="bitset",d.MAP="map",d.DYNAMIC="dynamic",d.VIEWER="viewer",d.LIST="list",d.SEM_VALUE="semantic_value",d.FUNC="func",d.FUNC_CALL="funccall",d.PROPERTY="property",d.CATEGORICAL="categorical",d.NUMERICAL="numerical",d.GRID_CELL_RENDER_ARGS="GridCellRenderArgs",d.VIEW="view",d.TABLE_VIEW="TableView",d.USER="User",d.MENU="Menu",d.PROJECT="Project",d.SEMANTIC_VALUE="semantic_value",d.EVENT_DATA="event_data",d.PROGRESS_INDICATOR="progressindicator",d.CREDENTIALS="Credentials",d.SCRIPT_ENVIRONMENT="ScriptEnvironment",d.NOTEBOOK="Notebook",f||(f={}),function(e){e.DEMO_PATH="demoPath",e.IS_DEMO_SCRIPT="isDemoScript"}(m||(m={})),function(e){e.HISTOGRAM="histogram",e.CATEGORICAL="categorical",e.MULTI_VALUE="multi-value",e.BOOL_COLUMNS="bool-columns",e.FREE_TEXT="free-text",e.COLUMN_FREE_TEXT="column-free-text",e.SUBSTRUCTURE="Chem:substructureFilter"}(h||(h={})),new Set([l.INT,l.BIG_INT,l.FLOAT,l.NUM,l.BOOL,l.STRING]),function(e){e.STRING="string",e.INT="int",e.FLOAT="double",e.BOOL="bool",e.DATE_TIME="datetime",e.BIG_INT="bigint",e.COLUMN="column",e.COLUMN_LIST="column_list",e.DATA_FRAME="dataframe"}(g||(g={})),function(e){e.TABLE_VIEW="TableView"}(v||(v={})),(N=y||(y={})).DEBUG="debug",N.INFO="info",N.WARNING="warning",N.ERROR="error",N.AUDIT="audit",N.USAGE="usage",(R=A||(A={})).HISTOGRAM="Histogram",R.BAR_CHART="Bar chart",R.BOX_PLOT="Box plot",R.CALENDAR="Calendar",R.CORR_PLOT="Correlation plot",R.DENSITY_PLOT="Density plot",R.FILTERS="Filters",R.FORM="Form",R.GLOBE="Globe",R.GRID="Grid",R.GOOGLE_MAP="Google map",R.HEAT_MAP="Heat map",R.LINE_CHART="Line chart",R.SHAPE_MAP="Shape Map",R.MARKUP="Markup",R.MATRIX_PLOT="Matrix plot",R.NETWORK_DIAGRAM="Network diagram",R.PC_PLOT="PC Plot",R.PIE_CHART="Pie chart",R.SCATTER_PLOT="Scatter plot",R.SCATTER_PLOT_3D="3d scatter plot",R.STATISTICS="Statistics",R.TILE_VIEWER="Tile Viewer",R.TREE_MAP="Tree map",R.TRELLIS_PLOT="Trellis plot",R.WORD_CLOUD="Word cloud",R.TIMELINES="TimelinesViewer",R.RADAR_VIEWER="RadarViewer",R.SURFACE_PLOT="SurfacePlot",R.SCAFFOLD_TREE="Scaffold Tree",R.PIVOT_TABLE="Pivot table",function(e){e.LINE="Line Chart",e.AREA="Area Chart",e.BAR="Bar Chart",e.STACKED_BAR="Stacked Bar Chart",e.STACKED_AREA="Stacked Area Chart"}(x||(x={})),(B=w||(w={})).TANIMOTO="tanimoto",B.DICE="dice",B.COSINE="cosine",B.SOKAL="sokal",B.RUSSEL="russel",B.ROGOT_GOLDBERG="rogot-goldberg",B.KULCZYNSKI="kulczynski",B.MC_CONNAUGHEY="mc-connaughey",B.ASYMMETRIC="asymmetric",B.BRAUN_BLANQUET="braun-blanquet",function(e){e.Sketch="Sketch",e.Categorical="Categorical"}(b||(b={})),function(e){e.WELLS="wells",e.DEMOG="demog",e.BIOSENSOR="biosensor",e.RANDOM_WALK="random walk",e.GEO="geo",e.MOLECULES="molecules",e.DOSE_RESPONSE="dose-response"}(C||(C={})),function(e){e.LEFT="left",e.RIGHT="right",e.TOP="up",e.DOWN="down",e.FILL="fill"}(T||(T={})),function(e){e.LEFT="left",e.RIGHT="right",e.TOP="top",e.BOTTOM="bottom"}(_||(_={})),function(e){e.CATEGORICAL="Categorical",e.CONDITIONAL="Conditional",e.LINEAR="Linear",e.OFF="Off"}(S||(S={})),function(e){e.JAVASCRIPT="javascript",e.JULIA="julia",e.OCTAVE="octave",e.PYTHON="python",e.R="r",e.NODE="nodejs",e.GROK="grok"}(I||(I={})),function(e){e.CONTAINS_MISSING_VALUES="containsMissingValues",e.COLUMN_NAME="columnName",e.COLUMN_IS_NUMERICAL="columnIsNumerical",e.COLUMN_IS_CATEGORICAL="columnIsCategorical",e.NOT_EMPTY="notEmpty"}(O||(O={})),function(e){e.CIRCLE="circle",e.CIRCLE_BORDER="circle border",e.SQUARE="square",e.SQUARE_BORDER="square border",e.CROSS_BORDER="cross border",e.CROSS_X_BORDER="cross x border",e.OUTLIER="outlier",e.DIAMOND="diamond",e.DIAMOND_BORDER="diamond border",e.TRIANGLE_TOP="triangle top",e.TRIANGLE_RIGHT="triangle right",e.TRIANGLE_BOTTOM="triangle bottom",e.TRIANGLE_LEFT="triangle left",e.TRIANGLE_TOP_BORDER="triangle top border",e.TRIANGLE_RIGHT_BORDER="triangle right border",e.TRIANGLE_BOTTOM_BORDER="triangle bottom border",e.TRIANGLE_LEFT_BORDER="triangle left border",e.ASTERISK="asterisk",e.STAR="star",e.DOT="dot",e.GRADIENT="gradient"}(k||(k={})),function(e){e.STATUS_NEW="new",e.STATUS_ACTIVE="active",e.STATUS_BLOCKED="blocked",e.STATUS_GUEST="guest"}(E||(E={})),function(e){e.EDIT="Edit",e.VIEW="View",e.SHARE="Share",e.DELETE="Delete"}(M||(M={})),n(701),n(442),$,dayjs,n(126);var q=n(379),F=n.n(q),D=n(911);F()(D.Z,{insert:"head",singleton:!1}),D.Z.locals;var V=n(686);F()(V.Z,{insert:"head",singleton:!1}),V.Z.locals;var Y=n(181);F()(Y.Z,{insert:"head",singleton:!1}),Y.Z.locals;var U=n(782);F()(U.Z,{insert:"head",singleton:!1}),U.Z.locals;let G=window;class X{static getCellColor(e){return G.grok_Color_FromCell(e.dart)}static getCellColorHtml(e){return X.toHtml(X.getCellColor(e))}static getCategoryColor(e,t){return G.grok_Color_FromCategory(e.dart,t)}static a(e){return e>>24&255}static r(e){return e>>16&255}static g(e){return e>>8&255}static b(e){return 255&e}static getCategoricalColor(e){return X.categoricalPalette[e%X.categoricalPalette.length]}static getContrastColor(e){return G.grok_Color_GetContrastColor(e)}static toHtml(e){return G.grok_Color_ToHtml(e)}static fromHtml(e){return G.grok_Color_FromHtml(e)}static toRgb(e){return null===e?"":`rgb(${X.r(e)},${X.g(e)},${X.b(e)})`}static get categoricalPalette(){return G.grok_Color_CategoricalPalette()}static scaleColor(e,t,n,r,o){return G.grok_Color_ScaleColor(e,t,n,r||null,o||null)}static scale(e,t,n){return t===n?t:(e-t)/(n-t)}static get gray(){return 4286611584}static get lightLightGray(){return 4293980400}static get lightGray(){return 4292072403}static get darkGray(){return 4286808963}static get blue(){return 4278190335}static get green(){return 4278255360}static get darkGreen(){return 4278215680}static get black(){return 4278190080}static get yellow(){return 4294967040}static get white(){return 4294967295}static get red(){return 4294901760}static get darkRed(){return 4287299584}static get maroon(){return 4286578688}static get olive(){return 4286611456}static get orange(){return 4294944e3}static get darkOrange(){return 4294937600}static get lightBlue(){return 4289583334}static get darkBlue(){return 4278190240}static get purple(){return 4286578816}static get whitesmoke(){return 4294309365}static get navy(){return 4278190208}static get cyan(){return 4278255615}static get filteredRows(){return 4280252340}static get filteredOutRows(){return X.lightLightGray}static get selectedRows(){return X.darkOrange}static get missingValueRows(){return X.filteredOutRows}static get mouseOverRows(){return 4289374890}static get currentRow(){return 4281907e3}static get histogramBar(){return X.filteredRows}static get barChart(){return 4280590881}static get scatterPlotMarker(){return 4282411420}static get scatterPlotSelection(){return 2150773298}static get scatterPlotZoom(){return 2153931264}static get areaSelection(){return X.lightBlue}static get rowSelection(){return 1625087136}static get colSelection(){return 1625087136}static get areaZoom(){return 2150773298}static get gridWarningBackground(){return 4294949287}static get success(){return 4282167667}static get failure(){return 4293617511}}let W=window,H=new Float64Array(4);class z{constructor(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r}static fromPoints(e,t,n,r){let o=Math.min(e,n),i=Math.min(t,r);return new z(o,i,Math.max(e,n)-o,Math.max(t,r)-i)}static fromXYArrays(e,t){let n=e[0],r=t[0],o=e[0],i=t[0];for(let a=1;a<e.length;a++)n=Math.min(n,e[a]),r=Math.min(r,t[a]),o=Math.max(o,e[a]),i=Math.max(i,t[a]);return new z(n,r,o-n,i-r)}static fromDart(e){return W.grok_Rect_Pack(e,H),new z(H[0],H[1],H[2],H[3])}static toDart(e){return H[0]=e.x,H[1]=e.y,H[2]=e.width,H[3]=e.height,W.grok_Rect_Unpack(H)}toDart(){return H[0]=this.x,H[1]=this.y,H[2]=this.width,H[3]=this.height,W.grok_Rect_Unpack(H)}fromCenterSize(e,t,n,r){return new z(e-n/2,t-r/2,n,r)}get midX(){return this.x+this.width/2}get midY(){return this.y+this.height/2}get minX(){return this.x}get maxX(){return this.x+this.width}get minY(){return this.y}get maxY(){return this.bottom}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}move(e,t){return new z(this.x+e,this.y+t,this.width,this.height)}getTop(e){return new z(this.left,this.top,this.width,e)}getBottom(e){return new z(this.left,this.bottom-e,this.width,e)}getLeft(e){return new z(this.left,this.top,e,this.height)}getRight(e){return new z(this.right-e,this.top,e,this.height)}getTopLeft(e,t){return new z(this.left,this.top,e,t)}getTopRight(e,t){return new z(this.right-e,this.top,e,t)}getBottomLeft(e,t){return new z(this.left,this.bottom-t,e,t)}getBottomRight(e,t){return new z(this.right-e,this.bottom-t,e,t)}cutLeft(e){return new z(this.left+e,this.top,this.width-e,this.height)}cutTop(e){return new z(this.left,this.top+e,this.width,this.height-e)}cutBottom(e){return new z(this.left,this.top,this.width,this.height-e)}cutRight(e){return new z(this.left,this.top,this.width-e,this.height)}below(e){return new z(this.left,this.bottom,this.width,e)}above(e){return new z(this.left,this.top-e,this.width,e)}toTheLeft(e){return new z(this.left-e,this.top,e,this.height)}toTheRight(e){return new z(this.right,this.top,e,this.height)}toTheTop(e){return this.above(e)}toTheBottom(e){return this.below(e)}getTopScaled(e){return this.getTop(this.height*e)}getBottomScaled(e){return this.getBottom(this.height*e)}getLeftScaled(e){return this.getLeft(this.width*e)}getRightScaled(e){return this.getRight(this.width*e)}getTopPart(e,t){return new z(this.left,this.top+this.height/e*t,this.width,this.height/e)}getLeftPart(e,t){return new z(this.left+this.width/e*t,this.top,this.width/e,this.height)}getGridPart(e,t,n,r){return new z(this.left+this.width/e*n,this.top+this.height/t*r,this.width/e,this.height/r)}inflate(e,t){return new z(this.left-e,this.top-t,this.width+2*e,this.height+2*t)}inflateSize(e,t){return new z(this.left,this.top,this.width+e,this.height+t)}inflateRel(e,t){return this.inflate(this.width*(e-1),this.height*(t-1))}fitSquare(){const e=Math.min(this.width,this.height);return new z(this.left+(this.width-e)/2,this.top+(this.height-e)/2,e,e)}fit(e,t){return e/t>this.width/this.height?this.fromCenterSize(this.midX,this.midY,this.width,t*(this.width/e)):this.fromCenterSize(this.midX,this.midY,e*(this.height/t),this.height)}contains(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom}containsPoint(e){return this.contains(e.x,e.y)}union(e){return z.fromPoints(Math.min(this.minX,e.minX),Math.min(this.minY,e.minY),Math.max(this.maxX,e.maxX),Math.max(this.maxY,e.maxY))}}let K=window;var Q,Z;CanvasRenderingContext2D.prototype.setFillStyle=function(e){return this.fillStyle=e,this},CanvasRenderingContext2D.prototype.setStrokeStyle=function(e){return this.strokeStyle=e,this},CanvasRenderingContext2D.prototype.roundRect=function(e,t,n,r,o){return n<2*o&&(o=n/2),r<2*o&&(o=r/2),this.beginPath(),this.moveTo(e+o,t),this.arcTo(e+n,t,e+n,t+r,o),this.arcTo(e+n,t+r,e,t+r,o),this.arcTo(e,t+r,e,t,o),this.arcTo(e,t,e+n,t,o),this.closePath(),this},CanvasRenderingContext2D.prototype.line=function(e,t,n,r,o){return this.beginPath(),this.strokeStyle=X.toRgb(o),this.moveTo(e,t),this.lineTo(n,r),this.stroke(),this},CanvasRenderingContext2D.prototype.polygon=function(e){this.beginPath();const t=e[e.length-1];this.moveTo(t.x,t.y);for(let t of e)this.lineTo(t.x,t.y);return this.closePath(),this},function(e){function t(e,t,n,r,o,i,a,u=!1,s=!1){K.grok_Paint_HorzAxis(e,t,n,r,o,i,a,u,s)}function n(e,t,n,r,o,i,a,u=!1,s=!1){K.grok_Paint_VertAxis(e,t,n,r,o,i,a,u,s)}e.coordinateGrid=function(e,r,o,i,a){null!=o&&t(e,r.minX,r.maxX,o.x,o.y,o.width,o.height),null!=i&&n(e,r.minY,r.maxY,i.x,i.y,i.width,i.height)},e.horzAxis=t,e.vertAxis=n,e.roundRect=function(e,t,n,r,o,i){return r<2*i&&(i=r/2),o<2*i&&(i=o/2),e.beginPath(),e.moveTo(t+i,n),e.arcTo(t+r,n,t+r,n+o,i),e.arcTo(t+r,n+o,t,n+o,i),e.arcTo(t,n+o,t,n,i),e.arcTo(t,n,t+r,n,i),e.closePath(),e},e.marker=function(e,t,n,r,o,i){K.grok_Paint_Marker(e,t,n,r,o,i)},e.pngImage=function(e,t,n){let r=new FileReader;r.readAsBinaryString(new Blob([n])),r.onload=function(){let n=new Image;n.onload=function(){t=new z(t.x,t.y,t.width,t.height).fit(n.width,n.height),e.drawImage(n,t.x,t.y,t.width,t.height)},n.src="data:image/jpeg;base64,"+window.btoa(r.result)}}}(Q||(Q={})),Symbol.iterator,function(e){e.renderToCanvas=function(e,t=1){return K.grok_HtmlUtils_RenderToCanvas(e,t)},e.htmlGetBounds=function(e){return z.fromDart(K.grok_HtmlUtils_HtmlGetBounds(e))}}(Z||(Z={}));const J=new Proxy(class{constructor(e,t=null,n=null){this.dart=e,this.objectName=t,this.valueType=n}keys(){return ee(K.grok_Map_Keys(this.dart))}values(){return ee(P(K.grok_Map_Values(this.dart)))}*[Symbol.iterator](){for(let e of this.keys()){const t=P(K.grok_Map_Get(this.dart,e));yield[e,P(t)]}}entries(){return this}forEach(e){for(const[t,n]of this)e(t,P(n))}delete(e){return P(K.grok_Map_Delete(this.dart,j(e)))}get(e){return P(K.grok_Map_Get(this.dart,e))}has(e){return K.grok_Map_Has(this.dart,j(e))}set(e,t){return K.grok_Map_Set(this.dart,e,j(t)),this}clear(){K.grok_Map_Clear(this.dart)}size(){return P(K.grok_Map_Size(this.dart))}},{construct:(e,t)=>new Proxy(new e(...t),{get:function(e,t){const n=e[t];return"function"==typeof n?function(...t){return n.apply(e,t)}:P(K.grok_Map_Get(e.dart,t))},set:function(e,t,n){const r=typeof n;if(e.valueType&&e.valueType!==r)throw new Error(`Entries of ${e.objectName} require type '${e.valueType}', passed '${r}'`);return K.grok_Map_Set(e.dart,t,j(n)),!0},deleteProperty:function(e,t){return K.grok_Map_Delete(e.dart,j(t)),!0},has:function(e,t){return K.grok_Map_Has(e.dart,j(t))},getOwnPropertyDescriptor:(e,t)=>({enumerable:!0,configurable:!0}),ownKeys:function(e){return Array.from(e.keys())}})});function ee(e){let t={};return t[Symbol.iterator]=()=>function(e){let t=K.grok_Iterable_Get_Iterator(e);return{next:function(){return K.grok_Iterator_MoveNext(t)?{value:P(K.grok_Iterator_Current(t)),done:!1}:{done:!0}}}}(e),t}var te;!function(e){e.isInBenchmark=!1}(te||(te={}));class ne{}ne.Description="description",ne.CreatedBy="createdBy",ne.SemanticDetectionDuration=".semantic-detection-duration",ne.Tooltip=".tooltip",ne.TooltipVisibility=".tooltip-visibility",ne.TooltipForm=".tooltip-form",ne.RowGroupTooltip=".row-group-tooltip",ne.ValueFunction=".value-function",ne.ColorCoding=".color-coding",ne.ColorCodingType=".color-coding-type",ne.ColorCodingText=".color-coding-text",ne.ColorCodingLinear=".color-coding-linear",ne.ColorCodingConditional=".color-coding-conditional",ne.ColorCodingCategorical=".color-coding-categorical",ne.ColorCodingValueColumn=".color-coding-value-column",ne.ColorCodingSchemeMax=".color-coding-scheme-max",ne.ColorCodingSchemeMin=".color-coding-scheme-min",ne.DefaultAxisType=".default-axis-type",ne.MarkerCoding=".marker-coding",ne.HelpUrl="help.url",ne.OriginalTableName=".orig.table.name",ne.OriginalViewName=".orig.view.name",ne.CellRenderer="cell.renderer",ne.Domains="domains",ne.Quality="quality",ne.Notation="notation",ne.LayoutColumnId="layout-column-id",ne.Units="units",ne.Format="format",ne.TooltipType=".tooltip-type",ne.Markup="markup",ne.SourcePrecision=".source-precision",ne.Formula="formula",ne.Choices=".choices",ne.CategoryOrder=".category-order",ne.DefaultFilter=".default-filter",ne.IgnoreCustomFilter=".ignore-custom-filter",ne.CustomFilterType=".custom-filter-type",ne.UseAsFilter=".use-as-filter",ne.PickupColumnsTags=".pickup-column-tags",ne.Charts=".charts",ne.AutoChoices=".auto-choices",ne.ImportTime="import-time",ne.Source="source",ne.SourceUri="source.uri",ne.SourceFile="source.file",ne.Db="Db",ne.DbSchema="DbSchema",ne.DbTable="DbTable",ne.DbColumn="DbColumn",ne.DbPath="DbPath",ne.SparqlEndpoint="sparql.endpoint",ne.SparqlOntology="sparql.ontology",ne.AggregationPivotValues="aggr.pivot.values",ne.AggregationSourceTableName="aggr.src.table.name",ne.AggregationSourceColumnName="aggr.src.col.name",ne.AggregationType="aggr.type",ne.PredictiveModel="predictive.model",ne.Id=".id",ne.TableInfo=".table-info",ne.VariableName=".VariableName",ne.DataConnectionId=".data-connection-id",ne.DataConnection=".data-connection",ne.DataSource=".DataSource",ne.DataSchema=".DataSchema",ne.DataQueryId=".DataQuery.id",ne.DataQueryName="DataQuery.name",ne.DataQueryCall=".DataQuery.query.call",ne.Presentation=".presentation",ne.QueryJson=".query-json",ne.Expression="expression",ne.TableSchema="table_schema",ne.ReferencesTable="references_table",ne.ReferencesColumn="references_column",ne.ChemDescriptor="chem-descriptor",ne.ChemFingerprinter="chem-fingerprinter",ne.DataHistory=".history",ne.CreationScript=".script",ne.DataSync=".data-sync",ne.IsDbEntity=".db.entity",ne.IsDbView=".db.view",ne.ColumnConverter=".column.converter",ne.ValueValidators=".value-validators",ne.MultiValueSeparator=".multi-value-separator",ne.FriendlyName="friendlyName",ne.AllowRename=".allow-rename",ne.EditableBy="editableBy",ne.PinIfEditable="pinIfEditable",ne.IncludeInCsvExport=".includeInCsvExport",ne.IncludeInBinaryExport=".includeInBinaryExport",ne.LinkClickBehavior=".linkClickBehavior",ne.Hierarchy="hierarchy";class re{}re.Editor="editor",re.Action="action",re.Toolbox="toolbox",re.AutostartImmediate="autostartImmediate",re.CellRendererColumnTags="columnTags",re.CellRendererCellType="cellType",re.InputPropertyType="propertyType",re.SemType="semType",re.VisibilityCondition="condition",re.DemoPath="condition",re.ViewerPath="viewerPath",re.GridChart="gridChart",re.RunOnInput="runOnInput",re.RunOnOpen="runOnOpen",re.PrimaryFilter="primaryFilter",re.InspectorPanel="inspectorPanel",re.Cache="cache",re.CacheInvalidateOn="cache.invalidateOn";class oe{}oe.SemType="semType",oe.Columns="columns",oe.Category="category",oe.Optional="optional",oe.Type="type",oe.Format="format",oe.AllowNulls="allowNulls",oe.Action="action",oe.Choices="choices",oe.Suggestions="suggestions",oe.Min="min",oe.Max="max",oe.Validators="validators",oe.Caption="caption",oe.Postfix="postfix",oe.Units="units",oe.Editor="editor",oe.Nullable="nullable",oe.Separators="separators",window,Symbol.iterator,Symbol.iterator,new DataView(new ArrayBuffer(8));let ie=window;class ae{constructor(e){this.dart=e,this.options=new J(ie.grok_Property_Get_Options(this.dart))}get get(){return ie.grok_Property_Get_Get(this.dart)}set get(e){ie.grok_Property_Set_Get(this.dart,e)}get set(){return ie.grok_Property_Get_Set(this.dart)}set set(e){ie.grok_Property_Set_Set(this.dart,e)}get name(){return ie.grok_Property_Get_Name(this.dart)}set name(e){ie.grok_Property_Set_Name(this.dart,e)}get caption(){return ie.grok_Property_Get_Caption(this.dart)}get category(){return ie.grok_Property_Get_Category(this.dart)}set category(e){ie.grok_Property_Set_Category(this.dart,e)}get propertyType(){return ie.grok_Property_Get_PropertyType(this.dart)}set propertyType(e){ie.grok_Property_Set_PropertyType(this.dart,e)}get semType(){return ie.grok_Property_Get_SemType(this.dart)}set semType(e){ie.grok_Property_Set_SemType(this.dart,e)}get description(){return ie.grok_Property_Get_Description(this.dart)}set description(e){ie.grok_Property_Set_Description(this.dart,e)}get defaultValue(){return ie.grok_Property_Get_DefaultValue(this.dart)}set defaultValue(e){ie.grok_Property_Set_DefaultValue(this.dart,e)}get editor(){return ie.grok_Property_Get(this.dart,"editor")}set editor(e){ie.grok_Property_Set(this.dart,"editor",e)}get showSlider(){return ie.grok_Property_GetShowSlider(this.dart)}set showSlider(e){ie.grok_Property_SetShowSlider(this.dart,e)}get showPlusMinus(){return ie.grok_Property_GetShowPlusMinus(this.dart)}set showPlusMinus(e){ie.grok_Property_SetShowPlusMinus(this.dart,e)}get choices(){return ie.grok_Property_Get_Choices(this.dart)}set choices(e){ie.grok_Property_Set_Choices(this.dart,e)}get columnFilter(){return ie.grok_Property_Get_ColumnTypeFilter(this.dart)}fromOptions(e){return e&&ie.grok_Property_Options(this.dart,e),this}static create(e,t,n,r,o=null){return new ae(ie.grok_Property(e,t,n,r,o))}static int(e,t,n,r){return ae.create(e,l.INT,t,n,r)}static float(e,t,n,r){return ae.create(e,l.FLOAT,t,n,r)}static string(e,t,n,r){return ae.create(e,l.STRING,t,n,r)}static bool(e,t,n,r){return ae.create(e,l.BOOL,t,n,r)}static dateTime(e,t,n,r){return ae.create(e,l.DATE_TIME,t,n,r)}static js(e,t,n){return ae.create(e,t,(t=>t[e]),(function(t,n){t[e]=n}),null==n?void 0:n.defaultValue).fromOptions(n)}static jsInt(e,t){return ae.js(e,l.INT,t)}static jsBool(e,t){return ae.js(e,l.BOOL,t)}static jsFloat(e,t){return ae.js(e,l.FLOAT,t)}static jsString(e,t){return ae.js(e,l.STRING,t)}static jsDateTime(e,t){return ae.js(e,l.DATE_TIME,t)}static fromOptions(e){return ae.js(e.name,e.type,e)}static registerAttachedProperty(e,t){ie.grok_Property_RegisterAttachedProperty(e,t.dart)}}var ue=n(78),se=n(162);const ce={CONSTANT:"constant",PROPORTIONAL:"proportional"},le="fit",fe="fit",me=".fit",he="rgba(255,191,63,0.4)",de="rgba(255,238,204,0.3)",pe={TOP:"top",BOTTOM:"bottom"};class ge{constructor(){this.chartOptions={},this.seriesOptions={},this.series=[]}}const ve=[ae.js("rSquared",l.FLOAT,{userEditable:!1}),ae.js("auc",l.FLOAT,{userEditable:!1}),ae.js("interceptY",l.FLOAT,{userEditable:!1}),ae.js("interceptX",l.FLOAT,{userEditable:!1}),ae.js("slope",l.FLOAT,{userEditable:!1}),ae.js("top",l.FLOAT,{userEditable:!1}),ae.js("bottom",l.FLOAT,{userEditable:!1})],ye=[ae.js("minX",l.FLOAT,{description:"Minimum value of the X axis",nullable:!0}),ae.js("minY",l.FLOAT,{description:"Minimum value of the Y axis",nullable:!0}),ae.js("maxX",l.FLOAT,{description:"Maximum value of the X axis",nullable:!0}),ae.js("maxY",l.FLOAT,{description:"Maximum value of the Y axis",nullable:!0}),ae.js("title",l.STRING,{nullable:!0}),ae.js("xAxisName",l.STRING,{description:"Label to show on the X axis. If not specified, corresponding data column name is used",nullable:!0}),ae.js("yAxisName",l.STRING,{description:"Label to show on the Y axis. If not specified, corresponding data column name is used",nullable:!0}),ae.js("logX",l.BOOL,{description:"Whether the X axis should be logarithmic",defaultValue:!1}),ae.js("logY",l.BOOL,{description:"Whether the Y axis should be logarithmic",defaultValue:!1}),ae.js("showStatistics",l.STRING_LIST,{description:"Whether specific statistics should be rendered",choices:ve.map((e=>e.name)),inputType:"MultiChoice"})],Ae=[ae.js("fitFunction",l.STRING,{category:"Fitting",choices:["sigmoid","linear"],defaultValue:"sigmoid"}),ae.js("pointColor",l.STRING,{category:"Rendering",nullable:!0,inputType:"Color"}),ae.js("fitLineColor",l.STRING,{category:"Rendering",nullable:!0,inputType:"Color"}),ae.js("errorModel",l.STRING,{category:"Fitting",defaultValue:"constant",choices:["constant","proportional"],nullable:!1}),ae.js("clickToToggle",l.BOOL,{category:"Fitting",description:"Click on a point to mark it as outlier and refit",nullable:!0,defaultValue:!1}),ae.js("showFitLine",l.BOOL,{category:"Fitting",defaultValue:!0}),ae.js("showPoints",l.STRING,{category:"Fitting",description:"Whether points/candlesticks/none should be rendered",defaultValue:"points",choices:["points","candlesticks","both"]}),ae.js("showCurveConfidenceInterval",l.BOOL,{category:"Fitting",description:"Whether confidence intervals should be rendered",defaultValue:!1,caption:"Confidence interval"}),ae.js("markerType",l.STRING,{category:"Rendering",defaultValue:"circle",choices:["asterisk","circle","cross border","diamond","square","star","triangle bottom","triangle left","triangle right","triangle top"],nullable:!1}),ae.js("lineStyle",l.STRING,{category:"Rendering",defaultValue:"solid",choices:["solid","dotted","dashed","dashdotted"],nullable:!1}),ae.js("droplines",l.STRING_LIST,{description:"Whether specific droplines should be rendered",choices:["IC50"],inputType:"MultiChoice"})],xe="sigmoid";class we{}class be extends we{constructor(e,t,n,r){super(),this._name=e,this._parameterNames=r,this.y=t,this.getInitialParameters=n}get name(){return this._name}get parameterNames(){return this._parameterNames}y(e,t){throw new Error("Not implemented")}getInitialParameters(e,t){throw new Error("Not implemented")}}const Ce={linear:new class extends we{get name(){return"linear"}get parameterNames(){return["Slope","Intercept"]}y(e,t){return function(e,t){return e[0]*t+e[1]}(e,t)}getInitialParameters(e,t){let n=0,r=0;for(let t=1;t<e.length;t++)e[t]<e[n]&&(n=t),e[t]>e[r]&&(r=t);const o=e[r]-e[n],i=(t[r]-t[n])/o;return[i,t[r]-i*e[r]]}},sigmoid:new class extends we{get name(){return xe}get parameterNames(){return["Top","Bottom","Slope","IC50"]}y(e,t){return function(e,t){const n=e[0],r=e[1],o=e[2],i=e[3];return i+(n-i)/(1+Math.pow(10,(t-o)*r))}(e,t)}getInitialParameters(e,t){const n=L.Rect.fromXYArrays(e,t),r=(n.bottom-n.top)/2+n.top;let o=n.bottom-n.top,i=0;for(let n=0;n<e.length;n++){const e=Math.abs(t[n]-r);e<o&&(o=e,i=n)}const a=e[i],u=t[0]>t[t.length-1]?1:-1;return[n.bottom,u,a,n.top]}}};function Te(e){let t;switch(e){case ce.CONSTANT:t=Ne;break;case ce.PROPORTIONAL:t=Le;break;default:t=Ne}return t}function _e(e,t,n,r){return{getValue:r=>n(t,e,r).value,getGradient:(o,i)=>{for(let a=0;a<o.length;a++)i[a]=r.includes(a)?0:Re(n,t,e,o,a);return i}}}function Se(e){if("string"==typeof e)return Ce[e];if(!Ce[e.name]){const t=e.name,n=e.parameterNames,r=e.function.split("=>").map((e=>e.trim())),o=e.getInitialParameters.split("=>").map((e=>e.trim())),i=new Function(r[0].slice(1,r[0].length-1),`${r[1].includes(";")?"":"return "}${r[1]}`),a=new Function(o[0].slice(1,o[0].length-1),`return ${o[1]}`),u=new be(t,i,a,n);Ce[t]=u}return Ce[e.name]}function Ie(e,t,n,r){var o,i;const a=t.y,u=t.getInitialParameters(e.x,e.y),s=Te(n),c=[];let l=!0;for(;l;){const t=_e(e,a,s,c);if((0,ue.U)(t,u),(0,ue.U)(t,u),l=!1,!r)break;for(let e=0;e<r.length;e++){if(void 0!==(null===(o=r[e])||void 0===o?void 0:o.max)&&u[e]>r[e].max){l=!0,c.push(e),u[e]=r[e].max;break}if(void 0!==(null===(i=r[e])||void 0===i?void 0:i.min)&&u[e]<r[e].min){l=!0,c.push(e),u[e]=r[e].min;break}}}return{fittedCurve:Oe(a,u),parameters:u}}function Oe(e,t){return n=>e(t,n)}function ke(e,t,n,r=.05,o){const i=Te(o),a=o===ce.PROPORTIONAL?i(n,e,t).mult:i(n,e,t).const,u=se.normal.inv(1-r/2,0,1);return{confidenceTop:e=>{const r=n(t,e);return o===ce.CONSTANT?r+u*a:r+u*Math.abs(r)*a},confidenceBottom:e=>{const r=n(t,e);return o===ce.CONSTANT?r-u*a:r-u*Math.abs(r)*a}}}function Ee(e,t,n,r=!0){const o=Oe(n,t);return{rSquared:r?Be(o,e):void 0,auc:r?Me(o,e):void 0,interceptX:t[2],interceptY:o(t[2]),slope:t[1],top:t[0],bottom:t[3]}}function Me(e,t){let n=0;const r=Math.min(...t.x),o=Math.max(...t.x),i=(o-r)/1e3;for(let t=r;t<o;t+=i)n+=i*e(t);return n}function Be(e,t){let n=0,r=0;const o=se.mean(t.y);for(let i=0;i<t.x.length;i++)n+=Math.pow(t.y[i]-e(t.x[i]),2),r+=Math.pow(t.y[i]-o,2);return 1-n/r}function Re(e,t,n,r,o){const i=1e-4*r[o]==0?.001:1e-4*r[o],a=[],u=[];for(let e=0;e<r.length;e++)e===o?(a.push(r[e]+i),u.push(r[e]-i)):(a.push(r[e]),u.push(r[e]));return(e(t,n,a).value-e(t,n,u).value)/(2*i)}function Ne(e,t,n){const r=Math.PI;let o=0,i=0,a=0;const u=new Float32Array(t.x.length);for(let r=0;r<t.x.length;r++){const o=t.y[r],i=e(n,t.x[r]);u[r]=Math.pow(o-i,2)}for(let e=0;e<u.length;e++)i+=u[e];i/=u.length,o=Math.sqrt(i);for(let e=0;e<u.length;e++)a+=u[e]/i+Math.log(2*r*i);return{value:-a,const:o,mult:0}}function Le(e,t,n){const r=Math.PI;let o=0,i=0,a=0;const u=new Float32Array(t.x.length);for(let r=0;r<t.x.length;r++){const o=t.y[r],i=e(n,t.x[r]);u[r]=Math.pow(o-i,2)}for(let e=0;e<u.length;e++)i+=u[e];i/=u.length,o=Math.sqrt(i);for(let e=0;e<u.length;e++)a+=u[e]/i+Math.log(2*r*i);return{value:-a,const:0,mult:o}}},416:(e,t,n)=>{"use strict";n.d(t,{LC:()=>p,PK:()=>d,TL:()=>a,Y6:()=>m,dU:()=>f,hq:()=>s,jG:()=>u,kG:()=>h,tq:()=>g});var r=n(976),o=n(114);function i(e){const t={};for(const n of e)null!==n.defaultValue&&(t[n.name]=n.defaultValue);return t}function a(){return{chartOptions:i(o.kW),seriesOptions:i(o.K0)}}function u(e){var t,n;return JSON.parse(null!==(t=(n=e.tags)[o.Kp])&&void 0!==t?t:n[o.Kp]=JSON.stringify(a()))}function s(e){var t,n;return JSON.parse(null!==(t=(n=e.tags)[o.Kp])&&void 0!==t?t:n[o.Kp]=JSON.stringify(a()))}function c(e){const t=[],n=[];for(let r=0;r<e.length;r++)t[r]=e[r].x,n[r]=e[r].y;return{xs:t,ys:n}}function l(e){const t=Math.floor(e.y.length/2),n=e.y.sort(((e,t)=>e-t));return n.length%2==0?(n[t-1]+n[t])/2:n[t]}function f(e){var t;const n=e.chartOptions;if((null===(t=e.series)||void 0===t?void 0:t.length)&&0!==e.series.length){const{xs:t,ys:o}=c(e.series[0].points);let i=r.Rect.fromXYArrays(t,o);for(let t=1;t<e.series.length;t++){const{xs:n,ys:o}=c(e.series[t].points);n.some((e=>void 0===e))||o.some((e=>void 0===e))||(i=i.union(r.Rect.fromXYArrays(n,o)))}return n?function(e,t){let n=e.x,o=e.y,i=e.width,a=e.height;return void 0!==t.minX&&null!==t.minX&&(!t.logX||t.logX&&t.minX>0)&&(i+=n-t.minX,n=t.minX),void 0!==t.maxX&&null!==t.maxX&&(!t.logX||t.logX&&t.maxX>0)&&(i+=t.maxX-(n+i)),void 0!==t.minY&&null!==t.minY&&(!t.logY||t.logY&&t.minY>0)&&(a+=o-t.minY,o=t.minY),void 0!==t.maxY&&null!==t.maxY&&(!t.logY||t.logY&&t.maxY>0)&&(a+=t.maxY-(o+a)),new r.Rect(n,o,i,a)}(i,n):i}return new r.Rect(0,0,1,1)}function m(e){return(0,o.ZY)(e.fitFunction)}function h(e,t){return(0,o.hR)(t.y,e.parameters)}function d(e,t,n){var r;const i={x:e.points.filter((e=>!e.outlier)).map((e=>(null==n?void 0:n.logX)?Math.log10(e.x):e.x)),y:e.points.filter((e=>!e.outlier)).map((e=>(null==n?void 0:n.logY)?Math.log10(e.y):e.y))};var a;return e.parameterBounds&&(null==n?void 0:n.logX)&&(e.parameterBounds[2]=((a=e.parameterBounds[2])&&(void 0!==a.max&&(a.max=Math.log10(a.max)),void 0!==a.min&&(a.min=0===a.min?-Number.MAX_VALUE:Math.log10(a.min))),a)),(0,o.iC)(function(e){const t={x:[],y:[]},n={x:[e.x[0]],y:[e.y[0]]};for(let r=1;r<e.x.length;r++){if(e.x[r]===n.x[0]){n.x[n.x.length]=e.x[r],n.y[n.y.length]=e.y[r];continue}const o=l(n);t.x[t.x.length]=n.x[0],t.y[t.y.length]=o,n.x=[e.x[r]],n.y=[e.y[r]]}const r=l(n);return t.x[t.x.length]=n.x[0],t.y[t.y.length]=r,t}(i),t,null!==(r=e.errorModel)&&void 0!==r?r:o.js.CONSTANT,e.parameterBounds)}function p(e,t,n,r){var i;const a=n?{x:e.points.map((e=>(null==r?void 0:r.logX)?Math.log10(e.x):e.x)),y:e.points.map((e=>(null==r?void 0:r.logY)?Math.log10(e.y):e.y))}:{x:e.points.filter((e=>!e.outlier)).map((e=>(null==r?void 0:r.logX)?Math.log10(e.x):e.x)),y:e.points.filter((e=>!e.outlier)).map((e=>(null==r?void 0:r.logY)?Math.log10(e.y):e.y))};return e.parameters||(e.parameters=d(e,t).parameters),(0,o.ue)(a,e.parameters,t.y,.05,null!==(i=e.errorModel)&&void 0!==i?i:o.js.CONSTANT)}function g(e,t,n){const r={x:e.points.filter((e=>!e.outlier)).map((e=>(null==n?void 0:n.logX)?Math.log10(e.x):e.x)),y:e.points.filter((e=>!e.outlier)).map((e=>(null==n?void 0:n.logY)?Math.log10(e.y):e.y))};return e.parameters||(e.parameters=d(e,t).parameters),(0,o.aC)(r,e.parameters,t.y,!0)}},766:(e,t,n)=>{"use strict";n.d(t,{l:()=>u});var r=n(976);const o=1e-30,i=new class{screenToWorld(e,t,n,r,o){return n+(o?1-e/t:e/t)*(r-n)}worldToScreen(e,t,n,r,o){return o?(1-(e-n)/(r-n))*t:(e-n)/(r-n)*t}},a=new class{screenToWorld(e,t,n,r,i){n=n<o?o:n;const a=Math.log(r),u=Math.log(n);return Math.exp(u+(a-u)*(i?t-e:e)/t)}worldToScreen(e,t,n,r,i){if(e<=0)return NaN;if(Math.abs(e-n)<o)return i?t:0;if(Math.abs(e-r)<o)return i?0:t;n=n<o?o:n,e=e<o?o:e;const a=t*Math.log(e/n)/Math.log(r/n);return i?t-a:a}};class u{get xt(){return this.logX?a:i}get yt(){return this.logY?a:i}constructor(e,t,n=!1,r=!1){this.logX=!1,this.logY=!1,this.inverseX=!1,this.inverseY=!1,this.world=e,this.screen=t,this.logX=n,this.logY=r}xToScreen(e){return this.screen.left+this.xt.worldToScreen(e,this.screen.width,this.world.minX,this.world.maxX,this.inverseX)}yToScreen(e){return this.screen.top+this.yt.worldToScreen(e,this.screen.height,this.world.minY,this.world.maxY,!this.inverseY)}xToWorld(e){return this.xt.screenToWorld(e-this.screen.left,this.screen.width,this.world.minX,this.world.maxX,this.inverseX)}yToWorld(e){return this.yt.screenToWorld(e-this.screen.top,this.screen.height,this.world.minY,this.world.maxY,!this.inverseY)}toScreen(e){return new r.Point(this.xToScreen(e.x),this.yToScreen(e.y))}toWorld(e){return new r.Point(this.xToWorld(e.x),this.yToWorld(e.y))}drawCoordinateGrid(e,t,n){t&&r.Paint.horzAxis(e,this.world.minX,this.world.maxX,t.x,t.y,t.width,t.height,this.logX,this.inverseX),n&&r.Paint.vertAxis(e,this.world.minY,this.world.maxY,n.x,n.y,n.width,n.height,this.logY,this.inverseY)}}},911:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(15),o=n.n(r),i=n(645),a=n.n(i)()(o());a.push([e.id,".ui-breadcrumbs {\n padding: 0 .5rem;\n display: flex;\n flex-wrap: wrap;\n list-style: none;\n margin: 0;\n font-size: 13px;\n align-items: center;\n}\n\n.ui-breadcrumbs-element:last-child a {\n color: var(--grey-6);\n cursor: default;\n}\n\n.ui-breadcrumbs i {\n font-size: 10px;\n font-weight: bold;\n color: var(--grey-3);\n padding: 0 12px;\n cursor: default;\n}\n","",{version:3,sources:["webpack://./node_modules/datagrok-api/css/breadcrumbs.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,SAAS;IACT,eAAe;IACf,mBAAmB;AACvB;;AAEA;IACI,oBAAoB;IACpB,eAAe;AACnB;;AAEA;IACI,eAAe;IACf,iBAAiB;IACjB,oBAAoB;IACpB,eAAe;IACf,eAAe;AACnB",sourcesContent:[".ui-breadcrumbs {\n padding: 0 .5rem;\n display: flex;\n flex-wrap: wrap;\n list-style: none;\n margin: 0;\n font-size: 13px;\n align-items: center;\n}\n\n.ui-breadcrumbs-element:last-child a {\n color: var(--grey-6);\n cursor: default;\n}\n\n.ui-breadcrumbs i {\n font-size: 10px;\n font-weight: bold;\n color: var(--grey-3);\n padding: 0 12px;\n cursor: default;\n}\n"],sourceRoot:""}]);const u=a},686:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(15),o=n.n(r),i=n(645),a=n.n(i)()(o());a.push([e.id,".ui-drop-down-root {\n position: relative;\n display: flex;\n align-items: center;\n min-width: initial;\n width: initial;\n max-height: 24px;\n padding: 0 7px 0 2px;\n margin: 2px 11px 2px 2px;\n}\n\n.ui-drop-down-root::after {\n content: ' ';\n margin-right: 2px;\n border-width: 4px 4px 0 4px;\n border-style: solid;\n border-color: #40607f transparent transparent transparent;\n}\n\n.ui-drop-down-root.ui-drop-down-root-expanded {\n z-index: 4000;\n box-shadow: 0px 0px 2px #40607F;\n border-radius: 1px;\n background-color: #ECEFF2;\n flex-grow: 1;\n}\n\n.ui-drop-down-root.ui-drop-down-root-expanded::before {\n content: ' ';\n bottom: -1px;\n left: 0;\n position: absolute;\n width: 100%;\n height: 5px;\n z-index: 4002;\n background-color: #ECEFF2;\n}\n\n.ui-drop-down-content {\n position: absolute;\n left: -2px;\n top: 25px;\n display: flex;\n justify-content: flex-start;\n flex-direction: column;\n align-items: center;\n box-shadow: 0px 0px 2px #40607F;\n z-index: 4000;\n background: #ECEFF2;\n min-width: 110px;\n width: max-content;\n padding: 0;\n /*padding: 6px 12px;\n visibility: hidden;*/\n}\n\n.d4-ribbon-item > .ui-drop-down-root {\n /*margin-right: 11px;*/\n}\n\n.ui-drop-down-root > .ui-combo-drop-down-fixed {\n position: fixed;\n align-self: baseline;\n z-index: 4001;\n}\n\n.ui-drop-down-content > div.ui-div {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 4px 6px;\n width: 100%;\n}\n.ui-drop-down-content > div.ui-div:hover {\n background-color: var(--steel-2);\n cursor: pointer;\n}\n.ui-drop-down-content > div.ui-div > i.grok-icon {\n margin-right: 6px;\n}","",{version:3,sources:["webpack://./node_modules/datagrok-api/css/drop-down.css"],names:[],mappings:"AAAA;IACI,kBAAkB;IAClB,aAAa;IACb,mBAAmB;IACnB,kBAAkB;IAClB,cAAc;IACd,gBAAgB;IAChB,oBAAoB;IACpB,wBAAwB;AAC5B;;AAEA;IACI,YAAY;IACZ,iBAAiB;IACjB,2BAA2B;IAC3B,mBAAmB;IACnB,yDAAyD;AAC7D;;AAEA;IACI,aAAa;IACb,+BAA+B;IAC/B,kBAAkB;IAClB,yBAAyB;IACzB,YAAY;AAChB;;AAEA;IACI,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,kBAAkB;IAClB,WAAW;IACX,WAAW;IACX,aAAa;IACb,yBAAyB;AAC7B;;AAEA;IACI,kBAAkB;IAClB,UAAU;IACV,SAAS;IACT,aAAa;IACb,2BAA2B;IAC3B,sBAAsB;IACtB,mBAAmB;IACnB,+BAA+B;IAC/B,aAAa;IACb,mBAAmB;IACnB,gBAAgB;IAChB,kBAAkB;IAClB,UAAU;IACV;wBACoB;AACxB;;AAEA;IACI,sBAAsB;AAC1B;;AAEA;IACI,eAAe;IACf,oBAAoB;IACpB,aAAa;AACjB;;AAEA;IACI,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,WAAW;AACf;AACA;IACI,gCAAgC;IAChC,eAAe;AACnB;AACA;IACI,iBAAiB;AACrB",sourcesContent:[".ui-drop-down-root {\n position: relative;\n display: flex;\n align-items: center;\n min-width: initial;\n width: initial;\n max-height: 24px;\n padding: 0 7px 0 2px;\n margin: 2px 11px 2px 2px;\n}\n\n.ui-drop-down-root::after {\n content: ' ';\n margin-right: 2px;\n border-width: 4px 4px 0 4px;\n border-style: solid;\n border-color: #40607f transparent transparent transparent;\n}\n\n.ui-drop-down-root.ui-drop-down-root-expanded {\n z-index: 4000;\n box-shadow: 0px 0px 2px #40607F;\n border-radius: 1px;\n background-color: #ECEFF2;\n flex-grow: 1;\n}\n\n.ui-drop-down-root.ui-drop-down-root-expanded::before {\n content: ' ';\n bottom: -1px;\n left: 0;\n position: absolute;\n width: 100%;\n height: 5px;\n z-index: 4002;\n background-color: #ECEFF2;\n}\n\n.ui-drop-down-content {\n position: absolute;\n left: -2px;\n top: 25px;\n display: flex;\n justify-content: flex-start;\n flex-direction: column;\n align-items: center;\n box-shadow: 0px 0px 2px #40607F;\n z-index: 4000;\n background: #ECEFF2;\n min-width: 110px;\n width: max-content;\n padding: 0;\n /*padding: 6px 12px;\n visibility: hidden;*/\n}\n\n.d4-ribbon-item > .ui-drop-down-root {\n /*margin-right: 11px;*/\n}\n\n.ui-drop-down-root > .ui-combo-drop-down-fixed {\n position: fixed;\n align-self: baseline;\n z-index: 4001;\n}\n\n.ui-drop-down-content > div.ui-div {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 4px 6px;\n width: 100%;\n}\n.ui-drop-down-content > div.ui-div:hover {\n background-color: var(--steel-2);\n cursor: pointer;\n}\n.ui-drop-down-content > div.ui-div > i.grok-icon {\n margin-right: 6px;\n}"],sourceRoot:""}]);const u=a},782:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(15),o=n.n(r),i=n(645),a=n.n(i)()(o());a.push([e.id,".ui-input-root.ui-input-tags {\n flex-direction: column;\n}\n\n.ui-tag-list {\n position: relative;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n padding: 4px 0;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root {\n max-width: initial;\n width: 100%;\n flex-grow: 1;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root:last-child {\n padding: 0;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root:last-child > label.ui-input-label {\n display: none;\n}\n\n.ui-tag {\n color: var(--grey-5);\n display: inline-flex;\n padding: 3px 6px;\n align-items: center;\n text-align: center;\n line-height: 1;\n background-color: var(--grey-1);\n margin: 1px;\n text-decoration: none;\n white-space: nowrap;\n border-radius: 2px;\n font-size: 12px;\n}\n\n.ui-tag span {\n white-space: nowrap;\n overflow: hidden;\n max-width: 200px;\n text-overflow: ellipsis;\n}\n\n.ui-tag > input {\n max-width: 65px;\n font-size: 12px;\n height: 11px;\n max-height: 11px;\n padding: 0;\n margin: 0;\n}\n\n.ui-tag > input:focus {\n background:none;\n outline: none;\n border: none;\n border-bottom: 1px solid var(--blue-1);\n}\n","",{version:3,sources:["webpack://./node_modules/datagrok-api/css/tags-input.css"],names:[],mappings:"AAAA;IACI,sBAAsB;AAC1B;;AAEA;IACI,kBAAkB;IAClB,aAAa;IACb,mBAAmB;IACnB,eAAe;IACf,cAAc;AAClB;;AAEA;IACI,kBAAkB;IAClB,WAAW;IACX,YAAY;AAChB;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,aAAa;AACjB;;AAEA;IACI,oBAAoB;IACpB,oBAAoB;IACpB,gBAAgB;IAChB,mBAAmB;IACnB,kBAAkB;IAClB,cAAc;IACd,+BAA+B;IAC/B,WAAW;IACX,qBAAqB;IACrB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;AACnB;;AAEA;IACI,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,uBAAuB;AAC3B;;AAEA;IACI,eAAe;IACf,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,SAAS;AACb;;AAEA;IACI,eAAe;IACf,aAAa;IACb,YAAY;IACZ,sCAAsC;AAC1C",sourcesContent:[".ui-input-root.ui-input-tags {\n flex-direction: column;\n}\n\n.ui-tag-list {\n position: relative;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n padding: 4px 0;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root {\n max-width: initial;\n width: 100%;\n flex-grow: 1;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root:last-child {\n padding: 0;\n}\n\n.ui-form.ui-form-condensed .ui-input-root.ui-input-tags > .ui-input-root:last-child > label.ui-input-label {\n display: none;\n}\n\n.ui-tag {\n color: var(--grey-5);\n display: inline-flex;\n padding: 3px 6px;\n align-items: center;\n text-align: center;\n line-height: 1;\n background-color: var(--grey-1);\n margin: 1px;\n text-decoration: none;\n white-space: nowrap;\n border-radius: 2px;\n font-size: 12px;\n}\n\n.ui-tag span {\n white-space: nowrap;\n overflow: hidden;\n max-width: 200px;\n text-overflow: ellipsis;\n}\n\n.ui-tag > input {\n max-width: 65px;\n font-size: 12px;\n height: 11px;\n max-height: 11px;\n padding: 0;\n margin: 0;\n}\n\n.ui-tag > input:focus {\n background:none;\n outline: none;\n border: none;\n border-bottom: 1px solid var(--blue-1);\n}\n"],sourceRoot:""}]);const u=a},181:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(15),o=n.n(r),i=n(645),a=n.n(i)()(o());a.push([e.id,".typeahead-standalone {\n display: flex;\n position: relative;\n flex-grow: 0;\n}\n\n.ui-form .ui-input-root > .typeahead-standalone {\n flex-grow: 1;\n}\n\n.ui-form.ui-form-condensed .typeahead-standalone.ui-input-root {\n padding: 0;\n}\n\n.ui-form.ui-form-condensed > .ui-input-root > .typeahead-standalone .tt-hint {\n line-height: 1.25;\n}\n\n.typeahead-standalone .ui-input-editor{\n position: relative;\n z-index: 1;\n min-width: 30px;\n flex-grow: 1;\n padding: 0 4px;\n background: transparent;\n}\n\n.typeahead-standalone .tt-hint {\n background: #fff;\n color: silver;\n cursor: default;\n left: 0;\n position: absolute;\n user-select: none;\n z-index: 0;\n padding: 6px 4px;\n border: none;\n}\n\n.typeahead-standalone .ui-input-list {\n display: block;\n position: absolute;\n width: 100%;\n left: 0px;\n z-index: 4000;\n background: white;\n top: 28px;\n box-shadow: 0px 2px 4px var(--grey-3);\n transition: box-shadow 200ms ease-in-out;\n}\n\n.tt-suggestion {\n background: white;\n color: var(--grey-6);\n padding: 4px;\n}\n\n.tt-suggestion:hover {\n cursor: pointer;\n background: var(--grey-1);\n color: var(--grey-6);\n padding: 4px;\n}\n\n.typeahead-standalone > .ui-input-list.tt-hide {\n display: none;\n}\n\n.tt-suggestion.tt-selected {\n cursor: pointer;\n background: var(--grey-1);\n color: var(--grey-6);\n padding: 4px;\n}\n\n.typeahead-standalone .ui-input-list .tt-suggestion .tt-highlight {\n font-weight: 900;\n}\n","",{version:3,sources:["webpack://./node_modules/datagrok-api/css/typeahead-input.css"],names:[],mappings:"AAAA;IACI,aAAa;IACb,kBAAkB;IAClB,YAAY;AAChB;;AAEA;IACI,YAAY;AAChB;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,kBAAkB;IAClB,UAAU;IACV,eAAe;IACf,YAAY;IACZ,cAAc;IACd,uBAAuB;AAC3B;;AAEA;IACI,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,OAAO;IACP,kBAAkB;IAClB,iBAAiB;IACjB,UAAU;IACV,gBAAgB;IAChB,YAAY;AAChB;;AAEA;IACI,cAAc;IACd,kBAAkB;IAClB,WAAW;IACX,SAAS;IACT,aAAa;IACb,iBAAiB;IACjB,SAAS;IACT,qCAAqC;IACrC,wCAAwC;AAC5C;;AAEA;IACI,iBAAiB;IACjB,oBAAoB;IACpB,YAAY;AAChB;;AAEA;IACI,eAAe;IACf,yBAAyB;IACzB,oBAAoB;IACpB,YAAY;AAChB;;AAEA;IACI,aAAa;AACjB;;AAEA;IACI,eAAe;IACf,yBAAyB;IACzB,oBAAoB;IACpB,YAAY;AAChB;;AAEA;IACI,gBAAgB;AACpB",sourcesContent:[".typeahead-standalone {\n display: flex;\n position: relative;\n flex-grow: 0;\n}\n\n.ui-form .ui-input-root > .typeahead-standalone {\n flex-grow: 1;\n}\n\n.ui-form.ui-form-condensed .typeahead-standalone.ui-input-root {\n padding: 0;\n}\n\n.ui-form.ui-form-condensed > .ui-input-root > .typeahead-standalone .tt-hint {\n line-height: 1.25;\n}\n\n.typeahead-standalone .ui-input-editor{\n position: relative;\n z-index: 1;\n min-width: 30px;\n flex-grow: 1;\n padding: 0 4px;\n background: transparent;\n}\n\n.typeahead-standalone .tt-hint {\n background: #fff;\n color: silver;\n cursor: default;\n left: 0;\n position: absolute;\n user-select: none;\n z-index: 0;\n padding: 6px 4px;\n border: none;\n}\n\n.typeahead-standalone .ui-input-list {\n display: block;\n position: absolute;\n width: 100%;\n left: 0px;\n z-index: 4000;\n background: white;\n top: 28px;\n box-shadow: 0px 2px 4px var(--grey-3);\n transition: box-shadow 200ms ease-in-out;\n}\n\n.tt-suggestion {\n background: white;\n color: var(--grey-6);\n padding: 4px;\n}\n\n.tt-suggestion:hover {\n cursor: pointer;\n background: var(--grey-1);\n color: var(--grey-6);\n padding: 4px;\n}\n\n.typeahead-standalone > .ui-input-list.tt-hide {\n display: none;\n}\n\n.tt-suggestion.tt-selected {\n cursor: pointer;\n background: var(--grey-1);\n color: var(--grey-6);\n padding: 4px;\n}\n\n.typeahead-standalone .ui-input-list .tt-suggestion .tt-highlight {\n font-weight: 900;\n}\n"],sourceRoot:""}]);const u=a},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var i=0;i<this.length;i++){var a=this[i][0];null!=a&&(o[a]=!0)}for(var u=0;u<e.length;u++){var s=[].concat(e[u]);r&&o[s[0]]||(n&&(s[2]?s[2]="".concat(n," and ").concat(s[2]):s[2]=n),t.push(s))}},t}},15:e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}e.exports=function(e){var n,r,o=(r=4,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}}(n,r)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[1],a=o[3];if(!a)return i;if("function"==typeof btoa){var u=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(u),c="/*# ".concat(s," */"),l=a.sources.map((function(e){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(e," */")}));return[i].concat(l).concat([c]).join("\n")}return[i].join("\n")}},162:function(e){var t;e.exports=(t=function(e,t){var n=Array.prototype.concat,r=Array.prototype.slice,o=Object.prototype.toString;function i(t,n){var r=t>n?t:n;return e.pow(10,17-~~(e.log(r>0?r:-r)*e.LOG10E))}var a=Array.isArray||function(e){return"[object Array]"===o.call(e)};function u(e){return"[object Function]"===o.call(e)}function s(e){return"number"==typeof e&&e-e==0}function c(){return new c._init(arguments)}function l(){return 0}function f(){return 1}function m(e,t){return e===t?1:0}c.fn=c.prototype,c._init=function(e){if(a(e[0]))if(a(e[0][0])){u(e[1])&&(e[0]=c.map(e[0],e[1]));for(var t=0;t<e[0].length;t++)this[t]=e[0][t];this.length=e[0].length}else this[0]=u(e[1])?c.map(e[0],e[1]):e[0],this.length=1;else if(s(e[0]))this[0]=c.seq.apply(null,e),this.length=1;else{if(e[0]instanceof c)return c(e[0].toArray());this[0]=[],this.length=1}return this},c._init.prototype=c.prototype,c._init.constructor=c,c.utils={calcRdx:i,isArray:a,isFunction:u,isNumber:s,toVector:function(e){return n.apply([],e)}},c._random_fn=e.random,c.setRandom=function(e){if("function"!=typeof e)throw new TypeError("fn is not a function");c._random_fn=e},c.extend=function(e){var t,n;if(1===arguments.length){for(n in e)c[n]=e[n];return this}for(t=1;t<arguments.length;t++)for(n in arguments[t])e[n]=arguments[t][n];return e},c.rows=function(e){return e.length||1},c.cols=function(e){return e[0].length||1},c.dimensions=function(e){return{rows:c.rows(e),cols:c.cols(e)}},c.row=function(e,t){return a(t)?t.map((function(t){return c.row(e,t)})):e[t]},c.rowa=function(e,t){return c.row(e,t)},c.col=function(e,t){if(a(t)){var n=c.arange(e.length).map((function(){return new Array(t.length)}));return t.forEach((function(t,r){c.arange(e.length).forEach((function(o){n[o][r]=e[o][t]}))})),n}for(var r=new Array(e.length),o=0;o<e.length;o++)r[o]=[e[o][t]];return r},c.cola=function(e,t){return c.col(e,t).map((function(e){return e[0]}))},c.diag=function(e){for(var t=c.rows(e),n=new Array(t),r=0;r<t;r++)n[r]=[e[r][r]];return n},c.antidiag=function(e){for(var t=c.rows(e)-1,n=new Array(t),r=0;t>=0;t--,r++)n[r]=[e[r][t]];return n},c.transpose=function(e){var t,n,r,o,i,u=[];for(a(e[0])||(e=[e]),n=e.length,r=e[0].length,i=0;i<r;i++){for(t=new Array(n),o=0;o<n;o++)t[o]=e[o][i];u.push(t)}return 1===u.length?u[0]:u},c.map=function(e,t,n){var r,o,i,u,s;for(a(e[0])||(e=[e]),o=e.length,i=e[0].length,u=n?e:new Array(o),r=0;r<o;r++)for(u[r]||(u[r]=new Array(i)),s=0;s<i;s++)u[r][s]=t(e[r][s],r,s);return 1===u.length?u[0]:u},c.cumreduce=function(e,t,n){var r,o,i,u,s;for(a(e[0])||(e=[e]),o=e.length,i=e[0].length,u=n?e:new Array(o),r=0;r<o;r++)for(u[r]||(u[r]=new Array(i)),i>0&&(u[r][0]=e[r][0]),s=1;s<i;s++)u[r][s]=t(u[r][s-1],e[r][s]);return 1===u.length?u[0]:u},c.alter=function(e,t){return c.map(e,t,!0)},c.create=function(e,t,n){var r,o,i=new Array(e);for(u(t)&&(n=t,t=e),r=0;r<e;r++)for(i[r]=new Array(t),o=0;o<t;o++)i[r][o]=n(r,o);return i},c.zeros=function(e,t){return s(t)||(t=e),c.create(e,t,l)},c.ones=function(e,t){return s(t)||(t=e),c.create(e,t,f)},c.rand=function(e,t){return s(t)||(t=e),c.create(e,t,c._random_fn)},c.identity=function(e,t){return s(t)||(t=e),c.create(e,t,m)},c.symmetric=function(e){var t,n,r=e.length;if(e.length!==e[0].length)return!1;for(t=0;t<r;t++)for(n=0;n<r;n++)if(e[n][t]!==e[t][n])return!1;return!0},c.clear=function(e){return c.alter(e,l)},c.seq=function(e,t,n,r){u(r)||(r=!1);var o,a=[],s=i(e,t),c=(t*s-e*s)/((n-1)*s),l=e;for(o=0;l<=t&&o<n;l=(e*s+c*s*++o)/s)a.push(r?r(l,o):l);return a},c.arange=function(e,n,r){var o,i=[];if(r=r||1,n===t&&(n=e,e=0),e===n||0===r)return[];if(e<n&&r<0)return[];if(e>n&&r>0)return[];if(r>0)for(o=e;o<n;o+=r)i.push(o);else for(o=e;o>n;o+=r)i.push(o);return i},c.slice=function(){function e(e,n,r,o){var i,a=[],u=e.length;if(n===t&&r===t&&o===t)return c.copy(e);if(o=o||1,(n=(n=n||0)>=0?n:u+n)===(r=(r=r||e.length)>=0?r:u+r)||0===o)return[];if(n<r&&o<0)return[];if(n>r&&o>0)return[];if(o>0)for(i=n;i<r;i+=o)a.push(e[i]);else for(i=n;i>r;i+=o)a.push(e[i]);return a}return function(t,n){var r,o;return s((n=n||{}).row)?s(n.col)?t[n.row][n.col]:e(c.rowa(t,n.row),(r=n.col||{}).start,r.end,r.step):s(n.col)?e(c.cola(t,n.col),(o=n.row||{}).start,o.end,o.step):(o=n.row||{},r=n.col||{},e(t,o.start,o.end,o.step).map((function(t){return e(t,r.start,r.end,r.step)})))}}(),c.sliceAssign=function(n,r,o){var i,a;if(s(r.row)){if(s(r.col))return n[r.row][r.col]=o;r.col=r.col||{},r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,i=c.arange(r.col.start,e.min(n.length,r.col.end),r.col.step);var u=r.row;return i.forEach((function(e,t){n[u][e]=o[t]})),n}if(s(r.col)){r.row=r.row||{},r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,a=c.arange(r.row.start,e.min(n[0].length,r.row.end),r.row.step);var l=r.col;return a.forEach((function(e,t){n[e][l]=o[t]})),n}return o[0].length===t&&(o=[o]),r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,a=c.arange(r.row.start,e.min(n.length,r.row.end),r.row.step),i=c.arange(r.col.start,e.min(n[0].length,r.col.end),r.col.step),a.forEach((function(e,t){i.forEach((function(r,i){n[e][r]=o[t][i]}))})),n},c.diagonal=function(e){var t=c.zeros(e.length,e.length);return e.forEach((function(e,n){t[n][n]=e})),t},c.copy=function(e){return e.map((function(e){return s(e)?e:e.map((function(e){return e}))}))};var h=c.prototype;return h.length=0,h.push=Array.prototype.push,h.sort=Array.prototype.sort,h.splice=Array.prototype.splice,h.slice=Array.prototype.slice,h.toArray=function(){return this.length>1?r.call(this):r.call(this)[0]},h.map=function(e,t){return c(c.map(this,e,t))},h.cumreduce=function(e,t){return c(c.cumreduce(this,e,t))},h.alter=function(e){return c.alter(this,e),this},function(e){for(var t=0;t<e.length;t++)!function(e){h[e]=function(t){var n,r=this;return t?(setTimeout((function(){t.call(r,h[e].call(r))})),this):(n=c[e](this),a(n)?c(n):n)}}(e[t])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(e){for(var t=0;t<e.length;t++)!function(e){h[e]=function(t,n){var r=this;return n?(setTimeout((function(){n.call(r,h[e].call(r,t))})),this):c(c[e](this,t))}}(e[t])}("row col".split(" ")),function(e){for(var t=0;t<e.length;t++)!function(e){h[e]=function(){return c(c[e].apply(null,arguments))}}(e[t])}("create zeros ones rand identity".split(" ")),c}(Math),function(e,t){var n=e.utils.isFunction;function r(e,t){return e-t}function o(e,n,r){return t.max(n,t.min(e,r))}e.sum=function(e){for(var t=0,n=e.length;--n>=0;)t+=e[n];return t},e.sumsqrd=function(e){for(var t=0,n=e.length;--n>=0;)t+=e[n]*e[n];return t},e.sumsqerr=function(t){for(var n,r=e.mean(t),o=0,i=t.length;--i>=0;)o+=(n=t[i]-r)*n;return o},e.sumrow=function(e){for(var t=0,n=e.length;--n>=0;)t+=e[n];return t},e.product=function(e){for(var t=1,n=e.length;--n>=0;)t*=e[n];return t},e.min=function(e){for(var t=e[0],n=0;++n<e.length;)e[n]<t&&(t=e[n]);return t},e.max=function(e){for(var t=e[0],n=0;++n<e.length;)e[n]>t&&(t=e[n]);return t},e.unique=function(e){for(var t={},n=[],r=0;r<e.length;r++)t[e[r]]||(t[e[r]]=!0,n.push(e[r]));return n},e.mean=function(t){return e.sum(t)/t.length},e.meansqerr=function(t){return e.sumsqerr(t)/t.length},e.geomean=function(n){var r=n.map(t.log),o=e.mean(r);return t.exp(o)},e.median=function(e){var t=e.length,n=e.slice().sort(r);return 1&t?n[t/2|0]:(n[t/2-1]+n[t/2])/2},e.cumsum=function(t){return e.cumreduce(t,(function(e,t){return e+t}))},e.cumprod=function(t){return e.cumreduce(t,(function(e,t){return e*t}))},e.diff=function(e){var t,n=[],r=e.length;for(t=1;t<r;t++)n.push(e[t]-e[t-1]);return n},e.rank=function(e){var t,n=[],o={};for(t=0;t<e.length;t++)o[s=e[t]]?o[s]++:(o[s]=1,n.push(s));var i=n.sort(r),a={},u=1;for(t=0;t<i.length;t++){var s,c=o[s=i[t]],l=(u+(u+c-1))/2;a[s]=l,u+=c}return e.map((function(e){return a[e]}))},e.mode=function(e){var t,n=e.length,o=e.slice().sort(r),i=1,a=0,u=0,s=[];for(t=0;t<n;t++)o[t]===o[t+1]?i++:(i>a?(s=[o[t]],a=i,u=0):i===a&&(s.push(o[t]),u++),i=1);return 0===u?s[0]:s},e.range=function(t){return e.max(t)-e.min(t)},e.variance=function(t,n){return e.sumsqerr(t)/(t.length-(n?1:0))},e.pooledvariance=function(t){return t.reduce((function(t,n){return t+e.sumsqerr(n)}),0)/(t.reduce((function(e,t){return e+t.length}),0)-t.length)},e.deviation=function(t){for(var n=e.mean(t),r=t.length,o=new Array(r),i=0;i<r;i++)o[i]=t[i]-n;return o},e.stdev=function(n,r){return t.sqrt(e.variance(n,r))},e.pooledstdev=function(n){return t.sqrt(e.pooledvariance(n))},e.meandev=function(n){for(var r=e.mean(n),o=[],i=n.length-1;i>=0;i--)o.push(t.abs(n[i]-r));return e.mean(o)},e.meddev=function(n){for(var r=e.median(n),o=[],i=n.length-1;i>=0;i--)o.push(t.abs(n[i]-r));return e.median(o)},e.coeffvar=function(t){return e.stdev(t)/e.mean(t)},e.quartiles=function(e){var n=e.length,o=e.slice().sort(r);return[o[t.round(n/4)-1],o[t.round(n/2)-1],o[t.round(3*n/4)-1]]},e.quantiles=function(e,n,i,a){var u,s,c,l,f,m=e.slice().sort(r),h=[n.length],d=e.length;for(void 0===i&&(i=3/8),void 0===a&&(a=3/8),u=0;u<n.length;u++)c=d*(s=n[u])+(i+s*(1-i-a)),l=t.floor(o(c,1,d-1)),f=o(c-l,0,1),h[u]=(1-f)*m[l-1]+f*m[l];return h},e.percentile=function(e,t,n){var o=e.slice().sort(r),i=t*(o.length+(n?1:-1))+(n?0:1),a=parseInt(i),u=i-a;return a+1<o.length?o[a-1]+u*(o[a]-o[a-1]):o[a-1]},e.percentileOfScore=function(e,t,n){var r,o,i=0,a=e.length,u=!1;for("strict"===n&&(u=!0),o=0;o<a;o++)r=e[o],(u&&r<t||!u&&r<=t)&&i++;return i/a},e.histogram=function(n,r){r=r||4;var o,i=e.min(n),a=(e.max(n)-i)/r,u=n.length,s=[];for(o=0;o<r;o++)s[o]=0;for(o=0;o<u;o++)s[t.min(t.floor((n[o]-i)/a),r-1)]+=1;return s},e.covariance=function(t,n){var r,o=e.mean(t),i=e.mean(n),a=t.length,u=new Array(a);for(r=0;r<a;r++)u[r]=(t[r]-o)*(n[r]-i);return e.sum(u)/(a-1)},e.corrcoeff=function(t,n){return e.covariance(t,n)/e.stdev(t,1)/e.stdev(n,1)},e.spearmancoeff=function(t,n){return t=e.rank(t),n=e.rank(n),e.corrcoeff(t,n)},e.stanMoment=function(n,r){for(var o=e.mean(n),i=e.stdev(n),a=n.length,u=0,s=0;s<a;s++)u+=t.pow((n[s]-o)/i,r);return u/n.length},e.skewness=function(t){return e.stanMoment(t,3)},e.kurtosis=function(t){return e.stanMoment(t,4)-3};var i=e.prototype;!function(t){for(var r=0;r<t.length;r++)!function(t){i[t]=function(r,o){var a=[],u=0,s=this;if(n(r)&&(o=r,r=!1),o)return setTimeout((function(){o.call(s,i[t].call(s,r))})),this;if(this.length>1){for(s=!0===r?this:this.transpose();u<s.length;u++)a[u]=e[t](s[u]);return a}return e[t](this[0],r)}}(t[r])}("cumsum cumprod".split(" ")),function(t){for(var r=0;r<t.length;r++)!function(t){i[t]=function(r,o){var a=[],u=0,s=this;if(n(r)&&(o=r,r=!1),o)return setTimeout((function(){o.call(s,i[t].call(s,r))})),this;if(this.length>1){for("sumrow"!==t&&(s=!0===r?this:this.transpose());u<s.length;u++)a[u]=e[t](s[u]);return!0===r?e[t](e.utils.toVector(a)):a}return e[t](this[0],r)}}(t[r])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(t){for(var r=0;r<t.length;r++)!function(t){i[t]=function(){var r,o=[],a=0,u=this,s=Array.prototype.slice.call(arguments);if(n(s[s.length-1])){r=s[s.length-1];var c=s.slice(0,s.length-1);return setTimeout((function(){r.call(u,i[t].apply(u,c))})),this}r=void 0;var l=function(n){return e[t].apply(u,[n].concat(s))};if(this.length>1){for(u=u.transpose();a<u.length;a++)o[a]=l(u[a]);return o}return l(this[0])}}(t[r])}("quantiles percentileOfScore".split(" "))}(t,Math),function(e,t){e.gammaln=function(e){var n,r,o,i=0,a=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],u=1.000000000190015;for(o=(r=n=e)+5.5,o-=(n+.5)*t.log(o);i<6;i++)u+=a[i]/++r;return t.log(2.5066282746310007*u/n)-o},e.loggam=function(e){var n,r,o,i,a,u,s,c=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(n=e,s=0,1==e||2==e)return 0;for(e<=7&&(n=e+(s=t.floor(7-e))),r=1/(n*n),o=2*t.PI,a=c[9],u=8;u>=0;u--)a*=r,a+=c[u];if(i=a/n+.5*t.log(o)+(n-.5)*t.log(n)-n,e<=7)for(u=1;u<=s;u++)i-=t.log(n-1),n-=1;return i},e.gammafn=function(e){var n,r,o,i,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],u=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,c=0,l=0,f=0,m=e;if(e>171.6243769536076)return 1/0;if(m<=0){if(!(i=m%1+36e-17))return 1/0;s=(1&m?-1:1)*t.PI/t.sin(t.PI*i),m=1-m}for(o=m,r=m<1?m++:(m-=c=(0|m)-1)-1,n=0;n<8;++n)f=(f+a[n])*r,l=l*r+u[n];if(i=f/l+1,o<m)i/=o;else if(o>m)for(n=0;n<c;++n)i*=m,m++;return s&&(i=s/i),i},e.gammap=function(t,n){return e.lowRegGamma(t,n)*e.gammafn(t)},e.lowRegGamma=function(n,r){var o,i=e.gammaln(n),a=n,u=1/n,s=u,c=r+1-n,l=1/1e-30,f=1/c,m=f,h=1,d=-~(8.5*t.log(n>=1?n:1/n)+.4*n+17);if(r<0||n<=0)return NaN;if(r<n+1){for(;h<=d;h++)u+=s*=r/++a;return u*t.exp(-r+n*t.log(r)-i)}for(;h<=d;h++)m*=(f=1/(f=(o=-h*(h-n))*f+(c+=2)))*(l=c+o/l);return 1-m*t.exp(-r+n*t.log(r)-i)},e.factorialln=function(t){return t<0?NaN:e.gammaln(t+1)},e.factorial=function(t){return t<0?NaN:e.gammafn(t+1)},e.combination=function(n,r){return n>170||r>170?t.exp(e.combinationln(n,r)):e.factorial(n)/e.factorial(r)/e.factorial(n-r)},e.combinationln=function(t,n){return e.factorialln(t)-e.factorialln(n)-e.factorialln(t-n)},e.permutation=function(t,n){return e.factorial(t)/e.factorial(t-n)},e.betafn=function(n,r){if(!(n<=0||r<=0))return n+r>170?t.exp(e.betaln(n,r)):e.gammafn(n)*e.gammafn(r)/e.gammafn(n+r)},e.betaln=function(t,n){return e.gammaln(t)+e.gammaln(n)-e.gammaln(t+n)},e.betacf=function(e,n,r){var o,i,a,u,s=1e-30,c=1,l=n+r,f=n+1,m=n-1,h=1,d=1-l*e/f;for(t.abs(d)<s&&(d=s),u=d=1/d;c<=100&&(d=1+(i=c*(r-c)*e/((m+(o=2*c))*(n+o)))*d,t.abs(d)<s&&(d=s),h=1+i/h,t.abs(h)<s&&(h=s),u*=(d=1/d)*h,d=1+(i=-(n+c)*(l+c)*e/((n+o)*(f+o)))*d,t.abs(d)<s&&(d=s),h=1+i/h,t.abs(h)<s&&(h=s),u*=a=(d=1/d)*h,!(t.abs(a-1)<3e-7));c++);return u},e.gammapinv=function(n,r){var o,i,a,u,s,c,l=0,f=r-1,m=e.gammaln(r);if(n>=1)return t.max(100,r+100*t.sqrt(r));if(n<=0)return 0;for(r>1?(s=t.log(f),c=t.exp(f*(s-1)-m),u=n<.5?n:1-n,o=(2.30753+.27061*(i=t.sqrt(-2*t.log(u))))/(1+i*(.99229+.04481*i))-i,n<.5&&(o=-o),o=t.max(.001,r*t.pow(1-1/(9*r)-o/(3*t.sqrt(r)),3))):o=n<(i=1-r*(.253+.12*r))?t.pow(n/i,1/r):1-t.log(1-(n-i)/(1-i));l<12;l++){if(o<=0)return 0;if((o-=i=(a=(e.lowRegGamma(r,o)-n)/(i=r>1?c*t.exp(-(o-f)+f*(t.log(o)-s)):t.exp(-o+f*t.log(o)-m)))/(1-.5*t.min(1,a*((r-1)/o-1))))<=0&&(o=.5*(o+i)),t.abs(i)<1e-8*o)break}return o},e.erf=function(e){var n,r,o,i,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],u=a.length-1,s=!1,c=0,l=0;for(e<0&&(e=-e,s=!0),r=4*(n=2/(2+e))-2;u>0;u--)o=c,c=r*c-l+a[u],l=o;return i=n*t.exp(-e*e+.5*(a[0]+r*c)-l),s?i-1:1-i},e.erfc=function(t){return 1-e.erf(t)},e.erfcinv=function(n){var r,o,i,a,u=0;if(n>=2)return-100;if(n<=0)return 100;for(a=n<1?n:2-n,r=-.70711*((2.30753+.27061*(i=t.sqrt(-2*t.log(a/2))))/(1+i*(.99229+.04481*i))-i);u<2;u++)r+=(o=e.erfc(r)-a)/(1.1283791670955126*t.exp(-r*r)-r*o);return n<1?r:-r},e.ibetainv=function(n,r,o){var i,a,u,s,c,l,f,m,h,d,p=r-1,g=o-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(r>=1&&o>=1?(u=n<.5?n:1-n,l=(2.30753+.27061*(s=t.sqrt(-2*t.log(u))))/(1+s*(.99229+.04481*s))-s,n<.5&&(l=-l),f=(l*l-3)/6,m=2/(1/(2*r-1)+1/(2*o-1)),h=l*t.sqrt(f+m)/m-(1/(2*o-1)-1/(2*r-1))*(f+5/6-2/(3*m)),l=r/(r+o*t.exp(2*h))):(i=t.log(r/(r+o)),a=t.log(o/(r+o)),l=n<(s=t.exp(r*i)/r)/(h=s+(c=t.exp(o*a)/o))?t.pow(r*h*n,1/r):1-t.pow(o*h*(1-n),1/o)),d=-e.gammaln(r)-e.gammaln(o)+e.gammaln(r+o);v<10;v++){if(0===l||1===l)return l;if((l-=s=(c=(e.ibeta(l,r,o)-n)/(s=t.exp(p*t.log(l)+g*t.log(1-l)+d)))/(1-.5*t.min(1,c*(p/l-g/(1-l)))))<=0&&(l=.5*(l+s)),l>=1&&(l=.5*(l+s+1)),t.abs(s)<1e-8*l&&v>0)break}return l},e.ibeta=function(n,r,o){var i=0===n||1===n?0:t.exp(e.gammaln(r+o)-e.gammaln(r)-e.gammaln(o)+r*t.log(n)+o*t.log(1-n));return!(n<0||n>1)&&(n<(r+1)/(r+o+2)?i*e.betacf(n,r,o)/r:1-i*e.betacf(1-n,o,r)/o)},e.randn=function(n,r){var o,i,a,u,s;if(r||(r=n),n)return e.create(n,r,(function(){return e.randn()}));do{o=e._random_fn(),i=1.7156*(e._random_fn()-.5),s=(a=o-.449871)*a+(u=t.abs(i)+.386595)*(.196*u-.25472*a)}while(s>.27597&&(s>.27846||i*i>-4*t.log(o)*o*o));return i/o},e.randg=function(n,r,o){var i,a,u,s,c,l,f=n;if(o||(o=r),n||(n=1),r)return(l=e.zeros(r,o)).alter((function(){return e.randg(n)})),l;n<1&&(n+=1),i=n-1/3,a=1/t.sqrt(9*i);do{do{s=1+a*(c=e.randn())}while(s<=0);s*=s*s,u=e._random_fn()}while(u>1-.331*t.pow(c,4)&&t.log(u)>.5*c*c+i*(1-s+t.log(s)));if(n==f)return i*s;do{u=e._random_fn()}while(0===u);return t.pow(u,1/f)*i*s},function(t){for(var n=0;n<t.length;n++)!function(t){e.fn[t]=function(){return e(e.map(this,(function(n){return e[t](n)})))}}(t[n])}("gammaln gammafn factorial factorialln".split(" ")),function(t){for(var n=0;n<t.length;n++)!function(t){e.fn[t]=function(){return e(e[t].apply(null,arguments))}}(t[n])}("randn".split(" "))}(t,Math),function(e,t){function n(e,n,r,o){for(var i,a=0,u=1,s=1,c=1,l=0,f=0;t.abs((s-f)/s)>o;)f=s,u=c+(i=-(n+l)*(n+r+l)*e/(n+2*l)/(n+2*l+1))*u,s=(a=s+i*a)+(i=(l+=1)*(r-l)*e/(n+2*l-1)/(n+2*l))*s,a/=c=u+i*c,u/=c,s/=c,c=1;return s/n}function r(n,r,o){var i=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],a=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],u=.5*n;if(u>=8)return 1;var s,c=2*e.normal.cdf(u,0,1,1,0)-1;c=c>=t.exp(-50/o)?t.pow(c,o):0;for(var l=u,f=(8-u)/(s=n>3?2:3),m=l+f,h=0,d=o-1,p=1;p<=s;p++){for(var g=0,v=.5*(m+l),y=.5*(m-l),A=1;A<=12;A++){var x,w=v+y*(6<A?i[(x=12-A+1)-1]:-i[(x=A)-1]),b=w*w;if(b>60)break;var C=2*e.normal.cdf(w,0,1,1,0)*.5-2*e.normal.cdf(w,n,1,1,0)*.5;C>=t.exp(-30/d)&&(g+=C=a[x-1]*t.exp(-.5*b)*t.pow(C,d))}h+=g*=2*y*o/t.sqrt(2*t.PI),l=m,m+=f}return(c+=h)<=t.exp(-30/r)?0:(c=t.pow(c,r))>=1?1:c}!function(t){for(var n=0;n<t.length;n++)!function(t){e[t]=function e(t,n,r){return this instanceof e?(this._a=t,this._b=n,this._c=r,this):new e(t,n,r)},e.fn[t]=function(n,r,o){var i=e[t](n,r,o);return i.data=this,i},e[t].prototype.sample=function(n){var r=this._a,o=this._b,i=this._c;return n?e.alter(n,(function(){return e[t].sample(r,o,i)})):e[t].sample(r,o,i)},function(n){for(var r=0;r<n.length;r++)!function(n){e[t].prototype[n]=function(r){var o=this._a,i=this._b,a=this._c;return r||0===r||(r=this.data),"number"!=typeof r?e.fn.map.call(r,(function(r){return e[t][n](r,o,i,a)})):e[t][n](r,o,i,a)}}(n[r])}("pdf cdf inv".split(" ")),function(n){for(var r=0;r<n.length;r++)!function(n){e[t].prototype[n]=function(){return e[t][n](this._a,this._b,this._c)}}(n[r])}("mean median mode variance".split(" "))}(t[n])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),e.extend(e.beta,{pdf:function(n,r,o){return n>1||n<0?0:1==r&&1==o?1:r<512&&o<512?t.pow(n,r-1)*t.pow(1-n,o-1)/e.betafn(r,o):t.exp((r-1)*t.log(n)+(o-1)*t.log(1-n)-e.betaln(r,o))},cdf:function(t,n,r){return t>1||t<0?1*(t>1):e.ibeta(t,n,r)},inv:function(t,n,r){return e.ibetainv(t,n,r)},mean:function(e,t){return e/(e+t)},median:function(t,n){return e.ibetainv(.5,t,n)},mode:function(e,t){return(e-1)/(e+t-2)},sample:function(t,n){var r=e.randg(t);return r/(r+e.randg(n))},variance:function(e,n){return e*n/(t.pow(e+n,2)*(e+n+1))}}),e.extend(e.centralF,{pdf:function(n,r,o){var i;return n<0?0:r<=2?0===n&&r<2?1/0:0===n&&2===r?1:1/e.betafn(r/2,o/2)*t.pow(r/o,r/2)*t.pow(n,r/2-1)*t.pow(1+r/o*n,-(r+o)/2):(i=r*n/(o+n*r),r*(o/(o+n*r))/2*e.binomial.pdf((r-2)/2,(r+o-2)/2,i))},cdf:function(t,n,r){return t<0?0:e.ibeta(n*t/(n*t+r),n/2,r/2)},inv:function(t,n,r){return r/(n*(1/e.ibetainv(t,n/2,r/2)-1))},mean:function(e,t){return t>2?t/(t-2):void 0},mode:function(e,t){return e>2?t*(e-2)/(e*(t+2)):void 0},sample:function(t,n){return 2*e.randg(t/2)/t/(2*e.randg(n/2)/n)},variance:function(e,t){if(!(t<=4))return 2*t*t*(e+t-2)/(e*(t-2)*(t-2)*(t-4))}}),e.extend(e.cauchy,{pdf:function(e,n,r){return r<0?0:r/(t.pow(e-n,2)+t.pow(r,2))/t.PI},cdf:function(e,n,r){return t.atan((e-n)/r)/t.PI+.5},inv:function(e,n,r){return n+r*t.tan(t.PI*(e-.5))},median:function(e){return e},mode:function(e){return e},sample:function(n,r){return e.randn()*t.sqrt(1/(2*e.randg(.5)))*r+n}}),e.extend(e.chisquare,{pdf:function(n,r){return n<0?0:0===n&&2===r?.5:t.exp((r/2-1)*t.log(n)-n/2-r/2*t.log(2)-e.gammaln(r/2))},cdf:function(t,n){return t<0?0:e.lowRegGamma(n/2,t/2)},inv:function(t,n){return 2*e.gammapinv(t,.5*n)},mean:function(e){return e},median:function(e){return e*t.pow(1-2/(9*e),3)},mode:function(e){return e-2>0?e-2:0},sample:function(t){return 2*e.randg(t/2)},variance:function(e){return 2*e}}),e.extend(e.exponential,{pdf:function(e,n){return e<0?0:n*t.exp(-n*e)},cdf:function(e,n){return e<0?0:1-t.exp(-n*e)},inv:function(e,n){return-t.log(1-e)/n},mean:function(e){return 1/e},median:function(e){return 1/e*t.log(2)},mode:function(){return 0},sample:function(n){return-1/n*t.log(e._random_fn())},variance:function(e){return t.pow(e,-2)}}),e.extend(e.gamma,{pdf:function(n,r,o){return n<0?0:0===n&&1===r?1/o:t.exp((r-1)*t.log(n)-n/o-e.gammaln(r)-r*t.log(o))},cdf:function(t,n,r){return t<0?0:e.lowRegGamma(n,t/r)},inv:function(t,n,r){return e.gammapinv(t,n)*r},mean:function(e,t){return e*t},mode:function(e,t){if(e>1)return(e-1)*t},sample:function(t,n){return e.randg(t)*n},variance:function(e,t){return e*t*t}}),e.extend(e.invgamma,{pdf:function(n,r,o){return n<=0?0:t.exp(-(r+1)*t.log(n)-o/n-e.gammaln(r)+r*t.log(o))},cdf:function(t,n,r){return t<=0?0:1-e.lowRegGamma(n,r/t)},inv:function(t,n,r){return r/e.gammapinv(1-t,n)},mean:function(e,t){return e>1?t/(e-1):void 0},mode:function(e,t){return t/(e+1)},sample:function(t,n){return n/e.randg(t)},variance:function(e,t){if(!(e<=2))return t*t/((e-1)*(e-1)*(e-2))}}),e.extend(e.kumaraswamy,{pdf:function(e,n,r){return 0===e&&1===n?r:1===e&&1===r?n:t.exp(t.log(n)+t.log(r)+(n-1)*t.log(e)+(r-1)*t.log(1-t.pow(e,n)))},cdf:function(e,n,r){return e<0?0:e>1?1:1-t.pow(1-t.pow(e,n),r)},inv:function(e,n,r){return t.pow(1-t.pow(1-e,1/r),1/n)},mean:function(t,n){return n*e.gammafn(1+1/t)*e.gammafn(n)/e.gammafn(1+1/t+n)},median:function(e,n){return t.pow(1-t.pow(2,-1/n),1/e)},mode:function(e,n){if(e>=1&&n>=1&&1!==e&&1!==n)return t.pow((e-1)/(e*n-1),1/e)},variance:function(){throw new Error("variance not yet implemented")}}),e.extend(e.lognormal,{pdf:function(e,n,r){return e<=0?0:t.exp(-t.log(e)-.5*t.log(2*t.PI)-t.log(r)-t.pow(t.log(e)-n,2)/(2*r*r))},cdf:function(n,r,o){return n<0?0:.5+.5*e.erf((t.log(n)-r)/t.sqrt(2*o*o))},inv:function(n,r,o){return t.exp(-1.4142135623730951*o*e.erfcinv(2*n)+r)},mean:function(e,n){return t.exp(e+n*n/2)},median:function(e){return t.exp(e)},mode:function(e,n){return t.exp(e-n*n)},sample:function(n,r){return t.exp(e.randn()*r+n)},variance:function(e,n){return(t.exp(n*n)-1)*t.exp(2*e+n*n)}}),e.extend(e.noncentralt,{pdf:function(n,r,o){return t.abs(o)<1e-14?e.studentt.pdf(n,r):t.abs(n)<1e-14?t.exp(e.gammaln((r+1)/2)-o*o/2-.5*t.log(t.PI*r)-e.gammaln(r/2)):r/n*(e.noncentralt.cdf(n*t.sqrt(1+2/r),r+2,o)-e.noncentralt.cdf(n,r,o))},cdf:function(n,r,o){var i=1e-14;if(t.abs(o)<i)return e.studentt.cdf(n,r);var a=!1;n<0&&(a=!0,o=-o);for(var u=e.normal.cdf(-o,0,1),s=i+1,c=s,l=n*n/(n*n+r),f=0,m=t.exp(-o*o/2),h=t.exp(-o*o/2-.5*t.log(2)-e.gammaln(1.5))*o;f<200||c>i||s>i;)c=s,f>0&&(m*=o*o/(2*f),h*=o*o/(2*(f+.5))),u+=.5*(s=m*e.beta.cdf(l,f+.5,r/2)+h*e.beta.cdf(l,f+1,r/2)),f++;return a?1-u:u}}),e.extend(e.normal,{pdf:function(e,n,r){return t.exp(-.5*t.log(2*t.PI)-t.log(r)-t.pow(e-n,2)/(2*r*r))},cdf:function(n,r,o){return.5*(1+e.erf((n-r)/t.sqrt(2*o*o)))},inv:function(t,n,r){return-1.4142135623730951*r*e.erfcinv(2*t)+n},mean:function(e){return e},median:function(e){return e},mode:function(e){return e},sample:function(t,n){return e.randn()*n+t},variance:function(e,t){return t*t}}),e.extend(e.pareto,{pdf:function(e,n,r){return e<n?0:r*t.pow(n,r)/t.pow(e,r+1)},cdf:function(e,n,r){return e<n?0:1-t.pow(n/e,r)},inv:function(e,n,r){return n/t.pow(1-e,1/r)},mean:function(e,n){if(!(n<=1))return n*t.pow(e,n)/(n-1)},median:function(e,n){return e*(n*t.SQRT2)},mode:function(e){return e},variance:function(e,n){if(!(n<=2))return e*e*n/(t.pow(n-1,2)*(n-2))}}),e.extend(e.studentt,{pdf:function(n,r){return r=r>1e100?1e100:r,1/(t.sqrt(r)*e.betafn(.5,r/2))*t.pow(1+n*n/r,-(r+1)/2)},cdf:function(n,r){var o=r/2;return e.ibeta((n+t.sqrt(n*n+r))/(2*t.sqrt(n*n+r)),o,o)},inv:function(n,r){var o=e.ibetainv(2*t.min(n,1-n),.5*r,.5);return o=t.sqrt(r*(1-o)/o),n>.5?o:-o},mean:function(e){return e>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return e.randn()*t.sqrt(n/(2*e.randg(n/2)))},variance:function(e){return e>2?e/(e-2):e>1?1/0:void 0}}),e.extend(e.weibull,{pdf:function(e,n,r){return e<0||n<0||r<0?0:r/n*t.pow(e/n,r-1)*t.exp(-t.pow(e/n,r))},cdf:function(e,n,r){return e<0?0:1-t.exp(-t.pow(e/n,r))},inv:function(e,n,r){return n*t.pow(-t.log(1-e),1/r)},mean:function(t,n){return t*e.gammafn(1+1/n)},median:function(e,n){return e*t.pow(t.log(2),1/n)},mode:function(e,n){return n<=1?0:e*t.pow((n-1)/n,1/n)},sample:function(n,r){return n*t.pow(-t.log(e._random_fn()),1/r)},variance:function(n,r){return n*n*e.gammafn(1+2/r)-t.pow(e.weibull.mean(n,r),2)}}),e.extend(e.uniform,{pdf:function(e,t,n){return e<t||e>n?0:1/(n-t)},cdf:function(e,t,n){return e<t?0:e<n?(e-t)/(n-t):1},inv:function(e,t,n){return t+e*(n-t)},mean:function(e,t){return.5*(e+t)},median:function(t,n){return e.mean(t,n)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(t,n){return t/2+n/2+(n/2-t/2)*(2*e._random_fn()-1)},variance:function(e,n){return t.pow(n-e,2)/12}}),e.extend(e.binomial,{pdf:function(n,r,o){return 0===o||1===o?r*o===n?1:0:e.combination(r,n)*t.pow(o,n)*t.pow(1-o,r-n)},cdf:function(r,o,i){var a,u=1e-10;if(r<0)return 0;if(r>=o)return 1;if(i<0||i>1||o<=0)return NaN;var s=i,c=(r=t.floor(r))+1,l=o-r,f=c+l,m=t.exp(e.gammaln(f)-e.gammaln(l)-e.gammaln(c)+c*t.log(s)+l*t.log(1-s));return a=s<(c+1)/(f+2)?m*n(s,c,l,u):1-m*n(1-s,l,c,u),t.round(1/u*(1-a))/(1/u)}}),e.extend(e.negbin,{pdf:function(n,r,o){return n===n>>>0&&(n<0?0:e.combination(n+r-1,r-1)*t.pow(1-o,n)*t.pow(o,r))},cdf:function(t,n,r){var o=0,i=0;if(t<0)return 0;for(;i<=t;i++)o+=e.negbin.pdf(i,n,r);return o}}),e.extend(e.hypgeom,{pdf:function(n,r,o,i){if(n!=n|0)return!1;if(n<0||n<o-(r-i))return 0;if(n>i||n>o)return 0;if(2*o>r)return 2*i>r?e.hypgeom.pdf(r-o-i+n,r,r-o,r-i):e.hypgeom.pdf(i-n,r,r-o,i);if(2*i>r)return e.hypgeom.pdf(o-n,r,o,r-i);if(o<i)return e.hypgeom.pdf(n,r,i,o);for(var a=1,u=0,s=0;s<n;s++){for(;a>1&&u<i;)a*=1-o/(r-u),u++;a*=(i-s)*(o-s)/((s+1)*(r-o-i+s+1))}for(;u<i;u++)a*=1-o/(r-u);return t.min(1,t.max(0,a))},cdf:function(n,r,o,i){if(n<0||n<o-(r-i))return 0;if(n>=i||n>=o)return 1;if(2*o>r)return 2*i>r?e.hypgeom.cdf(r-o-i+n,r,r-o,r-i):1-e.hypgeom.cdf(i-n-1,r,r-o,i);if(2*i>r)return 1-e.hypgeom.cdf(o-n-1,r,o,r-i);if(o<i)return e.hypgeom.cdf(n,r,i,o);for(var a=1,u=1,s=0,c=0;c<n;c++){for(;a>1&&s<i;){var l=1-o/(r-s);u*=l,a*=l,s++}a+=u*=(i-c)*(o-c)/((c+1)*(r-o-i+c+1))}for(;s<i;s++)a*=1-o/(r-s);return t.min(1,t.max(0,a))}}),e.extend(e.poisson,{pdf:function(n,r){return r<0||n%1!=0||n<0?0:t.pow(r,n)*t.exp(-r)/e.factorial(n)},cdf:function(t,n){var r=[],o=0;if(t<0)return 0;for(;o<=t;o++)r.push(e.poisson.pdf(o,n));return e.sum(r)},mean:function(e){return e},variance:function(e){return e},sampleSmall:function(n){var r=1,o=0,i=t.exp(-n);do{o++,r*=e._random_fn()}while(r>i);return o-1},sampleLarge:function(n){var r,o,i,a,u,s,c,l,f,m,h=n;for(a=t.sqrt(h),u=t.log(h),s=.02483*(c=.931+2.53*a)-.059,l=1.1239+1.1328/(c-3.4),f=.9277-3.6224/(c-2);;){if(o=t.random()-.5,i=t.random(),m=.5-t.abs(o),r=t.floor((2*s/m+c)*o+h+.43),m>=.07&&i<=f)return r;if(!(r<0||m<.013&&i>m)&&t.log(i)+t.log(l)-t.log(s/(m*m)+c)<=r*u-h-e.loggam(r+1))return r}},sample:function(e){return e<10?this.sampleSmall(e):this.sampleLarge(e)}}),e.extend(e.triangular,{pdf:function(e,t,n,r){return n<=t||r<t||r>n?NaN:e<t||e>n?0:e<r?2*(e-t)/((n-t)*(r-t)):e===r?2/(n-t):2*(n-e)/((n-t)*(n-r))},cdf:function(e,n,r,o){return r<=n||o<n||o>r?NaN:e<=n?0:e>=r?1:e<=o?t.pow(e-n,2)/((r-n)*(o-n)):1-t.pow(r-e,2)/((r-n)*(r-o))},inv:function(e,n,r,o){return r<=n||o<n||o>r?NaN:e<=(o-n)/(r-n)?n+(r-n)*t.sqrt(e*((o-n)/(r-n))):n+(r-n)*(1-t.sqrt((1-e)*(1-(o-n)/(r-n))))},mean:function(e,t,n){return(e+t+n)/3},median:function(e,n,r){return r<=(e+n)/2?n-t.sqrt((n-e)*(n-r))/t.sqrt(2):r>(e+n)/2?e+t.sqrt((n-e)*(r-e))/t.sqrt(2):void 0},mode:function(e,t,n){return n},sample:function(n,r,o){var i=e._random_fn();return i<(o-n)/(r-n)?n+t.sqrt(i*(r-n)*(o-n)):r-t.sqrt((1-i)*(r-n)*(r-o))},variance:function(e,t,n){return(e*e+t*t+n*n-e*t-e*n-t*n)/18}}),e.extend(e.arcsine,{pdf:function(e,n,r){return r<=n?NaN:e<=n||e>=r?0:2/t.PI*t.pow(t.pow(r-n,2)-t.pow(2*e-n-r,2),-.5)},cdf:function(e,n,r){return e<n?0:e<r?2/t.PI*t.asin(t.sqrt((e-n)/(r-n))):1},inv:function(e,n,r){return n+(.5-.5*t.cos(t.PI*e))*(r-n)},mean:function(e,t){return t<=e?NaN:(e+t)/2},median:function(e,t){return t<=e?NaN:(e+t)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(n,r){return(n+r)/2+(r-n)/2*t.sin(2*t.PI*e.uniform.sample(0,1))},variance:function(e,n){return n<=e?NaN:t.pow(n-e,2)/8}}),e.extend(e.laplace,{pdf:function(e,n,r){return r<=0?0:t.exp(-t.abs(e-n)/r)/(2*r)},cdf:function(e,n,r){return r<=0?0:e<n?.5*t.exp((e-n)/r):1-.5*t.exp(-(e-n)/r)},mean:function(e){return e},median:function(e){return e},mode:function(e){return e},variance:function(e,t){return 2*t*t},sample:function(n,r){var o,i=e._random_fn()-.5;return n-r*((o=i)/t.abs(o))*t.log(1-2*t.abs(i))}}),e.extend(e.tukey,{cdf:function(n,o,i){var a=o,u=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],s=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(i<2||a<2)return NaN;if(!Number.isFinite(n))return 1;if(i>25e3)return r(n,1,a);var c,l=.5*i,f=l*t.log(i)-i*t.log(2)-e.gammaln(l),m=l-1,h=.25*i;c=i<=100?1:i<=800?.5:i<=5e3?.25:.125,f+=t.log(c);for(var d=0,p=1;p<=50;p++){for(var g=0,v=(2*p-1)*c,y=1;y<=16;y++){var A,x;8<y?(A=y-8-1,x=f+m*t.log(v+u[A]*c)-(u[A]*c+v)*h):(A=y-1,x=f+m*t.log(v-u[A]*c)+(u[A]*c-v)*h),x>=-30&&(g+=r(8<y?n*t.sqrt(.5*(u[A]*c+v)):n*t.sqrt(.5*(-u[A]*c+v)),1,a)*s[A]*t.exp(x))}if(p*c>=1&&g<=1e-14)break;d+=g}if(g>1e-14)throw new Error("tukey.cdf failed to converge");return d>1&&(d=1),d},inv:function(n,r,o){if(o<2||r<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var i,a=function(e,n,r){var o=.5-.5*e,i=t.sqrt(t.log(1/(o*o))),a=i+((((-453642210148e-16*i-.204231210125)*i-.342242088547)*i-1)*i+.322232421088)/((((.0038560700634*i+.10353775285)*i+.531103462366)*i+.588581570495)*i+.099348462606);r<120&&(a+=(a*a*a+a)/r/4);var u=.8832-.2368*a;return r<120&&(u+=-1.214/r+1.208*a/r),a*(u*t.log(n-1)+1.4142)}(n,r,o),u=e.tukey.cdf(a,r,o)-n;i=u>0?t.max(0,a-1):a+1;for(var s,c=e.tukey.cdf(i,r,o)-n,l=1;l<50;l++)if(s=i-c*(i-a)/(c-u),u=c,a=i,s<0&&(s=0,c=-n),c=e.tukey.cdf(s,r,o)-n,i=s,t.abs(i-a)<1e-4)return s;throw new Error("tukey.inv failed to converge")}})}(t,Math),function(e,t){var n,r,o=Array.prototype.push,i=e.utils.isArray;function a(t){return i(t)||t instanceof e}e.extend({add:function(t,n){return a(n)?(a(n[0])||(n=[n]),e.map(t,(function(e,t,r){return e+n[t][r]}))):e.map(t,(function(e){return e+n}))},subtract:function(t,n){return a(n)?(a(n[0])||(n=[n]),e.map(t,(function(e,t,r){return e-n[t][r]||0}))):e.map(t,(function(e){return e-n}))},divide:function(t,n){return a(n)?(a(n[0])||(n=[n]),e.multiply(t,e.inv(n))):e.map(t,(function(e){return e/n}))},multiply:function(t,n){var r,o,i,u,s,c,l,f;if(void 0===t.length&&void 0===n.length)return t*n;if(s=t.length,c=t[0].length,l=e.zeros(s,i=a(n)?n[0].length:c),f=0,a(n)){for(;f<i;f++)for(r=0;r<s;r++){for(u=0,o=0;o<c;o++)u+=t[r][o]*n[o][f];l[r][f]=u}return 1===s&&1===f?l[0][0]:l}return e.map(t,(function(e){return e*n}))},outer:function(t,n){return e.multiply(t.map((function(e){return[e]})),[n])},dot:function(t,n){a(t[0])||(t=[t]),a(n[0])||(n=[n]);for(var r,o,i=1===t[0].length&&1!==t.length?e.transpose(t):t,u=1===n[0].length&&1!==n.length?e.transpose(n):n,s=[],c=0,l=i.length,f=i[0].length;c<l;c++){for(s[c]=[],r=0,o=0;o<f;o++)r+=i[c][o]*u[c][o];s[c]=r}return 1===s.length?s[0]:s},pow:function(n,r){return e.map(n,(function(e){return t.pow(e,r)}))},exp:function(n){return e.map(n,(function(e){return t.exp(e)}))},log:function(n){return e.map(n,(function(e){return t.log(e)}))},abs:function(n){return e.map(n,(function(e){return t.abs(e)}))},norm:function(e,n){var r=0,o=0;for(isNaN(n)&&(n=2),a(e[0])&&(e=e[0]);o<e.length;o++)r+=t.pow(t.abs(e[o]),n);return t.pow(r,1/n)},angle:function(n,r){return t.acos(e.dot(n,r)/(e.norm(n)*e.norm(r)))},aug:function(e,t){var n,r=[];for(n=0;n<e.length;n++)r.push(e[n].slice());for(n=0;n<r.length;n++)o.apply(r[n],t[n]);return r},inv:function(t){for(var n,r=t.length,o=t[0].length,i=e.identity(r,o),a=e.gauss_jordan(t,i),u=[],s=0;s<r;s++)for(u[s]=[],n=o;n<a[0].length;n++)u[s][n-o]=a[s][n];return u},det:function e(t){if(2===t.length)return t[0][0]*t[1][1]-t[0][1]*t[1][0];for(var n=0,r=0;r<t.length;r++){for(var o=[],i=1;i<t.length;i++){o[i-1]=[];for(var a=0;a<t.length;a++)a<r?o[i-1][a]=t[i][a]:a>r&&(o[i-1][a-1]=t[i][a])}var u=r%2?-1:1;n+=e(o)*t[0][r]*u}return n},gauss_elimination:function(n,r){var o,i,a,u,s=0,c=0,l=n.length,f=n[0].length,m=1,h=0,d=[];for(o=(n=e.aug(n,r))[0].length,s=0;s<l;s++){for(i=n[s][s],c=s,u=s+1;u<f;u++)i<t.abs(n[u][s])&&(i=n[u][s],c=u);if(c!=s)for(u=0;u<o;u++)a=n[s][u],n[s][u]=n[c][u],n[c][u]=a;for(c=s+1;c<l;c++)for(m=n[c][s]/n[s][s],u=s;u<o;u++)n[c][u]=n[c][u]-m*n[s][u]}for(s=l-1;s>=0;s--){for(h=0,c=s+1;c<=l-1;c++)h+=d[c]*n[s][c];d[s]=(n[s][o-1]-h)/n[s][s]}return d},gauss_jordan:function(n,r){var o,i,a,u=e.aug(n,r),s=u.length,c=u[0].length,l=0;for(i=0;i<s;i++){var f=i;for(a=i+1;a<s;a++)t.abs(u[a][i])>t.abs(u[f][i])&&(f=a);var m=u[i];for(u[i]=u[f],u[f]=m,a=i+1;a<s;a++)for(l=u[a][i]/u[i][i],o=i;o<c;o++)u[a][o]-=u[i][o]*l}for(i=s-1;i>=0;i--){for(l=u[i][i],a=0;a<i;a++)for(o=c-1;o>i-1;o--)u[a][o]-=u[i][o]*u[a][i]/l;for(u[i][i]/=l,o=s;o<c;o++)u[i][o]/=l}return u},triaUpSolve:function(t,n){var r,o=t[0].length,i=e.zeros(1,o)[0],a=!1;return null!=n[0].length&&(n=n.map((function(e){return e[0]})),a=!0),e.arange(o-1,-1,-1).forEach((function(a){r=e.arange(a+1,o).map((function(e){return i[e]*t[a][e]})),i[a]=(n[a]-e.sum(r))/t[a][a]})),a?i.map((function(e){return[e]})):i},triaLowSolve:function(t,n){var r,o=t[0].length,i=e.zeros(1,o)[0],a=!1;return null!=n[0].length&&(n=n.map((function(e){return e[0]})),a=!0),e.arange(o).forEach((function(o){r=e.arange(o).map((function(e){return t[o][e]*i[e]})),i[o]=(n[o]-e.sum(r))/t[o][o]})),a?i.map((function(e){return[e]})):i},lu:function(t){var n,r=t.length,o=e.identity(r),i=e.zeros(t.length,t[0].length);return e.arange(r).forEach((function(e){i[0][e]=t[0][e]})),e.arange(1,r).forEach((function(a){e.arange(a).forEach((function(r){n=e.arange(r).map((function(e){return o[a][e]*i[e][r]})),o[a][r]=(t[a][r]-e.sum(n))/i[r][r]})),e.arange(a,r).forEach((function(r){n=e.arange(a).map((function(e){return o[a][e]*i[e][r]})),i[a][r]=t[n.length][r]-e.sum(n)}))})),[o,i]},cholesky:function(n){var r,o=n.length,i=e.zeros(n.length,n[0].length);return e.arange(o).forEach((function(a){r=e.arange(a).map((function(e){return t.pow(i[a][e],2)})),i[a][a]=t.sqrt(n[a][a]-e.sum(r)),e.arange(a+1,o).forEach((function(t){r=e.arange(a).map((function(e){return i[a][e]*i[t][e]})),i[t][a]=(n[a][t]-e.sum(r))/i[a][a]}))})),i},gauss_jacobi:function(n,r,o,i){for(var a,u,s,c,l=0,f=0,m=n.length,h=[],d=[],p=[];l<m;l++)for(h[l]=[],d[l]=[],p[l]=[],f=0;f<m;f++)l>f?(h[l][f]=n[l][f],d[l][f]=p[l][f]=0):l<f?(d[l][f]=n[l][f],h[l][f]=p[l][f]=0):(p[l][f]=n[l][f],h[l][f]=d[l][f]=0);for(s=e.multiply(e.multiply(e.inv(p),e.add(h,d)),-1),u=e.multiply(e.inv(p),r),a=o,c=e.add(e.multiply(s,o),u),l=2;t.abs(e.norm(e.subtract(c,a)))>i;)a=c,c=e.add(e.multiply(s,a),u),l++;return c},gauss_seidel:function(n,r,o,i){for(var a,u,s,c,l,f=0,m=n.length,h=[],d=[],p=[];f<m;f++)for(h[f]=[],d[f]=[],p[f]=[],a=0;a<m;a++)f>a?(h[f][a]=n[f][a],d[f][a]=p[f][a]=0):f<a?(d[f][a]=n[f][a],h[f][a]=p[f][a]=0):(p[f][a]=n[f][a],h[f][a]=d[f][a]=0);for(c=e.multiply(e.multiply(e.inv(e.add(p,h)),d),-1),s=e.multiply(e.inv(e.add(p,h)),r),u=o,l=e.add(e.multiply(c,o),s),f=2;t.abs(e.norm(e.subtract(l,u)))>i;)u=l,l=e.add(e.multiply(c,u),s),f+=1;return l},SOR:function(n,r,o,i,a){for(var u,s,c,l,f,m=0,h=n.length,d=[],p=[],g=[];m<h;m++)for(d[m]=[],p[m]=[],g[m]=[],u=0;u<h;u++)m>u?(d[m][u]=n[m][u],p[m][u]=g[m][u]=0):m<u?(p[m][u]=n[m][u],d[m][u]=g[m][u]=0):(g[m][u]=n[m][u],d[m][u]=p[m][u]=0);for(l=e.multiply(e.inv(e.add(g,e.multiply(d,a))),e.subtract(e.multiply(g,1-a),e.multiply(p,a))),c=e.multiply(e.multiply(e.inv(e.add(g,e.multiply(d,a))),r),a),s=o,f=e.add(e.multiply(l,o),c),m=2;t.abs(e.norm(e.subtract(f,s)))>i;)s=f,f=e.add(e.multiply(l,s),c),m++;return f},householder:function(n){for(var r,o,i,a,u=n.length,s=n[0].length,c=0,l=[],f=[];c<u-1;c++){for(r=0,a=c+1;a<s;a++)r+=n[a][c]*n[a][c];for(r=(n[c+1][c]>0?-1:1)*t.sqrt(r),o=t.sqrt((r*r-n[c+1][c]*r)/2),(l=e.zeros(u,1))[c+1][0]=(n[c+1][c]-r)/(2*o),i=c+2;i<u;i++)l[i][0]=n[i][c]/(2*o);f=e.subtract(e.identity(u,s),e.multiply(e.multiply(l,e.transpose(l)),2)),n=e.multiply(f,e.multiply(n,f))}return n},QR:(n=e.sum,r=e.arange,function(o){var i,a,u,s=o.length,c=o[0].length,l=e.zeros(c,c);for(o=e.copy(o),a=0;a<c;a++){for(l[a][a]=t.sqrt(n(r(s).map((function(e){return o[e][a]*o[e][a]})))),i=0;i<s;i++)o[i][a]=o[i][a]/l[a][a];for(u=a+1;u<c;u++)for(l[a][u]=n(r(s).map((function(e){return o[e][a]*o[e][u]}))),i=0;i<s;i++)o[i][u]=o[i][u]-o[i][a]*l[a][u]}return[o,l]}),lstsq:function(t,n){var r=!1;void 0===n[0].length&&(n=n.map((function(e){return[e]})),r=!0);var o=e.QR(t),i=o[0],a=o[1],u=t[0].length,s=e.slice(i,{col:{end:u}}),c=function(t){var n=(t=e.copy(t)).length,r=e.identity(n);return e.arange(n-1,-1,-1).forEach((function(n){e.sliceAssign(r,{row:n},e.divide(e.slice(r,{row:n}),t[n][n])),e.sliceAssign(t,{row:n},e.divide(e.slice(t,{row:n}),t[n][n])),e.arange(n).forEach((function(o){var i=e.multiply(t[o][n],-1),a=e.slice(t,{row:o}),u=e.multiply(e.slice(t,{row:n}),i);e.sliceAssign(t,{row:o},e.add(a,u));var s=e.slice(r,{row:o}),c=e.multiply(e.slice(r,{row:n}),i);e.sliceAssign(r,{row:o},e.add(s,c))}))})),r}(e.slice(a,{row:{end:u}})),l=e.transpose(s);void 0===l[0].length&&(l=[l]);var f=e.multiply(e.multiply(c,l),n);return void 0===f.length&&(f=[[f]]),r?f.map((function(e){return e[0]})):f},jacobi:function(n){for(var r,o,i,a,u,s,c,l=1,f=n.length,m=e.identity(f,f),h=[];1===l;){for(u=n[0][1],i=0,a=1,r=0;r<f;r++)for(o=0;o<f;o++)r!=o&&u<t.abs(n[r][o])&&(u=t.abs(n[r][o]),i=r,a=o);for(s=n[i][i]===n[a][a]?n[i][a]>0?t.PI/4:-t.PI/4:t.atan(2*n[i][a]/(n[i][i]-n[a][a]))/2,(c=e.identity(f,f))[i][i]=t.cos(s),c[i][a]=-t.sin(s),c[a][i]=t.sin(s),c[a][a]=t.cos(s),m=e.multiply(m,c),n=e.multiply(e.multiply(e.inv(c),n),c),l=0,r=1;r<f;r++)for(o=1;o<f;o++)r!=o&&t.abs(n[r][o])>.001&&(l=1)}for(r=0;r<f;r++)h.push(n[r][r]);return[m,h]},rungekutta:function(e,t,n,r,o,i){var a,u,s;if(2===i)for(;r<=n;)o+=((a=t*e(r,o))+(u=t*e(r+t,o+a)))/2,r+=t;if(4===i)for(;r<=n;)o+=((a=t*e(r,o))+2*(u=t*e(r+t/2,o+a/2))+2*(s=t*e(r+t/2,o+u/2))+t*e(r+t,o+s))/6,r+=t;return o},romberg:function(e,n,r,o){for(var i,a,u,s,c,l=0,f=(r-n)/2,m=[],h=[],d=[];l<o/2;){for(c=e(n),u=n,s=0;u<=r;u+=f,s++)m[s]=u;for(i=m.length,u=1;u<i-1;u++)c+=(u%2!=0?4:2)*e(m[u]);c=f/3*(c+e(r)),d[l]=c,f/=2,l++}for(a=d.length,i=1;1!==a;){for(u=0;u<a-1;u++)h[u]=(t.pow(4,i)*d[u+1]-d[u])/(t.pow(4,i)-1);a=h.length,d=h,h=[],i++}return d},richardson:function(e,n,r,o){function i(e,t){for(var n,r=0,o=e.length;r<o;r++)e[r]===t&&(n=r);return n}for(var a,u,s,c,l,f=t.abs(r-e[i(e,r)+1]),m=0,h=[],d=[];o>=f;)a=i(e,r+o),u=i(e,r),h[m]=(n[a]-2*n[u]+n[2*u-a])/(o*o),o/=2,m++;for(c=h.length,s=1;1!=c;){for(l=0;l<c-1;l++)d[l]=(t.pow(4,s)*h[l+1]-h[l])/(t.pow(4,s)-1);c=d.length,h=d,d=[],s++}return h},simpson:function(e,t,n,r){for(var o,i=(n-t)/r,a=e(t),u=[],s=t,c=0,l=1;s<=n;s+=i,c++)u[c]=s;for(o=u.length;l<o-1;l++)a+=(l%2!=0?4:2)*e(u[l]);return i/3*(a+e(n))},hermite:function(e,t,n,r){for(var o,i=e.length,a=0,u=0,s=[],c=[],l=[],f=[];u<i;u++){for(s[u]=1,o=0;o<i;o++)u!=o&&(s[u]*=(r-e[o])/(e[u]-e[o]));for(c[u]=0,o=0;o<i;o++)u!=o&&(c[u]+=1/(e[u]-e[o]));l[u]=(1-2*(r-e[u])*c[u])*(s[u]*s[u]),f[u]=(r-e[u])*(s[u]*s[u]),a+=l[u]*t[u]+f[u]*n[u]}return a},lagrange:function(e,t,n){for(var r,o,i=0,a=0,u=e.length;a<u;a++){for(o=t[a],r=0;r<u;r++)a!=r&&(o*=(n-e[r])/(e[a]-e[r]));i+=o}return i},cubic_spline:function(t,n,r){for(var o,i,a=t.length,u=0,s=[],c=[],l=[],f=[],m=[],h=[];u<a-1;u++)f[u]=t[u+1]-t[u];for(l[0]=0,u=1;u<a-1;u++)l[u]=3/f[u]*(n[u+1]-n[u])-3/f[u-1]*(n[u]-n[u-1]);for(u=1;u<a-1;u++)s[u]=[],c[u]=[],s[u][u-1]=f[u-1],s[u][u]=2*(f[u-1]+f[u]),s[u][u+1]=f[u],c[u][0]=l[u];for(i=e.multiply(e.inv(s),c),o=0;o<a-1;o++)m[o]=(n[o+1]-n[o])/f[o]-f[o]*(i[o+1][0]+2*i[o][0])/3,h[o]=(i[o+1][0]-i[o][0])/(3*f[o]);for(o=0;o<a&&!(t[o]>r);o++);return n[o-=1]+(r-t[o])*m[o]+e.sq(r-t[o])*i[o]+(r-t[o])*e.sq(r-t[o])*h[o]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(t){var n,r,o,i,a,u=t.length,s=t[0].length,c=0,l=[],f=[],m=[],h=[],d=[],p=[],g=[];for(c=0;c<u;c++)l[c]=e.sum(t[c])/s;for(c=0;c<s;c++)for(d[c]=[],n=0;n<u;n++)d[c][n]=t[n][c]-l[n];for(d=e.transpose(d),c=0;c<u;c++)for(p[c]=[],n=0;n<u;n++)p[c][n]=e.dot([d[c]],[d[n]])/(s-1);for(a=(o=e.jacobi(p))[0],f=o[1],g=e.transpose(a),c=0;c<f.length;c++)for(n=c;n<f.length;n++)f[c]<f[n]&&(r=f[c],f[c]=f[n],f[n]=r,m=g[c],g[c]=g[n],g[n]=m);for(i=e.transpose(d),c=0;c<u;c++)for(h[c]=[],n=0;n<i.length;n++)h[c][n]=e.dot([g[c]],[i[n]]);return[t,f,g,h]}}),function(t){for(var n=0;n<t.length;n++)!function(t){e.fn[t]=function(n,r){var o=this;return r?(setTimeout((function(){r.call(o,e.fn[t].call(o,n))}),15),this):"number"==typeof e[t](this,n)?e[t](this,n):e(e[t](this,n))}}(t[n])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(t,Math),function(e,t){var n=[].slice,r=e.utils.isNumber,o=e.utils.isArray;function i(e,n,r,o){if(e>1||r>1||e<=0||r<=0)throw new Error("Proportions should be greater than 0 and less than 1");var i=(e*n+r*o)/(n+o);return(e-r)/t.sqrt(i*(1-i)*(1/n+1/o))}e.extend({zscore:function(){var t=n.call(arguments);return r(t[1])?(t[0]-t[1])/t[2]:(t[0]-e.mean(t[1]))/e.stdev(t[1],t[2])},ztest:function(){var r,i=n.call(arguments);return o(i[1])?(r=e.zscore(i[0],i[1],i[3]),1===i[2]?e.normal.cdf(-t.abs(r),0,1):2*e.normal.cdf(-t.abs(r),0,1)):i.length>2?(r=e.zscore(i[0],i[1],i[2]),1===i[3]?e.normal.cdf(-t.abs(r),0,1):2*e.normal.cdf(-t.abs(r),0,1)):(r=i[0],1===i[1]?e.normal.cdf(-t.abs(r),0,1):2*e.normal.cdf(-t.abs(r),0,1))}}),e.extend(e.fn,{zscore:function(e,t){return(e-this.mean())/this.stdev(t)},ztest:function(n,r,o){var i=t.abs(this.zscore(n,o));return 1===r?e.normal.cdf(-i,0,1):2*e.normal.cdf(-i,0,1)}}),e.extend({tscore:function(){var r=n.call(arguments);return 4===r.length?(r[0]-r[1])/(r[2]/t.sqrt(r[3])):(r[0]-e.mean(r[1]))/(e.stdev(r[1],!0)/t.sqrt(r[1].length))},ttest:function(){var o,i=n.call(arguments);return 5===i.length?(o=t.abs(e.tscore(i[0],i[1],i[2],i[3])),1===i[4]?e.studentt.cdf(-o,i[3]-1):2*e.studentt.cdf(-o,i[3]-1)):r(i[1])?(o=t.abs(i[0]),1==i[2]?e.studentt.cdf(-o,i[1]-1):2*e.studentt.cdf(-o,i[1]-1)):(o=t.abs(e.tscore(i[0],i[1])),1==i[2]?e.studentt.cdf(-o,i[1].length-1):2*e.studentt.cdf(-o,i[1].length-1))}}),e.extend(e.fn,{tscore:function(e){return(e-this.mean())/(this.stdev(!0)/t.sqrt(this.cols()))},ttest:function(n,r){return 1===r?1-e.studentt.cdf(t.abs(this.tscore(n)),this.cols()-1):2*e.studentt.cdf(-t.abs(this.tscore(n)),this.cols()-1)}}),e.extend({anovafscore:function(){var r,o,i,a,u,s,c,l,f=n.call(arguments);if(1===f.length){for(u=new Array(f[0].length),c=0;c<f[0].length;c++)u[c]=f[0][c];f=u}for(o=new Array,c=0;c<f.length;c++)o=o.concat(f[c]);for(i=e.mean(o),r=0,c=0;c<f.length;c++)r+=f[c].length*t.pow(e.mean(f[c])-i,2);for(r/=f.length-1,s=0,c=0;c<f.length;c++)for(a=e.mean(f[c]),l=0;l<f[c].length;l++)s+=t.pow(f[c][l]-a,2);return r/(s/(o.length-f.length))},anovaftest:function(){var t,o,i,a,u=n.call(arguments);if(r(u[0]))return 1-e.centralF.cdf(u[0],u[1],u[2]);var s=e.anovafscore(u);for(t=u.length-1,i=0,a=0;a<u.length;a++)i+=u[a].length;return o=i-t-1,1-e.centralF.cdf(s,t,o)},ftest:function(t,n,r){return 1-e.centralF.cdf(t,n,r)}}),e.extend(e.fn,{anovafscore:function(){return e.anovafscore(this.toArray())},anovaftes:function(){var t,n=0;for(t=0;t<this.length;t++)n+=this[t].length;return e.ftest(this.anovafscore(),this.length-1,n-this.length)}}),e.extend({qscore:function(){var o,i,a,u,s,c=n.call(arguments);return r(c[0])?(o=c[0],i=c[1],a=c[2],u=c[3],s=c[4]):(o=e.mean(c[0]),i=e.mean(c[1]),a=c[0].length,u=c[1].length,s=c[2]),t.abs(o-i)/(s*t.sqrt((1/a+1/u)/2))},qtest:function(){var t,r=n.call(arguments);3===r.length?(t=r[0],r=r.slice(1)):7===r.length?(t=e.qscore(r[0],r[1],r[2],r[3],r[4]),r=r.slice(5)):(t=e.qscore(r[0],r[1],r[2]),r=r.slice(3));var o=r[0],i=r[1];return 1-e.tukey.cdf(t,i,o-i)},tukeyhsd:function(t){for(var n=e.pooledstdev(t),r=t.map((function(t){return e.mean(t)})),o=t.reduce((function(e,t){return e+t.length}),0),i=[],a=0;a<t.length;++a)for(var u=a+1;u<t.length;++u){var s=e.qtest(r[a],r[u],t[a].length,t[u].length,n,o,t.length);i.push([[a,u],s])}return i}}),e.extend({normalci:function(){var r,o=n.call(arguments),i=new Array(2);return r=4===o.length?t.abs(e.normal.inv(o[1]/2,0,1)*o[2]/t.sqrt(o[3])):t.abs(e.normal.inv(o[1]/2,0,1)*e.stdev(o[2])/t.sqrt(o[2].length)),i[0]=o[0]-r,i[1]=o[0]+r,i},tci:function(){var r,o=n.call(arguments),i=new Array(2);return r=4===o.length?t.abs(e.studentt.inv(o[1]/2,o[3]-1)*o[2]/t.sqrt(o[3])):t.abs(e.studentt.inv(o[1]/2,o[2].length-1)*e.stdev(o[2],!0)/t.sqrt(o[2].length)),i[0]=o[0]-r,i[1]=o[0]+r,i},significant:function(e,t){return e<t}}),e.extend(e.fn,{normalci:function(t,n){return e.normalci(t,n,this.toArray())},tci:function(t,n){return e.tci(t,n,this.toArray())}}),e.extend(e.fn,{oneSidedDifferenceOfProportions:function(t,n,r,o){var a=i(t,n,r,o);return e.ztest(a,1)},twoSidedDifferenceOfProportions:function(t,n,r,o){var a=i(t,n,r,o);return e.ztest(a,2)}})}(t,Math),t.models=function(){function e(e,n){var r=e.length,o=n[0].length-1,i=r-o-1,a=t.lstsq(n,e),u=t.multiply(n,a.map((function(e){return[e]}))).map((function(e){return e[0]})),s=t.subtract(e,u),c=t.mean(e),l=t.sum(u.map((function(e){return Math.pow(e-c,2)}))),f=t.sum(e.map((function(e,t){return Math.pow(e-u[t],2)}))),m=l+f;return{exog:n,endog:e,nobs:r,df_model:o,df_resid:i,coef:a,predict:u,resid:s,ybar:c,SST:m,SSE:l,SSR:f,R2:l/m}}function n(n){var r,o,i=(r=n.exog,o=r[0].length,t.arange(o).map((function(n){var i=t.arange(o).filter((function(e){return e!==n}));return e(t.col(r,n).map((function(e){return e[0]})),t.col(r,i))}))),a=Math.sqrt(n.SSR/n.df_resid),u=i.map((function(e){var t=e.SST,n=e.R2;return a/Math.sqrt(t*(1-n))})),s=n.coef.map((function(e,t){return(e-0)/u[t]})),c=s.map((function(e){var r=t.studentt.cdf(e,n.df_resid);return 2*(r>.5?1-r:r)})),l=t.studentt.inv(.975,n.df_resid),f=n.coef.map((function(e,t){var n=l*u[t];return[e-n,e+n]}));return{se:u,t:s,p:c,sigmaHat:a,interval95:f}}return{ols:function(r,o){var i=e(r,o),a=n(i),u=function(e){var n,r,o,i=e.R2/e.df_model/((1-e.R2)/e.df_resid);return{F_statistic:i,pvalue:1-(n=i,r=e.df_model,o=e.df_resid,t.beta.cdf(n/(o/r+n),r/2,o/2))}}(i),s=1-(1-i.R2)*((i.nobs-1)/i.df_resid);return i.t=a,i.f=u,i.adjust_R2=s,i}}}(),t.extend({buildxmatrix:function(){for(var e=new Array(arguments.length),n=0;n<arguments.length;n++)e[n]=[1].concat(arguments[n]);return t(e)},builddxmatrix:function(){for(var e=new Array(arguments[0].length),n=0;n<arguments[0].length;n++)e[n]=[1].concat(arguments[0][n]);return t(e)},buildjxmatrix:function(e){for(var n=new Array(e.length),r=0;r<e.length;r++)n[r]=e[r];return t.builddxmatrix(n)},buildymatrix:function(e){return t(e).transpose()},buildjymatrix:function(e){return e.transpose()},matrixmult:function(e,n){var r,o,i,a,u;if(e.cols()==n.rows()){if(n.rows()>1){for(a=[],r=0;r<e.rows();r++)for(a[r]=[],o=0;o<n.cols();o++){for(u=0,i=0;i<e.cols();i++)u+=e.toArray()[r][i]*n.toArray()[i][o];a[r][o]=u}return t(a)}for(a=[],r=0;r<e.rows();r++)for(a[r]=[],o=0;o<n.cols();o++){for(u=0,i=0;i<e.cols();i++)u+=e.toArray()[r][i]*n.toArray()[o];a[r][o]=u}return t(a)}},regress:function(e,n){var r=t.xtranspxinv(e),o=e.transpose(),i=t.matrixmult(t(r),o);return t.matrixmult(i,n)},regresst:function(e,n,r){var o=t.regress(e,n),i={anova:{}},a=t.jMatYBar(e,o);i.yBar=a;var u=n.mean();i.anova.residuals=t.residuals(n,a),i.anova.ssr=t.ssr(a,u),i.anova.msr=i.anova.ssr/(e[0].length-1),i.anova.sse=t.sse(n,a),i.anova.mse=i.anova.sse/(n.length-(e[0].length-1)-1),i.anova.sst=t.sst(n,u),i.anova.mst=i.anova.sst/(n.length-1),i.anova.r2=1-i.anova.sse/i.anova.sst,i.anova.r2<0&&(i.anova.r2=0),i.anova.fratio=i.anova.msr/i.anova.mse,i.anova.pvalue=t.anovaftest(i.anova.fratio,e[0].length-1,n.length-(e[0].length-1)-1),i.anova.rmse=Math.sqrt(i.anova.mse),i.anova.r2adj=1-i.anova.mse/i.anova.mst,i.anova.r2adj<0&&(i.anova.r2adj=0),i.stats=new Array(e[0].length);for(var s,c,l,f=t.xtranspxinv(e),m=0;m<o.length;m++)s=Math.sqrt(i.anova.mse*Math.abs(f[m][m])),c=Math.abs(o[m]/s),l=t.ttest(c,n.length-e[0].length-1,r),i.stats[m]=[o[m],s,c,l];return i.regress=o,i},xtranspx:function(e){return t.matrixmult(e.transpose(),e)},xtranspxinv:function(e){var n=t.matrixmult(e.transpose(),e);return t.inv(n)},jMatYBar:function(e,n){var r=t.matrixmult(e,n);return new t(r)},residuals:function(e,n){return t.matrixsubtract(e,n)},ssr:function(e,t){for(var n=0,r=0;r<e.length;r++)n+=Math.pow(e[r]-t,2);return n},sse:function(e,t){for(var n=0,r=0;r<e.length;r++)n+=Math.pow(e[r]-t[r],2);return n},sst:function(e,t){for(var n=0,r=0;r<e.length;r++)n+=Math.pow(e[r]-t,2);return n},matrixsubtract:function(e,n){for(var r=new Array(e.length),o=0;o<e.length;o++){r[o]=new Array(e[o].length);for(var i=0;i<e[o].length;i++)r[o][i]=e[o][i]-n[o][i]}return t(r)}}),t.jStat=t,t)},379:(e,t,n)=>{"use strict";var r,o=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),i=[];function a(e){for(var t=-1,n=0;n<i.length;n++)if(i[n].identifier===e){t=n;break}return t}function u(e,t){for(var n={},r=[],o=0;o<e.length;o++){var u=e[o],s=t.base?u[0]+t.base:u[0],c=n[s]||0,l="".concat(s," ").concat(c);n[s]=c+1;var f=a(l),m={css:u[1],media:u[2],sourceMap:u[3]};-1!==f?(i[f].references++,i[f].updater(m)):i.push({identifier:l,updater:p(m,t),references:1}),r.push(l)}return r}function s(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var a=o(e.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(t)}return t}var c,l=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function f(e,t,n,r){var o=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=l(t,o);else{var i=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}function m(e,t,n){var r=n.css,o=n.media,i=n.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var h=null,d=0;function p(e,t){var n,r,o;if(t.singleton){var i=d++;n=h||(h=s(t)),r=f.bind(null,n,i,!1),o=f.bind(null,n,i,!0)}else n=s(t),r=m.bind(null,n,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r));var n=u(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var o=a(n[r]);i[o].references--}for(var s=u(e,t),c=0;c<n.length;c++){var l=a(n[c]);0===i[l].references&&(i[l].updater(),i.splice(l,1))}n=s}}}},184:(e,t,n)=>{"use strict";n.d(t,{$:()=>a});var r=n(976),o=n(870),i=n(559);class a extends r.JsViewer{constructor(e){super(),this.canvas=o.canvas(),this.gridCellStyle=r.GridCellStyle.create(),this.renderer=e,this.root.append(this.canvas),this.canvas.style.width="100%",this.canvas.style.height="100%",o.tools.handleResize(this.canvas,((e,t)=>{this.canvas.width=e,this.canvas.height=t,this.render()}));const t=e=>t=>{this.gridCell&&e(this.gridCell,t)};this.canvas.onmousemove=t(this.renderer.onMouseMove),this.canvas.onmouseenter=t(this.renderer.onMouseEnter),this.canvas.onmouseleave=t(this.renderer.onMouseLeave)}static fromGridCell(e){const t=new a(new i.cv);return t.gridCell=e,t.render(),t}render(){if(!this.gridCell)return;const e=this.canvas.getContext("2d");e.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderer.renderInternal(e,0,0,this.canvas.width,this.canvas.height,this.gridCell.dart,this.gridCellStyle)}}},840:(e,t,n)=>{"use strict";n.d(t,{DI:()=>a}),n(976);var r=n(469),o=n(526),i=(n(114),n(414),function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))});function a(){return i(this,void 0,void 0,(function*(){r.shell.windows.showContextPanel=!0;const e=yield r.data.loadTable(`${o._package.webRoot}files/curves-demo.csv`);r.shell.addTableView(e)}))}},188:(e,t,n)=>{"use strict";n.d(t,{No:()=>v,Z:()=>w,hS:()=>g});var r=n(976),o=n(870),i=n(416),a=n(114),u=n(559),s=n(184),c=n(711);const l=".sourceColumn",f=".statistics",m="chartOptions",h="seriesOptions";var d;!function(e){e.DATAFRAME="Dataframe",e.COLUMN="Column",e.CELL="Cell"}(d||(d={}));const p={count:"totalCount",nulls:"missingValueCount",unique:"uniqueCount",values:"valueCount",min:"min",max:"max",sum:"sum",avg:"avg",stdev:"stdev",variance:"variance",skew:"skew",kurt:"kurt",med:"med",q1:"q1",q2:"q2",q3:"q3"};function g(e,t){const n=(0,i.Y6)(e);return e.parameters?t.logX&&e.parameters[2]>0&&(e.parameters[2]=Math.log10(e.parameters[2])):e.parameters=(0,i.PK)(e,n,t).parameters,(0,i.tq)(e,n,t)}function v(e,t){var n,o,i;const a={logX:null===(n=e.chartOptions)||void 0===n?void 0:n.logX,logY:null===(o=e.chartOptions)||void 0===o?void 0:o.logY},u=[],s=[],c=[],l=[],f=[],m=[],h=[];for(let t=0,n=0;t<(null===(i=e.series)||void 0===i?void 0:i.length);t++){if(e.series[t].points.every((e=>e.outlier)))continue;const r=g(e.series[t],a);u[n]=r.rSquared,s[n]=r.auc,c[n]=r.interceptX,l[n]=r.interceptY,f[n]=r.slope,m[n]=r.top,h[n]=r.bottom,n++}return{rSquared:r.Stats.fromValues(u)[p[t]],auc:r.Stats.fromValues(s)[p[t]],interceptX:r.Stats.fromValues(c)[p[t]],interceptY:r.Stats.fromValues(l)[p[t]],slope:r.Stats.fromValues(f)[p[t]],top:r.Stats.fromValues(m)[p[t]],bottom:r.Stats.fromValues(h)[p[t]]}}function y(e,t,n,o){var i;const a=e.grid,s=r.Column.float(`${e.name}_${n.name}_${t.name}`,null===(i=e.column)||void 0===i?void 0:i.length);s.tags[l]=e.name,s.tags[".seriesNumber"]=o,s.tags[f]=t.name,s.init((n=>{var i,s;const l=r.GridCell.fromColumnRow(a,e.name,a.tableRowToGrid(n));if(""===l.cell.value)return null;const f=l.cell.column.getTag(u.Rj)===u.NH?(0,c.f)(l.cell.value):(0,u.W$)(l);if(void 0===f.series[o]||f.series[o].points.every((e=>e.outlier)))return null;const m={logX:null===(i=f.chartOptions)||void 0===i?void 0:i.logX,logY:null===(s=f.chartOptions)||void 0===s?void 0:s.logY},h=g(f.series[o],m);return t.get(h)})),a.dataFrame.columns.insert(s,e.idx)}function A(e){for(let t=0;t<e.length;t++){const n=e.get(t);if(""===n)continue;const r=(0,c.f)(n);e.set(t,JSON.stringify(r))}e.setTag(u.Rj,"")}function x(e,t,n,r){var o;void 0===e.cell.column.temp[`${m}-custom-title`]&&function(e){var t,n;const r=e.columns.bySemTypeAll(a.j2);for(let e=0;e<r.length;e++){a.kW.map((t=>{r[e].temp[`${m}-custom-${t.name}`]=!1})),a.K0.map((t=>{r[e].temp[`${h}-custom-${t.name}`]=!1})),r[e].getTag(u.Rj)===u.NH&&A(r[e]);for(let o=0;o<r[e].length;o++){if(""===r[e].get(o))continue;const i=null!==(n=JSON.parse(null!==(t=r[e].get(o))&&void 0!==t?t:"{}"))&&void 0!==n?n:{};a.kW.map((t=>{i.chartOptions&&void 0!==i.chartOptions[t.name]&&(r[e].temp[`${m}-custom-${t.name}`]=!0)})),a.K0.map((t=>{if(i.series)for(const n of i.series)void 0!==n[t.name]&&(r[e].temp[`${h}-custom-${t.name}`]=!0)}))}}}(e.cell.dataFrame);const s=t.property.name,c=r===d.DATAFRAME?(0,i.jG)(e.cell.dataFrame):(0,i.hq)(e.cell.column);if(n===m?c.chartOptions[s]=t.value:n===h&&(c.seriesOptions[s]=t.value),r===d.CELL){const r=e.cell.value;if(""===r)return;const i=null!==(o=JSON.parse(null!=r?r:"{}"))&&void 0!==o?o:{};!function(e,t,n){const r=t.property.name;if(n===m){if(void 0===e.chartOptions)return;e.chartOptions[r]=t.value}else if(n===h){if(void 0===e.series)return;for(let n=0;n<e.series.length;n++)e.series[n][r]=t.value}}(i,t,n),e.cell.value=JSON.stringify(i)}else{let t;r===d.DATAFRAME?(e.cell.dataFrame.tags[a.Kp]=JSON.stringify(c),t=e.cell.dataFrame.columns.bySemTypeAll(a.j2)):(e.cell.column.tags[a.Kp]=JSON.stringify(c),t=[e.cell.column]);for(let e=0;e<t.length;e++){if(r===d.DATAFRAME){const r=(0,i.hq)(t[e]);n===m?delete r.chartOptions[s]:delete r.seriesOptions[s],t[e].tags[a.Kp]=JSON.stringify(r)}!1!==t[e].temp[`${n}-custom-${s}`]&&(t[e].init((r=>{var o,i;const a=t[e].get(r);if(""===a)return a;const u=null!==(i=JSON.parse(null!==(o=t[e].get(r))&&void 0!==o?o:"{}"))&&void 0!==i?i:{};if(n===m){if(void 0===u.chartOptions)return a;if(void 0===u.chartOptions[s])return a;delete u.chartOptions[s]}else{if(void 0===u.series)return a;let e=!1;for(const t of u.series)void 0!==t[s]&&(delete t[s],e=!0);if(u.seriesOptions&&delete u.seriesOptions[s],!e)return a}return JSON.stringify(u)})),t[e].temp[`${n}-custom-${s}`]=!1)}}e.grid.invalidate()}class w extends r.ObjectHandler{get type(){return"GridCell"}isApplicable(e){return e instanceof r.GridCell&&e.cellType===a.d8}renderProperties(e,t=null){var n,d,p,A,w,b;const C=o.accordion("Curves property panel"),T=r.Property.js("level",r.TYPE.STRING,{description:"Controls the level at which properties will be switched",defaultValue:"Column",choices:["Dataframe","Column","Cell"],nullable:!1}),_=o.input.forProperty(T);o.tooltip.bind(_.captionLabel,"Controls the level at which properties will be switched");const S=(0,u.W$)(e),I=(0,i.hq)(e.cell.column),O=(0,i.jG)(e.cell.dataFrame),k={onValueChanged:t=>x(e,t,h,_.value)},E={onValueChanged:t=>x(e,t,m,_.value)};(0,u.fi)(null===(n=O.seriesOptions)||void 0===n?void 0:n.pointColor)||(0,u.fi)(null===(d=I.seriesOptions)||void 0===d?void 0:d.pointColor)||(S.seriesOptions?(0,u.fi)(S.seriesOptions.pointColor)||(S.seriesOptions.pointColor=r.Color.toHtml(r.Color.getCategoricalColor(0))):(0,u.fi)(S.series?S.series[0].pointColor:"")||(S.series[0].pointColor=r.Color.toHtml(r.Color.getCategoricalColor(0)))),(0,u.fi)(null===(p=O.seriesOptions)||void 0===p?void 0:p.fitLineColor)||(0,u.fi)(null===(A=I.seriesOptions)||void 0===A?void 0:A.fitLineColor)||(S.seriesOptions?(0,u.fi)(S.seriesOptions.fitLineColor)||(S.seriesOptions.fitLineColor=r.Color.toHtml(r.Color.getCategoricalColor(0))):(0,u.fi)(S.series?S.series[0].fitLineColor:"")||(S.series[0].fitLineColor=r.Color.toHtml(r.Color.getCategoricalColor(0)))),(0,u.BI)(a.K0,I.seriesOptions,S.seriesOptions?S.seriesOptions:S.series&&null!==(w=S.series[0])&&void 0!==w?w:{}),(0,u.BI)(a.K0,O.seriesOptions,S.seriesOptions?S.seriesOptions:S.series&&null!==(b=S.series[0])&&void 0!==b?b:{}),(0,u.BI)(a.kW,I.chartOptions,S.chartOptions?S.chartOptions:{}),(0,u.BI)(a.kW,O.chartOptions,S.chartOptions?S.chartOptions:{}),C.addPane("Options",(()=>o.divV([_.root,o.h3("Series options"),o.input.form(S.seriesOptions?S.seriesOptions:S.series[0],a.K0,k),o.h3("Chart options"),o.input.form(S.chartOptions,a.kW,E)])));const M=r.Property.js("series",r.TYPE.STRING,{description:"Controls whether to show series statistics or aggregated statistics",defaultValue:"All",choices:["all","aggregated"],nullable:!1}),B=o.input.forProperty(M,null,{onValueChanged(e){C.getPane("Fit").root.lastElementChild.replaceChildren(L())}}),R=r.Property.js("aggregation type",r.TYPE.STRING,{description:"Controls which aggregation to use on the series statistics",defaultValue:"med",choices:Object.values(r.STATS),nullable:!1}),N=o.input.forProperty(R,null,{onValueChanged(e){C.getPane("Fit").root.lastElementChild.replaceChildren(L())}});function L(){var t,n,s;const m=o.divV("aggregated"===B.stringValue?[B.root,N.root]:[B.root]),h=(0,i.dU)(S);if(h.x<=0&&S.chartOptions&&(S.chartOptions.logX=!1),h.y<=0&&S.chartOptions&&(S.chartOptions.logY=!1),"all"===B.stringValue){const i={logX:null===(t=S.chartOptions)||void 0===t?void 0:t.logX,logY:null===(n=S.chartOptions)||void 0===n?void 0:n.logY};for(let t=0;t<S.series.length;t++){const n=S.series[t],u=g(n,i),c=n.fitLineColor&&r.Color.fromHtml(n.fitLineColor)?n.fitLineColor:r.Color.toHtml(r.Color.getCategoricalColor(t));m.appendChild(o.panel([o.h1(null!==(s=n.name)&&void 0!==s?s:"series "+t,{style:{color:c}}),o.input.form(u,a.sw,{onCreated:r=>r.root.appendChild(o.iconFA("plus",(()=>y(e.gridColumn,r.property,n,t)),`Calculate ${r.property.name} for the whole column`))})]))}}else{const t=v(S,N.stringValue);m.appendChild(o.panel([o.h1(`series ${N.stringValue}`),o.input.form(t,a.sw,{onCreated:t=>t.root.appendChild(o.iconFA("plus",(()=>function(e,t,n){var o;const i=e.grid,a=r.Column.float(`${e.name}_${n}_${t.name}`,null===(o=e.column)||void 0===o?void 0:o.length);a.tags[l]=e.name,a.tags[".seriesAggregation"]=n,a.tags[f]=t.name,a.init((o=>{var a;const s=r.GridCell.fromColumnRow(i,e.name,i.tableRowToGrid(o));if(""===s.cell.value)return null;const l=s.cell.column.getTag(u.Rj)===u.NH?(0,c.f)(s.cell.value):(0,u.W$)(s);if(null===(a=l.series)||void 0===a?void 0:a.every((e=>e.points.every((e=>e.outlier)))))return null;const f=v(l,n);return t.get(f)})),i.dataFrame.columns.insert(a,e.idx)}(e.gridColumn,t.property,N.stringValue)),`Calculate ${t.property.name} for the whole column`))})]))}return m}return C.addPane("Fit",(()=>L())),C.addPane("Chart",(()=>s.$.fromGridCell(e).root)),C.root}}},711:(e,t,n)=>{"use strict";n.d(t,{f:()=>c});var r=n(976),o=n(114);const i={x:"xAxis",y:"yAxis"},a={min:"min",max:"max"};function u(e){var t,n,i;const a=null===(n=null===(t=e.getElementsByTagName("params")[0])||void 0===t?void 0:t.childNodes[0].nodeValue)||void 0===n?void 0:n.split(",").map(Number);let u=null===(i=e.getElementsByTagName("function")[0])||void 0===i?void 0:i.getAttribute("type");u=u&&"sigif"!==u?u:o.yB;const s=e.getElementsByTagName("settings")[0].getAttribute("markerColor"),c=e.getElementsByTagName("settings")[0].getAttribute("color"),l=!!e.getElementsByTagName("settings")[0].getAttribute("drawLine"),f={name:e.getAttribute("name"),fitFunction:u,markerType:r.MARKER_TYPE.CIRCLE,pointColor:s,fitLineColor:c,showFitLine:l,showPoints:"points",showCurveConfidenceInterval:!1,clickToToggle:!1};return a&&(f.parameters=[a[2],a[1],a[0],a[3]]),f}function s(e){const t=function(e){var t,n,r;const o=null===(t=e.getElementsByTagName("x")[0].childNodes[0].nodeValue)||void 0===t?void 0:t.split(","),i=null===(n=e.getElementsByTagName("y")[0].childNodes[0].nodeValue)||void 0===n?void 0:n.split(","),a=null===(r=e.getElementsByTagName("mask")[0].childNodes[0].nodeValue)||void 0===r?void 0:r.split(""),u=[];for(let e=0;e<o.length;e++)u[e]={x:+o[e],y:+i[e],outlier:!Boolean(a[e])};return u}(e),n=u(e),r={points:t};return Object.assign(r,n),r}function c(e){const t=(new DOMParser).parseFromString(e,"text/xml"),n=t.getElementsByTagName("grid")[0],r=(c=t.getElementsByTagName("settings")[0],{minX:+(o=n).getElementsByTagName(i.x)[0].getAttribute(a.min),minY:+o.getElementsByTagName(i.y)[0].getAttribute(a.min),maxX:+o.getElementsByTagName(i.x)[0].getAttribute(a.max),maxY:+o.getElementsByTagName(i.y)[0].getAttribute(a.max),xAxisName:c.getAttribute("xLabel"),yAxisName:c.getAttribute("yLabel"),logX:!!c.getAttribute("logX")});var o,c;const l=t.getElementsByTagName("seriesCollection")[0],f=u(l.getElementsByTagName("series")[0]),m=function(e){const t=[],n=e.getElementsByTagName("series").length;for(let r=0;r<n;r++){const n=e.getElementsByTagName("series")[r];t[r]=s(n)}return t}(l);return{chartOptions:r,seriesOptions:f,series:m}}},559:(e,t,n)=>{"use strict";n.d(t,{cv:()=>N,Rj:()=>g,NH:()=>v,W$:()=>T,fi:()=>S,BI:()=>C});var r=n(976),o=n(469),i=n(870),a=n(114),u=n(111),s=n(766);const c=window,l=new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});class f{static getUniqueName(e,t,n){return c.grok_Utils_GetUniqueName(e,t,null==n?void 0:n.auto,null==n?void 0:n.idx,null==n?void 0:n.render,null==n?void 0:n.choices)}static isEmpty(e){return null==e||""==e}static formatNumber(e){return l.format(e)}}var m=n(416),h=n(711),d=n(184),p=n(188);const g=".fitChartFormat",v="3dx",y=100,A=18,x=4,w=3.5,b={solid:[],dotted:[1,1],dashed:[5,5],dashdotted:[5,5,2,5]};function C(e,t,n){if(t&&n)for(const r of e)!(r.name in n)&&r.name in t&&(n[r.name]=t[r.name])}function T(e){var t,n,o,i,u,s;const c=(null===(n=null===(t=e.cell)||void 0===t?void 0:t.column)||void 0===n?void 0:n.type)===r.TYPE.STRING?e.cell.column.getTag(g)===v?(0,h.f)(e.cell.value):null!==(i=JSON.parse(null!==(o=e.cell.value)&&void 0!==o?o:"{}"))&&void 0!==i?i:{}:(0,m.TL)(),l=e.cell.column?(0,m.hq)(e.cell.column):{},f=e.cell.column?(0,m.jG)(e.cell.dataFrame):{};null!==(u=c.series)&&void 0!==u||(c.series=[]),null!==(s=c.chartOptions)&&void 0!==s||(c.chartOptions=l.chartOptions),C(a.kW,l.chartOptions,c.chartOptions),C(a.kW,f.chartOptions,c.chartOptions);for(const e of c.series)C(a.K0,l.seriesOptions,e),C(a.K0,f.seriesOptions,e);return c}function _(e,t,n){if(e.width<y||e.height<55)return[e,void 0,void 0];const r=t?45:38,o=t?30:15,i=n?25:5;return[e.cutLeft(r).cutBottom(o).cutTop(i).cutRight(A),e.getBottom(o).getTop(i).cutLeft(r).cutRight(A),e.getLeft(r).getRight(A).cutBottom(o).cutTop(i)]}function S(e){return null!=e&&""!==e&&void 0!==r.Color.fromHtml(e)}function I(e,t,n,r){e.moveTo(r.xToScreen(t)-x/2,r.yToScreen(n)),e.lineTo(r.xToScreen(t)+x/2,r.yToScreen(n))}function O(e,t,n,o,i,a){I(e,t,n.lowerAdjacentValue,o),e.moveTo(o.xToScreen(t),o.yToScreen(n.lowerAdjacentValue)),e.lineTo(o.xToScreen(t),o.yToScreen(n.upperAdjacentValue)),I(e,t,n.upperAdjacentValue,o),r.Paint.marker(e,r.MARKER_TYPE.CIRCLE,o.xToScreen(t),o.yToScreen(n.q2),a,w*i)}function k(e,t,n,o,i,a){for(let i=0;i<t.points.length;i++){const u=t.points[i],s=u.outlier?r.Color.red:u.color&&r.Color.fromHtml(u.color)?r.Color.fromHtml(u.color):a,c=u.marker?u.marker:t.markerType,l=u.outlier?12*o:u.size?u.size:4*o;r.Paint.marker(e,u.outlier?r.MARKER_TYPE.OUTLIER:c,n.xToScreen(u.x),n.yToScreen(u.y),s,l),u.stdev&&!u.outlier&&(e.strokeStyle=r.Color.toHtml(s),e.beginPath(),e.moveTo(n.xToScreen(u.x),n.yToScreen(u.y+u.stdev)),e.lineTo(n.xToScreen(u.x),n.yToScreen(u.y-u.stdev)),e.stroke())}}function E(e,t,n,o,i){for(let a=0,s=null;a<t.points.length;a++){const c=t.points[a];if(c.outlier)continue;const l=a+1<t.points.length&&t.points[a+1].x===c.x;if(!s&&l)s=a;else if(null!==s&&!l){const l=[];for(let e=s,n=0;e<=a;e++,n++)l[n]=t.points[e].y;const f=(0,u.G)(l);if(e.beginPath(),O(e,c.x,f,n,o,i),e.stroke(),"both"===t.showPoints)for(let i=0;i<l.length;i++)(l[i]<f.lowerAdjacentValue||l[i]>f.upperAdjacentValue)&&r.Paint.marker(e,r.MARKER_TYPE.OUTLIER,n.xToScreen(c.x),n.yToScreen(l[i]),t.pointColor?r.Color.fromHtml(t.pointColor):r.Color.scatterPlotMarker,6*o);s=null}}}function M(e,t,n,r,o,i,u,s){e.beginPath();const c=i?u?45:38:0,l=i?A:0,f=o===a.vK.TOP?t.confidenceTop:t.confidenceBottom;for(let t=c;t<=n.width-l;t++){const o=n.x+t,i=s.logX?Math.log10(r.xToWorld(o)):r.xToWorld(o),a=s.logY?r.yToScreen(Math.pow(10,f(i))):r.yToScreen(f(i));t===c?e.moveTo(o,a):e.lineTo(o,a)}e.stroke()}function B(e,t,n,r,o,i,a){e.beginPath();const u=o?i?45:38:0,s=o?A:0;for(let o=u;o<=n.width-s;o++){const i=n.x+o,s=a.logX?Math.log10(r.xToWorld(i)):r.xToWorld(i),c=a.logY?r.yToScreen(Math.pow(10,t.confidenceTop(s))):r.yToScreen(t.confidenceTop(s));o===u?e.moveTo(i,c):e.lineTo(i,c)}for(let o=n.width-s;o>=u;o--){const i=n.x+o,u=a.logX?Math.log10(r.xToWorld(i)):r.xToWorld(i),s=a.logY?r.yToScreen(Math.pow(10,t.confidenceBottom(u))):r.yToScreen(t.confidenceBottom(u));e.lineTo(i,s)}e.closePath(),e.fill()}function R(e,t,n,r,o,i){i.logX&&(n=Math.pow(10,n));const a=i.logX?Math.log10(n):n,u=i.logY?Math.pow(10,o(a)):o(a);e.moveTo(t.xToScreen(r.minX),t.yToScreen(u)),e.lineTo(t.xToScreen(n),t.yToScreen(u)),e.lineTo(t.xToScreen(n),t.yToScreen(r.minY))}class N extends r.GridCellRenderer{get name(){return a.d8}get cellType(){return a.d8}getDefaultSize(e){return{width:220,height:150}}onClick(e,t){var n,r,i,a,u,c,l,f;if(!e.cell.value)return;const d=e.cell.column.getTag(g)===v?(0,h.f)(e.cell.value):T(e);if(null===(n=d.series)||void 0===n?void 0:n.some((e=>0===e.points.length)))return;o.shell.o=e;const A=e.bounds.inflate(-6,-6),x=_(A,e.bounds.width>=180&&e.bounds.height>=140,e.bounds.width>=275&&e.bounds.height>=225)[0],w=(0,m.dU)(d),b=new s.l(w,x,null!==(i=null===(r=d.chartOptions)||void 0===r?void 0:r.logX)&&void 0!==i&&i,null!==(u=null===(a=d.chartOptions)||void 0===a?void 0:a.logY)&&void 0!==u&&u);for(let n=0;n<(null===(c=d.series)||void 0===c?void 0:c.length);n++)if(!(!d.series[n].clickToToggle||"points"!==d.series[n].showPoints||A.width<y||A.height<55))for(let r=0;r<d.series[n].points.length;r++){const o=d.series[n].points[r],i=b.xToScreen(o.x),a=b.yToScreen(o.y),u=(o.outlier?12:4)/2+2;if(t.offsetX>=i-u&&t.offsetX<=i+u&&t.offsetY>=a-u&&t.offsetY<=a+u){o.outlier=!o.outlier;const t=e.grid.dataFrame.columns.byTags({".sourceColumn":e.cell.column.name});if(t)for(const r of t){const t={logX:null===(l=d.chartOptions)||void 0===l?void 0:l.logX,logY:null===(f=d.chartOptions)||void 0===f?void 0:f.logY},o=null!==r.tags[".seriesAggregation"]?(0,p.No)(d,r.tags[".seriesAggregation"]):r.tags[".seriesNumber"]===n?(0,p.hS)(d.series[n],t):null;null!==o&&r.set(e.cell.rowIndex,o[r.tags[".statistics"]])}if(e.cell.column.getTag(g)!==v){const t=JSON.parse(e.cell.value);t.series[n].points[r].outlier=o.outlier,e.cell.value=JSON.stringify(t)}return}}}onDoubleClick(e,t){if(!e.cell.value)return;const n=d.$.fromGridCell(e),r=i.dialog({title:"Edit chart"}).add(n.root).show({resizable:!0}).root.getElementsByClassName("d4-dialog-contents dlg-edit-chart")[0].firstChild;n.canvas.width=r.clientWidth,n.canvas.height=r.clientHeight,n.render(),r.style.width="100%",r.style.height="100%",i.tools.handleResize(r,((e,t)=>{n.canvas.width=e,n.canvas.height=t,n.render()}))}renderCurves(e,t,n,o,i,u){var c,l,h,d,p,g,v,x,w,C,T,S,I,O,N,L,P,j,q,F,D,V;e.save(),e.beginPath(),e.rect(t,n,o,i),e.clip();const Y=new r.Rect(t,n,o,i).inflate(-6,-6),U=Y.width>=y&&Y.height>=55,G=o>=180&&i>=140&&!!(null===(c=u.chartOptions)||void 0===c?void 0:c.xAxisName)&&!!u.chartOptions.yAxisName,X=o>=275&&i>=225&&!!(null===(l=u.chartOptions)||void 0===l?void 0:l.title),[W,H,z]=_(Y,G,X),$=(0,m.dU)(u);$.x<=0&&u.chartOptions&&(u.chartOptions.logX=!1),$.y<=0&&u.chartOptions&&(u.chartOptions.logY=!1);const K=new s.l($,W,null!==(d=null===(h=u.chartOptions)||void 0===h?void 0:h.logX)&&void 0!==d&&d,null!==(g=null===(p=u.chartOptions)||void 0===p?void 0:p.logY)&&void 0!==g&&g),Q=Math.min(W.width,W.height),Z=Q>100?1:.2+Q/100*.8,J={logX:null===(v=u.chartOptions)||void 0===v?void 0:v.logX,logY:null===(x=u.chartOptions)||void 0===x?void 0:x.logY};e.save(),e.font='11px Roboto, "Roboto Local"',K.drawCoordinateGrid(e,H,z),e.restore();for(let t=0;t<(null===(w=u.series)||void 0===w?void 0:w.length);t++){const n=u.series[t];if(n.points.some((e=>void 0===e.x||void 0===e.y)))continue;(o<70||i<45)&&(n.showPoints="",u.chartOptions&&(u.chartOptions.showStatistics=[])),n.points.sort(((e,t)=>e.x-t.x));let s=!0;const c=(0,m.Y6)(n);let l;if(n.parameters)(null===(C=u.chartOptions)||void 0===C?void 0:C.logX)&&n.parameters[2]>0&&(n.parameters[2]=Math.log10(n.parameters[2])),l=(0,m.kG)(n,c);else{const e=(0,m.PK)(n,c,J);l=e.fittedCurve,n.parameters=e.parameters,s=!1}if(null===(T=n.showPoints)||void 0===T||T){const o=n.pointColor&&r.Color.fromHtml(n.pointColor)?n.pointColor:r.Color.toHtml(r.Color.getCategoricalColor(t));e.strokeStyle=o,"points"===n.showPoints?k(e,n,K,Z,0,r.Color.fromHtml(o)):["candlesticks","both"].includes(n.showPoints)&&E(e,n,K,Z,r.Color.fromHtml(o))}if(null===(S=n.showFitLine)||void 0===S||S){const o=n.fitLineColor&&r.Color.fromHtml(n.fitLineColor)?n.fitLineColor:r.Color.toHtml(r.Color.getCategoricalColor(t));e.save(),e.strokeStyle=o,e.lineWidth=2*Z,e.beginPath(),n.lineStyle&&e.setLineDash(b[n.lineStyle]);const i=U?G?45:38:0,a=U?A:0;for(let t=i;t<=Y.width-a;t++){const n=Y.x+t,r=(null===(I=u.chartOptions)||void 0===I?void 0:I.logX)?Math.log10(K.xToWorld(n)):K.xToWorld(n),o=(null===(O=u.chartOptions)||void 0===O?void 0:O.logY)?K.yToScreen(Math.pow(10,l(r))):K.yToScreen(l(r));t===i?e.moveTo(n,o):e.lineTo(n,o)}e.stroke(),e.restore()}if((null===(N=n.showFitLine)||void 0===N||N)&&null!==(L=n.showCurveConfidenceInterval)&&void 0!==L&&L){e.strokeStyle=null!==(P=n.confidenceIntervalColor)&&void 0!==P?P:a.Qc,e.fillStyle=null!==(j=n.confidenceIntervalColor)&&void 0!==j?j:a.XD;const t=(0,m.LC)(n,c,s,J);M(e,t,Y,K,a.vK.TOP,U,G,J),M(e,t,Y,K,a.vK.BOTTOM,U,G,J),B(e,t,Y,K,U,G,J)}if(n.droplines&&G){e.save(),e.strokeStyle="blue",e.lineWidth=Z,e.beginPath(),e.setLineDash([5,5]);for(let t=0;t<n.droplines.length;t++)"IC50"===n.droplines[t]&&R(e,K,n.parameters[2],$,l,J);e.stroke(),e.restore()}if(null===(q=u.chartOptions)||void 0===q?void 0:q.showStatistics){const o=(0,m.tq)(n,c,J);for(let i=0;i<u.chartOptions.showStatistics.length;i++){const s=u.chartOptions.showStatistics[i],c=a.sw.find((e=>e.name===s));if(c){const a=f.formatNumber(c.get(o)),u=n.fitLineColor&&r.Color.fromHtml(n.fitLineColor)?n.fitLineColor:r.Color.toHtml(r.Color.getCategoricalColor(t));e.fillStyle=u,e.textAlign="left",e.fillText(c.name+": "+a,W.x+5,W.y+20+20*i)}}}}if(X&&(e.font='12px Roboto, "Roboto Local"',e.textAlign="center",e.fillStyle="black",e.fillText(null===(F=u.chartOptions)||void 0===F?void 0:F.title,W.midX-5,n+15)),G){e.font='11px Roboto, "Roboto Local"',e.textAlign="center",e.fillStyle="black",e.fillText(null===(D=u.chartOptions)||void 0===D?void 0:D.xAxisName,W.midX-5,n+i-10),e.translate(t,n),e.rotate(-Math.PI/2);const r=X?25:5;e.fillText(null===(V=u.chartOptions)||void 0===V?void 0:V.yAxisName,-(W.height/2+r+15),15),e.restore()}e.restore()}render(e,t,n,r,o,i,a){var u,s;if(r<20||o<10)return;if(!i.cell.value)return;const c=(null===(u=i.cell.column)||void 0===u?void 0:u.getTag(g))===v?(0,h.f)(i.cell.value):T(i);(null===(s=c.series)||void 0===s?void 0:s.some((e=>0===e.points.length)))||this.renderCurves(e,t,n,r,o,c)}onMouseMove(e,t){var n,r,o,a,u;if(!e.cell.value)return;if(e.bounds.width<70||e.bounds.height<45){const n=i.canvas(300,200);this.render(n.getContext("2d"),0,0,300,200,e,null);const r=i.divV([n]);i.tooltip.show(r,t.x,t.y)}const c=e.cell.column.getTag(g)===v?(0,h.f)(e.cell.value):T(e),l=e.bounds.inflate(-6,-6),f=_(l,e.bounds.width>=180&&e.bounds.height>=140,e.bounds.width>=275&&e.bounds.height>=225)[0],d=(0,m.dU)(c),p=new s.l(d,f,null!==(r=null===(n=c.chartOptions)||void 0===n?void 0:n.logX)&&void 0!==r&&r,null!==(a=null===(o=c.chartOptions)||void 0===o?void 0:o.logY)&&void 0!==a&&a);for(let e=0;e<(null===(u=c.series)||void 0===u?void 0:u.length);e++)if(!(!c.series[e].clickToToggle||"points"!==c.series[e].showPoints||l.width<y||l.height<55))for(let n=0;n<c.series[e].points.length;n++){const r=c.series[e].points[n],o=p.xToScreen(r.x),i=p.yToScreen(r.y),a=(r.outlier?12:4)/2+2;if(t.offsetX>=o-a&&t.offsetX<=o+a&&t.offsetY>=i-a&&t.offsetY<=i+a)return void(document.body.style.cursor="pointer")}document.body.style.cursor="default"}}},526:(e,t,n)=>{"use strict";n.r(t),n.d(t,{_FitViewer:()=>p,_initCurves:()=>v,_package:()=>h,curveFitDemo:()=>g,fitCellRenderer:()=>d});var r=n(976),o=n(188),i=n(559),a=n(184),u=n(114),s=n(442),c=n(701);class l extends a.${constructor(){super(new i.cv),this.showSelectedRowsCurves=!1,this.showCurrentRowCurve=!0,this.showMouseOverRowCurve=!0,this.rows=[],this.data=new u.cY,this.curvesColumnName=this.column("curves"),this.showSelectedRowsCurves=this.bool("showSelectedRowsCurves",!1,{description:"Adds curves from the selected rows"}),this.showCurrentRowCurve=this.bool("showCurrentRowCurve",!0),this.showMouseOverRowCurve=this.bool("showMouseOverRowCurve",!0);for(const e of u.kW)this.addProperty(e.name,e.propertyType,e.defaultValue,e.options)}static fromChartData(e){let t=new l;return t.data=e,t.render(),t}applyViewerProperties(){(0,i.BI)(u.kW,this,this.data.chartOptions)}createChartData(){var e,t;this.rows.length=0,this.showCurrentRowCurve&&-1!==this.dataFrame.currentRowIdx&&this.rows.push(this.dataFrame.currentRowIdx),this.showMouseOverRowCurve&&-1!==this.dataFrame.mouseOverRowIdx&&this.rows.push(this.dataFrame.mouseOverRowIdx),this.showSelectedRowsCurves&&-1!==this.dataFrame.mouseOverRowIdx&&this.rows.push(...this.dataFrame.selection.getSelectedIndexes()),this.data=new u.cY;const n=null===(e=this.tableView)||void 0===e?void 0:e.grid;for(let e of this.rows){const r=(0,i.W$)(n.cell(this.curvesColumnName,n.tableRowToGrid(e)));null===(t=this.data.series)||void 0===t||t.push(...r.series)}}onPropertyChanged(e){this.applyViewerProperties(),this.render()}onTableAttached(){var e,t,n;const r=null===(e=this.tableView)||void 0===e?void 0:e.grid;null!==(t=this.curvesColumnName)&&void 0!==t||(this.curvesColumnName=null===(n=this.dataFrame.columns.bySemType(u.j2))||void 0===n?void 0:n.name),(0,c.merge)(this.dataFrame.onCurrentCellChanged,r.onCellMouseEnter,this.dataFrame.onSelectionChanged).pipe((0,s.debounce)((e=>(0,c.interval)(50)))).subscribe((e=>{this.createChartData(),this.render()}))}render(){const e=this.canvas.getContext("2d");e.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderer.renderCurves(e,0,0,this.canvas.width,this.canvas.height,this.data)}}var f=n(840),m=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))};const h=new r.Package;function d(){return new i.cv}function p(){return new l}function g(){return m(this,void 0,void 0,(function*(){yield(0,f.DI)()}))}function v(){r.ObjectHandler.register(new o.Z)}},126:function(e){var t;t=()=>(()=>{"use strict";var e,t={588:(e,t,n)=>{n.d(t,{default:()=>l});const r=(...e)=>{},o=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=e=>null!==e&&"Object"===(null==e?void 0:e.constructor.name),a=(e="")=>e.normalize("NFD").replace(/\p{Diacritic}/gu,""),u=(e,t)=>{const n=e.length;if(!n)return[];if(i(e[0])){for(let r=0;r<n;r++)if(!(t in e[r]))throw new Error("e03");return e}return e.reduce((function(e,n){return e.push({[t]:n&&"string"==typeof n?n:JSON.stringify(n)}),e}),[])},s={get:async function(e,t){return async function(e){const t=await e.text(),n=t&&JSON.parse(t);return e.ok?n:Promise.reject(n&&n.message||e.statusText)}(await fetch(e,t||{method:"GET"}))}},c=(e={})=>{const{hasDiacritics:t}=e;let n={};const r=String.fromCharCode(0);function o(e=""){return e=`${e}`,t&&(e=a(e)),e.toLowerCase().trim().split(/\s+/)}return{add:function(e,t="",i){if(!e)return;let a,u=n;(e=e.constructor===Array?e:[e]).forEach((e=>{o("string"==typeof e?e:e[t]).filter((e=>e)).forEach((t=>{u=n;for(let e=0,n=t.length;e<n;e++)a=t[e],u=u[a]||(u[a]={});const o="string"==typeof e?e:i&&i(e)||JSON.stringify(e);u[r]?u[r][o]=e:u[r]={[o]:e}}))}))},clear:function(){n={}},search:function(e,t){const i=o(e),a=[];let u={};i.forEach((e=>{a.push(function(e){let t,o=n,i={};for(let n=0,r=e.length;n<r;n++)if(t=e[n],o=o[t],void 0===o)return{};const a=[o],u=[e];let s;for(;a.length;)for(s in e=u.pop(),o=a.pop(),o)s!==r?(a.push(o[s]),u.push(e+s)):i=Object.assign(i,o[r]);return i}(e))})),u=a.reduce(((e,t)=>{const n={};return Object.keys(e).filter((e=>t[e])).forEach((t=>{n[t]=e[t]})),n})),u=Object.values(u);const s=u.length;return t&&s>t&&(u.length=t),{suggestions:u,count:s}}}};function l(e){var t,n,l;if(!e.input)throw new Error("e01");if(!i(e.source))throw new Error("e02");const f=document,m=f.createElement("div"),h=e.debounceRemote||100,d=e.preventSubmit||!1,p=e.minLength||1,g=!1!==e.hint,v=e.autoSelect||!1,y=e.templates,A=c({hasDiacritics:e.diacritics}),x=e.source.identifier||"label",w=e.source.groupIdentifier||"",b=e=>`${e[x]}`,C=e.display||b,T=e.source.identity||b,_=e.onSubmit||r,S=(null===(t=e.source.dataTokens)||void 0===t?void 0:t.constructor)===Array?e.source.dataTokens:void 0,I=e.source.transform||(e=>e),O=e.source.local||null,k=(null===(n=e.source.remote)||void 0===n?void 0:n.url)&&e.source.remote.wildcard?e.source.remote:null,E=(null===(l=e.source.prefetch)||void 0===l?void 0:l.url)?{when:"onInit",done:!1,...e.source.prefetch}:null,M={wrapper:"",input:"tt-input",hint:"tt-hint",highlight:"tt-highlight",hide:"tt-hide",show:"tt-show",list:"tt-list",selected:"tt-selected",header:"tt-header",footer:"tt-footer",loader:"tt-loader",suggestion:"tt-suggestion",group:"tt-group",empty:"tt-empty",notFound:"tt-notFound",...e.classNames||{}};if(!O&&!E&&!k)throw new Error("e02");const B={query:"",items:[],count:0,limit:e.limit||5};let R,N,L={},P={},j=!1,q="";y&&(y.header="function"==typeof y.header?y.header:void 0,y.footer="function"==typeof y.footer?y.footer:void 0,y.notFound="function"==typeof y.notFound?y.notFound:void 0,y.group="function"==typeof y.group?y.group:void 0,y.suggestion="function"==typeof y.suggestion?y.suggestion:void 0,y.loader="function"==typeof y.loader?y.loader:void 0,y.empty="function"==typeof y.empty?y.empty:void 0);const F=(e=[])=>{ie(u(e,x))};O&&F(O);const D=e.input;D.classList.add(M.input);const V=window.getComputedStyle(D),Y=f.createElement("div");Y.className=`typeahead-standalone${e.className?` ${e.className}`:""}${M.wrapper?` ${M.wrapper}`:""}`,B.container=Y;const U=D.parentNode,G=[...U.children].indexOf(D);U.removeChild(D),Y.appendChild(D),U.insertBefore(Y,U.children[G]);const X=D.cloneNode();function W(){if(!E||E.done)return;let e=[];s.get("function"==typeof E.url?E.url():E.url,null==E?void 0:E.requestOptions).then((t=>{e=I(t),e=u(e,x),ie(e)}),(e=>{console.error("e04",e)})).finally((()=>{"function"==typeof E.process&&E.process(e)})),E.done=!0}g&&function(e){["id","name","placeholder","required","aria-label"].forEach((t=>e.removeAttribute(t))),e.setAttribute("readonly","true"),e.setAttribute("aria-hidden","true"),e.style.marginTop=`-${D.offsetHeight+parseInt(V.marginBottom)}px`,e.tabIndex=-1,e.className=M.hint,D.after(e)}(X),m.classList.add(M.list,M.hide),m.tabIndex=0,m.setAttribute("aria-label","menu-options"),m.setAttribute("role","listbox"),m.style.position="absolute",m.style.width=`${D.offsetWidth}px`,m.style.marginTop=`${D.offsetHeight+parseInt(V.marginTop)}px`,Y.appendChild(m),E&&"onInit"===E.when&&W();const H=()=>{m.classList.remove(M.hide)},z=()=>{N&&window.clearTimeout(N)},$=()=>{B.items=[],X.value="",q="",m.classList.add(M.hide)},K=()=>{D.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:"insertCompositionText",data:D.value}))},Q=(e=!1)=>{if(!B.items.length&&B.query){$(),Z();const t=(null==y?void 0:y.notFound)&&y.notFound(B);if(!t)return!0;const n=e=>{const t=f.createElement("div");t.classList.add(M.notFound),le(t,e),m.appendChild(t)};return k?(L[JSON.stringify(B.query)]||e&&!j)&&n(t):n(t),H(),!0}},Z=()=>{for(;m.firstChild;)m.firstChild.remove()},J=()=>{if(!(null==y?void 0:y.loader))return;if(!j){const e=m.querySelector(`.${M.loader}`);return void(e&&m.removeChild(e))}const e=f.createElement("div");e.classList.add(M.loader),le(e,y.loader()),(null==y?void 0:y.footer)?m.insertBefore(e,m.querySelector(`.${M.footer}`)):m.appendChild(e)},ee=()=>{var t;if(Q())return;Z();const n=e=>{const t=f.createElement("div");return t.classList.add(M.suggestion),t.setAttribute("role","option"),t.setAttribute("aria-selected","false"),t.setAttribute("aria-label",C(e)),(null==y?void 0:y.suggestion)?le(t,y.suggestion(e,B)):t.textContent=e[x]||"",t},r=e=>{const t=f.createElement("div");return t.classList.add(M.group),t.setAttribute("role","group"),t.setAttribute("aria-label",e),(null==y?void 0:y.group)?le(t,y.group(e,B)):t.textContent=e||"",t},o=f.createDocumentFragment(),i=[];if(null==y?void 0:y.header){const e=f.createElement("div");e.classList.add(M.header),e.setAttribute("role","presentation"),le(e,y.header(B))&&o.appendChild(e)}for(const[t,a]of B.items.entries()){if(t===B.limit)break;if(a[w]&&!i.includes(a[w])){i.push(a[w]);const e=r(a[w]);o.appendChild(e)}const u=n(a);u.addEventListener("click",(e=>{$(),R=a,D.value=C(a,e),K()})),a===R&&(u.classList.add(M.selected),u.setAttribute("aria-selected","true")),o.appendChild(u),e.highlight&&se(u,B.query)}if(null==y?void 0:y.footer){const e=f.createElement("div");e.classList.add(M.footer),e.setAttribute("role","presentation"),le(e,y.footer(B))&&o.appendChild(e)}m.appendChild(o),g&&ce(R||B.items[0]),null===(t=m.querySelector(`.${M.selected}`))||void 0===t||t.scrollIntoView({block:"nearest"}),H()},te=()=>{var e,t;z();const n=D.value.replace(/\s{2,}/g," ").trim();if((null==y?void 0:y.empty)&&!n.length){const t=y.empty(B);if(B.query="",null===(e=B.defaultItems)||void 0===e?void 0:e.length)return B.items=u(I(B.defaultItems),x),ee();$(),Z();const n=f.createElement("div");return n.classList.add(M.empty),le(n,t),t&&m.appendChild(n),H()}if(n.length>=p){B.query=n,re();const e=JSON.stringify(B.query);k&&B.items.length<B.limit&&(null===(t=P[e])||void 0===t?void 0:t.length)&&re(P[e]),ee(),N=window.setTimeout((function(){B.items.length<B.limit&&!j&&oe()}),h)}else B.query="",$()},ne=(t="")=>(e.diacritics&&(t=a(t)),t.toLowerCase()),re=e=>{let{suggestions:t,count:n}=A.search(B.query,B.limit);if(null==e?void 0:e.length){e.push(...t);const r={};e.forEach((e=>{r[T(e)]=e})),t=Object.values(r),n=t.length}ae(t),w&&ue(t),B.items=t,B.count=n,R=void 0,v&&B.items.length&&(R=B.items[0])},oe=()=>{if(!k)return;j=!0;const e=B.query,t=JSON.stringify(e);if(L[t]||!B.query.length)return j=!1,void Q(!0);J();let n=[];s.get(("function"==typeof k.url?k.url():k.url).replace(k.wildcard,e),null==k?void 0:k.requestOptions).then((e=>{n=I(e),n=u(n,x),ie(n)}),(e=>{console.error("e05",e)})).finally((()=>{L[t]=!0,P[t]=n||[],j=!1,J(),n.length&&B.query.length&&(re(n),ee()),B.query.length&&e!==B.query&&oe(),Q(!0)}))};function ie(e){e.length&&(A.add(e,x,T),S&&S.forEach((t=>{A.add(e,t,T)})))}const ae=e=>{e.sort(((e,t)=>{const n=e[x].toLowerCase().startsWith(B.query.toLowerCase()),r=t[x].toLowerCase().startsWith(B.query.toLowerCase());return n&&!r||n&&e[x].length<t[x].length?-1:0}))},ue=e=>{e.sort(((e,t)=>!e[w]||e[w]<t[w]?-1:e[w]>t[w]?1:0))},se=(t,n)=>{const r=(e,t)=>{let n;for(let o=0;o<e.childNodes.length;o++)n=e.childNodes[o],3===n.nodeType?o+=t(n)?1:0:r(n,t)},i=((e,t)=>{const n=o(e);return new RegExp("("+n+")","i")})(n);n&&r(t,(t=>{var n;let r=i.exec(t.data);e.diacritics&&!r&&(r=i.exec(a(t.data)));const o=f.createElement("span");if(o.className=M.highlight,r){const e=t.splitText(r.index);e.splitText(r[0].length),o.appendChild(e.cloneNode(!0)),null===(n=null==t?void 0:t.parentNode)||void 0===n||n.replaceChild(o,e)}return!!r}))},ce=t=>{const n=D.value;if(n&&C(t)!==n&&0===ne(C(t)).indexOf(ne(n).replace(/\s{2,}/g," ").trimStart())){const r=C(t),i=new RegExp(o(B.query),"i");let u=i.exec(r);e.diacritics&&!u&&(u=i.exec(a(r))),u&&(X.value=n.replace(/\s?$/,"")+r.substring(u[0].length))}else X.value=""},le=(e,t)=>{const n=f.createElement("template");return n.innerHTML=t,e.appendChild(n.content),t};m.addEventListener("mousedown",(function(e){e.stopPropagation(),e.preventDefault()}));const fe=e=>{$(),A.clear(),O&&!e&&F(O),L={},P={},E&&(E.done=!1)};return D.addEventListener("keydown",(e=>{if(!D.value.length||"Escape"===e.key)return $();if(B.items.length&&("ArrowUp"===e.key||"ArrowDown"===e.key))return"ArrowDown"===e.key?(e=>{const t=B.items.length>=B.limit?B.limit:B.items.length;if(!R)return R=B.items[0],void(D.value=C(R,e));if(R===B.items[t-1])return R=void 0,void(D.value=q);for(let e=0;e<t-1;e++)if(R===B.items[e]){R=B.items[e+1];break}D.value=C(R,e)})(e):(e=>{const t=B.items.length>=B.limit?B.limit:B.items.length;if(R===B.items[0])return R=void 0,void(D.value=q);if(R){for(let e=t-1;e>0;e--)if(R===B.items[e]||1===e){R=B.items[e-1];break}}else R=B.items[t-1];D.value=C(R,e)})(e),ee(),e.preventDefault(),void e.stopPropagation();const t=function(t=!1){if(!R&&t&&B.items.length&&(R=B.items[0]),R)return $(),D.value=C(R,e),K(),R};if("Enter"===e.key)return d&&e.preventDefault(),void _(e,t());"Tab"!==e.key||m.classList.contains(M.hide)||(e.preventDefault(),t(!0))})),D.addEventListener("input",(e=>{("insertCompositionText"!==e.inputType||e.isComposing)&&(q=D.value,te())})),D.addEventListener("blur",(()=>{setTimeout((()=>{f.activeElement!==D&&$()}),50)})),D.addEventListener("focus",(()=>{E&&"onFocus"===E.when&&W(),te()})),{addToIndex:F,reset:fe,destroy:()=>{z(),fe(),Y.replaceWith(D.cloneNode())}}}}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.m=t,e=[],r.O=(t,n,o,i)=>{if(!n){var a=1/0;for(l=0;l<e.length;l++){for(var[n,o,i]=e[l],u=!0,s=0;s<n.length;s++)(!1&i||a>=i)&&Object.keys(r.O).every((e=>r.O[e](n[s])))?n.splice(s--,1):(u=!1,i<a&&(a=i));if(u){e.splice(l--,1);var c=o();void 0!==c&&(t=c)}}return t}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[n,o,i]},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={179:0,53:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var o,i,[a,u,s]=n,c=0;if(a.some((t=>0!==e[t]))){for(o in u)r.o(u,o)&&(r.m[o]=u[o]);if(s)var l=s(r)}for(t&&t(n);c<a.length;c++)i=a[c],r.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return r.O(l)},n=this.webpackChunktypeahead=this.webpackChunktypeahead||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var o=r.O(void 0,[53],(()=>r(588)));return(o=r.O(o)).default})(),e.exports=t()},976:e=>{"use strict";e.exports=DG},469:e=>{"use strict";e.exports=grok},701:e=>{"use strict";e.exports=rxjs},442:e=>{"use strict";e.exports=rxjs.operators},870:e=>{"use strict";e.exports=ui},414:e=>{"use strict";e.exports=wu}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={id:e,exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nc=void 0;var __webpack_exports__=__webpack_require__(526);curves=__webpack_exports__})();
2
2
  //# sourceMappingURL=package.js.map