diff --git a/README.md b/README.md index 5677601..c176b99 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ The component is initialized by a JavaScript object with the following keys and - 'value': used as the main value that's passed around for the target - 'text': human-readable text - 'plot_text': plot text (purpose: TBD) -- `task_ids`: `object` defining the _tasks_ in the data as described in `_fetchData`'s `taskIDs` arg above. The object contains a `string` key for each task ID variable, the value of which is an `array` of `object`s defining possible values. The keys should consist of only ASCII letters, digits, '_', and '-', and should start with a letter. The objects have two keys: +- `task_ids`: `object` defining the _tasks_ in the data as described in `_fetchData`'s `taskIDs` arg above. The object contains a `string` key for each task ID variable, the value of which is an `array` of `object`s defining possible values. The keys should consist of only ASCII letters, digits, `_`, and `-`, and should start with a letter. (Note that, for display, the IDs are split on `_` and `-` and the title-cased.) The objects have two keys: - `value`: used as the main value that's passed around for the task ID - `text`: human-readable text diff --git a/dist/predtimechart.bundle.js b/dist/predtimechart.bundle.js index bd1cf51..a8ef56d 100644 --- a/dist/predtimechart.bundle.js +++ b/dist/predtimechart.bundle.js @@ -1 +1 @@ -var e={870:(e,t)=>{function a(e,t){return{validate:e,compare:t}}t.u5=void 0,t.u5={date:a(r,n),time:a(l,d),"date-time":a((function(e){const t=e.split(c);return 2===t.length&&r(t[0])&&l(t[1],!0)}),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return p.test(e)&&u.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[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:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(v.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return h.lastIndex=0,h.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=_&&e>=f}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:g},double:{type:"number",validate:g},password:!0,binary:!0},t.u5,a(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,n),a(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d),a(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),Object.keys(t.u5);const s=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function r(e){const t=s.exec(e);if(!t)return!1;const a=+t[1],r=+t[2],n=+t[3];return r>=1&&r<=12&&n>=1&&n<=(2===r&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(a)?29:i[r])}function n(e,t){if(e&&t)return e>t?1:e(t=s[1]+s[2]+s[3]+(s[4]||""))?1:e{const s=a(725);s.code='require("ajv/dist/runtime/equal").default',t.Z=s},499:(e,t)=>{function a(e){const t=e.length;let a,s=0,i=0;for(;i=55296&&a<=56319&&i{a.d(t,{Z:()=>o});var s=a(81),i=a.n(s),r=a(645),n=a.n(r)()(i());n.push([e.id,"/**\n * predtimechart: A JavaScript (ES6 ECMAScript) module for forecast visualization.\n */\n\n.forecastViz_dot {\n height: 15px;\n width: 15px;\n border-radius: 50%;\n border: 1px solid black;\n display: inline-block;\n}\n\n.forecastViz_select_data {\n font-size: 14px;\n}\n\n#forecastViz_select_model {\n height: 48vh;\n overflow-y: scroll;\n font-size: 14px;\n}\n\n.forecastViz_disclaimer {\n text-align: center;\n margin-left: 3%;\n margin-right: 3%;\n font-size: 18px;\n}\n",""]);const o=n},645:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var a="",s=void 0!==t[5];return t[4]&&(a+="@supports (".concat(t[4],") {")),t[2]&&(a+="@media ".concat(t[2]," {")),s&&(a+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),a+=e(t),s&&(a+="}"),t[2]&&(a+="}"),t[4]&&(a+="}"),a})).join("")},t.i=function(e,a,s,i,r){"string"==typeof e&&(e=[[null,e,void 0]]);var n={};if(s)for(var o=0;o0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),a&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=a):c[2]=a),i&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=i):c[4]="".concat(i)),t.push(c))}},t}},81:e=>{e.exports=function(e){return e[1]}},725:e=>{e.exports=function e(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var s,i,r;if(Array.isArray(t)){if((s=t.length)!=a.length)return!1;for(i=s;0!=i--;)if(!e(t[i],a[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((s=(r=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(i=s;0!=i--;)if(!Object.prototype.hasOwnProperty.call(a,r[i]))return!1;for(i=s;0!=i--;){var n=r[i];if(!e(t[n],a[n]))return!1}return!0}return t!=t&&a!=a}},379:e=>{var t=[];function a(e){for(var a=-1,s=0;s{var t={};e.exports=function(e,a){var s=function(e){if(void 0===t[e]){var a=document.querySelector(e);if(window.HTMLIFrameElement&&a instanceof window.HTMLIFrameElement)try{a=a.contentDocument.head}catch(e){a=null}t[e]=a}return t[e]}(e);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(a)}},216:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},565:(e,t,a)=>{e.exports=function(e){var t=a.nc;t&&e.setAttribute("nonce",t)}},795:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(a){!function(e,t,a){var s="";a.supports&&(s+="@supports (".concat(a.supports,") {")),a.media&&(s+="@media ".concat(a.media," {"));var i=void 0!==a.layer;i&&(s+="@layer".concat(a.layer.length>0?" ".concat(a.layer):""," {")),s+=a.css,i&&(s+="}"),a.media&&(s+="}"),a.supports&&(s+="}");var r=a.sourceMap;r&&"undefined"!=typeof btoa&&(s+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(s,e,t.options)}(t,e,a)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},589:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},840:(e,t,a)=>{e.exports=c,e.exports.default=c;const s={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://github.com/reichlab/predtimechart/blob/main/src/schema.json",title:"predtimechart options",description:"predtimechart options object schema",type:"object",additionalProperties:!1,properties:{available_as_ofs:{description:"`object` that maps `target_variables` `value` to an `array` of dates in 'YYYY-MM-DD' format that have truth and/or forecasts available",type:"object",minProperties:1,additionalProperties:{type:"array",minItems:1,items:{type:"string",format:"date"}}},current_date:{description:"`available_as_ofs` `value` key to use for the initial plot",type:"string",format:"date"},disclaimer:{description:"`string` providing any important information users should know",type:"string",minLength:1},initial_as_of:{description:"`string` specifying the initial date from 'available_as_ofs' (in 'YYYY-MM-DD' format) to use for the initially-selected _as_of_ date",type:"string",format:"date"},initial_checked_models:{description:"`models` value(s) to use for the initial plot",type:"array",uniqueItems:!0},initial_interval:{description:"`intervals` value to use for the initial plot",type:"string"},initial_target_var:{description:"`target_variables` `value` key to use for the initial plot",type:"string"},initial_task_ids:{description:"an `object` to use for the initial plot. format is identical to `_fetchData()`'s `taskIDs` arg",type:"object",minProperties:1},initial_xaxis_range:{description:"optional `array` of two dates in 'YYYY-MM-DD' format that specify the initial xaxis range to use. To not initialize the range, either don't pass this key or pass `null` for its value",type:["array","null"],minItems:2,maxItems:2,uniqueItems:!0,items:{type:"string",format:"date"}},intervals:{description:"`array` of one or more strings of the format '%' between '0%' and '100%' inclusive, representing percentages. Currently only '50%' and '95%' are used (purpose: TBD)",type:"array",minItems:1,uniqueItems:!0,items:{type:"string",pattern:"^[1-9]?[0-9]%$"}},models:{description:"`array` of model names (`string`s) that provide data",type:"array",minItems:1,uniqueItems:!0},target_variables:{description:"`array` of `object`s defining the target variables in the data. Each object contains three keys: `value`, `text`, `plot_text`",type:"array",minItems:1,items:{type:"object",additionalProperties:!1,properties:{value:{description:"used as the main value that's passed around for the target",type:"string",minLength:1},text:{description:"human-readable text",type:"string",minLength:1},plot_text:{description:"plot text",type:"string",minLength:1}},required:["value","text","plot_text"]}},task_ids:{description:"`object` defining the _tasks_ in the data as described in `_fetchData`'s `taskIDs` arg",type:"object",minProperties:1,patternProperties:{"^[A-Za-z]+[A-Za-z0-9_-]*$":{type:"array",items:{type:"object",properties:{value:{description:"used as the main value that's passed around for the task_id",type:"string",minLength:1},text:{description:"human-readable text",type:"string",minLength:1}}}}},additionalProperties:!1}},required:["available_as_ofs","current_date","disclaimer","initial_as_of","initial_checked_models","initial_interval","initial_target_var","initial_task_ids","initial_xaxis_range","intervals","models","target_variables","task_ids"]},i=Object.prototype.hasOwnProperty,r=a(499).Z,n=a(510).Z,o=a(870).u5.date,l=new RegExp("^[1-9]?[0-9]%$","u"),d=new RegExp("^[A-Za-z]+[A-Za-z0-9_-]*$","u");function c(e,{instancePath:t="",parentData:a,parentDataProperty:m,rootData:p=e}={}){let u=null,h=0;if(e&&"object"==typeof e&&!Array.isArray(e)){if(void 0===e.available_as_ofs){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"available_as_ofs"},message:"must have required property 'available_as_ofs'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.current_date){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"current_date"},message:"must have required property 'current_date'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.disclaimer){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"disclaimer"},message:"must have required property 'disclaimer'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.initial_as_of){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"initial_as_of"},message:"must have required property 'initial_as_of'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.initial_checked_models){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"initial_checked_models"},message:"must have required property 'initial_checked_models'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.initial_interval){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"initial_interval"},message:"must have required property 'initial_interval'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.initial_target_var){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"initial_target_var"},message:"must have required property 'initial_target_var'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.initial_task_ids){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"initial_task_ids"},message:"must have required property 'initial_task_ids'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.initial_xaxis_range){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"initial_xaxis_range"},message:"must have required property 'initial_xaxis_range'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.intervals){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"intervals"},message:"must have required property 'intervals'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.models){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"models"},message:"must have required property 'models'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.target_variables){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"target_variables"},message:"must have required property 'target_variables'"};null===u?u=[e]:u.push(e),h++}if(void 0===e.task_ids){const e={instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:"task_ids"},message:"must have required property 'task_ids'"};null===u?u=[e]:u.push(e),h++}for(const a in e)if(!i.call(s.properties,a)){const e={instancePath:t,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:a},message:"must NOT have additional properties"};null===u?u=[e]:u.push(e),h++}if(void 0!==e.available_as_ofs){let a=e.available_as_ofs;if(a&&"object"==typeof a&&!Array.isArray(a)){if(Object.keys(a).length<1){const e={instancePath:t+"/available_as_ofs",schemaPath:"#/properties/available_as_ofs/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"};null===u?u=[e]:u.push(e),h++}for(const e in a){let s=a[e];if(Array.isArray(s)){if(s.length<1){const a={instancePath:t+"/available_as_ofs/"+e.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/available_as_ofs/additionalProperties/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};null===u?u=[a]:u.push(a),h++}const a=s.length;for(let i=0;i1)e:for(;s--;)for(e=s;e--;)if(n(a[s],a[e])){const a={instancePath:t+"/initial_checked_models",schemaPath:"#/properties/initial_checked_models/uniqueItems",keyword:"uniqueItems",params:{i:s,j:e},message:"must NOT have duplicate items (items ## "+e+" and "+s+" are identical)"};null===u?u=[a]:u.push(a),h++;break e}}else{const e={instancePath:t+"/initial_checked_models",schemaPath:"#/properties/initial_checked_models/type",keyword:"type",params:{type:"array"},message:"must be array"};null===u?u=[e]:u.push(e),h++}}if(void 0!==e.initial_interval&&"string"!=typeof e.initial_interval){const e={instancePath:t+"/initial_interval",schemaPath:"#/properties/initial_interval/type",keyword:"type",params:{type:"string"},message:"must be string"};null===u?u=[e]:u.push(e),h++}if(void 0!==e.initial_target_var&&"string"!=typeof e.initial_target_var){const e={instancePath:t+"/initial_target_var",schemaPath:"#/properties/initial_target_var/type",keyword:"type",params:{type:"string"},message:"must be string"};null===u?u=[e]:u.push(e),h++}if(void 0!==e.initial_task_ids){let a=e.initial_task_ids;if(a&&"object"==typeof a&&!Array.isArray(a)){if(Object.keys(a).length<1){const e={instancePath:t+"/initial_task_ids",schemaPath:"#/properties/initial_task_ids/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties"};null===u?u=[e]:u.push(e),h++}}else{const e={instancePath:t+"/initial_task_ids",schemaPath:"#/properties/initial_task_ids/type",keyword:"type",params:{type:"object"},message:"must be object"};null===u?u=[e]:u.push(e),h++}}if(void 0!==e.initial_xaxis_range){let a=e.initial_xaxis_range;if(!Array.isArray(a)&&null!==a){const e={instancePath:t+"/initial_xaxis_range",schemaPath:"#/properties/initial_xaxis_range/type",keyword:"type",params:{type:s.properties.initial_xaxis_range.type},message:"must be array,null"};null===u?u=[e]:u.push(e),h++}if(Array.isArray(a)){if(a.length>2){const e={instancePath:t+"/initial_xaxis_range",schemaPath:"#/properties/initial_xaxis_range/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items"};null===u?u=[e]:u.push(e),h++}if(a.length<2){const e={instancePath:t+"/initial_xaxis_range",schemaPath:"#/properties/initial_xaxis_range/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items"};null===u?u=[e]:u.push(e),h++}const e=a.length;for(let s=0;s1){const e={};for(;i--;){let r=a[i];if("string"==typeof r){if("number"==typeof e[r]){s=e[r];const a={instancePath:t+"/initial_xaxis_range",schemaPath:"#/properties/initial_xaxis_range/uniqueItems",keyword:"uniqueItems",params:{i,j:s},message:"must NOT have duplicate items (items ## "+s+" and "+i+" are identical)"};null===u?u=[a]:u.push(a),h++;break}e[r]=i}}}}}if(void 0!==e.intervals){let a=e.intervals;if(Array.isArray(a)){if(a.length<1){const e={instancePath:t+"/intervals",schemaPath:"#/properties/intervals/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};null===u?u=[e]:u.push(e),h++}const e=a.length;for(let s=0;s1){const e={};for(;i--;){let r=a[i];if("string"==typeof r){if("number"==typeof e[r]){s=e[r];const a={instancePath:t+"/intervals",schemaPath:"#/properties/intervals/uniqueItems",keyword:"uniqueItems",params:{i,j:s},message:"must NOT have duplicate items (items ## "+s+" and "+i+" are identical)"};null===u?u=[a]:u.push(a),h++;break}e[r]=i}}}}else{const e={instancePath:t+"/intervals",schemaPath:"#/properties/intervals/type",keyword:"type",params:{type:"array"},message:"must be array"};null===u?u=[e]:u.push(e),h++}}if(void 0!==e.models){let a=e.models;if(Array.isArray(a)){if(a.length<1){const e={instancePath:t+"/models",schemaPath:"#/properties/models/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};null===u?u=[e]:u.push(e),h++}let e,s=a.length;if(s>1)e:for(;s--;)for(e=s;e--;)if(n(a[s],a[e])){const a={instancePath:t+"/models",schemaPath:"#/properties/models/uniqueItems",keyword:"uniqueItems",params:{i:s,j:e},message:"must NOT have duplicate items (items ## "+e+" and "+s+" are identical)"};null===u?u=[a]:u.push(a),h++;break e}}else{const e={instancePath:t+"/models",schemaPath:"#/properties/models/type",keyword:"type",params:{type:"array"},message:"must be array"};null===u?u=[e]:u.push(e),h++}}if(void 0!==e.target_variables){let a=e.target_variables;if(Array.isArray(a)){if(a.length<1){const e={instancePath:t+"/target_variables",schemaPath:"#/properties/target_variables/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};null===u?u=[e]:u.push(e),h++}const e=a.length;for(let s=0;s{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var s in t)a.o(t,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.nc=void 0;var s,i,r,n,o,l,d,c,m,p,u,h,f,_,g={};s=a(379),i=a.n(s),r=a(795),n=a.n(r),o=a(569),l=a.n(o),d=a(565),c=a.n(d),m=a(216),p=a.n(m),u=a(589),h=a.n(u),f=a(253),(_={}).styleTagTransform=h(),_.setAttributes=c(),_.insert=l().bind(null,"head"),_.domAPI=n(),_.insertStyleElement=p(),i()(f.Z,_),f.Z&&f.Z.locals&&f.Z.locals,(()=>{function e(e){return new Date(parseInt(e.slice(0,4)),parseInt(e.slice(5,7))-1,parseInt(e.slice(8,10)))}function t(e){var t=0;return e.forEach((e=>{if("number"!=typeof e)throw new Error(`array item was not a number: ${e}`);t+=e})),t/e.length}a.d(g,{Z:()=>d});const s=function(e,a){if(0===e.length)throw new Error("_calcUemForecasts(): must have one or more componentModels");const s=[];if(e.forEach((e=>{Object.hasOwn(a,e)||s.push(e)})),0!==s.length)throw new Error(`_calcUemForecasts(): some models had no forecast data: ${s}`);const i=new Set(e.map((e=>JSON.stringify(Object.keys(a[e])))));if(1!==i.size)throw new Error(`not all forecasts had the same quantiles: ${JSON.stringify([...i])}`);const r=[];e.forEach((e=>{r.push(new Set(a[e].target_end_date))}));const n=r.reduce(((e,t)=>new Set([...e].filter((e=>t.has(e))))));if(0===n.size)throw new Error("_calcUemForecasts(): forecasts had no common target_end_dates");const o={};e.forEach((e=>{o[e]=[...n].map((t=>a[e].target_end_date.indexOf(t)))}));const l=a[e[0]],d={target_end_date:[...n]};return Object.keys(l).forEach((s=>{if(s.startsWith("q0.")){const i=[];e.forEach((e=>{const t=a[e][s],r=o[e].map((e=>t[e]));i.push(r)})),d[s]=function(e){const a=new Set(e.map((e=>e.length)));if(1!==a.size)throw new Error(`quantileArrays not all the same length: ${e}`);const s=[];for(let i=0;i{a.push(e[i])}));const r=t(a);s.push(r)}return s}(i)}})),d};var i=a(840);const r={name:"User-Ensemble",models:[],lastError:null};function n(e,t,a,s){return`
\n \n
`}function o(){const e=$("#forecastViz_Current_Truth").prop("checked"),t=$("#forecastViz_Truth_as_of").prop("checked"),a=[];e&&a.push("Current Truth"),t&&a.push("Truth as of"),this.state.selected_truth=a,this.fetchDataUpdatePlot(!1,null,!0)}const l={isIndicateRedraw:!1,_fetchData:null,_calcUemForecasts:null,isUemEnabled:!0,state:{target_variables:[],task_ids:[],intervals:[],available_as_ofs:[],current_date:"",models:[],disclaimer:"",selected_target_var:"",selected_interval:"",selected_as_of_date:"",selected_truth:["Current Truth","Truth as of"],selected_models:[],last_selected_models:[],colors:[],initial_xaxis_range:null,current_truth:[],as_of_truth:[],forecasts:{}},initialize(e,t,a,s,n){this._fetchData=t,this.isIndicateRedraw=a,this._calcUemForecasts=n,console.debug("initialize(): entered");const o=document.getElementById(e);if(null===o)throw`componentDiv DOM node not found: '${e}'`;if(function(e){if(null===e||"object"!=typeof e)throw`options object is required but missing: '${e}'`;if(!i(e))throw console.error(`_validateOptions(): invalid schema. ${i.errors.length} error(s). options:, errors:`,JSON.stringify(e,null," "),i.errors),`invalid options structure: ${i.errors.map((e=>JSON.stringify(e))).join(", ")}`;const t=e.available_as_ofs,a=e.target_variables;Object.keys(t).forEach((e=>{let t=!1;if(a.forEach((a=>{a.value===e&&(t=!0)})),!t)throw`available_as_ofs key not in target_variables value. key=${e}`}));const s=e.models;e.initial_checked_models.forEach((e=>{if(!s.includes(e))throw`initial_checked_models model not in models: ${e}`}));const r=e.initial_interval;if(!e.intervals.includes(r))throw`initial_interval not in intervals: ${r}`;const n=a.map((e=>e.value)),o=e.initial_target_var;if(!n.includes(o))throw`initial_target_var not in target_variables: ${o}`;const l=e.initial_as_of;if(!t[o].includes(l))throw`initial_as_of not in available_as_ofs: ${l}`;const d=e.task_ids,c=e.initial_task_ids;if(m=new Set(Object.keys(d)),p=new Set(Object.keys(c)),m.size!==p.size||![...m].every((e=>p.has(e))))throw`initial_task_ids key !== task_ids: ${JSON.stringify(c)}`;var m,p;Object.keys(c).forEach((e=>{const t=c[e],a=d[e].map((e=>e.value));if(!a.includes(t))throw`initial_task_ids value not in task_ids. initialTaskIdValue=${t}, taskIdValues=${a}`}))}(s),this.state.target_variables=s.target_variables,this.state.task_ids=s.task_ids,this.state.intervals=s.intervals,this.state.available_as_ofs=s.available_as_ofs,this.state.current_date=s.current_date,this.state.models=s.models,this.state.disclaimer=s.disclaimer,this.state.colors=Array(parseInt(this.state.models.length/10,10)+1).fill(["#0d0887","#46039f","#7201a8","#9c179e","#bd3786","#d8576b","#ed7953","#fb9f3a","#fdca26","#f0f921"]).flat(),this.state.initial_xaxis_range=s.hasOwnProperty("initial_xaxis_range")?s.initial_xaxis_range:null,this.state.selected_target_var=s.initial_target_var,this.state.selected_interval=s.initial_interval,this.state.selected_as_of_date=s.initial_as_of,this.state.selected_models=s.initial_checked_models,this.initializeBootstrapComponents(),"function"!=typeof n)console.log("disabling human judgement ensemble model feature",n,typeof n),this.isUemEnabled=!1;else if(this.state.models.includes(r.name)){const e=r.name+"_"+Math.floor(Date.now()/1e3);this.state.models.includes(e)?(console.warn("USER_ENSEMBLE_MODEL.name conflict. disabling human judgement ensemble model feature",r.name,this.state.models),$("#uemInfoModalTitle").html("Disabling human judgement ensemble model feature"),$("#uemInfoModalBody").html(`The default name '${r.name}' was in the models list.`),$("#uemInfoModal").modal("show")):(r.name=e,console.warn("USER_ENSEMBLE_MODEL.name conflict. renamed",r.name,this.state.models,e))}console.log("initialize(): initializing UI"),function(e,t,a){function s(e,t){return $(`
\n \n
\n \n
\n
`)}const i=$('
'),r=$("
");r.append(s("target_variable","Outcome")),a.forEach((e=>{r.append(s(e,e.toLowerCase().replace(/\b\w/g,(e=>e.toUpperCase()))))})),r.append(s("intervals","Interval")),i.append(r);const n=$('
\n \n  Current (current truth date here)\n  \n
\n \n  (as of truth date here)\n  \n
');var o;i.append('
Select Truth Data:
'),i.append(n),o=t?'\n':"",i.append($(o+'\n\n')),i.append($('
'));const l=$('
'),d=$('
\n
\n \n \n
\n
');l.append($('

(disclaimer here)

')),l.append($('
')),l.append(d),l.append($('

Note: You can navigate to forecasts from previous weeks with the left and right arrow keys

')),e.empty().append(i,l)}($(o),this.isUemEnabled,Object.keys(this.state.task_ids)),this.initializeUI(s),this.addEventHandlers(),console.log("initialize(): fetching data and updating plot"),this.fetchDataUpdatePlot(!0,!0,!1),console.log("initialize(): done")},initializeUI(e){this.initializeTargetVarsUI(),this.initializeTaskIDsUI(e.initial_task_ids),this.initializeIntervalsUI(),this.updateModelsList(),$("#currentTruthDate").text(`Current (${this.state.current_date})`),this.updateTruthAsOfCheckboxText(),$("#disclaimer").text(this.state.disclaimer);const t=document.getElementById("ploty_div"),a=this.getPlotlyLayout();Plotly.newPlot(t,[],a,{modeBarButtonsToRemove:["lasso2d","autoScale2d"],modeBarButtonsToAdd:[{name:"Jump to As_Of",icon:{width:448,height:512,path:"M128 0c17.7 0 32 14.3 32 32V64H288V32c0-17.7 14.3-32 32-32s32 14.3 32 32V64h48c26.5 0 48 21.5 48 48v48H0V112C0 85.5 21.5 64 48 64H96V32c0-17.7 14.3-32 32-32zM0 192H448V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V192zm64 80v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm128 0v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V272c0-8.8-7.2-16-16-16H336zM64 400v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16zm144-16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H208zm112 16v32c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V400c0-8.8-7.2-16-16-16H336c-8.8 0-16 7.2-16 16z"},click:()=>null}]}),this.initializeDateRangePicker()},initializeDateRangePicker(){const t=$("[data-title='Jump to As_Of']"),a=l.state.available_as_ofs[l.state.selected_target_var];t.daterangepicker({singleDatePicker:!0,showDropdowns:!0,minYear:parseInt(a[0].slice(0,4)),maxYear:parseInt(a.at(-1).slice(0,4))}),t.on("apply.daterangepicker",(function(t,a){const s=a.startDate.format("YYYY-MM-DD"),i=function(t,a){if(0===a.length)throw new Error("availableYears is empty");if(-1!==a.indexOf(t))return t;const s=e(t),i=a.map((t=>e(t)));let r=null;return i.forEach((e=>{const t=null===r?null:Math.abs(r-s),a=Math.abs(e-s);(null===r||a