var a;(function(i){i.Begin="begin",i.End="end"})(a||(a={}));function g(i,n,u,r,t){t===void 0&&(t=a.End);var o=i===0;if(o)return-(r+u*n);var d=Math.pow(1+i,n),f=t===a.Begin?1:0;return-r*d-u*(1+i*f)/i*(d-1)}function m(i,n,u,r,t){r===void 0&&(r=0),t===void 0&&(t=a.End);var o=i===0,d=Math.pow(1+i,n),f=t===a.Begin?1:0,v=o?1:i,c=o?n:(1+v*f)*(d-1)/v;return-(r+u*d)/c}function l(i,n,u,r,t,o){if(t===void 0&&(t=0),o===void 0&&(o=a.End),n<1)return Number.NaN;if(o===a.Begin&&n===1)return 0;var d=m(i,u,r,t,o),f=B(i,n,d,r,o)*i;return o===a.Begin&&n>1&&(f=f/(1+i)),f}function E(i,n,u,r,t,o){t===void 0&&(t=0),o===void 0&&(o=a.End);var d=m(i,u,r,t,o);return d-l(i,n,u,r,t,o)}function B(i,n,u,r,t){return g(i,n-1,u,r,t)}export{E as p};
