@ohif/extension-dicom-microscopy 3.13.0-beta.105 → 3.13.0-beta.106
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@cornerstonejs/core"),require("dcmjs"),require("@ohif/i18n"),require("@ohif/core"),require("@ohif/ui-next"),require("@ohif/extension-default")):"function"==typeof define&&define.amd?define(["@cornerstonejs/core","dcmjs","@ohif/i18n","@ohif/core","@ohif/ui-next","@ohif/extension-default"],t):"object"==typeof exports?exports["ohif-extension-dicom-microscopy"]=t(require("@cornerstonejs/core"),require("dcmjs"),require("@ohif/i18n"),require("@ohif/core"),require("@ohif/ui-next"),require("@ohif/extension-default")):e["ohif-extension-dicom-microscopy"]=t(e["@cornerstonejs/core"],e.dcmjs,e["@ohif/i18n"],e["@ohif/core"],e["@ohif/ui-next"],e["@ohif/extension-default"])}(globalThis,(e,t,r,n,i,o)=>(()=>{var u={683(e,t,r){"use strict";r.r(t),r.d(t,{default:()=>E});var n=r(326),i=r(438),o=r(530),u=r.n(o);let a=e=>{let{list:t,itemGenerator:r}=e;if(t)return t.map(t=>{if(!t)return;let n=t.generator||r;if(!n)throw Error(`No generator for ${t}`);return n({...e,item:t})})};var s=r(55),c=r(867),l=r.n(c);function f(e,t){if(null!==e)return parseFloat(e).toFixed(t)}function h(e,t="HH:mm:ss"){return l()(e,"HH:mm:ss").format(t)}r(557);var d=r(2);let{formatPN:p}=d.utils,m=e=>{let{item:t}=e,{title:r,value:i,condition:o,contents:u}=t;if(e.image={...e.image,...e.metadata},e.formatDate=s.formatDICOMDate,e.formatTime=h,e.formatPN=p,e.formatNumberPrecision=f,o&&!o(e)||!u&&!i)return null;let a=i&&i(e),c=u&&u(e)||[{className:"mr-1",value:r},{classname:"mr-1 font-light",value:a}];return n.createElement("div",{key:t.id,className:"flex flex-row"},c.map((e,t)=>n.createElement("span",{key:t,className:e.className},e.value)))},D=({config:e,overlayData:t,...r})=>{let{topLeft:i=[],topRight:o=[],bottomLeft:s=[],bottomRight:c=[]}=t??{},l="absolute pointer-events-none microscopy-viewport-overlay";return n.createElement(n.Fragment,null,i&&i.length>0&&n.createElement("div",{"data-cy":"viewport-overlay-top-left",className:u()(l,"top-viewport left-viewport text-highlight")},a({...r,list:i,itemGenerator:m})),o&&o.length>0&&n.createElement("div",{"data-cy":"viewport-overlay-top-right",className:u()(l,"top-viewport right-viewport-scrollbar text-highlight")},a({...r,list:o,itemGenerator:m})),c&&c.length>0&&n.createElement("div",{"data-cy":"viewport-overlay-bottom-right",className:u()(l,"bottom-viewport right-viewport-scrollbar text-highlight")},a({...r,list:c,itemGenerator:m})),s&&s.length>0&&n.createElement("div",{"data-cy":"viewport-overlay-bottom-left",className:u()(l,"bottom-viewport left-viewport text-highlight")},a({...r,list:s,itemGenerator:m})))};var g=r(427),y=r(111),v=r.n(y);let w=n.memo(({activeViewportId:e,setViewportActive:t,displaySets:r,viewportId:o,dataSource:u,resizeRef:a})=>{let{servicesManager:s,extensionManager:c}=(0,d.useSystem)(),[l,f]=(0,n.useState)(!1),[h,p]=(0,n.useState)(null),[m,y]=(0,n.useState)(null),w=(0,n.useRef)(),E=(0,n.useRef)(),{microscopyService:_,customizationService:A}=s.services,F=A.getCustomization("microscopyViewport.overlay"),b=(0,n.useCallback)(async(e,t)=>{let r=async r=>{let{viewer:n,metadata:a}=await _.importDicomMicroscopyViewer(),l=n.VolumeImageViewer,f=(0,g.A)({extensionManager:c,servicesManager:s}),h=[];r.forEach(e=>{e.ImageType="string"==typeof e.ImageType?e.ImageType.split("\\"):e.ImageType;let t=(0,i.cleanDenaturalizedDataset)(v().data.DicomMetaDictionary.denaturalizeDataset(e),{StudyInstanceUID:e.StudyInstanceUID,SeriesInstanceUID:e.SeriesInstanceUID,dataSourceConfig:u.getConfig()});t["00480105"]||(t["00480105"]={vr:"SQ",Value:[{"00480106":{vr:"SH",Value:["1"]}}]});let r=new a.VLWholeSlideMicroscopyImage({metadata:t}),n=r.ImageType[2];("VOLUME"===n||"THUMBNAIL"===n)&&h.push(r)});let d=new l({client:f,metadata:h,retrieveRendered:!1,controls:["overview","position"]});w&&w.current&&d.addViewportOverlay&&d.addViewportOverlay({element:w.current,coordinates:[0,0],navigate:!0,className:"OpenLayersOverlay"}),d.render({container:e});let{StudyInstanceUID:m,SeriesInstanceUID:D}=t,E=_.addViewer(d,o,e,m,D);E.addContextMenuCallback(e=>{}),p(d),y(E)};_.clearAnnotations();let n=t;if(t.isOverlayDisplaySet&&(n=t.getSourceDisplaySet()),console.log("Loading viewer metadata",n),await r(n.others),t.isOverlayDisplaySet&&!t.isLoaded&&!t.isLoading){let e=t.getSourceDisplaySet();t.load(e)}},[u,c,_,s,o]);(0,n.useEffect)(()=>{if(!h){let e=r[0];b(E.current,e).then(()=>{f(!0)})}return()=>{h&&_.removeViewer(h)}},[h]),(0,n.useEffect)(()=>{let e=r[0];if(_.clearAnnotations(),e.isOverlayDisplaySet&&!e.isLoaded&&!e.isLoading){let t=e.getSourceDisplaySet();e.load(t)}},[m,r,_]);let C={width:"100%",height:"100%"},x=r[0],S=x.firstInstance||x.instance,M=A.getCustomization("ui.loadingIndicatorProgress");return n.createElement("div",{className:"DicomMicroscopyViewer",style:C,onClick:()=>{o!==e&&t(o)}},n.createElement("div",{style:{...C,display:"none"}},n.createElement("div",{style:{...C},ref:w},n.createElement("div",{style:{position:"relative",height:"100%",width:"100%"}},x&&S.imageId&&n.createElement(D,{overlayData:F,displaySet:x,instance:x.instance,metadata:x.metadata})))),n.createElement("div",{style:C,"data-viewportid":o,ref:e=>{E.current=e,a.current=e}}),l?null:n.createElement(M,{className:"h-full w-full bg-black"}))},function(e,t){if(e.setViewportActive!==t.setViewportActive||e.resizeRef!==t.resizeRef||e.viewportId!==t.viewportId||e.activeViewportId!==t.activeViewportId||e.dataSource!==t.dataSource)return!1;let r=e.displaySets,n=t.displaySets;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n.find(e=>e.displaySetInstanceUID===t.displaySetInstanceUID);if(!i||i.images?.length!==t.images?.length)return!1;if(i.images?.length){for(let e=0;e<i.images.length;e++)if(i.images[e].imageId!==t.images[e].imageId)return!1}}return!0});w.displayName="DicomMicroscopyViewport";let E=w},427(e,t,r){"use strict";r.d(t,{A:()=>o});var n=r(2),i=r(438);function o({extensionManager:e,servicesManager:t}){let r=window.config.dataSources.find(t=>t.sourceName===e.activeDataSourceName),{userAuthenticationService:u}=t.services,{wadoRoot:a,staticWado:s,singlepart:c}=r.configuration,l={url:a||"/dicomlocal",staticWado:s,singlepart:c,headers:u.getAuthorizationHeader(),errorInterceptor:n.errorHandler.getHTTPErrorHandler()},f=new i.StaticWadoClient(l);return f.wadoURL=l.url,"dicomlocal"===e.activeDataSourceName&&(f.retrieveInstanceFrames=async e=>{if(!("studyInstanceUID"in e))throw Error("Study Instance UID is required for retrieval of instance frames");if(!("seriesInstanceUID"in e))throw Error("Series Instance UID is required for retrieval of instance frames");if(!("sopInstanceUID"in e))throw Error("SOP Instance UID is required for retrieval of instance frames");if(!("frameNumbers"in e))throw Error("frame numbers are required for retrieval of instance frames");console.log(`retrieve frames ${e.frameNumbers.toString()} of instance ${e.sopInstanceUID}`);let t=n.DicomMetadataStore.getInstance(e.studyInstanceUID,e.seriesInstanceUID,e.sopInstanceUID);return(Array.isArray(e.frameNumbers)?e.frameNumbers:e.frameNumbers.split(",")).map(e=>Array.isArray(t.PixelData)?t.PixelData[e-1]:t.PixelData)}),f}},42(e){!function(){"use strict";var t={s:1,n:0,d:1};function r(e,t){if(isNaN(e=parseInt(e,10)))throw c();return e*t}function n(e,t){if(0===t)throw s();var r=Object.create(a.prototype);r.s=e<0?-1:1;var n=u(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function i(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var o=function(e,n){var i,o=0,u=1,a=1,f=0,h=0,d=0,p=1,m=1,D=0,g=1,y=1,v=1;if(null==e);else if(void 0!==n){if(a=(o=e)*(u=n),o%1!=0||u%1!=0)throw l()}else switch(typeof e){case"object":if("d"in e&&"n"in e)o=e.n,u=e.d,"s"in e&&(o*=e.s);else if(0 in e)o=e[0],1 in e&&(u=e[1]);else throw c();a=o*u;break;case"number":if(e<0&&(a=e,e=-e),e%1==0)o=e;else if(e>0){for(e>=1&&(m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=m);g<=1e7&&v<=1e7;){if(e===(i=(D+y)/(g+v))){g+v<=1e7?(o=D+y,u=g+v):v>g?(o=y,u=v):(o=D,u=g);break}e>i?(D+=y,g+=v):(y+=D,v+=g),g>1e7?(o=y,u=v):(o=D,u=g)}o*=m}else(isNaN(e)||isNaN(n))&&(u=o=NaN);break;case"string":if(null===(g=e.match(/\d+|./g)))throw c();if("-"===g[D]?(a=-1,D++):"+"===g[D]&&D++,g.length===D+1?h=r(g[D++],a):"."===g[D+1]||"."===g[D]?("."!==g[D]&&(f=r(g[D++],a)),(++D+1===g.length||"("===g[D+1]&&")"===g[D+3]||"'"===g[D+1]&&"'"===g[D+3])&&(h=r(g[D],a),p=Math.pow(10,g[D].length),D++),("("===g[D]&&")"===g[D+2]||"'"===g[D]&&"'"===g[D+2])&&(d=r(g[D+1],a),m=Math.pow(10,g[D+1].length)-1,D+=3)):"/"===g[D+1]||":"===g[D+1]?(h=r(g[D],a),p=r(g[D+2],1),D+=3):"/"===g[D+3]&&" "===g[D+1]&&(f=r(g[D],a),h=r(g[D+2],a),p=r(g[D+4],1),D+=5),g.length<=D){a=o=d+(u=p*m)*f+m*h;break}default:throw c()}if(0===u)throw s();t.s=a<0?-1:1,t.n=Math.abs(o),t.d=Math.abs(u)};function u(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function a(e,r){if(o(e,r),!(this instanceof a))return n(t.s*t.n,t.d);e=u(t.d,t.n),this.s=t.s,this.n=t.n/e,this.d=t.d/e}var s=function(){return Error("Division by Zero")},c=function(){return Error("Invalid argument")},l=function(){return Error("Parameters must be integer")};a.prototype={s:1,n:0,d:1,abs:function(){return n(this.n,this.d)},neg:function(){return n(-this.s*this.n,this.d)},add:function(e,r){return o(e,r),n(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(e,r){return o(e,r),n(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(e,r){return o(e,r),n(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(e,r){return o(e,r),n(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return n(this.s*this.n,this.d)},mod:function(e,r){if(isNaN(this.n)||isNaN(this.d))return new a(NaN);if(void 0===e)return n(this.s*this.n%this.d,1);if(o(e,r),0===t.n&&0===this.d)throw s();return n(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(e,r){return o(e,r),n(u(t.n,this.n)*u(t.d,this.d),t.d*this.d)},lcm:function(e,r){return(o(e,r),0===t.n&&0===this.n)?n(0,1):n(t.n*this.n,u(t.n,this.n)*u(t.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new a(NaN):n(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new a(NaN):n(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new a(NaN):n(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return n(this.s*this.d,this.n)},pow:function(e,r){if(o(e,r),1===t.d)if(t.s<0)return n(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n));else return n(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var u=i(this.n),a=i(this.d),s=1,c=1;for(var l in u)if("1"!==l){if("0"===l){s=0;break}if(u[l]*=t.n,u[l]%t.d!=0)return null;u[l]/=t.d,s*=Math.pow(l,u[l])}for(var l in a)if("1"!==l){if(a[l]*=t.n,a[l]%t.d!=0)return null;a[l]/=t.d,c*=Math.pow(l,a[l])}return t.s<0?n(c,s):n(s,c)},equals:function(e,r){return o(e,r),this.s*this.n*t.d==t.s*t.n*this.d},compare:function(e,r){o(e,r);var n=this.s*this.n*t.d-t.s*t.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),r=t.toContinued(),i=1;i<r.length;i++){for(var o=n(r[i-1],1),u=i-2;u>=0;u--)o=o.inverse().add(r[u]);if(Math.abs(o.sub(t).valueOf())<e)return o.mul(this.s)}return this},divisible:function(e,r){return o(e,r),!(!(t.n*this.d)||this.n*t.d%(t.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do n.push(Math.floor(t/r)),e=t%r,t=r,r=e;while(1!==t)return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=function(e){for(;e%2==0;e/=2);for(;e%5==0;e/=5);if(1===e)return 0;for(var t=10%e,r=1;1!==t;r++)if(t=10*t%e,r>2e3)return 0;return r}(r),i=function(e,t){for(var r=1,n=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,t,e),i=0;i<300;i++){if(r===n)return i;r=10*r%e,n=10*n%e}return 0}(r,n),o=this.s<0?"-":"";if(o+=t/r|0,t%=r,(t*=10)&&(o+="."),n){for(var u=i;u--;)o+=t/r|0,t%=r,t*=10;o+="(";for(var u=n;u--;)o+=t/r|0,t%=r,t*=10;o+=")"}else for(var u=e;t&&u--;)o+=t/r|0,t%=r,t*=10;return o}},Object.defineProperty(a,"__esModule",{value:!0}),a.default=a,a.Fraction=a,e.exports=a}()},51(e,t,r){var n=0/0,i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt,c="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,l="object"==typeof self&&self&&self.Object===Object&&self,f=c||l||Function("return this")(),h=Object.prototype.toString,d=Math.max,p=Math.min,m=function(){return f.Date.now()};function D(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==h.call(t))return n;if(D(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=D(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var c=u.test(e);return c||a.test(e)?s(e.slice(2),c?2:8):o.test(e)?n:+e}e.exports=function(e,t,r){var n,i,o,u,a,s,c=0,l=!1,f=!1,h=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=n,o=i;return n=i=void 0,c=t,u=e.apply(o,r)}function v(e){var r=e-s,n=e-c;return void 0===s||r>=t||r<0||f&&n>=o}function w(){var e,r,n,i=m();if(v(i))return E(i);a=setTimeout(w,(e=i-s,r=i-c,n=t-e,f?p(n,o-r):n))}function E(e){return(a=void 0,h&&n)?y(e):(n=i=void 0,u)}function _(){var e,r=m(),o=v(r);if(n=arguments,i=this,s=r,o){if(void 0===a)return c=e=s,a=setTimeout(w,t),l?y(e):u;if(f)return a=setTimeout(w,t),y(s)}return void 0===a&&(a=setTimeout(w,t)),u}return t=g(t)||0,D(r)&&(l=!!r.leading,o=(f="maxWait"in r)?d(g(r.maxWait)||0,t):o,h="trailing"in r?!!r.trailing:h),_.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=s=i=a=void 0},_.flush=function(){return void 0===a?u:E(m())},_}},187(e,t,r){e.exports=r(183).Symbol},990(e,t,r){var n=r(187),i=r(29),o=r(704),u=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?i(e):o(e)}},66(e,t,r){var n=r(158),i=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},194(e,t,r){e.exports="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g},29(e,t,r){var n=r(187),i=Object.prototype,o=i.hasOwnProperty,u=i.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var i=u.call(e);return n&&(t?e[a]=r:delete e[a]),i}},704(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},183(e,t,r){var n=r(194),i="object"==typeof self&&self&&self.Object===Object&&self;e.exports=n||i||Function("return this")()},158(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},803(e,t,r){var n=r(15),i=r(642),o=r(572),u=Math.max,a=Math.min;e.exports=function(e,t,r){var s,c,l,f,h,d,p=0,m=!1,D=!1,g=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=s,n=c;return s=c=void 0,p=t,f=e.apply(n,r)}function v(e){var r=e-d,n=e-p;return void 0===d||r>=t||r<0||D&&n>=l}function w(){var e,r,n,o=i();if(v(o))return E(o);h=setTimeout(w,(e=o-d,r=o-p,n=t-e,D?a(n,l-r):n))}function E(e){return(h=void 0,g&&s)?y(e):(s=c=void 0,f)}function _(){var e,r=i(),n=v(r);if(s=arguments,c=this,d=r,n){if(void 0===h)return p=e=d,h=setTimeout(w,t),m?y(e):f;if(D)return clearTimeout(h),h=setTimeout(w,t),y(d)}return void 0===h&&(h=setTimeout(w,t)),f}return t=o(t)||0,n(r)&&(m=!!r.leading,l=(D="maxWait"in r)?u(o(r.maxWait)||0,t):l,g="trailing"in r?!!r.trailing:g),_.cancel=function(){void 0!==h&&clearTimeout(h),p=0,s=d=c=h=void 0},_.flush=function(){return void 0===h?f:E(i())},_}},15(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},184(e){e.exports=function(e){return null!=e&&"object"==typeof e}},536(e,t,r){var n=r(990),i=r(184);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},642(e,t,r){var n=r(183);e.exports=function(){return n.Date.now()}},444(e,t,r){var n=r(803),i=r(15);e.exports=function(e,t,r){var o=!0,u=!0;if("function"!=typeof e)throw TypeError("Expected a function");return i(r)&&(o="leading"in r?!!r.leading:o,u="trailing"in r?!!r.trailing:u),n(e,t,{leading:o,maxWait:t,trailing:u})}},572(e,t,r){var n=r(66),i=r(15),o=r(536),u=0/0,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return u;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=s.test(e);return r||c.test(e)?l(e.slice(2),r?2:8):a.test(e)?u:+e}},867(e,t,r){e=r.nmd(e),e.exports=function(){"use strict";function t(){return z.apply(null,arguments)}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e){var t;if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(t in e)if(o(e,t))return!1;return!0}function a(e){return void 0===e}function s(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function c(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var r,n=[],i=e.length;for(r=0;r<i;++r)n.push(t(e[r],r));return n}function f(e,t){for(var r in t)o(t,r)&&(e[r]=t[r]);return o(t,"toString")&&(e.toString=t.toString),o(t,"valueOf")&&(e.valueOf=t.valueOf),e}function h(e,t,r,n){return to(e,t,r,n,!0).utc()}function d(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function p(e){var t=null,r=!1,n=e._d&&!isNaN(e._d.getTime());return(n&&(t=d(e),r=V.call(t.parsedDateParts,function(e){return null!=e}),n=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&r),e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e))?n:(e._isValid=n,e._isValid)}function m(e){var t=h(NaN);return null!=e?f(d(t),e):d(t).userInvalidated=!0,t}V=Array.prototype.some?Array.prototype.some:function(e){var t,r=Object(this),n=r.length>>>0;for(t=0;t<n;t++)if(t in r&&e.call(this,r[t],t,r))return!0;return!1};var D,g,y=t.momentProperties=[],v=!1;function w(e,t){var r,n,i,o=y.length;if(a(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),a(t._i)||(e._i=t._i),a(t._f)||(e._f=t._f),a(t._l)||(e._l=t._l),a(t._strict)||(e._strict=t._strict),a(t._tzm)||(e._tzm=t._tzm),a(t._isUTC)||(e._isUTC=t._isUTC),a(t._offset)||(e._offset=t._offset),a(t._pf)||(e._pf=d(t)),a(t._locale)||(e._locale=t._locale),o>0)for(r=0;r<o;r++)a(i=t[n=y[r]])||(e[n]=i);return e}function E(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===v&&(v=!0,t.updateOffset(this),v=!1)}function _(e){return e instanceof E||null!=e&&null!=e._isAMomentObject}function A(e){!1===t.suppressDeprecationWarnings&&"u">typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function F(e,r){var n=!0;return f(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),n){var i,u,a,s=[],c=arguments.length;for(u=0;u<c;u++){if(i="","object"==typeof arguments[u]){for(a in i+="\n["+u+"] ",arguments[0])o(arguments[0],a)&&(i+=a+": "+arguments[0][a]+", ");i=i.slice(0,-2)}else i=arguments[u];s.push(i)}A(e+"\nArguments: "+Array.prototype.slice.call(s).join("")+"\n"+Error().stack),n=!1}return r.apply(this,arguments)},r)}var b={};function C(e,r){null!=t.deprecationHandler&&t.deprecationHandler(e,r),b[e]||(A(r),b[e]=!0)}function x(e){return"u">typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function S(e,t){var r,n=f({},e);for(r in t)o(t,r)&&(i(e[r])&&i(t[r])?(n[r]={},f(n[r],e[r]),f(n[r],t[r])):null!=t[r]?n[r]=t[r]:delete n[r]);for(r in e)o(e,r)&&!o(t,r)&&i(e[r])&&(n[r]=f({},n[r]));return n}function M(e){null!=e&&this.set(e)}function N(e,t,r){var n=""+Math.abs(e);return(e>=0?r?"+":"":"-")+Math.pow(10,Math.max(0,t-n.length)).toString().substr(1)+n}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var O=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,B=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,T={},k={};function I(e,t,r,n){var i=n;"string"==typeof n&&(i=function(){return this[n]()}),e&&(k[e]=i),t&&(k[t[0]]=function(){return N(i.apply(this,arguments),t[1],t[2])}),r&&(k[r]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function R(e,t){return e.isValid()?(T[t=P(t,e.localeData())]=T[t]||function(e){var t,r,n,i=e.match(O);for(r=0,n=i.length;r<n;r++)k[i[r]]?i[r]=k[i[r]]:i[r]=(t=i[r]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(t){var r,o="";for(r=0;r<n;r++)o+=x(i[r])?i[r].call(t,e):i[r];return o}}(t),T[t](e)):e.localeData().invalidDate()}function P(e,t){var r=5;function n(e){return t.longDateFormat(e)||e}for(B.lastIndex=0;r>=0&&B.test(e);)e=e.replace(B,n),B.lastIndex=0,r-=1;return e}var j={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Y(e){return"string"==typeof e?j[e]||j[e.toLowerCase()]:void 0}function U(e){var t,r,n={};for(r in e)o(e,r)&&(t=Y(r))&&(n[t]=e[r]);return n}var z,V,L,q={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1},H=Object.keys?Object.keys:function(e){var t,r=[];for(t in e)o(e,t)&&r.push(t);return r},W=/\d/,G=/\d\d/,Z=/\d{3}/,$=/\d{4}/,J=/[+-]?\d{6}/,Q=/\d\d?/,X=/\d\d\d\d?/,K=/\d\d\d\d\d\d?/,ee=/\d{1,3}/,et=/\d{1,4}/,er=/[+-]?\d{1,6}/,en=/\d+/,ei=/[+-]?\d+/,eo=/Z|[+-]\d\d:?\d\d/gi,eu=/Z|[+-]\d\d(?::?\d\d)?/gi,ea=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,es=/^[1-9]\d?/,ec=/^([1-9]\d|\d)/;function el(e,t,r){L[e]=x(t)?t:function(e,n){return e&&r?r:t}}function ef(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function eh(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function ed(e){var t=+e,r=0;return 0!==t&&isFinite(t)&&(r=eh(t)),r}L={};var ep={};function em(e,t){var r,n,i=t;for("string"==typeof e&&(e=[e]),s(t)&&(i=function(e,r){r[t]=ed(e)}),n=e.length,r=0;r<n;r++)ep[e[r]]=i}function eD(e,t){em(e,function(e,r,n,i){n._w=n._w||{},t(e,n._w,n,i)})}function eg(e){return e%4==0&&e%100!=0||e%400==0}function ey(e){return eg(e)?366:365}I("Y",0,0,function(){var e=this.year();return e<=9999?N(e,4):"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),el("Y",ei),el("YY",Q,G),el("YYYY",et,$),el("YYYYY",er,J),el("YYYYYY",er,J),em(["YYYYY","YYYYYY"],0),em("YYYY",function(e,r){r[0]=2===e.length?t.parseTwoDigitYear(e):ed(e)}),em("YY",function(e,r){r[0]=t.parseTwoDigitYear(e)}),em("Y",function(e,t){t[0]=parseInt(e,10)}),t.parseTwoDigitYear=function(e){return ed(e)+(ed(e)>68?1900:2e3)};var ev=ew("FullYear",!0);function ew(e,r){return function(n){return null!=n?(e_(this,e,n),t.updateOffset(this,r),this):eE(this,e)}}function eE(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function e_(e,t,r){var n,i,o,u;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(i?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(i?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(i?n.setUTCHours(r):n.setHours(r));case"Date":return void(i?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=e.month(),u=29!==(u=e.date())||1!==o||eg(r)?u:28,i?n.setUTCFullYear(r,o,u):n.setFullYear(r,o,u)}}function eA(e,t){if(isNaN(e)||isNaN(t))return NaN;var r=(t%12+12)%12;return e+=(t-r)/12,1===r?eg(e)?29:28:31-r%7%2}eL=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return -1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),el("M",Q,es),el("MM",Q,G),el("MMM",function(e,t){return t.monthsShortRegex(e)}),el("MMMM",function(e,t){return t.monthsRegex(e)}),em(["M","MM"],function(e,t){t[1]=ed(e)-1}),em(["MMM","MMMM"],function(e,t,r,n){var i=r._locale.monthsParse(e,n,r._strict);null!=i?t[1]=i:d(r).invalidMonth=e});var eF="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),eb=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;function eC(e,t,r){var n,i,o,u=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)o=h([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(o,"").toLocaleLowerCase();if(r)if("MMM"===t)return -1!==(i=eL.call(this._shortMonthsParse,u))?i:null;else return -1!==(i=eL.call(this._longMonthsParse,u))?i:null;return"MMM"===t?-1!==(i=eL.call(this._shortMonthsParse,u))||-1!==(i=eL.call(this._longMonthsParse,u))?i:null:-1!==(i=eL.call(this._longMonthsParse,u))||-1!==(i=eL.call(this._shortMonthsParse,u))?i:null}function ex(e,t){if(!e.isValid())return e;if("string"==typeof t){if(/^\d+$/.test(t))t=ed(t);else if(!s(t=e.localeData().monthsParse(t)))return e}var r=t,n=e.date();return n=n<29?n:Math.min(n,eA(e.year(),r)),e._isUTC?e._d.setUTCMonth(r,n):e._d.setMonth(r,n),e}function eS(e){return null!=e?(ex(this,e),t.updateOffset(this,!0),this):eE(this,"Month")}function eM(){function e(e,t){return t.length-e.length}var t,r,n,i,o=[],u=[],a=[];for(t=0;t<12;t++)r=h([2e3,t]),n=ef(this.monthsShort(r,"")),i=ef(this.months(r,"")),o.push(n),u.push(i),a.push(i),a.push(n);o.sort(e),u.sort(e),a.sort(e),this._monthsRegex=RegExp("^("+a.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=RegExp("^("+u.join("|")+")","i"),this._monthsShortStrictRegex=RegExp("^("+o.join("|")+")","i")}function eN(e,t,r,n,i,o,u){var a;return e<100&&e>=0?isFinite((a=new Date(e+400,t,r,n,i,o,u)).getFullYear())&&a.setFullYear(e):a=new Date(e,t,r,n,i,o,u),a}function eO(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,isFinite((t=new Date(Date.UTC.apply(null,r))).getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function eB(e,t,r){var n=7+t-r;return-((7+eO(e,0,n).getUTCDay()-t)%7)+n-1}function eT(e,t,r,n,i){var o,u,a=1+7*(t-1)+(7+r-n)%7+eB(e,n,i);return a<=0?u=ey(o=e-1)+a:a>ey(e)?(o=e+1,u=a-ey(e)):(o=e,u=a),{year:o,dayOfYear:u}}function ek(e,t,r){var n,i,o=eB(e.year(),t,r),u=Math.floor((e.dayOfYear()-o-1)/7)+1;return u<1?n=u+eI(i=e.year()-1,t,r):u>eI(e.year(),t,r)?(n=u-eI(e.year(),t,r),i=e.year()+1):(i=e.year(),n=u),{week:n,year:i}}function eI(e,t,r){var n=eB(e,t,r),i=eB(e+1,t,r);return(ey(e)-n+i)/7}function eR(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),el("w",Q,es),el("ww",Q,G),el("W",Q,es),el("WW",Q,G),eD(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=ed(e)}),I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),el("d",Q),el("e",Q),el("E",Q),el("dd",function(e,t){return t.weekdaysMinRegex(e)}),el("ddd",function(e,t){return t.weekdaysShortRegex(e)}),el("dddd",function(e,t){return t.weekdaysRegex(e)}),eD(["dd","ddd","dddd"],function(e,t,r,n){var i=r._locale.weekdaysParse(e,n,r._strict);null!=i?t.d=i:d(r).invalidWeekday=e}),eD(["d","e","E"],function(e,t,r,n){t[n]=ed(e)});var eP="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function ej(e,t,r){var n,i,o,u=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=h([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();if(r)if("dddd"===t)return -1!==(i=eL.call(this._weekdaysParse,u))?i:null;else if("ddd"===t)return -1!==(i=eL.call(this._shortWeekdaysParse,u))?i:null;else return -1!==(i=eL.call(this._minWeekdaysParse,u))?i:null;return"dddd"===t?-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._shortWeekdaysParse,u))||-1!==(i=eL.call(this._minWeekdaysParse,u))?i:null:"ddd"===t?-1!==(i=eL.call(this._shortWeekdaysParse,u))||-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._minWeekdaysParse,u))?i:null:-1!==(i=eL.call(this._minWeekdaysParse,u))||-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._shortWeekdaysParse,u))?i:null}function eY(){function e(e,t){return t.length-e.length}var t,r,n,i,o,u=[],a=[],s=[],c=[];for(t=0;t<7;t++)r=h([2e3,1]).day(t),n=ef(this.weekdaysMin(r,"")),i=ef(this.weekdaysShort(r,"")),o=ef(this.weekdays(r,"")),u.push(n),a.push(i),s.push(o),c.push(n),c.push(i),c.push(o);u.sort(e),a.sort(e),s.sort(e),c.sort(e),this._weekdaysRegex=RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=RegExp("^("+u.join("|")+")","i")}function eU(){return this.hours()%12||12}function ez(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function eV(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,eU),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+eU.apply(this)+N(this.minutes(),2)}),I("hmmss",0,0,function(){return""+eU.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),ez("a",!0),ez("A",!1),el("a",eV),el("A",eV),el("H",Q,ec),el("h",Q,es),el("k",Q,es),el("HH",Q,G),el("hh",Q,G),el("kk",Q,G),el("hmm",X),el("hmmss",K),el("Hmm",X),el("Hmmss",K),em(["H","HH"],3),em(["k","kk"],function(e,t,r){var n=ed(e);t[3]=24===n?0:n}),em(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e}),em(["h","hh"],function(e,t,r){t[3]=ed(e),d(r).bigHour=!0}),em("hmm",function(e,t,r){var n=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n)),d(r).bigHour=!0}),em("hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n,2)),t[5]=ed(e.substr(i)),d(r).bigHour=!0}),em("Hmm",function(e,t,r){var n=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n))}),em("Hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n,2)),t[5]=ed(e.substr(i))});var eL,eq,eH=ew("Hours",!0),eW={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:eF,week:{dow:0,doy:6},weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysShort:eP,meridiemParse:/[ap]\.?m?\.?/i},eG={},eZ={};function e$(e){return e?e.toLowerCase().replace("_","-"):e}function eJ(t){var n=null;if(void 0===eG[t]&&e&&e.exports&&t&&t.match("^[^/\\\\]*$"))try{n=eq._abbr,r(118)("./locale/"+t),eQ(n)}catch(e){eG[t]=null}return eG[t]}function eQ(e,t){var r;return e&&((r=a(t)?eK(e):eX(e,t))?eq=r:"u">typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),eq._abbr}function eX(e,t){if(null===t)return delete eG[e],null;var r,n=eW;if(t.abbr=e,null!=eG[e])C("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=eG[e]._config;else if(null!=t.parentLocale)if(null!=eG[t.parentLocale])n=eG[t.parentLocale]._config;else{if(null==(r=eJ(t.parentLocale)))return eZ[t.parentLocale]||(eZ[t.parentLocale]=[]),eZ[t.parentLocale].push({name:e,config:t}),null;n=r._config}return eG[e]=new M(S(n,t)),eZ[e]&&eZ[e].forEach(function(e){eX(e.name,e.config)}),eQ(e),eG[e]}function eK(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return eq;if(!n(e)){if(t=eJ(e))return t;e=[e]}return function(e){for(var t,r,n,i,o=0;o<e.length;){for(t=(i=e$(e[o]).split("-")).length,r=(r=e$(e[o+1]))?r.split("-"):null;t>0;){if(n=eJ(i.slice(0,t).join("-")))return n;if(r&&r.length>=t&&function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n}(i,r)>=t-1)break;t--}o++}return eq}(e)}function e0(e){var t,r=e._a;return r&&-2===d(e).overflow&&(t=r[1]<0||r[1]>11?1:r[2]<1||r[2]>eA(r[0],r[1])?2:r[3]<0||r[3]>24||24===r[3]&&(0!==r[4]||0!==r[5]||0!==r[6])?3:r[4]<0||r[4]>59?4:r[5]<0||r[5]>59?5:r[6]<0||r[6]>999?6:-1,d(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),d(e)._overflowWeeks&&-1===t&&(t=7),d(e)._overflowWeekday&&-1===t&&(t=8),d(e).overflow=t),e}var e1=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e2=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e8=/Z|[+-]\d\d(?::?\d\d)?/,e3=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],e5=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],e4=/^\/?Date\((-?\d+)/i,e6=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,e7={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function e9(e){var t,r,n,i,o,u,a=e._i,s=e1.exec(a)||e2.exec(a),c=e3.length,l=e5.length;if(s){for(d(e).iso=!0,t=0,r=c;t<r;t++)if(e3[t][1].exec(s[1])){i=e3[t][0],n=!1!==e3[t][2];break}if(null==i){e._isValid=!1;return}if(s[3]){for(t=0,r=l;t<r;t++)if(e5[t][1].exec(s[3])){o=(s[2]||" ")+e5[t][0];break}if(null==o){e._isValid=!1;return}}if(!n&&null!=o){e._isValid=!1;return}if(s[4])if(e8.exec(s[4]))u="Z";else{e._isValid=!1;return}e._f=i+(o||"")+(u||""),tn(e)}else e._isValid=!1}function te(e){var t,r,n,i,o,u,a,s,c,l,f,h=e6.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(h){if(o=h[4],u=h[3],a=h[2],s=h[5],c=h[6],l=h[7],f=[(t=parseInt(o,10))<=49?2e3+t:t<=999?1900+t:t,eF.indexOf(u),parseInt(a,10),parseInt(s,10),parseInt(c,10)],l&&f.push(parseInt(l,10)),r=h[1],n=f,i=e,r&&eP.indexOf(r)!==new Date(n[0],n[1],n[2]).getDay()&&(d(i).weekdayMismatch=!0,i._isValid=!1,1))return;e._a=f,e._tzm=function(e,t,r){if(e)return e7[e];if(t)return 0;var n=parseInt(r,10),i=n%100;return(n-i)/100*60+i}(h[8],h[9],h[10]),e._d=eO.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),d(e).rfc2822=!0}else e._isValid=!1}function tt(e,t,r){return null!=e?e:null!=t?t:r}function tr(e){var r,n,i,o,u,a,s,c,l,f,h,p,m,D,g,y,v=[];if(!e._d){for(h=new Date(t.now()),D=e._useUTC?[h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()]:[h.getFullYear(),h.getMonth(),h.getDate()],e._w&&null==e._a[2]&&null==e._a[1]&&(null!=(n=(r=e)._w).GG||null!=n.W||null!=n.E?(a=1,s=4,i=tt(n.GG,r._a[0],ek(tu(),1,4).year),o=tt(n.W,1),((u=tt(n.E,1))<1||u>7)&&(l=!0)):(a=r._locale._week.dow,s=r._locale._week.doy,f=ek(tu(),a,s),i=tt(n.gg,r._a[0],f.year),o=tt(n.w,f.week),null!=n.d?((u=n.d)<0||u>6)&&(l=!0):null!=n.e?(u=n.e+a,(n.e<0||n.e>6)&&(l=!0)):u=a),o<1||o>eI(i,a,s)?d(r)._overflowWeeks=!0:null!=l?d(r)._overflowWeekday=!0:(c=eT(i,o,u,a,s),r._a[0]=c.year,r._dayOfYear=c.dayOfYear)),null!=e._dayOfYear&&(y=tt(e._a[0],D[0]),(e._dayOfYear>ey(y)||0===e._dayOfYear)&&(d(e)._overflowDayOfYear=!0),m=eO(y,0,e._dayOfYear),e._a[1]=m.getUTCMonth(),e._a[2]=m.getUTCDate()),p=0;p<3&&null==e._a[p];++p)e._a[p]=v[p]=D[p];for(;p<7;p++)e._a[p]=v[p]=null==e._a[p]?+(2===p):e._a[p];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?eO:eN).apply(null,v),g=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==g&&(d(e).weekdayMismatch=!0)}}function tn(e){if(e._f===t.ISO_8601)return void e9(e);if(e._f===t.RFC_2822)return void te(e);e._a=[],d(e).empty=!0;var r,n,i,u,a,s,c,l,f,h,p,m=""+e._i,D=m.length,g=0;for(p=(c=P(e._f,e._locale).match(O)||[]).length,a=0;a<p;a++)if(l=c[a],(s=(m.match(!o(L,l)?new RegExp(ef(l.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,r,n,i){return t||r||n||i}))):L[l](e._strict,e._locale))||[])[0])&&((f=m.substr(0,m.indexOf(s))).length>0&&d(e).unusedInput.push(f),m=m.slice(m.indexOf(s)+s.length),g+=s.length),k[l])s?d(e).empty=!1:d(e).unusedTokens.push(l),null!=s&&o(ep,l)&&ep[l](s,e._a,e,l);else e._strict&&!s&&d(e).unusedTokens.push(l);d(e).charsLeftOver=D-g,m.length>0&&d(e).unusedInput.push(m),e._a[3]<=12&&!0===d(e).bigHour&&e._a[3]>0&&(d(e).bigHour=void 0),d(e).parsedDateParts=e._a.slice(0),d(e).meridiem=e._meridiem,e._a[3]=(r=e._locale,n=e._a[3],null==(i=e._meridiem)?n:null!=r.meridiemHour?r.meridiemHour(n,i):(null!=r.isPM&&((u=r.isPM(i))&&n<12&&(n+=12),u||12!==n||(n=0)),n)),null!==(h=d(e).era)&&(e._a[0]=e._locale.erasConvertYear(h,e._a[0])),tr(e),e0(e)}function ti(e){var r=e._i,o=e._f;return(e._locale=e._locale||eK(e._l),null===r||void 0===o&&""===r)?m({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),_(r))?new E(e0(r)):(c(r)?e._d=r:n(o)?!function(e){var t,r,n,i,o,u,a=!1,s=e._f.length;if(0===s){d(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;i<s;i++)o=0,u=!1,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],tn(t),p(t)&&(u=!0),o+=d(t).charsLeftOver,o+=10*d(t).unusedTokens.length,d(t).score=o,a?o<n&&(n=o,r=t):(null==n||o<n||u)&&(n=o,r=t,u&&(a=!0));f(e,r||t)}(e):o?tn(e):function(e){var r=e._i;if(a(r))e._d=new Date(t.now());else if(c(r))e._d=new Date(r.valueOf());else if("string"==typeof r)!function(e){var r=e4.exec(e._i);if(null!==r){e._d=new Date(+r[1]);return}e9(e),!1!==e._isValid||(delete e._isValid,te(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:t.createFromInputFallback(e)))}(e);else if(n(r))e._a=l(r.slice(0),function(e){return parseInt(e,10)}),tr(e);else if(i(r)){if(!e._d){var o=U(e._i),u=void 0===o.day?o.date:o.day;e._a=l([o.year,o.month,u,o.hour,o.minute,o.second,o.millisecond],function(e){return e&&parseInt(e,10)}),tr(e)}}else s(r)?e._d=new Date(r):t.createFromInputFallback(e)}(e),p(e)||(e._d=null),e)}function to(e,t,r,o,a){var s,c={};return(!0===t||!1===t)&&(o=t,t=void 0),(!0===r||!1===r)&&(o=r,r=void 0),(i(e)&&u(e)||n(e)&&0===e.length)&&(e=void 0),c._isAMomentObject=!0,c._useUTC=c._isUTC=a,c._l=r,c._i=e,c._f=t,c._strict=o,(s=new E(e0(ti(c))))._nextDay&&(s.add(1,"d"),s._nextDay=void 0),s}function tu(e,t,r,n){return to(e,t,r,n,!1)}t.createFromInputFallback=F("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){},t.RFC_2822=function(){};var ta=F("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=tu.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:m()}),ts=F("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=tu.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:m()});function tc(e,t){var r,i;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return tu();for(r=t[0],i=1;i<t.length;++i)(!t[i].isValid()||t[i][e](r))&&(r=t[i]);return r}var tl=["year","quarter","month","week","day","hour","minute","second","millisecond"];function tf(e){var t=U(e),r=t.year||0,n=t.quarter||0,i=t.month||0,u=t.week||t.isoWeek||0,a=t.day||0,s=t.hour||0,c=t.minute||0,l=t.second||0,f=t.millisecond||0;this._isValid=function(e){var t,r,n=!1,i=tl.length;for(t in e)if(o(e,t)&&!(-1!==eL.call(tl,t)&&(null==e[t]||!isNaN(e[t]))))return!1;for(r=0;r<i;++r)if(e[tl[r]]){if(n)return!1;parseFloat(e[tl[r]])!==ed(e[tl[r]])&&(n=!0)}return!0}(t),this._milliseconds=+f+1e3*l+6e4*c+1e3*s*3600,this._days=+a+7*u,this._months=+i+3*n+12*r,this._data={},this._locale=eK(),this._bubble()}function th(e){return e instanceof tf}function td(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function tp(e,t){I(e,0,0,function(){var e=this.utcOffset(),r="+";return e<0&&(e=-e,r="-"),r+N(~~(e/60),2)+t+N(~~e%60,2)})}tp("Z",":"),tp("ZZ",""),el("Z",eu),el("ZZ",eu),em(["Z","ZZ"],function(e,t,r){r._useUTC=!0,r._tzm=tD(eu,e)});var tm=/([\+\-]|\d\d)/gi;function tD(e,t){var r,n,i=(t||"").match(e);return null===i?null:0===(n=+(60*(r=((i[i.length-1]||[])+"").match(tm)||["-",0,0])[1])+ed(r[2]))?0:"+"===r[0]?n:-n}function tg(e,r){var n,i;return r._isUTC?(n=r.clone(),i=(_(e)||c(e)?e.valueOf():tu(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),t.updateOffset(n,!1),n):tu(e).local()}function ty(e){return-Math.round(e._d.getTimezoneOffset())}function tv(){return!!this.isValid()&&this._isUTC&&0===this._offset}t.updateOffset=function(){};var tw=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,tE=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function t_(e,t){var r,n,i,u,a,c,l=e,f=null;return th(e)?l={ms:e._milliseconds,d:e._days,M:e._months}:s(e)||!isNaN(+e)?(l={},t?l[t]=+e:l.milliseconds=+e):(f=tw.exec(e))?(u="-"===f[1]?-1:1,l={y:0,d:ed(f[2])*u,h:ed(f[3])*u,m:ed(f[4])*u,s:ed(f[5])*u,ms:ed(td(1e3*f[6]))*u}):(f=tE.exec(e))?(u="-"===f[1]?-1:1,l={y:tA(f[2],u),M:tA(f[3],u),w:tA(f[4],u),d:tA(f[5],u),h:tA(f[6],u),m:tA(f[7],u),s:tA(f[8],u)}):null==l?l={}:"object"==typeof l&&("from"in l||"to"in l)&&(r=tu(l.from),n=tu(l.to),c=r.isValid()&&n.isValid()?(n=tg(n,r),r.isBefore(n)?i=tF(r,n):((i=tF(n,r)).milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0},(l={}).ms=c.milliseconds,l.M=c.months),a=new tf(l),th(e)&&o(e,"_locale")&&(a._locale=e._locale),th(e)&&o(e,"_isValid")&&(a._isValid=e._isValid),a}function tA(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function tF(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=t-e.clone().add(r.months,"M"),r}function tb(e,t){return function(r,n){var i;return null===n||isNaN(+n)||(C(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=r,r=n,n=i),tC(this,t_(r,n),e),this}}function tC(e,r,n,i){var o=r._milliseconds,u=td(r._days),a=td(r._months);e.isValid()&&(i=null==i||i,a&&ex(e,eE(e,"Month")+a*n),u&&e_(e,"Date",eE(e,"Date")+u*n),o&&e._d.setTime(e._d.valueOf()+o*n),i&&t.updateOffset(e,u||a))}t_.fn=tf.prototype,t_.invalid=function(){return t_(NaN)};var tx=tb(1,"add"),tS=tb(-1,"subtract");function tM(e){return"string"==typeof e||e instanceof String}function tN(e,t){if(e.date()<t.date())return-tN(t,e);var r,n=(t.year()-e.year())*12+(t.month()-e.month()),i=e.clone().add(n,"months");return r=t-i<0?(t-i)/(i-e.clone().add(n-1,"months")):(t-i)/(e.clone().add(n+1,"months")-i),-(n+r)||0}function tO(e){var t;return void 0===e?this._locale._abbr:(null!=(t=eK(e))&&(this._locale=t),this)}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var tB=F("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function tT(){return this._locale}function tk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-126227808e5:new Date(e,t,r).valueOf()}function tI(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-126227808e5:Date.UTC(e,t,r)}function tR(e,t){return t.erasAbbrRegex(e)}function tP(){var e,t,r,n,i,o=[],u=[],a=[],s=[],c=this.eras();for(e=0,t=c.length;e<t;++e)r=ef(c[e].name),n=ef(c[e].abbr),i=ef(c[e].narrow),u.push(r),o.push(n),a.push(i),s.push(r),s.push(n),s.push(i);this._erasRegex=RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=RegExp("^("+u.join("|")+")","i"),this._erasAbbrRegex=RegExp("^("+o.join("|")+")","i"),this._erasNarrowRegex=RegExp("^("+a.join("|")+")","i")}function tj(e,t){I(0,[e,e.length],0,t)}function tY(e,t,r,n,i){var o;return null==e?ek(this,n,i).year:(t>(o=eI(e,n,i))&&(t=o),tU.call(this,e,t,r,n,i))}function tU(e,t,r,n,i){var o=eT(e,t,r,n,i),u=eO(o.year,0,o.dayOfYear);return this.year(u.getUTCFullYear()),this.month(u.getUTCMonth()),this.date(u.getUTCDate()),this}I("N",0,0,"eraAbbr"),I("NN",0,0,"eraAbbr"),I("NNN",0,0,"eraAbbr"),I("NNNN",0,0,"eraName"),I("NNNNN",0,0,"eraNarrow"),I("y",["y",1],"yo","eraYear"),I("y",["yy",2],0,"eraYear"),I("y",["yyy",3],0,"eraYear"),I("y",["yyyy",4],0,"eraYear"),el("N",tR),el("NN",tR),el("NNN",tR),el("NNNN",function(e,t){return t.erasNameRegex(e)}),el("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),em(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var i=r._locale.erasParse(e,n,r._strict);i?d(r).era=i:d(r).invalidEra=e}),el("y",en),el("yy",en),el("yyy",en),el("yyyy",en),el("yo",function(e,t){return t._eraYearOrdinalRegex||en}),em(["y","yy","yyy","yyyy"],0),em(["yo"],function(e,t,r,n){var i;r._locale._eraYearOrdinalRegex&&(i=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[0]=r._locale.eraYearOrdinalParse(e,i):t[0]=parseInt(e,10)}),I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),tj("gggg","weekYear"),tj("ggggg","weekYear"),tj("GGGG","isoWeekYear"),tj("GGGGG","isoWeekYear"),el("G",ei),el("g",ei),el("GG",Q,G),el("gg",Q,G),el("GGGG",et,$),el("gggg",et,$),el("GGGGG",er,J),el("ggggg",er,J),eD(["gggg","ggggg","GGGG","GGGGG"],function(e,t,r,n){t[n.substr(0,2)]=ed(e)}),eD(["gg","GG"],function(e,r,n,i){r[i]=t.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),el("Q",W),em("Q",function(e,t){t[1]=(ed(e)-1)*3}),I("D",["DD",2],"Do","date"),el("D",Q,es),el("DD",Q,G),el("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),em(["D","DD"],2),em("Do",function(e,t){t[2]=ed(e.match(Q)[0])});var tz=ew("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),el("DDD",ee),el("DDDD",Z),em(["DDD","DDDD"],function(e,t,r){r._dayOfYear=ed(e)}),I("m",["mm",2],0,"minute"),el("m",Q,ec),el("mm",Q,G),em(["m","mm"],4);var tV=ew("Minutes",!1);I("s",["ss",2],0,"second"),el("s",Q,ec),el("ss",Q,G),em(["s","ss"],5);var tL=ew("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),el("S",ee,W),el("SS",ee,G),el("SSS",ee,Z),D="SSSS";D.length<=9;D+="S")el(D,en);function tq(e,t){t[6]=ed(("0."+e)*1e3)}for(D="S";D.length<=9;D+="S")em(D,tq);g=ew("Milliseconds",!1),I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var tH=E.prototype;function tW(e){return e}tH.add=tx,tH.calendar=function(e,r){if(1==arguments.length)if(arguments[0]){var a,l,f,h;if(a=arguments[0],_(a)||c(a)||tM(a)||s(a)||(f=n(l=a),h=!1,f&&(h=0===l.filter(function(e){return!s(e)&&tM(l)}).length),f&&h)||function(e){var t,r,n=i(e)&&!u(e),a=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],c=s.length;for(t=0;t<c;t+=1)r=s[t],a=a||o(e,r);return n&&a}(a)||null==a)e=arguments[0],r=void 0;else(function(e){var t,r,n=i(e)&&!u(e),a=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<s.length;t+=1)r=s[t],a=a||o(e,r);return n&&a})(arguments[0])&&(r=arguments[0],e=void 0)}else e=void 0,r=void 0;var d=e||tu(),p=tg(d,this).startOf("day"),m=t.calendarFormat(this,p)||"sameElse",D=r&&(x(r[m])?r[m].call(this,d):r[m]);return this.format(D||this.localeData().calendar(m,this,tu(d)))},tH.clone=function(){return new E(this)},tH.diff=function(e,t,r){var n,i,o;if(!this.isValid()||!(n=tg(e,this)).isValid())return NaN;switch(i=(n.utcOffset()-this.utcOffset())*6e4,t=Y(t)){case"year":o=tN(this,n)/12;break;case"month":o=tN(this,n);break;case"quarter":o=tN(this,n)/3;break;case"second":o=(this-n)/1e3;break;case"minute":o=(this-n)/6e4;break;case"hour":o=(this-n)/36e5;break;case"day":o=(this-n-i)/864e5;break;case"week":o=(this-n-i)/6048e5;break;default:o=this-n}return r?o:eh(o)},tH.endOf=function(e){var r,n;if(void 0===(e=Y(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tI:tk,e){case"year":r=n(this.year()+1,0,1)-1;break;case"quarter":r=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":r=n(this.year(),this.month()+1,1)-1;break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":r=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":r=this._d.valueOf(),r+=36e5-((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5-1;break;case"minute":r=this._d.valueOf(),r+=6e4-(r%6e4+6e4)%6e4-1;break;case"second":r=this._d.valueOf(),r+=1e3-(r%1e3+1e3)%1e3-1}return this._d.setTime(r),t.updateOffset(this,!0),this},tH.format=function(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var r=R(this,e);return this.localeData().postformat(r)},tH.from=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||tu(e).isValid())?t_({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tH.fromNow=function(e){return this.from(tu(),e)},tH.to=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||tu(e).isValid())?t_({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tH.toNow=function(e){return this.to(tu(),e)},tH.get=function(e){return x(this[e=Y(e)])?this[e]():this},tH.invalidAt=function(){return d(this).overflow},tH.isAfter=function(e,t){var r=_(e)?e:tu(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()>r.valueOf():r.valueOf()<this.clone().startOf(t).valueOf())},tH.isBefore=function(e,t){var r=_(e)?e:tu(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()<r.valueOf():this.clone().endOf(t).valueOf()<r.valueOf())},tH.isBetween=function(e,t,r,n){var i=_(e)?e:tu(e),o=_(t)?t:tu(t);return!!(this.isValid()&&i.isValid()&&o.isValid())&&("("===(n=n||"()")[0]?this.isAfter(i,r):!this.isBefore(i,r))&&(")"===n[1]?this.isBefore(o,r):!this.isAfter(o,r))},tH.isSame=function(e,t){var r,n=_(e)?e:tu(e);return!!(this.isValid()&&n.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(t).valueOf()<=r&&r<=this.clone().endOf(t).valueOf()))},tH.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},tH.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},tH.isValid=function(){return p(this)},tH.lang=tB,tH.locale=tO,tH.localeData=tT,tH.max=ts,tH.min=ta,tH.parsingFlags=function(){return f({},d(this))},tH.set=function(e,t){if("object"==typeof e){var r,n=function(e){var t,r=[];for(t in e)o(e,t)&&r.push({unit:t,priority:q[t]});return r.sort(function(e,t){return e.priority-t.priority}),r}(e=U(e)),i=n.length;for(r=0;r<i;r++)this[n[r].unit](e[n[r].unit])}else if(x(this[e=Y(e)]))return this[e](t);return this},tH.startOf=function(e){var r,n;if(void 0===(e=Y(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tI:tk,e){case"year":r=n(this.year(),0,1);break;case"quarter":r=n(this.year(),this.month()-this.month()%3,1);break;case"month":r=n(this.year(),this.month(),1);break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":r=n(this.year(),this.month(),this.date());break;case"hour":r=this._d.valueOf(),r-=((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5;break;case"minute":r=this._d.valueOf(),r-=(r%6e4+6e4)%6e4;break;case"second":r=this._d.valueOf(),r-=(r%1e3+1e3)%1e3}return this._d.setTime(r),t.updateOffset(this,!0),this},tH.subtract=tS,tH.toArray=function(){return[this.year(),this.month(),this.date(),this.hour(),this.minute(),this.second(),this.millisecond()]},tH.toObject=function(){return{years:this.year(),months:this.month(),date:this.date(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()}},tH.toDate=function(){return new Date(this.valueOf())},tH.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,r=t?this.clone().utc():this;if(0>r.year()||r.year()>9999)return R(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");if(x(Date.prototype.toISOString))if(t)return this.toDate().toISOString();else return new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",R(r,"Z"));return R(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},tH.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,r,n="moment",i="";return this.isLocal()||(n=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+n+'("]',t=0<=this.year()&&9999>=this.year()?"YYYY":"YYYYYY",r=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+r)},"u">typeof Symbol&&null!=Symbol.for&&(tH[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),tH.toJSON=function(){return this.isValid()?this.toISOString():null},tH.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},tH.unix=function(){return Math.floor(this.valueOf()/1e3)},tH.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},tH.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},tH.eraName=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].name;return""},tH.eraNarrow=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].narrow;return""},tH.eraAbbr=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].abbr;return""},tH.eraYear=function(){var e,r,n,i,o=this.localeData().eras();for(e=0,r=o.length;e<r;++e)if(n=o[e].since<=o[e].until?1:-1,i=this.clone().startOf("day").valueOf(),o[e].since<=i&&i<=o[e].until||o[e].until<=i&&i<=o[e].since)return(this.year()-t(o[e].since).year())*n+o[e].offset;return this.year()},tH.year=ev,tH.isLeapYear=function(){return eg(this.year())},tH.weekYear=function(e){return tY.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},tH.isoWeekYear=function(e){return tY.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},tH.quarter=tH.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)},tH.month=eS,tH.daysInMonth=function(){return eA(this.year(),this.month())},tH.week=tH.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add((e-t)*7,"d")},tH.isoWeek=tH.isoWeeks=function(e){var t=ek(this,1,4).week;return null==e?t:this.add((e-t)*7,"d")},tH.weeksInYear=function(){var e=this.localeData()._week;return eI(this.year(),e.dow,e.doy)},tH.weeksInWeekYear=function(){var e=this.localeData()._week;return eI(this.weekYear(),e.dow,e.doy)},tH.isoWeeksInYear=function(){return eI(this.year(),1,4)},tH.isoWeeksInISOWeekYear=function(){return eI(this.isoWeekYear(),1,4)},tH.date=tz,tH.day=tH.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,r,n=eE(this,"Day");return null==e?n:(t=e,r=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=r.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-n,"d"))},tH.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},tH.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,r=(t=this.localeData(),"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e);return this.day(this.day()%7?r:r-7)},tH.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},tH.hour=tH.hours=eH,tH.minute=tH.minutes=tV,tH.second=tH.seconds=tL,tH.millisecond=tH.milliseconds=g,tH.utcOffset=function(e,r,n){var i,o=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?o:ty(this);if("string"==typeof e){if(null===(e=tD(eu,e)))return this}else 16>Math.abs(e)&&!n&&(e*=60);return!this._isUTC&&r&&(i=ty(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),o!==e&&(!r||this._changeInProgress?tC(this,t_(e-o,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this},tH.utc=function(e){return this.utcOffset(0,e)},tH.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(ty(this),"m")),this},tH.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=tD(eo,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},tH.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?tu(e).utcOffset():0,(this.utcOffset()-e)%60==0)},tH.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},tH.isLocal=function(){return!!this.isValid()&&!this._isUTC},tH.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},tH.isUtc=tv,tH.isUTC=tv,tH.zoneAbbr=function(){return this._isUTC?"UTC":""},tH.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},tH.dates=F("dates accessor is deprecated. Use date instead.",tz),tH.months=F("months accessor is deprecated. Use month instead",eS),tH.years=F("years accessor is deprecated. Use year instead",ev),tH.zone=F("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),tH.isDSTShifted=F("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!a(this._isDSTShifted))return this._isDSTShifted;var e,t={};return w(t,this),(t=ti(t))._a?(e=t._isUTC?h(t._a):tu(t._a),this._isDSTShifted=this.isValid()&&function(e,t){var r,n=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),o=0;for(r=0;r<n;r++)ed(e[r])!==ed(t[r])&&o++;return o+i}(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted});var tG=M.prototype;function tZ(e,t,r,n){var i=eK(),o=h().set(n,t);return i[r](o,e)}function t$(e,t,r){if(s(e)&&(t=e,e=void 0),e=e||"",null!=t)return tZ(e,t,r,"month");var n,i=[];for(n=0;n<12;n++)i[n]=tZ(e,n,r,"month");return i}function tJ(e,t,r,n){"boolean"==typeof e||(r=t=e,e=!1),s(t)&&(r=t,t=void 0),t=t||"";var i,o=eK(),u=e?o._week.dow:0,a=[];if(null!=r)return tZ(t,(r+u)%7,n,"day");for(i=0;i<7;i++)a[i]=tZ(t,(i+u)%7,n,"day");return a}tG.calendar=function(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return x(n)?n.call(t,r):n},tG.longDateFormat=function(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(O).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},tG.invalidDate=function(){return this._invalidDate},tG.ordinal=function(e){return this._ordinal.replace("%d",e)},tG.preparse=tW,tG.postformat=tW,tG.relativeTime=function(e,t,r,n){var i=this._relativeTime[r];return x(i)?i(e,t,r,n):i.replace(/%d/i,e)},tG.pastFuture=function(e,t){var r=this._relativeTime[e>0?"future":"past"];return x(r)?r(t):r.replace(/%s/i,t)},tG.set=function(e){var t,r;for(r in e)o(e,r)&&(x(t=e[r])?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},tG.eras=function(e,r){var n,i,o,u=this._eras||eK("en")._eras;for(n=0,i=u.length;n<i;++n)switch("string"==typeof u[n].since&&(o=t(u[n].since).startOf("day"),u[n].since=o.valueOf()),typeof u[n].until){case"undefined":u[n].until=Infinity;break;case"string":o=t(u[n].until).startOf("day").valueOf(),u[n].until=o.valueOf()}return u},tG.erasParse=function(e,t,r){var n,i,o,u,a,s=this.eras();for(e=e.toUpperCase(),n=0,i=s.length;n<i;++n)if(o=s[n].name.toUpperCase(),u=s[n].abbr.toUpperCase(),a=s[n].narrow.toUpperCase(),r)switch(t){case"N":case"NN":case"NNN":if(u===e)return s[n];break;case"NNNN":if(o===e)return s[n];break;case"NNNNN":if(a===e)return s[n]}else if([o,u,a].indexOf(e)>=0)return s[n]},tG.erasConvertYear=function(e,r){var n=e.since<=e.until?1:-1;return void 0===r?t(e.since).year():t(e.since).year()+(r-e.offset)*n},tG.erasAbbrRegex=function(e){return o(this,"_erasAbbrRegex")||tP.call(this),e?this._erasAbbrRegex:this._erasRegex},tG.erasNameRegex=function(e){return o(this,"_erasNameRegex")||tP.call(this),e?this._erasNameRegex:this._erasRegex},tG.erasNarrowRegex=function(e){return o(this,"_erasNarrowRegex")||tP.call(this),e?this._erasNarrowRegex:this._erasRegex},tG.months=function(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||eb).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone},tG.monthsShort=function(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[eb.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},tG.monthsParse=function(e,t,r){var n,i,o;if(this._monthsParseExact)return eC.call(this,e,t,r);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=h([2e3,n]),r&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),r||this._monthsParse[n]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=RegExp(o.replace(".",""),"i")),r&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(r&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!r&&this._monthsParse[n].test(e))return n}},tG.monthsRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||eM.call(this),e)?this._monthsStrictRegex:this._monthsRegex:(o(this,"_monthsRegex")||(this._monthsRegex=ea),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},tG.monthsShortRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||eM.call(this),e)?this._monthsShortStrictRegex:this._monthsShortRegex:(o(this,"_monthsShortRegex")||(this._monthsShortRegex=ea),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},tG.week=function(e){return ek(e,this._week.dow,this._week.doy).week},tG.firstDayOfYear=function(){return this._week.doy},tG.firstDayOfWeek=function(){return this._week.dow},tG.weekdays=function(e,t){var r=n(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?eR(r,this._week.dow):e?r[e.day()]:r},tG.weekdaysMin=function(e){return!0===e?eR(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},tG.weekdaysShort=function(e){return!0===e?eR(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},tG.weekdaysParse=function(e,t,r){var n,i,o;if(this._weekdaysParseExact)return ej.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=h([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=RegExp(o.replace(".",""),"i")),r&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(r&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(r&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;else if(!r&&this._weekdaysParse[n].test(e))return n}},tG.weekdaysRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysStrictRegex:this._weekdaysRegex:(o(this,"_weekdaysRegex")||(this._weekdaysRegex=ea),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},tG.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysShortStrictRegex:this._weekdaysShortRegex:(o(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ea),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},tG.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysMinStrictRegex:this._weekdaysMinRegex:(o(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=ea),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},tG.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},tG.meridiem=function(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"},eQ("en",{eras:[{since:"0001-01-01",until:Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=1===ed(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+r}}),t.lang=F("moment.lang is deprecated. Use moment.locale instead.",eQ),t.langData=F("moment.langData is deprecated. Use moment.localeData instead.",eK);var tQ=Math.abs;function tX(e,t,r,n){var i=t_(t,r);return e._milliseconds+=n*i._milliseconds,e._days+=n*i._days,e._months+=n*i._months,e._bubble()}function tK(e){return e<0?Math.floor(e):Math.ceil(e)}function t0(e){return 4800*e/146097}function t1(e){return 146097*e/4800}function t2(e){return function(){return this.as(e)}}var t8=t2("ms"),t3=t2("s"),t5=t2("m"),t4=t2("h"),t6=t2("d"),t7=t2("w"),t9=t2("M"),re=t2("Q"),rt=t2("y");function rr(e){return function(){return this.isValid()?this._data[e]:NaN}}var rn=rr("milliseconds"),ri=rr("seconds"),ro=rr("minutes"),ru=rr("hours"),ra=rr("days"),rs=rr("months"),rc=rr("years"),rl=Math.round,rf={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rh(e,t,r,n,i){return i.relativeTime(t||1,!!r,e,n)}var rd=Math.abs;function rp(e){return(e>0)-(e<0)||+e}function rm(){if(!this.isValid())return this.localeData().invalidDate();var e,t,r,n,i,o,u,a,s=rd(this._milliseconds)/1e3,c=rd(this._days),l=rd(this._months),f=this.asSeconds();return f?(e=eh(s/60),t=eh(e/60),s%=60,e%=60,r=eh(l/12),l%=12,n=s?s.toFixed(3).replace(/\.?0+$/,""):"",i=f<0?"-":"",o=rp(this._months)!==rp(f)?"-":"",u=rp(this._days)!==rp(f)?"-":"",a=rp(this._milliseconds)!==rp(f)?"-":"",i+"P"+(r?o+r+"Y":"")+(l?o+l+"M":"")+(c?u+c+"D":"")+(t||e||s?"T":"")+(t?a+t+"H":"")+(e?a+e+"M":"")+(s?a+n+"S":"")):"P0D"}var rD=tf.prototype;return rD.isValid=function(){return this._isValid},rD.abs=function(){var e=this._data;return this._milliseconds=tQ(this._milliseconds),this._days=tQ(this._days),this._months=tQ(this._months),e.milliseconds=tQ(e.milliseconds),e.seconds=tQ(e.seconds),e.minutes=tQ(e.minutes),e.hours=tQ(e.hours),e.months=tQ(e.months),e.years=tQ(e.years),this},rD.add=function(e,t){return tX(this,e,t,1)},rD.subtract=function(e,t){return tX(this,e,t,-1)},rD.as=function(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if("month"===(e=Y(e))||"quarter"===e||"year"===e)switch(t=this._days+n/864e5,r=this._months+t0(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(t1(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return 24*t+n/36e5;case"minute":return 1440*t+n/6e4;case"second":return 86400*t+n/1e3;case"millisecond":return Math.floor(864e5*t)+n;default:throw Error("Unknown unit "+e)}},rD.asMilliseconds=t8,rD.asSeconds=t3,rD.asMinutes=t5,rD.asHours=t4,rD.asDays=t6,rD.asWeeks=t7,rD.asMonths=t9,rD.asQuarters=re,rD.asYears=rt,rD.valueOf=t8,rD._bubble=function(){var e,t,r,n,i,o=this._milliseconds,u=this._days,a=this._months,s=this._data;return o>=0&&u>=0&&a>=0||o<=0&&u<=0&&a<=0||(o+=864e5*tK(t1(a)+u),u=0,a=0),s.milliseconds=o%1e3,s.seconds=(e=eh(o/1e3))%60,s.minutes=(t=eh(e/60))%60,s.hours=(r=eh(t/60))%24,u+=eh(r/24),a+=i=eh(t0(u)),u-=tK(t1(i)),n=eh(a/12),a%=12,s.days=u,s.months=a,s.years=n,this},rD.clone=function(){return t_(this)},rD.get=function(e){return e=Y(e),this.isValid()?this[e+"s"]():NaN},rD.milliseconds=rn,rD.seconds=ri,rD.minutes=ro,rD.hours=ru,rD.days=ra,rD.weeks=function(){return eh(this.days()/7)},rD.months=rs,rD.years=rc,rD.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var r,n,i,o,u,a,s,c,l,f,h,d,p,m=!1,D=rf;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(m=e),"object"==typeof t&&(D=Object.assign({},rf,t),null!=t.s&&null==t.ss&&(D.ss=t.s-1)),d=this.localeData(),r=!m,n=D,i=t_(this).abs(),o=rl(i.as("s")),u=rl(i.as("m")),a=rl(i.as("h")),s=rl(i.as("d")),c=rl(i.as("M")),l=rl(i.as("w")),f=rl(i.as("y")),h=o<=n.ss&&["s",o]||o<n.s&&["ss",o]||u<=1&&["m"]||u<n.m&&["mm",u]||a<=1&&["h"]||a<n.h&&["hh",a]||s<=1&&["d"]||s<n.d&&["dd",s],null!=n.w&&(h=h||l<=1&&["w"]||l<n.w&&["ww",l]),(h=h||c<=1&&["M"]||c<n.M&&["MM",c]||f<=1&&["y"]||["yy",f])[2]=r,h[3]=+this>0,h[4]=d,p=rh.apply(null,h),m&&(p=d.pastFuture(+this,p)),d.postformat(p)},rD.toISOString=rm,rD.toString=rm,rD.toJSON=rm,rD.locale=tO,rD.localeData=tT,rD.toIsoString=F("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",rm),rD.lang=tB,I("X",0,0,"unix"),I("x",0,0,"valueOf"),el("x",ei),el("X",/[+-]?\d+(\.\d{1,3})?/),em("X",function(e,t,r){r._d=new Date(1e3*parseFloat(e))}),em("x",function(e,t,r){r._d=new Date(ed(e))}),t.version="2.30.1",z=tu,t.fn=tH,t.min=function(){var e=[].slice.call(arguments,0);return tc("isBefore",e)},t.max=function(){var e=[].slice.call(arguments,0);return tc("isAfter",e)},t.now=function(){return Date.now?Date.now():+new Date},t.utc=h,t.unix=function(e){return tu(1e3*e)},t.months=function(e,t){return t$(e,t,"months")},t.isDate=c,t.locale=eQ,t.invalid=m,t.duration=t_,t.isMoment=_,t.weekdays=function(e,t,r){return tJ(e,t,r,"weekdays")},t.parseZone=function(){return tu.apply(null,arguments).parseZone()},t.localeData=eK,t.isDuration=th,t.monthsShort=function(e,t){return t$(e,t,"monthsShort")},t.weekdaysMin=function(e,t,r){return tJ(e,t,r,"weekdaysMin")},t.defineLocale=eX,t.updateLocale=function(e,t){if(null!=t){var r,n,i=eW;null!=eG[e]&&null!=eG[e].parentLocale?eG[e].set(S(eG[e]._config,t)):(null!=(n=eJ(e))&&(i=n._config),t=S(i,t),null==n&&(t.abbr=e),(r=new M(t)).parentLocale=eG[e],eG[e]=r),eQ(e)}else null!=eG[e]&&(null!=eG[e].parentLocale?(eG[e]=eG[e].parentLocale,e===eQ()&&eQ(e)):null!=eG[e]&&delete eG[e]);return eG[e]},t.locales=function(){return H(eG)},t.weekdaysShort=function(e,t,r){return tJ(e,t,r,"weekdaysShort")},t.normalizeUnits=Y,t.relativeTimeRounding=function(e){return void 0===e?rl:"function"==typeof e&&(rl=e,!0)},t.relativeTimeThreshold=function(e,t){return void 0!==rf[e]&&(void 0===t?rf[e]:(rf[e]=t,"s"===e&&(rf.ss=t-1),!0))},t.calendarFormat=function(e,t){var r=e.diff(t,"days",!0);return r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse"},t.prototype=tH,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t}()},118(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=118,e.exports=t},249(e,t){"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=(Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider")),u=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),f=Symbol.iterator,h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},d=Object.assign,p={};function m(e,t,r){this.props=e,this.context=t,this.refs=p,this.updater=r||h}function D(){}function g(e,t,r){this.props=e,this.context=t,this.refs=p,this.updater=r||h}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},D.prototype=m.prototype;var y=g.prototype=new D;y.constructor=g,d(y,m.prototype),y.isPureReactComponent=!0;var v=Array.isArray,w=Object.prototype.hasOwnProperty,E=null,_={key:!0,ref:!0,__self:!0,__source:!0};function A(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var F=null;t.Fragment=i,t.Suspense=s,t.createContext=function(e){return(e={$$typeof:u,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.createElement=function(e,t,n){var i,o={},u=null,a=null;if(null!=t)for(i in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)w.call(t,i)&&!_.hasOwnProperty(i)&&(o[i]=t[i]);var s=arguments.length-2;if(1===s)o.children=n;else if(1<s){for(var c=Array(s),l=0;l<s;l++)c[l]=arguments[l+2];o.children=c}if(e&&e.defaultProps)for(i in s=e.defaultProps)void 0===o[i]&&(o[i]=s[i]);return{$$typeof:r,type:e,key:u,ref:a,props:o,_owner:E}},t.forwardRef=function(e){return{$$typeof:a,render:e}},t.lazy=function(e){return{$$typeof:l,_payload:{_status:-1,_result:e},_init:A}},t.memo=function(e,t){return{$$typeof:c,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return F.useCallback(e,t)},t.useContext=function(e){return F.useContext(e)},t.useEffect=function(e,t){return F.useEffect(e,t)},t.useMemo=function(e,t){return F.useMemo(e,t)},t.useRef=function(e){return F.useRef(e)},t.useState=function(e){return F.useState(e)}},326(e,t,r){"use strict";e.exports=r(249)},741(e){e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},557(t){"use strict";t.exports=e},2(e){"use strict";e.exports=n},438(e){"use strict";e.exports=o},545(e){"use strict";e.exports=r},55(e){"use strict";e.exports=i},111(e){"use strict";e.exports=t},530(e){!function(){"use strict";var t={}.hasOwnProperty;function r(){for(var e="",i=0;i<arguments.length;i++){var o=arguments[i];o&&(e=n(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var i="";for(var o in e)t.call(e,o)&&e[o]&&(i=n(i,o));return i}(o)))}return e}function n(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return r}):window.classNames=r}()}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return u[e].call(r.exports,r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var c={};return(()=>{"use strict";s.r(c),s.d(c,{default:()=>iY});let e=JSON.parse('{"UU":"@ohif/extension-dicom-microscopy"}').UU;var t=s(326),r=s(55),n=s(438),i=s(2),o=s.n(i);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=u(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}s(741),Object.create(null);var l=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,f={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},h=function(e){return f[e]},d={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:function(e){return e.replace(l,h)}},p=(0,t.createContext)(),m=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.usedNamespaces={}}return e=[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach(function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,u,a=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return D(e,t);var r=({}).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)?D(e,t):void 0}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t,r){return(t=a(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(){if(console&&console.warn){for(var e,t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];"string"==typeof r[0]&&(r[0]="react-i18next:: ".concat(r[0])),(e=console).warn.apply(e,r)}}var w={};function E(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];"string"==typeof t[0]&&w[t[0]]||("string"==typeof t[0]&&(w[t[0]]=new Date),v.apply(void 0,t))}var _=function(e,t){return function(){e.isInitialized?t():e.on("initialized",function r(){setTimeout(function(){e.off("initialized",r)},0),t()})}};function A(e,t,r){e.loadNamespaces(t,_(e,r))}function F(e,t,r,n){"string"==typeof r&&(r=[r]),r.forEach(function(t){0>e.options.ns.indexOf(t)&&e.options.ns.push(t)}),e.loadLanguages(t,_(e,n))}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach(function(t){y(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var x=function(e,r){var n=(0,t.useRef)();return(0,t.useEffect)(function(){n.current=r?n.current:e},[e,r]),n.current},S=["forwardedRef"];function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){y(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function O(){return(O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}var B={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},T=function(e){if(e)throw Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");return Object.freeze(B)};O(T,B,{MATRIX_OPTIONS:["Matrix","Array"],NUMBER_OPTIONS:["number","BigNumber","Fraction"]});var k,I,R,P="0123456789abcdef",j="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Y="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",U={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},z=!0,V="[DecimalError] ",L=V+"Invalid argument: ",q=V+"Precision limit exceeded",H=V+"crypto unavailable",W="[object Decimal]",G=Math.floor,Z=Math.pow,$=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,J=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Q=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,X=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,K=j.length-1,ee=Y.length-1,et={toStringTag:W};function er(e){var t,r,n,i=e.length-1,o="",u=e[0];if(i>0){for(o+=u,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(o+=ed(r)),o+=n;(r=7-(n=(u=e[t])+"").length)&&(o+=ed(r))}else if(0===u)return"0";for(;u%10==0;)u/=10;return o+u}function en(e,t,r){if(e!==~~e||e<t||e>r)throw Error(L+e)}function ei(e,t,r,n){var i,o,u,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=Z(10,7-t),a=e[i]%o|0,null==n?t<3?(0==t?a=a/100|0:1==t&&(a=a/10|0),u=r<4&&99999==a||r>3&&49999==a||5e4==a||0==a):u=(r<4&&a+1==o||r>3&&a+1==o/2)&&(e[i+1]/o/100|0)==Z(10,t-2)-1||(a==o/2||0==a)&&(e[i+1]/o/100|0)==0:t<4?(0==t?a=a/1e3|0:1==t?a=a/100|0:2==t&&(a=a/10|0),u=(n||r<4)&&9999==a||!n&&r>3&&4999==a):u=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==Z(10,t-3)-1,u}function eo(e,t,r){for(var n,i,o=[0],u=0,a=e.length;u<a;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=P.indexOf(e.charAt(u++)),n=0;n<o.length;n++)o[n]>r-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}et.absoluteValue=et.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),ea(e)},et.ceil=function(){return ea(new this.constructor(this),this.e+1,2)},et.clampedTo=et.clamp=function(e,t){var r=this.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(L+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new r(this)},et.comparedTo=et.cmp=function(e){var t,r,n,i,o=this.d,u=(e=new this.constructor(e)).d,a=this.s,s=e.s;if(!o||!u)return a&&s?a!==s?a:o===u?0:!o^a<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?a:u[0]?-s:0;if(a!==s)return a;if(this.e!==e.e)return this.e>e.e^a<0?1:-1;for(n=o.length,t=0,r=n<(i=u.length)?n:i;t<r;++t)if(o[t]!==u[t])return o[t]>u[t]^a<0?1:-1;return n===i?0:n>i^a<0?1:-1},et.cosine=et.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/e_(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=eE(e,1,t.times(i),new e(1));for(var o=r;o--;){var u=t.times(t);t=u.times(u).minus(u).times(8).plus(1)}return e.precision-=r,t}(n,eA(n,r)),n.precision=e,n.rounding=t,ea(2==R||3==R?r.neg():r,e,t,!0)):new n(1):new n(NaN)},et.cubeRoot=et.cbrt=function(){var e,t,r,n,i,o,u,a,s,c,l=this.constructor;if(!this.isFinite()||this.isZero())return new l(this);for(z=!1,(o=this.s*Z(this.s*this,1/3))&&Math.abs(o)!=1/0?n=new l(o.toString()):(r=er(this.d),(o=((e=this.e)-r.length+1)%3)&&(r+=1==o||-2==o?"0":"00"),o=Z(r,1/3),e=G((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=o==1/0?"5e"+e:(r=o.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=this.s),u=(e=l.precision)+3;;)if(n=eu((c=(s=(a=n).times(a).times(a)).plus(this)).plus(this).times(a),c.plus(s),u+2,1),er(a.d).slice(0,u)===(r=er(n.d)).slice(0,u)){if("9999"!=(r=r.slice(u-3,u+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(ea(n,e+1,1),t=!n.times(n).times(n).eq(this));break}if(!i&&(ea(a,e+1,0),a.times(a).times(a).eq(this))){n=a;break}u+=4,i=1}return z=!0,ea(n,e,l.rounding,t)},et.decimalPlaces=et.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-G(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},et.dividedBy=et.div=function(e){return eu(this,new this.constructor(e))},et.dividedToIntegerBy=et.divToInt=function(e){var t=this.constructor;return ea(eu(this,new t(e),0,1,1),t.precision,t.rounding)},et.equals=et.eq=function(e){return 0===this.cmp(e)},et.floor=function(){return ea(new this.constructor(this),this.e+1,3)},et.greaterThan=et.gt=function(e){return this.cmp(e)>0},et.greaterThanOrEqualTo=et.gte=function(e){var t=this.cmp(e);return 1==t||0===t},et.hyperbolicCosine=et.cosh=function(){var e,t,r,n,i,o=this,u=o.constructor,a=new u(1);if(!o.isFinite())return new u(o.s?1/0:NaN);if(o.isZero())return a;r=u.precision,n=u.rounding,u.precision=r+Math.max(o.e,o.sd())+4,u.rounding=1,(i=o.d.length)<32?t=(1/e_(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=eE(u,1,o.times(t),new u(1),!0);for(var s,c=e,l=new u(8);c--;)s=o.times(o),o=a.minus(s.times(l.minus(s.times(l))));return ea(o,u.precision=r,u.rounding=n,!0)},et.hyperbolicSine=et.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=eE(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=eE(o,2,i=i.times(1/e_(5,e)),i,!0);for(var u,a=new o(5),s=new o(16),c=new o(20);e--;)u=i.times(i),i=i.times(a.plus(u.times(s.times(u).plus(c))))}return o.precision=t,o.rounding=r,ea(i,t,r,!0)},et.hyperbolicTangent=et.tanh=function(){var e,t,r=this.constructor;return this.isFinite()?this.isZero()?new r(this):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,eu(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},et.inverseCosine=et.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return -1!==r?0===r?e.isNeg()?ef(t,n,i):new t(0):new t(NaN):e.isZero()?ef(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},et.inverseHyperbolicCosine=et.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,z=!1,r=r.times(r).minus(1).sqrt().plus(r),z=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},et.inverseHyperbolicSine=et.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,z=!1,r=r.times(r).plus(1).sqrt().plus(r),z=!0,n.precision=e,n.rounding=t,r.ln())},et.inverseHyperbolicTangent=et.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,Math.max(n=i.sd(),e)<-(2*i.e)-1)?ea(new o(i),e,t,!0):(o.precision=r=n-i.e,i=eu(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5)):new o(NaN)},et.inverseSine=et.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,-1!==t)?0===t?((e=ef(o,r+4,n).times(.5)).s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2))},et.inverseTangent=et.atan=function(){var e,t,r,n,i,o,u,a,s,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);else if(c.abs().eq(1)&&f+4<=ee)return(u=ef(l,f+4,h).times(.25)).s=c.s,u}else{if(!c.s)return new l(NaN);if(f+4<=ee)return(u=ef(l,f+4,h).times(.5)).s=c.s,u}for(l.precision=a=f+10,l.rounding=1,e=r=Math.min(28,a/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(z=!1,t=Math.ceil(a/7),n=1,s=c.times(c),u=new l(c),i=c;-1!==e;)if(i=i.times(s),o=u.minus(i.div(n+=2)),i=i.times(s),void 0!==(u=o.plus(i.div(n+=2))).d[t])for(e=t;u.d[e]===o.d[e]&&e--;);return r&&(u=u.times(2<<r-1)),z=!0,ea(u,l.precision=f,l.rounding=h,!0)},et.isFinite=function(){return!!this.d},et.isInteger=et.isInt=function(){return!!this.d&&G(this.e/7)>this.d.length-2},et.isNaN=function(){return!this.s},et.isNegative=et.isNeg=function(){return this.s<0},et.isPositive=et.isPos=function(){return this.s>0},et.isZero=function(){return!!this.d&&0===this.d[0]},et.lessThan=et.lt=function(e){return 0>this.cmp(e)},et.lessThanOrEqualTo=et.lte=function(e){return 1>this.cmp(e)},et.logarithm=et.log=function(e){var t,r,n,i,o,u,a,s=this.constructor,c=s.precision,l=s.rounding;if(null==e)e=new s(10),t=!0;else{if(r=(e=new s(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new s(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new s(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t)if(r.length>1)i=!0;else{for(n=r[0];n%10==0;)n/=10;i=1!==n}if(z=!1,ei((a=eu(o=ey(this,u=c+5),t?el(s,u+10):ey(e,u),u,1)).d,n=c,l))do if(u+=10,a=eu(o=ey(this,u),t?el(s,u+10):ey(e,u),u,1),!i){+er(a.d).slice(n+1,n+15)+1==1e14&&(a=ea(a,c+1,0));break}while(ei(a.d,n+=10,l))return z=!0,ea(a,c,l)},et.minus=et.sub=function(e){var t,r,n,i,o,u,a,s,c,l,f,h,d=this.constructor;if(e=new d(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new d(e.d||this.s!==e.s?this:NaN):e=new d(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(c=this.d,h=e.d,a=d.precision,s=d.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else{if(!c[0])return new d(3===s?-0:0);e=new d(this)}return z?ea(e,a,s):e}if(r=G(e.e/7),l=G(this.e/7),c=c.slice(),o=l-r){for((f=o<0)?(t=c,o=-o,u=h.length):(t=h,r=l,u=c.length),o>(n=Math.max(Math.ceil(a/7),u)+2)&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for((f=(n=c.length)<(u=h.length))&&(u=n),n=0;n<u;n++)if(c[n]!=h[n]){f=c[n]<h[n];break}o=0}for(f&&(t=c,c=h,h=t,e.s=-e.s),u=c.length,n=h.length-u;n>0;--n)c[u++]=0;for(n=h.length;n>o;){if(c[--n]<h[n]){for(i=n;i&&0===c[--i];)c[i]=1e7-1;--c[i],c[n]+=1e7}c[n]-=h[n]}for(;0===c[--u];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=ec(c,r),z?ea(e,a,s):e):new d(3===s?-0:0)},et.modulo=et.mod=function(e){var t,r=this.constructor;return(e=new r(e),this.d&&e.s&&(!e.d||e.d[0]))?e.d&&(!this.d||this.d[0])?(z=!1,9==r.modulo?(t=eu(this,e.abs(),0,3,1),t.s*=e.s):t=eu(this,e,0,r.modulo,1),t=t.times(e),z=!0,this.minus(t)):ea(new r(this),r.precision,r.rounding):new r(NaN)},et.naturalExponential=et.exp=function(){return eg(this)},et.naturalLogarithm=et.ln=function(){return ey(this)},et.negated=et.neg=function(){var e=new this.constructor(this);return e.s=-e.s,ea(e)},et.plus=et.add=function(e){var t,r,n,i,o,u,a,s,c,l,f=this.constructor;if(e=new f(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new f(e.d||this.s===e.s?this:NaN)):e=new f(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(c=this.d,l=e.d,a=f.precision,s=f.rounding,!c[0]||!l[0])return l[0]||(e=new f(this)),z?ea(e,a,s):e;if(o=G(this.e/7),n=G(e.e/7),c=c.slice(),i=o-n){for(i<0?(r=c,i=-i,u=l.length):(r=l,n=o,u=c.length),i>(u=(o=Math.ceil(a/7))>u?o+1:u+1)&&(i=u,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((u=c.length)-(i=l.length)<0&&(i=u,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/1e7|0,c[i]%=1e7;for(t&&(c.unshift(t),++n),u=c.length;0==c[--u];)c.pop();return e.d=c,e.e=ec(c,n),z?ea(e,a,s):e},et.precision=et.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(L+e);return this.d?(t=eh(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},et.round=function(){var e=this.constructor;return ea(new e(this),this.e+1,e.rounding)},et.sine=et.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:eE(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=eE(e,2,t=t.times(1/e_(5,r)),t);for(var i,o=new e(5),u=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(u.times(i).minus(a))));return t}(n,eA(n,r)),n.precision=e,n.rounding=t,ea(R>2?r.neg():r,e,t,!0)):new n(NaN)},et.squareRoot=et.sqrt=function(){var e,t,r,n,i,o,u=this.d,a=this.e,s=this.s,c=this.constructor;if(1!==s||!u||!u[0])return new c(!s||s<0&&(!u||u[0])?NaN:u?this:1/0);for(z=!1,0==(s=Math.sqrt(+this))||s==1/0?(((t=er(u)).length+a)%2==0&&(t+="0"),s=Math.sqrt(t),a=G((a+1)/2)-(a<0||a%2),n=new c(t=s==1/0?"5e"+a:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+a)):n=new c(s.toString()),r=(a=c.precision)+3;;)if(n=(o=n).plus(eu(this,o,r+2,1)).times(.5),er(o.d).slice(0,r)===(t=er(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(ea(n,a+1,1),e=!n.times(n).eq(this));break}if(!i&&(ea(o,a+1,0),o.times(o).eq(this))){n=o;break}r+=4,i=1}return z=!0,ea(n,a,c.rounding,e)},et.tangent=et.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=eu(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,ea(2==R||4==R?r.neg():r,e,t,!0)):new n(NaN)},et.times=et.mul=function(e){var t,r,n,i,o,u,a,s,c,l=this.constructor,f=this.d,h=(e=new l(e)).d;if(e.s*=this.s,!f||!f[0]||!h||!h[0])return new l(!e.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?e.s/0:0*e.s);for(r=G(this.e/7)+G(e.e/7),(s=f.length)<(c=h.length)&&(o=f,f=h,h=o,u=s,s=c,c=u),o=[],n=u=s+c;n--;)o.push(0);for(n=c;--n>=0;){for(t=0,i=s+n;i>n;)a=o[i]+h[n]*f[i-n-1]+t,o[i--]=a%1e7|0,t=a/1e7|0;o[i]=(o[i]+t)%1e7|0}for(;!o[--u];)o.pop();return t?++r:o.shift(),e.d=o,e.e=ec(o,r),z?ea(e,l.precision,l.rounding):e},et.toBinary=function(e,t){return eF(this,2,e,t)},et.toDecimalPlaces=et.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(en(e,0,1e9),void 0===t?t=n.rounding:en(t,0,8),ea(r,e+r.e+1,t))},et.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=es(n,!0):(en(e,0,1e9),void 0===t?t=i.rounding:en(t,0,8),r=es(n=ea(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},et.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?r=es(this):(en(e,0,1e9),void 0===t?t=i.rounding:en(t,0,8),r=es(n=ea(new i(this),e+this.e+1,t),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},et.toFraction=function(e){var t,r,n,i,o,u,a,s,c,l,f,h,d=this.d,p=this.constructor;if(!d)return new p(this);if(c=r=new p(1),n=s=new p(0),u=(o=(t=new p(n)).e=eh(d)-this.e-1)%7,t.d[0]=Z(10,u<0?7+u:u),null==e)e=o>0?t:c;else{if(!(a=new p(e)).isInt()||a.lt(c))throw Error(L+a);e=a.gt(t)?o>0?t:c:a}for(z=!1,a=new p(er(d)),l=p.precision,p.precision=o=7*d.length*2;f=eu(a,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=c,c=s.plus(f.times(i)),s=i,i=t,t=a.minus(f.times(i)),a=i;return i=eu(e.minus(r),n,0,1,1),s=s.plus(i.times(c)),r=r.plus(i.times(n)),s.s=c.s=this.s,h=1>eu(c,n,o,1).minus(this).abs().cmp(eu(s,r,o,1).minus(this).abs())?[c,n]:[s,r],p.precision=l,z=!0,h},et.toHexadecimal=et.toHex=function(e,t){return eF(this,16,e,t)},et.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:en(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(z=!1,r=eu(r,e,0,t,1).times(e),z=!0,ea(r)):(e.s=r.s,r=e),r},et.toNumber=function(){return+this},et.toOctal=function(e,t){return eF(this,8,e,t)},et.toPower=et.pow=function(e){var t,r,n,i,o,u,a=this,s=a.constructor,c=+(e=new s(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new s(Z(+a,c));if((a=new s(a)).eq(1))return a;if(n=s.precision,o=s.rounding,e.eq(1))return ea(a,n,o);if((t=G(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=0x1fffffffffffff)return i=ep(s,a,r,n),e.s<0?new s(1).div(i):ea(i,n,o);if((u=a.s)<0){if(t<e.d.length-1)return new s(NaN);if((1&e.d[t])==0&&(u=1),0==a.e&&1==a.d[0]&&1==a.d.length)return a.s=u,a}return(t=0!=(r=Z(+a,c))&&isFinite(r)?new s(r+"").e:G(c*(Math.log("0."+er(a.d))/Math.LN10+a.e+1)))>s.maxE+1||t<s.minE-1?new s(t>0?u/0:0):(z=!1,s.rounding=a.s=1,r=Math.min(12,(t+"").length),(i=eg(e.times(ey(a,n+r)),n)).d&&ei((i=ea(i,n+5,1)).d,n,o)&&(t=n+10,+er((i=ea(eg(e.times(ey(a,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=ea(i,n+1,0))),i.s=u,z=!0,s.rounding=o,ea(i,n,o))},et.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=es(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(en(e,1,1e9),void 0===t?t=i.rounding:en(t,0,8),r=es(n=ea(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},et.toSignificantDigits=et.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(en(e,1,1e9),void 0===t?t=r.rounding:en(t,0,8)),ea(new r(this),e,t)},et.toString=function(){var e=this.constructor,t=es(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},et.truncated=et.trunc=function(){return ea(new this.constructor(this),this.e+1,1)},et.valueOf=et.toJSON=function(){var e=this.constructor,t=es(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var eu=function(){function e(e,t,r){var n,i=0,o=e.length;for(e=e.slice();o--;)n=e[o]*t+i,e[o]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=+(e[r]<t[r]),e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,o,u,a,s){var c,l,f,h,d,p,m,D,g,y,v,w,E,_,A,F,b,C,x,S,M=n.constructor,N=n.s==i.s?1:-1,O=n.d,B=i.d;if(!O||!O[0]||!B||!B[0])return new M(!n.s||!i.s||(O?B&&O[0]==B[0]:!B)?NaN:O&&0==O[0]||!B?0*N:N/0);for(s?(d=1,l=n.e-i.e):(s=1e7,d=7,l=G(n.e/d)-G(i.e/d)),x=B.length,b=O.length,y=(g=new M(N)).d=[],f=0;B[f]==(O[f]||0);f++);if(B[f]>(O[f]||0)&&l--,null==o?(_=o=M.precision,u=M.rounding):_=a?o+(n.e-i.e)+1:o,_<0)y.push(1),p=!0;else{if(_=_/d+2|0,f=0,1==x){for(h=0,B=B[0],_++;(f<b||h)&&_--;f++)A=h*s+(O[f]||0),y[f]=A/B|0,h=A%B|0;p=h||f<b}else{for((h=s/(B[0]+1)|0)>1&&(B=e(B,h,s),O=e(O,h,s),x=B.length,b=O.length),F=x,w=(v=O.slice(0,x)).length;w<x;)v[w++]=0;(S=B.slice()).unshift(0),C=B[0],B[1]>=s/2&&++C;do h=0,(c=t(B,v,x,w))<0?(E=v[0],x!=w&&(E=E*s+(v[1]||0)),(h=E/C|0)>1?(h>=s&&(h=s-1),D=(m=e(B,h,s)).length,w=v.length,1==(c=t(m,v,D,w))&&(h--,r(m,x<D?S:B,D,s))):(0==h&&(c=h=1),m=B.slice()),(D=m.length)<w&&m.unshift(0),r(v,m,w,s),-1==c&&(w=v.length,(c=t(B,v,x,w))<1&&(h++,r(v,x<w?S:B,w,s))),w=v.length):0===c&&(h++,v=[0]),y[f++]=h,c&&v[0]?v[w++]=O[F]||0:(v=[O[F]],w=1);while((F++<b||void 0!==v[0])&&_--)p=void 0!==v[0]}y[0]||y.shift()}if(1==d)g.e=l,I=p;else{for(f=1,h=y[0];h>=10;h/=10)f++;g.e=f+l*d-1,ea(g,a?o+g.e+1:o,u,p)}return g}}();function ea(e,t,r,n){var i,o,u,a,s,c,l,f,h,d=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,a=f[0];a>=10;a/=10)i++;if((o=t-i)<0)o+=7,u=t,s=(l=f[h=0])/Z(10,i-u-1)%10|0;else if((h=Math.ceil((o+1)/7))>=(a=f.length))if(n){for(;a++<=h;)f.push(0);l=s=0,i=1,o%=7,u=o-7+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;o%=7,s=(u=o-7+i)<0?0:l/Z(10,i-u-1)%10|0}if(n=n||t<0||void 0!==f[h+1]||(u<0?l:l%Z(10,i-u-1)),c=r<4?(s||n)&&(0==r||r==(e.s<0?3:2)):s>5||5==s&&(4==r||n||6==r&&(o>0?u>0?l/Z(10,i-u):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=Z(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=h,a=1,h--):(f.length=h+1,a=Z(10,7-o),f[h]=u>0?(l/Z(10,i-u)%Z(10,u)|0)*a:0),c)for(;;)if(0==h){for(o=1,u=f[0];u>=10;u/=10)o++;for(u=f[0]+=a,a=1;u>=10;u/=10)a++;o!=a&&(e.e++,1e7==f[0]&&(f[0]=1));break}else{if(f[h]+=a,1e7!=f[h])break;f[h--]=0,a=1}for(o=f.length;0===f[--o];)f.pop()}return z&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function es(e,t,r){if(!e.isFinite())return ev(e);var n,i=e.e,o=er(e.d),u=o.length;return t?(r&&(n=r-u)>0?o=o.charAt(0)+"."+o.slice(1)+ed(n):u>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+ed(-i-1)+o,r&&(n=r-u)>0&&(o+=ed(n))):i>=u?(o+=ed(i+1-u),r&&(n=r-i-1)>0&&(o=o+"."+ed(n))):((n=i+1)<u&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-u)>0&&(i+1===u&&(o+="."),o+=ed(n))),o}function ec(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function el(e,t,r){if(t>K)throw z=!0,r&&(e.precision=r),Error(q);return ea(new e(j),t,1,!0)}function ef(e,t,r){if(t>ee)throw Error(q);return ea(new e(Y),t,r,!0)}function eh(e){var t=e.length-1,r=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function ed(e){for(var t="";e--;)t+="0";return t}function ep(e,t,r,n){var i,o=new e(1),u=Math.ceil(n/7+4);for(z=!1;;){if(r%2&&eb((o=o.times(t)).d,u)&&(i=!0),0===(r=G(r/2))){r=o.d.length-1,i&&0===o.d[r]&&++o.d[r];break}eb((t=t.times(t)).d,u)}return z=!0,o}function em(e){return 1&e.d[e.d.length-1]}function eD(e,t,r){for(var n,i,o=new e(t[0]),u=0;++u<t.length;){if(!(i=new e(t[u])).s){o=i;break}((n=o.cmp(i))===r||0===n&&o.s===r)&&(o=i)}return o}function eg(e,t){var r,n,i,o,u,a,s,c=0,l=0,f=0,h=e.constructor,d=h.rounding,p=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?!e.d[0]?1:e.s<0?0:1/0:e.s?e.s<0?0:e:0/0);for(null==t?(z=!1,s=p):s=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(s+=n=Math.log(Z(2,f))/Math.LN10*2+5|0,r=o=u=new h(1),h.precision=s;;){if(o=ea(o.times(e),s,1),r=r.times(++l),er((a=u.plus(eu(o,r,s,1))).d).slice(0,s)===er(u.d).slice(0,s)){for(i=f;i--;)u=ea(u.times(u),s,1);if(null!=t)return h.precision=p,u;if(!(c<3&&ei(u.d,s-n,d,c)))return ea(u,h.precision=p,d,z=!0);h.precision=s+=10,r=o=a=new h(1),l=0,c++}u=a}}function ey(e,t){var r,n,i,o,u,a,s,c,l,f,h,d=1,p=e,m=p.d,D=p.constructor,g=D.rounding,y=D.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new D(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(z=!1,l=y):l=t,D.precision=l+=10,n=(r=er(m)).charAt(0),!(15e14>Math.abs(o=p.e)))return c=el(D,l+2,y).times(o+""),p=ey(new D(n+"."+r.slice(1)),l-10).plus(c),D.precision=y,null==t?ea(p,y,g,z=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=er((p=p.times(e)).d)).charAt(0),d++;for(o=p.e,n>1?(p=new D("0."+r),o++):p=new D(n+"."+r.slice(1)),f=p,s=u=p=eu(p.minus(1),p.plus(1),l,1),h=ea(p.times(p),l,1),i=3;;){if(u=ea(u.times(h),l,1),er((c=s.plus(eu(u,new D(i),l,1))).d).slice(0,l)===er(s.d).slice(0,l)){if(s=s.times(2),0!==o&&(s=s.plus(el(D,l+2,y).times(o+""))),s=eu(s,new D(d),l,1),null!=t)return D.precision=y,s;if(!ei(s.d,l-10,g,a))return ea(s,D.precision=y,g,z=!0);D.precision=l+=10,c=u=p=eu(f.minus(1),f.plus(1),l,1),h=ea(p.times(p),l,1),i=a=1}s=c,i+=2}}function ev(e){return String(e.s*e.s/0)}function ew(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=7;n<i;)e.d.push(+t.slice(n,n+=7));n=7-(t=t.slice(n)).length}else n-=i;for(;n--;)t+="0";e.d.push(+t),z&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function eE(e,t,r,n,i){var o,u,a,s,c=e.precision,l=Math.ceil(c/7);for(z=!1,s=r.times(r),a=new e(n);;){if(u=eu(a.times(s),new e(t++*t++),c,1),a=i?n.plus(u):n.minus(u),n=eu(u.times(s),new e(t++*t++),c,1),void 0!==(u=a.plus(n)).d[l]){for(o=l;u.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=n,n=u,u=o}return z=!0,u.d.length=l+1,u}function e_(e,t){for(var r=e;--t;)r*=e;return r}function eA(e,t){var r,n=t.s<0,i=ef(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return R=n?4:1,t;if((r=t.divToInt(i)).isZero())R=n?3:2;else{if((t=t.minus(r.times(i))).lte(o))return R=em(r)?n?2:3:n?4:1,t;R=em(r)?n?1:4:n?3:2}return t.minus(i).abs()}function eF(e,t,r,n){var i,o,u,a,s,c,l,f,h,d=e.constructor,p=void 0!==r;if(p?(en(r,1,1e9),void 0===n?n=d.rounding:en(n,0,8)):(r=d.precision,n=d.rounding),e.isFinite()){for(u=(l=es(e)).indexOf("."),p?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,u>=0&&(l=l.replace(".",""),(h=new d(1)).e=l.length-u,h.d=eo(es(h),10,i),h.e=h.d.length),o=s=(f=eo(l,10,i)).length;0==f[--s];)f.pop();if(f[0]){if(u<0?o--:((e=new d(e)).d=f,e.e=o,f=(e=eu(e,h,r,n,0,i)).d,o=e.e,c=I),u=f[r],a=i/2,c=c||void 0!==f[r+1],c=n<4?(void 0!==u||c)&&(0===n||n===(e.s<0?3:2)):u>a||u===a&&(4===n||c||6===n&&1&f[r-1]||n===(e.s<0?8:7)),f.length=r,c)for(;++f[--r]>i-1;)f[r]=0,r||(++o,f.unshift(1));for(s=f.length;!f[s-1];--s);for(u=0,l="";u<s;u++)l+=P.charAt(f[u]);if(p){if(s>1)if(16==t||8==t){for(u=16==t?4:3,--s;s%u;s++)l+="0";for(s=(f=eo(l,i,t)).length;!f[s-1];--s);for(u=1,l="1.";u<s;u++)l+=P.charAt(f[u])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>s)for(o-=s;o--;)l+="0";else o<s&&(l=l.slice(0,o)+"."+l.slice(o))}else l=p?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=ev(e);return e.s<0?"-"+l:l}function eb(e,t){if(e.length>t)return e.length=t,!0}function eC(e){return new this(e).abs()}function ex(e){return new this(e).acos()}function eS(e){return new this(e).acosh()}function eM(e,t){return new this(e).plus(t)}function eN(e){return new this(e).asin()}function eO(e){return new this(e).asinh()}function eB(e){return new this(e).atan()}function eT(e){return new this(e).atanh()}function ek(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?ef(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=ef(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,r=this.atan(eu(e,t,o,1)),t=ef(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(eu(e,t,o,1)):(r=ef(this,o,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function eI(e){return new this(e).cbrt()}function eR(e){return ea(e=new this(e),e.e+1,2)}function eP(e,t,r){return new this(e).clamp(t,r)}function ej(e){if(!e||"object"!=typeof e)throw Error(V+"Object expected");var t,r,n,i=!0===e.defaults,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=U[r]),void 0!==(n=e[r]))if(G(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(L+r+": "+n);if(r="crypto",i&&(this[r]=U[r]),void 0!==(n=e[r]))if(!0===n||!1===n||0===n||1===n)if(n)if("u">typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(H);else this[r]=!1;else throw Error(L+r+": "+n);return this}function eY(e){return new this(e).cos()}function eU(e){return new this(e).cosh()}function ez(e,t){return new this(e).div(t)}function eV(e){return new this(e).exp()}function eL(e){return ea(e=new this(e),e.e+1,3)}function eq(){var e,t,r=new this(0);for(e=0,z=!1;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return z=!0,new this(1/0);r=t}return z=!0,r.sqrt()}function eH(e){return e instanceof tr||e&&e.toStringTag===W||!1}function eW(e){return new this(e).ln()}function eG(e,t){return new this(e).log(t)}function eZ(e){return new this(e).log(2)}function e$(e){return new this(e).log(10)}function eJ(){return eD(this,arguments,-1)}function eQ(){return eD(this,arguments,1)}function eX(e,t){return new this(e).mod(t)}function eK(e,t){return new this(e).mul(t)}function e0(e,t){return new this(e).pow(t)}function e1(e){var t,r,n,i,o=0,u=new this(1),a=[];if(void 0===e?e=this.precision:en(e,1,1e9),n=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(H);else for(;o<n;)a[o++]=1e7*Math.random()|0;for(n=a[--o],e%=7,n&&e&&(i=Z(10,7-e),a[o]=(n/i|0)*i);0===a[o];o--)a.pop();if(o<0)r=0,a=[0];else{for(r=-1;0===a[0];r-=7)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return u.e=r,u.d=a,u}function e2(e){return ea(e=new this(e),e.e+1,this.rounding)}function e8(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function e3(e){return new this(e).sin()}function e5(e){return new this(e).sinh()}function e4(e){return new this(e).sqrt()}function e6(e,t){return new this(e).sub(t)}function e7(){var e=0,t=arguments,r=new this(t[0]);for(z=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return z=!0,ea(r,this.precision,this.rounding)}function e9(e){return new this(e).tan()}function te(e){return new this(e).tanh()}function tt(e){return ea(e=new this(e),e.e+1,1)}et[Symbol.for("nodejs.util.inspect.custom")]=et.toString,et[Symbol.toStringTag]="Decimal";var tr=et.constructor=function e(t){var r,n,i;function o(e){var t,r,n;if(!(this instanceof o))return new o(e);if(this.constructor=o,eH(e)){this.s=e.s,z?!e.d||e.e>o.maxE?(this.e=NaN,this.d=null):e.e<o.minE?(this.e=0,this.d=[0]):(this.e=e.e,this.d=e.d.slice()):(this.e=e.e,this.d=e.d?e.d.slice():e.d);return}if("number"==(n=typeof e)){if(0===e){this.s=1/e<0?-1:1,this.e=0,this.d=[0];return}if(e<0?(e=-e,this.s=-1):this.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;z?t>o.maxE?(this.e=NaN,this.d=null):t<o.minE?(this.e=0,this.d=[0]):(this.e=t,this.d=[e]):(this.e=t,this.d=[e]);return}if(0*e!=0){e||(this.s=NaN),this.e=NaN,this.d=null;return}return ew(this,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),this.s=-1):(43===r&&(e=e.slice(1)),this.s=1),X.test(e)?ew(this,e):function(e,t){var r,n,i,o,u,a,s,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),X.test(t))return ew(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(J.test(t))r=16,t=t.toLowerCase();else if($.test(t))r=2;else if(Q.test(t))r=8;else throw Error(L+t);for((o=t.search(/p/i))>0?(s=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),u=(o=t.indexOf("."))>=0,n=e.constructor,u&&(o=(a=(t=t.replace(".","")).length)-o,i=ep(n,new n(r),o,2*o)),o=l=(c=eo(t,r,1e7)).length-1;0===c[o];--o)c.pop();return o<0?new n(0*e.s):(e.e=ec(c,l),e.d=c,z=!1,u&&(e=eu(e,i,4*a)),s&&(e=e.times(54>Math.abs(s)?Z(2,s):tr.pow(2,s))),z=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,ew(this,e.toString());throw Error(L+e)}if(o.prototype=et,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=ej,o.clone=e,o.isDecimal=eH,o.abs=eC,o.acos=ex,o.acosh=eS,o.add=eM,o.asin=eN,o.asinh=eO,o.atan=eB,o.atanh=eT,o.atan2=ek,o.cbrt=eI,o.ceil=eR,o.clamp=eP,o.cos=eY,o.cosh=eU,o.div=ez,o.exp=eV,o.floor=eL,o.hypot=eq,o.ln=eW,o.log=eG,o.log10=e$,o.log2=eZ,o.max=eJ,o.min=eQ,o.mod=eX,o.mul=eK,o.pow=e0,o.random=e1,o.round=e2,o.sign=e8,o.sin=e3,o.sinh=e5,o.sqrt=e4,o.sub=e6,o.sum=e7,o.tan=e9,o.tanh=te,o.trunc=tt,void 0===t&&(t={}),t&&!0!==t.defaults)for(r=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return o.config(t),o}(U);function tn(e){return"number"==typeof e}function ti(e){return!!e&&"object"==typeof e&&"function"==typeof e.constructor&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function to(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function tu(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function ta(e){return e&&!0===e.constructor.prototype.isUnit||!1}function ts(e){return"string"==typeof e}j=new tr(j),Y=new tr(Y);var tc=Array.isArray;function tl(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function tf(e){return Array.isArray(e)||tl(e)}function th(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function td(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function tp(e){return e&&!0===e.constructor.prototype.isRange||!1}function tm(e){return e&&!0===e.constructor.prototype.isIndex||!1}function tD(e){return"boolean"==typeof e}function tg(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function ty(e){return e&&!0===e.constructor.prototype.isHelp||!1}function tv(e){return"function"==typeof e}function tw(e){return e instanceof Date}function tE(e){return e instanceof RegExp}function t_(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!to(e)&&!tu(e))}function tA(e){return null===e}function tF(e){return void 0===e}function tb(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function tC(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function tx(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function tS(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function tM(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function tN(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function tO(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function tB(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function tT(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function tk(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function tI(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function tR(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function tP(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function tj(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function tY(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function tU(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function tz(e){return e&&!0===e.constructor.prototype.isChain||!1}function tV(e){var t=typeof e;return"object"===t?null===e?"null":ti(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function tL(e){var t=typeof e;if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return tL(e)});if(e instanceof Date)return new Date(e.valueOf());if(ti(e))return e;if(t_(e)){var r=e,n=tL,i={};for(var o in r)tH(r,o)&&(i[o]=n(r[o]));return i}throw TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function tq(e,t){var r,n,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!tq(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(!(e instanceof Object))return e===t;if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!tq(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}function tH(e,t){return e&&Object.hasOwnProperty.call(e,t)}function tW(e,t,r,n){function i(n){var i=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],o=e[i];void 0!==o&&(r[i]=o)}return r}(n,t.map(tG));return function(e,t,r){if(!t.filter(e=>{var t;return!((t=e)&&"?"===t[0])}).every(e=>void 0!==r[e])){var n=t.filter(e=>void 0===r[e]);throw Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(n.map(e=>'"'.concat(e,'"')).join(", "),"."))}}(e,t,n),r(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),n&&(i.meta=n),i}function tG(e){return e&&"?"===e[0]?e.slice(1):e}var tZ=tW("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=tr.clone({precision:r.precision,modulo:tr.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})}),n},{isClass:!0});let t$=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},tJ=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},tQ=function(e,t){return((e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8)?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},tX=function(){throw SyntaxError("Invalid Param")};function tK(e,t){let r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):.5*Math.log((e*=.5)*e+(t*=.5)*t)+Math.LN2}let t0={re:0,im:0},t1=function(e,t){if(null==e)t0.re=t0.im=0;else if(void 0!==t)t0.re=e,t0.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)t0.re=e.re,t0.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return t2.INFINITY;t0.re=e.abs*Math.cos(e.arg),t0.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return t2.INFINITY;t0.re=e.r*Math.cos(e.phi),t0.im=e.r*Math.sin(e.phi)}else 2===e.length?(t0.re=e[0],t0.im=e[1]):tX();break;case"string":t0.im=t0.re=0;let r=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&tX();for(let e=0;e<r.length;e++){let t=r[e];" "===t||" "===t||"\n"===t||("+"===t?n++:"-"===t?i++:("i"===t||"I"===t?(n+i===0&&tX()," "===r[e+1]||isNaN(r[e+1])?t0.im+=parseFloat((i%2?"-":"")+"1"):(t0.im+=parseFloat((i%2?"-":"")+r[e+1]),e++)):((n+i===0||isNaN(t))&&tX(),"i"===r[e+1]||"I"===r[e+1]?(t0.im+=parseFloat((i%2?"-":"")+t),e++):t0.re+=parseFloat((i%2?"-":"")+t)),n=i=0))}n+i>0&&tX();break;case"number":t0.im=0,t0.re=e;break;default:tX()}return isNaN(t0.re)||isNaN(t0.im),t0};function t2(e,t){if(!(this instanceof t2))return new t2(e,t);let r=t1(e,t);this.re=r.re,this.im=r.im}function t8(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}t2.prototype={re:0,im:0,sign:function(){let e=tQ(this.re,this.im);return new t2(this.re/e,this.im/e)},add:function(e,t){let r=t1(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?t2.NAN:t2.INFINITY:new t2(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=t1(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?t2.NAN:t2.INFINITY:new t2(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=t1(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,u=0===r.re&&0===r.im;return n&&u||i&&o?t2.NAN:n||i?t2.INFINITY:0===r.im&&0===this.im?new t2(this.re*r.re,0):new t2(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=t1(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,u=0===r.re&&0===r.im;if(o&&u||n&&i)return t2.NAN;if(u||n)return t2.INFINITY;if(o||i)return t2.ZERO;if(0===r.im)return new t2(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let e=r.re/r.im,t=r.re*e+r.im;return new t2((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{let e=r.im/r.re,t=r.im*e+r.re;return new t2((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let r=t1(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return t2.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new t2(Math.pow(this.re,r.re),0);else if(0===this.re)switch((r.re%4+4)%4){case 0:return new t2(Math.pow(this.im,r.re),0);case 1:return new t2(0,Math.pow(this.im,r.re));case 2:return new t2(-Math.pow(this.im,r.re),0);case 3:return new t2(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return t2.ZERO;let i=Math.atan2(this.im,this.re),o=tK(this.re,this.im),u=Math.exp(r.re*o-r.im*i),a=r.im*o+r.re*i;return new t2(u*Math.cos(a),u*Math.sin(a))},sqrt:function(){let e=this.re,t=this.im;if(0===t)if(e>=0)return new t2(Math.sqrt(e),0);else return new t2(0,Math.sqrt(-e));let r=Math.sqrt(.5*(tQ(e,t)+Math.abs(e))),n=Math.abs(t)/(2*r);return e>=0?new t2(r,t<0?-n:n):new t2(n,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new t2(e,0):new t2(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e,t=this.re,r=this.im;return new t2(Math.expm1(t)*Math.cos(r)+-2*(e=Math.sin(.5*r))*e,Math.exp(t)*Math.sin(r))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new t2(Math.log(e),0):new t2(tK(e,t),Math.atan2(t,e))},abs:function(){return tQ(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new t2(Math.sin(e)*t$(t),Math.cos(e)*tJ(t))},cos:function(){let e=this.re,t=this.im;return new t2(Math.cos(e)*t$(t),-Math.sin(e)*tJ(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+t$(t);return new t2(Math.sin(e)/r,tJ(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-t$(t);return new t2(-Math.sin(e)/r,tJ(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*t$(2*t)+.5*Math.cos(2*e);return new t2(Math.cos(e)*t$(t)/r,Math.sin(e)*tJ(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*t$(2*t)-.5*Math.cos(2*e);return new t2(Math.sin(e)*t$(t)/r,-Math.cos(e)*tJ(t)/r)},asin:function(){let e=this.re,t=this.im,r=new t2(t*t-e*e+1,-2*e*t).sqrt(),n=new t2(r.re-t,r.im+e).log();return new t2(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new t2(t*t-e*e+1,-2*e*t).sqrt(),n=new t2(r.re-t,r.im+e).log();return new t2(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new t2(0,1/0);if(-1===t)return new t2(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new t2((1-t*t-e*e)/r,-2*e/r).log();return new t2(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new t2(Math.atan2(1,e),0);let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).atan():new t2(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t2(0,1/0);let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).acos():new t2(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t2(Math.PI/2,1/0);let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).asin():new t2(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new t2(tJ(e)*Math.cos(t),t$(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new t2(t$(e)*Math.cos(t),tJ(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=t$(e)+Math.cos(t);return new t2(tJ(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=t$(e)-Math.cos(t);return new t2(tJ(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-t$(2*e);return new t2(-2*tJ(e)*Math.cos(t)/r,2*t$(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+t$(2*e);return new t2(2*t$(e)*Math.cos(t)/r,-2*tJ(e)*Math.sin(t)/r)},asinh:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new t2(0,0);let t=Math.abs(e),r=Math.log(t+Math.sqrt(t*t+1));return new t2(e<0?-r:r,0)}let r=new t2(e*e-t*t+1,2*e*t).sqrt();return new t2(e+r.re,t+r.im).log()},acosh:function(){let e=this.re,t=this.im;if(0===t){if(e>1)return new t2(Math.log(e+Math.sqrt(e-1)*Math.sqrt(e+1)),0);if(e<-1){let t=Math.sqrt(e*e-1);return new t2(Math.log(-e+t),Math.PI)}return new t2(0,Math.acos(e))}let r=new t2(e-1,t).sqrt(),n=new t2(e+1,t).sqrt();return new t2(e+r.re*n.re-r.im*n.im,t+r.re*n.im+r.im*n.re).log()},atanh:function(){let e=this.re,t=this.im;if(0===t)return 0===e?new t2(0,0):1===e?new t2(1/0,0):-1===e?new t2(-1/0,0):-1<e&&e<1?new t2(.5*Math.log((1+e)/(1-e)),0):e>1?new t2(.5*Math.log((e+1)/(e-1)),-Math.PI/2):new t2(.5*Math.log(-((1+e)/(1-e))),Math.PI/2);let r=1-e,n=1+e,i=r*r+t*t;if(0===i)return new t2(-1!==e?e/0:0,0!==t?t/0:0);let o=(n*r-t*t)/i,u=(t*r+n*t)/i;return new t2(tK(o,u)/2,Math.atan2(u,o)/2)},acoth:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t2(0,Math.PI/2);let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).atanh():new t2(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new t2(1/0,0);let t=1/e;return new t2(Math.log(t+Math.sqrt(t*t+1)),0)}let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).asinh():new t2(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return t2.INFINITY;let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).acosh():new t2(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return t2.INFINITY;if(this.isInfinite())return t2.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new t2(e/r,-t/r)},conjugate:function(){return new t2(this.re,-this.im)},neg:function(){return new t2(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new t2(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new t2(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new t2(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=t1(e,t);return Math.abs(r.re-this.re)<=t2.EPSILON&&Math.abs(r.im-this.im)<=t2.EPSILON},clone:function(){return new t2(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<t2.EPSILON&&(e=0),Math.abs(t)<t2.EPSILON&&(t=0),0===t)?r+e:(0!==e?(r+=e,r+=" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),1!==t&&(r+=t),r+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},t2.ZERO=new t2(0,0),t2.ONE=new t2(1,0),t2.I=new t2(0,1),t2.PI=new t2(Math.PI,0),t2.E=new t2(Math.E,0),t2.INFINITY=new t2(1/0,1/0),t2.NAN=new t2(NaN,NaN),t2.EPSILON=1e-15;function t3(e,t,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!t8(r))throw Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!t8(e))throw Error("Value must be an integer");e<0&&(e+=2**r),n="i".concat(r)}var i="";return e<0&&(e=-e,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[t]).concat(e.toString(t)).concat(n)}function t5(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:r,precision:n,wordSize:i}=t4(t);switch(r){case"fixed":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t6(e),n="number"==typeof t?t9(r,r.exponent+1+t):r,i=n.coefficients,o=n.exponent+1,u=o+(t||0);return i.length<u&&(i=i.concat(re(u-i.length))),o<0&&(i=re(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),n.sign+i.join("")}(e,n);case"exponential":return t7(e,n);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t9(t6(e),t),n=r.exponent,i=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(tn(t))for(;t>i.length||n-o+1>i.length;)i.push(0);else for(var u=Math.abs(n-o)-(i.length-1),a=0;a<u;a++)i.push(0);for(var s=Math.abs(n-o),c=1;s>0;)c++,s--;var l=i.slice(c).join(""),f=tn(t)&&l.length||l.match(/[1-9]/)?"."+l:"",h=i.slice(0,c).join("")+f+"e"+(n>=0?"+":"")+o.toString();return r.sign+h}(e,n);case"bin":return t3(e,2,i);case"oct":return t3(e,8,i);case"hex":return t3(e,16,i);case"auto":return(function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=ri(null==r?void 0:r.lowerExp,-3),i=ri(null==r?void 0:r.upperExp,5),o=t6(e),u=t?t9(o,t):o;if(u.exponent<n||u.exponent>=i)return t7(e,t);var a=u.coefficients,s=u.exponent;a.length<t&&(a=a.concat(re(t-a.length))),a=a.concat(re(s-a.length+1+(a.length<t?t-a.length:0))),a=re(-s).concat(a);var c=s>0?s:0;return c<a.length-1&&a.splice(c+1,0,"."),u.sign+a.join("")})(e,n,t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function t4(e){var t,r,n="auto";if(void 0!==e)if(tn(e))t=e;else if(ti(e))t=e.toNumber();else if(t_(e))void 0!==e.precision&&(t=rn(e.precision,()=>{throw Error('Option "precision" must be a number or BigNumber')})),void 0!==e.wordSize&&(r=rn(e.wordSize,()=>{throw Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(n=e.notation);else throw Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:n,precision:t,wordSize:r}}function t6(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),o=n.indexOf(".");i+=-1!==o?o-1:n.length-1;var u=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===u.length&&(u.push(0),i++),{sign:r,coefficients:u,exponent:i}}function t7(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t6(e),n=t?t9(r,t):r,i=n.coefficients,o=n.exponent;i.length<t&&(i=i.concat(re(t-i.length)));var u=i.shift();return n.sign+u+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function t9(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),i--,n[i]++}return r}function re(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var rt=Number.EPSILON||2220446049250313e-31;function rr(e,t,r){if(null==r)return e===t;if(e===t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var n=Math.abs(e-t);return n<=rt||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}function rn(e,t){return tn(e)?e:ti(e)?e.toNumber():void t()}function ri(e,t){return tn(e)?e:ti(e)?e.toNumber():t}var ro=tW("Complex",[],()=>(Object.defineProperty(t2,"name",{value:"Complex"}),t2.prototype.constructor=t2,t2.prototype.type="Complex",t2.prototype.isComplex=!0,t2.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},t2.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},t2.prototype.format=function(e){var t=this.im,r=this.re,n=t5(this.re,e),i=t5(this.im,e),o=tn(e)?e:e?e.precision:null;if(null!==o){var u=Math.pow(10,-o);Math.abs(r/t)<u&&(r=0),Math.abs(t/r)<u&&(t=0)}return 0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},t2.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return t2(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if(tn(r)){if(ta(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),tn(n))return new t2({r,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},t2.prototype.valueOf=t2.prototype.toString,t2.fromJSON=function(e){return new t2(e)},t2.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},t2),{isClass:!0}),ru=s(42),ra=tW("Fraction",[],()=>(Object.defineProperty(ru,"name",{value:"Fraction"}),ru.prototype.constructor=ru,ru.prototype.type="Fraction",ru.prototype.isFraction=!0,ru.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},ru.fromJSON=function(e){return new ru(e)},ru),{isClass:!0}),rs=tW("Matrix",[],()=>{function e(){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function rc(e,t,r){var n=new e.constructor(2),i="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!t8(r))throw Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw Error("Base ".concat(t," not supported "))}}function rl(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function rf(e,t){return tn(e)?e:ti(e)?e.toNumber():t}function rh(e,t){var r=function(e,t){var r;if("number"==typeof e)return t5(e,t);if(ti(e))return function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r,n,i,o,u,a,s,{notation:c,precision:l,wordSize:f}=t4(t);switch(c){case"fixed":return r=e,n=l,r.toFixed(n);case"exponential":return rl(e,l);case"engineering":return i=e,o=l,a=(u=i.e)%3==0?u:u<0?u-3-u%3:u-u%3,(s=i.mul(Math.pow(10,-a)).toPrecision(o)).includes("e")&&(s=new i.constructor(s).toFixed()),s+"e"+(u>=0?"+":"")+a.toString();case"bin":return rc(e,2,f);case"oct":return rc(e,8,f);case"hex":return rc(e,16,f);case"auto":var h=rf(null==t?void 0:t.lowerExp,-3),d=rf(null==t?void 0:t.upperExp,5);if(e.isZero())return"0";var p=e.toSignificantDigits(l),m=p.e;return(m>=h&&m<d?p.toFixed():rl(e,l)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+c+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t);if((r=e)&&"object"==typeof r&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d)if(!t||"decimal"!==t.fraction)return e.s*e.n+"/"+e.d;else return e.toString();if(Array.isArray(e))return function e(t,r){if(!Array.isArray(t))return rh(t,r);for(var n="[",i=t.length,o=0;o<i;o++)0!==o&&(n+=", "),n+=e(t[o],r);return n+"]"}(e,t);if(ts(e))return rd(e);if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e)if("function"==typeof e.format)return e.format(t);else return e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(r=>rd(r)+": "+rh(e[r],t)).join(", ")+"}";return String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function rd(e){for(var t=String(e),r="",n=0;n<t.length;){var i=t.charAt(n);r+=i in rp?rp[i]:i,n++}return'"'+r+'"'}var rp={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function rm(e,t,r){if(!(this instanceof rm))throw SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=Error().stack}function rD(e,t,r){if(!(this instanceof rD))throw SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function rg(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function ry(e,t){if(0===t.length){if(Array.isArray(e))throw new rm(e.length,0)}else!function e(t,r,n){var i,o=t.length;if(o!==r[n])throw new rm(o,r[n]);if(n<r.length-1){var u=n+1;for(i=0;i<o;i++){if(!Array.isArray(t[i]))throw new rm(r.length-1,r.length,"<");e(t[i],r,u)}}else for(i=0;i<o;i++)if(Array.isArray(t[i]))throw new rm(r.length+1,r.length,">")}(e,t,0)}function rv(e,t){if(void 0!==e){if(!tn(e)||!t8(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new rD(e,t)}}function rw(e,t,r){if(!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!tn(e)||!t8(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+rh(t)+")")}),(tn(e)||ti(e))&&(e=[e]),function e(t,r,n,i){var o,u,a=t.length,s=r[n],c=Math.min(a,s);if(t.length=s,n<r.length-1){var l=n+1;for(o=0;o<c;o++)Array.isArray(u=t[o])||(u=[u],t[o]=u),e(u,r,l,i);for(o=c;o<s;o++)u=[],t[o]=u,e(u,r,l,i)}else{for(o=0;o<c;o++)for(;Array.isArray(t[o]);)t[o]=t[o][0];for(o=c;o<s;o++)t[o]=i}}(e,t,0,void 0!==r?r:0),e}function rE(e,t){var r=function(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function e(r){Array.isArray(r)?r.forEach(e):t.push(r)}),t}(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw new rm(0,n,"!=");var i=rA(t=r_(t,n));if(n!==i)throw new rm(i,n,"!=");try{return function(e,t){for(var r,n=e,i=t.length-1;i>0;i--){var o=t[i];r=[];for(var u=n.length/o,a=0;a<u;a++)r.push(n.slice(a*o,(a+1)*o));n=r}return n}(r,t)}catch(e){if(e instanceof rm)throw new rm(i,n,"!=");throw e}}function r_(e,t){var r=rA(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(t%r==0)n[i]=-t/r;else throw Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);return n}function rA(e){return e.reduce((e,t)=>e*t,1)}function rF(e,t,r,n){var i=n||rg(e);if(r)for(var o=0;o<r;o++)e=[e],i.unshift(1);for(e=function e(t,r,n){var i,o;if(Array.isArray(t)){var u=n+1;for(i=0,o=t.length;i<o;i++)t[i]=e(t[i],r,u)}else for(var a=n;a<r;a++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function rb(e,t){for(var r,n=0,i=0;i<e.length;i++){var o=e[i],u=Array.isArray(o);if(0===i&&u&&(n=o.length),u&&o.length!==n)return;var a=u?rb(o,t):t(o);if(void 0===r)r=a;else if(r!==a)return"mixed"}return r}function rC(e,t){for(var r=t.length,n=e.length,i=0;i<n;i++){var o=r-n+i;if(e[i]<t[o]&&e[i]>1||e[i]>t[o])throw Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[i]," to size ").concat(t[o]))}}function rx(e,t){var r,n,i,o=rg(e);if(tq(o,t))return e;rC(o,t);var u=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n=t.map(e=>e.length),i=Math.max(...n),o=Array(i).fill(null),u=0;u<t.length;u++)for(var a=t[u],s=n[u],c=0;c<s;c++){var l=i-s+c;a[c]>o[l]&&(o[l]=a[c])}for(var f=0;f<t.length;f++)rC(t[f],o);return o}(o,t),a=u.length,s=[...Array(a-o.length).fill(1),...o],c=O([],e);o.length<a&&(o=rg(c=rE(c,s)));for(var l=0;l<a;l++){o[l]<u[l]&&(o=rg((r=c,n=u[l],i=l,c=function(){var e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce(function(e,r){return function e(t,r,n,i){if(!(i<n))return t.concat(r);if(t.length!==r.length)throw new rm(t.length,r.length);for(var o=[],u=0;u<t.length;u++)o[u]=e(t[u],r[u],n,i+1);return o}(e,r,t,0)},e[0]);throw Error("Wrong number of arguments in function concat")}(...Array(n).fill(r),i))))}return c}function rS(e){return Object.keys(e.signatures||{}).reduce(function(e,t){return Math.max(e,(t.match(/,/g)||[]).length+1)},-1)}rm.prototype=RangeError(),rm.prototype.constructor=RangeError,rm.prototype.name="DimensionError",rm.prototype.isDimensionError=!0,rD.prototype=RangeError(),rD.prototype.constructor=RangeError,rD.prototype.name="IndexError",rD.prototype.isIndexError=!0;var rM=tW("DenseMatrix",["Matrix"],e=>{var{Matrix:t}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator");if(t&&!ts(t))throw Error("Invalid datatype: "+t);if(tl(e))"DenseMatrix"===e.type?(this._data=tL(e._data),this._size=tL(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&tc(e.data)&&tc(e.size))this._data=e.data,this._size=e.size,ry(this._data,this._size),this._datatype=t||e.datatype;else if(tc(e))this._data=function e(t){return tl(t)?e(t.valueOf()):tc(t)?t.map(e):t}(e),this._size=rg(this._data),ry(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+tV(e)+")");else this._data=[],this._size=[0],this._datatype=t}function n(e,t,r){if(0===t.length){for(var n=e._data;tc(n);)n=n[0];return n}return e._size=t.slice(0),e._data=rw(e._data,e._size,r),e}function i(e,t,r){for(var i=e._size.slice(0),o=!1;i.length<t.length;)i.push(0),o=!0;for(var u=0,a=t.length;u<a;u++)t[u]>i[u]&&(i[u]=t[u],o=!0);o&&n(e,i,r)}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return rb(this._data,tV)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return function(e,t){if(!tm(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var n=t.size();if(n.length!==e._size.length)throw new rm(n.length,e._size.length);for(var i=t.min(),o=t.max(),u=0,a=e._size.length;u<a;u++)rv(i[u],e._size[u]),rv(o[u],e._size[u]);return new r(function e(t,r,n,i){var o=i===n-1,u=r.dimension(i);return o?u.map(function(e){return rv(e,t.length),t[e]}).valueOf():u.map(function(o){return rv(o,t.length),e(t[o],r,n,i+1)}).valueOf()}(e._data,t,n.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var o,u=t.size(),a=t.isScalar();if(tl(r)?(o=r.size(),r=r.valueOf()):o=rg(r),a){if(0!==o.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(!tq(o,u))try{r=0===o.length?rx([r],u):rx(r,u),o=rg(r)}catch(e){}if(u.length<e._size.length)throw new rm(u.length,e._size.length,"<");if(o.length<u.length){for(var s=0,c=0;1===u[s]&&1===o[s];)s++;for(;1===u[s];)c++,s++;r=rF(r,u.length,c,o)}if(!tq(u,o))throw new rm(u,o,">");i(e,t.max().map(function(e){return e+1}),n);var l=u.length;!function e(t,r,n,i,o){var u=o===i-1,a=r.dimension(o);u?a.forEach(function(e,r){rv(e),t[e]=n[r[0]]}):a.forEach(function(u,a){rv(u),e(t[u],r,n[a[0]],i,o+1)})}(e._data,t,r,l,0)}return e}(this,e,t,n);default:throw SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!tc(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rm(e.length,this._size.length);for(var t=0;t<e.length;t++)rv(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var o=e[n];rv(o,r.length),r=r[o]}return r},r.prototype.set=function(e,t,r){if(!tc(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new rm(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),r);var n,o,u,a=this._data;for(n=0,o=e.length-1;n<o;n++)rv(u=e[n],a.length),a=a[u];return rv(u=e[e.length-1],a.length),a[u]=t,this},r.prototype.resize=function(e,t,r){if(!tf(e))throw TypeError("Array or Matrix expected");var i=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return n(r?this.clone():this,i,t)},r.prototype.reshape=function(e,t){var r=t?this.clone():this;r._data=rE(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=r_(e,n),r},r.prototype.clone=function(){return new r({data:tL(this._data),size:tL(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){var t=this,n=rS(e),i=function r(i,o){return tc(i)?i.map(function(e,t){return r(e,o.concat(t))}):1===n?e(i):2===n?e(i,o):e(i,o,t)}(this._data,[]),o=void 0!==this._datatype?rb(i,tV):void 0;return new r(i,o)},r.prototype.forEach=function(e){var t=this;!function r(n,i){tc(n)?n.forEach(function(e,t){r(e,i.concat(t))}):e(n,i,t)}(this._data,[])},r.prototype[Symbol.iterator]=function*(){var e=function* e(t,r){if(tc(t))for(var n=0;n<t.length;n++)yield*e(t[n],r.concat(n));else yield{value:t,index:r}};yield*e(this._data,[])},r.prototype.rows=function(){var e=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var t of this._data)e.push(new r([t],this._datatype));return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(2!==n.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,o=function(n){var o=i.map(e=>[e[n]]);t.push(new r(o,e._datatype))},u=0;u<n[1];u++)o(u);return t},r.prototype.toArray=function(){return tL(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return rh(this._data,e)},r.prototype.toString=function(){return rh(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(ti(e)&&(e=e.toNumber()),!tn(e)||!t8(e))throw TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,n=e<0?-e:0,i=Math.min(this._size[0]-n,this._size[1]-t),o=[],u=0;u<i;u++)o[u]=this._data[u+n][u+t];return new r({data:o,size:[i],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!tc(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(ti(e)&&(e=e.toNumber()),!tn(e)||!t8(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if(ti(n)&&(n=n.toNumber()),!tn(n)||!t8(n))throw TypeError("The parameter k must be an integer number")}else n=0;var o,u=n>0?n:0,a=n<0?-n:0,s=e[0],c=e[1],l=Math.min(s-a,c-u);if(tc(t)){if(t.length!==l)throw Error("Invalid value array length");o=function(e){return t[e]}}else if(tl(t)){var f=t.size();if(1!==f.length||f[0]!==l)throw Error("Invalid matrix length");o=function(e){return t.get([e])}}else o=function(){return t};i||(i=ti(o(0))?o(0).mul(0):0);var h=[];if(e.length>0){h=rw(h,e,i);for(var d=0;d<l;d++)h[d+a][d+u]=o(d)}return new r({data:h,size:[s,c]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!tn(e)||!t8(e)||!tn(t)||!t8(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return rv(e,this._size[0]),rv(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},r},{isClass:!0});function rN(){return!0}function rO(){return!1}function rB(){}let rT="Argument is not a typed-function.",rk=function e(){let t,r;function n(e){return"object"==typeof e&&null!==e&&e.constructor===Object}let i=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:n},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],o={name:"any",test:rN,isAny:!0},u=0,a={createCount:0};function s(e){let n,i=t.get(e);if(i)return i;let o='Unknown type "'+e+'"',u=e.toLowerCase();for(n of r)if(n.toLowerCase()===u){o+='. Did you mean "'+n+'" ?';break}throw TypeError(o)}function c(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any",i=n?s(n).index:r.length,o=[];for(let r=0;r<e.length;++r){if(!e[r]||"string"!=typeof e[r].name||"function"!=typeof e[r].test)throw TypeError("Object with properties {name: string, test: function} expected");let n=e[r].name;if(t.has(n))throw TypeError('Duplicate type name "'+n+'"');o.push(n),t.set(n,{name:n,test:e[r].test,isAny:e[r].isAny,index:i+r,conversionsTo:[]})}let u=r.slice(i);r=r.slice(0,i).concat(o).concat(u);for(let e=i+o.length;e<r.length;++e)t.get(r[e]).index=e}function l(){t=new Map,r=[],u=0,c([o],!1)}function f(e){let n=r.filter(r=>{let n=t.get(r);return!n.isAny&&n.test(e)});return n.length?n:["any"]}function h(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function d(e,t,r){let n,i;if(!h(e))throw TypeError(rT);let o=r&&r.exact,u=g(Array.isArray(t)?t.join(","):t),a=p(u);if(!o||a in e.signatures){let t=e._typedFunctionData.signatureMap.get(a);if(t)return t}let s=u.length;if(o){let t;for(t in n=[],e.signatures)n.push(e._typedFunctionData.signatureMap.get(t))}else n=e._typedFunctionData.signatures;for(let e=0;e<s;++e){let t,r=u[e],i=[];for(t of n){let n=w(t.params,e);if(n&&(!r.restParam||n.restParam)){if(!n.hasAny){let e=D(n);if(r.types.some(t=>!e.has(t.name)))continue}i.push(t)}}if(0===(n=i).length)break}for(i of n)if(i.params.length<=s)return i;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+p(u,", ")+"))")}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map(e=>e.name).join(t)}function m(e){let t=function(e){if(0===e.length)return[];let t=e.map(s);if(1===e.length)return t[0].conversionsTo;let r=new Set(e),n=new Set;for(let e=0;e<t.length;++e)for(let i of t[e].conversionsTo)r.has(i.from)||n.add(i.from);let i=[];for(let e of n){let r=u+1,n=null;for(let i=0;i<t.length;++i)for(let o of t[i].conversionsTo)o.from===e&&o.index<r&&(r=o.index,n=o);i.push(n)}return i}(e.types.map(e=>e.name)),r=e.hasAny,n=e.name,i=t.map(function(e){let t=s(e.from);return r=t.isAny||r,n+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}});return{types:e.types.concat(i),name:n,hasAny:r,hasConversion:i.length>0,restParam:e.restParam}}function D(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach(t=>e.typeSet.add(t.name))),e.typeSet}function g(e){let t=[];if("string"!=typeof e)throw TypeError("Signatures must be strings");let r=e.trim();if(""===r)return t;let n=r.split(",");for(let e=0;e<n.length;++e){let r=function(e){let t=0===e.indexOf("..."),r=(t?e.length>3?e.slice(3):"any":e).split("|").map(e=>s(e.trim())),n=!1,i=t?"...":"";return{types:r.map(function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}}),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:t}}(n[e].trim());if(r.restParam&&e!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===r.types.length)return null;t.push(r)}return t}function y(e){let t=O(e);return!!t&&t.restParam}function v(e){if(!e||0===e.types.length)return rN;if(1===e.types.length)return s(e.types[0].name).test;if(2===e.types.length){let t=s(e.types[0].name).test,r=s(e.types[1].name).test;return function(e){return t(e)||r(e)}}{let t=e.types.map(function(e){return s(e.name).test});return function(e){for(let r=0;r<t.length;r++)if(t[r](e))return!0;return!1}}}function w(e,t){return t<e.length?e[t]:y(e)?O(e):null}function E(e,t){let r=w(e,t);return r?D(r):new Set}function _(e){return null===e.conversion||void 0===e.conversion}function A(e,t){let r=new Set;return e.forEach(e=>{let n;for(n of E(e.params,t))r.add(n)}),r.has("any")?["any"]:Array.from(r)}function F(e,t,r){let n,i,o,u=e||"unnamed",a=r;for(o=0;o<t.length;o++){let e=[];if(a.forEach(r=>{let n=v(w(r.params,o));(o<r.params.length||y(r.params))&&n(t[o])&&e.push(r)}),0===e.length){if((i=A(a,o)).length>0){let e=f(t[o]);return(n=TypeError("Unexpected type of argument in function "+u+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+o+")")).data={category:"wrongType",fn:u,index:o,actual:e,expected:i},n}}else a=e}let s=a.map(function(e){return y(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,s))return(n=TypeError("Too few arguments in function "+u+" (expected: "+(i=A(a,o)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:u,index:t.length,expected:i},n;let c=Math.max.apply(null,s);if(t.length>c)return(n=TypeError("Too many arguments in function "+u+" (expected: "+c+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:u,index:t.length,expectedLength:c},n;let l=[];for(let e=0;e<t.length;++e)l.push(f(t[e]).join("|"));return(n=TypeError('Arguments of type "'+l.join(", ")+'" do not match any of the defined signatures of function '+u+".")).data={category:"mismatch",actual:l},n}function b(e){let t=r.length+1;for(let r=0;r<e.types.length;r++)t=Math.min(t,e.types[r].typeIndex);return t}function C(e){let t=u+1;for(let r=0;r<e.types.length;r++)_(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function x(e,t){let r,n,i=e.params,o=t.params,u=O(i),a=O(o),s=y(i),c=y(o);if(s&&u.hasAny){if(!c||!a.hasAny)return 1e7}else if(c&&a.hasAny)return -1e7;let l=0,f=0;for(r of i)r.hasAny&&++l,r.hasConversion&&++f;let h=0,d=0;for(r of o)r.hasAny&&++h,r.hasConversion&&++d;if(l!==h)return(l-h)*1e6;if(s&&u.hasConversion){if(!c||!a.hasConversion)return 1e5}else if(c&&a.hasConversion)return -1e5;if(f!==d)return(f-d)*1e4;if(s){if(!c)return 1e3}else if(c)return -1e3;let p=(i.length-o.length)*(s?-100:100);if(0!==p)return p;let m=[],D=0;for(let e=0;e<i.length;++e){let t=function(e,t){if(e.hasAny){if(!t.hasAny)return .1}else if(t.hasAny)return -.1;if(e.restParam){if(!t.restParam)return .01}else if(t.restParam)return -.01;let r=b(e)-b(t);if(r<0)return -.001;if(r>0)return .001;let n=C(e),i=C(t);if(e.hasConversion){if(!t.hasConversion)return(1+n)*1e-6}else if(t.hasConversion)return-(1e-6*(1+i));let o=n-i;return o<0?-1e-7:1e-7*(o>0)}(i[e],o[e]);m.push(t),D+=t}if(0!==D)return(D<0?-10:10)+D;let g=9,v=9/(m.length+1);for(n of m){if(0!==n)return(n<0?-g:g)+n;g-=v}return 0}function S(e){let t,r,n,i,o=[],u=[],a="";e.types.forEach(function(e){e.conversion&&(a+=e.conversion.from+"~>"+e.conversion.to+",",o.push(s(e.conversion.from).test),u.push(e.conversion.convert))}),a=a?a.slice(0,-1):"pass";let c=e=>e;switch(u.length){case 0:break;case 1:t=o[0],n=u[0],c=function(e){return t(e)?n(e):e};break;case 2:t=o[0],r=o[1],n=u[0],i=u[1],c=function(e){return t(e)?n(e):r(e)?i(e):e};break;default:c=function(e){for(let t=0;t<u.length;t++)if(o[t](e))return u[t](e);return e}}return Object.defineProperty(c,"name",{value:a}),c}function M(e,t,r){throw F(e,t,r)}function N(e){return B(e,0,e.length-1)}function O(e){return e[e.length-1]}function B(e,t,r){return Array.prototype.slice.call(e,t,r)}function T(e,t){return{referTo:{references:e,callback:t}}}function k(e){if("function"!=typeof e)throw TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function I(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function R(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function P(e,t){if(!e)return t;if(t&&t!==e){let r=Error("Function names do not match (expected: "+e+", actual: "+t+")");throw r.data={actual:t,expected:e},r}return e}l(),c(i);let j=a;function Y(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return(a=function(e){let t="string"==typeof e,r=+!!t,i=t?e:"",o={};for(let e=r;e<arguments.length;++e){let r,u=arguments[e],a={};if("function"==typeof u?(r=u.name,"string"==typeof u.signature?a[u.signature]=u:h(u)&&(a=u.signatures)):n(u)&&(a=u,t||(r=function(e){let t;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(h(e[r])||"string"==typeof e[r].signature)&&(t=P(t,e[r].name));return t}(u))),0===Object.keys(a).length){let t=TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw t.data={index:e,argument:u},t}t||(i=P(i,r)),function(e,t){let r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(r in e&&t[r]!==e[r]){let n=Error('Signature "'+r+'" is defined twice');throw n.data={signature:r,sourceFunction:t[r],destFunction:e[r]},n}e[r]=t[r]}}(o,a)}return function(e,t){let r,n,i;if(a.createCount++,0===Object.keys(t).length)throw SyntaxError("No signatures provided");a.warnAgainstDeprecatedThis&&(i=/\bthis(\(|\.signatures\b)/,Object.keys(t).forEach(e=>{let r=t[e];if(i.test(r.toString()))throw SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}));let o=[],u=[],s={},c=[];for(r in t){let e;if(!Object.prototype.hasOwnProperty.call(t,r))continue;let n=g(r);if(!n)continue;o.forEach(function(e){if(function(e,t){let r=Math.max(e.length,t.length);for(let n=0;n<r;n++){let r,i=E(e,n),o=E(t,n),u=!1;for(r of o)if(i.has(r)){u=!0;break}if(!u)return!1}let n=e.length,i=t.length,o=y(e),u=y(t);return o?u?n===i:i>=n:u?n>=i:n===i}(e,n))throw TypeError('Conflicting signatures "'+p(e)+'" and "'+p(n)+'".')}),o.push(n);let i=u.length;for(e of(u.push(t[r]),function e(t,r,n){if(!(r<t.length))return[n];{var i,o;let u=t[r],a=[];if(u.restParam){let e=u.types.filter(_);e.length<u.types.length&&a.push({types:e,name:"..."+e.map(e=>e.name).join("|"),hasAny:e.some(e=>e.isAny),hasConversion:!1,restParam:!0}),a.push(u)}else a=u.types.map(function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}});return i=a,o=function(i){return e(t,r+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(o))}}(n.map(m),0,[]))){let t=p(e);c.push({params:e,name:t,fn:i}),e.every(e=>!e.hasConversion)&&(s[t]=i)}}c.sort(x);let l=function(e,t,r){let n=e.map(e=>R(e)?k(e.referToSelf.callback):I(e)?T(e.referTo.references,e.referTo.callback):e),i=Array(n.length).fill(!1),o=!0;for(;o;){o=!1;let e=!0;for(let u=0;u<n.length;++u){if(i[u])continue;let a=n[u];if(R(a))n[u]=a.referToSelf.callback(r),n[u].referToSelf=a.referToSelf,i[u]=!0,e=!1;else if(I(a)){let r=function(e,t,r){let n,i=[];for(n of e){let e=r[n];if("number"!=typeof e)throw TypeError('No definition for referenced signature "'+n+'"');if("function"!=typeof(e=t[e]))return!1;i.push(e)}return i}(a.referTo.references,n,t);r?(n[u]=a.referTo.callback.apply(this,r),n[u].referTo=a.referTo,i[u]=!0,e=!1):o=!0}}if(e&&o)throw SyntaxError("Circular reference detected in resolving typed.referTo")}return n}(u,s,el);for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(s[n]=l[s[n]]);let f=[],h=new Map;for(n of c)h.has(n.name)||(n.fn=l[n.fn],f.push(n),h.set(n.name,n));let d=f[0]&&f[0].params.length<=2&&!y(f[0].params),D=f[1]&&f[1].params.length<=2&&!y(f[1].params),w=f[2]&&f[2].params.length<=2&&!y(f[2].params),A=f[3]&&f[3].params.length<=2&&!y(f[3].params),F=f[4]&&f[4].params.length<=2&&!y(f[4].params),b=f[5]&&f[5].params.length<=2&&!y(f[5].params);for(let e=0;e<f.length;++e)f[e].test=function(e){let t,r,n;if(y(e)){let r=(t=N(e).map(v)).length,n=v(O(e)),i=function(e){for(let t=r;t<e.length;t++)if(!n(e[t]))return!1;return!0};return function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return i(e)&&e.length>=r+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=v(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=v(e[0]),n=v(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(v),function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}(f[e].params);let C=d?v(f[0].params[0]):rO,M=D?v(f[1].params[0]):rO,P=w?v(f[2].params[0]):rO,j=A?v(f[3].params[0]):rO,Y=F?v(f[4].params[0]):rO,U=b?v(f[5].params[0]):rO,z=d?v(f[0].params[1]):rO,V=D?v(f[1].params[1]):rO,L=w?v(f[2].params[1]):rO,q=A?v(f[3].params[1]):rO,H=F?v(f[4].params[1]):rO,W=b?v(f[5].params[1]):rO;for(let e=0;e<f.length;++e)f[e].implementation=function(e,t){let r=t,n="";if(e.some(e=>e.hasConversion)){let i=y(e),o=e.map(S);n=o.map(e=>e.name).join(";"),r=function(){let e=[],r=i?arguments.length-1:arguments.length;for(let t=0;t<r;t++)e[t]=o[t](arguments[t]);return i&&(e[r]=arguments[r].map(o[r])),t.apply(this,e)}}let i=r;if(y(e)){let t=e.length-1;i=function(){return r.apply(this,B(arguments,0,t).concat([B(arguments,t)]))}}return n&&Object.defineProperty(i,"name",{value:n}),i}(f[e].params,f[e].fn);let G=d?f[0].implementation:rB,Z=D?f[1].implementation:rB,$=w?f[2].implementation:rB,J=A?f[3].implementation:rB,Q=F?f[4].implementation:rB,X=b?f[5].implementation:rB,K=d?f[0].params.length:-1,ee=D?f[1].params.length:-1,et=w?f[2].params.length:-1,er=A?f[3].params.length:-1,en=F?f[4].params.length:-1,ei=b?f[5].params.length:-1,eo=6*!!(d&&D&&w&&A&&F&&b),eu=f.length,ea=f.map(e=>e.test),es=f.map(e=>e.implementation),ec=function(){for(let e=eo;e<eu;e++)if(ea[e](arguments))return es[e].apply(this,arguments);return a.onMismatch(e,arguments,f)};function el(e,t){return arguments.length===K&&C(e)&&z(t)?G.apply(this,arguments):arguments.length===ee&&M(e)&&V(t)?Z.apply(this,arguments):arguments.length===et&&P(e)&&L(t)?$.apply(this,arguments):arguments.length===er&&j(e)&&q(t)?J.apply(this,arguments):arguments.length===en&&Y(e)&&H(t)?Q.apply(this,arguments):arguments.length===ei&&U(e)&&W(t)?X.apply(this,arguments):ec.apply(this,arguments)}try{Object.defineProperty(el,"name",{value:e})}catch(e){}return el.signatures=s,el._typedFunctionData={signatures:f,signatureMap:h},el}(i||"",o)}).create=e,a.createCount=j.createCount,a.onMismatch=M,a.throwMismatchError=M,a.createError=F,a.clear=l,a.clearConversions=function(){let e;for(e of r)t.get(e).conversionsTo=[];u=0},a.addTypes=c,a._findType=s,a.referTo=function(){let e=N(arguments).map(e=>p(g(e))),t=O(arguments);if("function"!=typeof t)throw TypeError("Callback function expected as last argument");return T(e,t)},a.referToSelf=k,a.convert=function(e,t){let r=s(t);if(r.test(e))return e;let n=r.conversionsTo;if(0===n.length)throw Error("There are no conversions to "+t+" defined.");for(let t=0;t<n.length;t++)if(s(n[t].from).test(e))return n[t].convert(e);throw Error("Cannot convert "+e+" to "+t)},a.findSignature=d,a.find=function(e,t,r){return d(e,t,r).implementation},a.isTypedFunction=h,a.warnAgainstDeprecatedThis=!0,a.addType=function(e,r){let n="any";!1!==r&&t.has("Object")&&(n="Object"),a.addTypes([e],n)},a.addConversion=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};Y(e);let r=s(e.to),n=r.conversionsTo.find(t=>t.from===e.from);if(n)if(t&&t.override)a.removeConversion({from:n.from,to:e.to,convert:n.convert});else throw Error('There is already a conversion from "'+e.from+'" to "'+r.name+'"');r.conversionsTo.push({from:e.from,to:r.name,convert:e.convert,index:u++})},a.addConversions=function(e,t){e.forEach(e=>a.addConversion(e,t))},a.removeConversion=function(e){Y(e);let t=s(e.to),r=function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return e[r]}(t.conversionsTo,t=>t.from===e.from);if(!r)throw Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(r.convert!==e.convert)throw Error("Conversion to remove does not match existing conversion");let n=t.conversionsTo.indexOf(r);t.conversionsTo.splice(n,1)},a.resolve=function(e,t){if(!h(e))throw TypeError(rT);let r=e._typedFunctionData.signatures;for(let e=0;e<r.length;++e)if(r[e].test(t))return r[e];return null},a}();function rI(e,t){return!!e&&"object"==typeof e&&(!!tH(rP,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function rR(e){return"object"==typeof e&&e&&e.constructor===Object}var rP={length:!0,name:!0},rj={toString:!0,valueOf:!0,toLocaleString:!0};class rY{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){var t,r,n=this.wrappedObject;if(rR(n)&&rI(n,e))return n[e];if("function"==typeof n[e]&&(t=n,r=e,!(null==t||"function"!=typeof t[r]||tH(t,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(t))&&(tH(rj,r)||!(r in Object.prototype)&&!(r in Function.prototype))))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}set(e,t){return!function(e,t,r){if(rR(e)&&rI(e,t))return e[t]=r;throw Error('No access to property "'+t+'"')}(this.wrappedObject,e,t),this}has(e){return e in this.wrappedObject}entries(){var e,t;return e=this.keys(),t=e=>[e,this.get(e)],{next:()=>{var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}function rU(e){return!!e&&(e instanceof Map||e instanceof rY||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var rz=function(){return rz=rk.create,rk},rV=tW("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,o=rz();return o.clear(),o.addTypes([{name:"number",test:tn},{name:"Complex",test:to},{name:"BigNumber",test:ti},{name:"Fraction",test:tu},{name:"Unit",test:ta},{name:"identifier",test:e=>ts&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(e)},{name:"string",test:ts},{name:"Chain",test:tz},{name:"Array",test:tc},{name:"Matrix",test:tl},{name:"DenseMatrix",test:th},{name:"SparseMatrix",test:td},{name:"Range",test:tp},{name:"Index",test:tm},{name:"boolean",test:tD},{name:"ResultSet",test:tg},{name:"Help",test:ty},{name:"function",test:tv},{name:"Date",test:tw},{name:"RegExp",test:tE},{name:"null",test:tA},{name:"undefined",test:tF},{name:"AccessorNode",test:tb},{name:"ArrayNode",test:tC},{name:"AssignmentNode",test:tx},{name:"BlockNode",test:tS},{name:"ConditionalNode",test:tM},{name:"ConstantNode",test:tN},{name:"FunctionNode",test:tB},{name:"FunctionAssignmentNode",test:tO},{name:"IndexNode",test:tT},{name:"Node",test:tk},{name:"ObjectNode",test:tI},{name:"OperatorNode",test:tR},{name:"ParenthesisNode",test:tP},{name:"RangeNode",test:tj},{name:"RelationalNode",test:tY},{name:"SymbolNode",test:tU},{name:"Map",test:rU},{name:"Object",test:t_}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(t||rL(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return r||rq(e),new r(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return r||rq(e),new r(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return r||rq(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||rH(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||rL(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||rH(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||rq(e);try{return new r(e)}catch(t){throw Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||rL(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||rH(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),o.onMismatch=(e,t,r)=>{var n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&tf(t[0])&&r.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},o.onMismatch=(e,t,r)=>{var n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&tf(t[0])&&r.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},o});function rL(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function rq(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function rH(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}function rW(e,t,r){return e&&"function"==typeof e.map?e.map(function(e){return rW(e,t,r)}):t(e)}var rG="number",rZ="number, number";function r$(e){return Math.abs(e)}function rJ(e,t){return e+t}function rQ(e,t){return e-t}function rX(e,t){return e*t}function rK(e){return-e}r$.signature=rG,rJ.signature=rZ,rQ.signature=rZ,rX.signature=rZ,rK.signature=rG;var r0=tW("abs",["typed"],e=>{var{typed:t}=e;return t("abs",{number:r$,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),"Array | Matrix":t.referToSelf(e=>t=>rW(t,e,!0))})}),r1="addScalar",r2=tW(r1,["typed"],e=>{var{typed:t}=e;return t(r1,{"number, number":rJ,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(null===r.value||void 0===r.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),r8=tW("bignumber",["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var n=t[2],i=r(t[1]),o=new r(2).pow(Number(n));if(i.gt(o.sub(1)))throw SyntaxError('String "'.concat(e,'" is out of range'));var u=new r(2).pow(Number(n)-1);return i.gte(u)?i.sub(o):i}return new r(e)},BigNumber:function(e){return e},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),Fraction:function(e){return new r(e.n).div(e.d).times(e.s)},null:function(e){return new r(0)},"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))})}),r3="conj",r5=tW(r3,["typed"],e=>{var{typed:t}=e;return t(r3,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))})}),r4=tW("compareUnits",["typed"],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(!r.equalBase(n))throw Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)})}}),r6="equalScalar",r7=tW(r6,["typed","config"],e=>{var{typed:t,config:r}=e,n=r4({typed:t});return t(r6,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return rr(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||function(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){var n;return n=r.epsilon,rr(e.re,t.re,n)&&rr(e.im,t.im,n)}},n)});tW(r6,["typed","config"],e=>{var{typed:t,config:r}=e;return t(r6,{"number, number":function(e,t){return rr(e,t,r.epsilon)}})});function r9(e){return 0===e}r9.signature="number";var ne="isZero",nt=tW(ne,["typed"],e=>{var{typed:t}=e;return t(ne,{number:r9,BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:t.referToSelf(e=>r=>t.find(e,r.valueType())(r.value)),"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))})}),nr=tW("multiplyScalar",["typed"],e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":rX,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})}),nn=tW("number",["typed"],e=>{var{typed:t}=e,r=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var t=function(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(!t)return null;var r={"0b":2,"0o":8,"0x":16}[t[1]];return{input:e,radix:r,integerPart:t[2],fractionalPart:t[3]}}(e);if(t){for(var r=parseInt(t.integerPart,t.radix),n=0,i=0;i<t.fractionalPart.length;i++)n+=parseInt(t.fractionalPart[i],t.radix)/Math.pow(t.radix,i+1);var o=r+n;if(isNaN(o))throw SyntaxError('String "'+t.input+'" is not a valid number');return o}var u=0,a=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);a&&(u=Number(a[2]),e=a[1]);var s=Number(e);if(isNaN(s))throw SyntaxError('String "'+e+'" is not a valid number');if(a){if(s>2**u-1)throw SyntaxError('String "'.concat(e,'" is out of range'));s>=2**(u-1)&&(s-=2**u)}return s},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))});return r.fromJSON=function(e){return parseFloat(e.value)},r}),ni=tW("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(t&&!ts(t))throw Error("Invalid datatype: "+t);if(tl(e)){var r,n,u;r=this,n=e,u=t,"SparseMatrix"===n.type?(r._values=n._values?tL(n._values):void 0,r._index=tL(n._index),r._ptr=tL(n._ptr),r._size=tL(n._size),r._datatype=u||n._datatype):o(r,n.valueOf(),u||n._datatype)}else if(e&&tc(e.index)&&tc(e.ptr)&&tc(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(tc(e))o(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+tV(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function o(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var o=n.length,u=0,a=r,s=0;if(ts(i)&&(a=t.find(r,[i,i])||r,s=t.convert(0,i)),o>0){var c=0;do{e._ptr.push(e._index.length);for(var l=0;l<o;l++){var f=n[l];if(tc(f)){if(0===c&&u<f.length&&(u=f.length),c<f.length){var h=f[c];a(h,s)||(e._values.push(h),e._index.push(l))}}else 0===c&&u<1&&(u=1),a(f,s)||(e._values.push(f),e._index.push(l))}c++}while(c<u)}e._ptr.push(e._index.length),e._size=[o,u]}function u(e,t,r,n){if(r-t==0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t}function a(e,t,r,n,i,o,u){i.splice(e,0,n),o.splice(e,0,t);for(var a=r+1;a<u.length;a++)u[a]++}function s(e,n,i,o){var u,a,s,c=o||0,l=r,f=0;ts(e._datatype)&&(l=t.find(r,[e._datatype,e._datatype])||r,f=t.convert(0,e._datatype),c=t.convert(c,e._datatype));var h=!l(c,f),d=e._size[0],p=e._size[1];if(i>p){for(a=p;a<i;a++)if(e._ptr[a]=e._values.length,h)for(u=0;u<d;u++)e._values.push(c),e._index.push(u);e._ptr[i]=e._values.length}else i<p&&(e._ptr.splice(i+1,p-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(p=i,n>d){if(h){var m=0;for(a=0;a<p;a++){e._ptr[a]=e._ptr[a]+m,s=e._ptr[a+1]+m;var D=0;for(u=d;u<n;u++,D++)e._values.splice(s+D,0,c),e._index.splice(s+D,0,u),m++}e._ptr[p]=e._values.length}}else if(n<d){var g=0;for(a=0;a<p;a++){e._ptr[a]=e._ptr[a]-g;var y=e._ptr[a],v=e._ptr[a+1]-g;for(s=y;s<v;s++)(u=e._index[s])>n-1&&(e._values.splice(s,1),e._index.splice(s,1),g++)}e._ptr[a]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function c(e,t,r,n,i){var o,u,a=n[0],s=n[1],c=[];for(o=0;o<a;o++)for(c[o]=[],u=0;u<s;u++)c[o][u]=0;for(u=0;u<s;u++)for(var l=r[u],f=r[u+1],h=l;h<f;h++)c[o=t[h]][u]=e?i?tL(e[h]):e[h]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return rb(this._values,tV)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,r){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!tm(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r,n,o,u,a=t.size();if(a.length!==e._size.length)throw new rm(a.length,e._size.length);var s=t.min(),c=t.max();for(r=0,n=e._size.length;r<n;r++)rv(s[r],e._size[r]),rv(c[r],e._size[r]);var l=e._values,f=e._index,h=e._ptr,d=t.dimension(0),p=t.dimension(1),m=[],D=[];d.forEach(function(e,t){D[e]=t[0],m[e]=!0});var g=l?[]:void 0,y=[],v=[];return p.forEach(function(e){for(v.push(y.length),o=h[e],u=h[e+1];o<u;o++)!0===m[r=f[o]]&&(y.push(D[r]),g&&g.push(l[o]))}),v.push(y.length),new i({values:g,index:y,ptr:v,size:a,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var i,o=t.size(),u=t.isScalar();if(tl(r)?(i=r.size(),r=r.toArray()):i=rg(r),u){if(0!==i.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==o.length&&2!==o.length)throw new rm(o.length,e._size.length,"<");if(i.length<o.length){for(var a=0,s=0;1===o[a]&&1===i[a];)a++;for(;1===o[a];)s++,a++;r=rF(r,o.length,s,i)}if(!tq(o,i))throw new rm(o,i,">");if(1===o.length)t.dimension(0).forEach(function(t,i){rv(t),e.set([t,0],r[i[0]],n)});else{var c=t.dimension(0),l=t.dimension(1);c.forEach(function(t,i){rv(t),l.forEach(function(o,u){rv(o),e.set([t,o],r[i[0]][u[0]],n)})})}}return e}(this,e,t,r);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!tc(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rm(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var t=e[0],r=e[1];rv(t,this._size[0]),rv(r,this._size[1]);var n=u(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},i.prototype.set=function(e,n,i){if(!tc(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rm(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var o=e[0],c=e[1],l=this._size[0],f=this._size[1],h=r,d=0;ts(this._datatype)&&(h=t.find(r,[this._datatype,this._datatype])||r,d=t.convert(0,this._datatype)),(o>l-1||c>f-1)&&(s(this,Math.max(o+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),rv(o,l),rv(c,f);var p=u(o,this._ptr[c],this._ptr[c+1],this._index);return p<this._ptr[c+1]&&this._index[p]===o?h(n,d)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var o=t+1;o<i.length;o++)i[o]--}(p,c,this._values,this._index,this._ptr):this._values[p]=n:h(n,d)||a(p,o,c,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!tf(e))throw TypeError("Array or Matrix expected");var n=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(e){if(!tn(e)||!t8(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+rh(n)+")")}),s(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!tc(e))throw TypeError("Array expected");if(2!==e.length)throw Error("Sparse matrices can only be reshaped in two dimensions");e.forEach(function(t){if(!tn(t)||!t8(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+rh(e)+")")});var r=this._size[0]*this._size[1],n=(e=r_(e,r))[0]*e[1];if(r!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return i;for(var o=[],s=0;s<i._ptr.length;s++)for(var c=0;c<i._ptr[s+1]-i._ptr[s];c++)o.push(s);for(var l=i._values.slice(),f=i._index.slice(),h=0;h<i._index.length;h++){var d=f[h],p=o[h],m=d*i._size[1]+p;o[h]=m%e[1],f[h]=Math.floor(m/e[1])}i._values.length=0,i._index.length=0,i._ptr.length=e[1]+1,i._size=e.slice();for(var D=0;D<i._ptr.length;D++)i._ptr[D]=0;for(var g=0;g<l.length;g++){var y=f[g],v=o[g],w=l[g];a(u(y,i._ptr[v],i._ptr[v+1],i._index),y,v,w,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?tL(this._values):void 0,index:tL(this._index),ptr:tL(this._ptr),size:tL(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var o=this,u=this._size[0],a=this._size[1],s=rS(e);return function(e,n,o,u,a){var s=[],c=[],l=[],f=r,h=0;ts(e._datatype)&&(f=t.find(r,[e._datatype,e._datatype])||r,h=t.convert(0,e._datatype));for(var d=function(e,t,r){e=u(e,t,r),f(e,h)||(s.push(e),c.push(t))},p=0;p<=o;p++){l.push(s.length);var m=e._ptr[p],D=e._ptr[p+1];if(a)for(var g=m;g<D;g++){var y=e._index[g];y>=0&&y<=n&&d(e._values[g],y-0,p-0)}else{for(var v={},w=m;w<D;w++)v[e._index[w]]=e._values[w];for(var E=0;E<=n;E++)d(E in v?v[E]:0,E-0,p-0)}}return l.push(s.length),new i({values:s,index:c,ptr:l,size:[n-0+1,o-0+1]})}(this,u-1,a-1,function(t,r,n){return 1===s?e(t):2===s?e(t,[r,n]):e(t,[r,n],o)},n)},i.prototype.forEach=function(e,t){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var o=this._ptr[i],u=this._ptr[i+1];if(t)for(var a=o;a<u;a++){var s=this._index[a];e(this._values[a],[s,i],this)}else{for(var c={},l=o;l<u;l++)c[this._index[l]]=this._values[l];for(var f=0;f<r;f++)e(f in c?c[f]:0,[f,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],t=0;t<e;t++)for(var r=this._ptr[t],n=this._ptr[t+1],i=r;i<n;i++){var o=this._index[i];yield{value:this._values[i],index:[o,t]}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+rh(t,e)+" x "+rh(r,e)+"] density: "+rh(n,e)+"\n",o=0;o<r;o++)for(var u=this._ptr[o],a=this._ptr[o+1],s=u;s<a;s++)i+="\n ("+rh(this._index[s],e)+", "+rh(o,e)+") ==> "+(this._values?rh(this._values[s],e):"X");return i},i.prototype.toString=function(){return rh(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(ti(e)&&(e=e.toNumber()),!tn(e)||!t8(e))throw TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],o=this._size[1],u=Math.min(n-r,o-t),a=[],s=[],c=[];c[0]=0;for(var l=t;l<o&&a.length<u;l++)for(var f=this._ptr[l],h=this._ptr[l+1],d=f;d<h;d++){var p=this._index[d];if(p===l-t+r){a.push(this._values[d]),s[a.length-1]=p-r;break}}return c.push(a.length),new i({values:a,index:s,ptr:c,size:[u,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,o,u,a){if(!tc(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(ti(e)&&(e=e.toNumber()),!tn(e)||!t8(e)||e<1)throw Error("Size values must be positive integers");return e}),o){if(ti(o)&&(o=o.toNumber()),!tn(o)||!t8(o))throw TypeError("The parameter k must be an integer number")}else o=0;var s,c=r,l=0;ts(a)&&(c=t.find(r,[a,a])||r,l=t.convert(0,a));var f=o>0?o:0,h=o<0?-o:0,d=e[0],p=e[1],m=Math.min(d-h,p-f);if(tc(n)){if(n.length!==m)throw Error("Invalid value array length");s=function(e){return n[e]}}else if(tl(n)){var D=n.size();if(1!==D.length||D[0]!==m)throw Error("Invalid matrix length");s=function(e){return n.get([e])}}else s=function(){return n};for(var g=[],y=[],v=[],w=0;w<p;w++){v.push(g.length);var E=w-f;if(E>=0&&E<m){var _=s(E);c(_,l)||(y.push(E+h),g.push(_))}}return v.push(g.length),new i({values:g,index:y,ptr:v,size:[d,p]})},i.prototype.swapRows=function(e,t){if(!tn(e)||!t8(e)||!tn(t)||!t8(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return rv(e,this._size[0]),rv(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,r,n,i){for(var o=n[e],u=n[e+1],a=o;a<u;a++)i(r[a],t[a])},i._swapRows=function(e,t,r,n,i,o){for(var a=0;a<r;a++){var s=o[a],c=o[a+1],l=u(e,s,c,i),f=u(t,s,c,i);if(l<c&&f<c&&i[l]===e&&i[f]===t){if(n){var h=n[l];n[l]=n[f],n[f]=h}continue}if(l<c&&i[l]===e&&(f>=c||i[f]!==t)){var d=n?n[l]:void 0;i.splice(f,0,t),n&&n.splice(f,0,d),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1);continue}if(f<c&&i[f]===t&&(l>=c||i[l]!==e)){var p=n?n[f]:void 0;i.splice(l,0,e),n&&n.splice(l,0,p),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}}},i},{isClass:!0}),no="subtractScalar",nu=tW(no,["typed"],e=>{var{typed:t}=e;return t(no,{"number, number":rQ,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(null===r.value||void 0===r.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),na="unaryMinus",ns=tW(na,["typed"],e=>{var{typed:t}=e;return t(na,{number:rK,"Complex | BigNumber | Fraction":e=>e.neg(),Unit:t.referToSelf(e=>r=>{var n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n}),"Array | Matrix":t.referToSelf(e=>t=>rW(t,e,!0))})}),nc=tW("fraction",["typed","Fraction"],e=>{var{typed:t,Fraction:r}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),Object:function(e){return new r(e)},"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))})}),nl="matrix",nf=tW(nl,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(nl,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw TypeError("Unknown matrix type "+JSON.stringify(t)+".")}});function nh(){throw Error('No "bignumber" implementation available')}function nd(){throw Error('No "fraction" implementation available')}var np=tW("numeric",["number","?bignumber","?fraction"],e=>{var{number:t,bignumber:r,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:e=>t(e),BigNumber:r?e=>r(e):nh,Fraction:n?e=>n(e):nd};return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=arguments.length>2?arguments[2]:void 0;if(void 0!==r)throw SyntaxError("numeric() takes one or two arguments");var n=tV(e);if(!(n in i))throw TypeError("Cannot convert "+e+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in o))throw TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(o).join(", "));return t===n?e:o[t](e)}}),nm="size",nD=tW(nm,["typed","config","?matrix"],e=>{var{typed:t,config:r,matrix:n}=e;return t(nm,{Matrix:function(e){return e.create(e.size())},Array:rg,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([]):function(){throw Error('No "matrix" implementation available')}()}})}),ng="divideScalar",ny=tW(ng,["typed","numeric"],e=>{var{typed:t,numeric:r}=e;return t(ng,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})}),nv="identity",nw=tW(nv,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:o,SparseMatrix:u}=e;return t(nv,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return s(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return s(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return s(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return s(e,t,r)},Array:function(e){return a(e)},"Array, string":function(e,t){return a(e,t)},Matrix:function(e){return a(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return a(e.valueOf(),t)}});function a(e,t){switch(e.length){case 0:return t?n(t):[];case 1:return s(e[0],e[0],t);case 2:return s(e[0],e[1],t);default:throw Error("Vector containing two values expected")}}function s(e,t,r){var n=ti(e)||ti(t)?i:null;if(ti(e)&&(e=e.toNumber()),ti(t)&&(t=t.toNumber()),!t8(e)||e<1||!t8(t)||t<1)throw Error("Parameters in function identity must be positive integers");var a=n?new i(1):1,s=n?new n(0):0,c=[e,t];if(r){if("sparse"===r)return u.diagonal(c,a,0,s);if("dense"===r)return o.diagonal(c,a,0,s);throw TypeError('Unknown matrix type "'.concat(r,'"'))}for(var l=rw([],c,s),f=e<t?e:t,h=0;h<f;h++)l[h][h]=a;return l}}),nE=tW("dot",["typed","addScalar","multiplyScalar","conj","size"],e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:o}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,o){var s=u(e,o),c=tl(e)?e._data:e,l=tl(e)?e._datatype||e.getDataType():void 0,f=tl(o)?o._data:o,h=tl(o)?o._datatype||o.getDataType():void 0,d=2===a(e).length,p=2===a(o).length,m=r,D=n;if(l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(m=t.find(r,[l,l]),D=t.find(n,[l,l])),!d&&!p){for(var g=D(i(c[0]),f[0]),y=1;y<s;y++)g=m(g,D(i(c[y]),f[y]));return g}if(!d&&p){for(var v=D(i(c[0]),f[0][0]),w=1;w<s;w++)v=m(v,D(i(c[w]),f[w][0]));return v}if(d&&!p){for(var E=D(i(c[0][0]),f[0]),_=1;_<s;_++)E=m(E,D(i(c[_][0]),f[_]));return E}if(d&&p){for(var A=D(i(c[0][0]),f[0][0]),F=1;F<s;F++)A=m(A,D(i(c[F][0]),f[F][0]));return A}},"SparseMatrix, SparseMatrix":function(e,t){u(e,t);for(var i=e._index,o=e._values,a=t._index,s=t._values,c=0,l=0,f=0;l<i.length&&f<a.length;){var h=i[l],d=a[f];if(h<d){l++;continue}if(h>d){f++;continue}h===d&&(c=r(c,n(o[l],s[f])),l++,f++)}return c}});function u(e,t){var r,n,i=a(e),o=a(t);if(1===i.length)r=i[0];else if(2===i.length&&1===i[1])r=i[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");if(1===o.length)n=o[0];else if(2===o.length&&1===o[1])n=o[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+o.join(", ")+")");if(r!==n)throw RangeError("Vectors must have equal length ("+r+" != "+n+")");if(0===r)throw RangeError("Cannot calculate the dot product of empty vectors");return r}function a(e){return tl(e)?e.size():o(e)}}),n_=tW("matAlgo11xS0s",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i,o){var u,a=e._values,s=e._index,c=e._ptr,l=e._size,f=e._datatype;if(!a)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=l[0],d=l[1],p=r,m=0,D=i;"string"==typeof f&&(u=f,p=t.find(r,[u,u]),m=t.convert(0,u),n=t.convert(n,u),D=t.find(i,[u,u]));for(var g=[],y=[],v=[],w=0;w<d;w++){v[w]=y.length;for(var E=c[w],_=c[w+1],A=E;A<_;A++){var F=s[A],b=o?D(n,a[A]):D(a[A],n);p(b,m)||(y.push(F),g.push(b))}}return v[d]=y.length,e.createSparseMatrix({values:g,index:y,ptr:v,size:[h,d],datatype:u})}}),nA=tW("matAlgo14xDs",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var o,u=e._data,a=e._size,s=e._datatype,c=n;"string"==typeof s&&(o=s,r=t.convert(r,o),c=t.find(n,[o,o]));var l=a.length>0?function e(t,r,n,i,o,u,a){var s=[];if(r===n.length-1)for(var c=0;c<i;c++)s[c]=a?t(u,o[c]):t(o[c],u);else for(var l=0;l<i;l++)s[l]=e(t,r+1,n,n[r+1],o[l],u,a);return s}(c,0,a,a[0],u,r,i):[];return e.createDenseMatrix({data:l,size:tL(a),datatype:o})}}),nF="multiply",nb=tW(nF,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:o,dot:u}=e,a=n_({typed:t,equalScalar:o}),s=nA({typed:t});function c(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}var l=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,r){var o,u=e._data,a=e._size,s=e._datatype||e.getDataType(),c=r._data,l=r._datatype||r.getDataType(),f=a[0],h=a[1],d=n,p=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&(o=s,d=t.find(n,[o,o]),p=t.find(i,[o,o]));for(var m=[],D=0;D<f;D++){for(var g=u[D],y=p(g[0],c[0]),v=1;v<h;v++)y=d(y,p(g[v],c[v]));m[D]=y}return e.createDenseMatrix({data:m,size:[f],datatype:s===e._datatype&&l===r._datatype?o:void 0})},"SparseMatrix, any":function(e,r){var u,a=e._values,s=e._index,c=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=r._data,h=r._datatype||r.getDataType(),d=e._size[0],p=r._size[0],m=[],D=[],g=[],y=n,v=i,w=o,E=0;l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(u=l,y=t.find(n,[u,u]),v=t.find(i,[u,u]),w=t.find(o,[u,u]),E=t.convert(0,u));var _=[],A=[];g[0]=0;for(var F=0;F<p;F++){var b=f[F];if(!w(b,E))for(var C=c[F],x=c[F+1],S=C;S<x;S++){var M=s[S];A[M]?_[M]=y(_[M],v(b,a[S])):(A[M]=!0,D.push(M),_[M]=v(b,a[S]))}}for(var N=D.length,O=0;O<N;O++){var B=D[O];m[O]=_[B]}return g[1]=D.length,e.createSparseMatrix({values:m,index:D,ptr:g,size:[d,1],datatype:l===e._datatype&&h===r._datatype?u:void 0})}}),f=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,r){var o,u=e._data,a=e._size,s=e._datatype||e.getDataType(),c=r._data,l=r._size,f=r._datatype||r.getDataType(),h=a[0],d=a[1],p=l[1],m=n,D=i;s&&f&&s===f&&"string"==typeof s&&"mixed"!==s&&"mixed"!==s&&(o=s,m=t.find(n,[o,o]),D=t.find(i,[o,o]));for(var g=[],y=0;y<h;y++){var v=u[y];g[y]=[];for(var w=0;w<p;w++){for(var E=D(v[0],c[0][w]),_=1;_<d;_++)E=m(E,D(v[_],c[_][w]));g[y][w]=E}}return e.createDenseMatrix({data:g,size:[h,p],datatype:s===e._datatype&&f===r._datatype?o:void 0})},"DenseMatrix, SparseMatrix":function(e,r){var u,a=e._data,s=e._size,c=e._datatype||e.getDataType(),l=r._values,f=r._index,h=r._ptr,d=r._size,p=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(!l)throw Error("Cannot multiply Dense Matrix times Pattern only Matrix");var m=s[0],D=d[1],g=n,y=i,v=o,w=0;c&&p&&c===p&&"string"==typeof c&&"mixed"!==c&&(u=c,g=t.find(n,[u,u]),y=t.find(i,[u,u]),v=t.find(o,[u,u]),w=t.convert(0,u));for(var E=[],_=[],A=[],F=r.createSparseMatrix({values:E,index:_,ptr:A,size:[m,D],datatype:c===e._datatype&&p===r._datatype?u:void 0}),b=0;b<D;b++){A[b]=_.length;var C=h[b],x=h[b+1];if(x>C)for(var S=0,M=0;M<m;M++){for(var N=M+1,O=void 0,B=C;B<x;B++){var T=f[B];S!==N?(O=y(a[M][T],l[B]),S=N):O=g(O,y(a[M][T],l[B]))}S!==N||v(O,w)||(_.push(M),E.push(O))}}return A[D]=_.length,F},"SparseMatrix, DenseMatrix":function(e,r){var u,a=e._values,s=e._index,c=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=r._data,h=r._datatype||r.getDataType(),d=e._size[0],p=r._size[0],m=r._size[1],D=n,g=i,y=o,v=0;l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(u=l,D=t.find(n,[u,u]),g=t.find(i,[u,u]),y=t.find(o,[u,u]),v=t.convert(0,u));for(var w=[],E=[],_=[],A=e.createSparseMatrix({values:w,index:E,ptr:_,size:[d,m],datatype:l===e._datatype&&h===r._datatype?u:void 0}),F=[],b=[],C=0;C<m;C++){_[C]=E.length;for(var x=C+1,S=0;S<p;S++){var M=f[S][C];if(!y(M,v))for(var N=c[S],O=c[S+1],B=N;B<O;B++){var T=s[B];b[T]!==x?(b[T]=x,E.push(T),F[T]=g(M,a[B])):F[T]=D(F[T],g(M,a[B]))}}for(var k=_[C],I=E.length,R=k;R<I;R++){var P=E[R];w[R]=F[P]}}return _[m]=E.length,A},"SparseMatrix, SparseMatrix":function(e,r){var o,u,a,s,c,l,f,h,d,p=e._values,m=e._index,D=e._ptr,g=e._datatype||void 0===e._data?e._datatype:e.getDataType(),y=r._values,v=r._index,w=r._ptr,E=r._datatype||void 0===r._data?r._datatype:r.getDataType(),_=e._size[0],A=r._size[1],F=p&&y,b=n,C=i;g&&E&&g===E&&"string"==typeof g&&"mixed"!==g&&(o=g,b=t.find(n,[o,o]),C=t.find(i,[o,o]));for(var x=F?[]:void 0,S=[],M=[],N=e.createSparseMatrix({values:x,index:S,ptr:M,size:[_,A],datatype:g===e._datatype&&E===r._datatype?o:void 0}),O=F?[]:void 0,B=[],T=0;T<A;T++){M[T]=S.length;var k=T+1;for(l=w[T],f=w[T+1],c=l;c<f;c++)if(d=v[c],F)for(a=D[d],s=D[d+1],u=a;u<s;u++)B[h=m[u]]!==k?(B[h]=k,S.push(h),O[h]=C(y[c],p[u])):O[h]=b(O[h],C(y[c],p[u]));else for(a=D[d],s=D[d+1],u=a;u<s;u++)B[h=m[u]]!==k&&(B[h]=k,S.push(h));if(F)for(var I=M[T],R=S.length,P=I;P<R;P++){var j=S[P];x[P]=O[j]}}return M[A]=S.length,N}});return t(nF,i,{"Array, Array":t.referTo("Matrix, Matrix",e=>(t,n)=>{c(rg(t),rg(n));var i=e(r(t),r(n));return tl(i)?i.valueOf():i}),"Matrix, Matrix":function(e,r){var o=e.size(),a=r.size();if(c(o,a),1===o.length){if(1===a.length){if(0===o[0])throw Error("Cannot multiply two empty vectors");return u(e,r)}if("dense"!==r.storage())throw Error("Support for SparseMatrix not implemented");return function(e,r){var o,u=e._data,a=e._size,s=e._datatype||e.getDataType(),c=r._data,l=r._size,f=r._datatype||r.getDataType(),h=a[0],d=l[1],p=n,m=i;s&&f&&s===f&&"string"==typeof s&&"mixed"!==s&&(o=s,p=t.find(n,[o,o]),m=t.find(i,[o,o]));for(var D=[],g=0;g<d;g++){for(var y=m(u[0],c[0][g]),v=1;v<h;v++)y=p(y,m(u[v],c[v][g]));D[g]=y}return e.createDenseMatrix({data:D,size:[d],datatype:s===e._datatype&&f===r._datatype?o:void 0})}(e,r)}return 1===a.length?l(e,r):f(e,r)},"Matrix, Array":t.referTo("Matrix,Matrix",e=>(t,n)=>e(t,r(n))),"Array, Matrix":t.referToSelf(e=>(t,n)=>e(r(t,n.storage()),n)),"SparseMatrix, any":function(e,t){return a(e,t,i,!1)},"DenseMatrix, any":function(e,t){return s(e,t,i,!1)},"any, SparseMatrix":function(e,t){return a(t,e,i,!0)},"any, DenseMatrix":function(e,t){return s(t,e,i,!0)},"Array, any":function(e,t){return s(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return s(r(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(e=>(t,r,n)=>{for(var i=e(t,r),o=0;o<n.length;o++)i=e(i,n[o]);return i})})}),nC=tW("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],e=>{var{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:o,isZero:u,unaryMinus:a}=e;return t("det",{any:function(e){return tL(e)},"Array | Matrix":function(e){var t;switch((t=tl(e)?e.size():Array.isArray(e)?(e=r(e)).size():[]).length){case 0:return tL(e);case 1:if(1===t[0])return tL(e.valueOf()[0]);if(0===t[0])return 1;throw RangeError("Matrix must be square (size: "+rh(t)+")");case 2:var s=t[0],c=t[1];if(s===c)return function(e,t){if(1===t)return tL(e[0][0]);if(2===t)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var r=!1,s=Array(t).fill(0).map((e,t)=>t),c=0;c<t;c++){var l=s[c];if(u(e[l][c])){var f=void 0;for(f=c+1;f<t;f++)if(!u(e[s[f]][c])){l=s[f],s[f]=s[c],s[c]=l,r=!r;break}if(f===t)return e[l][c]}for(var h=e[l][c],d=0===c?1:e[s[c-1]][c-1],p=c+1;p<t;p++)for(var m=s[p],D=c+1;D<t;D++)e[m][D]=o(n(i(e[m][D],h),i(e[m][c],e[l][D])),d)}var g=e[s[t-1]][t-1];return r?a(g):g}(e.clone().valueOf(),s);if(0===c)return 1;throw RangeError("Matrix must be square (size: "+rh(t)+")");default:throw RangeError("Matrix must be two dimensional (size: "+rh(t)+")")}}})}),nx=tW("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],e=>{var{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:o,unaryMinus:u,det:a,identity:s,abs:c}=e;return t("inv",{"Array | Matrix":function(e){var t=tl(e)?e.size():rg(e);switch(t.length){case 1:if(1===t[0])if(tl(e))return r([n(1,e.valueOf()[0])]);else return[n(1,e[0])];throw RangeError("Matrix must be square (size: "+rh(t)+")");case 2:var i=t[0],o=t[1];if(i===o)if(tl(e))return r(l(e.valueOf(),i,o),e.storage());else return l(e,i,o);throw RangeError("Matrix must be square (size: "+rh(t)+")");default:throw RangeError("Matrix must be two dimensional (size: "+rh(t)+")")}},any:function(e){return n(1,e)}});function l(e,t,r){if(1===t){if(0===(d=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,d)]]}if(2===t){var l,f,h,d,p,m=a(e);if(0===m)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],m),n(u(e[0][1]),m)],[n(u(e[1][0]),m),n(e[0][0],m)]]}var D=e.concat();for(l=0;l<t;l++)D[l]=D[l].concat();for(var g=s(t).valueOf(),y=0;y<r;y++){var v=c(D[y][y]),w=y;for(l=y+1;l<t;)c(D[l][y])>v&&(v=c(D[l][y]),w=l),l++;if(0===v)throw Error("Cannot calculate inverse, determinant is zero");(l=w)!==y&&(p=D[y],D[y]=D[l],D[l]=p,p=g[y],g[y]=g[l],g[l]=p);var E=D[y],_=g[y];for(l=0;l<t;l++){var A=D[l],F=g[l];if(l!==y){if(0!==A[y]){for(h=n(u(A[y]),E[y]),f=y;f<r;f++)A[f]=i(A[f],o(h,E[f]));for(f=0;f<r;f++)F[f]=i(F[f],o(h,_[f]))}}else{for(h=E[y],f=y;f<r;f++)A[f]=n(A[f],h);for(f=0;f<r;f++)F[f]=n(F[f],h)}}}return g}}),nS=tZ({config:T}),nM=ro({}),nN=ra({}),nO=rs({}),nB=rM({Matrix:nO}),nT=rV({BigNumber:nS,Complex:nM,DenseMatrix:nB,Fraction:nN}),nk=r0({typed:nT}),nI=r2({typed:nT}),nR=r8({BigNumber:nS,typed:nT}),nP=r5({typed:nT}),nj=r7({config:T,typed:nT}),nY=nt({typed:nT}),nU=nr({typed:nT}),nz=nn({typed:nT}),nV=ni({Matrix:nO,equalScalar:nj,typed:nT}),nL=nu({typed:nT}),nq=ns({typed:nT}),nH=nc({Fraction:nN,typed:nT}),nW=nf({DenseMatrix:nB,Matrix:nO,SparseMatrix:nV,typed:nT}),nG=np({bignumber:nR,fraction:nH,number:nz}),nZ=nD({matrix:nW,config:T,typed:nT}),n$=ny({numeric:nG,typed:nT}),nJ=nw({BigNumber:nS,DenseMatrix:nB,SparseMatrix:nV,config:T,matrix:nW,typed:nT}),nQ=nE({addScalar:nI,conj:nP,multiplyScalar:nU,size:nZ,typed:nT}),nX=nb({addScalar:nI,dot:nQ,equalScalar:nj,matrix:nW,multiplyScalar:nU,typed:nT}),nK=nx({abs:nk,addScalar:nI,det:nC({divideScalar:n$,isZero:nY,matrix:nW,multiply:nX,subtractScalar:nL,typed:nT,unaryMinus:nq}),divideScalar:n$,identity:nJ,matrix:nW,multiply:nX,typed:nT,unaryMinus:nq});function n0(e,t){var r;let n=!1;Array.isArray(e[0])||(e=[e],n=!0);let i=t[t.length-1],o=i.ImageOrientationSlide,u=(r=i).PixelSpacing?r.PixelSpacing:r.SharedFunctionalGroupsSequence[0].PixelMeasuresSequence[0].PixelSpacing,a=i.TotalPixelMatrixOriginSequence[0],s=[Number(a.XOffsetInSlideCoordinateSystem),Number(a.YOffsetInSlideCoordinateSystem)];return(e=e.map(e=>{let t=function(e){if(!("offset"in e))throw Error('Option "offset" is required.');if(!Array.isArray(e.offset))throw Error('Option "offset" must be an array.');if(2!==e.offset.length)throw Error('Option "offset" must be an array with 2 elements.');let t=e.offset;if(!("orientation"in e))throw Error('Option "orientation" is required.');if(!Array.isArray(e.orientation))throw Error('Option "orientation" must be an array.');if(6!==e.orientation.length)throw Error('Option "orientation" must be an array with 6 elements.');let r=e.orientation;if(!("spacing"in e))throw Error('Option "spacing" is required.');if(!Array.isArray(e.spacing))throw Error('Option "spacing" must be an array.');if(2!==e.spacing.length)throw Error('Option "spacing" must be an array with 2 elements.');let n=e.spacing;if(!("point"in e))throw Error('Option "point" is required.');if(!Array.isArray(e.point))throw Error('Option "point" must be an array.');if(2!==e.point.length)throw Error('Option "point" must be an array with 2 elements.');let i=e.point,o=nX(nK([[r[0]*n[1],r[3]*n[0],t[0]],[r[1]*n[1],r[4]*n[0],t[1]],[0,0,1]]),[[i[0]],[i[1]],[1]]),u=Number(o[1][0].toFixed(4));return[Number(o[0][0].toFixed(4)),u]}({offset:s,orientation:o,spacing:u,point:[e[0],e[1]]});return[t[0],-(t[1]+1),0]}),n)?e[0]:e}let n1={color:"rgba(255,255,255,0.4)"},n2={color:"rgba(255,255,255,0.0)"},n8={color:"rgb(0,255,0)",width:1.5},n3={color:"rgb(255,255,0)",width:1.5},n5={image:{circle:{fill:n1,stroke:n3,radius:5}},fill:n1,stroke:n3},n4={image:{circle:{fill:n2,stroke:n8,radius:5}},fill:n2,stroke:n8},n6="dicommicroscopyviewer_roi_added",n7="dicommicroscopyviewer_roi_modified",n9="dicommicroscopyviewer_roi_removed",ie="dicommicroscopyviewer_roi_selected",it={ADDED:"added",MODIFIED:"modified",REMOVED:"removed",UPDATED:"updated",SELECTED:"selected"};class ir extends i.PubSubService{constructor(e,t,r,n,i){super(it),this.viewer=e,this.viewportId=t,this.container=r,this.studyInstanceUID=n,this.seriesInstanceUID=i,this.onRoiAdded=this.roiAddedHandler.bind(this),this.onRoiModified=this.roiModifiedHandler.bind(this),this.onRoiRemoved=this.roiRemovedHandler.bind(this),this.onRoiSelected=this.roiSelectedHandler.bind(this),this.contextMenuCallback=()=>{};const o=Object.getOwnPropertySymbols(this.viewer);this._drawingSource=o.find(e=>"drawingSource"===e.description),this._pyramid=o.find(e=>"pyramid"===e.description),this._map=o.find(e=>"map"===e.description),this._affine=o.find(e=>"affine"===e.description),this.registerEvents(),this.activateDefaultInteractions()}addContextMenuCallback(e){this.contextMenuCallback=e}destroy(){this.unregisterEvents()}publish(e,t){this._broadcastEvent(e,{roiGraphic:t,managedViewer:this})}registerEvents(){this.container.addEventListener(n6,this.onRoiAdded),this.container.addEventListener(n7,this.onRoiModified),this.container.addEventListener(n9,this.onRoiRemoved),this.container.addEventListener(ie,this.onRoiSelected)}unregisterEvents(){this.container.removeEventListener(n6,this.onRoiAdded),this.container.removeEventListener(n7,this.onRoiModified),this.container.removeEventListener(n9,this.onRoiRemoved),this.container.removeEventListener(ie,this.onRoiSelected)}roiAddedHandler(e){let t=e.detail.payload;this.publish(it.ADDED,t),this.publish(it.UPDATED,t)}roiModifiedHandler(e){let t=e.detail.payload;this.publish(it.MODIFIED,t),this.publish(it.UPDATED,t)}roiRemovedHandler(e){let t=e.detail.payload;this.publish(it.REMOVED,t),this.publish(it.UPDATED,t)}roiSelectedHandler(e){let t=e.detail.payload;this.publish(it.SELECTED,t)}runSilently(e){this.unregisterEvents(),e(),this.registerEvents()}clearRoiGraphics(){this.runSilently(()=>this.viewer.removeAllROIs())}showROIs(){this.viewer.showROIs()}hideROIs(){this.viewer.hideROIs()}addRoiGraphic(e){this.runSilently(()=>this.viewer.addROI(e,n4))}addRoiGraphicWithLabel(e,t){this.runSilently(()=>this.viewer.addROI(e,n4)),this._broadcastEvent(it.ADDED,{roiGraphic:e,managedViewer:this,label:t})}setROIStyle(e,t){this.viewer.setROIStyle(e,t)}removeRoiGraphic(e){this.viewer.removeROI(e)}updateROIProperties({uid:e,properties:t}){this.viewer.updateROI({uid:e,properties:t})}toggleOverviewMap(){this.viewer.toggleOverviewMap()}activateDefaultInteractions(){document.querySelector(".DicomMicroscopyViewer").addEventListener("contextmenu",e=>{e.preventDefault()},!1),this.activateInteractions([["dragPan",{bindings:{mouseButtons:["middle"]}}],["dragZoom",{bindings:{mouseButtons:["right"]}}],["modify",{}]])}activateInteractions(e){let t={draw:e=>e?"activateDrawInteraction":"deactivateDrawInteraction",modify:e=>e?"activateModifyInteraction":"deactivateModifyInteraction",translate:e=>e?"activateTranslateInteraction":"deactivateTranslateInteraction",snap:e=>e?"activateSnapInteraction":"deactivateSnapInteraction",dragPan:e=>e?"activateDragPanInteraction":"deactivateDragPanInteraction",dragZoom:e=>e?"activateDragZoomInteraction":"deactivateDragZoomInteraction",select:e=>e?"activateSelectInteraction":"deactivateSelectInteraction"};Object.keys(t).forEach(r=>{let n=e.find(e=>e[0]===r);if(n){let[e,r]=n,i=t[e](!0);this.viewer[i](r)}else{let e=t[r](!1);this.viewer[e]()}})}_getMapView(){return this._getMap().getView()}_getMap(){let e=Object.getOwnPropertySymbols(this.viewer).find(e=>"Symbol(map)"===String(e));return window.map=this.viewer[e],this.viewer[e]}getViewState(){let e=this._getMapView();return{center:e.getCenter(),resolution:e.getResolution(),zoom:e.getZoom()}}setViewState(e){let t=this._getMapView();t.setZoom(e.zoom),t.setResolution(e.resolution),t.setCenter(e.center)}setViewStateByExtent(e){let t=e.getCoordinates();Array.isArray(t[0])&&!t[2]?this._jumpToPolyline(t):Array.isArray(t[0])?this._jumpToPolygonOrEllipse(t):this._jumpToPoint(t)}_jumpToPoint(e){let t=n0(e,this.viewer[this._pyramid].metadata);this._getMapView().setCenter(t)}_jumpToPolyline(e){let t=n0(e,this.viewer[this._pyramid].metadata),r=this._getMapView(),n=t[0],i=t[1],o=(n[0]+i[0])/2,u=(n[1]+i[1])/2;r.setCenter([o,u])}_jumpToPolygonOrEllipse(e){let t=this.viewer[this._pyramid].metadata,r=1/0,n=-1/0,i=1/0,o=-1/0;e.forEach(e=>{let[u,a]=n0(e,t);u<r?r=u:u>n&&(n=u),a<i?i=a:a>o&&(o=a)});let u=n-r,a=o-i;r-=.5*u,n+=.5*u,i-=.5*a,o+=.5*a;let s=this._getMap();s.getView().fit([r,i,n,o],s.getSize())}}var ii=s(545),io=s.n(ii);let iu={LABEL_UPDATED:"labelUpdated",GRAPHIC_UPDATED:"graphicUpdated",VIEW_UPDATED:"viewUpdated",REMOVED:"removed"};class ia extends i.PubSubService{constructor(e,t,r,n="",i=null){super(iu),this.uid=e.uid,this.roiGraphic=e,this.studyInstanceUID=t,this.seriesInstanceUID=r,this.label=n,this.viewState=i,this.setMeasurements(e)}getScoord3d(){let e=this.roiGraphic,t=Object.getOwnPropertySymbols(e).find(e=>"Symbol(scoord3d)"===String(e));return e[t]}getCoordinates(){let e=this.getScoord3d(),t=Object.getOwnPropertySymbols(e).find(e=>"Symbol(coordinates)"===String(e));return e[t]}destroy(){this._broadcastEvent(iu.REMOVED,this)}setRoiGraphic(e){this.roiGraphic=e,this.setMeasurements(),this._broadcastEvent(iu.GRAPHIC_UPDATED,this)}setMeasurements(){let e=this.roiGraphic.scoord3d.graphicType,t=this.roiGraphic.scoord3d.graphicData;switch(e){case"ELLIPSE":let r=t[0],n=t[1],i=n[0]-r[0],o=n[1]-r[1];i*=i,o*=o;let u=Math.sqrt(i+o),a=u/2,s=Math.PI*a*a;this._area=s,this._length=void 0;break;case"POLYGON":let c=function(e){let t=e.length,r=0,n=t-1;for(let i=0;i<t;i++)r+=(e[n][0]+e[i][0])*(e[n][1]-e[i][1]),n=i;return Math.abs(r/2)}(t);this._area=c,this._length=void 0;break;case"POINT":this._area=void 0,this._length=void 0;break;case"POLYLINE":let l=0;for(let e=1;e<t.length;e++){let r=t[e-1],n=t[e],i=n[0]-r[0],o=n[1]-r[1];i*=i,o*=o,l+=Math.sqrt(i+o)}this._area=void 0,this._length=l}}setViewState(e){this.viewState=e,this._broadcastEvent(iu.VIEW_UPDATED,this)}setLabel(e,t){this.label=e||t&&t.CodeMeaning,this.finding=t||{CodingSchemeDesignator:"@ohif/extension-dicom-microscopy",CodeValue:e,CodeMeaning:e},this._broadcastEvent(iu.LABEL_UPDATED,this)}getLabel(){return this.label?`${this.label}`:""}getDetailedLabel(){let e=io()?.t("MeasurementTable:empty")||"(empty)";return this.label?`${this.label}`:e}getLength(){return this._length}getArea(){return this._area}}function is(e,t,r){var n;return(t="symbol"==typeof(n=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?n:n+"")in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ic={ANNOTATION_UPDATED:"annotationUpdated",ANNOTATION_SELECTED:"annotationSelected",ANNOTATION_REMOVED:"annotationRemoved",RELABEL:"relabel",DELETE:"delete"};class il extends i.PubSubService{constructor({servicesManager:e,extensionManager:t}){super(ic),is(this,"servicesManager",void 0),is(this,"managedViewers",new Set),is(this,"roiUids",new Set),is(this,"annotations",{}),is(this,"selectedAnnotation",null),is(this,"pendingFocus",!1),this.servicesManager=e,this.peerImport=t.appConfig.peerImport,this._onRoiAdded=this._onRoiAdded.bind(this),this._onRoiModified=this._onRoiModified.bind(this),this._onRoiRemoved=this._onRoiRemoved.bind(this),this._onRoiUpdated=this._onRoiUpdated.bind(this),this._onRoiSelected=this._onRoiSelected.bind(this),this.isROIsVisible=!0}clear(){for(let e in this.managedViewers.forEach(e=>e.destroy()),this.managedViewers.clear(),this.annotations)delete this.annotations[e];this.roiUids.clear(),this.selectedAnnotation=null,this.pendingFocus=!1}clearAnnotations(){Object.keys(this.annotations).forEach(e=>{this.removeAnnotation(this.annotations[e])})}importDicomMicroscopyViewer(){return this.peerImport("dicom-microscopy-viewer")}_onRoiAdded(e){let{roiGraphic:t,managedViewer:r,label:n}=e,{studyInstanceUID:i,seriesInstanceUID:o}=r,u=new ia(t,i,o,"",r.getViewState());this.roiUids.add(t.uid),this.annotations[t.uid]=u,u.subscribe(iu.LABEL_UPDATED,()=>{this._broadcastEvent(ic.ANNOTATION_UPDATED,u)}),void 0!==n?u.setLabel(n):this.triggerRelabel(u,!0,e=>r.updateROIProperties({uid:t.uid,properties:{label:e.label,finding:e.finding}}))}_onRoiModified(e){let{roiGraphic:t,managedViewer:r}=e,n=this.getAnnotation(t.uid);n&&(n.setRoiGraphic(t),n.setViewState(r.getViewState()))}_onRoiRemoved(e){let{roiGraphic:t}=e;this.roiUids.delete(t.uid),this.annotations[t.uid].destroy(),delete this.annotations[t.uid],this._broadcastEvent(ic.ANNOTATION_REMOVED,t)}_onRoiUpdated(e){let{roiGraphic:t,managedViewer:r}=e;this.synchronizeViewers(r),this._broadcastEvent(ic.ANNOTATION_UPDATED,this.getAnnotation(t.uid))}_onRoiSelected(e){let{roiGraphic:t}=e,r=this.getAnnotation(t.uid);r&&r!==this.getSelectedAnnotation()&&(this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=r,this._broadcastEvent(ic.ANNOTATION_SELECTED,r))}_addManagedViewerSubscriptions(e){e._roiAddedSubscription=e.subscribe(it.ADDED,this._onRoiAdded),e._roiModifiedSubscription=e.subscribe(it.MODIFIED,this._onRoiModified),e._roiRemovedSubscription=e.subscribe(it.REMOVED,this._onRoiRemoved),e._roiUpdatedSubscription=e.subscribe(it.UPDATED,this._onRoiUpdated),e._roiSelectedSubscription=e.subscribe(it.UPDATED,this._onRoiSelected)}_removeManagedViewerSubscriptions(e){e._roiAddedSubscription&&e._roiAddedSubscription.unsubscribe(),e._roiModifiedSubscription&&e._roiModifiedSubscription.unsubscribe(),e._roiRemovedSubscription&&e._roiRemovedSubscription.unsubscribe(),e._roiUpdatedSubscription&&e._roiUpdatedSubscription.unsubscribe(),e._roiSelectedSubscription&&e._roiSelectedSubscription.unsubscribe(),e._roiAddedSubscription=null,e._roiModifiedSubscription=null,e._roiRemovedSubscription=null,e._roiUpdatedSubscription=null,e._roiSelectedSubscription=null}_getManagedViewersForSeries(e,t){return Array.from(this.managedViewers).filter(r=>r.studyInstanceUID===e&&r.seriesInstanceUID===t)}getManagedViewersForStudy(e){return Array.from(this.managedViewers).filter(t=>t.studyInstanceUID===e)}getManagedViewersForViewport(e){return Array.from(this.managedViewers).filter(t=>t.viewportId===e)}_restoreAnnotations(e){let{studyInstanceUID:t,seriesInstanceUID:r}=e;this.getAnnotationsForSeries(t,r).forEach(t=>{e.addRoiGraphic(t.roiGraphic)})}addViewer(e,t,r,n,i){let o=Array.from(this.managedViewers).find(e=>e.viewportId===t);o&&this.removeViewer(o.viewer);let u=new ir(e,t,r,n,i);return this._restoreAnnotations(u),e._manager=u,this.managedViewers.add(u),this._addManagedViewerSubscriptions(u),this.pendingFocus&&(this.pendingFocus=!1,this.focusAnnotation(this.selectedAnnotation,t)),u}_potentiallyLoadSR(e,t){let r=i.DicomMetadataStore.getStudy(e),n=t.find(e=>"SM"===e.Modality),{FrameOfReferenceUID:o,othersFrameOfReferenceUID:u}=n;if(!r)return;let a=o?t.filter(e=>e.ReferencedFrameOfReferenceUID===o||u.includes(e.ReferencedFrameOfReferenceUID)):[];if(!a.length||(a=a.filter(e=>"SR"===e.Modality)).some(e=>!0===e.isLoaded))return;let s=0,c=a[0];a.forEach(e=>{let t=Number(`${e.SeriesDate}${e.SeriesTime}`);t>s&&(s=t,c=e)}),c.isLoading||(c.isLoading=!0,c.load(n))}removeViewer(e){let t=e._manager;this._removeManagedViewerSubscriptions(t),t.destroy(),this.managedViewers.delete(t)}toggleROIsVisibility(){this.isROIsVisible?this.hideROIs():this.showROIs,this.isROIsVisible=!this.isROIsVisible}hideROIs(){this.managedViewers.forEach(e=>e.hideROIs())}showROIs(){this.managedViewers.forEach(e=>e.showROIs())}getAnnotation(e){return this.annotations[e]}getAnnotations(){let e=[];return Object.keys(this.annotations).forEach(t=>{e.push(this.getAnnotation(t))}),e}getAnnotationsForStudy(e){return this.getAnnotations().filter(t=>t.studyInstanceUID===e)}getAnnotationsForSeries(e,t){return this.getAnnotations().filter(r=>r.studyInstanceUID===e&&r.seriesInstanceUID===t)}getSelectedAnnotation(){return this.selectedAnnotation}clearSelection(){this.selectedAnnotation&&this.setROIStyle(this.selectedAnnotation.uid,{stroke:{color:"#00ff00"}}),this.selectedAnnotation=null}selectAnnotation(e){this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=e,this._broadcastEvent(ic.ANNOTATION_SELECTED,e),this.setROIStyle(e.uid,n5)}toggleOverviewMap(e){let t=Array.from(this.managedViewers).find(t=>t.viewportId===e);t&&t.toggleOverviewMap()}removeAnnotation(e){let{uid:t,studyInstanceUID:r,seriesInstanceUID:n}=e;Array.from(this.managedViewers).filter(e=>e.studyInstanceUID===r&&e.seriesInstanceUID===n).forEach(e=>e.removeRoiGraphic(t)),this.annotations[t]&&(this.roiUids.delete(t),this.annotations[t].destroy(),delete this.annotations[t],this._broadcastEvent(ic.ANNOTATION_REMOVED,e))}focusAnnotation(e,t){let r=Array.from(this.managedViewers).find(e=>e.viewportId===t);r?r.setViewStateByExtent(e):this.pendingFocus=!0}synchronizeViewers(e){let{studyInstanceUID:t,seriesInstanceUID:r}=e,n=this._getManagedViewersForSeries(t,r);n.forEach(e=>this._removeManagedViewerSubscriptions(e)),n.forEach(n=>{if(n===e)return;let i=this.getAnnotationsForSeries(t,r);n.clearRoiGraphics(),i.forEach(e=>{n.addRoiGraphic(e.roiGraphic)})}),n.forEach(e=>this._addManagedViewerSubscriptions(e))}activateInteractions(e){this.managedViewers.forEach(t=>t.activateInteractions(e)),this.activeInteractions=e}getActiveInteractions(){return this.activeInteractions}triggerRelabel(e,t=!1,r){r||(r=({label:t})=>this.managedViewers.forEach(r=>r.updateROIProperties({uid:e.uid,properties:{label:t}}))),this._broadcastEvent(ic.RELABEL,{roiAnnotation:e,deleteCallback:()=>this.removeAnnotation(e),successCallback:r,newAnnotation:t})}triggerDelete(e){this._broadcastEvent(ic.DELETE,e)}setROIStyle(e,t){this.managedViewers.forEach(r=>r.setROIStyle(e,t))}getAllManagedViewers(){return Array.from(this.managedViewers)}}is(il,"REGISTRATION",e=>({name:"microscopyService",altName:"MicroscopyService",create:e=>new il(e)}));var ih=s(111),id=s.n(ih);let{downloadDicom:ip}=i.utils,{datasetToBuffer:im}=id().data,iD=(e,t)=>{let r=1;if("km"==t||!t&&e>1e6)t="km",r=1e-6;else if("m"==t||!t&&e>1e3)t="m",r=.001;else if("μm"==t||!t&&e<1)t="μm",r=1e3;else if(t&&"mm"!=t)throw Error(`Unknown length unit ${t}`);else t="mm";return`${(e*r).toFixed(2)} ${t}`},ig=(function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){function i(i){var o=i.forwardedRef,a=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(i,S),s=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.i18n,i=(0,t.useContext)(p)||{},o=i.i18n,a=i.defaultNS,s=n||o||k;if(s&&!s.reportNamespaces&&(s.reportNamespaces=new m),!s){E("You will need to pass in an i18next instance by using initReactI18next");var c=function(e,t){return"string"==typeof t?t:t&&"object"===u(t)&&"string"==typeof t.defaultValue?t.defaultValue:Array.isArray(e)?e[e.length-1]:e},l=[c,{},!1];return l.t=c,l.i18n={},l.ready=!1,l}s.options.react&&void 0!==s.options.react.wait&&E("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=C(C(C({},d),s.options.react),r),h=f.useSuspense,D=f.keyPrefix,y=e||a||s.options&&s.options.defaultNS;y="string"==typeof y?[y]:y||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(y);var v=(s.isInitialized||s.initializedStoreOnce)&&y.every(function(e){return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.languages&&t.languages.length?void 0===t.options.ignoreJSONStructure?function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.languages[0],i=!!t.options&&t.options.fallbackLng,o=t.languages[t.languages.length-1];if("cimode"===n.toLowerCase())return!0;var u=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return -1===n||2===n};return(!(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1)||!t.services.backendConnector.backend||!t.isLanguageChangingTo||!!u(t.isLanguageChangingTo,e))&&!!(t.hasResourceBundle(n,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||u(n,e)&&(!i||u(o,e)))}(e,t,r):t.hasLoadedNamespace(e,{lng:r.lng,precheck:function(t,n){if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!n(t.isLanguageChangingTo,e))return!1}}):(E("i18n.languages were undefined or empty",t.languages),!0)}(e,s,f)});function w(){return s.getFixedT(r.lng||null,"fallback"===f.nsMode?y:y[0],D)}var _=g((0,t.useState)(w),2),b=_[0],S=_[1],M=y.join();r.lng&&(M="".concat(r.lng).concat(M));var N=x(M),O=(0,t.useRef)(!0);(0,t.useEffect)(function(){var e=f.bindI18n,t=f.bindI18nStore;function n(){O.current&&S(w)}return O.current=!0,v||h||(r.lng?F(s,r.lng,y,function(){O.current&&S(w)}):A(s,y,function(){O.current&&S(w)})),v&&N&&N!==M&&O.current&&S(w),e&&s&&s.on(e,n),t&&s&&s.store.on(t,n),function(){O.current=!1,e&&s&&e.split(" ").forEach(function(e){return s.off(e,n)}),t&&s&&t.split(" ").forEach(function(e){return s.store.off(e,n)})}},[s,M]);var B=(0,t.useRef)(!0);(0,t.useEffect)(function(){O.current&&!B.current&&S(w),B.current=!1},[s,D]);var T=[b,s,v];if(T.t=b,T.i18n=s,T.ready=v,v||!v&&!h)return T;throw new Promise(function(e){r.lng?F(s,r.lng,y,function(){return e()}):A(s,y,function(){return e()})})}(e,N(N({},a),{},{keyPrefix:r.keyPrefix})),c=g(s,3),l=c[0],f=c[1],h=c[2],D=N(N({},a),{},{t:l,i18n:f,tReady:h});return r.withRef&&o?D.ref=o:!r.withRef&&o&&(D.forwardedRef=o),(0,t.createElement)(n,D)}return i.displayName="withI18nextTranslation(".concat(n.displayName||n.name||("string"==typeof n&&n.length>0?n:"Unknown"),")"),i.WrappedComponent=n,r.withRef?(0,t.forwardRef)(function(e,r){return(0,t.createElement)(i,Object.assign({},e,{forwardedRef:r}))}):i}})(["MicroscopyTable","Common"])(function(e){let{microscopyService:n}=e.servicesManager.services,[i,o]=(0,t.useState)(null),[u,a]=(0,t.useState)([]),[s,c]=(0,t.useState)(null),{servicesManager:l,extensionManager:f}=e,{uiDialogService:h,displaySetService:d}=l.services;(0,t.useEffect)(()=>{let t=e.viewports.get(e.activeViewportId);if(t?.displaySetInstanceUIDs[0]){let e=d.getDisplaySetByUID(t.displaySetInstanceUIDs[0]);e&&o(e.StudyInstanceUID)}},[e.viewports,e.activeViewportId]),(0,t.useEffect)(()=>{let e=()=>{a(n.getAnnotationsForStudy(i))},t=()=>{c(n.getSelectedAnnotation())},{unsubscribe:r}=n.subscribe(ic.ANNOTATION_UPDATED,e),{unsubscribe:o}=n.subscribe(ic.ANNOTATION_SELECTED,t),{unsubscribe:u}=n.subscribe(ic.ANNOTATION_REMOVED,()=>{e()});return e(),t(),()=>{r(),o(),u()}},[i]);let p=u.map((e,t)=>{let r=e.getDetailedLabel(),n=e.getArea(),i=e.getLength(),o=e.roiGraphic.properties.shortAxisLength,u=s===e,{uid:a}=e,c=[];if(void 0!==n){let e,t;c.push((e=1,t="mm",n>1e6?(t="m",e=1e-6):n<1&&(t="μm",e=1e6),`${(n*e).toFixed(2)} ${t}\xb2`))}else void 0!==i&&c.push(o?`${iD(i,"μm")} x ${iD(o,"μm")}`:`${iD(i,"μm")}`);return{uid:a,index:t,label:r,isActive:u,displayText:c,roiAnnotation:e}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"ohif-scrollbar overflow-y-auto overflow-x-hidden","data-cy":"measurements-panel"},t.createElement("div",{className:"flex flex-col"},p.map(i=>t.createElement(r.DataRow,{key:i.uid,number:i.index+1,title:i.label,isSelected:i.isActive,onSelect:()=>(({uid:t})=>{let r=n.getAnnotation(t);n.selectAnnotation(r),n.focusAnnotation(r,e.activeViewportId)})({uid:i.uid}),details:{primary:i.displayText,secondary:[]},isVisible:!0,onToggleVisibility:()=>{},isLocked:!1,onToggleLocked:()=>{},onRename:()=>(({uid:t})=>{e.commandsManager.runCommand("setLabel",{uid:t},"MICROSCOPY")})({uid:i.uid,isActive:i.isActive}),onDelete:()=>(({uid:e})=>{let t=n.getAnnotation(e);n.removeAnnotation(t)})({uid:i.uid,isActive:i.isActive}),onColor:()=>{},disableEditing:!1,description:i.displayText.join(", ")})))))}),iy="126010",iv="125007",iw="111030",iE="112039";function i_(e){return Array.isArray(e)?e:[e]}let iA=id().adapters.DICOMMicroscopyViewer.MeasurementReport;async function iF(e,t,r){let n=t.metadata,{StudyInstanceUID:i,FrameOfReferenceUID:o}=r,u=e.getManagedViewersForStudy(i);if(!u||!u.length)return;t.isLoaded=!0;let{rois:a,labels:s}=await ib(e,n,o),c=u[0];for(let e=0;e<a.length;e++){let t=a[e],r=Object.getOwnPropertySymbols(t).find(e=>"properties"===e.description);t[r].evaluations=[],c.addRoiGraphicWithLabel(t,s[e])}}async function ib(e,t,r){let n=iA.generateToolState(t),i=Object.getOwnPropertyNames(n),o=await e.importDicomMicroscopyViewer(),u=function(e){let{ContentSequence:t}=e;return i_(t.find(e=>e.ConceptNameCodeSequence.CodeValue===iy).ContentSequence).filter(e=>e.ConceptNameCodeSequence.CodeValue===iv)}(t),a=[],s=[];return i.forEach(e=>{let t,i=n[e],c=e.toUpperCase(),l=u.filter(e=>i_(e.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iw).GraphicType===c);i.forEach((n,i)=>{let u={},c={coordinates:n,frameOfReferenceUID:r};if("Polygon"===e)t=new o.scoord3d.Polygon(c);else if("Polyline"===e)t=new o.scoord3d.Polyline(c);else if("Point"===e)t=new o.scoord3d.Point(c);else if("Ellipse"===e)t=new o.scoord3d.Ellipse(c);else throw Error("Unsupported tool type");let f=l[i],h=i_(f.ContentSequence).find(e=>"121071"===e.ConceptNameCodeSequence.CodeValue),d=i_(f.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iE);if(d){let e=/\(([^)]+)\)/.exec(d.TextValue);e&&e[1]&&(u.presentationState=JSON.parse(e[1]),u.marker=u.presentationState.marker)}let p=i_(f.ContentSequence).filter(e=>["410668003","42798000","G-A186","G-A185","G-D7FE"].includes(e.ConceptNameCodeSequence.CodeValue)),m=i_(f.ContentSequence).filter(e=>[iE].includes(e.ConceptNameCodeSequence.CodeValue));m=m.map(e=>{let t={...e};return t.ConceptNameCodeSequence=i_(t.ConceptNameCodeSequence),t}),(p=p.map(e=>{let t={...e};return t.ConceptNameCodeSequence=i_(t.ConceptNameCodeSequence),t}))&&p.length&&(u.measurements=p,console.log("[SR] retrieving measurements...",p)),m&&m.length&&(u.evaluations=m,console.log("[SR] retrieving evaluations...",m));let D=new o.roi.ROI({scoord3d:t,properties:u});a.push(D),h?s.push(h.ConceptCodeSequence.CodeValue):s.push("")})}),{rois:a,labels:s}}function iC(e,t){let{ReferencedFrameOfReferenceUID:r,metadata:n}=t;if(n.ReferencedSeriesSequence){let{ReferencedSeriesSequence:t}=n,{SeriesInstanceUID:r}=t[0];return e.filter(e=>e.SeriesInstanceUID===r)[0]}let i=e.filter(e=>e.displaySetInstanceUID!==t.displaySetInstanceUID),o=i.find(e=>"SM"===e.Modality&&(e.FrameOfReferenceUID===r||e.othersFrameOfReferenceUID.includes(r)));return!o&&i.length>=1?(console.warn("No display set with FrameOfReferenceUID",r,"single series, assuming data error, defaulting to only series."),i.find(e=>"SM"===e.Modality)):o}let{utils:ix}=o();var iS=s(427);let{utils:iM}=o();var iN=s(803),iO=s.n(iN),iB=s(444),iT=s.n(iB),ik=s(51),iI=s.n(ik);function iR(){return(iR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}let iP=t.lazy(()=>Promise.resolve().then(s.bind(s,683))),ij=e=>t.createElement(t.Suspense,{fallback:t.createElement("div",null,"Loading...")},t.createElement(iP,e)),iY={id:e,async preRegistration({servicesManager:e}){e.registerService(il.REGISTRATION(e))},getViewportModule:({servicesManager:e})=>[{name:"microscopy-dicom",component:n=>{let{viewportOptions:i}=n,[o,u]=(0,r.useViewportGrid)(),{activeViewportId:a}=o,s=(0,t.useMemo)(()=>n.displaySets.map(e=>e.displaySetInstanceUID).join("-"),[n.displaySets]),{ref:c}=function({skipOnMount:e=!1,refreshMode:r,refreshRate:n=1e3,refreshOptions:i,handleWidth:o=!0,handleHeight:u=!0,targetRef:a,observerOptions:s,onResize:c}={}){let l=(0,t.useRef)(e),[f,h]=(0,t.useState)({width:void 0,height:void 0}),[d,p]=(0,t.useState)((null==a?void 0:a.current)||null);a&&setTimeout(()=>{a.current!==d&&p(a.current)},0);let m=(0,t.useMemo)(()=>new Proxy(e=>{e!==d&&p(e)},{get:(e,t)=>"current"===t?d:e[t],set:(e,t,r)=>("current"===t?p(r):e[t]=r,!0)}),[d]),D=(0,t.useCallback)((e,t)=>(e.width!==t.width||e.height!==t.height)&&(e.width!==t.width||!!u)&&(e.height!==t.height||!!o),[o,u]),g=(0,t.useCallback)(e=>{if(o||u){if(l.current){l.current=!1;return}e.forEach(e=>{let{width:t,height:r}=(null==e?void 0:e.contentRect)||{};h(e=>D(e,{width:t,height:r})?{width:t,height:r}:e)})}},[o,u,l,D]),y=(0,t.useCallback)(((e,t,r,n)=>{switch(t){case"debounce":return iO()(e,r,n);case"throttle":return iT()(e,r,n);default:return e}})(g,r,n,i),[g,r,n,i]);return(0,t.useEffect)(()=>{let e;return d?(e=new window.ResizeObserver(y)).observe(d,s):(f.width||f.height)&&h({width:void 0,height:void 0}),()=>{var t,r;null==(t=null==e?void 0:e.disconnect)||t.call(e),null==(r=y.cancel)||r.call(y)}},[y,d]),(0,t.useEffect)(()=>{null==c||c(f.width,f.height)},[f]),Object.assign({ref:m},f)}({onResize:iI()(()=>{let{microscopyService:t}=e.services,r=t.getAllManagedViewers();r&&r.length>0&&r[0].viewer.resize()},100),handleHeight:!0,handleWidth:!0}),l=(0,t.useCallback)(e=>{u.setActiveViewportId(e)},[u]);return t.createElement(ij,iR({key:s,activeViewportId:a,setViewportActive:l,viewportData:i,resizeRef:c},n))}}],getToolbarModule:({servicesManager:e})=>[{name:"evaluate.microscopyTool",evaluate:({button:t})=>{let{microscopyService:r}=e.services,n=r.getActiveInteractions();if(!n)return!1;let i=n.find(e=>!!e[1].bindings.mouseButtons.includes("left")&&("draw"!==e[0]?e[0]===t.id:e[1].geometryType===t.id));return{disabled:!1,className:i?"!text-black bg-highlight":"!text-foreground/80 hover:!bg-muted hover:!text-highlight",isActive:i}}}],getSopClassHandlerModule:e=>[function({servicesManager:e,extensionManager:t}){return{name:"DicomMicroscopySRSopClassHandler",sopClassUids:["1.2.840.10008.5.1.4.1.1.88.34"],getDisplaySetsFromSeries:t=>(function(e,t){if(!e||!e.length)throw Error("No instances were provided");let{displaySetService:r,microscopyService:n}=t.services,o=e[0],u=i.DicomMetadataStore.getSeries(o.StudyInstanceUID,o.SeriesInstanceUID).instances[0],a=function(e){let{ContentSequence:t}=e,r=i_(t.find(e=>e.ConceptNameCodeSequence.CodeValue===iy).ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iv);return i_(r.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iw).ReferencedFrameOfReferenceUID}(u),{FrameOfReferenceUID:s,SeriesDescription:c,ContentDate:l,ContentTime:f,SeriesNumber:h,StudyInstanceUID:d,SeriesInstanceUID:p,SOPInstanceUID:m,SOPClassUID:D}=o,g={isOverlayDisplaySet:!0,plugin:"microscopy",Modality:"SR",altImageText:"Microscopy SR",displaySetInstanceUID:ix.guid(),SOPInstanceUID:m,SeriesInstanceUID:p,StudyInstanceUID:d,ReferencedFrameOfReferenceUID:a,SOPClassHandlerId:"@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopySRSopClassHandler",SOPClassUID:D,SeriesDescription:c,SeriesDate:l,SeriesTime:f,SeriesNumber:h,instance:o,metadata:u,isDerived:!0,isLoading:!1,isLoaded:!1,loadError:!1};return g.load=function(e){return iF(n,g,e).catch(e=>{throw g.isLoaded=!1,g.loadError=!0,Error(e)})},g.getSourceDisplaySet=function(){let e=[];return i.DicomMetadataStore.getStudy(d).series.forEach(t=>{let n=r.getDisplaySetsForSeries(t.SeriesInstanceUID);e=e.concat(n)}),iC(e,g)},[g]})(t,e)}}(e),function({servicesManager:e,extensionManager:t}){return{name:"DicomMicroscopyANNSopClassHandler",sopClassUids:["1.2.840.10008.5.1.4.1.1.91.1"],getDisplaySetsFromSeries:r=>(function(e,t,r){if(!e||!e.length)throw Error("No instances were provided");let{displaySetService:n,microscopyService:o}=t.services,u=[...e].sort((e,t)=>{let r=`${e.ContentDate}${e.ContentTime}`,n=`${t.ContentDate}${t.ContentTime}`;return r.localeCompare(n)}),a=u[u.length-1],s=i.DicomMetadataStore.getSeries(a.StudyInstanceUID,a.SeriesInstanceUID).instances[0],{SeriesDescription:c,ContentDate:l,ContentTime:f,SeriesNumber:h,StudyInstanceUID:d,SeriesInstanceUID:p,SOPInstanceUID:m,SOPClassUID:D}=a,g={isOverlayDisplaySet:!0,plugin:"microscopy",Modality:"ANN",thumbnailSrc:null,altImageText:"Microscopy Annotation",displaySetInstanceUID:iM.uuidv4(),SOPInstanceUID:m,SeriesInstanceUID:p,StudyInstanceUID:d,SOPClassHandlerId:"@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopyANNSopClassHandler",SOPClassUID:D,SeriesDescription:c,SeriesDate:l,SeriesTime:f,SeriesNumber:h,instance:a,metadata:s,isDerived:!0,isLoading:!1,isLoaded:!1,loadError:!1};return g.load=function(){return(function({microscopyService:e,displaySet:t,extensionManager:r,servicesManager:n}){let{uiNotificationService:i}=n.services;return new Promise(async(o,u)=>{try{t.isLoading=!0;let{metadata:u}=t,a=await e.importDicomMicroscopyViewer(),s=(0,iS.A)({extensionManager:r,servicesManager:n}),c=n.services.viewportGridService.getActiveViewportId(),l=e.getManagedViewersForViewport(c)[0];s.retrieveSeriesMetadata({studyInstanceUID:u.StudyInstanceUID,seriesInstanceUID:u.SeriesInstanceUID}).then(async e=>{let r=e.map(e=>new a.metadata.MicroscopyBulkSimpleAnnotations({metadata:e}));i.show({message:"Loading annotations...",type:"info"}),await Promise.all(r.map(async e=>{try{await l.viewer.addAnnotationGroups(e),e.AnnotationGroupSequence.forEach(e=>{let t=e.AnnotationGroupUID;l.viewer.setAnnotationGroupStyle(t,{color:[255,234,0]})}),e.AnnotationGroupSequence.forEach(e=>{let t=e.AnnotationGroupUID;l.viewer.showAnnotationGroup(t)})}catch(e){console.error("failed to add annotation groups:",e),i.show({title:"Error loading annotations",message:e.message,type:"error"})}})),t.isLoaded=!0,t.isLoading=!1,o(t)})}catch(e){console.error("Error loading annotation:",e),u(e)}})})({microscopyService:o,displaySet:g,extensionManager:r,servicesManager:t}).catch(e=>{throw g.isLoaded=!1,g.loadError=!0,Error(e)})},g.getSourceDisplaySet=function(){let e=[];return i.DicomMetadataStore.getStudy(d).series.forEach(t=>{let r=n.getDisplaySetsForSeries(t.SeriesInstanceUID);e=e.concat(r)}),iC(e,g)},[g]})(r,e,t)}}(e)],getPanelModule:function({commandsManager:e,extensionManager:n,servicesManager:i}){return[{name:"measure",iconName:"tab-linear",iconLabel:"Measure",label:"Measurements",secondaryLabel:"Measurements",component:({})=>{let[{activeViewportId:o,viewports:u}]=(0,r.useViewportGrid)();return t.createElement(ig,{viewports:u,activeViewportId:o,onSaveComplete:()=>{},onRejectComplete:()=>{},commandsManager:e,servicesManager:i,extensionManager:n})}}]},getCommandsModule:function({servicesManager:e,commandsManager:t,extensionManager:r}){let{viewportGridService:i,uiDialogService:o,microscopyService:u}=e.services,a={deleteMeasurement:({uid:e})=>{if(e){let t=u.getAnnotation(e);t&&u.removeAnnotation(t)}},setLabel:async({uid:e})=>{let t=u.getAnnotation(e);if(!t)return;let r=await (0,n.callInputDialog)({uiDialogService:o,title:io().t("Tools:Edit Measurement Label"),placeholder:t.label||io().t("Tools:Enter new label"),defaultValue:t.label});null!=r&&(t.setLabel(r),u.triggerRelabel(t))},setToolActive:({toolName:e,toolGroupId:t="MICROSCOPY"})=>{let r=["dragPan",{bindings:{mouseButtons:["middle"]}}],n=["dragZoom",{bindings:{mouseButtons:["right"]}}];if(["line","box","circle","point","polygon","freehandpolygon","freehandline"].indexOf(e)>=0){let t={geometryType:e,vertexEnabled:!0,styleOptions:n4,bindings:{mouseButtons:["left"]}};"line"===e?(t.minPoints=2,t.maxPoints=2):"point"===e&&(delete t.styleOptions,delete t.vertexEnabled),u.activateInteractions([["draw",t],r,n])}else"dragPan"==e?u.activateInteractions([["dragPan",{bindings:{mouseButtons:["left","middle"]}}],n]):u.activateInteractions([[e,{bindings:{mouseButtons:["left"]}}],r,n])},toggleOverlays:()=>{let e=document.getElementsByClassName("microscopy-viewport-overlay");for(let t=0;t<e.length;t++)0===t&&e.item(0).classList.contains("hidden"),e.item(t).classList.toggle("hidden");let{activeViewportId:t}=i.getState();u.toggleOverviewMap(t)},toggleAnnotations:()=>{u.toggleROIsVisibility()}},s={deleteMeasurement:{commandFn:a.deleteMeasurement},setLabel:{commandFn:a.setLabel},setToolActive:{commandFn:a.setToolActive},toggleOverlays:{commandFn:a.toggleOverlays},toggleAnnotations:{commandFn:a.toggleAnnotations}};return{actions:a,definitions:s,defaultContext:"MICROSCOPY"}},getCustomizationModule:function(){return[]}}})(),c})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@cornerstonejs/core"),require("dcmjs"),require("@ohif/i18n"),require("@ohif/core"),require("@ohif/ui-next"),require("@ohif/extension-default")):"function"==typeof define&&define.amd?define(["@cornerstonejs/core","dcmjs","@ohif/i18n","@ohif/core","@ohif/ui-next","@ohif/extension-default"],t):"object"==typeof exports?exports["ohif-extension-dicom-microscopy"]=t(require("@cornerstonejs/core"),require("dcmjs"),require("@ohif/i18n"),require("@ohif/core"),require("@ohif/ui-next"),require("@ohif/extension-default")):e["ohif-extension-dicom-microscopy"]=t(e["@cornerstonejs/core"],e.dcmjs,e["@ohif/i18n"],e["@ohif/core"],e["@ohif/ui-next"],e["@ohif/extension-default"])}(globalThis,(e,t,r,n,i,o)=>(()=>{var u={683(e,t,r){"use strict";r.r(t),r.d(t,{default:()=>E});var n=r(326),i=r(438),o=r(530),u=r.n(o);let a=e=>{let{list:t,itemGenerator:r}=e;if(t)return t.map(t=>{if(!t)return;let n=t.generator||r;if(!n)throw Error(`No generator for ${t}`);return n({...e,item:t})})};var s=r(55),c=r(867),l=r.n(c);function f(e,t){if(null!==e)return parseFloat(e).toFixed(t)}function h(e,t="HH:mm:ss"){return l()(e,"HH:mm:ss").format(t)}r(557);var d=r(2);let{formatPN:p}=d.utils,m=e=>{let{item:t}=e,{title:r,value:i,condition:o,contents:u}=t;if(e.image={...e.image,...e.metadata},e.formatDate=s.formatDICOMDate,e.formatTime=h,e.formatPN=p,e.formatNumberPrecision=f,o&&!o(e)||!u&&!i)return null;let a=i&&i(e),c=u&&u(e)||[{className:"mr-1",value:r},{classname:"mr-1 font-light",value:a}];return n.createElement("div",{key:t.id,className:"flex flex-row"},c.map((e,t)=>n.createElement("span",{key:t,className:e.className},e.value)))},D=({config:e,overlayData:t,...r})=>{let{topLeft:i=[],topRight:o=[],bottomLeft:s=[],bottomRight:c=[]}=t??{},l="absolute pointer-events-none microscopy-viewport-overlay";return n.createElement(n.Fragment,null,i&&i.length>0&&n.createElement("div",{"data-cy":"viewport-overlay-top-left",className:u()(l,"top-viewport left-viewport text-highlight")},a({...r,list:i,itemGenerator:m})),o&&o.length>0&&n.createElement("div",{"data-cy":"viewport-overlay-top-right",className:u()(l,"top-viewport right-viewport-scrollbar text-highlight")},a({...r,list:o,itemGenerator:m})),c&&c.length>0&&n.createElement("div",{"data-cy":"viewport-overlay-bottom-right",className:u()(l,"bottom-viewport right-viewport-scrollbar text-highlight")},a({...r,list:c,itemGenerator:m})),s&&s.length>0&&n.createElement("div",{"data-cy":"viewport-overlay-bottom-left",className:u()(l,"bottom-viewport left-viewport text-highlight")},a({...r,list:s,itemGenerator:m})))};var g=r(427),y=r(111),v=r.n(y);let w=n.memo(({activeViewportId:e,setViewportActive:t,displaySets:r,viewportId:o,dataSource:u,resizeRef:a})=>{let{servicesManager:s,extensionManager:c}=(0,d.useSystem)(),[l,f]=(0,n.useState)(!1),[h,p]=(0,n.useState)(null),[m,y]=(0,n.useState)(null),w=(0,n.useRef)(),E=(0,n.useRef)(),{microscopyService:_,customizationService:A}=s.services,F=A.getCustomization("microscopyViewport.overlay"),b=(0,n.useCallback)(async(e,t)=>{let r=async r=>{let{viewer:n,metadata:a}=await _.importDicomMicroscopyViewer(),l=n.VolumeImageViewer,f=(0,g.A)({extensionManager:c,servicesManager:s}),h=[];r.forEach(e=>{e.ImageType="string"==typeof e.ImageType?e.ImageType.split("\\"):e.ImageType;let t=(0,i.cleanDenaturalizedDataset)(v().data.DicomMetaDictionary.denaturalizeDataset(e),{StudyInstanceUID:e.StudyInstanceUID,SeriesInstanceUID:e.SeriesInstanceUID,dataSourceConfig:u.getConfig()});t["00480105"]||(t["00480105"]={vr:"SQ",Value:[{"00480106":{vr:"SH",Value:["1"]}}]});let r=new a.VLWholeSlideMicroscopyImage({metadata:t}),n=r.ImageType[2];("VOLUME"===n||"THUMBNAIL"===n)&&h.push(r)});let d=new l({client:f,metadata:h,retrieveRendered:!1,controls:["overview","position"]});w&&w.current&&d.addViewportOverlay&&d.addViewportOverlay({element:w.current,coordinates:[0,0],navigate:!0,className:"OpenLayersOverlay"}),d.render({container:e});let{StudyInstanceUID:m,SeriesInstanceUID:D}=t,E=_.addViewer(d,o,e,m,D);E.addContextMenuCallback(e=>{}),p(d),y(E)};_.clearAnnotations();let n=t;if(t.isOverlayDisplaySet&&(n=t.getSourceDisplaySet()),console.log("Loading viewer metadata",n),await r(n.others),t.isOverlayDisplaySet&&!t.isLoaded&&!t.isLoading){let e=t.getSourceDisplaySet();t.load(e)}},[u,c,_,s,o]);(0,n.useEffect)(()=>{if(!h){let e=r[0];b(E.current,e).then(()=>{f(!0)})}return()=>{h&&_.removeViewer(h)}},[h]),(0,n.useEffect)(()=>{let e=r[0];if(_.clearAnnotations(),e.isOverlayDisplaySet&&!e.isLoaded&&!e.isLoading){let t=e.getSourceDisplaySet();e.load(t)}},[m,r,_]);let C={width:"100%",height:"100%"},x=r[0],S=x.firstInstance||x.instance,M=A.getCustomization("ui.loadingIndicatorProgress");return n.createElement("div",{className:"DicomMicroscopyViewer",style:C,onClick:()=>{o!==e&&t(o)}},n.createElement("div",{style:{...C,display:"none"}},n.createElement("div",{style:{...C},ref:w},n.createElement("div",{style:{position:"relative",height:"100%",width:"100%"}},x&&S.imageId&&n.createElement(D,{overlayData:F,displaySet:x,instance:x.instance,metadata:x.metadata})))),n.createElement("div",{style:C,"data-viewportid":o,ref:e=>{E.current=e,a.current=e}}),l?null:n.createElement(M,{className:"h-full w-full bg-black"}))},function(e,t){if(e.setViewportActive!==t.setViewportActive||e.resizeRef!==t.resizeRef||e.viewportId!==t.viewportId||e.activeViewportId!==t.activeViewportId||e.dataSource!==t.dataSource)return!1;let r=e.displaySets,n=t.displaySets;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n.find(e=>e.displaySetInstanceUID===t.displaySetInstanceUID);if(!i||i.images?.length!==t.images?.length)return!1;if(i.images?.length){for(let e=0;e<i.images.length;e++)if(i.images[e].imageId!==t.images[e].imageId)return!1}}return!0});w.displayName="DicomMicroscopyViewport";let E=w},427(e,t,r){"use strict";r.d(t,{A:()=>o});var n=r(2),i=r(438);function o({extensionManager:e,servicesManager:t}){let r=window.config.dataSources.find(t=>t.sourceName===e.activeDataSourceName),{userAuthenticationService:u}=t.services,{wadoRoot:a,staticWado:s,singlepart:c}=r.configuration,l={url:a||"/dicomlocal",staticWado:s,singlepart:c,headers:u.getAuthorizationHeader(),errorInterceptor:n.errorHandler.getHTTPErrorHandler()},f=new i.StaticWadoClient(l);return f.wadoURL=l.url,"dicomlocal"===e.activeDataSourceName&&(f.retrieveInstanceFrames=async e=>{if(!("studyInstanceUID"in e))throw Error("Study Instance UID is required for retrieval of instance frames");if(!("seriesInstanceUID"in e))throw Error("Series Instance UID is required for retrieval of instance frames");if(!("sopInstanceUID"in e))throw Error("SOP Instance UID is required for retrieval of instance frames");if(!("frameNumbers"in e))throw Error("frame numbers are required for retrieval of instance frames");console.log(`retrieve frames ${e.frameNumbers.toString()} of instance ${e.sopInstanceUID}`);let t=n.DicomMetadataStore.getInstance(e.studyInstanceUID,e.seriesInstanceUID,e.sopInstanceUID);return(Array.isArray(e.frameNumbers)?e.frameNumbers:e.frameNumbers.split(",")).map(e=>Array.isArray(t.PixelData)?t.PixelData[e-1]:t.PixelData)}),f}},42(e){!function(){"use strict";var t={s:1,n:0,d:1};function r(e,t){if(isNaN(e=parseInt(e,10)))throw c();return e*t}function n(e,t){if(0===t)throw s();var r=Object.create(a.prototype);r.s=e<0?-1:1;var n=u(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function i(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var o=function(e,n){var i,o=0,u=1,a=1,f=0,h=0,d=0,p=1,m=1,D=0,g=1,y=1,v=1;if(null==e);else if(void 0!==n){if(a=(o=e)*(u=n),o%1!=0||u%1!=0)throw l()}else switch(typeof e){case"object":if("d"in e&&"n"in e)o=e.n,u=e.d,"s"in e&&(o*=e.s);else if(0 in e)o=e[0],1 in e&&(u=e[1]);else throw c();a=o*u;break;case"number":if(e<0&&(a=e,e=-e),e%1==0)o=e;else if(e>0){for(e>=1&&(m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=m);g<=1e7&&v<=1e7;){if(e===(i=(D+y)/(g+v))){g+v<=1e7?(o=D+y,u=g+v):v>g?(o=y,u=v):(o=D,u=g);break}e>i?(D+=y,g+=v):(y+=D,v+=g),g>1e7?(o=y,u=v):(o=D,u=g)}o*=m}else(isNaN(e)||isNaN(n))&&(u=o=NaN);break;case"string":if(null===(g=e.match(/\d+|./g)))throw c();if("-"===g[D]?(a=-1,D++):"+"===g[D]&&D++,g.length===D+1?h=r(g[D++],a):"."===g[D+1]||"."===g[D]?("."!==g[D]&&(f=r(g[D++],a)),(++D+1===g.length||"("===g[D+1]&&")"===g[D+3]||"'"===g[D+1]&&"'"===g[D+3])&&(h=r(g[D],a),p=Math.pow(10,g[D].length),D++),("("===g[D]&&")"===g[D+2]||"'"===g[D]&&"'"===g[D+2])&&(d=r(g[D+1],a),m=Math.pow(10,g[D+1].length)-1,D+=3)):"/"===g[D+1]||":"===g[D+1]?(h=r(g[D],a),p=r(g[D+2],1),D+=3):"/"===g[D+3]&&" "===g[D+1]&&(f=r(g[D],a),h=r(g[D+2],a),p=r(g[D+4],1),D+=5),g.length<=D){a=o=d+(u=p*m)*f+m*h;break}default:throw c()}if(0===u)throw s();t.s=a<0?-1:1,t.n=Math.abs(o),t.d=Math.abs(u)};function u(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function a(e,r){if(o(e,r),!(this instanceof a))return n(t.s*t.n,t.d);e=u(t.d,t.n),this.s=t.s,this.n=t.n/e,this.d=t.d/e}var s=function(){return Error("Division by Zero")},c=function(){return Error("Invalid argument")},l=function(){return Error("Parameters must be integer")};a.prototype={s:1,n:0,d:1,abs:function(){return n(this.n,this.d)},neg:function(){return n(-this.s*this.n,this.d)},add:function(e,r){return o(e,r),n(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(e,r){return o(e,r),n(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(e,r){return o(e,r),n(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(e,r){return o(e,r),n(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return n(this.s*this.n,this.d)},mod:function(e,r){if(isNaN(this.n)||isNaN(this.d))return new a(NaN);if(void 0===e)return n(this.s*this.n%this.d,1);if(o(e,r),0===t.n&&0===this.d)throw s();return n(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(e,r){return o(e,r),n(u(t.n,this.n)*u(t.d,this.d),t.d*this.d)},lcm:function(e,r){return(o(e,r),0===t.n&&0===this.n)?n(0,1):n(t.n*this.n,u(t.n,this.n)*u(t.d,this.d))},ceil:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new a(NaN):n(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new a(NaN):n(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return(e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d))?new a(NaN):n(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return n(this.s*this.d,this.n)},pow:function(e,r){if(o(e,r),1===t.d)if(t.s<0)return n(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n));else return n(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var u=i(this.n),a=i(this.d),s=1,c=1;for(var l in u)if("1"!==l){if("0"===l){s=0;break}if(u[l]*=t.n,u[l]%t.d!=0)return null;u[l]/=t.d,s*=Math.pow(l,u[l])}for(var l in a)if("1"!==l){if(a[l]*=t.n,a[l]%t.d!=0)return null;a[l]/=t.d,c*=Math.pow(l,a[l])}return t.s<0?n(c,s):n(s,c)},equals:function(e,r){return o(e,r),this.s*this.n*t.d==t.s*t.n*this.d},compare:function(e,r){o(e,r);var n=this.s*this.n*t.d-t.s*t.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),r=t.toContinued(),i=1;i<r.length;i++){for(var o=n(r[i-1],1),u=i-2;u>=0;u--)o=o.inverse().add(r[u]);if(Math.abs(o.sub(t).valueOf())<e)return o.mul(this.s)}return this},divisible:function(e,r){return o(e,r),!(!(t.n*this.d)||this.n*t.d%(t.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do n.push(Math.floor(t/r)),e=t%r,t=r,r=e;while(1!==t);return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=function(e){for(;e%2==0;e/=2);for(;e%5==0;e/=5);if(1===e)return 0;for(var t=10%e,r=1;1!==t;r++)if(t=10*t%e,r>2e3)return 0;return r}(r),i=function(e,t){for(var r=1,n=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,t,e),i=0;i<300;i++){if(r===n)return i;r=10*r%e,n=10*n%e}return 0}(r,n),o=this.s<0?"-":"";if(o+=t/r|0,t%=r,(t*=10)&&(o+="."),n){for(var u=i;u--;)o+=t/r|0,t%=r,t*=10;o+="(";for(var u=n;u--;)o+=t/r|0,t%=r,t*=10;o+=")"}else for(var u=e;t&&u--;)o+=t/r|0,t%=r,t*=10;return o}},Object.defineProperty(a,"__esModule",{value:!0}),a.default=a,a.Fraction=a,e.exports=a}()},51(e,t,r){var n=0/0,i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt,c="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,l="object"==typeof self&&self&&self.Object===Object&&self,f=c||l||Function("return this")(),h=Object.prototype.toString,d=Math.max,p=Math.min,m=function(){return f.Date.now()};function D(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==h.call(t))return n;if(D(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=D(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var c=u.test(e);return c||a.test(e)?s(e.slice(2),c?2:8):o.test(e)?n:+e}e.exports=function(e,t,r){var n,i,o,u,a,s,c=0,l=!1,f=!1,h=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=n,o=i;return n=i=void 0,c=t,u=e.apply(o,r)}function v(e){var r=e-s,n=e-c;return void 0===s||r>=t||r<0||f&&n>=o}function w(){var e,r,n,i=m();if(v(i))return E(i);a=setTimeout(w,(e=i-s,r=i-c,n=t-e,f?p(n,o-r):n))}function E(e){return(a=void 0,h&&n)?y(e):(n=i=void 0,u)}function _(){var e,r=m(),o=v(r);if(n=arguments,i=this,s=r,o){if(void 0===a)return c=e=s,a=setTimeout(w,t),l?y(e):u;if(f)return a=setTimeout(w,t),y(s)}return void 0===a&&(a=setTimeout(w,t)),u}return t=g(t)||0,D(r)&&(l=!!r.leading,o=(f="maxWait"in r)?d(g(r.maxWait)||0,t):o,h="trailing"in r?!!r.trailing:h),_.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=s=i=a=void 0},_.flush=function(){return void 0===a?u:E(m())},_}},187(e,t,r){e.exports=r(183).Symbol},990(e,t,r){var n=r(187),i=r(29),o=r(704),u=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?i(e):o(e)}},66(e,t,r){var n=r(158),i=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},194(e,t,r){e.exports="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g},29(e,t,r){var n=r(187),i=Object.prototype,o=i.hasOwnProperty,u=i.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var i=u.call(e);return n&&(t?e[a]=r:delete e[a]),i}},704(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},183(e,t,r){var n=r(194),i="object"==typeof self&&self&&self.Object===Object&&self;e.exports=n||i||Function("return this")()},158(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},803(e,t,r){var n=r(15),i=r(642),o=r(572),u=Math.max,a=Math.min;e.exports=function(e,t,r){var s,c,l,f,h,d,p=0,m=!1,D=!1,g=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=s,n=c;return s=c=void 0,p=t,f=e.apply(n,r)}function v(e){var r=e-d,n=e-p;return void 0===d||r>=t||r<0||D&&n>=l}function w(){var e,r,n,o=i();if(v(o))return E(o);h=setTimeout(w,(e=o-d,r=o-p,n=t-e,D?a(n,l-r):n))}function E(e){return(h=void 0,g&&s)?y(e):(s=c=void 0,f)}function _(){var e,r=i(),n=v(r);if(s=arguments,c=this,d=r,n){if(void 0===h)return p=e=d,h=setTimeout(w,t),m?y(e):f;if(D)return clearTimeout(h),h=setTimeout(w,t),y(d)}return void 0===h&&(h=setTimeout(w,t)),f}return t=o(t)||0,n(r)&&(m=!!r.leading,l=(D="maxWait"in r)?u(o(r.maxWait)||0,t):l,g="trailing"in r?!!r.trailing:g),_.cancel=function(){void 0!==h&&clearTimeout(h),p=0,s=d=c=h=void 0},_.flush=function(){return void 0===h?f:E(i())},_}},15(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},184(e){e.exports=function(e){return null!=e&&"object"==typeof e}},536(e,t,r){var n=r(990),i=r(184);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},642(e,t,r){var n=r(183);e.exports=function(){return n.Date.now()}},444(e,t,r){var n=r(803),i=r(15);e.exports=function(e,t,r){var o=!0,u=!0;if("function"!=typeof e)throw TypeError("Expected a function");return i(r)&&(o="leading"in r?!!r.leading:o,u="trailing"in r?!!r.trailing:u),n(e,t,{leading:o,maxWait:t,trailing:u})}},572(e,t,r){var n=r(66),i=r(15),o=r(536),u=0/0,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return u;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=s.test(e);return r||c.test(e)?l(e.slice(2),r?2:8):a.test(e)?u:+e}},867(e,t,r){e=r.nmd(e),e.exports=function(){"use strict";function t(){return z.apply(null,arguments)}function n(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function i(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e){var t;if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(t in e)if(o(e,t))return!1;return!0}function a(e){return void 0===e}function s(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function c(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var r,n=[],i=e.length;for(r=0;r<i;++r)n.push(t(e[r],r));return n}function f(e,t){for(var r in t)o(t,r)&&(e[r]=t[r]);return o(t,"toString")&&(e.toString=t.toString),o(t,"valueOf")&&(e.valueOf=t.valueOf),e}function h(e,t,r,n){return to(e,t,r,n,!0).utc()}function d(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function p(e){var t=null,r=!1,n=e._d&&!isNaN(e._d.getTime());return(n&&(t=d(e),r=V.call(t.parsedDateParts,function(e){return null!=e}),n=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&r),e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)),null!=Object.isFrozen&&Object.isFrozen(e))?n:(e._isValid=n,e._isValid)}function m(e){var t=h(NaN);return null!=e?f(d(t),e):d(t).userInvalidated=!0,t}V=Array.prototype.some?Array.prototype.some:function(e){var t,r=Object(this),n=r.length>>>0;for(t=0;t<n;t++)if(t in r&&e.call(this,r[t],t,r))return!0;return!1};var D,g,y=t.momentProperties=[],v=!1;function w(e,t){var r,n,i,o=y.length;if(a(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),a(t._i)||(e._i=t._i),a(t._f)||(e._f=t._f),a(t._l)||(e._l=t._l),a(t._strict)||(e._strict=t._strict),a(t._tzm)||(e._tzm=t._tzm),a(t._isUTC)||(e._isUTC=t._isUTC),a(t._offset)||(e._offset=t._offset),a(t._pf)||(e._pf=d(t)),a(t._locale)||(e._locale=t._locale),o>0)for(r=0;r<o;r++)a(i=t[n=y[r]])||(e[n]=i);return e}function E(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===v&&(v=!0,t.updateOffset(this),v=!1)}function _(e){return e instanceof E||null!=e&&null!=e._isAMomentObject}function A(e){!1===t.suppressDeprecationWarnings&&"u">typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function F(e,r){var n=!0;return f(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),n){var i,u,a,s=[],c=arguments.length;for(u=0;u<c;u++){if(i="","object"==typeof arguments[u]){for(a in i+="\n["+u+"] ",arguments[0])o(arguments[0],a)&&(i+=a+": "+arguments[0][a]+", ");i=i.slice(0,-2)}else i=arguments[u];s.push(i)}A(e+"\nArguments: "+Array.prototype.slice.call(s).join("")+"\n"+Error().stack),n=!1}return r.apply(this,arguments)},r)}var b={};function C(e,r){null!=t.deprecationHandler&&t.deprecationHandler(e,r),b[e]||(A(r),b[e]=!0)}function x(e){return"u">typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function S(e,t){var r,n=f({},e);for(r in t)o(t,r)&&(i(e[r])&&i(t[r])?(n[r]={},f(n[r],e[r]),f(n[r],t[r])):null!=t[r]?n[r]=t[r]:delete n[r]);for(r in e)o(e,r)&&!o(t,r)&&i(e[r])&&(n[r]=f({},n[r]));return n}function M(e){null!=e&&this.set(e)}function N(e,t,r){var n=""+Math.abs(e);return(e>=0?r?"+":"":"-")+Math.pow(10,Math.max(0,t-n.length)).toString().substr(1)+n}t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var O=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,B=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,T={},k={};function I(e,t,r,n){var i=n;"string"==typeof n&&(i=function(){return this[n]()}),e&&(k[e]=i),t&&(k[t[0]]=function(){return N(i.apply(this,arguments),t[1],t[2])}),r&&(k[r]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function R(e,t){return e.isValid()?(T[t=P(t,e.localeData())]=T[t]||function(e){var t,r,n,i=e.match(O);for(r=0,n=i.length;r<n;r++)k[i[r]]?i[r]=k[i[r]]:i[r]=(t=i[r]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(t){var r,o="";for(r=0;r<n;r++)o+=x(i[r])?i[r].call(t,e):i[r];return o}}(t),T[t](e)):e.localeData().invalidDate()}function P(e,t){var r=5;function n(e){return t.longDateFormat(e)||e}for(B.lastIndex=0;r>=0&&B.test(e);)e=e.replace(B,n),B.lastIndex=0,r-=1;return e}var j={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Y(e){return"string"==typeof e?j[e]||j[e.toLowerCase()]:void 0}function U(e){var t,r,n={};for(r in e)o(e,r)&&(t=Y(r))&&(n[t]=e[r]);return n}var z,V,L,q={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1},H=Object.keys?Object.keys:function(e){var t,r=[];for(t in e)o(e,t)&&r.push(t);return r},W=/\d/,G=/\d\d/,Z=/\d{3}/,$=/\d{4}/,J=/[+-]?\d{6}/,Q=/\d\d?/,X=/\d\d\d\d?/,K=/\d\d\d\d\d\d?/,ee=/\d{1,3}/,et=/\d{1,4}/,er=/[+-]?\d{1,6}/,en=/\d+/,ei=/[+-]?\d+/,eo=/Z|[+-]\d\d:?\d\d/gi,eu=/Z|[+-]\d\d(?::?\d\d)?/gi,ea=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,es=/^[1-9]\d?/,ec=/^([1-9]\d|\d)/;function el(e,t,r){L[e]=x(t)?t:function(e,n){return e&&r?r:t}}function ef(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function eh(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function ed(e){var t=+e,r=0;return 0!==t&&isFinite(t)&&(r=eh(t)),r}L={};var ep={};function em(e,t){var r,n,i=t;for("string"==typeof e&&(e=[e]),s(t)&&(i=function(e,r){r[t]=ed(e)}),n=e.length,r=0;r<n;r++)ep[e[r]]=i}function eD(e,t){em(e,function(e,r,n,i){n._w=n._w||{},t(e,n._w,n,i)})}function eg(e){return e%4==0&&e%100!=0||e%400==0}function ey(e){return eg(e)?366:365}I("Y",0,0,function(){var e=this.year();return e<=9999?N(e,4):"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),el("Y",ei),el("YY",Q,G),el("YYYY",et,$),el("YYYYY",er,J),el("YYYYYY",er,J),em(["YYYYY","YYYYYY"],0),em("YYYY",function(e,r){r[0]=2===e.length?t.parseTwoDigitYear(e):ed(e)}),em("YY",function(e,r){r[0]=t.parseTwoDigitYear(e)}),em("Y",function(e,t){t[0]=parseInt(e,10)}),t.parseTwoDigitYear=function(e){return ed(e)+(ed(e)>68?1900:2e3)};var ev=ew("FullYear",!0);function ew(e,r){return function(n){return null!=n?(e_(this,e,n),t.updateOffset(this,r),this):eE(this,e)}}function eE(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function e_(e,t,r){var n,i,o,u;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,i=e._isUTC,t){case"Milliseconds":return void(i?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(i?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(i?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(i?n.setUTCHours(r):n.setHours(r));case"Date":return void(i?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=e.month(),u=29!==(u=e.date())||1!==o||eg(r)?u:28,i?n.setUTCFullYear(r,o,u):n.setFullYear(r,o,u)}}function eA(e,t){if(isNaN(e)||isNaN(t))return NaN;var r=(t%12+12)%12;return e+=(t-r)/12,1===r?eg(e)?29:28:31-r%7%2}eL=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return -1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),el("M",Q,es),el("MM",Q,G),el("MMM",function(e,t){return t.monthsShortRegex(e)}),el("MMMM",function(e,t){return t.monthsRegex(e)}),em(["M","MM"],function(e,t){t[1]=ed(e)-1}),em(["MMM","MMMM"],function(e,t,r,n){var i=r._locale.monthsParse(e,n,r._strict);null!=i?t[1]=i:d(r).invalidMonth=e});var eF="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),eb=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;function eC(e,t,r){var n,i,o,u=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],n=0;n<12;++n)o=h([2e3,n]),this._shortMonthsParse[n]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[n]=this.months(o,"").toLocaleLowerCase();if(r)if("MMM"===t)return -1!==(i=eL.call(this._shortMonthsParse,u))?i:null;else return -1!==(i=eL.call(this._longMonthsParse,u))?i:null;return"MMM"===t?-1!==(i=eL.call(this._shortMonthsParse,u))||-1!==(i=eL.call(this._longMonthsParse,u))?i:null:-1!==(i=eL.call(this._longMonthsParse,u))||-1!==(i=eL.call(this._shortMonthsParse,u))?i:null}function ex(e,t){if(!e.isValid())return e;if("string"==typeof t){if(/^\d+$/.test(t))t=ed(t);else if(!s(t=e.localeData().monthsParse(t)))return e}var r=t,n=e.date();return n=n<29?n:Math.min(n,eA(e.year(),r)),e._isUTC?e._d.setUTCMonth(r,n):e._d.setMonth(r,n),e}function eS(e){return null!=e?(ex(this,e),t.updateOffset(this,!0),this):eE(this,"Month")}function eM(){function e(e,t){return t.length-e.length}var t,r,n,i,o=[],u=[],a=[];for(t=0;t<12;t++)r=h([2e3,t]),n=ef(this.monthsShort(r,"")),i=ef(this.months(r,"")),o.push(n),u.push(i),a.push(i),a.push(n);o.sort(e),u.sort(e),a.sort(e),this._monthsRegex=RegExp("^("+a.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=RegExp("^("+u.join("|")+")","i"),this._monthsShortStrictRegex=RegExp("^("+o.join("|")+")","i")}function eN(e,t,r,n,i,o,u){var a;return e<100&&e>=0?isFinite((a=new Date(e+400,t,r,n,i,o,u)).getFullYear())&&a.setFullYear(e):a=new Date(e,t,r,n,i,o,u),a}function eO(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,isFinite((t=new Date(Date.UTC.apply(null,r))).getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function eB(e,t,r){var n=7+t-r;return-((7+eO(e,0,n).getUTCDay()-t)%7)+n-1}function eT(e,t,r,n,i){var o,u,a=1+7*(t-1)+(7+r-n)%7+eB(e,n,i);return a<=0?u=ey(o=e-1)+a:a>ey(e)?(o=e+1,u=a-ey(e)):(o=e,u=a),{year:o,dayOfYear:u}}function ek(e,t,r){var n,i,o=eB(e.year(),t,r),u=Math.floor((e.dayOfYear()-o-1)/7)+1;return u<1?n=u+eI(i=e.year()-1,t,r):u>eI(e.year(),t,r)?(n=u-eI(e.year(),t,r),i=e.year()+1):(i=e.year(),n=u),{week:n,year:i}}function eI(e,t,r){var n=eB(e,t,r),i=eB(e+1,t,r);return(ey(e)-n+i)/7}function eR(e,t){return e.slice(t,7).concat(e.slice(0,t))}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),el("w",Q,es),el("ww",Q,G),el("W",Q,es),el("WW",Q,G),eD(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=ed(e)}),I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),el("d",Q),el("e",Q),el("E",Q),el("dd",function(e,t){return t.weekdaysMinRegex(e)}),el("ddd",function(e,t){return t.weekdaysShortRegex(e)}),el("dddd",function(e,t){return t.weekdaysRegex(e)}),eD(["dd","ddd","dddd"],function(e,t,r,n){var i=r._locale.weekdaysParse(e,n,r._strict);null!=i?t.d=i:d(r).invalidWeekday=e}),eD(["d","e","E"],function(e,t,r,n){t[n]=ed(e)});var eP="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");function ej(e,t,r){var n,i,o,u=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=h([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();if(r)if("dddd"===t)return -1!==(i=eL.call(this._weekdaysParse,u))?i:null;else if("ddd"===t)return -1!==(i=eL.call(this._shortWeekdaysParse,u))?i:null;else return -1!==(i=eL.call(this._minWeekdaysParse,u))?i:null;return"dddd"===t?-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._shortWeekdaysParse,u))||-1!==(i=eL.call(this._minWeekdaysParse,u))?i:null:"ddd"===t?-1!==(i=eL.call(this._shortWeekdaysParse,u))||-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._minWeekdaysParse,u))?i:null:-1!==(i=eL.call(this._minWeekdaysParse,u))||-1!==(i=eL.call(this._weekdaysParse,u))||-1!==(i=eL.call(this._shortWeekdaysParse,u))?i:null}function eY(){function e(e,t){return t.length-e.length}var t,r,n,i,o,u=[],a=[],s=[],c=[];for(t=0;t<7;t++)r=h([2e3,1]).day(t),n=ef(this.weekdaysMin(r,"")),i=ef(this.weekdaysShort(r,"")),o=ef(this.weekdays(r,"")),u.push(n),a.push(i),s.push(o),c.push(n),c.push(i),c.push(o);u.sort(e),a.sort(e),s.sort(e),c.sort(e),this._weekdaysRegex=RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=RegExp("^("+u.join("|")+")","i")}function eU(){return this.hours()%12||12}function ez(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function eV(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,eU),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+eU.apply(this)+N(this.minutes(),2)}),I("hmmss",0,0,function(){return""+eU.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),ez("a",!0),ez("A",!1),el("a",eV),el("A",eV),el("H",Q,ec),el("h",Q,es),el("k",Q,es),el("HH",Q,G),el("hh",Q,G),el("kk",Q,G),el("hmm",X),el("hmmss",K),el("Hmm",X),el("Hmmss",K),em(["H","HH"],3),em(["k","kk"],function(e,t,r){var n=ed(e);t[3]=24===n?0:n}),em(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e}),em(["h","hh"],function(e,t,r){t[3]=ed(e),d(r).bigHour=!0}),em("hmm",function(e,t,r){var n=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n)),d(r).bigHour=!0}),em("hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n,2)),t[5]=ed(e.substr(i)),d(r).bigHour=!0}),em("Hmm",function(e,t,r){var n=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n))}),em("Hmmss",function(e,t,r){var n=e.length-4,i=e.length-2;t[3]=ed(e.substr(0,n)),t[4]=ed(e.substr(n,2)),t[5]=ed(e.substr(i))});var eL,eq,eH=ew("Hours",!0),eW={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:eF,week:{dow:0,doy:6},weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysShort:eP,meridiemParse:/[ap]\.?m?\.?/i},eG={},eZ={};function e$(e){return e?e.toLowerCase().replace("_","-"):e}function eJ(t){var n=null;if(void 0===eG[t]&&e&&e.exports&&t&&t.match("^[^/\\\\]*$"))try{n=eq._abbr,r(118)("./locale/"+t),eQ(n)}catch(e){eG[t]=null}return eG[t]}function eQ(e,t){var r;return e&&((r=a(t)?eK(e):eX(e,t))?eq=r:"u">typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),eq._abbr}function eX(e,t){if(null===t)return delete eG[e],null;var r,n=eW;if(t.abbr=e,null!=eG[e])C("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=eG[e]._config;else if(null!=t.parentLocale)if(null!=eG[t.parentLocale])n=eG[t.parentLocale]._config;else{if(null==(r=eJ(t.parentLocale)))return eZ[t.parentLocale]||(eZ[t.parentLocale]=[]),eZ[t.parentLocale].push({name:e,config:t}),null;n=r._config}return eG[e]=new M(S(n,t)),eZ[e]&&eZ[e].forEach(function(e){eX(e.name,e.config)}),eQ(e),eG[e]}function eK(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return eq;if(!n(e)){if(t=eJ(e))return t;e=[e]}return function(e){for(var t,r,n,i,o=0;o<e.length;){for(t=(i=e$(e[o]).split("-")).length,r=(r=e$(e[o+1]))?r.split("-"):null;t>0;){if(n=eJ(i.slice(0,t).join("-")))return n;if(r&&r.length>=t&&function(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r<n;r+=1)if(e[r]!==t[r])return r;return n}(i,r)>=t-1)break;t--}o++}return eq}(e)}function e0(e){var t,r=e._a;return r&&-2===d(e).overflow&&(t=r[1]<0||r[1]>11?1:r[2]<1||r[2]>eA(r[0],r[1])?2:r[3]<0||r[3]>24||24===r[3]&&(0!==r[4]||0!==r[5]||0!==r[6])?3:r[4]<0||r[4]>59?4:r[5]<0||r[5]>59?5:r[6]<0||r[6]>999?6:-1,d(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),d(e)._overflowWeeks&&-1===t&&(t=7),d(e)._overflowWeekday&&-1===t&&(t=8),d(e).overflow=t),e}var e1=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e2=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,e8=/Z|[+-]\d\d(?::?\d\d)?/,e3=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],e5=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],e4=/^\/?Date\((-?\d+)/i,e6=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,e7={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function e9(e){var t,r,n,i,o,u,a=e._i,s=e1.exec(a)||e2.exec(a),c=e3.length,l=e5.length;if(s){for(d(e).iso=!0,t=0,r=c;t<r;t++)if(e3[t][1].exec(s[1])){i=e3[t][0],n=!1!==e3[t][2];break}if(null==i){e._isValid=!1;return}if(s[3]){for(t=0,r=l;t<r;t++)if(e5[t][1].exec(s[3])){o=(s[2]||" ")+e5[t][0];break}if(null==o){e._isValid=!1;return}}if(!n&&null!=o){e._isValid=!1;return}if(s[4])if(e8.exec(s[4]))u="Z";else{e._isValid=!1;return}e._f=i+(o||"")+(u||""),tn(e)}else e._isValid=!1}function te(e){var t,r,n,i,o,u,a,s,c,l,f,h=e6.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(h){if(o=h[4],u=h[3],a=h[2],s=h[5],c=h[6],l=h[7],f=[(t=parseInt(o,10))<=49?2e3+t:t<=999?1900+t:t,eF.indexOf(u),parseInt(a,10),parseInt(s,10),parseInt(c,10)],l&&f.push(parseInt(l,10)),r=h[1],n=f,i=e,r&&eP.indexOf(r)!==new Date(n[0],n[1],n[2]).getDay()&&(d(i).weekdayMismatch=!0,i._isValid=!1,1))return;e._a=f,e._tzm=function(e,t,r){if(e)return e7[e];if(t)return 0;var n=parseInt(r,10),i=n%100;return(n-i)/100*60+i}(h[8],h[9],h[10]),e._d=eO.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),d(e).rfc2822=!0}else e._isValid=!1}function tt(e,t,r){return null!=e?e:null!=t?t:r}function tr(e){var r,n,i,o,u,a,s,c,l,f,h,p,m,D,g,y,v=[];if(!e._d){for(h=new Date(t.now()),D=e._useUTC?[h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()]:[h.getFullYear(),h.getMonth(),h.getDate()],e._w&&null==e._a[2]&&null==e._a[1]&&(null!=(n=(r=e)._w).GG||null!=n.W||null!=n.E?(a=1,s=4,i=tt(n.GG,r._a[0],ek(tu(),1,4).year),o=tt(n.W,1),((u=tt(n.E,1))<1||u>7)&&(l=!0)):(a=r._locale._week.dow,s=r._locale._week.doy,f=ek(tu(),a,s),i=tt(n.gg,r._a[0],f.year),o=tt(n.w,f.week),null!=n.d?((u=n.d)<0||u>6)&&(l=!0):null!=n.e?(u=n.e+a,(n.e<0||n.e>6)&&(l=!0)):u=a),o<1||o>eI(i,a,s)?d(r)._overflowWeeks=!0:null!=l?d(r)._overflowWeekday=!0:(c=eT(i,o,u,a,s),r._a[0]=c.year,r._dayOfYear=c.dayOfYear)),null!=e._dayOfYear&&(y=tt(e._a[0],D[0]),(e._dayOfYear>ey(y)||0===e._dayOfYear)&&(d(e)._overflowDayOfYear=!0),m=eO(y,0,e._dayOfYear),e._a[1]=m.getUTCMonth(),e._a[2]=m.getUTCDate()),p=0;p<3&&null==e._a[p];++p)e._a[p]=v[p]=D[p];for(;p<7;p++)e._a[p]=v[p]=null==e._a[p]?+(2===p):e._a[p];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?eO:eN).apply(null,v),g=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==g&&(d(e).weekdayMismatch=!0)}}function tn(e){if(e._f===t.ISO_8601)return void e9(e);if(e._f===t.RFC_2822)return void te(e);e._a=[],d(e).empty=!0;var r,n,i,u,a,s,c,l,f,h,p,m=""+e._i,D=m.length,g=0;for(p=(c=P(e._f,e._locale).match(O)||[]).length,a=0;a<p;a++)if(l=c[a],(s=(m.match(!o(L,l)?new RegExp(ef(l.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,r,n,i){return t||r||n||i}))):L[l](e._strict,e._locale))||[])[0])&&((f=m.substr(0,m.indexOf(s))).length>0&&d(e).unusedInput.push(f),m=m.slice(m.indexOf(s)+s.length),g+=s.length),k[l])s?d(e).empty=!1:d(e).unusedTokens.push(l),null!=s&&o(ep,l)&&ep[l](s,e._a,e,l);else e._strict&&!s&&d(e).unusedTokens.push(l);d(e).charsLeftOver=D-g,m.length>0&&d(e).unusedInput.push(m),e._a[3]<=12&&!0===d(e).bigHour&&e._a[3]>0&&(d(e).bigHour=void 0),d(e).parsedDateParts=e._a.slice(0),d(e).meridiem=e._meridiem,e._a[3]=(r=e._locale,n=e._a[3],null==(i=e._meridiem)?n:null!=r.meridiemHour?r.meridiemHour(n,i):(null!=r.isPM&&((u=r.isPM(i))&&n<12&&(n+=12),u||12!==n||(n=0)),n)),null!==(h=d(e).era)&&(e._a[0]=e._locale.erasConvertYear(h,e._a[0])),tr(e),e0(e)}function ti(e){var r=e._i,o=e._f;return(e._locale=e._locale||eK(e._l),null===r||void 0===o&&""===r)?m({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),_(r))?new E(e0(r)):(c(r)?e._d=r:n(o)?!function(e){var t,r,n,i,o,u,a=!1,s=e._f.length;if(0===s){d(e).invalidFormat=!0,e._d=new Date(NaN);return}for(i=0;i<s;i++)o=0,u=!1,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],tn(t),p(t)&&(u=!0),o+=d(t).charsLeftOver,o+=10*d(t).unusedTokens.length,d(t).score=o,a?o<n&&(n=o,r=t):(null==n||o<n||u)&&(n=o,r=t,u&&(a=!0));f(e,r||t)}(e):o?tn(e):function(e){var r=e._i;if(a(r))e._d=new Date(t.now());else if(c(r))e._d=new Date(r.valueOf());else if("string"==typeof r)!function(e){var r=e4.exec(e._i);if(null!==r){e._d=new Date(+r[1]);return}e9(e),!1!==e._isValid||(delete e._isValid,te(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:t.createFromInputFallback(e)))}(e);else if(n(r))e._a=l(r.slice(0),function(e){return parseInt(e,10)}),tr(e);else if(i(r)){if(!e._d){var o=U(e._i),u=void 0===o.day?o.date:o.day;e._a=l([o.year,o.month,u,o.hour,o.minute,o.second,o.millisecond],function(e){return e&&parseInt(e,10)}),tr(e)}}else s(r)?e._d=new Date(r):t.createFromInputFallback(e)}(e),p(e)||(e._d=null),e)}function to(e,t,r,o,a){var s,c={};return(!0===t||!1===t)&&(o=t,t=void 0),(!0===r||!1===r)&&(o=r,r=void 0),(i(e)&&u(e)||n(e)&&0===e.length)&&(e=void 0),c._isAMomentObject=!0,c._useUTC=c._isUTC=a,c._l=r,c._i=e,c._f=t,c._strict=o,(s=new E(e0(ti(c))))._nextDay&&(s.add(1,"d"),s._nextDay=void 0),s}function tu(e,t,r,n){return to(e,t,r,n,!1)}t.createFromInputFallback=F("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){},t.RFC_2822=function(){};var ta=F("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=tu.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:m()}),ts=F("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=tu.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:m()});function tc(e,t){var r,i;if(1===t.length&&n(t[0])&&(t=t[0]),!t.length)return tu();for(r=t[0],i=1;i<t.length;++i)(!t[i].isValid()||t[i][e](r))&&(r=t[i]);return r}var tl=["year","quarter","month","week","day","hour","minute","second","millisecond"];function tf(e){var t=U(e),r=t.year||0,n=t.quarter||0,i=t.month||0,u=t.week||t.isoWeek||0,a=t.day||0,s=t.hour||0,c=t.minute||0,l=t.second||0,f=t.millisecond||0;this._isValid=function(e){var t,r,n=!1,i=tl.length;for(t in e)if(o(e,t)&&!(-1!==eL.call(tl,t)&&(null==e[t]||!isNaN(e[t]))))return!1;for(r=0;r<i;++r)if(e[tl[r]]){if(n)return!1;parseFloat(e[tl[r]])!==ed(e[tl[r]])&&(n=!0)}return!0}(t),this._milliseconds=+f+1e3*l+6e4*c+1e3*s*3600,this._days=+a+7*u,this._months=+i+3*n+12*r,this._data={},this._locale=eK(),this._bubble()}function th(e){return e instanceof tf}function td(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function tp(e,t){I(e,0,0,function(){var e=this.utcOffset(),r="+";return e<0&&(e=-e,r="-"),r+N(~~(e/60),2)+t+N(~~e%60,2)})}tp("Z",":"),tp("ZZ",""),el("Z",eu),el("ZZ",eu),em(["Z","ZZ"],function(e,t,r){r._useUTC=!0,r._tzm=tD(eu,e)});var tm=/([\+\-]|\d\d)/gi;function tD(e,t){var r,n,i=(t||"").match(e);return null===i?null:0===(n=+(60*(r=((i[i.length-1]||[])+"").match(tm)||["-",0,0])[1])+ed(r[2]))?0:"+"===r[0]?n:-n}function tg(e,r){var n,i;return r._isUTC?(n=r.clone(),i=(_(e)||c(e)?e.valueOf():tu(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),t.updateOffset(n,!1),n):tu(e).local()}function ty(e){return-Math.round(e._d.getTimezoneOffset())}function tv(){return!!this.isValid()&&this._isUTC&&0===this._offset}t.updateOffset=function(){};var tw=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,tE=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function t_(e,t){var r,n,i,u,a,c,l=e,f=null;return th(e)?l={ms:e._milliseconds,d:e._days,M:e._months}:s(e)||!isNaN(+e)?(l={},t?l[t]=+e:l.milliseconds=+e):(f=tw.exec(e))?(u="-"===f[1]?-1:1,l={y:0,d:ed(f[2])*u,h:ed(f[3])*u,m:ed(f[4])*u,s:ed(f[5])*u,ms:ed(td(1e3*f[6]))*u}):(f=tE.exec(e))?(u="-"===f[1]?-1:1,l={y:tA(f[2],u),M:tA(f[3],u),w:tA(f[4],u),d:tA(f[5],u),h:tA(f[6],u),m:tA(f[7],u),s:tA(f[8],u)}):null==l?l={}:"object"==typeof l&&("from"in l||"to"in l)&&(r=tu(l.from),n=tu(l.to),c=r.isValid()&&n.isValid()?(n=tg(n,r),r.isBefore(n)?i=tF(r,n):((i=tF(n,r)).milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0},(l={}).ms=c.milliseconds,l.M=c.months),a=new tf(l),th(e)&&o(e,"_locale")&&(a._locale=e._locale),th(e)&&o(e,"_isValid")&&(a._isValid=e._isValid),a}function tA(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function tF(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=t-e.clone().add(r.months,"M"),r}function tb(e,t){return function(r,n){var i;return null===n||isNaN(+n)||(C(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=r,r=n,n=i),tC(this,t_(r,n),e),this}}function tC(e,r,n,i){var o=r._milliseconds,u=td(r._days),a=td(r._months);e.isValid()&&(i=null==i||i,a&&ex(e,eE(e,"Month")+a*n),u&&e_(e,"Date",eE(e,"Date")+u*n),o&&e._d.setTime(e._d.valueOf()+o*n),i&&t.updateOffset(e,u||a))}t_.fn=tf.prototype,t_.invalid=function(){return t_(NaN)};var tx=tb(1,"add"),tS=tb(-1,"subtract");function tM(e){return"string"==typeof e||e instanceof String}function tN(e,t){if(e.date()<t.date())return-tN(t,e);var r,n=(t.year()-e.year())*12+(t.month()-e.month()),i=e.clone().add(n,"months");return r=t-i<0?(t-i)/(i-e.clone().add(n-1,"months")):(t-i)/(e.clone().add(n+1,"months")-i),-(n+r)||0}function tO(e){var t;return void 0===e?this._locale._abbr:(null!=(t=eK(e))&&(this._locale=t),this)}t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var tB=F("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function tT(){return this._locale}function tk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-126227808e5:new Date(e,t,r).valueOf()}function tI(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-126227808e5:Date.UTC(e,t,r)}function tR(e,t){return t.erasAbbrRegex(e)}function tP(){var e,t,r,n,i,o=[],u=[],a=[],s=[],c=this.eras();for(e=0,t=c.length;e<t;++e)r=ef(c[e].name),n=ef(c[e].abbr),i=ef(c[e].narrow),u.push(r),o.push(n),a.push(i),s.push(r),s.push(n),s.push(i);this._erasRegex=RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=RegExp("^("+u.join("|")+")","i"),this._erasAbbrRegex=RegExp("^("+o.join("|")+")","i"),this._erasNarrowRegex=RegExp("^("+a.join("|")+")","i")}function tj(e,t){I(0,[e,e.length],0,t)}function tY(e,t,r,n,i){var o;return null==e?ek(this,n,i).year:(t>(o=eI(e,n,i))&&(t=o),tU.call(this,e,t,r,n,i))}function tU(e,t,r,n,i){var o=eT(e,t,r,n,i),u=eO(o.year,0,o.dayOfYear);return this.year(u.getUTCFullYear()),this.month(u.getUTCMonth()),this.date(u.getUTCDate()),this}I("N",0,0,"eraAbbr"),I("NN",0,0,"eraAbbr"),I("NNN",0,0,"eraAbbr"),I("NNNN",0,0,"eraName"),I("NNNNN",0,0,"eraNarrow"),I("y",["y",1],"yo","eraYear"),I("y",["yy",2],0,"eraYear"),I("y",["yyy",3],0,"eraYear"),I("y",["yyyy",4],0,"eraYear"),el("N",tR),el("NN",tR),el("NNN",tR),el("NNNN",function(e,t){return t.erasNameRegex(e)}),el("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),em(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var i=r._locale.erasParse(e,n,r._strict);i?d(r).era=i:d(r).invalidEra=e}),el("y",en),el("yy",en),el("yyy",en),el("yyyy",en),el("yo",function(e,t){return t._eraYearOrdinalRegex||en}),em(["y","yy","yyy","yyyy"],0),em(["yo"],function(e,t,r,n){var i;r._locale._eraYearOrdinalRegex&&(i=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[0]=r._locale.eraYearOrdinalParse(e,i):t[0]=parseInt(e,10)}),I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),tj("gggg","weekYear"),tj("ggggg","weekYear"),tj("GGGG","isoWeekYear"),tj("GGGGG","isoWeekYear"),el("G",ei),el("g",ei),el("GG",Q,G),el("gg",Q,G),el("GGGG",et,$),el("gggg",et,$),el("GGGGG",er,J),el("ggggg",er,J),eD(["gggg","ggggg","GGGG","GGGGG"],function(e,t,r,n){t[n.substr(0,2)]=ed(e)}),eD(["gg","GG"],function(e,r,n,i){r[i]=t.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),el("Q",W),em("Q",function(e,t){t[1]=(ed(e)-1)*3}),I("D",["DD",2],"Do","date"),el("D",Q,es),el("DD",Q,G),el("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),em(["D","DD"],2),em("Do",function(e,t){t[2]=ed(e.match(Q)[0])});var tz=ew("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),el("DDD",ee),el("DDDD",Z),em(["DDD","DDDD"],function(e,t,r){r._dayOfYear=ed(e)}),I("m",["mm",2],0,"minute"),el("m",Q,ec),el("mm",Q,G),em(["m","mm"],4);var tV=ew("Minutes",!1);I("s",["ss",2],0,"second"),el("s",Q,ec),el("ss",Q,G),em(["s","ss"],5);var tL=ew("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),el("S",ee,W),el("SS",ee,G),el("SSS",ee,Z),D="SSSS";D.length<=9;D+="S")el(D,en);function tq(e,t){t[6]=ed(("0."+e)*1e3)}for(D="S";D.length<=9;D+="S")em(D,tq);g=ew("Milliseconds",!1),I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var tH=E.prototype;function tW(e){return e}tH.add=tx,tH.calendar=function(e,r){if(1==arguments.length)if(arguments[0]){var a,l,f,h;if(a=arguments[0],_(a)||c(a)||tM(a)||s(a)||(f=n(l=a),h=!1,f&&(h=0===l.filter(function(e){return!s(e)&&tM(l)}).length),f&&h)||function(e){var t,r,n=i(e)&&!u(e),a=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],c=s.length;for(t=0;t<c;t+=1)r=s[t],a=a||o(e,r);return n&&a}(a)||null==a)e=arguments[0],r=void 0;else(function(e){var t,r,n=i(e)&&!u(e),a=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<s.length;t+=1)r=s[t],a=a||o(e,r);return n&&a})(arguments[0])&&(r=arguments[0],e=void 0)}else e=void 0,r=void 0;var d=e||tu(),p=tg(d,this).startOf("day"),m=t.calendarFormat(this,p)||"sameElse",D=r&&(x(r[m])?r[m].call(this,d):r[m]);return this.format(D||this.localeData().calendar(m,this,tu(d)))},tH.clone=function(){return new E(this)},tH.diff=function(e,t,r){var n,i,o;if(!this.isValid()||!(n=tg(e,this)).isValid())return NaN;switch(i=(n.utcOffset()-this.utcOffset())*6e4,t=Y(t)){case"year":o=tN(this,n)/12;break;case"month":o=tN(this,n);break;case"quarter":o=tN(this,n)/3;break;case"second":o=(this-n)/1e3;break;case"minute":o=(this-n)/6e4;break;case"hour":o=(this-n)/36e5;break;case"day":o=(this-n-i)/864e5;break;case"week":o=(this-n-i)/6048e5;break;default:o=this-n}return r?o:eh(o)},tH.endOf=function(e){var r,n;if(void 0===(e=Y(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tI:tk,e){case"year":r=n(this.year()+1,0,1)-1;break;case"quarter":r=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":r=n(this.year(),this.month()+1,1)-1;break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":r=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":r=this._d.valueOf(),r+=36e5-((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5-1;break;case"minute":r=this._d.valueOf(),r+=6e4-(r%6e4+6e4)%6e4-1;break;case"second":r=this._d.valueOf(),r+=1e3-(r%1e3+1e3)%1e3-1}return this._d.setTime(r),t.updateOffset(this,!0),this},tH.format=function(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var r=R(this,e);return this.localeData().postformat(r)},tH.from=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||tu(e).isValid())?t_({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tH.fromNow=function(e){return this.from(tu(),e)},tH.to=function(e,t){return this.isValid()&&(_(e)&&e.isValid()||tu(e).isValid())?t_({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},tH.toNow=function(e){return this.to(tu(),e)},tH.get=function(e){return x(this[e=Y(e)])?this[e]():this},tH.invalidAt=function(){return d(this).overflow},tH.isAfter=function(e,t){var r=_(e)?e:tu(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()>r.valueOf():r.valueOf()<this.clone().startOf(t).valueOf())},tH.isBefore=function(e,t){var r=_(e)?e:tu(e);return!!(this.isValid()&&r.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()<r.valueOf():this.clone().endOf(t).valueOf()<r.valueOf())},tH.isBetween=function(e,t,r,n){var i=_(e)?e:tu(e),o=_(t)?t:tu(t);return!!(this.isValid()&&i.isValid()&&o.isValid())&&("("===(n=n||"()")[0]?this.isAfter(i,r):!this.isBefore(i,r))&&(")"===n[1]?this.isBefore(o,r):!this.isAfter(o,r))},tH.isSame=function(e,t){var r,n=_(e)?e:tu(e);return!!(this.isValid()&&n.isValid())&&("millisecond"===(t=Y(t)||"millisecond")?this.valueOf()===n.valueOf():(r=n.valueOf(),this.clone().startOf(t).valueOf()<=r&&r<=this.clone().endOf(t).valueOf()))},tH.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},tH.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},tH.isValid=function(){return p(this)},tH.lang=tB,tH.locale=tO,tH.localeData=tT,tH.max=ts,tH.min=ta,tH.parsingFlags=function(){return f({},d(this))},tH.set=function(e,t){if("object"==typeof e){var r,n=function(e){var t,r=[];for(t in e)o(e,t)&&r.push({unit:t,priority:q[t]});return r.sort(function(e,t){return e.priority-t.priority}),r}(e=U(e)),i=n.length;for(r=0;r<i;r++)this[n[r].unit](e[n[r].unit])}else if(x(this[e=Y(e)]))return this[e](t);return this},tH.startOf=function(e){var r,n;if(void 0===(e=Y(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?tI:tk,e){case"year":r=n(this.year(),0,1);break;case"quarter":r=n(this.year(),this.month()-this.month()%3,1);break;case"month":r=n(this.year(),this.month(),1);break;case"week":r=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":r=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":r=n(this.year(),this.month(),this.date());break;case"hour":r=this._d.valueOf(),r-=((r+(this._isUTC?0:6e4*this.utcOffset()))%36e5+36e5)%36e5;break;case"minute":r=this._d.valueOf(),r-=(r%6e4+6e4)%6e4;break;case"second":r=this._d.valueOf(),r-=(r%1e3+1e3)%1e3}return this._d.setTime(r),t.updateOffset(this,!0),this},tH.subtract=tS,tH.toArray=function(){return[this.year(),this.month(),this.date(),this.hour(),this.minute(),this.second(),this.millisecond()]},tH.toObject=function(){return{years:this.year(),months:this.month(),date:this.date(),hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()}},tH.toDate=function(){return new Date(this.valueOf())},tH.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,r=t?this.clone().utc():this;if(0>r.year()||r.year()>9999)return R(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ");if(x(Date.prototype.toISOString))if(t)return this.toDate().toISOString();else return new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",R(r,"Z"));return R(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},tH.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,r,n="moment",i="";return this.isLocal()||(n=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+n+'("]',t=0<=this.year()&&9999>=this.year()?"YYYY":"YYYYYY",r=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+r)},"u">typeof Symbol&&null!=Symbol.for&&(tH[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),tH.toJSON=function(){return this.isValid()?this.toISOString():null},tH.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},tH.unix=function(){return Math.floor(this.valueOf()/1e3)},tH.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},tH.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},tH.eraName=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].name;return""},tH.eraNarrow=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].narrow;return""},tH.eraAbbr=function(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;e<t;++e)if(r=this.clone().startOf("day").valueOf(),n[e].since<=r&&r<=n[e].until||n[e].until<=r&&r<=n[e].since)return n[e].abbr;return""},tH.eraYear=function(){var e,r,n,i,o=this.localeData().eras();for(e=0,r=o.length;e<r;++e)if(n=o[e].since<=o[e].until?1:-1,i=this.clone().startOf("day").valueOf(),o[e].since<=i&&i<=o[e].until||o[e].until<=i&&i<=o[e].since)return(this.year()-t(o[e].since).year())*n+o[e].offset;return this.year()},tH.year=ev,tH.isLeapYear=function(){return eg(this.year())},tH.weekYear=function(e){return tY.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)},tH.isoWeekYear=function(e){return tY.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},tH.quarter=tH.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)},tH.month=eS,tH.daysInMonth=function(){return eA(this.year(),this.month())},tH.week=tH.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add((e-t)*7,"d")},tH.isoWeek=tH.isoWeeks=function(e){var t=ek(this,1,4).week;return null==e?t:this.add((e-t)*7,"d")},tH.weeksInYear=function(){var e=this.localeData()._week;return eI(this.year(),e.dow,e.doy)},tH.weeksInWeekYear=function(){var e=this.localeData()._week;return eI(this.weekYear(),e.dow,e.doy)},tH.isoWeeksInYear=function(){return eI(this.year(),1,4)},tH.isoWeeksInISOWeekYear=function(){return eI(this.isoWeekYear(),1,4)},tH.date=tz,tH.day=tH.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,r,n=eE(this,"Day");return null==e?n:(t=e,r=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=r.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-n,"d"))},tH.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},tH.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,r=(t=this.localeData(),"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e);return this.day(this.day()%7?r:r-7)},tH.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},tH.hour=tH.hours=eH,tH.minute=tH.minutes=tV,tH.second=tH.seconds=tL,tH.millisecond=tH.milliseconds=g,tH.utcOffset=function(e,r,n){var i,o=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?o:ty(this);if("string"==typeof e){if(null===(e=tD(eu,e)))return this}else 16>Math.abs(e)&&!n&&(e*=60);return!this._isUTC&&r&&(i=ty(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),o!==e&&(!r||this._changeInProgress?tC(this,t_(e-o,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this},tH.utc=function(e){return this.utcOffset(0,e)},tH.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(ty(this),"m")),this},tH.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=tD(eo,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},tH.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?tu(e).utcOffset():0,(this.utcOffset()-e)%60==0)},tH.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},tH.isLocal=function(){return!!this.isValid()&&!this._isUTC},tH.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},tH.isUtc=tv,tH.isUTC=tv,tH.zoneAbbr=function(){return this._isUTC?"UTC":""},tH.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},tH.dates=F("dates accessor is deprecated. Use date instead.",tz),tH.months=F("months accessor is deprecated. Use month instead",eS),tH.years=F("years accessor is deprecated. Use year instead",ev),tH.zone=F("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),tH.isDSTShifted=F("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!a(this._isDSTShifted))return this._isDSTShifted;var e,t={};return w(t,this),(t=ti(t))._a?(e=t._isUTC?h(t._a):tu(t._a),this._isDSTShifted=this.isValid()&&function(e,t){var r,n=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),o=0;for(r=0;r<n;r++)ed(e[r])!==ed(t[r])&&o++;return o+i}(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted});var tG=M.prototype;function tZ(e,t,r,n){var i=eK(),o=h().set(n,t);return i[r](o,e)}function t$(e,t,r){if(s(e)&&(t=e,e=void 0),e=e||"",null!=t)return tZ(e,t,r,"month");var n,i=[];for(n=0;n<12;n++)i[n]=tZ(e,n,r,"month");return i}function tJ(e,t,r,n){"boolean"==typeof e||(r=t=e,e=!1),s(t)&&(r=t,t=void 0),t=t||"";var i,o=eK(),u=e?o._week.dow:0,a=[];if(null!=r)return tZ(t,(r+u)%7,n,"day");for(i=0;i<7;i++)a[i]=tZ(t,(i+u)%7,n,"day");return a}tG.calendar=function(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return x(n)?n.call(t,r):n},tG.longDateFormat=function(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(O).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},tG.invalidDate=function(){return this._invalidDate},tG.ordinal=function(e){return this._ordinal.replace("%d",e)},tG.preparse=tW,tG.postformat=tW,tG.relativeTime=function(e,t,r,n){var i=this._relativeTime[r];return x(i)?i(e,t,r,n):i.replace(/%d/i,e)},tG.pastFuture=function(e,t){var r=this._relativeTime[e>0?"future":"past"];return x(r)?r(t):r.replace(/%s/i,t)},tG.set=function(e){var t,r;for(r in e)o(e,r)&&(x(t=e[r])?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},tG.eras=function(e,r){var n,i,o,u=this._eras||eK("en")._eras;for(n=0,i=u.length;n<i;++n)switch("string"==typeof u[n].since&&(o=t(u[n].since).startOf("day"),u[n].since=o.valueOf()),typeof u[n].until){case"undefined":u[n].until=Infinity;break;case"string":o=t(u[n].until).startOf("day").valueOf(),u[n].until=o.valueOf()}return u},tG.erasParse=function(e,t,r){var n,i,o,u,a,s=this.eras();for(e=e.toUpperCase(),n=0,i=s.length;n<i;++n)if(o=s[n].name.toUpperCase(),u=s[n].abbr.toUpperCase(),a=s[n].narrow.toUpperCase(),r)switch(t){case"N":case"NN":case"NNN":if(u===e)return s[n];break;case"NNNN":if(o===e)return s[n];break;case"NNNNN":if(a===e)return s[n]}else if([o,u,a].indexOf(e)>=0)return s[n]},tG.erasConvertYear=function(e,r){var n=e.since<=e.until?1:-1;return void 0===r?t(e.since).year():t(e.since).year()+(r-e.offset)*n},tG.erasAbbrRegex=function(e){return o(this,"_erasAbbrRegex")||tP.call(this),e?this._erasAbbrRegex:this._erasRegex},tG.erasNameRegex=function(e){return o(this,"_erasNameRegex")||tP.call(this),e?this._erasNameRegex:this._erasRegex},tG.erasNarrowRegex=function(e){return o(this,"_erasNarrowRegex")||tP.call(this),e?this._erasNarrowRegex:this._erasRegex},tG.months=function(e,t){return e?n(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||eb).test(t)?"format":"standalone"][e.month()]:n(this._months)?this._months:this._months.standalone},tG.monthsShort=function(e,t){return e?n(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[eb.test(t)?"format":"standalone"][e.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},tG.monthsParse=function(e,t,r){var n,i,o;if(this._monthsParseExact)return eC.call(this,e,t,r);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(i=h([2e3,n]),r&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),r||this._monthsParse[n]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[n]=RegExp(o.replace(".",""),"i")),r&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(r&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!r&&this._monthsParse[n].test(e))return n}},tG.monthsRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||eM.call(this),e)?this._monthsStrictRegex:this._monthsRegex:(o(this,"_monthsRegex")||(this._monthsRegex=ea),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},tG.monthsShortRegex=function(e){return this._monthsParseExact?(o(this,"_monthsRegex")||eM.call(this),e)?this._monthsShortStrictRegex:this._monthsShortRegex:(o(this,"_monthsShortRegex")||(this._monthsShortRegex=ea),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},tG.week=function(e){return ek(e,this._week.dow,this._week.doy).week},tG.firstDayOfYear=function(){return this._week.doy},tG.firstDayOfWeek=function(){return this._week.dow},tG.weekdays=function(e,t){var r=n(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?eR(r,this._week.dow):e?r[e.day()]:r},tG.weekdaysMin=function(e){return!0===e?eR(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},tG.weekdaysShort=function(e){return!0===e?eR(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},tG.weekdaysParse=function(e,t,r){var n,i,o;if(this._weekdaysParseExact)return ej.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(i=h([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[n]=RegExp(o.replace(".",""),"i")),r&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(r&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(r&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;else if(!r&&this._weekdaysParse[n].test(e))return n}},tG.weekdaysRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysStrictRegex:this._weekdaysRegex:(o(this,"_weekdaysRegex")||(this._weekdaysRegex=ea),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},tG.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysShortStrictRegex:this._weekdaysShortRegex:(o(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ea),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},tG.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(o(this,"_weekdaysRegex")||eY.call(this),e)?this._weekdaysMinStrictRegex:this._weekdaysMinRegex:(o(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=ea),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},tG.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},tG.meridiem=function(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"},eQ("en",{eras:[{since:"0001-01-01",until:Infinity,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=1===ed(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+r}}),t.lang=F("moment.lang is deprecated. Use moment.locale instead.",eQ),t.langData=F("moment.langData is deprecated. Use moment.localeData instead.",eK);var tQ=Math.abs;function tX(e,t,r,n){var i=t_(t,r);return e._milliseconds+=n*i._milliseconds,e._days+=n*i._days,e._months+=n*i._months,e._bubble()}function tK(e){return e<0?Math.floor(e):Math.ceil(e)}function t0(e){return 4800*e/146097}function t1(e){return 146097*e/4800}function t2(e){return function(){return this.as(e)}}var t8=t2("ms"),t3=t2("s"),t5=t2("m"),t4=t2("h"),t6=t2("d"),t7=t2("w"),t9=t2("M"),re=t2("Q"),rt=t2("y");function rr(e){return function(){return this.isValid()?this._data[e]:NaN}}var rn=rr("milliseconds"),ri=rr("seconds"),ro=rr("minutes"),ru=rr("hours"),ra=rr("days"),rs=rr("months"),rc=rr("years"),rl=Math.round,rf={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function rh(e,t,r,n,i){return i.relativeTime(t||1,!!r,e,n)}var rd=Math.abs;function rp(e){return(e>0)-(e<0)||+e}function rm(){if(!this.isValid())return this.localeData().invalidDate();var e,t,r,n,i,o,u,a,s=rd(this._milliseconds)/1e3,c=rd(this._days),l=rd(this._months),f=this.asSeconds();return f?(e=eh(s/60),t=eh(e/60),s%=60,e%=60,r=eh(l/12),l%=12,n=s?s.toFixed(3).replace(/\.?0+$/,""):"",i=f<0?"-":"",o=rp(this._months)!==rp(f)?"-":"",u=rp(this._days)!==rp(f)?"-":"",a=rp(this._milliseconds)!==rp(f)?"-":"",i+"P"+(r?o+r+"Y":"")+(l?o+l+"M":"")+(c?u+c+"D":"")+(t||e||s?"T":"")+(t?a+t+"H":"")+(e?a+e+"M":"")+(s?a+n+"S":"")):"P0D"}var rD=tf.prototype;return rD.isValid=function(){return this._isValid},rD.abs=function(){var e=this._data;return this._milliseconds=tQ(this._milliseconds),this._days=tQ(this._days),this._months=tQ(this._months),e.milliseconds=tQ(e.milliseconds),e.seconds=tQ(e.seconds),e.minutes=tQ(e.minutes),e.hours=tQ(e.hours),e.months=tQ(e.months),e.years=tQ(e.years),this},rD.add=function(e,t){return tX(this,e,t,1)},rD.subtract=function(e,t){return tX(this,e,t,-1)},rD.as=function(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if("month"===(e=Y(e))||"quarter"===e||"year"===e)switch(t=this._days+n/864e5,r=this._months+t0(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(t1(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return 24*t+n/36e5;case"minute":return 1440*t+n/6e4;case"second":return 86400*t+n/1e3;case"millisecond":return Math.floor(864e5*t)+n;default:throw Error("Unknown unit "+e)}},rD.asMilliseconds=t8,rD.asSeconds=t3,rD.asMinutes=t5,rD.asHours=t4,rD.asDays=t6,rD.asWeeks=t7,rD.asMonths=t9,rD.asQuarters=re,rD.asYears=rt,rD.valueOf=t8,rD._bubble=function(){var e,t,r,n,i,o=this._milliseconds,u=this._days,a=this._months,s=this._data;return o>=0&&u>=0&&a>=0||o<=0&&u<=0&&a<=0||(o+=864e5*tK(t1(a)+u),u=0,a=0),s.milliseconds=o%1e3,s.seconds=(e=eh(o/1e3))%60,s.minutes=(t=eh(e/60))%60,s.hours=(r=eh(t/60))%24,u+=eh(r/24),a+=i=eh(t0(u)),u-=tK(t1(i)),n=eh(a/12),a%=12,s.days=u,s.months=a,s.years=n,this},rD.clone=function(){return t_(this)},rD.get=function(e){return e=Y(e),this.isValid()?this[e+"s"]():NaN},rD.milliseconds=rn,rD.seconds=ri,rD.minutes=ro,rD.hours=ru,rD.days=ra,rD.weeks=function(){return eh(this.days()/7)},rD.months=rs,rD.years=rc,rD.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var r,n,i,o,u,a,s,c,l,f,h,d,p,m=!1,D=rf;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(m=e),"object"==typeof t&&(D=Object.assign({},rf,t),null!=t.s&&null==t.ss&&(D.ss=t.s-1)),d=this.localeData(),r=!m,n=D,i=t_(this).abs(),o=rl(i.as("s")),u=rl(i.as("m")),a=rl(i.as("h")),s=rl(i.as("d")),c=rl(i.as("M")),l=rl(i.as("w")),f=rl(i.as("y")),h=o<=n.ss&&["s",o]||o<n.s&&["ss",o]||u<=1&&["m"]||u<n.m&&["mm",u]||a<=1&&["h"]||a<n.h&&["hh",a]||s<=1&&["d"]||s<n.d&&["dd",s],null!=n.w&&(h=h||l<=1&&["w"]||l<n.w&&["ww",l]),(h=h||c<=1&&["M"]||c<n.M&&["MM",c]||f<=1&&["y"]||["yy",f])[2]=r,h[3]=+this>0,h[4]=d,p=rh.apply(null,h),m&&(p=d.pastFuture(+this,p)),d.postformat(p)},rD.toISOString=rm,rD.toString=rm,rD.toJSON=rm,rD.locale=tO,rD.localeData=tT,rD.toIsoString=F("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",rm),rD.lang=tB,I("X",0,0,"unix"),I("x",0,0,"valueOf"),el("x",ei),el("X",/[+-]?\d+(\.\d{1,3})?/),em("X",function(e,t,r){r._d=new Date(1e3*parseFloat(e))}),em("x",function(e,t,r){r._d=new Date(ed(e))}),t.version="2.30.1",z=tu,t.fn=tH,t.min=function(){var e=[].slice.call(arguments,0);return tc("isBefore",e)},t.max=function(){var e=[].slice.call(arguments,0);return tc("isAfter",e)},t.now=function(){return Date.now?Date.now():+new Date},t.utc=h,t.unix=function(e){return tu(1e3*e)},t.months=function(e,t){return t$(e,t,"months")},t.isDate=c,t.locale=eQ,t.invalid=m,t.duration=t_,t.isMoment=_,t.weekdays=function(e,t,r){return tJ(e,t,r,"weekdays")},t.parseZone=function(){return tu.apply(null,arguments).parseZone()},t.localeData=eK,t.isDuration=th,t.monthsShort=function(e,t){return t$(e,t,"monthsShort")},t.weekdaysMin=function(e,t,r){return tJ(e,t,r,"weekdaysMin")},t.defineLocale=eX,t.updateLocale=function(e,t){if(null!=t){var r,n,i=eW;null!=eG[e]&&null!=eG[e].parentLocale?eG[e].set(S(eG[e]._config,t)):(null!=(n=eJ(e))&&(i=n._config),t=S(i,t),null==n&&(t.abbr=e),(r=new M(t)).parentLocale=eG[e],eG[e]=r),eQ(e)}else null!=eG[e]&&(null!=eG[e].parentLocale?(eG[e]=eG[e].parentLocale,e===eQ()&&eQ(e)):null!=eG[e]&&delete eG[e]);return eG[e]},t.locales=function(){return H(eG)},t.weekdaysShort=function(e,t,r){return tJ(e,t,r,"weekdaysShort")},t.normalizeUnits=Y,t.relativeTimeRounding=function(e){return void 0===e?rl:"function"==typeof e&&(rl=e,!0)},t.relativeTimeThreshold=function(e,t){return void 0!==rf[e]&&(void 0===t?rf[e]:(rf[e]=t,"s"===e&&(rf.ss=t-1),!0))},t.calendarFormat=function(e,t){var r=e.diff(t,"days",!0);return r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse"},t.prototype=tH,t.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},t}()},118(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=118,e.exports=t},249(e,t){"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=(Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider")),u=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),f=Symbol.iterator,h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},d=Object.assign,p={};function m(e,t,r){this.props=e,this.context=t,this.refs=p,this.updater=r||h}function D(){}function g(e,t,r){this.props=e,this.context=t,this.refs=p,this.updater=r||h}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},D.prototype=m.prototype;var y=g.prototype=new D;y.constructor=g,d(y,m.prototype),y.isPureReactComponent=!0;var v=Array.isArray,w=Object.prototype.hasOwnProperty,E=null,_={key:!0,ref:!0,__self:!0,__source:!0};function A(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){(0===e._status||-1===e._status)&&(e._status=1,e._result=t)},function(t){(0===e._status||-1===e._status)&&(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var F=null;t.Fragment=i,t.Suspense=s,t.createContext=function(e){return(e={$$typeof:u,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.createElement=function(e,t,n){var i,o={},u=null,a=null;if(null!=t)for(i in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)w.call(t,i)&&!_.hasOwnProperty(i)&&(o[i]=t[i]);var s=arguments.length-2;if(1===s)o.children=n;else if(1<s){for(var c=Array(s),l=0;l<s;l++)c[l]=arguments[l+2];o.children=c}if(e&&e.defaultProps)for(i in s=e.defaultProps)void 0===o[i]&&(o[i]=s[i]);return{$$typeof:r,type:e,key:u,ref:a,props:o,_owner:E}},t.forwardRef=function(e){return{$$typeof:a,render:e}},t.lazy=function(e){return{$$typeof:l,_payload:{_status:-1,_result:e},_init:A}},t.memo=function(e,t){return{$$typeof:c,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return F.useCallback(e,t)},t.useContext=function(e){return F.useContext(e)},t.useEffect=function(e,t){return F.useEffect(e,t)},t.useMemo=function(e,t){return F.useMemo(e,t)},t.useRef=function(e){return F.useRef(e)},t.useState=function(e){return F.useState(e)}},326(e,t,r){"use strict";e.exports=r(249)},741(e){e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},557(t){"use strict";t.exports=e},2(e){"use strict";e.exports=n},438(e){"use strict";e.exports=o},545(e){"use strict";e.exports=r},55(e){"use strict";e.exports=i},111(e){"use strict";e.exports=t},530(e){!function(){"use strict";var t={}.hasOwnProperty;function r(){for(var e="",i=0;i<arguments.length;i++){var o=arguments[i];o&&(e=n(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var i="";for(var o in e)t.call(e,o)&&e[o]&&(i=n(i,o));return i}(o)))}return e}function n(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return r}):window.classNames=r}()}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return u[e].call(r.exports,r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var c={};return(()=>{"use strict";s.r(c),s.d(c,{default:()=>iY});let e=JSON.parse('{"UU":"@ohif/extension-dicom-microscopy"}').UU;var t=s(326),r=s(55),n=s(438),i=s(2),o=s.n(i);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e){var t=function(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=u(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u(t)?t:t+""}s(741),Object.create(null);var l=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,f={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"\xa9","©":"\xa9","®":"\xae","®":"\xae","…":"…","…":"…","/":"/","/":"/"},h=function(e){return f[e]},d={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:function(e){return e.replace(l,h)}},p=(0,t.createContext)(),m=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.usedNamespaces={}}return e=[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach(function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}();function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,u,a=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return D(e,t);var r=({}).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)?D(e,t):void 0}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t,r){return(t=a(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(){if(console&&console.warn){for(var e,t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];"string"==typeof r[0]&&(r[0]="react-i18next:: ".concat(r[0])),(e=console).warn.apply(e,r)}}var w={};function E(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];"string"==typeof t[0]&&w[t[0]]||("string"==typeof t[0]&&(w[t[0]]=new Date),v.apply(void 0,t))}var _=function(e,t){return function(){e.isInitialized?t():e.on("initialized",function r(){setTimeout(function(){e.off("initialized",r)},0),t()})}};function A(e,t,r){e.loadNamespaces(t,_(e,r))}function F(e,t,r,n){"string"==typeof r&&(r=[r]),r.forEach(function(t){0>e.options.ns.indexOf(t)&&e.options.ns.push(t)}),e.loadLanguages(t,_(e,n))}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach(function(t){y(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var x=function(e,r){var n=(0,t.useRef)();return(0,t.useEffect)(function(){n.current=r?n.current:e},[e,r]),n.current},S=["forwardedRef"];function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){y(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function O(){return(O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}var B={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},T=function(e){if(e)throw Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");return Object.freeze(B)};O(T,B,{MATRIX_OPTIONS:["Matrix","Array"],NUMBER_OPTIONS:["number","BigNumber","Fraction"]});var k,I,R,P="0123456789abcdef",j="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Y="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",U={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},z=!0,V="[DecimalError] ",L=V+"Invalid argument: ",q=V+"Precision limit exceeded",H=V+"crypto unavailable",W="[object Decimal]",G=Math.floor,Z=Math.pow,$=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,J=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Q=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,X=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,K=j.length-1,ee=Y.length-1,et={toStringTag:W};function er(e){var t,r,n,i=e.length-1,o="",u=e[0];if(i>0){for(o+=u,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(o+=ed(r)),o+=n;(r=7-(n=(u=e[t])+"").length)&&(o+=ed(r))}else if(0===u)return"0";for(;u%10==0;)u/=10;return o+u}function en(e,t,r){if(e!==~~e||e<t||e>r)throw Error(L+e)}function ei(e,t,r,n){var i,o,u,a;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=Z(10,7-t),a=e[i]%o|0,null==n?t<3?(0==t?a=a/100|0:1==t&&(a=a/10|0),u=r<4&&99999==a||r>3&&49999==a||5e4==a||0==a):u=(r<4&&a+1==o||r>3&&a+1==o/2)&&(e[i+1]/o/100|0)==Z(10,t-2)-1||(a==o/2||0==a)&&(e[i+1]/o/100|0)==0:t<4?(0==t?a=a/1e3|0:1==t?a=a/100|0:2==t&&(a=a/10|0),u=(n||r<4)&&9999==a||!n&&r>3&&4999==a):u=((n||r<4)&&a+1==o||!n&&r>3&&a+1==o/2)&&(e[i+1]/o/1e3|0)==Z(10,t-3)-1,u}function eo(e,t,r){for(var n,i,o=[0],u=0,a=e.length;u<a;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=P.indexOf(e.charAt(u++)),n=0;n<o.length;n++)o[n]>r-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}et.absoluteValue=et.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),ea(e)},et.ceil=function(){return ea(new this.constructor(this),this.e+1,2)},et.clampedTo=et.clamp=function(e,t){var r=this.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(L+t);return 0>this.cmp(e)?e:this.cmp(t)>0?t:new r(this)},et.comparedTo=et.cmp=function(e){var t,r,n,i,o=this.d,u=(e=new this.constructor(e)).d,a=this.s,s=e.s;if(!o||!u)return a&&s?a!==s?a:o===u?0:!o^a<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?a:u[0]?-s:0;if(a!==s)return a;if(this.e!==e.e)return this.e>e.e^a<0?1:-1;for(n=o.length,t=0,r=n<(i=u.length)?n:i;t<r;++t)if(o[t]!==u[t])return o[t]>u[t]^a<0?1:-1;return n===i?0:n>i^a<0?1:-1},et.cosine=et.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/e_(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=eE(e,1,t.times(i),new e(1));for(var o=r;o--;){var u=t.times(t);t=u.times(u).minus(u).times(8).plus(1)}return e.precision-=r,t}(n,eA(n,r)),n.precision=e,n.rounding=t,ea(2==R||3==R?r.neg():r,e,t,!0)):new n(1):new n(NaN)},et.cubeRoot=et.cbrt=function(){var e,t,r,n,i,o,u,a,s,c,l=this.constructor;if(!this.isFinite()||this.isZero())return new l(this);for(z=!1,(o=this.s*Z(this.s*this,1/3))&&Math.abs(o)!=1/0?n=new l(o.toString()):(r=er(this.d),(o=((e=this.e)-r.length+1)%3)&&(r+=1==o||-2==o?"0":"00"),o=Z(r,1/3),e=G((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=o==1/0?"5e"+e:(r=o.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=this.s),u=(e=l.precision)+3;;)if(n=eu((c=(s=(a=n).times(a).times(a)).plus(this)).plus(this).times(a),c.plus(s),u+2,1),er(a.d).slice(0,u)===(r=er(n.d)).slice(0,u)){if("9999"!=(r=r.slice(u-3,u+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(ea(n,e+1,1),t=!n.times(n).times(n).eq(this));break}if(!i&&(ea(a,e+1,0),a.times(a).times(a).eq(this))){n=a;break}u+=4,i=1}return z=!0,ea(n,e,l.rounding,t)},et.decimalPlaces=et.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-G(this.e/7))*7,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},et.dividedBy=et.div=function(e){return eu(this,new this.constructor(e))},et.dividedToIntegerBy=et.divToInt=function(e){var t=this.constructor;return ea(eu(this,new t(e),0,1,1),t.precision,t.rounding)},et.equals=et.eq=function(e){return 0===this.cmp(e)},et.floor=function(){return ea(new this.constructor(this),this.e+1,3)},et.greaterThan=et.gt=function(e){return this.cmp(e)>0},et.greaterThanOrEqualTo=et.gte=function(e){var t=this.cmp(e);return 1==t||0===t},et.hyperbolicCosine=et.cosh=function(){var e,t,r,n,i,o=this,u=o.constructor,a=new u(1);if(!o.isFinite())return new u(o.s?1/0:NaN);if(o.isZero())return a;r=u.precision,n=u.rounding,u.precision=r+Math.max(o.e,o.sd())+4,u.rounding=1,(i=o.d.length)<32?t=(1/e_(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=eE(u,1,o.times(t),new u(1),!0);for(var s,c=e,l=new u(8);c--;)s=o.times(o),o=a.minus(s.times(l.minus(s.times(l))));return ea(o,u.precision=r,u.rounding=n,!0)},et.hyperbolicSine=et.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=eE(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=eE(o,2,i=i.times(1/e_(5,e)),i,!0);for(var u,a=new o(5),s=new o(16),c=new o(20);e--;)u=i.times(i),i=i.times(a.plus(u.times(s.times(u).plus(c))))}return o.precision=t,o.rounding=r,ea(i,t,r,!0)},et.hyperbolicTangent=et.tanh=function(){var e,t,r=this.constructor;return this.isFinite()?this.isZero()?new r(this):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,eu(this.sinh(),this.cosh(),r.precision=e,r.rounding=t)):new r(this.s)},et.inverseCosine=et.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return -1!==r?0===r?e.isNeg()?ef(t,n,i):new t(0):new t(NaN):e.isZero()?ef(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},et.inverseHyperbolicCosine=et.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,z=!1,r=r.times(r).minus(1).sqrt().plus(r),z=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},et.inverseHyperbolicSine=et.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,z=!1,r=r.times(r).plus(1).sqrt().plus(r),z=!0,n.precision=e,n.rounding=t,r.ln())},et.inverseHyperbolicTangent=et.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,Math.max(n=i.sd(),e)<-(2*i.e)-1)?ea(new o(i),e,t,!0):(o.precision=r=n-i.e,i=eu(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5)):new o(NaN)},et.inverseSine=et.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,-1!==t)?0===t?((e=ef(o,r+4,n).times(.5)).s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2))},et.inverseTangent=et.atan=function(){var e,t,r,n,i,o,u,a,s,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);else if(c.abs().eq(1)&&f+4<=ee)return(u=ef(l,f+4,h).times(.25)).s=c.s,u}else{if(!c.s)return new l(NaN);if(f+4<=ee)return(u=ef(l,f+4,h).times(.5)).s=c.s,u}for(l.precision=a=f+10,l.rounding=1,e=r=Math.min(28,a/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(z=!1,t=Math.ceil(a/7),n=1,s=c.times(c),u=new l(c),i=c;-1!==e;)if(i=i.times(s),o=u.minus(i.div(n+=2)),i=i.times(s),void 0!==(u=o.plus(i.div(n+=2))).d[t])for(e=t;u.d[e]===o.d[e]&&e--;);return r&&(u=u.times(2<<r-1)),z=!0,ea(u,l.precision=f,l.rounding=h,!0)},et.isFinite=function(){return!!this.d},et.isInteger=et.isInt=function(){return!!this.d&&G(this.e/7)>this.d.length-2},et.isNaN=function(){return!this.s},et.isNegative=et.isNeg=function(){return this.s<0},et.isPositive=et.isPos=function(){return this.s>0},et.isZero=function(){return!!this.d&&0===this.d[0]},et.lessThan=et.lt=function(e){return 0>this.cmp(e)},et.lessThanOrEqualTo=et.lte=function(e){return 1>this.cmp(e)},et.logarithm=et.log=function(e){var t,r,n,i,o,u,a,s=this.constructor,c=s.precision,l=s.rounding;if(null==e)e=new s(10),t=!0;else{if(r=(e=new s(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new s(NaN);t=e.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new s(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(t)if(r.length>1)i=!0;else{for(n=r[0];n%10==0;)n/=10;i=1!==n}if(z=!1,ei((a=eu(o=ey(this,u=c+5),t?el(s,u+10):ey(e,u),u,1)).d,n=c,l))do if(u+=10,a=eu(o=ey(this,u),t?el(s,u+10):ey(e,u),u,1),!i){+er(a.d).slice(n+1,n+15)+1==1e14&&(a=ea(a,c+1,0));break}while(ei(a.d,n+=10,l));return z=!0,ea(a,c,l)},et.minus=et.sub=function(e){var t,r,n,i,o,u,a,s,c,l,f,h,d=this.constructor;if(e=new d(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new d(e.d||this.s!==e.s?this:NaN):e=new d(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(c=this.d,h=e.d,a=d.precision,s=d.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else{if(!c[0])return new d(3===s?-0:0);e=new d(this)}return z?ea(e,a,s):e}if(r=G(e.e/7),l=G(this.e/7),c=c.slice(),o=l-r){for((f=o<0)?(t=c,o=-o,u=h.length):(t=h,r=l,u=c.length),o>(n=Math.max(Math.ceil(a/7),u)+2)&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for((f=(n=c.length)<(u=h.length))&&(u=n),n=0;n<u;n++)if(c[n]!=h[n]){f=c[n]<h[n];break}o=0}for(f&&(t=c,c=h,h=t,e.s=-e.s),u=c.length,n=h.length-u;n>0;--n)c[u++]=0;for(n=h.length;n>o;){if(c[--n]<h[n]){for(i=n;i&&0===c[--i];)c[i]=1e7-1;--c[i],c[n]+=1e7}c[n]-=h[n]}for(;0===c[--u];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=ec(c,r),z?ea(e,a,s):e):new d(3===s?-0:0)},et.modulo=et.mod=function(e){var t,r=this.constructor;return(e=new r(e),this.d&&e.s&&(!e.d||e.d[0]))?e.d&&(!this.d||this.d[0])?(z=!1,9==r.modulo?(t=eu(this,e.abs(),0,3,1),t.s*=e.s):t=eu(this,e,0,r.modulo,1),t=t.times(e),z=!0,this.minus(t)):ea(new r(this),r.precision,r.rounding):new r(NaN)},et.naturalExponential=et.exp=function(){return eg(this)},et.naturalLogarithm=et.ln=function(){return ey(this)},et.negated=et.neg=function(){var e=new this.constructor(this);return e.s=-e.s,ea(e)},et.plus=et.add=function(e){var t,r,n,i,o,u,a,s,c,l,f=this.constructor;if(e=new f(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new f(e.d||this.s===e.s?this:NaN)):e=new f(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(c=this.d,l=e.d,a=f.precision,s=f.rounding,!c[0]||!l[0])return l[0]||(e=new f(this)),z?ea(e,a,s):e;if(o=G(this.e/7),n=G(e.e/7),c=c.slice(),i=o-n){for(i<0?(r=c,i=-i,u=l.length):(r=l,n=o,u=c.length),i>(u=(o=Math.ceil(a/7))>u?o+1:u+1)&&(i=u,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((u=c.length)-(i=l.length)<0&&(i=u,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/1e7|0,c[i]%=1e7;for(t&&(c.unshift(t),++n),u=c.length;0==c[--u];)c.pop();return e.d=c,e.e=ec(c,n),z?ea(e,a,s):e},et.precision=et.sd=function(e){var t;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(L+e);return this.d?(t=eh(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},et.round=function(){var e=this.constructor;return ea(new e(this),this.e+1,e.rounding)},et.sine=et.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:eE(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=eE(e,2,t=t.times(1/e_(5,r)),t);for(var i,o=new e(5),u=new e(16),a=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(u.times(i).minus(a))));return t}(n,eA(n,r)),n.precision=e,n.rounding=t,ea(R>2?r.neg():r,e,t,!0)):new n(NaN)},et.squareRoot=et.sqrt=function(){var e,t,r,n,i,o,u=this.d,a=this.e,s=this.s,c=this.constructor;if(1!==s||!u||!u[0])return new c(!s||s<0&&(!u||u[0])?NaN:u?this:1/0);for(z=!1,0==(s=Math.sqrt(+this))||s==1/0?(((t=er(u)).length+a)%2==0&&(t+="0"),s=Math.sqrt(t),a=G((a+1)/2)-(a<0||a%2),n=new c(t=s==1/0?"5e"+a:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+a)):n=new c(s.toString()),r=(a=c.precision)+3;;)if(n=(o=n).plus(eu(this,o,r+2,1)).times(.5),er(o.d).slice(0,r)===(t=er(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(ea(n,a+1,1),e=!n.times(n).eq(this));break}if(!i&&(ea(o,a+1,0),o.times(o).eq(this))){n=o;break}r+=4,i=1}return z=!0,ea(n,a,c.rounding,e)},et.tangent=et.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=eu(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,ea(2==R||4==R?r.neg():r,e,t,!0)):new n(NaN)},et.times=et.mul=function(e){var t,r,n,i,o,u,a,s,c,l=this.constructor,f=this.d,h=(e=new l(e)).d;if(e.s*=this.s,!f||!f[0]||!h||!h[0])return new l(!e.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?e.s/0:0*e.s);for(r=G(this.e/7)+G(e.e/7),(s=f.length)<(c=h.length)&&(o=f,f=h,h=o,u=s,s=c,c=u),o=[],n=u=s+c;n--;)o.push(0);for(n=c;--n>=0;){for(t=0,i=s+n;i>n;)a=o[i]+h[n]*f[i-n-1]+t,o[i--]=a%1e7|0,t=a/1e7|0;o[i]=(o[i]+t)%1e7|0}for(;!o[--u];)o.pop();return t?++r:o.shift(),e.d=o,e.e=ec(o,r),z?ea(e,l.precision,l.rounding):e},et.toBinary=function(e,t){return eF(this,2,e,t)},et.toDecimalPlaces=et.toDP=function(e,t){var r=this,n=r.constructor;return(r=new n(r),void 0===e)?r:(en(e,0,1e9),void 0===t?t=n.rounding:en(t,0,8),ea(r,e+r.e+1,t))},et.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=es(n,!0):(en(e,0,1e9),void 0===t?t=i.rounding:en(t,0,8),r=es(n=ea(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},et.toFixed=function(e,t){var r,n,i=this.constructor;return void 0===e?r=es(this):(en(e,0,1e9),void 0===t?t=i.rounding:en(t,0,8),r=es(n=ea(new i(this),e+this.e+1,t),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+r:r},et.toFraction=function(e){var t,r,n,i,o,u,a,s,c,l,f,h,d=this.d,p=this.constructor;if(!d)return new p(this);if(c=r=new p(1),n=s=new p(0),u=(o=(t=new p(n)).e=eh(d)-this.e-1)%7,t.d[0]=Z(10,u<0?7+u:u),null==e)e=o>0?t:c;else{if(!(a=new p(e)).isInt()||a.lt(c))throw Error(L+a);e=a.gt(t)?o>0?t:c:a}for(z=!1,a=new p(er(d)),l=p.precision,p.precision=o=7*d.length*2;f=eu(a,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=c,c=s.plus(f.times(i)),s=i,i=t,t=a.minus(f.times(i)),a=i;return i=eu(e.minus(r),n,0,1,1),s=s.plus(i.times(c)),r=r.plus(i.times(n)),s.s=c.s=this.s,h=1>eu(c,n,o,1).minus(this).abs().cmp(eu(s,r,o,1).minus(this).abs())?[c,n]:[s,r],p.precision=l,z=!0,h},et.toHexadecimal=et.toHex=function(e,t){return eF(this,16,e,t)},et.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:en(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(z=!1,r=eu(r,e,0,t,1).times(e),z=!0,ea(r)):(e.s=r.s,r=e),r},et.toNumber=function(){return+this},et.toOctal=function(e,t){return eF(this,8,e,t)},et.toPower=et.pow=function(e){var t,r,n,i,o,u,a=this,s=a.constructor,c=+(e=new s(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new s(Z(+a,c));if((a=new s(a)).eq(1))return a;if(n=s.precision,o=s.rounding,e.eq(1))return ea(a,n,o);if((t=G(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=0x1fffffffffffff)return i=ep(s,a,r,n),e.s<0?new s(1).div(i):ea(i,n,o);if((u=a.s)<0){if(t<e.d.length-1)return new s(NaN);if((1&e.d[t])==0&&(u=1),0==a.e&&1==a.d[0]&&1==a.d.length)return a.s=u,a}return(t=0!=(r=Z(+a,c))&&isFinite(r)?new s(r+"").e:G(c*(Math.log("0."+er(a.d))/Math.LN10+a.e+1)))>s.maxE+1||t<s.minE-1?new s(t>0?u/0:0):(z=!1,s.rounding=a.s=1,r=Math.min(12,(t+"").length),(i=eg(e.times(ey(a,n+r)),n)).d&&ei((i=ea(i,n+5,1)).d,n,o)&&(t=n+10,+er((i=ea(eg(e.times(ey(a,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=ea(i,n+1,0))),i.s=u,z=!0,s.rounding=o,ea(i,n,o))},et.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=es(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(en(e,1,1e9),void 0===t?t=i.rounding:en(t,0,8),r=es(n=ea(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},et.toSignificantDigits=et.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(en(e,1,1e9),void 0===t?t=r.rounding:en(t,0,8)),ea(new r(this),e,t)},et.toString=function(){var e=this.constructor,t=es(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+t:t},et.truncated=et.trunc=function(){return ea(new this.constructor(this),this.e+1,1)},et.valueOf=et.toJSON=function(){var e=this.constructor,t=es(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+t:t};var eu=function(){function e(e,t,r){var n,i=0,o=e.length;for(e=e.slice();o--;)n=e[o]*t+i,e[o]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=+(e[r]<t[r]),e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,o,u,a,s){var c,l,f,h,d,p,m,D,g,y,v,w,E,_,A,F,b,C,x,S,M=n.constructor,N=n.s==i.s?1:-1,O=n.d,B=i.d;if(!O||!O[0]||!B||!B[0])return new M(!n.s||!i.s||(O?B&&O[0]==B[0]:!B)?NaN:O&&0==O[0]||!B?0*N:N/0);for(s?(d=1,l=n.e-i.e):(s=1e7,d=7,l=G(n.e/d)-G(i.e/d)),x=B.length,b=O.length,y=(g=new M(N)).d=[],f=0;B[f]==(O[f]||0);f++);if(B[f]>(O[f]||0)&&l--,null==o?(_=o=M.precision,u=M.rounding):_=a?o+(n.e-i.e)+1:o,_<0)y.push(1),p=!0;else{if(_=_/d+2|0,f=0,1==x){for(h=0,B=B[0],_++;(f<b||h)&&_--;f++)A=h*s+(O[f]||0),y[f]=A/B|0,h=A%B|0;p=h||f<b}else{for((h=s/(B[0]+1)|0)>1&&(B=e(B,h,s),O=e(O,h,s),x=B.length,b=O.length),F=x,w=(v=O.slice(0,x)).length;w<x;)v[w++]=0;(S=B.slice()).unshift(0),C=B[0],B[1]>=s/2&&++C;do h=0,(c=t(B,v,x,w))<0?(E=v[0],x!=w&&(E=E*s+(v[1]||0)),(h=E/C|0)>1?(h>=s&&(h=s-1),D=(m=e(B,h,s)).length,w=v.length,1==(c=t(m,v,D,w))&&(h--,r(m,x<D?S:B,D,s))):(0==h&&(c=h=1),m=B.slice()),(D=m.length)<w&&m.unshift(0),r(v,m,w,s),-1==c&&(w=v.length,(c=t(B,v,x,w))<1&&(h++,r(v,x<w?S:B,w,s))),w=v.length):0===c&&(h++,v=[0]),y[f++]=h,c&&v[0]?v[w++]=O[F]||0:(v=[O[F]],w=1);while((F++<b||void 0!==v[0])&&_--);p=void 0!==v[0]}y[0]||y.shift()}if(1==d)g.e=l,I=p;else{for(f=1,h=y[0];h>=10;h/=10)f++;g.e=f+l*d-1,ea(g,a?o+g.e+1:o,u,p)}return g}}();function ea(e,t,r,n){var i,o,u,a,s,c,l,f,h,d=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,a=f[0];a>=10;a/=10)i++;if((o=t-i)<0)o+=7,u=t,s=(l=f[h=0])/Z(10,i-u-1)%10|0;else if((h=Math.ceil((o+1)/7))>=(a=f.length))if(n){for(;a++<=h;)f.push(0);l=s=0,i=1,o%=7,u=o-7+1}else break e;else{for(l=a=f[h],i=1;a>=10;a/=10)i++;o%=7,s=(u=o-7+i)<0?0:l/Z(10,i-u-1)%10|0}if(n=n||t<0||void 0!==f[h+1]||(u<0?l:l%Z(10,i-u-1)),c=r<4?(s||n)&&(0==r||r==(e.s<0?3:2)):s>5||5==s&&(4==r||n||6==r&&(o>0?u>0?l/Z(10,i-u):0:f[h-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=Z(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=h,a=1,h--):(f.length=h+1,a=Z(10,7-o),f[h]=u>0?(l/Z(10,i-u)%Z(10,u)|0)*a:0),c)for(;;)if(0==h){for(o=1,u=f[0];u>=10;u/=10)o++;for(u=f[0]+=a,a=1;u>=10;u/=10)a++;o!=a&&(e.e++,1e7==f[0]&&(f[0]=1));break}else{if(f[h]+=a,1e7!=f[h])break;f[h--]=0,a=1}for(o=f.length;0===f[--o];)f.pop()}return z&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function es(e,t,r){if(!e.isFinite())return ev(e);var n,i=e.e,o=er(e.d),u=o.length;return t?(r&&(n=r-u)>0?o=o.charAt(0)+"."+o.slice(1)+ed(n):u>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+ed(-i-1)+o,r&&(n=r-u)>0&&(o+=ed(n))):i>=u?(o+=ed(i+1-u),r&&(n=r-i-1)>0&&(o=o+"."+ed(n))):((n=i+1)<u&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-u)>0&&(i+1===u&&(o+="."),o+=ed(n))),o}function ec(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function el(e,t,r){if(t>K)throw z=!0,r&&(e.precision=r),Error(q);return ea(new e(j),t,1,!0)}function ef(e,t,r){if(t>ee)throw Error(q);return ea(new e(Y),t,r,!0)}function eh(e){var t=e.length-1,r=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function ed(e){for(var t="";e--;)t+="0";return t}function ep(e,t,r,n){var i,o=new e(1),u=Math.ceil(n/7+4);for(z=!1;;){if(r%2&&eb((o=o.times(t)).d,u)&&(i=!0),0===(r=G(r/2))){r=o.d.length-1,i&&0===o.d[r]&&++o.d[r];break}eb((t=t.times(t)).d,u)}return z=!0,o}function em(e){return 1&e.d[e.d.length-1]}function eD(e,t,r){for(var n,i,o=new e(t[0]),u=0;++u<t.length;){if(!(i=new e(t[u])).s){o=i;break}((n=o.cmp(i))===r||0===n&&o.s===r)&&(o=i)}return o}function eg(e,t){var r,n,i,o,u,a,s,c=0,l=0,f=0,h=e.constructor,d=h.rounding,p=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?!e.d[0]?1:e.s<0?0:1/0:e.s?e.s<0?0:e:0/0);for(null==t?(z=!1,s=p):s=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(s+=n=Math.log(Z(2,f))/Math.LN10*2+5|0,r=o=u=new h(1),h.precision=s;;){if(o=ea(o.times(e),s,1),r=r.times(++l),er((a=u.plus(eu(o,r,s,1))).d).slice(0,s)===er(u.d).slice(0,s)){for(i=f;i--;)u=ea(u.times(u),s,1);if(null!=t)return h.precision=p,u;if(!(c<3&&ei(u.d,s-n,d,c)))return ea(u,h.precision=p,d,z=!0);h.precision=s+=10,r=o=a=new h(1),l=0,c++}u=a}}function ey(e,t){var r,n,i,o,u,a,s,c,l,f,h,d=1,p=e,m=p.d,D=p.constructor,g=D.rounding,y=D.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new D(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(z=!1,l=y):l=t,D.precision=l+=10,n=(r=er(m)).charAt(0),!(15e14>Math.abs(o=p.e)))return c=el(D,l+2,y).times(o+""),p=ey(new D(n+"."+r.slice(1)),l-10).plus(c),D.precision=y,null==t?ea(p,y,g,z=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=er((p=p.times(e)).d)).charAt(0),d++;for(o=p.e,n>1?(p=new D("0."+r),o++):p=new D(n+"."+r.slice(1)),f=p,s=u=p=eu(p.minus(1),p.plus(1),l,1),h=ea(p.times(p),l,1),i=3;;){if(u=ea(u.times(h),l,1),er((c=s.plus(eu(u,new D(i),l,1))).d).slice(0,l)===er(s.d).slice(0,l)){if(s=s.times(2),0!==o&&(s=s.plus(el(D,l+2,y).times(o+""))),s=eu(s,new D(d),l,1),null!=t)return D.precision=y,s;if(!ei(s.d,l-10,g,a))return ea(s,D.precision=y,g,z=!0);D.precision=l+=10,c=u=p=eu(f.minus(1),f.plus(1),l,1),h=ea(p.times(p),l,1),i=a=1}s=c,i+=2}}function ev(e){return String(e.s*e.s/0)}function ew(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=7;n<i;)e.d.push(+t.slice(n,n+=7));n=7-(t=t.slice(n)).length}else n-=i;for(;n--;)t+="0";e.d.push(+t),z&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function eE(e,t,r,n,i){var o,u,a,s,c=e.precision,l=Math.ceil(c/7);for(z=!1,s=r.times(r),a=new e(n);;){if(u=eu(a.times(s),new e(t++*t++),c,1),a=i?n.plus(u):n.minus(u),n=eu(u.times(s),new e(t++*t++),c,1),void 0!==(u=a.plus(n)).d[l]){for(o=l;u.d[o]===a.d[o]&&o--;);if(-1==o)break}o=a,a=n,n=u,u=o}return z=!0,u.d.length=l+1,u}function e_(e,t){for(var r=e;--t;)r*=e;return r}function eA(e,t){var r,n=t.s<0,i=ef(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return R=n?4:1,t;if((r=t.divToInt(i)).isZero())R=n?3:2;else{if((t=t.minus(r.times(i))).lte(o))return R=em(r)?n?2:3:n?4:1,t;R=em(r)?n?1:4:n?3:2}return t.minus(i).abs()}function eF(e,t,r,n){var i,o,u,a,s,c,l,f,h,d=e.constructor,p=void 0!==r;if(p?(en(r,1,1e9),void 0===n?n=d.rounding:en(n,0,8)):(r=d.precision,n=d.rounding),e.isFinite()){for(u=(l=es(e)).indexOf("."),p?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,u>=0&&(l=l.replace(".",""),(h=new d(1)).e=l.length-u,h.d=eo(es(h),10,i),h.e=h.d.length),o=s=(f=eo(l,10,i)).length;0==f[--s];)f.pop();if(f[0]){if(u<0?o--:((e=new d(e)).d=f,e.e=o,f=(e=eu(e,h,r,n,0,i)).d,o=e.e,c=I),u=f[r],a=i/2,c=c||void 0!==f[r+1],c=n<4?(void 0!==u||c)&&(0===n||n===(e.s<0?3:2)):u>a||u===a&&(4===n||c||6===n&&1&f[r-1]||n===(e.s<0?8:7)),f.length=r,c)for(;++f[--r]>i-1;)f[r]=0,r||(++o,f.unshift(1));for(s=f.length;!f[s-1];--s);for(u=0,l="";u<s;u++)l+=P.charAt(f[u]);if(p){if(s>1)if(16==t||8==t){for(u=16==t?4:3,--s;s%u;s++)l+="0";for(s=(f=eo(l,i,t)).length;!f[s-1];--s);for(u=1,l="1.";u<s;u++)l+=P.charAt(f[u])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>s)for(o-=s;o--;)l+="0";else o<s&&(l=l.slice(0,o)+"."+l.slice(o))}else l=p?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=ev(e);return e.s<0?"-"+l:l}function eb(e,t){if(e.length>t)return e.length=t,!0}function eC(e){return new this(e).abs()}function ex(e){return new this(e).acos()}function eS(e){return new this(e).acosh()}function eM(e,t){return new this(e).plus(t)}function eN(e){return new this(e).asin()}function eO(e){return new this(e).asinh()}function eB(e){return new this(e).atan()}function eT(e){return new this(e).atanh()}function ek(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?ef(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=ef(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,r=this.atan(eu(e,t,o,1)),t=ef(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(eu(e,t,o,1)):(r=ef(this,o,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function eI(e){return new this(e).cbrt()}function eR(e){return ea(e=new this(e),e.e+1,2)}function eP(e,t,r){return new this(e).clamp(t,r)}function ej(e){if(!e||"object"!=typeof e)throw Error(V+"Object expected");var t,r,n,i=!0===e.defaults,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=U[r]),void 0!==(n=e[r]))if(G(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(L+r+": "+n);if(r="crypto",i&&(this[r]=U[r]),void 0!==(n=e[r]))if(!0===n||!1===n||0===n||1===n)if(n)if("u">typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(H);else this[r]=!1;else throw Error(L+r+": "+n);return this}function eY(e){return new this(e).cos()}function eU(e){return new this(e).cosh()}function ez(e,t){return new this(e).div(t)}function eV(e){return new this(e).exp()}function eL(e){return ea(e=new this(e),e.e+1,3)}function eq(){var e,t,r=new this(0);for(e=0,z=!1;e<arguments.length;)if(t=new this(arguments[e++]),t.d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return z=!0,new this(1/0);r=t}return z=!0,r.sqrt()}function eH(e){return e instanceof tr||e&&e.toStringTag===W||!1}function eW(e){return new this(e).ln()}function eG(e,t){return new this(e).log(t)}function eZ(e){return new this(e).log(2)}function e$(e){return new this(e).log(10)}function eJ(){return eD(this,arguments,-1)}function eQ(){return eD(this,arguments,1)}function eX(e,t){return new this(e).mod(t)}function eK(e,t){return new this(e).mul(t)}function e0(e,t){return new this(e).pow(t)}function e1(e){var t,r,n,i,o=0,u=new this(1),a=[];if(void 0===e?e=this.precision:en(e,1,1e9),n=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:a[o++]=i%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(n*=4);o<n;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(a.push(i%1e7),o+=4);o=n/4}else throw Error(H);else for(;o<n;)a[o++]=1e7*Math.random()|0;for(n=a[--o],e%=7,n&&e&&(i=Z(10,7-e),a[o]=(n/i|0)*i);0===a[o];o--)a.pop();if(o<0)r=0,a=[0];else{for(r=-1;0===a[0];r-=7)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return u.e=r,u.d=a,u}function e2(e){return ea(e=new this(e),e.e+1,this.rounding)}function e8(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function e3(e){return new this(e).sin()}function e5(e){return new this(e).sinh()}function e4(e){return new this(e).sqrt()}function e6(e,t){return new this(e).sub(t)}function e7(){var e=0,t=arguments,r=new this(t[0]);for(z=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return z=!0,ea(r,this.precision,this.rounding)}function e9(e){return new this(e).tan()}function te(e){return new this(e).tanh()}function tt(e){return ea(e=new this(e),e.e+1,1)}et[Symbol.for("nodejs.util.inspect.custom")]=et.toString,et[Symbol.toStringTag]="Decimal";var tr=et.constructor=function e(t){var r,n,i;function o(e){var t,r,n;if(!(this instanceof o))return new o(e);if(this.constructor=o,eH(e)){this.s=e.s,z?!e.d||e.e>o.maxE?(this.e=NaN,this.d=null):e.e<o.minE?(this.e=0,this.d=[0]):(this.e=e.e,this.d=e.d.slice()):(this.e=e.e,this.d=e.d?e.d.slice():e.d);return}if("number"==(n=typeof e)){if(0===e){this.s=1/e<0?-1:1,this.e=0,this.d=[0];return}if(e<0?(e=-e,this.s=-1):this.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;z?t>o.maxE?(this.e=NaN,this.d=null):t<o.minE?(this.e=0,this.d=[0]):(this.e=t,this.d=[e]):(this.e=t,this.d=[e]);return}if(0*e!=0){e||(this.s=NaN),this.e=NaN,this.d=null;return}return ew(this,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),this.s=-1):(43===r&&(e=e.slice(1)),this.s=1),X.test(e)?ew(this,e):function(e,t){var r,n,i,o,u,a,s,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),X.test(t))return ew(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(J.test(t))r=16,t=t.toLowerCase();else if($.test(t))r=2;else if(Q.test(t))r=8;else throw Error(L+t);for((o=t.search(/p/i))>0?(s=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),u=(o=t.indexOf("."))>=0,n=e.constructor,u&&(o=(a=(t=t.replace(".","")).length)-o,i=ep(n,new n(r),o,2*o)),o=l=(c=eo(t,r,1e7)).length-1;0===c[o];--o)c.pop();return o<0?new n(0*e.s):(e.e=ec(c,l),e.d=c,z=!1,u&&(e=eu(e,i,4*a)),s&&(e=e.times(54>Math.abs(s)?Z(2,s):tr.pow(2,s))),z=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,ew(this,e.toString());throw Error(L+e)}if(o.prototype=et,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=ej,o.clone=e,o.isDecimal=eH,o.abs=eC,o.acos=ex,o.acosh=eS,o.add=eM,o.asin=eN,o.asinh=eO,o.atan=eB,o.atanh=eT,o.atan2=ek,o.cbrt=eI,o.ceil=eR,o.clamp=eP,o.cos=eY,o.cosh=eU,o.div=ez,o.exp=eV,o.floor=eL,o.hypot=eq,o.ln=eW,o.log=eG,o.log10=e$,o.log2=eZ,o.max=eJ,o.min=eQ,o.mod=eX,o.mul=eK,o.pow=e0,o.random=e1,o.round=e2,o.sign=e8,o.sin=e3,o.sinh=e5,o.sqrt=e4,o.sub=e6,o.sum=e7,o.tan=e9,o.tanh=te,o.trunc=tt,void 0===t&&(t={}),t&&!0!==t.defaults)for(r=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return o.config(t),o}(U);function tn(e){return"number"==typeof e}function ti(e){return!!e&&"object"==typeof e&&"function"==typeof e.constructor&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function to(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function tu(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function ta(e){return e&&!0===e.constructor.prototype.isUnit||!1}function ts(e){return"string"==typeof e}j=new tr(j),Y=new tr(Y);var tc=Array.isArray;function tl(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function tf(e){return Array.isArray(e)||tl(e)}function th(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function td(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function tp(e){return e&&!0===e.constructor.prototype.isRange||!1}function tm(e){return e&&!0===e.constructor.prototype.isIndex||!1}function tD(e){return"boolean"==typeof e}function tg(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function ty(e){return e&&!0===e.constructor.prototype.isHelp||!1}function tv(e){return"function"==typeof e}function tw(e){return e instanceof Date}function tE(e){return e instanceof RegExp}function t_(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!to(e)&&!tu(e))}function tA(e){return null===e}function tF(e){return void 0===e}function tb(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function tC(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function tx(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function tS(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function tM(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function tN(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function tO(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function tB(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function tT(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function tk(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function tI(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function tR(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function tP(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function tj(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function tY(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function tU(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function tz(e){return e&&!0===e.constructor.prototype.isChain||!1}function tV(e){var t=typeof e;return"object"===t?null===e?"null":ti(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function tL(e){var t=typeof e;if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return tL(e)});if(e instanceof Date)return new Date(e.valueOf());if(ti(e))return e;if(t_(e)){var r=e,n=tL,i={};for(var o in r)tH(r,o)&&(i[o]=n(r[o]));return i}throw TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function tq(e,t){var r,n,i;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!tq(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(!(e instanceof Object))return e===t;if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!tq(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}function tH(e,t){return e&&Object.hasOwnProperty.call(e,t)}function tW(e,t,r,n){function i(n){var i=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],o=e[i];void 0!==o&&(r[i]=o)}return r}(n,t.map(tG));return function(e,t,r){if(!t.filter(e=>{var t;return!((t=e)&&"?"===t[0])}).every(e=>void 0!==r[e])){var n=t.filter(e=>void 0===r[e]);throw Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(n.map(e=>'"'.concat(e,'"')).join(", "),"."))}}(e,t,n),r(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),n&&(i.meta=n),i}function tG(e){return e&&"?"===e[0]?e.slice(1):e}var tZ=tW("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=tr.clone({precision:r.precision,modulo:tr.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})}),n},{isClass:!0});let t$=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},tJ=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},tQ=function(e,t){return((e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8)?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},tX=function(){throw SyntaxError("Invalid Param")};function tK(e,t){let r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):.5*Math.log((e*=.5)*e+(t*=.5)*t)+Math.LN2}let t0={re:0,im:0},t1=function(e,t){if(null==e)t0.re=t0.im=0;else if(void 0!==t)t0.re=e,t0.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)t0.re=e.re,t0.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return t2.INFINITY;t0.re=e.abs*Math.cos(e.arg),t0.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return t2.INFINITY;t0.re=e.r*Math.cos(e.phi),t0.im=e.r*Math.sin(e.phi)}else 2===e.length?(t0.re=e[0],t0.im=e[1]):tX();break;case"string":t0.im=t0.re=0;let r=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&tX();for(let e=0;e<r.length;e++){let t=r[e];" "===t||" "===t||"\n"===t||("+"===t?n++:"-"===t?i++:("i"===t||"I"===t?(n+i===0&&tX()," "===r[e+1]||isNaN(r[e+1])?t0.im+=parseFloat((i%2?"-":"")+"1"):(t0.im+=parseFloat((i%2?"-":"")+r[e+1]),e++)):((n+i===0||isNaN(t))&&tX(),"i"===r[e+1]||"I"===r[e+1]?(t0.im+=parseFloat((i%2?"-":"")+t),e++):t0.re+=parseFloat((i%2?"-":"")+t)),n=i=0))}n+i>0&&tX();break;case"number":t0.im=0,t0.re=e;break;default:tX()}return isNaN(t0.re)||isNaN(t0.im),t0};function t2(e,t){if(!(this instanceof t2))return new t2(e,t);let r=t1(e,t);this.re=r.re,this.im=r.im}function t8(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}t2.prototype={re:0,im:0,sign:function(){let e=tQ(this.re,this.im);return new t2(this.re/e,this.im/e)},add:function(e,t){let r=t1(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?t2.NAN:t2.INFINITY:new t2(this.re+r.re,this.im+r.im)},sub:function(e,t){let r=t1(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?t2.NAN:t2.INFINITY:new t2(this.re-r.re,this.im-r.im)},mul:function(e,t){let r=t1(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,u=0===r.re&&0===r.im;return n&&u||i&&o?t2.NAN:n||i?t2.INFINITY:0===r.im&&0===this.im?new t2(this.re*r.re,0):new t2(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){let r=t1(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,u=0===r.re&&0===r.im;if(o&&u||n&&i)return t2.NAN;if(u||n)return t2.INFINITY;if(o||i)return t2.ZERO;if(0===r.im)return new t2(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){let e=r.re/r.im,t=r.re*e+r.im;return new t2((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{let e=r.im/r.re,t=r.im*e+r.re;return new t2((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){let r=t1(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return t2.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new t2(Math.pow(this.re,r.re),0);else if(0===this.re)switch((r.re%4+4)%4){case 0:return new t2(Math.pow(this.im,r.re),0);case 1:return new t2(0,Math.pow(this.im,r.re));case 2:return new t2(-Math.pow(this.im,r.re),0);case 3:return new t2(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return t2.ZERO;let i=Math.atan2(this.im,this.re),o=tK(this.re,this.im),u=Math.exp(r.re*o-r.im*i),a=r.im*o+r.re*i;return new t2(u*Math.cos(a),u*Math.sin(a))},sqrt:function(){let e=this.re,t=this.im;if(0===t)if(e>=0)return new t2(Math.sqrt(e),0);else return new t2(0,Math.sqrt(-e));let r=Math.sqrt(.5*(tQ(e,t)+Math.abs(e))),n=Math.abs(t)/(2*r);return e>=0?new t2(r,t<0?-n:n):new t2(n,t<0?-r:r)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new t2(e,0):new t2(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e,t=this.re,r=this.im;return new t2(Math.expm1(t)*Math.cos(r)+-2*(e=Math.sin(.5*r))*e,Math.exp(t)*Math.sin(r))},log:function(){let e=this.re,t=this.im;return 0===t&&e>0?new t2(Math.log(e),0):new t2(tK(e,t),Math.atan2(t,e))},abs:function(){return tQ(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,t=this.im;return new t2(Math.sin(e)*t$(t),Math.cos(e)*tJ(t))},cos:function(){let e=this.re,t=this.im;return new t2(Math.cos(e)*t$(t),-Math.sin(e)*tJ(t))},tan:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)+t$(t);return new t2(Math.sin(e)/r,tJ(t)/r)},cot:function(){let e=2*this.re,t=2*this.im,r=Math.cos(e)-t$(t);return new t2(-Math.sin(e)/r,tJ(t)/r)},sec:function(){let e=this.re,t=this.im,r=.5*t$(2*t)+.5*Math.cos(2*e);return new t2(Math.cos(e)*t$(t)/r,Math.sin(e)*tJ(t)/r)},csc:function(){let e=this.re,t=this.im,r=.5*t$(2*t)-.5*Math.cos(2*e);return new t2(Math.sin(e)*t$(t)/r,-Math.cos(e)*tJ(t)/r)},asin:function(){let e=this.re,t=this.im,r=new t2(t*t-e*e+1,-2*e*t).sqrt(),n=new t2(r.re-t,r.im+e).log();return new t2(n.im,-n.re)},acos:function(){let e=this.re,t=this.im,r=new t2(t*t-e*e+1,-2*e*t).sqrt(),n=new t2(r.re-t,r.im+e).log();return new t2(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,t=this.im;if(0===e){if(1===t)return new t2(0,1/0);if(-1===t)return new t2(0,-1/0)}let r=e*e+(1-t)*(1-t),n=new t2((1-t*t-e*e)/r,-2*e/r).log();return new t2(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,t=this.im;if(0===t)return new t2(Math.atan2(1,e),0);let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).atan():new t2(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t2(0,1/0);let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).acos():new t2(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t2(Math.PI/2,1/0);let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).asin():new t2(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){let e=this.re,t=this.im;return new t2(tJ(e)*Math.cos(t),t$(e)*Math.sin(t))},cosh:function(){let e=this.re,t=this.im;return new t2(t$(e)*Math.cos(t),tJ(e)*Math.sin(t))},tanh:function(){let e=2*this.re,t=2*this.im,r=t$(e)+Math.cos(t);return new t2(tJ(e)/r,Math.sin(t)/r)},coth:function(){let e=2*this.re,t=2*this.im,r=t$(e)-Math.cos(t);return new t2(tJ(e)/r,-Math.sin(t)/r)},csch:function(){let e=this.re,t=this.im,r=Math.cos(2*t)-t$(2*e);return new t2(-2*tJ(e)*Math.cos(t)/r,2*t$(e)*Math.sin(t)/r)},sech:function(){let e=this.re,t=this.im,r=Math.cos(2*t)+t$(2*e);return new t2(2*t$(e)*Math.cos(t)/r,-2*tJ(e)*Math.sin(t)/r)},asinh:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new t2(0,0);let t=Math.abs(e),r=Math.log(t+Math.sqrt(t*t+1));return new t2(e<0?-r:r,0)}let r=new t2(e*e-t*t+1,2*e*t).sqrt();return new t2(e+r.re,t+r.im).log()},acosh:function(){let e=this.re,t=this.im;if(0===t){if(e>1)return new t2(Math.log(e+Math.sqrt(e-1)*Math.sqrt(e+1)),0);if(e<-1){let t=Math.sqrt(e*e-1);return new t2(Math.log(-e+t),Math.PI)}return new t2(0,Math.acos(e))}let r=new t2(e-1,t).sqrt(),n=new t2(e+1,t).sqrt();return new t2(e+r.re*n.re-r.im*n.im,t+r.re*n.im+r.im*n.re).log()},atanh:function(){let e=this.re,t=this.im;if(0===t)return 0===e?new t2(0,0):1===e?new t2(1/0,0):-1===e?new t2(-1/0,0):-1<e&&e<1?new t2(.5*Math.log((1+e)/(1-e)),0):e>1?new t2(.5*Math.log((e+1)/(e-1)),-Math.PI/2):new t2(.5*Math.log(-((1+e)/(1-e))),Math.PI/2);let r=1-e,n=1+e,i=r*r+t*t;if(0===i)return new t2(-1!==e?e/0:0,0!==t?t/0:0);let o=(n*r-t*t)/i,u=(t*r+n*t)/i;return new t2(tK(o,u)/2,Math.atan2(u,o)/2)},acoth:function(){let e=this.re,t=this.im;if(0===e&&0===t)return new t2(0,Math.PI/2);let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).atanh():new t2(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){let e=this.re,t=this.im;if(0===t){if(0===e)return new t2(1/0,0);let t=1/e;return new t2(Math.log(t+Math.sqrt(t*t+1)),0)}let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).asinh():new t2(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){let e=this.re,t=this.im;if(this.isZero())return t2.INFINITY;let r=e*e+t*t;return 0!==r?new t2(e/r,-t/r).acosh():new t2(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return t2.INFINITY;if(this.isInfinite())return t2.ZERO;let e=this.re,t=this.im,r=e*e+t*t;return new t2(e/r,-t/r)},conjugate:function(){return new t2(this.re,-this.im)},neg:function(){return new t2(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new t2(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new t2(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new t2(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){let r=t1(e,t);return Math.abs(r.re-this.re)<=t2.EPSILON&&Math.abs(r.im-this.im)<=t2.EPSILON},clone:function(){return new t2(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<t2.EPSILON&&(e=0),Math.abs(t)<t2.EPSILON&&(t=0),0===t)?r+e:(0!==e?(r+=e,r+=" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),1!==t&&(r+=t),r+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},t2.ZERO=new t2(0,0),t2.ONE=new t2(1,0),t2.I=new t2(0,1),t2.PI=new t2(Math.PI,0),t2.E=new t2(Math.E,0),t2.INFINITY=new t2(1/0,1/0),t2.NAN=new t2(NaN,NaN),t2.EPSILON=1e-15;function t3(e,t,r){var n="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!t8(r))throw Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!t8(e))throw Error("Value must be an integer");e<0&&(e+=2**r),n="i".concat(r)}var i="";return e<0&&(e=-e,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[t]).concat(e.toString(t)).concat(n)}function t5(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:r,precision:n,wordSize:i}=t4(t);switch(r){case"fixed":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t6(e),n="number"==typeof t?t9(r,r.exponent+1+t):r,i=n.coefficients,o=n.exponent+1,u=o+(t||0);return i.length<u&&(i=i.concat(re(u-i.length))),o<0&&(i=re(-o+1).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),n.sign+i.join("")}(e,n);case"exponential":return t7(e,n);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t9(t6(e),t),n=r.exponent,i=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(tn(t))for(;t>i.length||n-o+1>i.length;)i.push(0);else for(var u=Math.abs(n-o)-(i.length-1),a=0;a<u;a++)i.push(0);for(var s=Math.abs(n-o),c=1;s>0;)c++,s--;var l=i.slice(c).join(""),f=tn(t)&&l.length||l.match(/[1-9]/)?"."+l:"",h=i.slice(0,c).join("")+f+"e"+(n>=0?"+":"")+o.toString();return r.sign+h}(e,n);case"bin":return t3(e,2,i);case"oct":return t3(e,8,i);case"hex":return t3(e,16,i);case"auto":return(function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=ri(null==r?void 0:r.lowerExp,-3),i=ri(null==r?void 0:r.upperExp,5),o=t6(e),u=t?t9(o,t):o;if(u.exponent<n||u.exponent>=i)return t7(e,t);var a=u.coefficients,s=u.exponent;a.length<t&&(a=a.concat(re(t-a.length))),a=a.concat(re(s-a.length+1+(a.length<t?t-a.length:0))),a=re(-s).concat(a);var c=s>0?s:0;return c<a.length-1&&a.splice(c+1,0,"."),u.sign+a.join("")})(e,n,t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function t4(e){var t,r,n="auto";if(void 0!==e)if(tn(e))t=e;else if(ti(e))t=e.toNumber();else if(t_(e))void 0!==e.precision&&(t=rn(e.precision,()=>{throw Error('Option "precision" must be a number or BigNumber')})),void 0!==e.wordSize&&(r=rn(e.wordSize,()=>{throw Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(n=e.notation);else throw Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:n,precision:t,wordSize:r}}function t6(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),o=n.indexOf(".");i+=-1!==o?o-1:n.length-1;var u=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===u.length&&(u.push(0),i++),{sign:r,coefficients:u,exponent:i}}function t7(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=t6(e),n=t?t9(r,t):r,i=n.coefficients,o=n.exponent;i.length<t&&(i=i.concat(re(t-i.length)));var u=i.shift();return n.sign+u+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function t9(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),i--,n[i]++}return r}function re(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var rt=Number.EPSILON||2220446049250313e-31;function rr(e,t,r){if(null==r)return e===t;if(e===t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var n=Math.abs(e-t);return n<=rt||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}function rn(e,t){return tn(e)?e:ti(e)?e.toNumber():void t()}function ri(e,t){return tn(e)?e:ti(e)?e.toNumber():t}var ro=tW("Complex",[],()=>(Object.defineProperty(t2,"name",{value:"Complex"}),t2.prototype.constructor=t2,t2.prototype.type="Complex",t2.prototype.isComplex=!0,t2.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},t2.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},t2.prototype.format=function(e){var t=this.im,r=this.re,n=t5(this.re,e),i=t5(this.im,e),o=tn(e)?e:e?e.precision:null;if(null!==o){var u=Math.pow(10,-o);Math.abs(r/t)<u&&(r=0),Math.abs(t/r)<u&&(t=0)}return 0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},t2.fromPolar=function(e){switch(arguments.length){case 1:var t=arguments[0];if("object"==typeof t)return t2(t);throw TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if(tn(r)){if(ta(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),tn(n))return new t2({r,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},t2.prototype.valueOf=t2.prototype.toString,t2.fromJSON=function(e){return new t2(e)},t2.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},t2),{isClass:!0}),ru=s(42),ra=tW("Fraction",[],()=>(Object.defineProperty(ru,"name",{value:"Fraction"}),ru.prototype.constructor=ru,ru.prototype.type="Fraction",ru.prototype.isFraction=!0,ru.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},ru.fromJSON=function(e){return new ru(e)},ru),{isClass:!0}),rs=tW("Matrix",[],()=>{function e(){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0});function rc(e,t,r){var n=new e.constructor(2),i="";if(r){if(r<1)throw Error("size must be in greater than 0");if(!t8(r))throw Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw Error("Base ".concat(t," not supported "))}}function rl(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function rf(e,t){return tn(e)?e:ti(e)?e.toNumber():t}function rh(e,t){var r=function(e,t){var r;if("number"==typeof e)return t5(e,t);if(ti(e))return function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r,n,i,o,u,a,s,{notation:c,precision:l,wordSize:f}=t4(t);switch(c){case"fixed":return r=e,n=l,r.toFixed(n);case"exponential":return rl(e,l);case"engineering":return i=e,o=l,a=(u=i.e)%3==0?u:u<0?u-3-u%3:u-u%3,(s=i.mul(Math.pow(10,-a)).toPrecision(o)).includes("e")&&(s=new i.constructor(s).toFixed()),s+"e"+(u>=0?"+":"")+a.toString();case"bin":return rc(e,2,f);case"oct":return rc(e,8,f);case"hex":return rc(e,16,f);case"auto":var h=rf(null==t?void 0:t.lowerExp,-3),d=rf(null==t?void 0:t.upperExp,5);if(e.isZero())return"0";var p=e.toSignificantDigits(l),m=p.e;return(m>=h&&m<d?p.toFixed():rl(e,l)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw Error('Unknown notation "'+c+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t);if((r=e)&&"object"==typeof r&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d)if(!t||"decimal"!==t.fraction)return e.s*e.n+"/"+e.d;else return e.toString();if(Array.isArray(e))return function e(t,r){if(!Array.isArray(t))return rh(t,r);for(var n="[",i=t.length,o=0;o<i;o++)0!==o&&(n+=", "),n+=e(t[o],r);return n+"]"}(e,t);if(ts(e))return rd(e);if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e)if("function"==typeof e.format)return e.format(t);else return e&&e.toString(t)!==({}).toString()?e.toString(t):"{"+Object.keys(e).map(r=>rd(r)+": "+rh(e[r],t)).join(", ")+"}";return String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function rd(e){for(var t=String(e),r="",n=0;n<t.length;){var i=t.charAt(n);r+=i in rp?rp[i]:i,n++}return'"'+r+'"'}var rp={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function rm(e,t,r){if(!(this instanceof rm))throw SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=Error().stack}function rD(e,t,r){if(!(this instanceof rD))throw SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function rg(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function ry(e,t){if(0===t.length){if(Array.isArray(e))throw new rm(e.length,0)}else!function e(t,r,n){var i,o=t.length;if(o!==r[n])throw new rm(o,r[n]);if(n<r.length-1){var u=n+1;for(i=0;i<o;i++){if(!Array.isArray(t[i]))throw new rm(r.length-1,r.length,"<");e(t[i],r,u)}}else for(i=0;i<o;i++)if(Array.isArray(t[i]))throw new rm(r.length+1,r.length,">")}(e,t,0)}function rv(e,t){if(void 0!==e){if(!tn(e)||!t8(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new rD(e,t)}}function rw(e,t,r){if(!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!tn(e)||!t8(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+rh(t)+")")}),(tn(e)||ti(e))&&(e=[e]),function e(t,r,n,i){var o,u,a=t.length,s=r[n],c=Math.min(a,s);if(t.length=s,n<r.length-1){var l=n+1;for(o=0;o<c;o++)Array.isArray(u=t[o])||(u=[u],t[o]=u),e(u,r,l,i);for(o=c;o<s;o++)u=[],t[o]=u,e(u,r,l,i)}else{for(o=0;o<c;o++)for(;Array.isArray(t[o]);)t[o]=t[o][0];for(o=c;o<s;o++)t[o]=i}}(e,t,0,void 0!==r?r:0),e}function rE(e,t){var r=function(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function e(r){Array.isArray(r)?r.forEach(e):t.push(r)}),t}(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw TypeError("Array expected");if(0===t.length)throw new rm(0,n,"!=");var i=rA(t=r_(t,n));if(n!==i)throw new rm(i,n,"!=");try{return function(e,t){for(var r,n=e,i=t.length-1;i>0;i--){var o=t[i];r=[];for(var u=n.length/o,a=0;a<u;a++)r.push(n.slice(a*o,(a+1)*o));n=r}return n}(r,t)}catch(e){if(e instanceof rm)throw new rm(i,n,"!=");throw e}}function r_(e,t){var r=rA(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(t%r==0)n[i]=-t/r;else throw Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);return n}function rA(e){return e.reduce((e,t)=>e*t,1)}function rF(e,t,r,n){var i=n||rg(e);if(r)for(var o=0;o<r;o++)e=[e],i.unshift(1);for(e=function e(t,r,n){var i,o;if(Array.isArray(t)){var u=n+1;for(i=0,o=t.length;i<o;i++)t[i]=e(t[i],r,u)}else for(var a=n;a<r;a++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function rb(e,t){for(var r,n=0,i=0;i<e.length;i++){var o=e[i],u=Array.isArray(o);if(0===i&&u&&(n=o.length),u&&o.length!==n)return;var a=u?rb(o,t):t(o);if(void 0===r)r=a;else if(r!==a)return"mixed"}return r}function rC(e,t){for(var r=t.length,n=e.length,i=0;i<n;i++){var o=r-n+i;if(e[i]<t[o]&&e[i]>1||e[i]>t[o])throw Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[i]," to size ").concat(t[o]))}}function rx(e,t){var r,n,i,o=rg(e);if(tq(o,t))return e;rC(o,t);var u=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n=t.map(e=>e.length),i=Math.max(...n),o=Array(i).fill(null),u=0;u<t.length;u++)for(var a=t[u],s=n[u],c=0;c<s;c++){var l=i-s+c;a[c]>o[l]&&(o[l]=a[c])}for(var f=0;f<t.length;f++)rC(t[f],o);return o}(o,t),a=u.length,s=[...Array(a-o.length).fill(1),...o],c=O([],e);o.length<a&&(o=rg(c=rE(c,s)));for(var l=0;l<a;l++){o[l]<u[l]&&(o=rg((r=c,n=u[l],i=l,c=function(){var e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce(function(e,r){return function e(t,r,n,i){if(!(i<n))return t.concat(r);if(t.length!==r.length)throw new rm(t.length,r.length);for(var o=[],u=0;u<t.length;u++)o[u]=e(t[u],r[u],n,i+1);return o}(e,r,t,0)},e[0]);throw Error("Wrong number of arguments in function concat")}(...Array(n).fill(r),i))))}return c}function rS(e){return Object.keys(e.signatures||{}).reduce(function(e,t){return Math.max(e,(t.match(/,/g)||[]).length+1)},-1)}rm.prototype=RangeError(),rm.prototype.constructor=RangeError,rm.prototype.name="DimensionError",rm.prototype.isDimensionError=!0,rD.prototype=RangeError(),rD.prototype.constructor=RangeError,rD.prototype.name="IndexError",rD.prototype.isIndexError=!0;var rM=tW("DenseMatrix",["Matrix"],e=>{var{Matrix:t}=e;function r(e,t){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator");if(t&&!ts(t))throw Error("Invalid datatype: "+t);if(tl(e))"DenseMatrix"===e.type?(this._data=tL(e._data),this._size=tL(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&tc(e.data)&&tc(e.size))this._data=e.data,this._size=e.size,ry(this._data,this._size),this._datatype=t||e.datatype;else if(tc(e))this._data=function e(t){return tl(t)?e(t.valueOf()):tc(t)?t.map(e):t}(e),this._size=rg(this._data),ry(this._data,this._size),this._datatype=t;else if(e)throw TypeError("Unsupported type of data ("+tV(e)+")");else this._data=[],this._size=[0],this._datatype=t}function n(e,t,r){if(0===t.length){for(var n=e._data;tc(n);)n=n[0];return n}return e._size=t.slice(0),e._data=rw(e._data,e._size,r),e}function i(e,t,r){for(var i=e._size.slice(0),o=!1;i.length<t.length;)i.push(0),o=!0;for(var u=0,a=t.length;u<a;u++)t[u]>i[u]&&(i[u]=t[u],o=!0);o&&n(e,i,r)}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return rb(this._data,tV)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return function(e,t){if(!tm(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var n=t.size();if(n.length!==e._size.length)throw new rm(n.length,e._size.length);for(var i=t.min(),o=t.max(),u=0,a=e._size.length;u<a;u++)rv(i[u],e._size[u]),rv(o[u],e._size[u]);return new r(function e(t,r,n,i){var o=i===n-1,u=r.dimension(i);return o?u.map(function(e){return rv(e,t.length),t[e]}).valueOf():u.map(function(o){return rv(o,t.length),e(t[o],r,n,i+1)}).valueOf()}(e._data,t,n.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var o,u=t.size(),a=t.isScalar();if(tl(r)?(o=r.size(),r=r.valueOf()):o=rg(r),a){if(0!==o.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(!tq(o,u))try{r=0===o.length?rx([r],u):rx(r,u),o=rg(r)}catch(e){}if(u.length<e._size.length)throw new rm(u.length,e._size.length,"<");if(o.length<u.length){for(var s=0,c=0;1===u[s]&&1===o[s];)s++;for(;1===u[s];)c++,s++;r=rF(r,u.length,c,o)}if(!tq(u,o))throw new rm(u,o,">");i(e,t.max().map(function(e){return e+1}),n);var l=u.length;!function e(t,r,n,i,o){var u=o===i-1,a=r.dimension(o);u?a.forEach(function(e,r){rv(e),t[e]=n[r[0]]}):a.forEach(function(u,a){rv(u),e(t[u],r,n[a[0]],i,o+1)})}(e._data,t,r,l,0)}return e}(this,e,t,n);default:throw SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!tc(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rm(e.length,this._size.length);for(var t=0;t<e.length;t++)rv(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var o=e[n];rv(o,r.length),r=r[o]}return r},r.prototype.set=function(e,t,r){if(!tc(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new rm(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),r);var n,o,u,a=this._data;for(n=0,o=e.length-1;n<o;n++)rv(u=e[n],a.length),a=a[u];return rv(u=e[e.length-1],a.length),a[u]=t,this},r.prototype.resize=function(e,t,r){if(!tf(e))throw TypeError("Array or Matrix expected");var i=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return n(r?this.clone():this,i,t)},r.prototype.reshape=function(e,t){var r=t?this.clone():this;r._data=rE(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=r_(e,n),r},r.prototype.clone=function(){return new r({data:tL(this._data),size:tL(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){var t=this,n=rS(e),i=function r(i,o){return tc(i)?i.map(function(e,t){return r(e,o.concat(t))}):1===n?e(i):2===n?e(i,o):e(i,o,t)}(this._data,[]),o=void 0!==this._datatype?rb(i,tV):void 0;return new r(i,o)},r.prototype.forEach=function(e){var t=this;!function r(n,i){tc(n)?n.forEach(function(e,t){r(e,i.concat(t))}):e(n,i,t)}(this._data,[])},r.prototype[Symbol.iterator]=function*(){var e=function* e(t,r){if(tc(t))for(var n=0;n<t.length;n++)yield*e(t[n],r.concat(n));else yield{value:t,index:r}};yield*e(this._data,[])},r.prototype.rows=function(){var e=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var t of this._data)e.push(new r([t],this._datatype));return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(2!==n.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,o=function(n){var o=i.map(e=>[e[n]]);t.push(new r(o,e._datatype))},u=0;u<n[1];u++)o(u);return t},r.prototype.toArray=function(){return tL(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return rh(this._data,e)},r.prototype.toString=function(){return rh(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(ti(e)&&(e=e.toNumber()),!tn(e)||!t8(e))throw TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,n=e<0?-e:0,i=Math.min(this._size[0]-n,this._size[1]-t),o=[],u=0;u<i;u++)o[u]=this._data[u+n][u+t];return new r({data:o,size:[i],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!tc(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(ti(e)&&(e=e.toNumber()),!tn(e)||!t8(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if(ti(n)&&(n=n.toNumber()),!tn(n)||!t8(n))throw TypeError("The parameter k must be an integer number")}else n=0;var o,u=n>0?n:0,a=n<0?-n:0,s=e[0],c=e[1],l=Math.min(s-a,c-u);if(tc(t)){if(t.length!==l)throw Error("Invalid value array length");o=function(e){return t[e]}}else if(tl(t)){var f=t.size();if(1!==f.length||f[0]!==l)throw Error("Invalid matrix length");o=function(e){return t.get([e])}}else o=function(){return t};i||(i=ti(o(0))?o(0).mul(0):0);var h=[];if(e.length>0){h=rw(h,e,i);for(var d=0;d<l;d++)h[d+a][d+u]=o(d)}return new r({data:h,size:[s,c]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!tn(e)||!t8(e)||!tn(t)||!t8(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return rv(e,this._size[0]),rv(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},r},{isClass:!0});function rN(){return!0}function rO(){return!1}function rB(){}let rT="Argument is not a typed-function.",rk=function e(){let t,r;function n(e){return"object"==typeof e&&null!==e&&e.constructor===Object}let i=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:n},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],o={name:"any",test:rN,isAny:!0},u=0,a={createCount:0};function s(e){let n,i=t.get(e);if(i)return i;let o='Unknown type "'+e+'"',u=e.toLowerCase();for(n of r)if(n.toLowerCase()===u){o+='. Did you mean "'+n+'" ?';break}throw TypeError(o)}function c(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any",i=n?s(n).index:r.length,o=[];for(let r=0;r<e.length;++r){if(!e[r]||"string"!=typeof e[r].name||"function"!=typeof e[r].test)throw TypeError("Object with properties {name: string, test: function} expected");let n=e[r].name;if(t.has(n))throw TypeError('Duplicate type name "'+n+'"');o.push(n),t.set(n,{name:n,test:e[r].test,isAny:e[r].isAny,index:i+r,conversionsTo:[]})}let u=r.slice(i);r=r.slice(0,i).concat(o).concat(u);for(let e=i+o.length;e<r.length;++e)t.get(r[e]).index=e}function l(){t=new Map,r=[],u=0,c([o],!1)}function f(e){let n=r.filter(r=>{let n=t.get(r);return!n.isAny&&n.test(e)});return n.length?n:["any"]}function h(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function d(e,t,r){let n,i;if(!h(e))throw TypeError(rT);let o=r&&r.exact,u=g(Array.isArray(t)?t.join(","):t),a=p(u);if(!o||a in e.signatures){let t=e._typedFunctionData.signatureMap.get(a);if(t)return t}let s=u.length;if(o){let t;for(t in n=[],e.signatures)n.push(e._typedFunctionData.signatureMap.get(t))}else n=e._typedFunctionData.signatures;for(let e=0;e<s;++e){let t,r=u[e],i=[];for(t of n){let n=w(t.params,e);if(n&&(!r.restParam||n.restParam)){if(!n.hasAny){let e=D(n);if(r.types.some(t=>!e.has(t.name)))continue}i.push(t)}}if(0===(n=i).length)break}for(i of n)if(i.params.length<=s)return i;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+p(u,", ")+"))")}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map(e=>e.name).join(t)}function m(e){let t=function(e){if(0===e.length)return[];let t=e.map(s);if(1===e.length)return t[0].conversionsTo;let r=new Set(e),n=new Set;for(let e=0;e<t.length;++e)for(let i of t[e].conversionsTo)r.has(i.from)||n.add(i.from);let i=[];for(let e of n){let r=u+1,n=null;for(let i=0;i<t.length;++i)for(let o of t[i].conversionsTo)o.from===e&&o.index<r&&(r=o.index,n=o);i.push(n)}return i}(e.types.map(e=>e.name)),r=e.hasAny,n=e.name,i=t.map(function(e){let t=s(e.from);return r=t.isAny||r,n+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}});return{types:e.types.concat(i),name:n,hasAny:r,hasConversion:i.length>0,restParam:e.restParam}}function D(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach(t=>e.typeSet.add(t.name))),e.typeSet}function g(e){let t=[];if("string"!=typeof e)throw TypeError("Signatures must be strings");let r=e.trim();if(""===r)return t;let n=r.split(",");for(let e=0;e<n.length;++e){let r=function(e){let t=0===e.indexOf("..."),r=(t?e.length>3?e.slice(3):"any":e).split("|").map(e=>s(e.trim())),n=!1,i=t?"...":"";return{types:r.map(function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}}),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:t}}(n[e].trim());if(r.restParam&&e!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===r.types.length)return null;t.push(r)}return t}function y(e){let t=O(e);return!!t&&t.restParam}function v(e){if(!e||0===e.types.length)return rN;if(1===e.types.length)return s(e.types[0].name).test;if(2===e.types.length){let t=s(e.types[0].name).test,r=s(e.types[1].name).test;return function(e){return t(e)||r(e)}}{let t=e.types.map(function(e){return s(e.name).test});return function(e){for(let r=0;r<t.length;r++)if(t[r](e))return!0;return!1}}}function w(e,t){return t<e.length?e[t]:y(e)?O(e):null}function E(e,t){let r=w(e,t);return r?D(r):new Set}function _(e){return null===e.conversion||void 0===e.conversion}function A(e,t){let r=new Set;return e.forEach(e=>{let n;for(n of E(e.params,t))r.add(n)}),r.has("any")?["any"]:Array.from(r)}function F(e,t,r){let n,i,o,u=e||"unnamed",a=r;for(o=0;o<t.length;o++){let e=[];if(a.forEach(r=>{let n=v(w(r.params,o));(o<r.params.length||y(r.params))&&n(t[o])&&e.push(r)}),0===e.length){if((i=A(a,o)).length>0){let e=f(t[o]);return(n=TypeError("Unexpected type of argument in function "+u+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+o+")")).data={category:"wrongType",fn:u,index:o,actual:e,expected:i},n}}else a=e}let s=a.map(function(e){return y(e.params)?1/0:e.params.length});if(t.length<Math.min.apply(null,s))return(n=TypeError("Too few arguments in function "+u+" (expected: "+(i=A(a,o)).join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:u,index:t.length,expected:i},n;let c=Math.max.apply(null,s);if(t.length>c)return(n=TypeError("Too many arguments in function "+u+" (expected: "+c+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:u,index:t.length,expectedLength:c},n;let l=[];for(let e=0;e<t.length;++e)l.push(f(t[e]).join("|"));return(n=TypeError('Arguments of type "'+l.join(", ")+'" do not match any of the defined signatures of function '+u+".")).data={category:"mismatch",actual:l},n}function b(e){let t=r.length+1;for(let r=0;r<e.types.length;r++)t=Math.min(t,e.types[r].typeIndex);return t}function C(e){let t=u+1;for(let r=0;r<e.types.length;r++)_(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function x(e,t){let r,n,i=e.params,o=t.params,u=O(i),a=O(o),s=y(i),c=y(o);if(s&&u.hasAny){if(!c||!a.hasAny)return 1e7}else if(c&&a.hasAny)return -1e7;let l=0,f=0;for(r of i)r.hasAny&&++l,r.hasConversion&&++f;let h=0,d=0;for(r of o)r.hasAny&&++h,r.hasConversion&&++d;if(l!==h)return(l-h)*1e6;if(s&&u.hasConversion){if(!c||!a.hasConversion)return 1e5}else if(c&&a.hasConversion)return -1e5;if(f!==d)return(f-d)*1e4;if(s){if(!c)return 1e3}else if(c)return -1e3;let p=(i.length-o.length)*(s?-100:100);if(0!==p)return p;let m=[],D=0;for(let e=0;e<i.length;++e){let t=function(e,t){if(e.hasAny){if(!t.hasAny)return .1}else if(t.hasAny)return -.1;if(e.restParam){if(!t.restParam)return .01}else if(t.restParam)return -.01;let r=b(e)-b(t);if(r<0)return -.001;if(r>0)return .001;let n=C(e),i=C(t);if(e.hasConversion){if(!t.hasConversion)return(1+n)*1e-6}else if(t.hasConversion)return-(1e-6*(1+i));let o=n-i;return o<0?-1e-7:1e-7*(o>0)}(i[e],o[e]);m.push(t),D+=t}if(0!==D)return(D<0?-10:10)+D;let g=9,v=9/(m.length+1);for(n of m){if(0!==n)return(n<0?-g:g)+n;g-=v}return 0}function S(e){let t,r,n,i,o=[],u=[],a="";e.types.forEach(function(e){e.conversion&&(a+=e.conversion.from+"~>"+e.conversion.to+",",o.push(s(e.conversion.from).test),u.push(e.conversion.convert))}),a=a?a.slice(0,-1):"pass";let c=e=>e;switch(u.length){case 0:break;case 1:t=o[0],n=u[0],c=function(e){return t(e)?n(e):e};break;case 2:t=o[0],r=o[1],n=u[0],i=u[1],c=function(e){return t(e)?n(e):r(e)?i(e):e};break;default:c=function(e){for(let t=0;t<u.length;t++)if(o[t](e))return u[t](e);return e}}return Object.defineProperty(c,"name",{value:a}),c}function M(e,t,r){throw F(e,t,r)}function N(e){return B(e,0,e.length-1)}function O(e){return e[e.length-1]}function B(e,t,r){return Array.prototype.slice.call(e,t,r)}function T(e,t){return{referTo:{references:e,callback:t}}}function k(e){if("function"!=typeof e)throw TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function I(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function R(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function P(e,t){if(!e)return t;if(t&&t!==e){let r=Error("Function names do not match (expected: "+e+", actual: "+t+")");throw r.data={actual:t,expected:e},r}return e}l(),c(i);let j=a;function Y(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return(a=function(e){let t="string"==typeof e,r=+!!t,i=t?e:"",o={};for(let e=r;e<arguments.length;++e){let r,u=arguments[e],a={};if("function"==typeof u?(r=u.name,"string"==typeof u.signature?a[u.signature]=u:h(u)&&(a=u.signatures)):n(u)&&(a=u,t||(r=function(e){let t;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(h(e[r])||"string"==typeof e[r].signature)&&(t=P(t,e[r].name));return t}(u))),0===Object.keys(a).length){let t=TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw t.data={index:e,argument:u},t}t||(i=P(i,r)),function(e,t){let r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(r in e&&t[r]!==e[r]){let n=Error('Signature "'+r+'" is defined twice');throw n.data={signature:r,sourceFunction:t[r],destFunction:e[r]},n}e[r]=t[r]}}(o,a)}return function(e,t){let r,n,i;if(a.createCount++,0===Object.keys(t).length)throw SyntaxError("No signatures provided");a.warnAgainstDeprecatedThis&&(i=/\bthis(\(|\.signatures\b)/,Object.keys(t).forEach(e=>{let r=t[e];if(i.test(r.toString()))throw SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}));let o=[],u=[],s={},c=[];for(r in t){let e;if(!Object.prototype.hasOwnProperty.call(t,r))continue;let n=g(r);if(!n)continue;o.forEach(function(e){if(function(e,t){let r=Math.max(e.length,t.length);for(let n=0;n<r;n++){let r,i=E(e,n),o=E(t,n),u=!1;for(r of o)if(i.has(r)){u=!0;break}if(!u)return!1}let n=e.length,i=t.length,o=y(e),u=y(t);return o?u?n===i:i>=n:u?n>=i:n===i}(e,n))throw TypeError('Conflicting signatures "'+p(e)+'" and "'+p(n)+'".')}),o.push(n);let i=u.length;for(e of(u.push(t[r]),function e(t,r,n){if(!(r<t.length))return[n];{var i,o;let u=t[r],a=[];if(u.restParam){let e=u.types.filter(_);e.length<u.types.length&&a.push({types:e,name:"..."+e.map(e=>e.name).join("|"),hasAny:e.some(e=>e.isAny),hasConversion:!1,restParam:!0}),a.push(u)}else a=u.types.map(function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}});return i=a,o=function(i){return e(t,r+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(o))}}(n.map(m),0,[]))){let t=p(e);c.push({params:e,name:t,fn:i}),e.every(e=>!e.hasConversion)&&(s[t]=i)}}c.sort(x);let l=function(e,t,r){let n=e.map(e=>R(e)?k(e.referToSelf.callback):I(e)?T(e.referTo.references,e.referTo.callback):e),i=Array(n.length).fill(!1),o=!0;for(;o;){o=!1;let e=!0;for(let u=0;u<n.length;++u){if(i[u])continue;let a=n[u];if(R(a))n[u]=a.referToSelf.callback(r),n[u].referToSelf=a.referToSelf,i[u]=!0,e=!1;else if(I(a)){let r=function(e,t,r){let n,i=[];for(n of e){let e=r[n];if("number"!=typeof e)throw TypeError('No definition for referenced signature "'+n+'"');if("function"!=typeof(e=t[e]))return!1;i.push(e)}return i}(a.referTo.references,n,t);r?(n[u]=a.referTo.callback.apply(this,r),n[u].referTo=a.referTo,i[u]=!0,e=!1):o=!0}}if(e&&o)throw SyntaxError("Circular reference detected in resolving typed.referTo")}return n}(u,s,el);for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(s[n]=l[s[n]]);let f=[],h=new Map;for(n of c)h.has(n.name)||(n.fn=l[n.fn],f.push(n),h.set(n.name,n));let d=f[0]&&f[0].params.length<=2&&!y(f[0].params),D=f[1]&&f[1].params.length<=2&&!y(f[1].params),w=f[2]&&f[2].params.length<=2&&!y(f[2].params),A=f[3]&&f[3].params.length<=2&&!y(f[3].params),F=f[4]&&f[4].params.length<=2&&!y(f[4].params),b=f[5]&&f[5].params.length<=2&&!y(f[5].params);for(let e=0;e<f.length;++e)f[e].test=function(e){let t,r,n;if(y(e)){let r=(t=N(e).map(v)).length,n=v(O(e)),i=function(e){for(let t=r;t<e.length;t++)if(!n(e[t]))return!1;return!0};return function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return i(e)&&e.length>=r+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=v(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=v(e[0]),n=v(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(v),function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}(f[e].params);let C=d?v(f[0].params[0]):rO,M=D?v(f[1].params[0]):rO,P=w?v(f[2].params[0]):rO,j=A?v(f[3].params[0]):rO,Y=F?v(f[4].params[0]):rO,U=b?v(f[5].params[0]):rO,z=d?v(f[0].params[1]):rO,V=D?v(f[1].params[1]):rO,L=w?v(f[2].params[1]):rO,q=A?v(f[3].params[1]):rO,H=F?v(f[4].params[1]):rO,W=b?v(f[5].params[1]):rO;for(let e=0;e<f.length;++e)f[e].implementation=function(e,t){let r=t,n="";if(e.some(e=>e.hasConversion)){let i=y(e),o=e.map(S);n=o.map(e=>e.name).join(";"),r=function(){let e=[],r=i?arguments.length-1:arguments.length;for(let t=0;t<r;t++)e[t]=o[t](arguments[t]);return i&&(e[r]=arguments[r].map(o[r])),t.apply(this,e)}}let i=r;if(y(e)){let t=e.length-1;i=function(){return r.apply(this,B(arguments,0,t).concat([B(arguments,t)]))}}return n&&Object.defineProperty(i,"name",{value:n}),i}(f[e].params,f[e].fn);let G=d?f[0].implementation:rB,Z=D?f[1].implementation:rB,$=w?f[2].implementation:rB,J=A?f[3].implementation:rB,Q=F?f[4].implementation:rB,X=b?f[5].implementation:rB,K=d?f[0].params.length:-1,ee=D?f[1].params.length:-1,et=w?f[2].params.length:-1,er=A?f[3].params.length:-1,en=F?f[4].params.length:-1,ei=b?f[5].params.length:-1,eo=6*!!(d&&D&&w&&A&&F&&b),eu=f.length,ea=f.map(e=>e.test),es=f.map(e=>e.implementation),ec=function(){for(let e=eo;e<eu;e++)if(ea[e](arguments))return es[e].apply(this,arguments);return a.onMismatch(e,arguments,f)};function el(e,t){return arguments.length===K&&C(e)&&z(t)?G.apply(this,arguments):arguments.length===ee&&M(e)&&V(t)?Z.apply(this,arguments):arguments.length===et&&P(e)&&L(t)?$.apply(this,arguments):arguments.length===er&&j(e)&&q(t)?J.apply(this,arguments):arguments.length===en&&Y(e)&&H(t)?Q.apply(this,arguments):arguments.length===ei&&U(e)&&W(t)?X.apply(this,arguments):ec.apply(this,arguments)}try{Object.defineProperty(el,"name",{value:e})}catch(e){}return el.signatures=s,el._typedFunctionData={signatures:f,signatureMap:h},el}(i||"",o)}).create=e,a.createCount=j.createCount,a.onMismatch=M,a.throwMismatchError=M,a.createError=F,a.clear=l,a.clearConversions=function(){let e;for(e of r)t.get(e).conversionsTo=[];u=0},a.addTypes=c,a._findType=s,a.referTo=function(){let e=N(arguments).map(e=>p(g(e))),t=O(arguments);if("function"!=typeof t)throw TypeError("Callback function expected as last argument");return T(e,t)},a.referToSelf=k,a.convert=function(e,t){let r=s(t);if(r.test(e))return e;let n=r.conversionsTo;if(0===n.length)throw Error("There are no conversions to "+t+" defined.");for(let t=0;t<n.length;t++)if(s(n[t].from).test(e))return n[t].convert(e);throw Error("Cannot convert "+e+" to "+t)},a.findSignature=d,a.find=function(e,t,r){return d(e,t,r).implementation},a.isTypedFunction=h,a.warnAgainstDeprecatedThis=!0,a.addType=function(e,r){let n="any";!1!==r&&t.has("Object")&&(n="Object"),a.addTypes([e],n)},a.addConversion=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};Y(e);let r=s(e.to),n=r.conversionsTo.find(t=>t.from===e.from);if(n)if(t&&t.override)a.removeConversion({from:n.from,to:e.to,convert:n.convert});else throw Error('There is already a conversion from "'+e.from+'" to "'+r.name+'"');r.conversionsTo.push({from:e.from,to:r.name,convert:e.convert,index:u++})},a.addConversions=function(e,t){e.forEach(e=>a.addConversion(e,t))},a.removeConversion=function(e){Y(e);let t=s(e.to),r=function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return e[r]}(t.conversionsTo,t=>t.from===e.from);if(!r)throw Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(r.convert!==e.convert)throw Error("Conversion to remove does not match existing conversion");let n=t.conversionsTo.indexOf(r);t.conversionsTo.splice(n,1)},a.resolve=function(e,t){if(!h(e))throw TypeError(rT);let r=e._typedFunctionData.signatures;for(let e=0;e<r.length;++e)if(r[e].test(t))return r[e];return null},a}();function rI(e,t){return!!e&&"object"==typeof e&&(!!tH(rP,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function rR(e){return"object"==typeof e&&e&&e.constructor===Object}var rP={length:!0,name:!0},rj={toString:!0,valueOf:!0,toLocaleString:!0};class rY{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){var t,r,n=this.wrappedObject;if(rR(n)&&rI(n,e))return n[e];if("function"==typeof n[e]&&(t=n,r=e,!(null==t||"function"!=typeof t[r]||tH(t,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(t))&&(tH(rj,r)||!(r in Object.prototype)&&!(r in Function.prototype))))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}set(e,t){return!function(e,t,r){if(rR(e)&&rI(e,t))return e[t]=r;throw Error('No access to property "'+t+'"')}(this.wrappedObject,e,t),this}has(e){return e in this.wrappedObject}entries(){var e,t;return e=this.keys(),t=e=>[e,this.get(e)],{next:()=>{var r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}forEach(e){for(var t of this.keys())e(this.get(t),t,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}function rU(e){return!!e&&(e instanceof Map||e instanceof rY||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var rz=function(){return rz=rk.create,rk},rV=tW("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,o=rz();return o.clear(),o.addTypes([{name:"number",test:tn},{name:"Complex",test:to},{name:"BigNumber",test:ti},{name:"Fraction",test:tu},{name:"Unit",test:ta},{name:"identifier",test:e=>ts&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(e)},{name:"string",test:ts},{name:"Chain",test:tz},{name:"Array",test:tc},{name:"Matrix",test:tl},{name:"DenseMatrix",test:th},{name:"SparseMatrix",test:td},{name:"Range",test:tp},{name:"Index",test:tm},{name:"boolean",test:tD},{name:"ResultSet",test:tg},{name:"Help",test:ty},{name:"function",test:tv},{name:"Date",test:tw},{name:"RegExp",test:tE},{name:"null",test:tA},{name:"undefined",test:tF},{name:"AccessorNode",test:tb},{name:"ArrayNode",test:tC},{name:"AssignmentNode",test:tx},{name:"BlockNode",test:tS},{name:"ConditionalNode",test:tM},{name:"ConstantNode",test:tN},{name:"FunctionNode",test:tB},{name:"FunctionAssignmentNode",test:tO},{name:"IndexNode",test:tT},{name:"Node",test:tk},{name:"ObjectNode",test:tI},{name:"OperatorNode",test:tR},{name:"ParenthesisNode",test:tP},{name:"RangeNode",test:tj},{name:"RelationalNode",test:tY},{name:"SymbolNode",test:tU},{name:"Map",test:rU},{name:"Object",test:t_}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(t||rL(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return r||rq(e),new r(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return r||rq(e),new r(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return r||rq(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||rH(e);var t=new i(e);if(t.valueOf()!==e)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||rL(e);try{return new t(e)}catch(t){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||rH(e);try{return new i(e)}catch(t){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||rq(e);try{return new r(e)}catch(t){throw Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||rL(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||rH(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),o.onMismatch=(e,t,r)=>{var n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&tf(t[0])&&r.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},o.onMismatch=(e,t,r)=>{var n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&tf(t[0])&&r.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},o});function rL(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function rq(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function rH(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}function rW(e,t,r){return e&&"function"==typeof e.map?e.map(function(e){return rW(e,t,r)}):t(e)}var rG="number",rZ="number, number";function r$(e){return Math.abs(e)}function rJ(e,t){return e+t}function rQ(e,t){return e-t}function rX(e,t){return e*t}function rK(e){return-e}r$.signature=rG,rJ.signature=rZ,rQ.signature=rZ,rX.signature=rZ,rK.signature=rG;var r0=tW("abs",["typed"],e=>{var{typed:t}=e;return t("abs",{number:r$,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),"Array | Matrix":t.referToSelf(e=>t=>rW(t,e,!0))})}),r1="addScalar",r2=tW(r1,["typed"],e=>{var{typed:t}=e;return t(r1,{"number, number":rJ,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(null===r.value||void 0===r.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),r8=tW("bignumber",["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var n=t[2],i=r(t[1]),o=new r(2).pow(Number(n));if(i.gt(o.sub(1)))throw SyntaxError('String "'.concat(e,'" is out of range'));var u=new r(2).pow(Number(n)-1);return i.gte(u)?i.sub(o):i}return new r(e)},BigNumber:function(e){return e},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),Fraction:function(e){return new r(e.n).div(e.d).times(e.s)},null:function(e){return new r(0)},"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))})}),r3="conj",r5=tW(r3,["typed"],e=>{var{typed:t}=e;return t(r3,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))})}),r4=tW("compareUnits",["typed"],e=>{var{typed:t}=e;return{"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(!r.equalBase(n))throw Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)})}}),r6="equalScalar",r7=tW(r6,["typed","config"],e=>{var{typed:t,config:r}=e,n=r4({typed:t});return t(r6,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return rr(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||function(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){var n;return n=r.epsilon,rr(e.re,t.re,n)&&rr(e.im,t.im,n)}},n)});tW(r6,["typed","config"],e=>{var{typed:t,config:r}=e;return t(r6,{"number, number":function(e,t){return rr(e,t,r.epsilon)}})});function r9(e){return 0===e}r9.signature="number";var ne="isZero",nt=tW(ne,["typed"],e=>{var{typed:t}=e;return t(ne,{number:r9,BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:t.referToSelf(e=>r=>t.find(e,r.valueType())(r.value)),"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))})}),nr=tW("multiplyScalar",["typed"],e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":rX,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})}),nn=tW("number",["typed"],e=>{var{typed:t}=e,r=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var t=function(e){var t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(!t)return null;var r={"0b":2,"0o":8,"0x":16}[t[1]];return{input:e,radix:r,integerPart:t[2],fractionalPart:t[3]}}(e);if(t){for(var r=parseInt(t.integerPart,t.radix),n=0,i=0;i<t.fractionalPart.length;i++)n+=parseInt(t.fractionalPart[i],t.radix)/Math.pow(t.radix,i+1);var o=r+n;if(isNaN(o))throw SyntaxError('String "'+t.input+'" is not a valid number');return o}var u=0,a=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);a&&(u=Number(a[2]),e=a[1]);var s=Number(e);if(isNaN(s))throw SyntaxError('String "'+e+'" is not a valid number');if(a){if(s>2**u-1)throw SyntaxError('String "'.concat(e,'" is out of range'));s>=2**(u-1)&&(s-=2**u)}return s},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))});return r.fromJSON=function(e){return parseFloat(e.value)},r}),ni=tW("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(e,t){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(t&&!ts(t))throw Error("Invalid datatype: "+t);if(tl(e)){var r,n,u;r=this,n=e,u=t,"SparseMatrix"===n.type?(r._values=n._values?tL(n._values):void 0,r._index=tL(n._index),r._ptr=tL(n._ptr),r._size=tL(n._size),r._datatype=u||n._datatype):o(r,n.valueOf(),u||n._datatype)}else if(e&&tc(e.index)&&tc(e.ptr)&&tc(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(tc(e))o(this,e,t);else if(e)throw TypeError("Unsupported type of data ("+tV(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}function o(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var o=n.length,u=0,a=r,s=0;if(ts(i)&&(a=t.find(r,[i,i])||r,s=t.convert(0,i)),o>0){var c=0;do{e._ptr.push(e._index.length);for(var l=0;l<o;l++){var f=n[l];if(tc(f)){if(0===c&&u<f.length&&(u=f.length),c<f.length){var h=f[c];a(h,s)||(e._values.push(h),e._index.push(l))}}else 0===c&&u<1&&(u=1),a(f,s)||(e._values.push(f),e._index.push(l))}c++}while(c<u)}e._ptr.push(e._index.length),e._size=[o,u]}function u(e,t,r,n){if(r-t==0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t}function a(e,t,r,n,i,o,u){i.splice(e,0,n),o.splice(e,0,t);for(var a=r+1;a<u.length;a++)u[a]++}function s(e,n,i,o){var u,a,s,c=o||0,l=r,f=0;ts(e._datatype)&&(l=t.find(r,[e._datatype,e._datatype])||r,f=t.convert(0,e._datatype),c=t.convert(c,e._datatype));var h=!l(c,f),d=e._size[0],p=e._size[1];if(i>p){for(a=p;a<i;a++)if(e._ptr[a]=e._values.length,h)for(u=0;u<d;u++)e._values.push(c),e._index.push(u);e._ptr[i]=e._values.length}else i<p&&(e._ptr.splice(i+1,p-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(p=i,n>d){if(h){var m=0;for(a=0;a<p;a++){e._ptr[a]=e._ptr[a]+m,s=e._ptr[a+1]+m;var D=0;for(u=d;u<n;u++,D++)e._values.splice(s+D,0,c),e._index.splice(s+D,0,u),m++}e._ptr[p]=e._values.length}}else if(n<d){var g=0;for(a=0;a<p;a++){e._ptr[a]=e._ptr[a]-g;var y=e._ptr[a],v=e._ptr[a+1]-g;for(s=y;s<v;s++)(u=e._index[s])>n-1&&(e._values.splice(s,1),e._index.splice(s,1),g++)}e._ptr[a]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function c(e,t,r,n,i){var o,u,a=n[0],s=n[1],c=[];for(o=0;o<a;o++)for(c[o]=[],u=0;u<s;u++)c[o][u]=0;for(u=0;u<s;u++)for(var l=r[u],f=r[u+1],h=l;h<f;h++)c[o=t[h]][u]=e?i?tL(e[h]):e[h]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return rb(this._values,tV)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,r){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!tm(t))throw TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r,n,o,u,a=t.size();if(a.length!==e._size.length)throw new rm(a.length,e._size.length);var s=t.min(),c=t.max();for(r=0,n=e._size.length;r<n;r++)rv(s[r],e._size[r]),rv(c[r],e._size[r]);var l=e._values,f=e._index,h=e._ptr,d=t.dimension(0),p=t.dimension(1),m=[],D=[];d.forEach(function(e,t){D[e]=t[0],m[e]=!0});var g=l?[]:void 0,y=[],v=[];return p.forEach(function(e){for(v.push(y.length),o=h[e],u=h[e+1];o<u;o++)!0===m[r=f[o]]&&(y.push(D[r]),g&&g.push(l[o]))}),v.push(y.length),new i({values:g,index:y,ptr:v,size:a,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw TypeError("Invalid index");var i,o=t.size(),u=t.isScalar();if(tl(r)?(i=r.size(),r=r.toArray()):i=rg(r),u){if(0!==i.length)throw TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==o.length&&2!==o.length)throw new rm(o.length,e._size.length,"<");if(i.length<o.length){for(var a=0,s=0;1===o[a]&&1===i[a];)a++;for(;1===o[a];)s++,a++;r=rF(r,o.length,s,i)}if(!tq(o,i))throw new rm(o,i,">");if(1===o.length)t.dimension(0).forEach(function(t,i){rv(t),e.set([t,0],r[i[0]],n)});else{var c=t.dimension(0),l=t.dimension(1);c.forEach(function(t,i){rv(t),l.forEach(function(o,u){rv(o),e.set([t,o],r[i[0]][u[0]],n)})})}}return e}(this,e,t,r);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!tc(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rm(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var t=e[0],r=e[1];rv(t,this._size[0]),rv(r,this._size[1]);var n=u(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},i.prototype.set=function(e,n,i){if(!tc(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new rm(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var o=e[0],c=e[1],l=this._size[0],f=this._size[1],h=r,d=0;ts(this._datatype)&&(h=t.find(r,[this._datatype,this._datatype])||r,d=t.convert(0,this._datatype)),(o>l-1||c>f-1)&&(s(this,Math.max(o+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),rv(o,l),rv(c,f);var p=u(o,this._ptr[c],this._ptr[c+1],this._index);return p<this._ptr[c+1]&&this._index[p]===o?h(n,d)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var o=t+1;o<i.length;o++)i[o]--}(p,c,this._values,this._index,this._ptr):this._values[p]=n:h(n,d)||a(p,o,c,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!tf(e))throw TypeError("Array or Matrix expected");var n=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(e){if(!tn(e)||!t8(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+rh(n)+")")}),s(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!tc(e))throw TypeError("Array expected");if(2!==e.length)throw Error("Sparse matrices can only be reshaped in two dimensions");e.forEach(function(t){if(!tn(t)||!t8(t)||t<=-2||0===t)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+rh(e)+")")});var r=this._size[0]*this._size[1],n=(e=r_(e,r))[0]*e[1];if(r!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return i;for(var o=[],s=0;s<i._ptr.length;s++)for(var c=0;c<i._ptr[s+1]-i._ptr[s];c++)o.push(s);for(var l=i._values.slice(),f=i._index.slice(),h=0;h<i._index.length;h++){var d=f[h],p=o[h],m=d*i._size[1]+p;o[h]=m%e[1],f[h]=Math.floor(m/e[1])}i._values.length=0,i._index.length=0,i._ptr.length=e[1]+1,i._size=e.slice();for(var D=0;D<i._ptr.length;D++)i._ptr[D]=0;for(var g=0;g<l.length;g++){var y=f[g],v=o[g],w=l[g];a(u(y,i._ptr[v],i._ptr[v+1],i._index),y,v,w,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?tL(this._values):void 0,index:tL(this._index),ptr:tL(this._ptr),size:tL(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var o=this,u=this._size[0],a=this._size[1],s=rS(e);return function(e,n,o,u,a){var s=[],c=[],l=[],f=r,h=0;ts(e._datatype)&&(f=t.find(r,[e._datatype,e._datatype])||r,h=t.convert(0,e._datatype));for(var d=function(e,t,r){e=u(e,t,r),f(e,h)||(s.push(e),c.push(t))},p=0;p<=o;p++){l.push(s.length);var m=e._ptr[p],D=e._ptr[p+1];if(a)for(var g=m;g<D;g++){var y=e._index[g];y>=0&&y<=n&&d(e._values[g],y-0,p-0)}else{for(var v={},w=m;w<D;w++)v[e._index[w]]=e._values[w];for(var E=0;E<=n;E++)d(E in v?v[E]:0,E-0,p-0)}}return l.push(s.length),new i({values:s,index:c,ptr:l,size:[n-0+1,o-0+1]})}(this,u-1,a-1,function(t,r,n){return 1===s?e(t):2===s?e(t,[r,n]):e(t,[r,n],o)},n)},i.prototype.forEach=function(e,t){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var o=this._ptr[i],u=this._ptr[i+1];if(t)for(var a=o;a<u;a++){var s=this._index[a];e(this._values[a],[s,i],this)}else{for(var c={},l=o;l<u;l++)c[this._index[l]]=this._values[l];for(var f=0;f<r;f++)e(f in c?c[f]:0,[f,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],t=0;t<e;t++)for(var r=this._ptr[t],n=this._ptr[t+1],i=r;i<n;i++){var o=this._index[i];yield{value:this._values[i],index:[o,t]}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+rh(t,e)+" x "+rh(r,e)+"] density: "+rh(n,e)+"\n",o=0;o<r;o++)for(var u=this._ptr[o],a=this._ptr[o+1],s=u;s<a;s++)i+="\n ("+rh(this._index[s],e)+", "+rh(o,e)+") ==> "+(this._values?rh(this._values[s],e):"X");return i},i.prototype.toString=function(){return rh(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(ti(e)&&(e=e.toNumber()),!tn(e)||!t8(e))throw TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],o=this._size[1],u=Math.min(n-r,o-t),a=[],s=[],c=[];c[0]=0;for(var l=t;l<o&&a.length<u;l++)for(var f=this._ptr[l],h=this._ptr[l+1],d=f;d<h;d++){var p=this._index[d];if(p===l-t+r){a.push(this._values[d]),s[a.length-1]=p-r;break}}return c.push(a.length),new i({values:a,index:s,ptr:c,size:[u,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,o,u,a){if(!tc(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(ti(e)&&(e=e.toNumber()),!tn(e)||!t8(e)||e<1)throw Error("Size values must be positive integers");return e}),o){if(ti(o)&&(o=o.toNumber()),!tn(o)||!t8(o))throw TypeError("The parameter k must be an integer number")}else o=0;var s,c=r,l=0;ts(a)&&(c=t.find(r,[a,a])||r,l=t.convert(0,a));var f=o>0?o:0,h=o<0?-o:0,d=e[0],p=e[1],m=Math.min(d-h,p-f);if(tc(n)){if(n.length!==m)throw Error("Invalid value array length");s=function(e){return n[e]}}else if(tl(n)){var D=n.size();if(1!==D.length||D[0]!==m)throw Error("Invalid matrix length");s=function(e){return n.get([e])}}else s=function(){return n};for(var g=[],y=[],v=[],w=0;w<p;w++){v.push(g.length);var E=w-f;if(E>=0&&E<m){var _=s(E);c(_,l)||(y.push(E+h),g.push(_))}}return v.push(g.length),new i({values:g,index:y,ptr:v,size:[d,p]})},i.prototype.swapRows=function(e,t){if(!tn(e)||!t8(e)||!tn(t)||!t8(t))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return rv(e,this._size[0]),rv(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,r,n,i){for(var o=n[e],u=n[e+1],a=o;a<u;a++)i(r[a],t[a])},i._swapRows=function(e,t,r,n,i,o){for(var a=0;a<r;a++){var s=o[a],c=o[a+1],l=u(e,s,c,i),f=u(t,s,c,i);if(l<c&&f<c&&i[l]===e&&i[f]===t){if(n){var h=n[l];n[l]=n[f],n[f]=h}continue}if(l<c&&i[l]===e&&(f>=c||i[f]!==t)){var d=n?n[l]:void 0;i.splice(f,0,t),n&&n.splice(f,0,d),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1);continue}if(f<c&&i[f]===t&&(l>=c||i[l]!==e)){var p=n?n[f]:void 0;i.splice(l,0,e),n&&n.splice(l,0,p),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}}},i},{isClass:!0}),no="subtractScalar",nu=tW(no,["typed"],e=>{var{typed:t}=e;return t(no,{"number, number":rQ,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf(e=>(r,n)=>{if(null===r.value||void 0===r.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),na="unaryMinus",ns=tW(na,["typed"],e=>{var{typed:t}=e;return t(na,{number:rK,"Complex | BigNumber | Fraction":e=>e.neg(),Unit:t.referToSelf(e=>r=>{var n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n}),"Array | Matrix":t.referToSelf(e=>t=>rW(t,e,!0))})}),nc=tW("fraction",["typed","Fraction"],e=>{var{typed:t,Fraction:r}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf(e=>t=>{var r=t.clone();return r.value=e(t.value),r}),Object:function(e){return new r(e)},"Array | Matrix":t.referToSelf(e=>t=>rW(t,e))})}),nl="matrix",nf=tW(nl,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(nl,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw TypeError("Unknown matrix type "+JSON.stringify(t)+".")}});function nh(){throw Error('No "bignumber" implementation available')}function nd(){throw Error('No "fraction" implementation available')}var np=tW("numeric",["number","?bignumber","?fraction"],e=>{var{number:t,bignumber:r,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:e=>t(e),BigNumber:r?e=>r(e):nh,Fraction:n?e=>n(e):nd};return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=arguments.length>2?arguments[2]:void 0;if(void 0!==r)throw SyntaxError("numeric() takes one or two arguments");var n=tV(e);if(!(n in i))throw TypeError("Cannot convert "+e+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in o))throw TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(o).join(", "));return t===n?e:o[t](e)}}),nm="size",nD=tW(nm,["typed","config","?matrix"],e=>{var{typed:t,config:r,matrix:n}=e;return t(nm,{Matrix:function(e){return e.create(e.size())},Array:rg,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([]):function(){throw Error('No "matrix" implementation available')}()}})}),ng="divideScalar",ny=tW(ng,["typed","numeric"],e=>{var{typed:t,numeric:r}=e;return t(ng,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})}),nv="identity",nw=tW(nv,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:o,SparseMatrix:u}=e;return t(nv,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return s(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return s(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return s(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return s(e,t,r)},Array:function(e){return a(e)},"Array, string":function(e,t){return a(e,t)},Matrix:function(e){return a(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return a(e.valueOf(),t)}});function a(e,t){switch(e.length){case 0:return t?n(t):[];case 1:return s(e[0],e[0],t);case 2:return s(e[0],e[1],t);default:throw Error("Vector containing two values expected")}}function s(e,t,r){var n=ti(e)||ti(t)?i:null;if(ti(e)&&(e=e.toNumber()),ti(t)&&(t=t.toNumber()),!t8(e)||e<1||!t8(t)||t<1)throw Error("Parameters in function identity must be positive integers");var a=n?new i(1):1,s=n?new n(0):0,c=[e,t];if(r){if("sparse"===r)return u.diagonal(c,a,0,s);if("dense"===r)return o.diagonal(c,a,0,s);throw TypeError('Unknown matrix type "'.concat(r,'"'))}for(var l=rw([],c,s),f=e<t?e:t,h=0;h<f;h++)l[h][h]=a;return l}}),nE=tW("dot",["typed","addScalar","multiplyScalar","conj","size"],e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:o}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,o){var s=u(e,o),c=tl(e)?e._data:e,l=tl(e)?e._datatype||e.getDataType():void 0,f=tl(o)?o._data:o,h=tl(o)?o._datatype||o.getDataType():void 0,d=2===a(e).length,p=2===a(o).length,m=r,D=n;if(l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(m=t.find(r,[l,l]),D=t.find(n,[l,l])),!d&&!p){for(var g=D(i(c[0]),f[0]),y=1;y<s;y++)g=m(g,D(i(c[y]),f[y]));return g}if(!d&&p){for(var v=D(i(c[0]),f[0][0]),w=1;w<s;w++)v=m(v,D(i(c[w]),f[w][0]));return v}if(d&&!p){for(var E=D(i(c[0][0]),f[0]),_=1;_<s;_++)E=m(E,D(i(c[_][0]),f[_]));return E}if(d&&p){for(var A=D(i(c[0][0]),f[0][0]),F=1;F<s;F++)A=m(A,D(i(c[F][0]),f[F][0]));return A}},"SparseMatrix, SparseMatrix":function(e,t){u(e,t);for(var i=e._index,o=e._values,a=t._index,s=t._values,c=0,l=0,f=0;l<i.length&&f<a.length;){var h=i[l],d=a[f];if(h<d){l++;continue}if(h>d){f++;continue}h===d&&(c=r(c,n(o[l],s[f])),l++,f++)}return c}});function u(e,t){var r,n,i=a(e),o=a(t);if(1===i.length)r=i[0];else if(2===i.length&&1===i[1])r=i[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");if(1===o.length)n=o[0];else if(2===o.length&&1===o[1])n=o[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+o.join(", ")+")");if(r!==n)throw RangeError("Vectors must have equal length ("+r+" != "+n+")");if(0===r)throw RangeError("Cannot calculate the dot product of empty vectors");return r}function a(e){return tl(e)?e.size():o(e)}}),n_=tW("matAlgo11xS0s",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i,o){var u,a=e._values,s=e._index,c=e._ptr,l=e._size,f=e._datatype;if(!a)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=l[0],d=l[1],p=r,m=0,D=i;"string"==typeof f&&(u=f,p=t.find(r,[u,u]),m=t.convert(0,u),n=t.convert(n,u),D=t.find(i,[u,u]));for(var g=[],y=[],v=[],w=0;w<d;w++){v[w]=y.length;for(var E=c[w],_=c[w+1],A=E;A<_;A++){var F=s[A],b=o?D(n,a[A]):D(a[A],n);p(b,m)||(y.push(F),g.push(b))}}return v[d]=y.length,e.createSparseMatrix({values:g,index:y,ptr:v,size:[h,d],datatype:u})}}),nA=tW("matAlgo14xDs",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var o,u=e._data,a=e._size,s=e._datatype,c=n;"string"==typeof s&&(o=s,r=t.convert(r,o),c=t.find(n,[o,o]));var l=a.length>0?function e(t,r,n,i,o,u,a){var s=[];if(r===n.length-1)for(var c=0;c<i;c++)s[c]=a?t(u,o[c]):t(o[c],u);else for(var l=0;l<i;l++)s[l]=e(t,r+1,n,n[r+1],o[l],u,a);return s}(c,0,a,a[0],u,r,i):[];return e.createDenseMatrix({data:l,size:tL(a),datatype:o})}}),nF="multiply",nb=tW(nF,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:o,dot:u}=e,a=n_({typed:t,equalScalar:o}),s=nA({typed:t});function c(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}var l=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,r){var o,u=e._data,a=e._size,s=e._datatype||e.getDataType(),c=r._data,l=r._datatype||r.getDataType(),f=a[0],h=a[1],d=n,p=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&(o=s,d=t.find(n,[o,o]),p=t.find(i,[o,o]));for(var m=[],D=0;D<f;D++){for(var g=u[D],y=p(g[0],c[0]),v=1;v<h;v++)y=d(y,p(g[v],c[v]));m[D]=y}return e.createDenseMatrix({data:m,size:[f],datatype:s===e._datatype&&l===r._datatype?o:void 0})},"SparseMatrix, any":function(e,r){var u,a=e._values,s=e._index,c=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=r._data,h=r._datatype||r.getDataType(),d=e._size[0],p=r._size[0],m=[],D=[],g=[],y=n,v=i,w=o,E=0;l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(u=l,y=t.find(n,[u,u]),v=t.find(i,[u,u]),w=t.find(o,[u,u]),E=t.convert(0,u));var _=[],A=[];g[0]=0;for(var F=0;F<p;F++){var b=f[F];if(!w(b,E))for(var C=c[F],x=c[F+1],S=C;S<x;S++){var M=s[S];A[M]?_[M]=y(_[M],v(b,a[S])):(A[M]=!0,D.push(M),_[M]=v(b,a[S]))}}for(var N=D.length,O=0;O<N;O++){var B=D[O];m[O]=_[B]}return g[1]=D.length,e.createSparseMatrix({values:m,index:D,ptr:g,size:[d,1],datatype:l===e._datatype&&h===r._datatype?u:void 0})}}),f=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,r){var o,u=e._data,a=e._size,s=e._datatype||e.getDataType(),c=r._data,l=r._size,f=r._datatype||r.getDataType(),h=a[0],d=a[1],p=l[1],m=n,D=i;s&&f&&s===f&&"string"==typeof s&&"mixed"!==s&&"mixed"!==s&&(o=s,m=t.find(n,[o,o]),D=t.find(i,[o,o]));for(var g=[],y=0;y<h;y++){var v=u[y];g[y]=[];for(var w=0;w<p;w++){for(var E=D(v[0],c[0][w]),_=1;_<d;_++)E=m(E,D(v[_],c[_][w]));g[y][w]=E}}return e.createDenseMatrix({data:g,size:[h,p],datatype:s===e._datatype&&f===r._datatype?o:void 0})},"DenseMatrix, SparseMatrix":function(e,r){var u,a=e._data,s=e._size,c=e._datatype||e.getDataType(),l=r._values,f=r._index,h=r._ptr,d=r._size,p=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(!l)throw Error("Cannot multiply Dense Matrix times Pattern only Matrix");var m=s[0],D=d[1],g=n,y=i,v=o,w=0;c&&p&&c===p&&"string"==typeof c&&"mixed"!==c&&(u=c,g=t.find(n,[u,u]),y=t.find(i,[u,u]),v=t.find(o,[u,u]),w=t.convert(0,u));for(var E=[],_=[],A=[],F=r.createSparseMatrix({values:E,index:_,ptr:A,size:[m,D],datatype:c===e._datatype&&p===r._datatype?u:void 0}),b=0;b<D;b++){A[b]=_.length;var C=h[b],x=h[b+1];if(x>C)for(var S=0,M=0;M<m;M++){for(var N=M+1,O=void 0,B=C;B<x;B++){var T=f[B];S!==N?(O=y(a[M][T],l[B]),S=N):O=g(O,y(a[M][T],l[B]))}S!==N||v(O,w)||(_.push(M),E.push(O))}}return A[D]=_.length,F},"SparseMatrix, DenseMatrix":function(e,r){var u,a=e._values,s=e._index,c=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=r._data,h=r._datatype||r.getDataType(),d=e._size[0],p=r._size[0],m=r._size[1],D=n,g=i,y=o,v=0;l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(u=l,D=t.find(n,[u,u]),g=t.find(i,[u,u]),y=t.find(o,[u,u]),v=t.convert(0,u));for(var w=[],E=[],_=[],A=e.createSparseMatrix({values:w,index:E,ptr:_,size:[d,m],datatype:l===e._datatype&&h===r._datatype?u:void 0}),F=[],b=[],C=0;C<m;C++){_[C]=E.length;for(var x=C+1,S=0;S<p;S++){var M=f[S][C];if(!y(M,v))for(var N=c[S],O=c[S+1],B=N;B<O;B++){var T=s[B];b[T]!==x?(b[T]=x,E.push(T),F[T]=g(M,a[B])):F[T]=D(F[T],g(M,a[B]))}}for(var k=_[C],I=E.length,R=k;R<I;R++){var P=E[R];w[R]=F[P]}}return _[m]=E.length,A},"SparseMatrix, SparseMatrix":function(e,r){var o,u,a,s,c,l,f,h,d,p=e._values,m=e._index,D=e._ptr,g=e._datatype||void 0===e._data?e._datatype:e.getDataType(),y=r._values,v=r._index,w=r._ptr,E=r._datatype||void 0===r._data?r._datatype:r.getDataType(),_=e._size[0],A=r._size[1],F=p&&y,b=n,C=i;g&&E&&g===E&&"string"==typeof g&&"mixed"!==g&&(o=g,b=t.find(n,[o,o]),C=t.find(i,[o,o]));for(var x=F?[]:void 0,S=[],M=[],N=e.createSparseMatrix({values:x,index:S,ptr:M,size:[_,A],datatype:g===e._datatype&&E===r._datatype?o:void 0}),O=F?[]:void 0,B=[],T=0;T<A;T++){M[T]=S.length;var k=T+1;for(l=w[T],f=w[T+1],c=l;c<f;c++)if(d=v[c],F)for(a=D[d],s=D[d+1],u=a;u<s;u++)B[h=m[u]]!==k?(B[h]=k,S.push(h),O[h]=C(y[c],p[u])):O[h]=b(O[h],C(y[c],p[u]));else for(a=D[d],s=D[d+1],u=a;u<s;u++)B[h=m[u]]!==k&&(B[h]=k,S.push(h));if(F)for(var I=M[T],R=S.length,P=I;P<R;P++){var j=S[P];x[P]=O[j]}}return M[A]=S.length,N}});return t(nF,i,{"Array, Array":t.referTo("Matrix, Matrix",e=>(t,n)=>{c(rg(t),rg(n));var i=e(r(t),r(n));return tl(i)?i.valueOf():i}),"Matrix, Matrix":function(e,r){var o=e.size(),a=r.size();if(c(o,a),1===o.length){if(1===a.length){if(0===o[0])throw Error("Cannot multiply two empty vectors");return u(e,r)}if("dense"!==r.storage())throw Error("Support for SparseMatrix not implemented");return function(e,r){var o,u=e._data,a=e._size,s=e._datatype||e.getDataType(),c=r._data,l=r._size,f=r._datatype||r.getDataType(),h=a[0],d=l[1],p=n,m=i;s&&f&&s===f&&"string"==typeof s&&"mixed"!==s&&(o=s,p=t.find(n,[o,o]),m=t.find(i,[o,o]));for(var D=[],g=0;g<d;g++){for(var y=m(u[0],c[0][g]),v=1;v<h;v++)y=p(y,m(u[v],c[v][g]));D[g]=y}return e.createDenseMatrix({data:D,size:[d],datatype:s===e._datatype&&f===r._datatype?o:void 0})}(e,r)}return 1===a.length?l(e,r):f(e,r)},"Matrix, Array":t.referTo("Matrix,Matrix",e=>(t,n)=>e(t,r(n))),"Array, Matrix":t.referToSelf(e=>(t,n)=>e(r(t,n.storage()),n)),"SparseMatrix, any":function(e,t){return a(e,t,i,!1)},"DenseMatrix, any":function(e,t){return s(e,t,i,!1)},"any, SparseMatrix":function(e,t){return a(t,e,i,!0)},"any, DenseMatrix":function(e,t){return s(t,e,i,!0)},"Array, any":function(e,t){return s(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return s(r(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf(e=>(t,r,n)=>{for(var i=e(t,r),o=0;o<n.length;o++)i=e(i,n[o]);return i})})}),nC=tW("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],e=>{var{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:o,isZero:u,unaryMinus:a}=e;return t("det",{any:function(e){return tL(e)},"Array | Matrix":function(e){var t;switch((t=tl(e)?e.size():Array.isArray(e)?(e=r(e)).size():[]).length){case 0:return tL(e);case 1:if(1===t[0])return tL(e.valueOf()[0]);if(0===t[0])return 1;throw RangeError("Matrix must be square (size: "+rh(t)+")");case 2:var s=t[0],c=t[1];if(s===c)return function(e,t){if(1===t)return tL(e[0][0]);if(2===t)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var r=!1,s=Array(t).fill(0).map((e,t)=>t),c=0;c<t;c++){var l=s[c];if(u(e[l][c])){var f=void 0;for(f=c+1;f<t;f++)if(!u(e[s[f]][c])){l=s[f],s[f]=s[c],s[c]=l,r=!r;break}if(f===t)return e[l][c]}for(var h=e[l][c],d=0===c?1:e[s[c-1]][c-1],p=c+1;p<t;p++)for(var m=s[p],D=c+1;D<t;D++)e[m][D]=o(n(i(e[m][D],h),i(e[m][c],e[l][D])),d)}var g=e[s[t-1]][t-1];return r?a(g):g}(e.clone().valueOf(),s);if(0===c)return 1;throw RangeError("Matrix must be square (size: "+rh(t)+")");default:throw RangeError("Matrix must be two dimensional (size: "+rh(t)+")")}}})}),nx=tW("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],e=>{var{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:o,unaryMinus:u,det:a,identity:s,abs:c}=e;return t("inv",{"Array | Matrix":function(e){var t=tl(e)?e.size():rg(e);switch(t.length){case 1:if(1===t[0])if(tl(e))return r([n(1,e.valueOf()[0])]);else return[n(1,e[0])];throw RangeError("Matrix must be square (size: "+rh(t)+")");case 2:var i=t[0],o=t[1];if(i===o)if(tl(e))return r(l(e.valueOf(),i,o),e.storage());else return l(e,i,o);throw RangeError("Matrix must be square (size: "+rh(t)+")");default:throw RangeError("Matrix must be two dimensional (size: "+rh(t)+")")}},any:function(e){return n(1,e)}});function l(e,t,r){if(1===t){if(0===(d=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,d)]]}if(2===t){var l,f,h,d,p,m=a(e);if(0===m)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],m),n(u(e[0][1]),m)],[n(u(e[1][0]),m),n(e[0][0],m)]]}var D=e.concat();for(l=0;l<t;l++)D[l]=D[l].concat();for(var g=s(t).valueOf(),y=0;y<r;y++){var v=c(D[y][y]),w=y;for(l=y+1;l<t;)c(D[l][y])>v&&(v=c(D[l][y]),w=l),l++;if(0===v)throw Error("Cannot calculate inverse, determinant is zero");(l=w)!==y&&(p=D[y],D[y]=D[l],D[l]=p,p=g[y],g[y]=g[l],g[l]=p);var E=D[y],_=g[y];for(l=0;l<t;l++){var A=D[l],F=g[l];if(l!==y){if(0!==A[y]){for(h=n(u(A[y]),E[y]),f=y;f<r;f++)A[f]=i(A[f],o(h,E[f]));for(f=0;f<r;f++)F[f]=i(F[f],o(h,_[f]))}}else{for(h=E[y],f=y;f<r;f++)A[f]=n(A[f],h);for(f=0;f<r;f++)F[f]=n(F[f],h)}}}return g}}),nS=tZ({config:T}),nM=ro({}),nN=ra({}),nO=rs({}),nB=rM({Matrix:nO}),nT=rV({BigNumber:nS,Complex:nM,DenseMatrix:nB,Fraction:nN}),nk=r0({typed:nT}),nI=r2({typed:nT}),nR=r8({BigNumber:nS,typed:nT}),nP=r5({typed:nT}),nj=r7({config:T,typed:nT}),nY=nt({typed:nT}),nU=nr({typed:nT}),nz=nn({typed:nT}),nV=ni({Matrix:nO,equalScalar:nj,typed:nT}),nL=nu({typed:nT}),nq=ns({typed:nT}),nH=nc({Fraction:nN,typed:nT}),nW=nf({DenseMatrix:nB,Matrix:nO,SparseMatrix:nV,typed:nT}),nG=np({bignumber:nR,fraction:nH,number:nz}),nZ=nD({matrix:nW,config:T,typed:nT}),n$=ny({numeric:nG,typed:nT}),nJ=nw({BigNumber:nS,DenseMatrix:nB,SparseMatrix:nV,config:T,matrix:nW,typed:nT}),nQ=nE({addScalar:nI,conj:nP,multiplyScalar:nU,size:nZ,typed:nT}),nX=nb({addScalar:nI,dot:nQ,equalScalar:nj,matrix:nW,multiplyScalar:nU,typed:nT}),nK=nx({abs:nk,addScalar:nI,det:nC({divideScalar:n$,isZero:nY,matrix:nW,multiply:nX,subtractScalar:nL,typed:nT,unaryMinus:nq}),divideScalar:n$,identity:nJ,matrix:nW,multiply:nX,typed:nT,unaryMinus:nq});function n0(e,t){var r;let n=!1;Array.isArray(e[0])||(e=[e],n=!0);let i=t[t.length-1],o=i.ImageOrientationSlide,u=(r=i).PixelSpacing?r.PixelSpacing:r.SharedFunctionalGroupsSequence[0].PixelMeasuresSequence[0].PixelSpacing,a=i.TotalPixelMatrixOriginSequence[0],s=[Number(a.XOffsetInSlideCoordinateSystem),Number(a.YOffsetInSlideCoordinateSystem)];return(e=e.map(e=>{let t=function(e){if(!("offset"in e))throw Error('Option "offset" is required.');if(!Array.isArray(e.offset))throw Error('Option "offset" must be an array.');if(2!==e.offset.length)throw Error('Option "offset" must be an array with 2 elements.');let t=e.offset;if(!("orientation"in e))throw Error('Option "orientation" is required.');if(!Array.isArray(e.orientation))throw Error('Option "orientation" must be an array.');if(6!==e.orientation.length)throw Error('Option "orientation" must be an array with 6 elements.');let r=e.orientation;if(!("spacing"in e))throw Error('Option "spacing" is required.');if(!Array.isArray(e.spacing))throw Error('Option "spacing" must be an array.');if(2!==e.spacing.length)throw Error('Option "spacing" must be an array with 2 elements.');let n=e.spacing;if(!("point"in e))throw Error('Option "point" is required.');if(!Array.isArray(e.point))throw Error('Option "point" must be an array.');if(2!==e.point.length)throw Error('Option "point" must be an array with 2 elements.');let i=e.point,o=nX(nK([[r[0]*n[1],r[3]*n[0],t[0]],[r[1]*n[1],r[4]*n[0],t[1]],[0,0,1]]),[[i[0]],[i[1]],[1]]),u=Number(o[1][0].toFixed(4));return[Number(o[0][0].toFixed(4)),u]}({offset:s,orientation:o,spacing:u,point:[e[0],e[1]]});return[t[0],-(t[1]+1),0]}),n)?e[0]:e}let n1={color:"rgba(255,255,255,0.4)"},n2={color:"rgba(255,255,255,0.0)"},n8={color:"rgb(0,255,0)",width:1.5},n3={color:"rgb(255,255,0)",width:1.5},n5={image:{circle:{fill:n1,stroke:n3,radius:5}},fill:n1,stroke:n3},n4={image:{circle:{fill:n2,stroke:n8,radius:5}},fill:n2,stroke:n8},n6="dicommicroscopyviewer_roi_added",n7="dicommicroscopyviewer_roi_modified",n9="dicommicroscopyviewer_roi_removed",ie="dicommicroscopyviewer_roi_selected",it={ADDED:"added",MODIFIED:"modified",REMOVED:"removed",UPDATED:"updated",SELECTED:"selected"};class ir extends i.PubSubService{constructor(e,t,r,n,i){super(it),this.viewer=e,this.viewportId=t,this.container=r,this.studyInstanceUID=n,this.seriesInstanceUID=i,this.onRoiAdded=this.roiAddedHandler.bind(this),this.onRoiModified=this.roiModifiedHandler.bind(this),this.onRoiRemoved=this.roiRemovedHandler.bind(this),this.onRoiSelected=this.roiSelectedHandler.bind(this),this.contextMenuCallback=()=>{};const o=Object.getOwnPropertySymbols(this.viewer);this._drawingSource=o.find(e=>"drawingSource"===e.description),this._pyramid=o.find(e=>"pyramid"===e.description),this._map=o.find(e=>"map"===e.description),this._affine=o.find(e=>"affine"===e.description),this.registerEvents(),this.activateDefaultInteractions()}addContextMenuCallback(e){this.contextMenuCallback=e}destroy(){this.unregisterEvents()}publish(e,t){this._broadcastEvent(e,{roiGraphic:t,managedViewer:this})}registerEvents(){this.container.addEventListener(n6,this.onRoiAdded),this.container.addEventListener(n7,this.onRoiModified),this.container.addEventListener(n9,this.onRoiRemoved),this.container.addEventListener(ie,this.onRoiSelected)}unregisterEvents(){this.container.removeEventListener(n6,this.onRoiAdded),this.container.removeEventListener(n7,this.onRoiModified),this.container.removeEventListener(n9,this.onRoiRemoved),this.container.removeEventListener(ie,this.onRoiSelected)}roiAddedHandler(e){let t=e.detail.payload;this.publish(it.ADDED,t),this.publish(it.UPDATED,t)}roiModifiedHandler(e){let t=e.detail.payload;this.publish(it.MODIFIED,t),this.publish(it.UPDATED,t)}roiRemovedHandler(e){let t=e.detail.payload;this.publish(it.REMOVED,t),this.publish(it.UPDATED,t)}roiSelectedHandler(e){let t=e.detail.payload;this.publish(it.SELECTED,t)}runSilently(e){this.unregisterEvents(),e(),this.registerEvents()}clearRoiGraphics(){this.runSilently(()=>this.viewer.removeAllROIs())}showROIs(){this.viewer.showROIs()}hideROIs(){this.viewer.hideROIs()}addRoiGraphic(e){this.runSilently(()=>this.viewer.addROI(e,n4))}addRoiGraphicWithLabel(e,t){this.runSilently(()=>this.viewer.addROI(e,n4)),this._broadcastEvent(it.ADDED,{roiGraphic:e,managedViewer:this,label:t})}setROIStyle(e,t){this.viewer.setROIStyle(e,t)}removeRoiGraphic(e){this.viewer.removeROI(e)}updateROIProperties({uid:e,properties:t}){this.viewer.updateROI({uid:e,properties:t})}toggleOverviewMap(){this.viewer.toggleOverviewMap()}activateDefaultInteractions(){document.querySelector(".DicomMicroscopyViewer").addEventListener("contextmenu",e=>{e.preventDefault()},!1),this.activateInteractions([["dragPan",{bindings:{mouseButtons:["middle"]}}],["dragZoom",{bindings:{mouseButtons:["right"]}}],["modify",{}]])}activateInteractions(e){let t={draw:e=>e?"activateDrawInteraction":"deactivateDrawInteraction",modify:e=>e?"activateModifyInteraction":"deactivateModifyInteraction",translate:e=>e?"activateTranslateInteraction":"deactivateTranslateInteraction",snap:e=>e?"activateSnapInteraction":"deactivateSnapInteraction",dragPan:e=>e?"activateDragPanInteraction":"deactivateDragPanInteraction",dragZoom:e=>e?"activateDragZoomInteraction":"deactivateDragZoomInteraction",select:e=>e?"activateSelectInteraction":"deactivateSelectInteraction"};Object.keys(t).forEach(r=>{let n=e.find(e=>e[0]===r);if(n){let[e,r]=n,i=t[e](!0);this.viewer[i](r)}else{let e=t[r](!1);this.viewer[e]()}})}_getMapView(){return this._getMap().getView()}_getMap(){let e=Object.getOwnPropertySymbols(this.viewer).find(e=>"Symbol(map)"===String(e));return window.map=this.viewer[e],this.viewer[e]}getViewState(){let e=this._getMapView();return{center:e.getCenter(),resolution:e.getResolution(),zoom:e.getZoom()}}setViewState(e){let t=this._getMapView();t.setZoom(e.zoom),t.setResolution(e.resolution),t.setCenter(e.center)}setViewStateByExtent(e){let t=e.getCoordinates();Array.isArray(t[0])&&!t[2]?this._jumpToPolyline(t):Array.isArray(t[0])?this._jumpToPolygonOrEllipse(t):this._jumpToPoint(t)}_jumpToPoint(e){let t=n0(e,this.viewer[this._pyramid].metadata);this._getMapView().setCenter(t)}_jumpToPolyline(e){let t=n0(e,this.viewer[this._pyramid].metadata),r=this._getMapView(),n=t[0],i=t[1],o=(n[0]+i[0])/2,u=(n[1]+i[1])/2;r.setCenter([o,u])}_jumpToPolygonOrEllipse(e){let t=this.viewer[this._pyramid].metadata,r=1/0,n=-1/0,i=1/0,o=-1/0;e.forEach(e=>{let[u,a]=n0(e,t);u<r?r=u:u>n&&(n=u),a<i?i=a:a>o&&(o=a)});let u=n-r,a=o-i;r-=.5*u,n+=.5*u,i-=.5*a,o+=.5*a;let s=this._getMap();s.getView().fit([r,i,n,o],s.getSize())}}var ii=s(545),io=s.n(ii);let iu={LABEL_UPDATED:"labelUpdated",GRAPHIC_UPDATED:"graphicUpdated",VIEW_UPDATED:"viewUpdated",REMOVED:"removed"};class ia extends i.PubSubService{constructor(e,t,r,n="",i=null){super(iu),this.uid=e.uid,this.roiGraphic=e,this.studyInstanceUID=t,this.seriesInstanceUID=r,this.label=n,this.viewState=i,this.setMeasurements(e)}getScoord3d(){let e=this.roiGraphic,t=Object.getOwnPropertySymbols(e).find(e=>"Symbol(scoord3d)"===String(e));return e[t]}getCoordinates(){let e=this.getScoord3d(),t=Object.getOwnPropertySymbols(e).find(e=>"Symbol(coordinates)"===String(e));return e[t]}destroy(){this._broadcastEvent(iu.REMOVED,this)}setRoiGraphic(e){this.roiGraphic=e,this.setMeasurements(),this._broadcastEvent(iu.GRAPHIC_UPDATED,this)}setMeasurements(){let e=this.roiGraphic.scoord3d.graphicType,t=this.roiGraphic.scoord3d.graphicData;switch(e){case"ELLIPSE":let r=t[0],n=t[1],i=n[0]-r[0],o=n[1]-r[1];i*=i,o*=o;let u=Math.sqrt(i+o),a=u/2,s=Math.PI*a*a;this._area=s,this._length=void 0;break;case"POLYGON":let c=function(e){let t=e.length,r=0,n=t-1;for(let i=0;i<t;i++)r+=(e[n][0]+e[i][0])*(e[n][1]-e[i][1]),n=i;return Math.abs(r/2)}(t);this._area=c,this._length=void 0;break;case"POINT":this._area=void 0,this._length=void 0;break;case"POLYLINE":let l=0;for(let e=1;e<t.length;e++){let r=t[e-1],n=t[e],i=n[0]-r[0],o=n[1]-r[1];i*=i,o*=o,l+=Math.sqrt(i+o)}this._area=void 0,this._length=l}}setViewState(e){this.viewState=e,this._broadcastEvent(iu.VIEW_UPDATED,this)}setLabel(e,t){this.label=e||t&&t.CodeMeaning,this.finding=t||{CodingSchemeDesignator:"@ohif/extension-dicom-microscopy",CodeValue:e,CodeMeaning:e},this._broadcastEvent(iu.LABEL_UPDATED,this)}getLabel(){return this.label?`${this.label}`:""}getDetailedLabel(){let e=io()?.t("MeasurementTable:empty")||"(empty)";return this.label?`${this.label}`:e}getLength(){return this._length}getArea(){return this._area}}function is(e,t,r){var n;return(t="symbol"==typeof(n=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?n:n+"")in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ic={ANNOTATION_UPDATED:"annotationUpdated",ANNOTATION_SELECTED:"annotationSelected",ANNOTATION_REMOVED:"annotationRemoved",RELABEL:"relabel",DELETE:"delete"};class il extends i.PubSubService{constructor({servicesManager:e,extensionManager:t}){super(ic),is(this,"servicesManager",void 0),is(this,"managedViewers",new Set),is(this,"roiUids",new Set),is(this,"annotations",{}),is(this,"selectedAnnotation",null),is(this,"pendingFocus",!1),this.servicesManager=e,this.peerImport=t.appConfig.peerImport,this._onRoiAdded=this._onRoiAdded.bind(this),this._onRoiModified=this._onRoiModified.bind(this),this._onRoiRemoved=this._onRoiRemoved.bind(this),this._onRoiUpdated=this._onRoiUpdated.bind(this),this._onRoiSelected=this._onRoiSelected.bind(this),this.isROIsVisible=!0}clear(){for(let e in this.managedViewers.forEach(e=>e.destroy()),this.managedViewers.clear(),this.annotations)delete this.annotations[e];this.roiUids.clear(),this.selectedAnnotation=null,this.pendingFocus=!1}clearAnnotations(){Object.keys(this.annotations).forEach(e=>{this.removeAnnotation(this.annotations[e])})}importDicomMicroscopyViewer(){return this.peerImport("dicom-microscopy-viewer")}_onRoiAdded(e){let{roiGraphic:t,managedViewer:r,label:n}=e,{studyInstanceUID:i,seriesInstanceUID:o}=r,u=new ia(t,i,o,"",r.getViewState());this.roiUids.add(t.uid),this.annotations[t.uid]=u,u.subscribe(iu.LABEL_UPDATED,()=>{this._broadcastEvent(ic.ANNOTATION_UPDATED,u)}),void 0!==n?u.setLabel(n):this.triggerRelabel(u,!0,e=>r.updateROIProperties({uid:t.uid,properties:{label:e.label,finding:e.finding}}))}_onRoiModified(e){let{roiGraphic:t,managedViewer:r}=e,n=this.getAnnotation(t.uid);n&&(n.setRoiGraphic(t),n.setViewState(r.getViewState()))}_onRoiRemoved(e){let{roiGraphic:t}=e;this.roiUids.delete(t.uid),this.annotations[t.uid].destroy(),delete this.annotations[t.uid],this._broadcastEvent(ic.ANNOTATION_REMOVED,t)}_onRoiUpdated(e){let{roiGraphic:t,managedViewer:r}=e;this.synchronizeViewers(r),this._broadcastEvent(ic.ANNOTATION_UPDATED,this.getAnnotation(t.uid))}_onRoiSelected(e){let{roiGraphic:t}=e,r=this.getAnnotation(t.uid);r&&r!==this.getSelectedAnnotation()&&(this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=r,this._broadcastEvent(ic.ANNOTATION_SELECTED,r))}_addManagedViewerSubscriptions(e){e._roiAddedSubscription=e.subscribe(it.ADDED,this._onRoiAdded),e._roiModifiedSubscription=e.subscribe(it.MODIFIED,this._onRoiModified),e._roiRemovedSubscription=e.subscribe(it.REMOVED,this._onRoiRemoved),e._roiUpdatedSubscription=e.subscribe(it.UPDATED,this._onRoiUpdated),e._roiSelectedSubscription=e.subscribe(it.UPDATED,this._onRoiSelected)}_removeManagedViewerSubscriptions(e){e._roiAddedSubscription&&e._roiAddedSubscription.unsubscribe(),e._roiModifiedSubscription&&e._roiModifiedSubscription.unsubscribe(),e._roiRemovedSubscription&&e._roiRemovedSubscription.unsubscribe(),e._roiUpdatedSubscription&&e._roiUpdatedSubscription.unsubscribe(),e._roiSelectedSubscription&&e._roiSelectedSubscription.unsubscribe(),e._roiAddedSubscription=null,e._roiModifiedSubscription=null,e._roiRemovedSubscription=null,e._roiUpdatedSubscription=null,e._roiSelectedSubscription=null}_getManagedViewersForSeries(e,t){return Array.from(this.managedViewers).filter(r=>r.studyInstanceUID===e&&r.seriesInstanceUID===t)}getManagedViewersForStudy(e){return Array.from(this.managedViewers).filter(t=>t.studyInstanceUID===e)}getManagedViewersForViewport(e){return Array.from(this.managedViewers).filter(t=>t.viewportId===e)}_restoreAnnotations(e){let{studyInstanceUID:t,seriesInstanceUID:r}=e;this.getAnnotationsForSeries(t,r).forEach(t=>{e.addRoiGraphic(t.roiGraphic)})}addViewer(e,t,r,n,i){let o=Array.from(this.managedViewers).find(e=>e.viewportId===t);o&&this.removeViewer(o.viewer);let u=new ir(e,t,r,n,i);return this._restoreAnnotations(u),e._manager=u,this.managedViewers.add(u),this._addManagedViewerSubscriptions(u),this.pendingFocus&&(this.pendingFocus=!1,this.focusAnnotation(this.selectedAnnotation,t)),u}_potentiallyLoadSR(e,t){let r=i.DicomMetadataStore.getStudy(e),n=t.find(e=>"SM"===e.Modality),{FrameOfReferenceUID:o,othersFrameOfReferenceUID:u}=n;if(!r)return;let a=o?t.filter(e=>e.ReferencedFrameOfReferenceUID===o||u.includes(e.ReferencedFrameOfReferenceUID)):[];if(!a.length||(a=a.filter(e=>"SR"===e.Modality)).some(e=>!0===e.isLoaded))return;let s=0,c=a[0];a.forEach(e=>{let t=Number(`${e.SeriesDate}${e.SeriesTime}`);t>s&&(s=t,c=e)}),c.isLoading||(c.isLoading=!0,c.load(n))}removeViewer(e){let t=e._manager;this._removeManagedViewerSubscriptions(t),t.destroy(),this.managedViewers.delete(t)}toggleROIsVisibility(){this.isROIsVisible?this.hideROIs():this.showROIs,this.isROIsVisible=!this.isROIsVisible}hideROIs(){this.managedViewers.forEach(e=>e.hideROIs())}showROIs(){this.managedViewers.forEach(e=>e.showROIs())}getAnnotation(e){return this.annotations[e]}getAnnotations(){let e=[];return Object.keys(this.annotations).forEach(t=>{e.push(this.getAnnotation(t))}),e}getAnnotationsForStudy(e){return this.getAnnotations().filter(t=>t.studyInstanceUID===e)}getAnnotationsForSeries(e,t){return this.getAnnotations().filter(r=>r.studyInstanceUID===e&&r.seriesInstanceUID===t)}getSelectedAnnotation(){return this.selectedAnnotation}clearSelection(){this.selectedAnnotation&&this.setROIStyle(this.selectedAnnotation.uid,{stroke:{color:"#00ff00"}}),this.selectedAnnotation=null}selectAnnotation(e){this.selectedAnnotation&&this.clearSelection(),this.selectedAnnotation=e,this._broadcastEvent(ic.ANNOTATION_SELECTED,e),this.setROIStyle(e.uid,n5)}toggleOverviewMap(e){let t=Array.from(this.managedViewers).find(t=>t.viewportId===e);t&&t.toggleOverviewMap()}removeAnnotation(e){let{uid:t,studyInstanceUID:r,seriesInstanceUID:n}=e;Array.from(this.managedViewers).filter(e=>e.studyInstanceUID===r&&e.seriesInstanceUID===n).forEach(e=>e.removeRoiGraphic(t)),this.annotations[t]&&(this.roiUids.delete(t),this.annotations[t].destroy(),delete this.annotations[t],this._broadcastEvent(ic.ANNOTATION_REMOVED,e))}focusAnnotation(e,t){let r=Array.from(this.managedViewers).find(e=>e.viewportId===t);r?r.setViewStateByExtent(e):this.pendingFocus=!0}synchronizeViewers(e){let{studyInstanceUID:t,seriesInstanceUID:r}=e,n=this._getManagedViewersForSeries(t,r);n.forEach(e=>this._removeManagedViewerSubscriptions(e)),n.forEach(n=>{if(n===e)return;let i=this.getAnnotationsForSeries(t,r);n.clearRoiGraphics(),i.forEach(e=>{n.addRoiGraphic(e.roiGraphic)})}),n.forEach(e=>this._addManagedViewerSubscriptions(e))}activateInteractions(e){this.managedViewers.forEach(t=>t.activateInteractions(e)),this.activeInteractions=e}getActiveInteractions(){return this.activeInteractions}triggerRelabel(e,t=!1,r){r||(r=({label:t})=>this.managedViewers.forEach(r=>r.updateROIProperties({uid:e.uid,properties:{label:t}}))),this._broadcastEvent(ic.RELABEL,{roiAnnotation:e,deleteCallback:()=>this.removeAnnotation(e),successCallback:r,newAnnotation:t})}triggerDelete(e){this._broadcastEvent(ic.DELETE,e)}setROIStyle(e,t){this.managedViewers.forEach(r=>r.setROIStyle(e,t))}getAllManagedViewers(){return Array.from(this.managedViewers)}}is(il,"REGISTRATION",e=>({name:"microscopyService",altName:"MicroscopyService",create:e=>new il(e)}));var ih=s(111),id=s.n(ih);let{downloadDicom:ip}=i.utils,{datasetToBuffer:im}=id().data,iD=(e,t)=>{let r=1;if("km"==t||!t&&e>1e6)t="km",r=1e-6;else if("m"==t||!t&&e>1e3)t="m",r=.001;else if("μm"==t||!t&&e<1)t="μm",r=1e3;else if(t&&"mm"!=t)throw Error(`Unknown length unit ${t}`);else t="mm";return`${(e*r).toFixed(2)} ${t}`},ig=(function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){function i(i){var o=i.forwardedRef,a=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(i,S),s=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.i18n,i=(0,t.useContext)(p)||{},o=i.i18n,a=i.defaultNS,s=n||o||k;if(s&&!s.reportNamespaces&&(s.reportNamespaces=new m),!s){E("You will need to pass in an i18next instance by using initReactI18next");var c=function(e,t){return"string"==typeof t?t:t&&"object"===u(t)&&"string"==typeof t.defaultValue?t.defaultValue:Array.isArray(e)?e[e.length-1]:e},l=[c,{},!1];return l.t=c,l.i18n={},l.ready=!1,l}s.options.react&&void 0!==s.options.react.wait&&E("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=C(C(C({},d),s.options.react),r),h=f.useSuspense,D=f.keyPrefix,y=e||a||s.options&&s.options.defaultNS;y="string"==typeof y?[y]:y||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(y);var v=(s.isInitialized||s.initializedStoreOnce)&&y.every(function(e){return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.languages&&t.languages.length?void 0===t.options.ignoreJSONStructure?function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.languages[0],i=!!t.options&&t.options.fallbackLng,o=t.languages[t.languages.length-1];if("cimode"===n.toLowerCase())return!0;var u=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return -1===n||2===n};return(!(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1)||!t.services.backendConnector.backend||!t.isLanguageChangingTo||!!u(t.isLanguageChangingTo,e))&&!!(t.hasResourceBundle(n,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||u(n,e)&&(!i||u(o,e)))}(e,t,r):t.hasLoadedNamespace(e,{lng:r.lng,precheck:function(t,n){if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!n(t.isLanguageChangingTo,e))return!1}}):(E("i18n.languages were undefined or empty",t.languages),!0)}(e,s,f)});function w(){return s.getFixedT(r.lng||null,"fallback"===f.nsMode?y:y[0],D)}var _=g((0,t.useState)(w),2),b=_[0],S=_[1],M=y.join();r.lng&&(M="".concat(r.lng).concat(M));var N=x(M),O=(0,t.useRef)(!0);(0,t.useEffect)(function(){var e=f.bindI18n,t=f.bindI18nStore;function n(){O.current&&S(w)}return O.current=!0,v||h||(r.lng?F(s,r.lng,y,function(){O.current&&S(w)}):A(s,y,function(){O.current&&S(w)})),v&&N&&N!==M&&O.current&&S(w),e&&s&&s.on(e,n),t&&s&&s.store.on(t,n),function(){O.current=!1,e&&s&&e.split(" ").forEach(function(e){return s.off(e,n)}),t&&s&&t.split(" ").forEach(function(e){return s.store.off(e,n)})}},[s,M]);var B=(0,t.useRef)(!0);(0,t.useEffect)(function(){O.current&&!B.current&&S(w),B.current=!1},[s,D]);var T=[b,s,v];if(T.t=b,T.i18n=s,T.ready=v,v||!v&&!h)return T;throw new Promise(function(e){r.lng?F(s,r.lng,y,function(){return e()}):A(s,y,function(){return e()})})}(e,N(N({},a),{},{keyPrefix:r.keyPrefix})),c=g(s,3),l=c[0],f=c[1],h=c[2],D=N(N({},a),{},{t:l,i18n:f,tReady:h});return r.withRef&&o?D.ref=o:!r.withRef&&o&&(D.forwardedRef=o),(0,t.createElement)(n,D)}return i.displayName="withI18nextTranslation(".concat(n.displayName||n.name||("string"==typeof n&&n.length>0?n:"Unknown"),")"),i.WrappedComponent=n,r.withRef?(0,t.forwardRef)(function(e,r){return(0,t.createElement)(i,Object.assign({},e,{forwardedRef:r}))}):i}})(["MicroscopyTable","Common"])(function(e){let{microscopyService:n}=e.servicesManager.services,[i,o]=(0,t.useState)(null),[u,a]=(0,t.useState)([]),[s,c]=(0,t.useState)(null),{servicesManager:l,extensionManager:f}=e,{uiDialogService:h,displaySetService:d}=l.services;(0,t.useEffect)(()=>{let t=e.viewports.get(e.activeViewportId);if(t?.displaySetInstanceUIDs[0]){let e=d.getDisplaySetByUID(t.displaySetInstanceUIDs[0]);e&&o(e.StudyInstanceUID)}},[e.viewports,e.activeViewportId]),(0,t.useEffect)(()=>{let e=()=>{a(n.getAnnotationsForStudy(i))},t=()=>{c(n.getSelectedAnnotation())},{unsubscribe:r}=n.subscribe(ic.ANNOTATION_UPDATED,e),{unsubscribe:o}=n.subscribe(ic.ANNOTATION_SELECTED,t),{unsubscribe:u}=n.subscribe(ic.ANNOTATION_REMOVED,()=>{e()});return e(),t(),()=>{r(),o(),u()}},[i]);let p=u.map((e,t)=>{let r=e.getDetailedLabel(),n=e.getArea(),i=e.getLength(),o=e.roiGraphic.properties.shortAxisLength,u=s===e,{uid:a}=e,c=[];if(void 0!==n){let e,t;c.push((e=1,t="mm",n>1e6?(t="m",e=1e-6):n<1&&(t="μm",e=1e6),`${(n*e).toFixed(2)} ${t}\xb2`))}else void 0!==i&&c.push(o?`${iD(i,"μm")} x ${iD(o,"μm")}`:`${iD(i,"μm")}`);return{uid:a,index:t,label:r,isActive:u,displayText:c,roiAnnotation:e}});return t.createElement(t.Fragment,null,t.createElement("div",{className:"ohif-scrollbar overflow-y-auto overflow-x-hidden","data-cy":"measurements-panel"},t.createElement("div",{className:"flex flex-col"},p.map(i=>t.createElement(r.DataRow,{key:i.uid,number:i.index+1,title:i.label,isSelected:i.isActive,onSelect:()=>(({uid:t})=>{let r=n.getAnnotation(t);n.selectAnnotation(r),n.focusAnnotation(r,e.activeViewportId)})({uid:i.uid}),details:{primary:i.displayText,secondary:[]},isVisible:!0,onToggleVisibility:()=>{},isLocked:!1,onToggleLocked:()=>{},onRename:()=>(({uid:t})=>{e.commandsManager.runCommand("setLabel",{uid:t},"MICROSCOPY")})({uid:i.uid,isActive:i.isActive}),onDelete:()=>(({uid:e})=>{let t=n.getAnnotation(e);n.removeAnnotation(t)})({uid:i.uid,isActive:i.isActive}),onColor:()=>{},disableEditing:!1,description:i.displayText.join(", ")})))))}),iy="126010",iv="125007",iw="111030",iE="112039";function i_(e){return Array.isArray(e)?e:[e]}let iA=id().adapters.DICOMMicroscopyViewer.MeasurementReport;async function iF(e,t,r){let n=t.metadata,{StudyInstanceUID:i,FrameOfReferenceUID:o}=r,u=e.getManagedViewersForStudy(i);if(!u||!u.length)return;t.isLoaded=!0;let{rois:a,labels:s}=await ib(e,n,o),c=u[0];for(let e=0;e<a.length;e++){let t=a[e],r=Object.getOwnPropertySymbols(t).find(e=>"properties"===e.description);t[r].evaluations=[],c.addRoiGraphicWithLabel(t,s[e])}}async function ib(e,t,r){let n=iA.generateToolState(t),i=Object.getOwnPropertyNames(n),o=await e.importDicomMicroscopyViewer(),u=function(e){let{ContentSequence:t}=e;return i_(t.find(e=>e.ConceptNameCodeSequence.CodeValue===iy).ContentSequence).filter(e=>e.ConceptNameCodeSequence.CodeValue===iv)}(t),a=[],s=[];return i.forEach(e=>{let t,i=n[e],c=e.toUpperCase(),l=u.filter(e=>i_(e.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iw).GraphicType===c);i.forEach((n,i)=>{let u={},c={coordinates:n,frameOfReferenceUID:r};if("Polygon"===e)t=new o.scoord3d.Polygon(c);else if("Polyline"===e)t=new o.scoord3d.Polyline(c);else if("Point"===e)t=new o.scoord3d.Point(c);else if("Ellipse"===e)t=new o.scoord3d.Ellipse(c);else throw Error("Unsupported tool type");let f=l[i],h=i_(f.ContentSequence).find(e=>"121071"===e.ConceptNameCodeSequence.CodeValue),d=i_(f.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iE);if(d){let e=/\(([^)]+)\)/.exec(d.TextValue);e&&e[1]&&(u.presentationState=JSON.parse(e[1]),u.marker=u.presentationState.marker)}let p=i_(f.ContentSequence).filter(e=>["410668003","42798000","G-A186","G-A185","G-D7FE"].includes(e.ConceptNameCodeSequence.CodeValue)),m=i_(f.ContentSequence).filter(e=>[iE].includes(e.ConceptNameCodeSequence.CodeValue));m=m.map(e=>{let t={...e};return t.ConceptNameCodeSequence=i_(t.ConceptNameCodeSequence),t}),(p=p.map(e=>{let t={...e};return t.ConceptNameCodeSequence=i_(t.ConceptNameCodeSequence),t}))&&p.length&&(u.measurements=p,console.log("[SR] retrieving measurements...",p)),m&&m.length&&(u.evaluations=m,console.log("[SR] retrieving evaluations...",m));let D=new o.roi.ROI({scoord3d:t,properties:u});a.push(D),h?s.push(h.ConceptCodeSequence.CodeValue):s.push("")})}),{rois:a,labels:s}}function iC(e,t){let{ReferencedFrameOfReferenceUID:r,metadata:n}=t;if(n.ReferencedSeriesSequence){let{ReferencedSeriesSequence:t}=n,{SeriesInstanceUID:r}=t[0];return e.filter(e=>e.SeriesInstanceUID===r)[0]}let i=e.filter(e=>e.displaySetInstanceUID!==t.displaySetInstanceUID),o=i.find(e=>"SM"===e.Modality&&(e.FrameOfReferenceUID===r||e.othersFrameOfReferenceUID.includes(r)));return!o&&i.length>=1?(console.warn("No display set with FrameOfReferenceUID",r,"single series, assuming data error, defaulting to only series."),i.find(e=>"SM"===e.Modality)):o}let{utils:ix}=o();var iS=s(427);let{utils:iM}=o();var iN=s(803),iO=s.n(iN),iB=s(444),iT=s.n(iB),ik=s(51),iI=s.n(ik);function iR(){return(iR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}let iP=t.lazy(()=>Promise.resolve().then(s.bind(s,683))),ij=e=>t.createElement(t.Suspense,{fallback:t.createElement("div",null,"Loading...")},t.createElement(iP,e)),iY={id:e,async preRegistration({servicesManager:e}){e.registerService(il.REGISTRATION(e))},getViewportModule:({servicesManager:e})=>[{name:"microscopy-dicom",component:n=>{let{viewportOptions:i}=n,[o,u]=(0,r.useViewportGrid)(),{activeViewportId:a}=o,s=(0,t.useMemo)(()=>n.displaySets.map(e=>e.displaySetInstanceUID).join("-"),[n.displaySets]),{ref:c}=function({skipOnMount:e=!1,refreshMode:r,refreshRate:n=1e3,refreshOptions:i,handleWidth:o=!0,handleHeight:u=!0,targetRef:a,observerOptions:s,onResize:c}={}){let l=(0,t.useRef)(e),[f,h]=(0,t.useState)({width:void 0,height:void 0}),[d,p]=(0,t.useState)((null==a?void 0:a.current)||null);a&&setTimeout(()=>{a.current!==d&&p(a.current)},0);let m=(0,t.useMemo)(()=>new Proxy(e=>{e!==d&&p(e)},{get:(e,t)=>"current"===t?d:e[t],set:(e,t,r)=>("current"===t?p(r):e[t]=r,!0)}),[d]),D=(0,t.useCallback)((e,t)=>(e.width!==t.width||e.height!==t.height)&&(e.width!==t.width||!!u)&&(e.height!==t.height||!!o),[o,u]),g=(0,t.useCallback)(e=>{if(o||u){if(l.current){l.current=!1;return}e.forEach(e=>{let{width:t,height:r}=(null==e?void 0:e.contentRect)||{};h(e=>D(e,{width:t,height:r})?{width:t,height:r}:e)})}},[o,u,l,D]),y=(0,t.useCallback)(((e,t,r,n)=>{switch(t){case"debounce":return iO()(e,r,n);case"throttle":return iT()(e,r,n);default:return e}})(g,r,n,i),[g,r,n,i]);return(0,t.useEffect)(()=>{let e;return d?(e=new window.ResizeObserver(y)).observe(d,s):(f.width||f.height)&&h({width:void 0,height:void 0}),()=>{var t,r;null==(t=null==e?void 0:e.disconnect)||t.call(e),null==(r=y.cancel)||r.call(y)}},[y,d]),(0,t.useEffect)(()=>{null==c||c(f.width,f.height)},[f]),Object.assign({ref:m},f)}({onResize:iI()(()=>{let{microscopyService:t}=e.services,r=t.getAllManagedViewers();r&&r.length>0&&r[0].viewer.resize()},100),handleHeight:!0,handleWidth:!0}),l=(0,t.useCallback)(e=>{u.setActiveViewportId(e)},[u]);return t.createElement(ij,iR({key:s,activeViewportId:a,setViewportActive:l,viewportData:i,resizeRef:c},n))}}],getToolbarModule:({servicesManager:e})=>[{name:"evaluate.microscopyTool",evaluate:({button:t})=>{let{microscopyService:r}=e.services,n=r.getActiveInteractions();if(!n)return!1;let i=n.find(e=>!!e[1].bindings.mouseButtons.includes("left")&&("draw"!==e[0]?e[0]===t.id:e[1].geometryType===t.id));return{disabled:!1,className:i?"!text-black bg-highlight":"!text-foreground/80 hover:!bg-muted hover:!text-highlight",isActive:i}}}],getSopClassHandlerModule:e=>[function({servicesManager:e,extensionManager:t}){return{name:"DicomMicroscopySRSopClassHandler",sopClassUids:["1.2.840.10008.5.1.4.1.1.88.34"],getDisplaySetsFromSeries:t=>(function(e,t){if(!e||!e.length)throw Error("No instances were provided");let{displaySetService:r,microscopyService:n}=t.services,o=e[0],u=i.DicomMetadataStore.getSeries(o.StudyInstanceUID,o.SeriesInstanceUID).instances[0],a=function(e){let{ContentSequence:t}=e,r=i_(t.find(e=>e.ConceptNameCodeSequence.CodeValue===iy).ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iv);return i_(r.ContentSequence).find(e=>e.ConceptNameCodeSequence.CodeValue===iw).ReferencedFrameOfReferenceUID}(u),{FrameOfReferenceUID:s,SeriesDescription:c,ContentDate:l,ContentTime:f,SeriesNumber:h,StudyInstanceUID:d,SeriesInstanceUID:p,SOPInstanceUID:m,SOPClassUID:D}=o,g={isOverlayDisplaySet:!0,plugin:"microscopy",Modality:"SR",altImageText:"Microscopy SR",displaySetInstanceUID:ix.guid(),SOPInstanceUID:m,SeriesInstanceUID:p,StudyInstanceUID:d,ReferencedFrameOfReferenceUID:a,SOPClassHandlerId:"@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopySRSopClassHandler",SOPClassUID:D,SeriesDescription:c,SeriesDate:l,SeriesTime:f,SeriesNumber:h,instance:o,metadata:u,isDerived:!0,isLoading:!1,isLoaded:!1,loadError:!1};return g.load=function(e){return iF(n,g,e).catch(e=>{throw g.isLoaded=!1,g.loadError=!0,Error(e)})},g.getSourceDisplaySet=function(){let e=[];return i.DicomMetadataStore.getStudy(d).series.forEach(t=>{let n=r.getDisplaySetsForSeries(t.SeriesInstanceUID);e=e.concat(n)}),iC(e,g)},[g]})(t,e)}}(e),function({servicesManager:e,extensionManager:t}){return{name:"DicomMicroscopyANNSopClassHandler",sopClassUids:["1.2.840.10008.5.1.4.1.1.91.1"],getDisplaySetsFromSeries:r=>(function(e,t,r){if(!e||!e.length)throw Error("No instances were provided");let{displaySetService:n,microscopyService:o}=t.services,u=[...e].sort((e,t)=>{let r=`${e.ContentDate}${e.ContentTime}`,n=`${t.ContentDate}${t.ContentTime}`;return r.localeCompare(n)}),a=u[u.length-1],s=i.DicomMetadataStore.getSeries(a.StudyInstanceUID,a.SeriesInstanceUID).instances[0],{SeriesDescription:c,ContentDate:l,ContentTime:f,SeriesNumber:h,StudyInstanceUID:d,SeriesInstanceUID:p,SOPInstanceUID:m,SOPClassUID:D}=a,g={isOverlayDisplaySet:!0,plugin:"microscopy",Modality:"ANN",thumbnailSrc:null,altImageText:"Microscopy Annotation",displaySetInstanceUID:iM.uuidv4(),SOPInstanceUID:m,SeriesInstanceUID:p,StudyInstanceUID:d,SOPClassHandlerId:"@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopyANNSopClassHandler",SOPClassUID:D,SeriesDescription:c,SeriesDate:l,SeriesTime:f,SeriesNumber:h,instance:a,metadata:s,isDerived:!0,isLoading:!1,isLoaded:!1,loadError:!1};return g.load=function(){return(function({microscopyService:e,displaySet:t,extensionManager:r,servicesManager:n}){let{uiNotificationService:i}=n.services;return new Promise(async(o,u)=>{try{t.isLoading=!0;let{metadata:u}=t,a=await e.importDicomMicroscopyViewer(),s=(0,iS.A)({extensionManager:r,servicesManager:n}),c=n.services.viewportGridService.getActiveViewportId(),l=e.getManagedViewersForViewport(c)[0];s.retrieveSeriesMetadata({studyInstanceUID:u.StudyInstanceUID,seriesInstanceUID:u.SeriesInstanceUID}).then(async e=>{let r=e.map(e=>new a.metadata.MicroscopyBulkSimpleAnnotations({metadata:e}));i.show({message:"Loading annotations...",type:"info"}),await Promise.all(r.map(async e=>{try{await l.viewer.addAnnotationGroups(e),e.AnnotationGroupSequence.forEach(e=>{let t=e.AnnotationGroupUID;l.viewer.setAnnotationGroupStyle(t,{color:[255,234,0]})}),e.AnnotationGroupSequence.forEach(e=>{let t=e.AnnotationGroupUID;l.viewer.showAnnotationGroup(t)})}catch(e){console.error("failed to add annotation groups:",e),i.show({title:"Error loading annotations",message:e.message,type:"error"})}})),t.isLoaded=!0,t.isLoading=!1,o(t)})}catch(e){console.error("Error loading annotation:",e),u(e)}})})({microscopyService:o,displaySet:g,extensionManager:r,servicesManager:t}).catch(e=>{throw g.isLoaded=!1,g.loadError=!0,Error(e)})},g.getSourceDisplaySet=function(){let e=[];return i.DicomMetadataStore.getStudy(d).series.forEach(t=>{let r=n.getDisplaySetsForSeries(t.SeriesInstanceUID);e=e.concat(r)}),iC(e,g)},[g]})(r,e,t)}}(e)],getPanelModule:function({commandsManager:e,extensionManager:n,servicesManager:i}){return[{name:"measure",iconName:"tab-linear",iconLabel:"Measure",label:"Measurements",secondaryLabel:"Measurements",component:({})=>{let[{activeViewportId:o,viewports:u}]=(0,r.useViewportGrid)();return t.createElement(ig,{viewports:u,activeViewportId:o,onSaveComplete:()=>{},onRejectComplete:()=>{},commandsManager:e,servicesManager:i,extensionManager:n})}}]},getCommandsModule:function({servicesManager:e,commandsManager:t,extensionManager:r}){let{viewportGridService:i,uiDialogService:o,microscopyService:u}=e.services,a={deleteMeasurement:({uid:e})=>{if(e){let t=u.getAnnotation(e);t&&u.removeAnnotation(t)}},setLabel:async({uid:e})=>{let t=u.getAnnotation(e);if(!t)return;let r=await (0,n.callInputDialog)({uiDialogService:o,title:io().t("Tools:Edit Measurement Label"),placeholder:t.label||io().t("Tools:Enter new label"),defaultValue:t.label});null!=r&&(t.setLabel(r),u.triggerRelabel(t))},setToolActive:({toolName:e,toolGroupId:t="MICROSCOPY"})=>{let r=["dragPan",{bindings:{mouseButtons:["middle"]}}],n=["dragZoom",{bindings:{mouseButtons:["right"]}}];if(["line","box","circle","point","polygon","freehandpolygon","freehandline"].indexOf(e)>=0){let t={geometryType:e,vertexEnabled:!0,styleOptions:n4,bindings:{mouseButtons:["left"]}};"line"===e?(t.minPoints=2,t.maxPoints=2):"point"===e&&(delete t.styleOptions,delete t.vertexEnabled),u.activateInteractions([["draw",t],r,n])}else"dragPan"==e?u.activateInteractions([["dragPan",{bindings:{mouseButtons:["left","middle"]}}],n]):u.activateInteractions([[e,{bindings:{mouseButtons:["left"]}}],r,n])},toggleOverlays:()=>{let e=document.getElementsByClassName("microscopy-viewport-overlay");for(let t=0;t<e.length;t++)0===t&&e.item(0).classList.contains("hidden"),e.item(t).classList.toggle("hidden");let{activeViewportId:t}=i.getState();u.toggleOverviewMap(t)},toggleAnnotations:()=>{u.toggleROIsVisibility()}},s={deleteMeasurement:{commandFn:a.deleteMeasurement},setLabel:{commandFn:a.setLabel},setToolActive:{commandFn:a.setToolActive},toggleOverlays:{commandFn:a.toggleOverlays},toggleAnnotations:{commandFn:a.toggleAnnotations}};return{actions:a,definitions:s,defaultContext:"MICROSCOPY"}},getCustomizationModule:function(){return[]}}})(),c})());
|