@tidepool/viz
Version:
Tidepool data visualization for diabetes device data.
2 lines • 1.4 MB
JavaScript
/*! For license information please see print.js.LICENSE.txt */
(()=>{var e={25568:e=>{"use strict";const{AbortController:r,AbortSignal:t}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=r,e.exports.AbortSignal=t,e.exports.default=r},19511:(e,r,t)=>{"use strict";var n=t(38075)("ArrayBuffer.prototype.byteLength",!0),a=t(84670);e.exports=function(e){return a(e)?n?n(e):e.byteLength:NaN}},94148:(e,r,t)=>{"use strict";function n(e){return n="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},n(e)}function a(e,r){for(var t=0;t<r.length;t++){var a=r[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,(void 0,i=function(e){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!==n(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a.key),"symbol"===n(i)?i:String(i)),a)}var i}function i(e,r,t){return r&&a(e.prototype,r),t&&a(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var o,s,c=t(69597).codes,l=c.ERR_AMBIGUOUS_ARGUMENT,u=c.ERR_INVALID_ARG_TYPE,d=c.ERR_INVALID_ARG_VALUE,h=c.ERR_INVALID_RETURN_VALUE,f=c.ERR_MISSING_ARGS,m=t(3918),g=t(40537).inspect,P=t(40537).types,X=P.isPromise,K=P.isRegExp,p=t(11514)(),y=t(9394)(),v=t(38075)("RegExp.prototype.test");function b(){var e=t(82299);o=e.isDeepEqual,s=e.isDeepStrictEqual}new Map;var A=!1,w=e.exports=O,x={};function C(e){if(e.message instanceof Error)throw e.message;throw new m(e)}function S(e,r,t,n){if(!t){var a=!1;if(0===r)a=!0,n="No value argument passed to `assert.ok()`";else if(n instanceof Error)throw n;var i=new m({actual:t,expected:!0,message:n,operator:"==",stackStartFn:e});throw i.generatedMessage=a,i}}function O(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];S.apply(void 0,[O,r.length].concat(r))}w.fail=function e(r,t,n,a,i){var o,s=arguments.length;if(0===s?o="Failed":1===s?(n=r,r=void 0):(!1===A&&(A=!0,(process.emitWarning?process.emitWarning:console.warn.bind(console))("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")),2===s&&(a="!=")),n instanceof Error)throw n;var c={actual:r,expected:t,operator:void 0===a?"fail":a,stackStartFn:i||e};void 0!==n&&(c.message=n);var l=new m(c);throw o&&(l.message=o,l.generatedMessage=!0),l},w.AssertionError=m,w.ok=O,w.equal=function e(r,t,n){if(arguments.length<2)throw new f("actual","expected");r!=t&&C({actual:r,expected:t,message:n,operator:"==",stackStartFn:e})},w.notEqual=function e(r,t,n){if(arguments.length<2)throw new f("actual","expected");r==t&&C({actual:r,expected:t,message:n,operator:"!=",stackStartFn:e})},w.deepEqual=function e(r,t,n){if(arguments.length<2)throw new f("actual","expected");void 0===o&&b(),o(r,t)||C({actual:r,expected:t,message:n,operator:"deepEqual",stackStartFn:e})},w.notDeepEqual=function e(r,t,n){if(arguments.length<2)throw new f("actual","expected");void 0===o&&b(),o(r,t)&&C({actual:r,expected:t,message:n,operator:"notDeepEqual",stackStartFn:e})},w.deepStrictEqual=function e(r,t,n){if(arguments.length<2)throw new f("actual","expected");void 0===o&&b(),s(r,t)||C({actual:r,expected:t,message:n,operator:"deepStrictEqual",stackStartFn:e})},w.notDeepStrictEqual=function e(r,t,n){if(arguments.length<2)throw new f("actual","expected");void 0===o&&b(),s(r,t)&&C({actual:r,expected:t,message:n,operator:"notDeepStrictEqual",stackStartFn:e})},w.strictEqual=function e(r,t,n){if(arguments.length<2)throw new f("actual","expected");y(r,t)||C({actual:r,expected:t,message:n,operator:"strictEqual",stackStartFn:e})},w.notStrictEqual=function e(r,t,n){if(arguments.length<2)throw new f("actual","expected");y(r,t)&&C({actual:r,expected:t,message:n,operator:"notStrictEqual",stackStartFn:e})};var T=i((function e(r,t,n){var a=this;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),t.forEach((function(e){e in r&&(void 0!==n&&"string"==typeof n[e]&&K(r[e])&&v(r[e],n[e])?a[e]=n[e]:a[e]=r[e])}))}));function k(e,r,t,a){if("function"!=typeof r){if(K(r))return v(r,e);if(2===arguments.length)throw new u("expected",["Function","RegExp"],r);if("object"!==n(e)||null===e){var i=new m({actual:e,expected:r,message:t,operator:"deepStrictEqual",stackStartFn:a});throw i.operator=a.name,i}var c=Object.keys(r);if(r instanceof Error)c.push("name","message");else if(0===c.length)throw new d("error",r,"may not be an empty object");return void 0===o&&b(),c.forEach((function(n){"string"==typeof e[n]&&K(r[n])&&v(r[n],e[n])||function(e,r,t,n,a,i){if(!(t in e)||!s(e[t],r[t])){if(!n){var o=new T(e,a),c=new T(r,a,e),l=new m({actual:o,expected:c,operator:"deepStrictEqual",stackStartFn:i});throw l.actual=e,l.expected=r,l.operator=i.name,l}C({actual:e,expected:r,message:n,operator:i.name,stackStartFn:i})}}(e,r,n,t,c,a)})),!0}return void 0!==r.prototype&&e instanceof r||!Error.isPrototypeOf(r)&&!0===r.call({},e)}function B(e){if("function"!=typeof e)throw new u("fn","Function",e);try{e()}catch(e){return e}return x}function E(e){return X(e)||null!==e&&"object"===n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function N(e){return Promise.resolve().then((function(){var r;if("function"==typeof e){if(!E(r=e()))throw new h("instance of Promise","promiseFn",r)}else{if(!E(e))throw new u("promiseFn",["Function","Promise"],e);r=e}return Promise.resolve().then((function(){return r})).then((function(){return x})).catch((function(e){return e}))}))}function _(e,r,t,a){if("string"==typeof t){if(4===arguments.length)throw new u("error",["Object","Error","Function","RegExp"],t);if("object"===n(r)&&null!==r){if(r.message===t)throw new l("error/message",'The error message "'.concat(r.message,'" is identical to the message.'))}else if(r===t)throw new l("error/message",'The error "'.concat(r,'" is identical to the message.'));a=t,t=void 0}else if(null!=t&&"object"!==n(t)&&"function"!=typeof t)throw new u("error",["Object","Error","Function","RegExp"],t);if(r===x){var i="";t&&t.name&&(i+=" (".concat(t.name,")")),i+=a?": ".concat(a):".";var o="rejects"===e.name?"rejection":"exception";C({actual:void 0,expected:t,operator:e.name,message:"Missing expected ".concat(o).concat(i),stackStartFn:e})}if(t&&!k(r,t,a,e))throw r}function D(e,r,t,n){if(r!==x){if("string"==typeof t&&(n=t,t=void 0),!t||k(r,t)){var a=n?": ".concat(n):".",i="doesNotReject"===e.name?"rejection":"exception";C({actual:r,expected:t,operator:e.name,message:"Got unwanted ".concat(i).concat(a,"\n")+'Actual message: "'.concat(r&&r.message,'"'),stackStartFn:e})}throw r}}function W(e,r,t,a,i){if(!K(r))throw new u("regexp","RegExp",r);var o="match"===i;if("string"!=typeof e||v(r,e)!==o){if(t instanceof Error)throw t;var s=!t;t=t||("string"!=typeof e?'The "string" argument must be of type string. Received type '+"".concat(n(e)," (").concat(g(e),")"):(o?"The input did not match the regular expression ":"The input was expected to not match the regular expression ")+"".concat(g(r),". Input:\n\n").concat(g(e),"\n"));var c=new m({actual:e,expected:r,message:t,operator:i,stackStartFn:a});throw c.generatedMessage=s,c}}function I(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];S.apply(void 0,[I,r.length].concat(r))}w.throws=function e(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];_.apply(void 0,[e,B(r)].concat(n))},w.rejects=function e(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return N(r).then((function(r){return _.apply(void 0,[e,r].concat(n))}))},w.doesNotThrow=function e(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];D.apply(void 0,[e,B(r)].concat(n))},w.doesNotReject=function e(r){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return N(r).then((function(r){return D.apply(void 0,[e,r].concat(n))}))},w.ifError=function e(r){if(null!=r){var t="ifError got unwanted exception: ";"object"===n(r)&&"string"==typeof r.message?0===r.message.length&&r.constructor?t+=r.constructor.name:t+=r.message:t+=g(r);var a=new m({actual:r,expected:null,operator:"ifError",message:t,stackStartFn:e}),i=r.stack;if("string"==typeof i){var o=i.split("\n");o.shift();for(var s=a.stack.split("\n"),c=0;c<o.length;c++){var l=s.indexOf(o[c]);if(-1!==l){s=s.slice(0,l);break}}a.stack="".concat(s.join("\n"),"\n").concat(o.join("\n"))}throw a}},w.match=function e(r,t,n){W(r,t,n,e,"match")},w.doesNotMatch=function e(r,t,n){W(r,t,n,e,"doesNotMatch")},w.strict=p(I,w,{equal:w.strictEqual,deepEqual:w.deepStrictEqual,notEqual:w.notStrictEqual,notDeepEqual:w.notDeepStrictEqual}),w.strict.strict=w.strict},3918:(e,r,t)=>{"use strict";function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach((function(r){var n,a,i;n=e,a=r,i=t[r],(a=o(a))in n?Object.defineProperty(n,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[a]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function o(e){var r=function(e){if("object"!==m(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!==m(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===m(r)?r:String(r)}function s(e,r){if(r&&("object"===m(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){var r="function"==typeof Map?new Map:void 0;return l=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return u(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)},l(e)}function u(e,r,t){return u=d()?Reflect.construct.bind():function(e,r,t){var n=[null];n.push.apply(n,r);var a=new(Function.bind.apply(e,n));return t&&h(a,t.prototype),a},u.apply(null,arguments)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function h(e,r){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},h(e,r)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function m(e){return m="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},m(e)}var g=t(40537).inspect,P=t(69597).codes.ERR_INVALID_ARG_TYPE;function X(e,r,t){return(void 0===t||t>e.length)&&(t=e.length),e.substring(t-r.length,t)===r}var K="",p="",y="",v="",b={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function A(e){var r=Object.keys(e),t=Object.create(Object.getPrototypeOf(e));return r.forEach((function(r){t[r]=e[r]})),Object.defineProperty(t,"message",{value:e.message}),t}function w(e){return g(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var x=function(e,r){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&h(e,r)}(x,e);var t,n,o,l,u=(t=x,n=d(),function(){var e,r=f(t);if(n){var a=f(this).constructor;e=Reflect.construct(r,arguments,a)}else e=r.apply(this,arguments);return s(this,e)});function x(e){var r;if(function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,x),"object"!==m(e)||null===e)throw new P("options","Object",e);var t=e.message,n=e.operator,a=e.stackStartFn,i=e.actual,o=e.expected,l=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=t)r=u.call(this,String(t));else if(process.stderr&&process.stderr.isTTY&&(process.stderr&&process.stderr.getColorDepth&&1!==process.stderr.getColorDepth()?(K="[34m",p="[32m",v="[39m",y="[31m"):(K="",p="",v="",y="")),"object"===m(i)&&null!==i&&"object"===m(o)&&null!==o&&"stack"in i&&i instanceof Error&&"stack"in o&&o instanceof Error&&(i=A(i),o=A(o)),"deepStrictEqual"===n||"strictEqual"===n)r=u.call(this,function(e,r,t){var n="",a="",i=0,o="",s=!1,c=w(e),l=c.split("\n"),u=w(r).split("\n"),d=0,h="";if("strictEqual"===t&&"object"===m(e)&&"object"===m(r)&&null!==e&&null!==r&&(t="strictEqualObject"),1===l.length&&1===u.length&&l[0]!==u[0]){var f=l[0].length+u[0].length;if(f<=10){if(!("object"===m(e)&&null!==e||"object"===m(r)&&null!==r||0===e&&0===r))return"".concat(b[t],"\n\n")+"".concat(l[0]," !== ").concat(u[0],"\n")}else if("strictEqualObject"!==t&&f<(process.stderr&&process.stderr.isTTY?process.stderr.columns:80)){for(;l[0][d]===u[0][d];)d++;d>2&&(h="\n ".concat(function(e,r){if(r=Math.floor(r),0==e.length||0==r)return"";var t=e.length*r;for(r=Math.floor(Math.log(r)/Math.log(2));r;)e+=e,r--;return e+e.substring(0,t-e.length)}(" ",d),"^"),d=0)}}for(var g=l[l.length-1],P=u[u.length-1];g===P&&(d++<2?o="\n ".concat(g).concat(o):n=g,l.pop(),u.pop(),0!==l.length&&0!==u.length);)g=l[l.length-1],P=u[u.length-1];var A=Math.max(l.length,u.length);if(0===A){var x=c.split("\n");if(x.length>30)for(x[26]="".concat(K,"...").concat(v);x.length>27;)x.pop();return"".concat(b.notIdentical,"\n\n").concat(x.join("\n"),"\n")}d>3&&(o="\n".concat(K,"...").concat(v).concat(o),s=!0),""!==n&&(o="\n ".concat(n).concat(o),n="");var C=0,S=b[t]+"\n".concat(p,"+ actual").concat(v," ").concat(y,"- expected").concat(v),O=" ".concat(K,"...").concat(v," Lines skipped");for(d=0;d<A;d++){var T=d-i;if(l.length<d+1)T>1&&d>2&&(T>4?(a+="\n".concat(K,"...").concat(v),s=!0):T>3&&(a+="\n ".concat(u[d-2]),C++),a+="\n ".concat(u[d-1]),C++),i=d,n+="\n".concat(y,"-").concat(v," ").concat(u[d]),C++;else if(u.length<d+1)T>1&&d>2&&(T>4?(a+="\n".concat(K,"...").concat(v),s=!0):T>3&&(a+="\n ".concat(l[d-2]),C++),a+="\n ".concat(l[d-1]),C++),i=d,a+="\n".concat(p,"+").concat(v," ").concat(l[d]),C++;else{var k=u[d],B=l[d],E=B!==k&&(!X(B,",")||B.slice(0,-1)!==k);E&&X(k,",")&&k.slice(0,-1)===B&&(E=!1,B+=","),E?(T>1&&d>2&&(T>4?(a+="\n".concat(K,"...").concat(v),s=!0):T>3&&(a+="\n ".concat(l[d-2]),C++),a+="\n ".concat(l[d-1]),C++),i=d,a+="\n".concat(p,"+").concat(v," ").concat(B),n+="\n".concat(y,"-").concat(v," ").concat(k),C+=2):(a+=n,n="",1!==T&&0!==d||(a+="\n ".concat(B),C++))}if(C>20&&d<A-2)return"".concat(S).concat(O,"\n").concat(a,"\n").concat(K,"...").concat(v).concat(n,"\n")+"".concat(K,"...").concat(v)}return"".concat(S).concat(s?O:"","\n").concat(a).concat(n).concat(o).concat(h)}(i,o,n));else if("notDeepStrictEqual"===n||"notStrictEqual"===n){var d=b[n],h=w(i).split("\n");if("notStrictEqual"===n&&"object"===m(i)&&null!==i&&(d=b.notStrictEqualObject),h.length>30)for(h[26]="".concat(K,"...").concat(v);h.length>27;)h.pop();r=1===h.length?u.call(this,"".concat(d," ").concat(h[0])):u.call(this,"".concat(d,"\n\n").concat(h.join("\n"),"\n"))}else{var f=w(i),g="",C=b[n];"notDeepEqual"===n||"notEqual"===n?(f="".concat(b[n],"\n\n").concat(f)).length>1024&&(f="".concat(f.slice(0,1021),"...")):(g="".concat(w(o)),f.length>512&&(f="".concat(f.slice(0,509),"...")),g.length>512&&(g="".concat(g.slice(0,509),"...")),"deepEqual"===n||"equal"===n?f="".concat(C,"\n\n").concat(f,"\n\nshould equal\n\n"):g=" ".concat(n," ").concat(g)),r=u.call(this,"".concat(f).concat(g))}return Error.stackTraceLimit=l,r.generatedMessage=!t,Object.defineProperty(c(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=i,r.expected=o,r.operator=n,Error.captureStackTrace&&Error.captureStackTrace(c(r),a),r.stack,r.name="AssertionError",s(r)}return o=x,(l=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:r,value:function(e,r){return g(this,a(a({},r),{},{customInspect:!1,depth:0}))}}])&&i(o.prototype,l),Object.defineProperty(o,"prototype",{writable:!1}),x}(l(Error),g.custom);e.exports=x},69597:(e,r,t)=>{"use strict";function n(e){return n="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},n(e)}function a(e,r){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},a(e,r)}function i(e){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}var o,s,c={};function l(e,r,t){t||(t=Error);var o=function(t){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&a(e,r)}(u,t);var o,s,c,l=(s=u,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=i(s);if(c){var t=i(this).constructor;e=Reflect.construct(r,arguments,t)}else e=r.apply(this,arguments);return function(e,r){if(r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function u(t,n,a){var i;return function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,u),i=l.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,a)),i.code=e,i}return o=u,Object.defineProperty(o,"prototype",{writable:!1}),o}(t);c[e]=o}function u(e,r){if(Array.isArray(e)){var t=e.length;return e=e.map((function(e){return String(e)})),t>2?"one of ".concat(r," ").concat(e.slice(0,t-1).join(", "),", or ")+e[t-1]:2===t?"one of ".concat(r," ").concat(e[0]," or ").concat(e[1]):"of ".concat(r," ").concat(e[0])}return"of ".concat(r," ").concat(String(e))}l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",(function(e,r,a){var i,s,c,l,d;if(void 0===o&&(o=t(94148)),o("string"==typeof e,"'name' must be a string"),"string"==typeof r&&(s="not ",r.substr(0,4)===s)?(i="must not be",r=r.replace(/^not /,"")):i="must be",function(e,r,t){return(void 0===t||t>e.length)&&(t=e.length),e.substring(t-9,t)===r}(e," argument"))c="The ".concat(e," ").concat(i," ").concat(u(r,"type"));else{var h=("number"!=typeof d&&(d=0),d+1>(l=e).length||-1===l.indexOf(".",d)?"argument":"property");c='The "'.concat(e,'" ').concat(h," ").concat(i," ").concat(u(r,"type"))}return c+". Received type ".concat(n(a))}),TypeError),l("ERR_INVALID_ARG_VALUE",(function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===s&&(s=t(40537));var a=s.inspect(r);return a.length>128&&(a="".concat(a.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(n,". Received ").concat(a)}),TypeError,RangeError),l("ERR_INVALID_RETURN_VALUE",(function(e,r,t){var a;return a=t&&t.constructor&&t.constructor.name?"instance of ".concat(t.constructor.name):"type ".concat(n(t)),"Expected ".concat(e,' to be returned from the "').concat(r,'"')+" function but got ".concat(a,".")}),TypeError),l("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];void 0===o&&(o=t(94148)),o(r.length>0,"At least one arg needs to be specified");var a="The ",i=r.length;switch(r=r.map((function(e){return'"'.concat(e,'"')})),i){case 1:a+="".concat(r[0]," argument");break;case 2:a+="".concat(r[0]," and ").concat(r[1]," arguments");break;default:a+=r.slice(0,i-1).join(", "),a+=", and ".concat(r[i-1]," arguments")}return"".concat(a," must be specified")}),TypeError),e.exports.codes=c},82299:(e,r,t)=>{"use strict";function n(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,a,i,o,s=[],c=!0,l=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=i.call(t)).done)&&(s.push(n.value),s.length!==r);c=!0);}catch(e){l=!0,a=e}finally{try{if(!c&&null!=t.return&&(o=t.return(),Object(o)!==o))return}finally{if(l)throw a}}return s}}(e,r)||function(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function i(e){return i="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},i(e)}var o=void 0!==/a/g.flags,s=function(e){var r=[];return e.forEach((function(e){return r.push(e)})),r},c=function(e){var r=[];return e.forEach((function(e,t){return r.push([t,e])})),r},l=Object.is?Object.is:t(37653),u=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},d=Number.isNaN?Number.isNaN:t(24133);function h(e){return e.call.bind(e)}var f=h(Object.prototype.hasOwnProperty),m=h(Object.prototype.propertyIsEnumerable),g=h(Object.prototype.toString),P=t(40537).types,X=P.isAnyArrayBuffer,K=P.isArrayBufferView,p=P.isDate,y=P.isMap,v=P.isRegExp,b=P.isSet,A=P.isNativeError,w=P.isBoxedPrimitive,x=P.isNumberObject,C=P.isStringObject,S=P.isBooleanObject,O=P.isBigIntObject,T=P.isSymbolObject,k=P.isFloat32Array,B=P.isFloat64Array;function E(e){if(0===e.length||e.length>10)return!0;for(var r=0;r<e.length;r++){var t=e.charCodeAt(r);if(t<48||t>57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function N(e){return Object.keys(e).filter(E).concat(u(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function _(e,r){if(e===r)return 0;for(var t=e.length,n=r.length,a=0,i=Math.min(t,n);a<i;++a)if(e[a]!==r[a]){t=e[a],n=r[a];break}return t<n?-1:n<t?1:0}var D=0,W=1,I=2,R=3;function U(e,r,t,n){if(e===r)return 0!==e||!t||l(e,r);if(t){if("object"!==i(e))return"number"==typeof e&&d(e)&&d(r);if("object"!==i(r)||null===e||null===r)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(r))return!1}else{if(null===e||"object"!==i(e))return(null===r||"object"!==i(r))&&e==r;if(null===r||"object"!==i(r))return!1}var a,s,c,u,h=g(e);if(h!==g(r))return!1;if(Array.isArray(e)){if(e.length!==r.length)return!1;var f=N(e),m=N(r);return f.length===m.length&&F(e,r,t,n,W,f)}if("[object Object]"===h&&(!y(e)&&y(r)||!b(e)&&b(r)))return!1;if(p(e)){if(!p(r)||Date.prototype.getTime.call(e)!==Date.prototype.getTime.call(r))return!1}else if(v(e)){if(!v(r)||(c=e,u=r,!(o?c.source===u.source&&c.flags===u.flags:RegExp.prototype.toString.call(c)===RegExp.prototype.toString.call(u))))return!1}else if(A(e)||e instanceof Error){if(e.message!==r.message||e.name!==r.name)return!1}else{if(K(e)){if(t||!k(e)&&!B(e)){if(!function(e,r){return e.byteLength===r.byteLength&&0===_(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}(e,r))return!1}else if(!function(e,r){if(e.byteLength!==r.byteLength)return!1;for(var t=0;t<e.byteLength;t++)if(e[t]!==r[t])return!1;return!0}(e,r))return!1;var P=N(e),E=N(r);return P.length===E.length&&F(e,r,t,n,D,P)}if(b(e))return!(!b(r)||e.size!==r.size)&&F(e,r,t,n,I);if(y(e))return!(!y(r)||e.size!==r.size)&&F(e,r,t,n,R);if(X(e)){if(s=r,(a=e).byteLength!==s.byteLength||0!==_(new Uint8Array(a),new Uint8Array(s)))return!1}else if(w(e)&&!function(e,r){return x(e)?x(r)&&l(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(r)):C(e)?C(r)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(r):S(e)?S(r)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(r):O(e)?O(r)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(r):T(r)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(r)}(e,r))return!1}return F(e,r,t,n,D)}function L(e,r){return r.filter((function(r){return m(e,r)}))}function F(e,r,t,a,o,l){if(5===arguments.length){l=Object.keys(e);var d=Object.keys(r);if(l.length!==d.length)return!1}for(var h=0;h<l.length;h++)if(!f(r,l[h]))return!1;if(t&&5===arguments.length){var g=u(e);if(0!==g.length){var P=0;for(h=0;h<g.length;h++){var X=g[h];if(m(e,X)){if(!m(r,X))return!1;l.push(X),P++}else if(m(r,X))return!1}var K=u(r);if(g.length!==K.length&&L(r,K).length!==P)return!1}else{var p=u(r);if(0!==p.length&&0!==L(r,p).length)return!1}}if(0===l.length&&(o===D||o===W&&0===e.length||0===e.size))return!0;if(void 0===a)a={val1:new Map,val2:new Map,position:0};else{var y=a.val1.get(e);if(void 0!==y){var v=a.val2.get(r);if(void 0!==v)return y===v}a.position++}a.val1.set(e,a.position),a.val2.set(r,a.position);var b=function(e,r,t,a,o,l){var u=0;if(l===I){if(!function(e,r,t,n){for(var a=null,o=s(e),c=0;c<o.length;c++){var l=o[c];if("object"===i(l)&&null!==l)null===a&&(a=new Set),a.add(l);else if(!r.has(l)){if(t)return!1;if(!G(e,r,l))return!1;null===a&&(a=new Set),a.add(l)}}if(null!==a){for(var u=s(r),d=0;d<u.length;d++){var h=u[d];if("object"===i(h)&&null!==h){if(!M(a,h,t,n))return!1}else if(!t&&!e.has(h)&&!M(a,h,t,n))return!1}return 0===a.size}return!0}(e,r,t,o))return!1}else if(l===R){if(!function(e,r,t,a){for(var o=null,s=c(e),l=0;l<s.length;l++){var u=n(s[l],2),d=u[0],h=u[1];if("object"===i(d)&&null!==d)null===o&&(o=new Set),o.add(d);else{var f=r.get(d);if(void 0===f&&!r.has(d)||!U(h,f,t,a)){if(t)return!1;if(!z(e,r,d,h,a))return!1;null===o&&(o=new Set),o.add(d)}}}if(null!==o){for(var m=c(r),g=0;g<m.length;g++){var P=n(m[g],2),X=P[0],K=P[1];if("object"===i(X)&&null!==X){if(!V(o,e,X,K,t,a))return!1}else if(!(t||e.has(X)&&U(e.get(X),K,!1,a)||V(o,e,X,K,!1,a)))return!1}return 0===o.size}return!0}(e,r,t,o))return!1}else if(l===W)for(;u<e.length;u++){if(!f(e,u)){if(f(r,u))return!1;for(var d=Object.keys(e);u<d.length;u++){var h=d[u];if(!f(r,h)||!U(e[h],r[h],t,o))return!1}return d.length===Object.keys(r).length}if(!f(r,u)||!U(e[u],r[u],t,o))return!1}for(u=0;u<a.length;u++){var m=a[u];if(!U(e[m],r[m],t,o))return!1}return!0}(e,r,t,l,a,o);return a.val1.delete(e),a.val2.delete(r),b}function M(e,r,t,n){for(var a=s(e),i=0;i<a.length;i++){var o=a[i];if(U(r,o,t,n))return e.delete(o),!0}return!1}function Y(e){switch(i(e)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":e=+e;case"number":if(d(e))return!1}return!0}function G(e,r,t){var n=Y(t);return null!=n?n:r.has(n)&&!e.has(n)}function z(e,r,t,n,a){var i=Y(t);if(null!=i)return i;var o=r.get(i);return!(void 0===o&&!r.has(i)||!U(n,o,!1,a))&&!e.has(i)&&U(n,o,!1,a)}function V(e,r,t,n,a,i){for(var o=s(e),c=0;c<o.length;c++){var l=o[c];if(U(t,l,a,i)&&U(n,r.get(l),a,i))return e.delete(l),!0}return!1}e.exports={isDeepEqual:function(e,r){return U(e,r,!1)},isDeepStrictEqual:function(e,r){return U(e,r,!0)}}},93870:(e,r,t)=>{"use strict";var n=t(44906).default;Object.defineProperty(r,"__esModule",{value:!0}),r.system=r.default=r.bgChart=void 0;var a=n(t(37055)),i=r.system={white:"#FFFFFF",black:"#000000",gray50:"#707070",gray30:"#8C8C8C",gray10:"#D9D9D9",gray05:"#EBEBEB",gray00:"#F6F6F6",purple90:"#271B46",indigo50:"#4A60E2",indigo30:"#627CFF",indigo00:"#F4F5FF",blue80:"#375178",blue60:"#445F87",blue50:"#4F6A92",blue30:"#708FC2",blue05:"#E1EAF9",blue00:"#F0F5FF",blueGray50:"#5F6B82",blueGray50T:"#1F304FB3",blueGray30:"#838CA0",blueGray10:"#D1D6E1",red50:"#CC2900",red30:"#EC4C47",red05:"#FFECE9",gold50:"#A35700",gold30:"#CC6D00",gold05:"#FFE8CF",green50:"#00754E",green30:"#08A057",green05:"#DAF9E4"},o=r.bgChart={veryLow:"#E9695E",low:"#F19181",target:"#8DD0A9",high:"#B69CE2",veryHigh:"#856ACF"},s=(0,a.default)((0,a.default)({},i),o);r.default=s},70938:(e,r,t)=>{"use strict";var n=t(44906).default;Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=n(t(37055)),i=n(t(89679)),o=n(t(17559)),s=n(t(46721)),c=n(t(4841)),l=n(t(96195)),u=n(t(77294)),d=n(t(54013)),h=n(t(53671)),f=n(t(27825)),m=n(t(56427)),g=n(t(55812)),P=n(t(80364)),X=t(79947),K=t(87307),p=t(66871),y=t(19992),v=t(99559),b=t(74501),A=t(80358),w=m.default.t.bind(m.default),x=function(e){(0,d.default)(x,e);var r,t,n,m,P=(0,h.default)(x);function x(e,r,t){var n;return(0,s.default)(this,x),(n=P.call(this,e,r,t)).sections=(0,K.generateChartSections)(r,n.bgSource),n.doc.addPage(),n.svgDataURLS=t.svgDataURLS,n}return(0,c.default)(x,[{key:"newPage",value:function(){(0,l.default)((0,u.default)(x.prototype),"newPage",this).call(this)}},{key:"render",value:(m=(0,o.default)((0,i.default)().mark((function e(){return(0,i.default)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.renderReportInfo(),this.sections.ambulatoryGlucoseProfile.sufficientData||this.sections.dailyGlucoseProfiles.sufficientData||this.sections.glucoseMetrics.sufficientData||this.sections.percentInRanges.sufficientData){e.next=5;break}this.renderInsufficientData(),e.next=12;break;case 5:return this.renderGlucoseMetrics(),e.next=8,this.renderPercentInRanges();case 8:return e.next=10,this.renderAmbulatoryGlucoseProfile();case 10:return e.next=12,this.renderDailyGlucoseProfiles();case 12:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"renderHeader",value:function(){this.doc.font(this.boldFont).fontSize(X.fontSizes.reportHeader);var e=this.leftEdge,r=this.topEdge,t=X.text.reportSubHeader[this.bgSource];return this.doc.fillColor(X.colors.text.reportHeader).fillOpacity(1).text("".concat(X.text.reportHeader," "),e,r,{continued:!0}).font(this.font).text(t),this}},{key:"renderFooter",value:function(){this.doc.font(this.font).fontSize(X.fontSizes.reportFooter);var e=this.leftEdge,r=this.bottomEdge-1.25*this.doc.currentLineHeight()-X.AGP_FOOTER_Y_PADDING;this.doc.fillColor(X.colors.text.reportFooter).fillOpacity(1).text(X.text.reportFooter,e,r),this.agpLogoWidth=70,this.tidepoolLogoWidth=65;var t=this.doc.page.width-this.agpLogoWidth-this.margins.right,n=this.bottomEdge-.175*this.agpLogoWidth-X.AGP_FOOTER_Y_PADDING;return this.doc.image("images/capturAGP-logo.png",t,n,{width:this.agpLogoWidth}),this.doc.image("images/tidepool-logo-408x46.png",t-(this.agpLogoWidth+10),n+2,{width:this.tidepoolLogoWidth}),this.setStroke(X.colors.mediumGrey),this.doc.moveTo(t-8,n).lineTo(t-8,n+11).stroke(),(0,l.default)((0,u.default)(x.prototype),"renderFooter",this).call(this),this}},{key:"renderGuides",value:function(){var e=this;this.doc.lineWidth(1).dash(3,{space:4}).rect(this.margins.left,this.margins.top,this.width,this.height).stroke("#EEEEEE"),f.default.each(f.default.values(this.sections),(function(r){e.doc.lineWidth(1).rect(r.x,r.y,r.width,r.height).stroke("#EEEEEE")})),this.doc.undash()}},{key:"renderInsufficientData",value:function(){this.resetText();var e=this.topEdge+.3*this.dpi,r=this.leftEdge;this.doc.fontSize(X.fontSizes.reportInfo.default).text(X.text.reportInsuffienctData,r,e)}},{key:"renderSectionContainer",value:function(e){var r,t,n,a;this.resetText(),e.bordered&&(this.doc.roundedRect(e.x,e.y,e.width,e.height,X.AGP_SECTION_BORDER_RADIUS).fill(X.colors.background.shaded),this.doc.rect(e.x+1,e.y+1+X.AGP_SECTION_HEADER_HEIGHT,e.width-2,X.AGP_SECTION_BORDER_RADIUS).fill(X.colors.white),this.doc.roundedRect(e.x+1,e.y+1+X.AGP_SECTION_HEADER_HEIGHT,e.width-2,e.height-2-X.AGP_SECTION_HEADER_HEIGHT,X.AGP_SECTION_BORDER_RADIUS-1).fill(X.colors.white));var i=null===(r=e.text)||void 0===r?void 0:r.title;if(!e.sufficientData&&null!==(t=e.text)&&void 0!==t&&t.insufficientDataTitle&&(i=e.text.insufficientDataTitle),i){var o,s=e.x+8,c=e.y+1+(X.AGP_SECTION_HEADER_HEIGHT-this.doc.currentLineHeight())/2;if(this.setFill(X.colors.text.section.title),this.doc.font(this.boldFont).fontSize(X.fontSizes.section.title),this.doc.text(i,s,c),null!==(o=e.text)&&void 0!==o&&o.subtitle){var l=s+this.doc.widthOfString(i)+.5*this.dpi;this.setFill(X.colors.text.section.subtitle),this.doc.font(this.font).fontSize(X.fontSizes.section.subtitle),this.doc.text(e.text.subtitle,l,e.y+1+(X.AGP_SECTION_HEADER_HEIGHT-this.doc.currentLineHeight())/2)}}if(!e.sufficientData&&null!==(n=e.text)&&void 0!==n&&n.insufficientData){var u=e.x+14,d=e.y+X.AGP_SECTION_HEADER_HEIGHT+8;this.setFill(X.colors.text.section.insufficientData),this.doc.font(this.font).fontSize(X.fontSizes.section.insufficientData),this.doc.text(e.text.insufficientData,u,d)}else if(null!==(a=e.text)&&void 0!==a&&a.description){var h=e.x+14,f=e.y+X.AGP_SECTION_HEADER_HEIGHT+8;this.setFill(X.colors.text.section.description),this.doc.font(this.font).fontSize(X.fontSizes.section.description),this.doc.text(e.text.description,h,f)}}},{key:"renderReportInfo",value:function(){var e,r,t,n,a,i,o,s,c=this,l=this.sections.reportInfo;this.renderSectionContainer(l);var u=f.default.truncate((0,y.getPatientFullName)(this.patient),{length:32}),d=(0,b.formatBirthdate)(this.patient),h=((null===(e=this.stats.sensorUsage)||void 0===e||null===(r=e.data)||void 0===r?void 0:r.raw)||{}).sensorUsageAGP,m=(null===(t=this.stats.bgExtents)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.raw)||{},P=m.bgDaysWorn,K=void 0===P?0:P,A=m.oldestDatum,x=m.newestDatum,C=(null===(a=this.patient)||void 0===a?void 0:a.clinicPatientMRN)||(null===(i=this.patient)||void 0===i||null===(o=i.profile)||void 0===o||null===(s=o.patient)||void 0===s?void 0:s.mrn),S=w(1===K?"{{bgDaysWorn}} Day":"{{bgDaysWorn}} Days",{bgDaysWorn:K});K>=1&&(S+=": ".concat(1===K?g.default.utc((null==x?void 0:x.time)-(0,b.getOffset)(null==x?void 0:x.time,this.timezone)*p.MS_IN_MIN).format("MMMM D, YYYY"):this.getDateRange(null==A?void 0:A.time,null==x?void 0:x.time,void 0,"","MMMM")));var O=function(e,r,t){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=c.doc.x,i=c.doc.y,o=0;if(t&&(c.doc.font(c.boldFont).fontSize(X.fontSizes.reportInfo.default),o=c.doc.widthOfString(t),c.doc.text(t,a,i,{align:"right",width:l.width}),r&&(c.doc.font(c.font).fontSize(X.fontSizes.reportInfo.label),c.doc.text(r,a,i+1,{align:"right",width:l.width-o-.025*c.dpi}))),c.doc.font(c.boldFont).fontSize(X.fontSizes.reportInfo.default).text(e,a,i),n){var s=i+c.doc.currentLineHeight()+.025*c.dpi;c.doc.moveTo(l.x,s).lineWidth(.25).lineTo(l.x+l.width,s).strokeColor(X.colors.line.default).stroke()}c.doc.x=a};this.doc.x=l.x,C&&(C.length>15&&(C="".concat(C.slice(0,5),"…").concat(C.slice(-7))),this.doc.y=l.y+.05*this.dpi,this.doc.moveUp(1),O("",X.text.reportInfo.mrn,C,!1)),this.doc.y=l.y+.05*this.dpi,O(u,X.text.reportInfo.dob,d),this.doc.moveDown(1),O(S),l.bgSource===p.CGM_DATA_KEY&&(this.doc.moveDown(1),O(w("Time CGM Active: {{activeTime}}%",{activeTime:(0,v.bankersRound)(h,1)})))}},{key:"renderGlucoseMetrics",value:function(){var e=this,r=this.sections.glucoseMetrics;this.renderSectionContainer(r);var t=.2*this.dpi,n=[r.x+t,r.x+r.width-t],i=this.bgSource===p.CGM_DATA_KEY?[{stat:this.stats.averageGlucose,dataPath:"summary",dataFormat:"summary"},{stat:this.stats.glucoseManagementIndicator,dataPath:"summaryAGP",dataFormat:"summary"},{stat:this.stats.coefficientOfVariation,dataPath:"summary",dataFormat:"summary"}]:[{stat:this.stats.readingsInRange,dataPath:"totalReadings",dataFormat:"count"},{stat:(0,a.default)((0,a.default)({},this.stats.readingsInRange),{},{id:"dailyReadingsInRange"}),dataPath:"averageDailyReadings",dataFormat:"count"},{stat:this.stats.averageGlucose,dataPath:"summary",dataFormat:"summary"},{stat:this.stats.coefficientOfVariation,dataPath:"summary",dataFormat:"summary"}];this.doc.x=r.x,this.doc.y=r.y+this.dpi*(this.bgSource===p.CGM_DATA_KEY?.375:.425),f.default.each(i,(function(a,i){var o,s,c,l,u=a.stat,d=a.dataPath,h=a.dataFormat,m=n[1]-n[0],g=e.doc.y,P="averageGlucose"===u.id,K=e.bgSource===p.CGM_DATA_KEY&&i%2!=0,y={bgPrefs:e.bgPrefs,data:u.data,useAGPFormat:!0},v=(0,A.formatDatum)(f.default.get(u.data,null===(o=u.data)||void 0===o||null===(s=o.dataPaths)||void 0===s?void 0:s[d]),null===(c=u.dataFormat)||void 0===c?void 0:c[h],y),b=v.value,w=v.suffix;P&&(w=e.bgUnits),e.doc.font(e.boldFont).fontSize(X.fontSizes.glucoseMetrics.labels).lineGap(-1.5),K&&e.doc.rect(r.x,g-8,r.width,2.25*e.doc.currentLineHeight()+16).fill(X.colors.background.shaded),e.setFill(),e.doc.text(X.text.glucoseMetrics[e.bgSource][u.id].label,n[0],g);var x=0,C=0;if(w){C=(X.fontSizes.glucoseMetrics.values-X.fontSizes.glucoseMetrics.labels)/2;var S=P?X.fontSizes.glucoseMetrics.bgUnits:X.fontSizes.glucoseMetrics.values,O=P?C-2.15:C;e.doc.fontSize(S).text("".concat(w),n[0],g-O,{align:"right",width:m}),x=e.doc.widthOfString(w)+1}e.doc.fontSize(X.fontSizes.glucoseMetrics.values).text("".concat(b),n[0],g-C,{align:"right",width:m-x}),e.setFill(X.colors.text.goals.glucoseMetrics),X.text.glucoseMetrics[e.bgSource][u.id].subLabel&&e.doc.font(e.font).fontSize(X.fontSizes.glucoseMetrics.subLabels).lineGap(1.3).text(X.text.glucoseMetrics[e.bgSource][u.id].subLabel),e.doc.font(e.font).fontSize(X.fontSizes.glucoseMetrics.goals);var T,k,B,E=e.bgUnits===p.MGDL_UNITS?"mgdl":"mmoll",N=P?null===(l=X.text.glucoseMetrics[e.bgSource][u.id].goal)||void 0===l?void 0:l[E]:X.text.glucoseMetrics[e.bgSource][u.id].goal;if(N&&e.doc.lineGap(1.3).text(N),P&&e.bgSource===p.BGM_DATA_KEY&&(e.setFill(X.colors.text.subStats.glucoseMetrics),2===(null===(T=e.stats.bgExtents)||void 0===T||null===(k=T.data)||void 0===k||null===(B=k.data)||void 0===B?void 0:B.length))){var _,D;e.doc.moveDown(.75);var W=f.default.map(null===(_=e.stats.bgExtents)||void 0===_||null===(D=_.data)||void 0===D?void 0:D.data,(function(e){return(0,A.formatDatum)(e,"bgValue",y).value}));e.doc.font(e.font).fontSize(X.fontSizes.glucoseMetrics.subStats).lineGap(1.3);var I=X.text.glucoseMetrics[e.bgSource].bgExtents.label,R=e.doc.widthOfString(I),U="".concat(W.reverse().join("/")," ").concat(e.bgUnits),L=e.doc.widthOfString(U);e.setStroke(),e.doc.moveTo(n[0]+t+R+2,e.doc.y+5.5).lineTo(n[0]+m-L-2,e.doc.y+5.5).dash(1,{space:2}).stroke().lineWidth(.5),e.doc.text(I,n[0]+t,e.doc.y,{align:"left",width:m-t,continued:!0}).text(U,e.doc.x,e.doc.y,{align:"right",width:m-t})}e.doc.moveDown(1.25)})),this.resetText()}},{key:"renderPercentInRanges",value:(n=(0,o.default)((0,i.default)().mark((function e(){var r,t,n,a,o,s;return(0,i.default)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.sections.percentInRanges,this.renderSectionContainer(t),n=t.x+1,a=t.y+1+.25*this.dpi,o=t.width-2,s=t.height-2-.25*this.dpi-X.AGP_SECTION_BORDER_RADIUS,this.renderSVGImage(null===(r=this.svgDataURLS)||void 0===r?void 0:r.percentInRanges,n,a,o,s);case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"renderAmbulatoryGlucoseProfile",value:(t=(0,o.default)((0,i.default)().mark((function e(){var r,t,n,a,o,s;return(0,i.default)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this.sections.ambulatoryGlucoseProfile,this.renderSectionContainer(r),(r.sufficientData||this.bgSource===p.BGM_DATA_KEY)&&(n=r.x+1,a=r.y+1+.5*this.dpi,o=r.width-2,s=r.height-2-.5*this.dpi-X.AGP_SECTION_BORDER_RADIUS,this.renderSVGImage(null===(t=this.svgDataURLS)||void 0===t?void 0:t.ambulatoryGlucoseProfile,n,a,o,s));case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"renderDailyGlucoseProfiles",value:(r=(0,o.default)((0,i.default)().mark((function e(){var r,t,n,a,o,s,c,l,u,d;return(0,i.default)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=this.sections.dailyGlucoseProfiles,this.renderSectionContainer(o),s=o.x+1,c=o.y+1+X.AGP_SECTION_HEADER_HEIGHT+X.AGP_SECTION_DESCRIPTION_HEIGHT,l=o.width-2,u=o.height-2-(X.AGP_SECTION_HEADER_HEIGHT+X.AGP_SECTION_DESCRIPTION_HEIGHT)-X.AGP_SECTION_BORDER_RADIUS,d=u/2,this.renderSVGImage(null===(r=this.svgDataURLS)||void 0===r||null===(t=r.dailyGlucoseProfiles)||void 0===t?void 0:t[0],s,c,l,d),this.renderSVGImage(null===(n=this.svgDataURLS)||void 0===n||null===(a=n.dailyGlucoseProfiles)||void 0===a?void 0:a[1],s,c+d,l,d);case 9:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}]),x}(P.default);r.default=x},77361:(e,r,t)=>{"use strict";var n=t(44906).default;Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a,i=n(t(84374)),o=n(t(37055)),s=n(t(21580)),c=n(t(46721)),l=n(t(4841)),u=n(t(83581)),d=n(t(96195)),h=n(t(77294)),f=n(t(54013)),m=n(t(53671)),g=n(t(271)),P=n(t(27825)),X=n(t(74716)),K=n(t(56427)),p=n(t(80364)),y=t(54114),v=t(80358),b=t(11270),A=t(66871),w=(a={},(0,g.default)(a,A.SITE_CHANGE_CANNULA,"images/sitechange-cannula.png"),(0,g.default)(a,A.SITE_CHANGE_RESERVOIR,"images/sitechange-reservoir.png"),(0,g.default)(a,A.SITE_CHANGE_TUBING,"images/sitechange-tubing.png"),(0,g.default)(a,A.SITE_CHANGE_TUBING,"images/sitechange-tubing.png"),(0,g.default)(a,"".concat(A.TIDEPOOL_LOOP.toLowerCase(),"_").concat(A.SITE_CHANGE_TUBING),"images/sitechange-loop-tubing.png"),(0,g.default)(a,"".concat(A.DIY_LOOP.toLowerCase(),"_").concat(A.SITE_CHANGE_TUBING),"images/sitechange-loop-tubing.png"),(0,g.default)(a,"".concat(A.TWIIST_LOOP.toLowerCase(),"_").concat(A.SITE_CHANGE_RESERVOIR),"images/sitechange-twiist-cassette.png"),a),x=K.default.t.bind(K.default),C=function(e){(0,f.default)(t,e);var r=(0,m.default)(t);function t(e,n,a){var i;return(0,c.default)(this,t),(i=r.call(this,e,n,a)).sections=P.default.isEmpty(i.aggregationsByDate)?{}:(0,y.processBasicsAggregations)((0,y.defineBasicsAggregations)(i.bgPrefs,i.manufacturer,i.latestPumpUpload),i.aggregationsByDate,i.patient,i.manufacturer),i.renderCalendarCell=i.renderCalendarCell.bind((0,u.default)(i)),i.doc.addPage(),i.initLayout(),i}return(0,l.default)(t,[{key:"getChartDateBoundDisplayFormat",value:function(){var e=(0,s.default)(this.endpoints.range,2),r=e[0],t=e[1],n=X.default.utc(r).tz(this.timePrefs.timezoneName),a=X.default.utc(t).tz(this.timePrefs.timezoneName),i=0===(null==n?void 0:n.hours())&&0===(null==n?void 0:n.minutes())||23===(null==n?void 0:n.hours())&&(null==n?void 0:n.minutes())>=59,o=0===(null==a?void 0:a.hours())&&0===(null==a?void 0:a.minutes())||23===(null==a?void 0:a.hours())&&(null==a?void 0:a.minutes())>=59;return i&&o?"MMM D, YYYY":"MMM D, YYYY (h:mm A)"}},{key:"newPage",value:function(){var e=(0,s.default)(this.endpoints.range,2),r=e[0],n=e[1],a=this.getChartDateBoundDisplayFormat();if("MMM D, YYYY (h:mm A)"===a){var i=X.default.utc(r).tz(this.timePrefs.timezoneName).format(a),o=X.default.utc(n).tz(this.timePrefs.timezoneName).format(a),c="".concat(i," - ").concat(o);(0,d.default)((0,h.default)(t.prototype),"newPage",this).call(this,x("Date range: {{dateRange}}",{dateRange:c}))}else(0,d.default)((0,h.default)(t.prototype),"newPage",this).call(this,this.getDateRange(r,n-1,void 0,x("Date range: ")))}},{key:"initCalendar",value:function(){var e=this,r=this.getActiveColumnWidth(),t={};t.days=(0,y.findBasicsDays)(this.endpoints.range,this.timePrefs.timezoneName),t.labels=(0,y.generateCalendarDayLabels)(t.days),t.headerHeight=15,t.columns=P.default.map(t.labels,(function(t){return{id:t,header:t,width:r/7,height:r/7,cache:!1,renderer:e.renderCalendarCell,headerBorder:"",headerPadding:[4,2,0,2],padding:[3,2,3,2]}})),t.pos={},this.calendar=t}},{key:"initLayout",value:function(){this.setLayoutColumns({width:this.chartArea.width,gutter:14,type:"percentage",widths:[25.5,49,25.5]})}},{key:"render",value:function(){this.renderStats(),this.renderCalendars(),this.RenderCalendarSummaries()}},{key:"renderStats",value:function(){this.goToPage(0),this.goToLayoutColumnPosition(0),this.renderAggregatedStats()}},{key:"renderCalendars",value:function(){this.goToPage(0),this.goToLayoutColumnPosition(1),this.initCalendar(),this.renderCalendarSection({title:this.sections.fingersticks.title,data:this.aggregationsByDate.fingersticks.smbg.byDate,type:"smbg",disabled:this.sections.fingersticks.disabled,emptyText:this.sections.fingersticks.emptyText}),this.renderCalendarSection({title:{text:this.sections.boluses.title,subText:x("(days with no insulin data have been excluded)")},data:this.aggregationsByDate.boluses.byDate,type:"bolus",disabled:this.sections.boluses.disabled,emptyText:this.sections.boluses.emptyText});var e=this.sections.siteChanges.subTitle;this.renderCalendarSection({title:{text:this.sections.siteChanges.title,subText:!!e&&x("(from '{{source}}')",{source:this.sections.siteChanges.subTitle})},data:this.aggregationsByDate.siteChanges.byDate,type:"siteChange",disabled:this.sections.siteChanges.disabled,emptyText:this.sections.siteChanges.emptyText}),this.renderCalendarSection({title:this.sections.basals.title,data:this.aggregationsByDate.basals.basal.byDate,type:"basal",disabled:this.sections.basals.disabled,emptyText:this.sections.basals.emptyText,bottomMargin:0})}},{key:"RenderCalendarSummaries",value:function(){this.goToPage(0),this.goToLayoutColumnPosition(2),this.renderCalendarSummary({dimensions:this.sections.fingersticks.dimensions,header:this.sections.fingersticks.summaryTitle,data:this.aggregationsByDate.fingersticks,type:"smbg",disabled:this.sections.fingersticks.disabled}),this.renderCalendarSummary({dimensions:this.sections.boluses.dimensions,header:this.sections.boluses.summaryTitle,data:this.aggregationsByDate.boluses,type:"bolus",disabled:this.sections.boluses.disabled}),this.renderCalendarSummary({dimensions:this.sections.basals.dimensions,header:this.sections.basals.summaryTitle,data:this.aggregationsByDate.basals,type:"basal",disabled:this.sections.basals.disabled})}},{key:"renderAggregatedStats",value:function(){var e,r,t,n=this.stats,a=n.averageDailyDose,i=n.averageGlucose,o=n.carbs,s=n.coefficientOfVariation,c=n.glucoseManagementIndicator,l=n.readingsInRange,u=n.sensorUsage,d=n.standardDev,h=n.timeInAuto,f=n.timeInOverride,m=n.timeInRange,g=n.totalInsulin;if(m&&this.renderHorizontalBarStat(m,{heading:{text:"Time in Range",note:x("Showing {{source}} data",{source:v.statBgSourceLabels[this.bgSource]})}}),l&&this.renderHorizontalBarStat(l,{heading:{text:"Readings in Range",note:x("{{source}} data from {{count}} readings",{source:v.statBgSourceLabels[this.bgSource],count:null===(e=l.data)||void 0===e||null===(r=e.raw)||void 0===r||null===(t=r.counts)||void 0===t?void 0:t.total})}}),i&&this.renderSimpleStat(i),u&&this.renderSimpleStat(u),this.renderHorizontalBarStat(g,{heading:x("Avg. Daily Insulin Ratio"),secondaryFormatKey:"tooltip",fillOpacity:.5}),h){var X=(0,b.getPumpVocabulary)(this.manufacturer)[A.AUTOMATED_DELIVERY];this.renderHorizontalBarStat(h,{heading:x("Avg. Daily Time In {{automatedLabel}}",{automatedLabel:X}),fillOpacity:.5,secondaryFormatKey:"tooltip"})}if(f){var K=(0,b.getPumpVocabulary)(this.manufacturer)[A.SETTINGS_OVERRIDE];this.renderHorizontalBarStat(f,{heading:x("Avg. Daily Time In {{overrideLabel}}",{overrideLabel:K}),fillOpacity:.5,secondaryFormatKey:"tooltip"})}var p=P.default.get(o,"data.raw.carbs.grams",0)>0,y=P.default.get(o,"data.raw.carbs.exchanges",0)>0;p&&y&&(o.title=[o.title,x("Avg. Daily Carb Exchanges")]),this.renderSimpleStat(o),this.renderSimpleStat(a),c&&this.renderSimpleStat(c),this.renderSimpleStat(d),this.renderSimpleStat(s)}},{key:"defineStatColumns",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.getActiveColumnWidth(),t=e.height,n=void 0===t?30:t,a=e.labelWidth,i=void 0===a?.65*r:a,o=e.valueWidth,s=void 0===o?.35*r:o,c=e.statFont,l=void 0===c?this.font:c,u=e.statFontSize,d=void 0===u?this.defaultFontSize:u,h=e.valueFont,f=void 0===h?this.boldFont:h,m=e.valueFontSize,g=void 0===m?this.defaultFontSize:m,P=e.labelHeader,X=void 0!==P&&P,K=e.valueHeader,p=void 0!==K&&K;return[{id:"label",cache:!1,rende