import{a7 as Vr}from"./index-5ce8de01.js";var rr=1e-6,O=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});function He(){var r=new O(9);return O!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function _e(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}function Ie(r){var e=new O(9);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e}function Te(r,e,n,t,a,i,u,s,o){var f=new O(9);return f[0]=r,f[1]=e,f[2]=n,f[3]=t,f[4]=a,f[5]=i,f[6]=u,f[7]=s,f[8]=o,f}function $e(r,e){var n=e[0],t=e[1],a=e[2],i=e[3],u=e[4],s=e[5],o=e[6],f=e[7],c=e[8],l=c*u-s*f,x=-c*i+s*o,g=f*i-u*o,h=n*l+t*x+a*g;return h?(h=1/h,r[0]=l*h,r[1]=(-c*t+a*f)*h,r[2]=(s*t-a*u)*h,r[3]=x*h,r[4]=(c*n-a*o)*h,r[5]=(-s*n+a*i)*h,r[6]=g*h,r[7]=(-f*n+t*o)*h,r[8]=(u*n-t*i)*h,r):null}function Wr(r,e,n){var t=e[0],a=e[1],i=e[2],u=e[3],s=e[4],o=e[5],f=e[6],c=e[7],l=e[8],x=n[0],g=n[1],h=n[2],d=n[3],m=n[4],v=n[5],M=n[6],w=n[7],y=n[8];return r[0]=x*t+g*u+h*f,r[1]=x*a+g*s+h*c,r[2]=x*i+g*o+h*l,r[3]=d*t+m*u+v*f,r[4]=d*a+m*s+v*c,r[5]=d*i+m*o+v*l,r[6]=M*t+w*u+y*f,r[7]=M*a+w*s+y*c,r[8]=M*i+w*o+y*l,r}function Fe(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=e[0],r[7]=e[1],r[8]=1,r}function qe(r,e){var n=Math.sin(e),t=Math.cos(e);return r[0]=t,r[1]=n,r[2]=0,r[3]=-n,r[4]=t,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function ke(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=e[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}var Re=Wr;function Gr(){var r=new O(3);return O!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function je(r){var e=new O(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Br(r){var e=r[0],n=r[1],t=r[2];return Math.hypot(e,n,t)}function Ce(r,e,n){var t=new O(3);return t[0]=r,t[1]=e,t[2]=n,t}function Ze(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function Le(r,e,n,t){return r[0]=e,r[1]=n,r[2]=t,r}function Ue(r,e,n){return r[0]=e[0]+n[0],r[1]=e[1]+n[1],r[2]=e[2]+n[2],r}function Ve(r,e,n){return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],r}function We(r,e,n){return r[0]=e[0]*n[0],r[1]=e[1]*n[1],r[2]=e[2]*n[2],r}function Ge(r,e,n){return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r}function Jr(r,e){var n=e[0]-r[0],t=e[1]-r[1],a=e[2]-r[2];return Math.hypot(n,t,a)}function Be(r,e){var n=e[0],t=e[1],a=e[2],i=n*n+t*t+a*a;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function Je(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Xe(r,e,n){var t=e[0],a=e[1],i=e[2],u=n[0],s=n[1],o=n[2];return r[0]=a*o-i*s,r[1]=i*u-t*o,r[2]=t*s-a*u,r}function Qe(r,e,n,t){var a=e[0],i=e[1],u=e[2];return r[0]=a+t*(n[0]-a),r[1]=i+t*(n[1]-i),r[2]=u+t*(n[2]-u),r}function Ke(r,e,n){var t=e[0],a=e[1],i=e[2],u=n[3]*t+n[7]*a+n[11]*i+n[15];return u=u||1,r[0]=(n[0]*t+n[4]*a+n[8]*i+n[12])/u,r[1]=(n[1]*t+n[5]*a+n[9]*i+n[13])/u,r[2]=(n[2]*t+n[6]*a+n[10]*i+n[14])/u,r}function rn(r,e,n){var t=e[0],a=e[1],i=e[2];return r[0]=t*n[0]+a*n[3]+i*n[6],r[1]=t*n[1]+a*n[4]+i*n[7],r[2]=t*n[2]+a*n[5]+i*n[8],r}function en(r,e,n){var t=n[0],a=n[1],i=n[2],u=n[3],s=e[0],o=e[1],f=e[2],c=a*f-i*o,l=i*s-t*f,x=t*o-a*s,g=a*x-i*l,h=i*c-t*x,d=t*l-a*c,m=u*2;return c*=m,l*=m,x*=m,g*=2,h*=2,d*=2,r[0]=s+c+g,r[1]=o+l+h,r[2]=f+x+d,r}function nn(r,e){var n=r[0],t=r[1],a=r[2],i=e[0],u=e[1],s=e[2];return Math.abs(n-i)<=rr*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(t-u)<=rr*Math.max(1,Math.abs(t),Math.abs(u))&&Math.abs(a-s)<=rr*Math.max(1,Math.abs(a),Math.abs(s))}var tn=Jr,an=Br;(function(){var r=Gr();return function(e,n,t,a,i,u){var s,o;for(n||(n=3),t||(t=0),a?o=Math.min(a*n+t,e.length):o=e.length,s=t;s0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function gn(r,e){return r[0]*e[0]+r[1]*e[1]}function vn(r,e,n){var t=e[0],a=e[1];return r[0]=n[0]*t+n[3]*a+n[6],r[1]=n[1]*t+n[4]*a+n[7],r}function mn(r,e){var n=r[0],t=r[1],a=e[0],i=e[1],u=Math.sqrt(n*n+t*t)*Math.sqrt(a*a+i*i),s=u&&(n*a+t*i)/u;return Math.acos(Math.min(Math.max(s,-1),1))}function yn(r,e){return r[0]===e[0]&&r[1]===e[1]}var pn=Qr;(function(){var r=Xr();return function(e,n,t,a,i,u){var s,o;for(n||(n=2),t||(t=0),a?o=Math.min(a*n+t,e.length):o=e.length,s=t;s0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]=r.length&&(r=void 0),{value:r&&r[t++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Nn(r,e){var n=typeof Symbol=="function"&&r[Symbol.iterator];if(!n)return r;var t=n.call(r),a,i=[],u;try{for(;(e===void 0||e-- >0)&&!(a=t.next()).done;)i.push(a.value)}catch(s){u={error:s}}finally{try{a&&!a.done&&(n=t.return)&&n.call(t)}finally{if(u)throw u.error}}return i}function Kr(){for(var r=0,e=0,n=arguments.length;e-1?a:null}};function $(r){for(var e=[],n=1;n3?0:(r-r%10!==10?1:0)*r%10]}},B=$({},ar),Hr=function(r){return B=$(B,r)},lr=function(r){return r.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},N=function(r,e){for(e===void 0&&(e=2),r=String(r);r.length0?"-":"+")+N(Math.floor(Math.abs(e)/60)*100+Math.abs(e)%60,4)},Z:function(r){var e=r.getTimezoneOffset();return(e>0?"-":"+")+N(Math.floor(Math.abs(e)/60),2)+":"+N(Math.abs(e)%60,2)}},hr=function(r){return+r-1},xr=[null,T],dr=[null,j],gr=["isPm",j,function(r,e){var n=r.toLowerCase();return n===e.amPm[0]?0:n===e.amPm[1]?1:null}],vr=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(r){var e=(r+"").match(/([+-]|\d\d)/gi);if(e){var n=+e[1]*60+parseInt(e[2],10);return e[0]==="+"?n:-n}return 0}],ie={D:["day",T],DD:["day",I],Do:["day",T+j,function(r){return parseInt(r,10)}],M:["month",T,hr],MM:["month",I,hr],YY:["year",I,function(r){var e=new Date,n=+(""+e.getFullYear()).substr(0,2);return+(""+(+r>68?n-1:n)+r)}],h:["hour",T,void 0,"isPm"],hh:["hour",I,void 0,"isPm"],H:["hour",T],HH:["hour",I],m:["minute",T],mm:["minute",I],s:["second",T],ss:["second",I],YYYY:["year",ee],S:["millisecond","\\d",function(r){return+r*100}],SS:["millisecond",I,function(r){return+r*10}],SSS:["millisecond",re],d:xr,dd:xr,ddd:dr,dddd:dr,MMM:["month",j,cr("monthNamesShort")],MMMM:["month",j,cr("monthNames")],a:gr,A:gr,ZZ:vr,Z:vr},J={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},_r=function(r){return $(J,r)},Ir=function(r,e,n){if(e===void 0&&(e=J.default),n===void 0&&(n={}),typeof r=="number"&&(r=new Date(r)),Object.prototype.toString.call(r)!=="[object Date]"||isNaN(r.getTime()))throw new Error("Invalid Date pass to format");e=J[e]||e;var t=[];e=e.replace(Or,function(i,u){return t.push(u),"@@@"});var a=$($({},B),n);return e=e.replace(Yr,function(i){return ae[i](r,a)}),e.replace(/@@@/g,function(){return t.shift()})};function Tr(r,e,n){if(n===void 0&&(n={}),typeof e!="string")throw new Error("Invalid format in fecha parse");if(e=J[e]||e,r.length>1e3)return null;var t=new Date,a={year:t.getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},i=[],u=[],s=e.replace(Or,function(y,p){return u.push(lr(p)),"@@@"}),o={},f={};s=lr(s).replace(Yr,function(y){var p=ie[y],S=p[0],F=p[1],H=p[3];if(o[S])throw new Error("Invalid format. "+S+" specified twice in format");return o[S]=!0,H&&(f[H]=!0),i.push(p),"("+F+")"}),Object.keys(f).forEach(function(y){if(!o[y])throw new Error("Invalid format. "+y+" is required in specified format")}),s=s.replace(/@@@/g,function(){return u.shift()});var c=r.match(new RegExp(s,"i"));if(!c)return null;for(var l=$($({},B),n),x=1;x11||a.month<0||a.day>31||a.day<1||a.hour>23||a.hour<0||a.minute>59||a.minute<0||a.second>59||a.second<0)return null;return v}var fe={format:Ir,parse:Tr,defaultI18n:ar,setGlobalDateI18n:Hr,setGlobalDateMasks:_r};const Yn=Object.freeze(Object.defineProperty({__proto__:null,assign:$,default:fe,defaultI18n:ar,format:Ir,parse:Tr,setGlobalDateI18n:Hr,setGlobalDateMasks:_r},Symbol.toStringTag,{value:"Module"}));function ir(r,e,n){r.prototype=e.prototype=n,n.constructor=r}function $r(r,e){var n=Object.create(r.prototype);for(var t in e)n[t]=e[t];return n}function L(){}var C=.7,X=1/C,k="\\s*([+-]?\\d+)\\s*",Z="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",P="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oe=/^#([0-9a-f]{3,8})$/,ue=new RegExp("^rgb\\("+[k,k,k]+"\\)$"),se=new RegExp("^rgb\\("+[P,P,P]+"\\)$"),ce=new RegExp("^rgba\\("+[k,k,k,Z]+"\\)$"),le=new RegExp("^rgba\\("+[P,P,P,Z]+"\\)$"),he=new RegExp("^hsl\\("+[Z,P,P]+"\\)$"),xe=new RegExp("^hsla\\("+[Z,P,P,Z]+"\\)$"),mr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ir(L,fr,{copy:function(r){return Object.assign(new this.constructor,this,r)},displayable:function(){return this.rgb().displayable()},hex:yr,formatHex:yr,formatHsl:de,formatRgb:pr,toString:pr});function yr(){return this.rgb().formatHex()}function de(){return Fr(this).formatHsl()}function pr(){return this.rgb().formatRgb()}function fr(r){var e,n;return r=(r+"").trim().toLowerCase(),(e=oe.exec(r))?(n=e[1].length,e=parseInt(e[1],16),n===6?br(e):n===3?new E(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?W(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?W(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ue.exec(r))?new E(e[1],e[2],e[3],1):(e=se.exec(r))?new E(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ce.exec(r))?W(e[1],e[2],e[3],e[4]):(e=le.exec(r))?W(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=he.exec(r))?Sr(e[1],e[2]/100,e[3]/100,1):(e=xe.exec(r))?Sr(e[1],e[2]/100,e[3]/100,e[4]):mr.hasOwnProperty(r)?br(mr[r]):r==="transparent"?new E(NaN,NaN,NaN,0):null}function br(r){return new E(r>>16&255,r>>8&255,r&255,1)}function W(r,e,n,t){return t<=0&&(r=e=n=NaN),new E(r,e,n,t)}function ge(r){return r instanceof L||(r=fr(r)),r?(r=r.rgb(),new E(r.r,r.g,r.b,r.opacity)):new E}function ve(r,e,n,t){return arguments.length===1?ge(r):new E(r,e,n,t??1)}function E(r,e,n,t){this.r=+r,this.g=+e,this.b=+n,this.opacity=+t}ir(E,ve,$r(L,{brighter:function(r){return r=r==null?X:Math.pow(X,r),new E(this.r*r,this.g*r,this.b*r,this.opacity)},darker:function(r){return r=r==null?C:Math.pow(C,r),new E(this.r*r,this.g*r,this.b*r,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Mr,formatHex:Mr,formatRgb:wr,toString:wr}));function Mr(){return"#"+er(this.r)+er(this.g)+er(this.b)}function wr(){var r=this.opacity;return r=isNaN(r)?1:Math.max(0,Math.min(1,r)),(r===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(r===1?")":", "+r+")")}function er(r){return r=Math.max(0,Math.min(255,Math.round(r)||0)),(r<16?"0":"")+r.toString(16)}function Sr(r,e,n,t){return t<=0?r=e=n=NaN:n<=0||n>=1?r=e=NaN:e<=0&&(r=NaN),new z(r,e,n,t)}function Fr(r){if(r instanceof z)return new z(r.h,r.s,r.l,r.opacity);if(r instanceof L||(r=fr(r)),!r)return new z;if(r instanceof z)return r;r=r.rgb();var e=r.r/255,n=r.g/255,t=r.b/255,a=Math.min(e,n,t),i=Math.max(e,n,t),u=NaN,s=i-a,o=(i+a)/2;return s?(e===i?u=(n-t)/s+(n0&&o<1?0:u,new z(u,s,o,r.opacity)}function me(r,e,n,t){return arguments.length===1?Fr(r):new z(r,e,n,t??1)}function z(r,e,n,t){this.h=+r,this.s=+e,this.l=+n,this.opacity=+t}ir(z,me,$r(L,{brighter:function(r){return r=r==null?X:Math.pow(X,r),new z(this.h,this.s,this.l*r,this.opacity)},darker:function(r){return r=r==null?C:Math.pow(C,r),new z(this.h,this.s,this.l*r,this.opacity)},rgb:function(){var r=this.h%360+(this.h<0)*360,e=isNaN(r)||isNaN(this.s)?0:this.s,n=this.l,t=n+(n<.5?n:1-n)*e,a=2*n-t;return new E(nr(r>=240?r-240:r+120,a,t),nr(r,a,t),nr(r<120?r+240:r-120,a,t),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var r=this.opacity;return r=isNaN(r)?1:Math.max(0,Math.min(1,r)),(r===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(r===1?")":", "+r+")")}}));function nr(r,e,n){return(r<60?e+(n-e)*r/60:r<180?n:r<240?e+(n-e)*(240-r)/60:e)*255}var qr={exports:{}},kr={exports:{}};(function(r){var e=r.exports;r.exports.isNumber=function(n){return typeof n=="number"},r.exports.findMin=function(n){if(n.length===0)return 1/0;for(var t=n[0],a=1;a=v.length)){var D=Math.max(b-l,0),or=b,Q=Math.min(b+l,v.length-1),K=D-(b-l),Zr=b+l-Q,Lr=y[-l-1+K]||0,Ur=y[-l-1+Zr]||0,V=p/(p-Lr-Ur);K>0&&(F+=V*(K-1)*S);var ur=Math.max(0,b-l+1);i.inside(0,v.length-1,ur)&&(v[ur].y+=V*1*S),i.inside(0,v.length-1,or+1)&&(v[or+1].y-=V*2*S),i.inside(0,v.length-1,Q+1)&&(v[Q+1].y+=V*1*S)}});var H=F,q=0,A=0;return v.forEach(function(Y){q+=Y.y,H+=q,Y.y=H,A+=H}),A>0&&v.forEach(function(Y){Y.y/=A}),v};function s(o,f){for(var c={},l=0,x=-f;x<=f;x++)l+=o(x/f),c[x]=l;return c}r.exports.getExpectedValueFromPdf=function(o){if(!(!o||o.length===0)){var f=0;return o.forEach(function(c){f+=c.x*c.y}),f}},r.exports.getXWithLeftTailArea=function(o,f){if(!(!o||o.length===0)){for(var c=0,l=0,x=0;x=f));x++);return o[l].x}},r.exports.getPerplexity=function(o){if(!(!o||o.length===0)){var f=0;return o.forEach(function(c){var l=Math.log(c.y);isFinite(l)&&(f+=c.y*l)}),f=-f/t,Math.pow(2,f)}}})(qr);var pe=qr.exports;const On=Vr(pe);function An(r,e,n,t){t=t||{};var a=t.maxIterations||100,i=t.tolerance||1e-10,u=r(e),s=r(n),o=n-e;if(u*s>0)throw"Initial bisect points must have opposite signs";if(u===0)return e;if(s===0)return n;for(var f=0;f=0&&(e=c),Math.abs(o)=h[g-1].fx){var Y=!1;if(y.fx>A.fx?(_(p,1+c,w,-c,A),p.fx=r(p),p.fx=1)break;for(d=1;ds+i*a*o||f>=v)m=a;else{if(Math.abs(l)<=-u*o)return a;l*(m-d)>=0&&(m=d),d=a,v=f}return 0}for(var h=0;h<10;++h){if(_(t.x,1,n.x,a,e),f=t.fx=r(t.x,t.fxprime),l=R(t.fxprime,e),f>s+i*a*o||h&&f>=c)return g(x,a,c);if(Math.abs(l)<=-u*o)return a;if(l>=0)return g(a,x,f);c=f,x=a,a*=2}return a}function Hn(r,e,n){var t={x:e.slice(),fx:0,fxprime:e.slice()},a={x:e.slice(),fx:0,fxprime:e.slice()},i=e.slice(),u,s,o=1,f;n=n||{},f=n.maxIterations||e.length*20,t.fx=r(t.x,t.fxprime),u=t.fxprime.slice(),Nr(u,t.fxprime,-1);for(var c=0;c