mirror of https://github.com/vladmandic/human
362 lines
941 KiB
JavaScript
362 lines
941 KiB
JavaScript
![]() |
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("tf")):"function"==typeof define&&define.amd?define(["tf"],e):"object"==typeof exports?exports.tfvis=e(require("tf")):t.tfvis=e(t.tf)}(window,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=59)}([function(t,e,n){"use strict";var r=function(t,e,n){return t.fields=e||[],t.fname=n,t};function i(t){return null==t?null:t.fname}function o(t){return null==t?null:t.fields}var a=function(t){return 1===t.length?s(t[0]):u(t)};const s=t=>(function(e){return e[t]}),u=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};var l=function(t){throw Error(t)},c=function(t){var e,n,r,i=[],o=null,a=0,s=t.length,u="";function c(){i.push(u+t.substring(e,n)),u="",e=n+1}for(t+="",e=n=0;n<s;++n)if("\\"===(r=t[n]))u+=t.substring(e,n),u+=t.substring(++n,++n),e=n;else if(r===o)c(),o=null,a=-1;else{if(o)continue;e===a&&'"'===r?(e=n+1,o=r):e===a&&"'"===r?(e=n+1,o=r):"."!==r||a?"["===r?(n>e&&c(),a=e=n+1):"]"===r&&(a||l("Access path missing open bracket: "+t),a>0&&c(),a=0,e=n+1):n>e?c():e=n+1}return a&&l("Access path missing closing bracket: "+t),o&&l("Access path missing closing quote: "+t),n>e&&(n++,c()),i},f=function(t,e,n){const i=c(t);return t=1===i.length?i[0]:t,r((n&&n.get||a)(i),[t],e||t)},d=[],h=f("id"),p=r(function(t){return t},d,"identity"),g=r(function(){return 0},d,"zero"),m=r(function(){return 1},d,"one"),v=r(function(){return!0},d,"true"),y=r(function(){return!1},d,"false");function b(t,e,n){var r=[e].concat([].slice.call(n));console[t].apply(console,r)}var x=function(t,e){var n=t||0;return{level:function(t){return arguments.length?(n=+t,this):n},error:function(){return n>=1&&b(e||"error","ERROR",arguments),this},warn:function(){return n>=2&&b(e||"warn","WARN",arguments),this},info:function(){return n>=3&&b(e||"log","INFO",arguments),this},debug:function(){return n>=4&&b(e||"log","DEBUG",arguments),this}}},_=Array.isArray,w=function(t){return t===Object(t)};const O=t=>"__proto__"!==t;function j(...t){return t.reduce((t,e)=>{for(var n in e)if("signals"===n)t.signals=A(t.signals,e.signals);else{var r="legend"===n?{layout:1}:"style"===n||null;k(t,n,e[n],r)}return t},{})}function k(t,e,n,r){var i,o;if(O(e))if(w(n)&&!_(n))for(i in o=w(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?k(o,i,n[i]):O(i)&&(o[i]=n[i]);else t[e]=n}function A(t,e){if(null==t)return e;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}var E=function(t){return t[t.length-1]},S=function(t){return null==t||""===t?null:+t};function D(t){return function(e){return t*Math.exp(e)}}function C(t){return function(e){return Math.log(t*e)}}function M(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function F(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function $(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function N(t,e,n,r){var i=n(t[0]),o=n(E(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function T(t,e){return N(t,e,S,p)}function z(t,e){var n=Math.sign(t[0]);return N(t,e,C(n),D(n))}function R(t,e,n){return N(t,e,$(n),$(1/n))}function P(t,e,n){return N(t,e,M(n),F(n))}function L(t,e,n,r,i){var o=r(t[0]),a=
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(49),o=n(50);e.getDrawArea=function(t){if(t instanceof HTMLElement)return t;if(i.isSurface(t))return t.drawArea;if(i.isSurfaceInfo(t))return o.visor().surface({name:t.name,tab:t.tab,styles:t.styles}).drawArea;throw new Error("Not a drawable")},e.shallowEquals=function(t,e){const n=Object.getOwnPropertyNames(t),r=Object.getOwnPropertyNames(e);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++){const i=n[r];if(t[i]!==e[i])return!1}return!0},e.nextFrame=function(){return r(this,void 0,void 0,function*(){yield new Promise(t=>requestAnimationFrame(t))})}},,function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/Object.defineProperty(e,"__esModule",{value:!0});const r=n(14),i=n(5),o={prepend:!1};e.subSurface=function(t,e,n={}){const a=i.getDrawArea(t),s=r.css({"& canvas":{display:"block"},marginTop:".5rem",marginBottom:".5rem"}),u=r.css({backgroundColor:"white",display:"inline-block",boxSizing:"border-box",borderBottom:"1px solid #357EDD",lineHeight:"2em",padding:"0 10px 0 10px",marginBottom:"20px",fontWeight:"600",textAlign:"left"}),l=Object.assign({},o,n);let c=a.querySelector(`div[data-name=${e}]`);if(!c){if((c=document.createElement("div")).setAttribute("class",`${s}`),c.dataset.name=e,l.title){const t=document.createElement("div");t.setAttribute("class",`subsurface-title ${u}`),t.innerText=l.title,c.appendChild(t)}l.prepend?a.insertBefore(c,a.firstChild):a.appendChild(c)}return c},e.getDefaultWidth=function(t){let e=0,n=t;for(;n&&0===n.clientWidth;)n=n.parentElement,e=50;return n.clientWidth-e},e.getDefaultHeight=function(t){return 0===t.clientHeight?200:t.clientHeight}},function(t,e,n){"use strict";t.exports=function(t,e){e||(e={}),"function"==typeof e&&(e={cmp:e});var n="boolean"==typeof e.cycles&&e.cycles,r=e.cmp&&function(t){return function(e){return function(n,r){var i={key:n,value:e[n]},o={key:r,value:e[r]};return t(i,o)}}}(e.cmp),i=[];return function t(e){if(e&&e.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0!==e){if("number"==typeof e)return isFinite(e)?""+e:"null";if("object"!=typeof e)return JSON.stringify(e);var o,a;if(Array.isArray(e)){for(a="[",o=0;o<e.length;o++)o&&(a+=","),a+=t(e[o])||"null";return a+"]"}if(null===e)return"null";if(-1!==i.indexOf(e)){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=i.push(e)-1,u=Object.keys(e).sort(r&&r(e));for(a="",o=0;o<u.length;o++){var l=u[o],c=t(e[l]);c&&(a&&(a+=","),a+=JSON.stringify(l)+":"+c)}return i.splice(s,1),"{"+a+"}"}}(t)}},function(t,e,n){const{MAX_SAFE_COMPONENT_LENGTH:r}=n(17),i=n(18),o=(e=t.exports={}).re=[],a=e.src=[],s=e.t={};let u=0;const l=(t,e,n)=>{const r=u++;i(r,e),s[t]=r,a[r]=e,o[r]=new RegExp(e,n?"g":void 0)};l("NUMERICIDENTIFIER","0|[1-9]\\d*"),l("NUMERICIDENTIFIERLOOSE","[0-9]+"),l("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),l("MAINVERSION",`(${a[s.NUMERICIDENTIFIER]})\\.`+`(${a[s.NUMERICIDENTIFIER]})\\.`+`(${a[s.NUMERICIDENTIFIER]})`),l("MAINVERSIONLOOSE",`(${a[s.NUMERICIDENTIFIERLOOSE]})\\.`+`(${a[s.NUMERICIDENTIFIERLOOSE]})\\.`+`(${a[s.NUMERICIDENTIFIERLOOSE]})`),l("PRERELEASEIDENTIFIER",`(?:${a[s.NUMERICIDENTIFIER]}|${a[s.NONNUMERICIDENTIFIER]})`),l("PRERELEASEIDENTIFIERLOOSE",`(?:${a[s.NUMERICIDENTIFIERLOOSE]}|${a[s.NONNUMERICIDENTIFIER]})`),l("PRERELEASE",`(?:-(${a[s.PRERELEASEIDENTIFIER]}(?:\\.${a[s.PRERELEASEIDENTIFIER]})*))`),l("PRERELEASELOOSE",`(?:-?(${a[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${a[s.PRERELEASEIDENTIFIERLOOSE]})*))`),l("BUILDIDENTIFIER","[0-9A-Za-z-]+"),l("BUILD",`(?:\\+(${a[s.BUILDIDENTIFIER]}(?:\\.${a[s.BUILDIDENTIFIER]})*))`),l("FULLPLAIN",`v?${a[s.MAINVERSION]}${a[s.PRERELEASE]}?${a[s.BUILD]}?`),l("FULL",`^${a[s.FULLPLAIN]}$`),l("LOOSEPLAIN",`[v=\\s]*${a[s.MAINVERSIONLOOSE]}${a[s.PRERELEASELOOSE]}?${a[s.BUILD]}?`),l("LOOSE",`^${a[s.LOOSEPLAIN]}$`),l("GTLT","((?:<|>)?=?)"),l("XRANGEIDENTIFIERLOOSE",`${a[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),l("XRANGEIDENTIFIER",`${a[s.NUMERICIDENTIFIER]}|x|X|\\*`),l("XRANGEPLAIN",`[v=\\s]*(${a[s.XRANGEIDENTIFIER]})`+`(?:\\.(${a[s.XRANGEIDENTIFIER]})`+`(?:\\.(${a[s.XRANGEIDENTIFIER]})`+`(?:${a[s.PRERELEASE]})?${a[s.BUILD]}?`+")?)?"),l("XRANGEPLAINLOOSE",`[v=\\s]*(${a[s.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})`+`(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})`+`(?:${a[s.PRERELEASELOOSE]})?${a[s.BUILD]}?`+")?)?"),l("XRANGE",`^${a[s.GTLT]}\\s*${a[s.XRANGEPLAIN]}$`),l("XRANGELOOSE",`^${a[s.GTLT]}\\s*${a[s.XRANGEPLAINLOOSE]}$`),l("COERCE",`(^|[^\\d])(\\d{1,${r}})`+`(?:\\.(\\d{1,${r}}))?`+`(?:\\.(\\d{1,${r}}))?`+"(?:$|[^\\d])"),l("COERCERTL",a[s.COERCE],!0),l("LONETILDE","(?:~>?)"),l("TILDETRIM",`(\\s*)${a[s.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",l("TILDE",`^${a[s.LONETILDE]}${a[s.XRANGEPLAIN]}$`
|
||
|
/*!
|
||
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
||
|
* (c) 2017 Joachim Wester
|
||
|
* MIT license
|
||
|
*/
|
||
|
var _=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),w=Object.prototype.hasOwnProperty;function O(t,e){return w.call(t,e)}function j(t){if(Array.isArray(t)){for(var e=new Array(t.length),n=0;n<e.length;n++)e[n]=""+n;return e}if(Object.keys)return Object.keys(t);e=[];for(var r in t)O(t,r)&&e.push(r);return e}function k(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function A(t){for(var e,n=0,r=t.length;n<r;){if(!((e=t.charCodeAt(n))>=48&&e<=57))return!1;n++}return!0}function E(t){return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function S(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function D(t,e){var n=[t];for(var r in e){var i="object"==typeof e[r]?JSON.stringify(e[r],null,2):e[r];void 0!==i&&n.push(r+": "+i)}return n.join("\n")}var C=function(t){function e(e,n,r,i,o){var a=this.constructor,s=t.call(this,D(e,{name:n,index:r,operation:i,tree:o}))||this;return s.name=n,s.index=r,s.operation=i,s.tree=o,Object.setPrototypeOf(s,a.prototype),s.message=D(e,{name:n,index:r,operation:i,tree:o}),s}return _(e,t),e}(Error),M=C,F=k,$={add:function(t,e,n){return t[e]=this.value,{newDocument:n}},remove:function(t,e,n){var r=t[e];return delete t[e],{newDocument:n,removed:r}},replace:function(t,e,n){var r=t[e];return t[e]=this.value,{newDocument:n,removed:r}},move:function(t,e,n){var r=T(n,this.path);r&&(r=k(r));var i=z(n,{op:"remove",path:this.from}).removed;return z(n,{op:"add",path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(t,e,n){var r=T(n,this.from);return z(n,{op:"add",path:this.path,value:k(r)}),{newDocument:n}},test:function(t,e,n){return{newDocument:n,test:I(t[e],this.value)}},_get:function(t,e,n){return this.value=t[e],{newDocument:n}}},N={add:function(t,e,n){return A(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:n,index:e}},remove:function(t,e,n){return{newDocument:n,removed:t.splice(e,1)[0]}},replace:function(t,e,n){var r=t[e];return t[e]=this.value,{newDocument:n,removed:r}},move:$.move,copy:$.copy,test:$.test,_get:$._get};function T(t,e){if(""==e)return t;var n={op:"_get",path:e};return z(t,n),n.value}function z(t,e,n,r,i,o){if(void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===i&&(i=!0),void 0===o&&(o=0),n&&("function"==typeof n?n(e,0,t,e.path):L(e,0)),""===e.path){var a={newDocument:t};if("add"===e.op)return a.newDocument=e.value,a;if("replace"===e.op)return a.newDocument=e.value,a.removed=t,a;if("move"===e.op||"copy"===e.op)return a.newDocument=T(t,e.from),"move"===e.op&&(a.removed=t),a;if("test"===e.op){if(a.test=I(t,e.value),!1===a.test)throw new M("Test operation failed","TEST_OPERATION_FAILED",o,e,t);return a.newDocument=t,a}if("remove"===e.op)return a.removed=t,a.newDocument=null,a;if("_get"===e.op)return e.value=t,a;if(n)throw new M("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,e,t);return a}r||(t=k(t));var s=(e.path||"").split("/"),u=t,l=1,c=s.length,f=void 0,d=void 0,h=void 0;for(h="function"==typeof n?n:L;;){if(d=s[l],i&&"__proto__"==d)throw new TypeError("JSON-Patch: modifying `__proto__` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===f&&(void 0===u[d]?f=s.slice(0,l).join("/"):l==c-1&&(f=e.path),void 0!==f&&h(e,0,t,f)),l++,Array.isArray(u)){if("-"===d)d=u.length;else{if(n&&!A(d))throw new M("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,e,t);A(d)&&(d=~~d)}if(l>=c){if(n&&"add"===e.op&&d>u.length)throw new M("The specified index MUST NOT be greater than the number of elements in the array",
|
||
|
/*!
|
||
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
||
|
* (c) 2017 Joachim Wester
|
||
|
* MIT license
|
||
|
*/
|
||
|
var U=new WeakMap,q=function(){return function(t){this.observers=new Map,this.obj=t}}(),W=function(){return function(t,e){this.callback=t,this.observer=e}}();function H(t,e){e.unobserve()}function Y(t,e){var n,r=function(t){return U.get(t)}(t);if(r){var i=function(t,e){return t.observers.get(e)}(r,e);n=i&&i.observer}else r=new q(t),U.set(t,r);if(n)return n;if(n={},r.value=k(t),e){n.callback=e,n.next=null;var o=function(){G(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(o)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=[],n.object=t,n.unobserve=function(){G(n),clearTimeout(n.next),function(t,e){t.observers.delete(e.callback)}(r,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},r.observers.set(e,new W(e,n)),n}function G(t,e){void 0===e&&(e=!1);var n=U.get(t.object);V(n.value,t.object,t.patches,"",e),t.patches.length&&R(n.value,t.patches);var r=t.patches;return r.length>0&&(t.patches=[],t.callback&&t.callback(r)),r}function V(t,e,n,r,i){if(e!==t){"function"==typeof e.toJSON&&(e=e.toJSON());for(var o=j(e),a=j(t),s=!1,u=a.length-1;u>=0;u--){var l=t[f=a[u]];if(!O(e,f)||void 0===e[f]&&void 0!==l&&!1===Array.isArray(e))Array.isArray(t)===Array.isArray(e)?(i&&n.push({op:"test",path:r+"/"+E(f),value:k(l)}),n.push({op:"remove",path:r+"/"+E(f)}),s=!0):(i&&n.push({op:"test",path:r,value:t}),n.push({op:"replace",path:r,value:e}),!0);else{var c=e[f];"object"==typeof l&&null!=l&&"object"==typeof c&&null!=c?V(l,c,n,r+"/"+E(f),i):l!==c&&(!0,i&&n.push({op:"test",path:r+"/"+E(f),value:k(l)}),n.push({op:"replace",path:r+"/"+E(f),value:k(c)}))}}if(s||o.length!=a.length)for(u=0;u<o.length;u++){var f;O(t,f=o[u])||void 0===e[f]||n.push({op:"add",path:r+"/"+E(f),value:k(e[f])})}}}function Z(t,e,n){void 0===n&&(n=!1);var r=[];return V(t,e,r,"",n),r}Object.assign({},r,i,{JsonPatchError:C,deepClone:k,escapePathComponent:E,unescapePathComponent:S});var X=n(26),J=n.n(X),Q=n(38),K=n(0);function tt(t){var e=t||K.x,n=[],r={};return n.add=function(t){var i=e(t);return r[i]||(r[i]=1,n.push(t)),n},n.remove=function(t){var i,o=e(t);return r[o]&&(r[o]=0,(i=n.indexOf(t))>=0&&n.splice(i,1)),n},n}var et=async function(t,e){try{await e(t)}catch(e){t.error(e)}},nt=Symbol("vega_id"),rt=1;function it(t){return!(!t||!ot(t))}function ot(t){return t[nt]}function at(t,e){return t[nt]=e,t}function st(t){var e=t===Object(t)?t:{data:t};return ot(e)?e:at(e,rt++)}function ut(t){return lt(t,st({}))}function lt(t,e){for(var n in t)e[n]=t[n];return e}function ct(t,e){return at(e,ot(t))}function ft(t,e){return t?e?(n,r)=>t(n,r)||ot(e(n))-ot(e(r)):(e,n)=>t(e,n)||ot(e)-ot(n):null}function dt(t){return t&&t.constructor===ht}function ht(){var t=[],e=[],n=[],r=[],i=[],o=null,a=!1;return{constructor:ht,insert:function(e){for(var n=Object(K.i)(e),r=0,i=n.length;r<i;++r)t.push(n[r]);return this},remove:function(t){for(var n=Object(K.D)(t)?r:e,i=Object(K.i)(t),o=0,a=i.length;o<a;++o)n.push(i[o]);return this},modify:function(t,e,r){var o={field:e,value:Object(K.l)(r)};return Object(K.D)(t)?(o.filter=t,i.push(o)):(o.tuple=t,n.push(o)),this},encode:function(t,e){return Object(K.D)(t)?i.push({filter:t,field:e}):n.push({tuple:t,field:e}),this},clean:function(t){return o=t,this},reflow:function(){return a=!0,this},pulse:function(s,u){var l,c,f,d,h,p,g={},m={};for(l=0,c=u.length;l<c;++l)g[ot(u[l])]=1;for(l=0,c=e.length;l<c;++l)g[ot(h=e[l])]=-1;for(l=0,c=r.length;l<c;++l)d=r[l],u.forEach(function(t){d(t)&&(g[ot(t)]=-1)});for(l=0,c=t.length;l<c;++l)p=ot(h=t[l]),g[p]?g[p]=1:s.add.push(st(t[l]));for(l=0,c=u.length;l<c;++l)h=u[l],g[ot(h)]<0&&s.rem.push(h);function v(t,e,n){n?t[e]=n(t):s.encode=e,a||(m[ot(t)]=t)}for(l=0,c=n.length;l<c;++l)h=(f=n[l]).tuple,d=f.field,(p=g[ot(h)])>0&&(v(h,d,f.value),s.modifies(d));for(l=0,c=i.length
|
||
|
/*! *****************************************************************************
|
||
|
Copyright (c) Microsoft Corporation.
|
||
|
|
||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||
|
purpose with or without fee is hereby granted.
|
||
|
|
||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
|
PERFORMANCE OF THIS SOFTWARE.
|
||
|
***************************************************************************** */function wz(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}Object.create;Object.create;Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function t(){var e=isNaN(arguments[0])?1:Number(arguments[0]);return e?Array.prototype.reduce.call(this,function(n,r){return Array.isArray(r)?n.push.apply(n,t.call(r,e-1)):n.push(r),n},[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{configurable:!0,value:function(t){return Array.prototype.map.apply(this,arguments).flat()},writable:!0});var Oz=n(55),jz=n.n(Oz),kz=n(56),Az=n.n(kz),Ez=n(8),Sz=n.n(Ez);function Dz(t){return!!t.or}function Cz(t){return!!t.and}function Mz(t){return!!t.not}const Fz=Az.a,$z=jz.a;function Nz(t,e){const n={};for(const r of e)Object(K.v)(t,r)&&(n[r]=t[r]);return n}function Tz(t,e){const n=Object.assign({},t);for(const t of e)delete n[t];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(t=>Sz()(t)).join(",")})`};const zz=Sz.a;function Rz(t){if(Object(K.E)(t))return t;const e=Object(K.H)(t)?t:Sz()(t);if(e.length<250)return e;let n=0;for(let t=0;t<e.length;t++){n=(n<<5)-n+e.charCodeAt(t),n&=n}return n}function Pz(t){return!1===t||null===t}function Lz(t,e){return t.indexOf(e)>-1}function Bz(t,e){let n=0;for(const[r,i]of t.entries())if(e(i,r,n++))return!0;return!1}function Iz(t,e){let n=0;for(const[r,i]of t.entries())if(!e(i,r,n++))return!1;return!0}function Uz(t,e){for(const n of Vz(e))Object(K.jb)(t,n,e[n],!0)}function qz(t,e){const n=[],r={};let i;for(const o of t)(i=e(o))in r||(r[i]=1,n.push(o));return n}function Wz(t,e){for(const n of t)if(e.has(n))return!0;return!1}function Hz(t){const e=new Set;for(const n of t){const t=Object(K.Y)(n).map((t,e)=>0===e?t:`[${t}]`),r=t.map((e,n)=>t.slice(0,n+1).join(""));for(const t of r)e.add(t)}return e}function Yz(t,e){return void 0===t||void 0===e||Wz(Hz(t),Hz(e))}function Gz(t){return 0===Vz(t).length}const Vz=Object.keys,Zz=Object.values;function Xz(t){const e=[];for(const n in t)Object(K.v)(t,n)&&e.push({key:n,value:t[n]});return e}function Jz(t){return!0===t||!1===t}function Qz(t){const e=t.replace(/\W/g,"_");return(t.match(/^\d+/)?"_":"")+e}function Kz(t,e){return Mz(t)?"!("+Kz(t.not,e)+")":Cz(t)?"("+t.and.map(t=>Kz(t,e)).join(") && (")+")":Dz(t)?"("+t.or.map(t=>Kz(t,e)).join(") || (")+")":e(t)}function tR(t,e){if(0===e.length)return!0;const n=e.shift();return n in t&&tR(t[n],e)&&delete t[n],Gz(t)}function eR(t){return t.charAt(0).toUpperCase()+t.substr(1)}function nR(t,e="datum"){const n=Object(K.Y)(t),r=[];for(let t=1;t<=n.length;t++){const i=`[${n.slice(0,t).map(K.Z).join("][")}]`;r.push(`${e}${i}`)}return r.join(" && ")}function rR(t){return t.replace(/(\[|\]|\.|'|")/g,"\\$1")}function iR(t){return`${Object(K.Y)(t).map(rR).join("\\.")}`}function oR(t,e,n){return t.replace(new RegExp(e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function aR(t){return`${Object(K.Y)(t).join(".")}`}function sR(t){return t?Object(K.Y)(t).length:0}function uR(...t){for(const e of t)if(void 0!==e)return e}let lR=42;function cR(t){const e=++lR;return t?String(t)+e:e}function fR(t){if(void 0!==t)return(t%360+360)%360}function dR(t){return!!Object(K.E)(t)||!isNaN(t)&&!isNaN(parseFloat(t))}const hR={domainColor:{part:"domain",vgProp:"stroke"},labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vg
|
||
|
/*
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/
|
||
|
function r(t,e){if(!t)throw new Error("string"==typeof e?e:e())}function i(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}Object.defineProperty(e,"__esModule",{value:!0}),e.assert=r,e.assertShapesMatch=function(t,e,n=""){r(i(t,e),n+` Shapes ${t} and ${e} must match`)},e.arraysEqual=i,e.DECIMAL_PLACES_TO_CHECK=4},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(51),o=n(22);e.arrayStats=function(t){if(!Array.isArray(t))throw new Error("input must be an array");if(0===t.length)return{numVals:0,numNans:0,numZeros:0,max:void 0,min:void 0};const e=t.length;let n=-1/0,r=1/0,i=0,o=0,a=0;for(let s=0;s<e;s++){const e=t[s];e>n&&(n=e),e<r&&(r=e),0===e&&(i+=1),isNaN(e)?o+=1:isFinite(e)||(a+=1)}const s={numVals:e,numZeros:i,numNans:o,max:n,min:r,numInfs:a};return s.max===-1/0&&(s.max=NaN),s.min===1/0&&(s.min=NaN),s},e.tensorStats=function(t){return r(this,void 0,void 0,function*(){const[e,n,r]=i.tidy(()=>{const e=i.scalar(0,t.dtype);return[t.min(),t.max(),t.equal(e).sum()]});return Promise.all([t.data(),e.data(),n.data(),r.data()]).then(([t,e,n,r])=>{const i=t.length;let o=0,a=0;for(let e=0;e<i;e++){const n=t[e];isNaN(n)?o+=1:isFinite(n)||(a+=1)}let s=e[0],u=n[0];return o===i&&(s=NaN,u=NaN),{numVals:i,numZeros:r[0],numNans:o,min:s,max:u,numInfs:a}})})},e.confusionMatrix=function(t,e,n,a){return r(this,void 0,void 0,function*(){o.assert(1===t.rank,"labels must be a 1D tensor"),o.assert(1===e.rank,"predictions must be a 1D tensor"),o.assert(t.size===e.size,"labels and predictions must be the same length"),null!=a&&o.assert(a.size===e.size,"labels and predictions must be the same length");const r=t.cast("int32"),s=e.cast("int32");null==n&&(n=i.tidy(()=>i.maximum(r.max(),s.max()).cast("int32").dataSync()[0]+1));let u=Promise.resolve(null);return null!=a&&(u=a.data()),Promise.all([r.data(),s.data(),u]).then(([t,e,r])=>{const i=Array(n).fill(0);for(let t=0;t<n;t++)i[t]=Array(n).fill(0);for(let n=0;n<t.length;n++){const o=t[n],a=e[n];i[o][a]+=null!=r?r[n]:1}return i})})},e.accuracy=function(t,e){return r(this,void 0,void 0,function*(){o.assertShapesMatch(t.shape,e.shape,"Error computing accuracy.");const n=t.equal(e),r=n.mean(),a=(yield r.data())[0];return i.dispose([n,r]),a})},e.perClassAccuracy=function(t,e,n){return r(this,void 0,void 0,function*(){return o.assert(1===t.rank,"labels must be a 1D tensor"),o.assert(1===e.rank,"predictions must be a 1D tensor"),o.assert(t.size===e.size,"labels and predictions must be the same length"),null==n&&(n=i.tidy(()=>i.maximum(t.max(),e.max()).dataSync()[0]+1)),Promise.all([t.data(),e.data()]).then(([t,e])=>{const r=Array(n).fill(0),i=Array(n).fill(0);for(let n=0;n<t.length;n++){const o=t[n],a=e[n];r[o]+=1,o===a&&(i[o]+=1)}const o=[];for(let t=0;t<r.length;t++)o.push({count:r[t],accuracy:0===r[t]?0:i[t]/r[t]});return o})})}},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/Object.defineProperty(e,"__esModule",{value:!0});const r=n(53),i=n(134),o=n(14),a=n(5);e.table=function(t,e,n={}){if(e&&null==e.headers)throw new Error('Data to render must have a "headers" property');if(e&&null==e.values)throw new Error('Data to render must have a "values" property');const u=a.getDrawArea(t),l=Object.assign({},s,n);let c=i.select(u).select("table.tf-table");const f=o.css({fontSize:l.fontSize||".875rem",width:"100%",maxWidth:"64rem",marginRight:"auto",marginLeft:"auto"});if(0===c.size()&&((c=i.select(u).append("table")).attr("class",` ${f} tf-table`),c.append("thead").append("tr"),c.append("tbody")),1!==c.size())throw new Error("Error inserting table");const d=o.css({fontWeight:"600",borderBottomStyle:"solid",borderBottomWidth:"1px",borderColor:"rgba( 0, 0, 0, .2 )",textAlign:"left",paddingBottom:"1rem",paddingRight:"1rem",backgroundColor:"#fff"}),h=c.select("thead").select("tr").selectAll("th").data(e.headers),p=h.enter().append("th").attr("class",`${d}`);h.merge(p).html(t=>t),h.exit().remove();const g=r.format(",.4~f"),m=c.select("tbody").selectAll("tr").data(e.values),v=m.enter().append("tr"),y=o.css({padding:"0.25rem",borderBottomStyle:"solid",borderBottomWidth:"1px",borderColor:"rgba( 0, 0, 0, .2 )"}),b=m.merge(v).selectAll("td").data(t=>t),x=b.enter().append("td").attr("class",`${y}`);b.merge(x).html(t=>"number"==typeof t?g(t):t),b.exit().remove(),m.exit().remove()};const s={fontSize:14}},function(t,e,n){"use strict";(function(t){n.d(e,"a",function(){return i});var r=n(0);function i(e,n){const i=n&&n.property?Object(r.t)(n.property):r.x;return Object(r.F)(e)&&!function(e){return!("function"!=typeof t||!Object(r.D)(t.isBuffer))&&t.isBuffer(e)}(e)?function(t,e){return e&&e.copy?JSON.parse(JSON.stringify(t)):t}(i(e)):i(JSON.parse(e))}i.responseType="json"}).call(this,n(44).Buffer)},function(t,e,n){"use strict";var r=/("(?:[^\\"]|\\.)*")|[:,]/g;t.exports=function(t,e){var n,i,o;return e=e||{},n=JSON.stringify([1],void 0,void 0===e.indent?2:e.indent).slice(2,-3),i=""===n?1/0:void 0===e.maxLength?80:e.maxLength,o=e.replacer,function t(e,a,s){var u,l,c,f,d,h,p,g,m,v,y,b;if(e&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0===(y=JSON.stringify(e,o)))return y;if(p=i-a.length-s,y.length<=p&&(m=y.replace(r,function(t,e){return e||t+" "})).length<=p)return m;if(null!=o&&(e=JSON.parse(y),o=void 0),"object"==typeof e&&null!==e){if(g=a+n,c=[],l=0,Array.isArray(e))for(v="[",u="]",p=e.length;l<p;l++)c.push(t(e[l],g,l===p-1?0:1)||"null");else for(v="{",u="}",p=(h=Object.keys(e)).length;l<p;l++)f=h[l],d=JSON.stringify(f)+": ",void 0!==(b=t(e[f],g,d.length+(l===p-1?0:1)))&&c.push(d+b);if(c.length>0)return[v,n+c.join(",\n"+g),u].join("\n"+a)}return y}(t,"",0)}},,function(t,e){const n=/^[0-9]+$/,r=(t,e)=>{const r=n.test(t),i=n.test(e);return r&&i&&(t=+t,e=+e),t===e?0:r&&!i?-1:i&&!r?1:t<e?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(t,e)=>r(e,t)}},function(t,e,n){const r=n(3);t.exports=((t,e,n)=>0===r(t,e,n))},function(t,e,n){const r=n(2);t.exports=((t,e,n)=>{const i=new r(t,n),o=new r(e,n);return i.compare(o)||i.compareBuild(o)})},function(t,e,n){const r=n(3);t.exports=((t,e,n)=>r(t,e,n)<0)},function(t,e,n){const r=n(3);t.exports=((t,e,n)=>r(t,e,n)>=0)},function(t,e,n){const r=n(3);t.exports=((t,e,n)=>r(t,e,n)<=0)},function(t,e,n){const r=n(2),i=n(20),{ANY:o}=i,a=n(4),s=n(21),u=n(19),l=n(31),c=n(33),f=n(32);t.exports=((t,e,n,d)=>{let h,p,g,m,v;switch(t=new r(t,d),e=new a(e,d),n){case">":h=u,p=c,g=l,m=">",v=">=";break;case"<":h=l,p=f,g=u,m="<",v="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(t,e,d))return!1;for(let n=0;n<e.set.length;++n){let r=null,a=null;if(e.set[n].forEach(t=>{t.semver===o&&(t=new i(">=0.0.0")),r=r||t,a=a||t,h(t.semver,r.semver,d)?r=t:g(t.semver,a.semver,d)&&(a=t)}),r.operator===m||r.operator===v)return!1;if((!a.operator||a.operator===m)&&p(t,a.semver))return!1;if(a.operator===v&&g(t,a.semver))return!1}return!0})},function(t,e,n){"use strict";
|
||
|
/*
|
||
|
object-assign
|
||
|
(c) Sindre Sorhus
|
||
|
@license MIT
|
||
|
*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,a,s=function(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var l in n=Object(arguments[u]))i.call(n,l)&&(s[l]=n[l]);if(r){a=r(n);for(var c=0;c<a.length;c++)o.call(n,a[c])&&(s[a[c]]=n[a[c]])}}return s}},function(t,e,n){"use strict";n.r(e),n.d(e,"h",function(){return a}),n.d(e,"createElement",function(){return a}),n.d(e,"cloneElement",function(){return l}),n.d(e,"Component",function(){return T}),n.d(e,"render",function(){return z}),n.d(e,"rerender",function(){return h}),n.d(e,"options",function(){return r});var r={},i=[],o=[];function a(t,e){var n,a,s,u,l=o;for(u=arguments.length;u-- >2;)i.push(arguments[u]);for(e&&null!=e.children&&(i.length||i.push(e.children),delete e.children);i.length;)if((a=i.pop())&&void 0!==a.pop)for(u=a.length;u--;)i.push(a[u]);else"boolean"==typeof a&&(a=null),(s="function"!=typeof t)&&(null==a?a="":"number"==typeof a?a=String(a):"string"!=typeof a&&(s=!1)),s&&n?l[l.length-1]+=a:l===o?l=[a]:l.push(a),n=s;var c=new function(){};return c.nodeName=t,c.children=l,c.attributes=null==e?void 0:e,c.key=null==e?void 0:e.key,void 0!==r.vnode&&r.vnode(c),c}function s(t,e){for(var n in e)t[n]=e[n];return t}var u="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;function l(t,e){return a(t.nodeName,s(s({},t.attributes),e),arguments.length>2?[].slice.call(arguments,2):t.children)}var c=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,f=[];function d(t){!t._dirty&&(t._dirty=!0)&&1==f.push(t)&&(r.debounceRendering||u)(h)}function h(){var t,e=f;for(f=[];t=e.pop();)t._dirty&&$(t)}function p(t,e,n){return"string"==typeof e||"number"==typeof e?void 0!==t.splitText:"string"==typeof e.nodeName?!t._componentConstructor&&g(t,e.nodeName):n||t._componentConstructor===e.nodeName}function g(t,e){return t.normalizedNodeName===e||t.nodeName.toLowerCase()===e.toLowerCase()}function m(t){var e=s({},t.attributes);e.children=t.children;var n=t.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===e[r]&&(e[r]=n[r]);return e}function v(t){var e=t.parentNode;e&&e.removeChild(t)}function y(t,e,n,r,i){if("className"===e&&(e="class"),"key"===e);else if("ref"===e)n&&n(null),r&&r(t);else if("class"!==e||i)if("style"===e){if(r&&"string"!=typeof r&&"string"!=typeof n||(t.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var o in n)o in r||(t.style[o]="");for(var o in r)t.style[o]="number"==typeof r[o]&&!1===c.test(o)?r[o]+"px":r[o]}}else if("dangerouslySetInnerHTML"===e)r&&(t.innerHTML=r.__html||"");else if("o"==e[0]&&"n"==e[1]){var a=e!==(e=e.replace(/Capture$/,""));e=e.toLowerCase().substring(2),r?n||t.addEventListener(e,b,a):t.removeEventListener(e,b,a),(t._listeners||(t._listeners={}))[e]=r}else if("list"!==e&&"type"!==e&&!i&&e in t)!function(t,e,n){try{t[e]=n}catch(t){}}(t,e,null==r?"":r),null!=r&&!1!==r||t.removeAttribute(e);else{var s=i&&e!==(e=e.replace(/^xlink:?/,""));null==r||!1===r?s?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.removeAttribute(e):"function"!=typeof r&&(s?t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),r):t.setAttribute(e,r))}else t.className=r||""}function b(t){return this._listeners[t.type](r.event&&r.event(t)||t)}var x=[],_=0,w=!1,O=!1;function j(){for(var t;t=x.pop();)r.afterMount&&r.afterMount(t),t.componentDidMount&&t.componentDidMount()}function k(t,e,n,r,i,o){_++||(w=null!=i&&void 0!==i.ownerSV
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(53),a=i(n(11)),s=n(7),u=n(23),l=n(24),c={maxBins:12,fontSize:11};e.histogram=function(t,e,n={}){return r(this,void 0,void 0,function*(){const r=function(t){if(null==t.length)throw new Error("input data must be an array");if(0===t.length)return[];if("object"==typeof t[0]){if(null==t[0].value)throw new Error("input data must have a value field");return t}{const e=Array(t.length);for(let n=0;n<t.length;n++)e[n]={value:t[n]};return e}}(e),i=Object.assign({},c,n),f=s.subSurface(t,"histogram");if(!1!==n.stats){const e=s.subSurface(t,"stats",{prepend:!0});let a;!function(t,e,n){const r=o.format(",.4~f"),i=o.format(".4~p"),a=[],s=[];if(null!=t.numVals&&(a.push("Num Vals"),s.push(r(t.numVals))),null!=t.min&&(a.push("Min"),s.push(r(t.min))),null!=t.max&&(a.push("Max"),s.push(r(t.max))),null!=t.numZeros){a.push("# Zeros");let e="";t.numVals&&(e=t.numZeros>0?`(${i(t.numZeros/t.numVals)})`:""),s.push(`${r(t.numZeros)} ${e}`)}if(null!=t.numNans){a.push("# NaNs");let e="";t.numVals&&(e=t.numNans>0?`(${i(t.numNans/t.numVals)})`:""),s.push(`${r(t.numNans)} ${e}`)}if(null!=t.numInfs){a.push("# Infinity");let e="";t.numVals&&(e=t.numInfs>0?`(${i(t.numInfs/t.numVals)})`:""),s.push(`${r(t.numInfs)} ${e}`)}l.table(e,{headers:a,values:[s]},n)}(a=n.stats?n.stats:u.arrayStats(r.map(t=>t.value)),e,{fontSize:i.fontSize})}if(0===r.length)return;const d=[];for(let t=0;t<r.length;t++){const e=r[t].value;null!=e&&isFinite(e)&&d.push(r[t])}const h={width:i.width||s.getDefaultWidth(f),height:i.height||s.getDefaultHeight(f),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},data:{values:d},mark:{type:"bar",tooltip:!0},config:{axis:{labelFontSize:i.fontSize,titleFontSize:i.fontSize},text:{fontSize:i.fontSize},legend:{labelFontSize:i.fontSize,titleFontSize:i.fontSize}},encoding:{x:{bin:{maxbins:i.maxBins},field:"value",type:"quantitative"},y:{aggregate:"count",type:"quantitative"},color:{value:i.color||"#001B44"}}};return a.default(f,h,{actions:!1,mode:"vega-lite",defaultStyle:!1})})}},function(t,e,n){const r=n(9);t.exports={re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:n(17).SEMVER_SPEC_VERSION,SemVer:n(2),compareIdentifiers:n(28).compareIdentifiers,rcompareIdentifiers:n(28).rcompareIdentifiers,parse:n(10),valid:n(68),clean:n(69),inc:n(70),diff:n(71),major:n(72),minor:n(73),patch:n(74),prerelease:n(75),compare:n(3),rcompare:n(76),compareLoose:n(77),compareBuild:n(30),sort:n(78),rsort:n(79),gt:n(19),lt:n(31),eq:n(29),neq:n(42),gte:n(32),lte:n(33),cmp:n(43),coerce:n(80),Comparator:n(20),Range:n(4),satisfies:n(21),toComparators:n(81),maxSatisfying:n(82),minSatisfying:n(83),minVersion:n(84),validRange:n(85),outside:n(34),gtr:n(86),ltr:n(87),intersects:n(88),simplifyRange:n(89),subset:n(90)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=/\/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(t).slice(1,3);return{library:e[0],version:e[1]}}},,,function(t,e,n){const r=n(3);t.exports=((t,e,n)=>0!==r(t,e,n))},function(t,e,n){const r=n(29),i=n(42),o=n(19),a=n(32),s=n(31),u=n(33);t.exports=((t,e,n,l)=>{switch(e){case"===":return"object"==typeof t&&(t=t.version),"object"==typeof n&&(n=n.version),t===n;case"!==":return"object"==typeof t&&(t=t.version),"object"==typeof n&&(n=n.version),t!==n;case"":case"=":case"==":return r(t,n,l);case"!=":return i(t,n,l);case">":return o(t,n,l);case">=":return a(t,n,l);case"<":return s(t,n,l);case"<=":return u(t,n,l);default:throw new TypeError(`Invalid operator: ${e}`)}})},function(t,e,n){"use strict";(function(t){
|
||
|
/*!
|
||
|
* The buffer module from node.js, for the browser.
|
||
|
*
|
||
|
* @author Feross Aboukhadijeh <http://feross.org>
|
||
|
* @license MIT
|
||
|
*/
|
||
|
var r=n(92),i=n(93),o=n(94);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return l(this,t,e,n)}function l(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=d(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(e,n),i=(t=s(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(u.isBuffer(e)){var n=0|h(e.length);return 0===(t=s(t,n)).length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||function(t){return t!=t}(e.length)?s(t,0):d(t,e);if("Buffer"===e.type&&o(e.data))return d(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(c(e),t=s(t,e<0?0:0|h(e)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function d(t,e){var n=e.length<0?0:0|h(e.length);t=s(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function h(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return I(t).length;default:if(r)return B(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=n;o<s;o++)if(l(t,o)===l(e,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(l(t,o+d)!==l(e,d)){f=!1;break}if(f)return o}return-1}function y(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/Object.defineProperty(e,"__esModule",{value:!0});const r=n(123);let i;const o="Visor",a="tfjs-visor-container";e.visor=function(){if("undefined"==typeof document)throw new Error("No document defined. This library needs a browser/dom to work");if(document.getElementById(a)&&null!=i)return i;let t,e=document.getElementById(a);function n(e,n){let i=null;return t=r.VisorComponent.render(e,t,{ref:t=>i=t,surfaceList:Array.from(n.values())}),i}null==e&&((e=document.createElement("div")).id=a,document.body.appendChild(e));const o=new Map,u=n(e,o);return i=new s(u,e,o,n)};class s{constructor(t,e,n,r){this.visorComponent=t,this.el=e,this.surfaceList=n,this.renderVisor=r}surface(t){const{name:e}=t,n=null==t.tab?o:t.tab;if(null==e||!("string"==typeof e||e instanceof String))throw new Error("You must pass a config object with a 'name' property to create or retrieve a surface");const r=Object.assign({},t,{tab:n}),i=`${e}-${n}`;return this.surfaceList.has(i)||this.surfaceList.set(i,r),this.renderVisor(this.el,this.surfaceList),this.visorComponent.getSurface(e,n)}isFullscreen(){return this.visorComponent.isFullscreen()}isOpen(){return this.visorComponent.isOpen()}close(){return this.visorComponent.close()}open(){return this.visorComponent.open()}toggle(){return this.visorComponent.toggle()}toggleFullScreen(){return this.visorComponent.toggleFullScreen()}bindKeys(){return this.visorComponent.bindKeys()}unbindKeys(){return this.visorComponent.unbindKeys()}setActiveTab(t){if(!this.visorComponent.state.tabs.has(t))throw new Error(`Tab '${t}' does not exist`);this.visorComponent.setState({activeTab:t})}}e.Visor=s},function(e,n){e.exports=t},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(11)),a=n(7),s=n(22),u=n(5);e.linechart=function(t,e,n={}){return r(this,void 0,void 0,function*(){const r=Array.isArray(e.values[0])?e.values:[e.values],i=r[0].length,c=e.series?e.series:r.map((t,e)=>`Series ${e+1}`);s.assert(c.length===r.length,"Must have an equal number of series labels as there are data series"),null!=n.seriesColors&&s.assert(n.seriesColors.length===r.length,"Must have an equal number of series colors as there are data series");const f=[];for(let t=0;t<i;t++){const e={x:t};c.forEach((n,i)=>{const o=r[i][t].y;e[n]=o,e[`${n}-name`]=n}),f.push(e)}const d=Object.assign({},l,n),h={x:{field:"x",type:d.xType,title:d.xLabel},tooltip:[{field:"x",type:"quantitative"},...c.map(t=>({field:t,type:"quantitative"}))]},p=c.map(t=>({data:void 0,mark:{type:"line",clip:!0},encoding:{y:{field:t,type:d.yType,title:d.yLabel,scale:d.zoomToFit?{zero:!1}:null!=d.yAxisDomain?{domain:d.yAxisDomain}:void 0},color:{field:`${t}-name`,type:"nominal",legend:{values:c,title:null},scale:{range:d.seriesColors}}}})),g=u.getDrawArea(t),m={width:d.width||a.getDefaultWidth(g),height:d.height||a.getDefaultHeight(g),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:d.fontSize,titleFontSize:d.fontSize},text:{fontSize:d.fontSize},legend:{labelFontSize:d.fontSize,titleFontSize:d.fontSize}},data:{values:f},encoding:h,layer:[...p,{mark:"rule",selection:{hover:{type:"single",on:"mouseover",nearest:!0,clear:"mouseout"}},encoding:{color:{value:"grey",condition:{selection:{not:"hover"},value:"transparent"}}}}]};return yield o.default(g,m,{actions:!1,mode:"vega-lite",defaultStyle:!1}),Promise.resolve()})};const l={xLabel:"x",yLabel:"y",xType:"quantitative",yType:"quantitative",zoomToFit:!1,fontSize:11}},function(t,e,n){"use strict";n.r(e);var r=function(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]},i=function(t){return(t=r(Math.abs(t)))?t[1]:NaN},o=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function a(t){return new s(t)}function s(t){if(!(e=o.exec(t)))throw new Error("invalid format: "+t);var e;this.fill=e[1]||" ",this.align=e[2]||">",this.sign=e[3]||"-",this.symbol=e[4]||"",this.zero=!!e[5],this.width=e[6]&&+e[6],this.comma=!!e[7],this.precision=e[8]&&+e[8].slice(1),this.trim=!!e[9],this.type=e[10]||""}a.prototype=s.prototype,s.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var u,l,c,f,d=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(i>0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(e+1):t},h=function(t,e){var n=r(t,e);if(!n)return t+"";var i=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")},p={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return h(100*t,e)},r:h,s:function(t,e){var n=r(t,e);if(!n)return t+"";var i=n[0],o=n[1],a=o-(u=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,s=i.length;return a===s?i:a>s?i+new Array(a-s+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0.
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/Object.defineProperty(e,"__esModule",{value:!0});const r=n(66),i=n(126),o=n(127),a=n(37),s=n(52),u=n(128),l=n(24),c=n(129),f=n(130),d=n(131),h=n(132),p=n(23),g=n(133);e.version_vis=g.version;const m={barchart:r.barchart,table:l.table,histogram:a.histogram,linechart:s.linechart,scatterplot:u.scatterplot,confusionMatrix:i.confusionMatrix,heatmap:o.heatmap};e.render=m;const v={accuracy:p.accuracy,perClassAccuracy:p.perClassAccuracy,confusionMatrix:p.confusionMatrix};e.metrics=v;const y={history:c.history,fitCallbacks:c.fitCallbacks,perClassAccuracy:d.showPerClassAccuracy,valuesDistribution:h.valuesDistribution,layer:f.layer,modelSummary:f.modelSummary};e.show=y;var b=n(50);e.visor=b.visor,function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(49))},,,,,,,function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(11)),a=n(7),s=n(5);e.barchart=function(t,e,n={}){return r(this,void 0,void 0,function*(){const r=s.getDrawArea(t),i=e,c=Object.assign({},u,n);if(l.has(r)){const t=l.get(r);if(s.shallowEquals(c,t.lastOptions)){yield s.nextFrame();const e=t.view,n=e.changeset().remove(()=>!0).insert(i);return void(yield e.change("values",n).runAsync())}}const{xLabel:f,yLabel:d,xType:h,yType:p}=c;let g=null;null!=f&&(g={title:f});let m,v=null;null!=d&&(v={title:d}),m=null!=c.color?Array.isArray(c.color)?{field:"index",type:"nominal",scale:{range:c.color}}:{value:c.color}:{value:"#4C78A0"};const y={width:c.width||a.getDefaultWidth(r),height:c.height||a.getDefaultHeight(r),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:c.fontSize,titleFontSize:c.fontSize},text:{fontSize:c.fontSize},legend:{labelFontSize:c.fontSize,titleFontSize:c.fontSize}},data:{values:i,name:"values"},mark:{type:"bar",tooltip:!0},encoding:{x:{field:"index",type:h,axis:g},y:{field:"value",type:p,axis:v},color:m}};yield s.nextFrame();const b=yield o.default(r,y,{actions:!1,mode:"vega-lite",defaultStyle:!1});l.set(r,{view:b.view,lastOptions:c})})};const u={xLabel:"",yLabel:"",xType:"ordinal",yType:"quantitative",fontSize:11},l=new Map},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,l=[],c=!1,f=-1;function d(){c&&u&&(c=!1,u.length?l=u.concat(l):f=-1,l.length&&h())}function h(){if(!c){var t=s(d);c=!0;for(var e=l.length;e;){for(u=l,l=[];++f<e;)u&&u[f].run();f=-1,e=l.length}u=null,c=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new p(t,e)),1!==l.length||c||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){const r=n(10);t.exports=((t,e)=>{const n=r(t,e);return n?n.version:null})},function(t,e,n){const r=n(10);t.exports=((t,e)=>{const n=r(t.trim().replace(/^[=v]+/,""),e);return n?n.version:null})},function(t,e,n){const r=n(2);t.exports=((t,e,n,i)=>{"string"==typeof n&&(i=n,n=void 0);try{return new r(t,n).inc(e,i).version}catch(t){return null}})},function(t,e,n){const r=n(10),i=n(29);t.exports=((t,e)=>{if(i(t,e))return null;{const n=r(t),i=r(e),o=n.prerelease.length||i.prerelease.length,a=o?"pre":"",s=o?"prerelease":"";for(const t in n)if(("major"===t||"minor"===t||"patch"===t)&&n[t]!==i[t])return a+t;return s}})},function(t,e,n){const r=n(2);t.exports=((t,e)=>new r(t,e).major)},function(t,e,n){const r=n(2);t.exports=((t,e)=>n
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/Object.defineProperty(e,"__esModule",{value:!0});const r=n(36),i=n(14),o=n(124),a=n(125);class s extends r.Component{static render(t,e,n){return r.render(r.h(s,Object.assign({},n)),t,e)}constructor(t){super(t),this.surfaces=new Map;const e=null==t.startOpen||t.startOpen;this.state={isOpen:e,isFullscreen:!1,activeTab:null,tabs:new Set},this.keyHandler=this.keyHandler.bind(this)}close(){this.setState({isOpen:!1})}open(){this.setState({isOpen:!0})}toggle(){this.setState({isOpen:!this.state.isOpen})}toggleFullScreen(){this.setState({isFullscreen:!this.state.isFullscreen})}isOpen(){return this.state.isOpen}isFullscreen(){return this.state.isFullscreen}getSurface(t,e){const n=this.surfaceId(t,e);let r;if(!this.surfaces.has(n))throw Error(`Surface not found with id: ${n}`);return{container:(r=this.surfaces.get(n)).container,label:r.label,drawArea:r.drawArea}}bindKeys(){document.addEventListener("keydown",this.keyHandler,!1)}unbindKeys(){document.removeEventListener("keydown",this.keyHandler)}surfaceId(t,e){return t+e}setTabs(t){const e=t.map(t=>t.tab),n=this.state.tabs;let r;for(const t of e)n.has(t)||(n.add(t),r=t);null!=r&&this.setState({tabs:n,activeTab:r})}getTabs(){return this.state.tabs}registerSurface(t,e,n){const r=this.surfaceId(t,e);this.surfaces.set(r,n)}keyHandler(t){192===t.keyCode&&(t.shiftKey?this.toggleFullScreen():this.toggle())}setActiveTab(t){this.setState({activeTab:t})}componentDidMount(){this.bindKeys()}componentWillMount(){this.setTabs(this.props.surfaceList)}componentWillReceiveProps(t){this.setTabs(t.surfaceList)}render(){const{isOpen:t,isFullscreen:e,activeTab:n}=this.state,{surfaceList:s}=this.props,l=Array.from(this.getTabs().values()),c=e?"90vw":"550px",f=i.css({width:c,height:"100%",backgroundColor:"#fafafa",boxSizing:"border-box",padding:"10px",position:"fixed",top:"0px",transition:"right 0.5s cubic-bezier(0.645, 0.045, 0.355, 1), width 0.5s cubic-bezier(0.645, 0.045, 0.355, 1)",boxShadow:"0 2px 5px rgba(0, 0, 0, 0.12), 0 2px 5px rgba(0, 0, 0, 0.24)",overflow:"auto",fontFamily:"sans-serif",fontSize:"14px",zIndex:1e3}),d=i.css({right:"0"}),h=i.css({right:`calc(-${c} - 10px)`}),p=t?d:h,g=i.css({});return r.h("div",{className:`${f} ${p} visor`,"data-isopen":t,"data-isfullscreen":e},r.h(u,{fullScreenHandler:this.toggleFullScreen.bind(this),closeHandler:this.close.bind(this),isFullScreen:e}),r.h(a.Tabs,{tabNames:l,activeTab:n,handleClick:this.setActiveTab.bind(this)}),r.h("div",{className:`${g} visor-surfaces`},s.map(t=>r.h(o.SurfaceComponent,{key:t.name+t.tab,name:t.name,tab:t.tab,styles:t.styles,registerSurface:this.registerSurface.bind(this),visible:n===t.tab}))))}}function u(t){const{isFullScreen:e,fullScreenHandler:n,closeHandler:o}=t,a=i.css({display:"flex",backgroundColor:"white",border:"1px solid white",padding:"6px",paddingTop:"10px",marginBottom:"10px",borderRadius:"6px",marginTop:"-16px"}),s=i.css({fontSize:".875rem",borderRadius:".25rem",paddingLeft:"1rem",paddingRight:"1rem",paddingTop:".5rem",paddingBottom:".5rem",textDecoration:"none",transition:"color .15s ease-in",color:"#111"}),u=i.css({marginLeft:"auto"});return r.h("div",{className:`${a} visor-controls`},r.h("button",{className:`${s}`,onClick:n},e?"Minimize":"Maximize"),r.h("button",{className:`${s} ${u}`,onClick:o},"Hide"))}e.VisorComponent=s},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/Object.defineProperty(e,"__esModule",{value:!0});const r=n(36),i=n(14);class o extends r.Component{componentDidMount(){const{name:t,tab:e}=this.props;this.props.registerSurface(t,e,this)}componentDidUpdate(){return!1}render(){const{name:t,visible:e,styles:n}=this.props,a=Object.assign({},o.defaultStyles,n),{width:s,height:u}=a;let{maxHeight:l,maxWidth:c}=a;l=u===o.defaultStyles.height?l:u,c=s===o.defaultStyles.width?c:s;const f=i.css({display:e?"block":"none",backgroundColor:"white",marginTop:"10px",marginBottom:"10px",boxShadow:"0 0 6px -3px #777",padding:"10px !important",height:u,width:s,maxHeight:l,maxWidth:c,overflow:"auto"}),d=i.css({backgroundColor:"white",boxSizing:"border-box",borderBottom:"1px solid #357EDD",lineHeight:"2em",marginBottom:"20px",fontWeight:"600",textAlign:"center"}),h=i.css({boxSizing:"border-box"});return r.h("div",{className:`${f} tf-surface`,ref:t=>this.container=t,"data-visible":e},r.h("div",{className:`${d} tf-label`,ref:t=>this.label=t},t),r.h("div",{className:`${h} tf-draw-area`,ref:t=>this.drawArea=t}))}}o.defaultStyles={maxWidth:"550px",maxHeight:"580px",height:"auto",width:"auto"},e.SurfaceComponent=o},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/Object.defineProperty(e,"__esModule",{value:!0});const r=n(36),i=n(14);e.Tabs=class extends r.Component{render(){const{tabNames:t,activeTab:e,handleClick:n}=this.props,a=t.length>0?t.map(t=>r.h(o,{key:t,id:t,handleClick:n,isActive:t===e},t)):null,s=i.css({overflowX:"scroll",overflowY:"hidden",whiteSpace:"nowrap",borderBottomStyle:"solid",borderBottomWidth:"1px",borderColor:"#eee",paddingBottom:"1rem",marginTop:"1rem"});return r.h("div",{className:`${s} visor-tabs`},a)}};class o extends r.Component{render(){const{children:t,isActive:e,handleClick:n,id:o}=this.props,a=i.css({borderBottomColor:e?"#357EDD":"#AAAAAA",borderBottomWidth:"1px",borderBottomStyle:"solid",cursor:"pointer",":hover":{color:"#357EDD"},display:"inline-block",marginRight:"1rem",padding:".5rem",fontSize:"1rem",fontWeight:"bold"});return r.h("a",{className:`${a} tf-tab`,"data-isactive":e,onClick:()=>n(o)},t)}}},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(11)),a=n(7),s=n(5);e.confusionMatrix=function(t,e,n={}){return r(this,void 0,void 0,function*(){const r=Object.assign({},u,n),i=s.getDrawArea(t),l=[],c=e.values,f=e.tickLabels||[],d=0===f.length;let h=!0;for(let t=0;t<c.length;t++){const e=d?`Class ${t}`:f[t];d&&f.push(e);for(let n=0;n<c[t].length;n++){const i=d?`Class ${n}`:f[n],o=c[t][n];t!==n||r.shadeDiagonal?(l.push({label:e,prediction:i,count:o,scaleCount:o}),0!==o&&(h=!1)):l.push({label:e,prediction:i,count:o,noFill:!0})}}if(!r.shadeDiagonal&&h)for(const t of l)!0===t.noFill&&(t.noFill=!1,t.scaleCount=t.count);const p={width:r.width||a.getDefaultWidth(i),height:r.height||a.getDefaultHeight(i),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:r.fontSize,titleFontSize:r.fontSize},text:{fontSize:r.fontSize},legend:{labelFontSize:r.fontSize,titleFontSize:r.fontSize}},data:{values:l},encoding:{x:{field:"prediction",type:"ordinal",title:r.xLabel||"prediction",scale:{domain:f}},y:{field:"label",type:"ordinal",title:r.yLabel||"label",scale:{domain:f}}},layer:[{transform:[{filter:"datum.noFill != true"}],mark:{type:"rect"},encoding:{color:{field:"scaleCount",type:"quantitative",scale:{range:r.colorMap}},tooltip:[{field:"label",type:"nominal"},{field:"prediction",type:"nominal"},{field:"count",type:"quantitative"}]}}]};!1===r.shadeDiagonal&&p.layer.push({transform:[{filter:"datum.noFill == true"}],mark:{type:"rect",fill:"white"},encoding:{tooltip:[{field:"label",type:"nominal"},{field:"prediction",type:"nominal"},{field:"count",type:"quantitative"}]}}),r.showTextOverlay&&p.layer.push({mark:{type:"text",baseline:"middle"},encoding:{text:{field:"count",type:"nominal"}}});const g="string"==typeof r.colorMap?{scheme:r.colorMap}:r.colorMap;p.layer[0].encoding.color.scale.range=g,yield o.default(i,p,{actions:!1,mode:"vega-lite",defaultStyle:!1})})};const u={xLabel:null,yLabel:null,xType:"nominal",yType:"nominal",shadeDiagonal:!0,fontSize:12,showTextOverlay:!0,height:400,colorMap:["#f7fbff","#4292c6"]}},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const a=i(n(51)),s=o(n(11)),u=n(7),l=n(22),c=n(5);function f(t,e,n){const r=t instanceof a.Tensor?t.shape:[t.length,t[0].length];0===n?l.assert(r[0]===e.length,`Length of xTickLabels (${e.length}) must match number of rows`+` (${r[0]})`):1===n&&l.assert(r[1]===e.length,`Length of yTickLabels (${e.length}) must match number of columns (${r[1]})`)}e.heatmap=function(t,e,n={}){return r(this,void 0,void 0,function*(){const i=Object.assign({},d,n),o=c.getDrawArea(t);let h=e.values;i.rowMajor&&(h=yield function(t){return r(this,void 0,void 0,function*(){let e,n;t instanceof a.Tensor?(e=t.shape,n=t.transpose()):(e=[t.length,t[0].length],n=a.tidy(()=>a.tensor2d(t).transpose())),l.assert(2===n.rank,"Input to renderHeatmap must be a 2d array or Tensor2d");const r=yield n.array();n.dispose();const i=[r.length,r[0].length];return l.assert(e[0]===i[1]&&e[1]===i[0],`Unexpected transposed shape. Original ${e} : Transposed ${i}`),r})}(e.values));const{xTickLabels:p,yTickLabels:g}=e;null!=p&&f(h,p,0),null!=g&&f(h,g,1);const m=[];if(h instanceof a.Tensor){l.assert(2===h.rank,"Input to renderHeatmap must be a 2d array or Tensor2d");const t=yield h.data(),[e,n]=h.shape;for(let r=0;r<e;r++){const e=p?`${p[r]}@tfidx@${r}`:r;for(let i=0;i<n;i++){const o=g?`${g[i]}@tfidx@${i}`:i,a=t[r*n+i];m.push({x:e,y:o,value:a})}}}else{const t=h;for(let e=0;e<t.length;e++){const n=p?`${p[e]}@tfidx@${e}`:e;for(let r=0;r<t[e].length;r++){const i=g?`${g[r]}@tfidx@${r}`:r,o=t[e][r];m.push({x:n,y:i,value:o})}}}const v={actions:!1,mode:"vega-lite",defaultStyle:!1},y={width:i.width||u.getDefaultWidth(o),height:i.height||u.getDefaultHeight(o),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:i.fontSize,titleFontSize:i.fontSize},text:{fontSize:i.fontSize},legend:{labelFontSize:i.fontSize,titleFontSize:i.fontSize},scale:{bandPaddingInner:0,bandPaddingOuter:0}},data:{values:m},mark:{type:"rect",tooltip:!0},encoding:{x:{field:"x",type:i.xType,title:i.xLabel,sort:"x"},y:{field:"y",type:i.yType,title:i.yLabel,sort:"y"},fill:{field:"value",type:"quantitative"}}},b=new RegExp("@tfidx@\\d+$");let x;switch(p&&(y.encoding.x.axis={labelExpr:"replace(datum.value, regexp(/@tfidx@\\d+$/), '')"}),g&&(y.encoding.y.axis={labelExpr:"replace(datum.value, regexp(/@tfidx@\\d+$/), '')"}),(p||g)&&(v.tooltip={sanitize:t=>String(t).replace(b,"")}),i.colorMap){case"blues":x=["#f7fbff","#4292c6"];break;case"greyscale":x=["#000000","#ffffff"];break;case"viridis":default:x="viridis"}if("viridis"!==x&&(y.encoding.fill.scale={range:x}),i.domain){const t=y.encoding.fill;null!=t.scale?t.scale=Object.assign({},t.scale,{domain:i.domain}):t.scale={domain:i.domain}}yield s.default(o,y,v)})};const d={xLabel:null,yLabel:null,xType:"ordinal",yType:"ordinal",colorMap:"viridis",fontSize:12,domain:null,rowMajor:!1}},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(n(11)),a=n(7),s=n(22),u=n(5);e.scatterplot=function(t,e,n={}){return r(this,void 0,void 0,function*(){let r=e.values;const i=null==e.series?[]:e.series,c=[];(r=Array.isArray(r[0])?r:[r]).forEach((t,e)=>{const n=null!=i[e]?i[e]:`Series ${e+1}`,r=t.map(t=>Object.assign({},t,{series:n}));c.push(...r)}),null!=n.seriesColors&&s.assert(n.seriesColors.length===r.length,"Must have an equal number of series colors as there are data series");const f=u.getDrawArea(t),d=Object.assign({},l,n),h={width:d.width||a.getDefaultWidth(f),height:d.height||a.getDefaultHeight(f),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:d.fontSize,titleFontSize:d.fontSize},text:{fontSize:d.fontSize},legend:{labelFontSize:d.fontSize,titleFontSize:d.fontSize}},data:{values:c},mark:{type:"point",clip:!0,tooltip:{content:"data"}},encoding:{x:{field:"x",type:d.xType,title:d.xLabel,scale:d.zoomToFit?{zero:!1}:null!=d.xAxisDomain?{domain:d.xAxisDomain}:void 0},y:{field:"y",type:d.yType,title:d.yLabel,scale:d.zoomToFit?{zero:!1}:null!=d.yAxisDomain?{domain:d.yAxisDomain}:void 0},color:{field:"series",type:"nominal",scale:{range:d.seriesColors}},shape:{field:"series",type:"nominal"}}};return yield o.default(f,h,{actions:!1,mode:"vega-lite",defaultStyle:!1}),Promise.resolve()})};const l={xLabel:"x",yLabel:"y",xType:"quantitative",yType:"quantitative",zoomToFit:!1,fontSize:11}},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(52),o=n(5),a=n(7);function s(t,e,n,s={}){return r(this,void 0,void 0,function*(){const r=o.getDrawArea(t),c={};for(const t of n)if(/val_/.test(t)){const r=t.replace("val_","");u(c,r);const i=l(e,t,n.indexOf(t));c[r].series.push(t),c[r].values.push(i)}else{const r=l(e,t,n.indexOf(t));u(c,t),c[t].series.push(t),c[t].values.push(r)}const f=Object.keys(c),d=Object.assign({},{xLabel:"Iteration",yLabel:"Value"},s),h=[];for(const t of f){const e=a.subSurface(r,t),n=c[t].series,o=c[t].values;n.every(t=>Boolean(t.match("acc")))&&(d.zoomToFitAccuracy?d.zoomToFit=!0:(d.yAxisDomain=[0,1],delete d.zoomToFit));const s=i.linechart(e,{values:o,series:n},d);h.push(s)}yield Promise.all(h)})}function u(t,e){null==t[e]&&(t[e]={series:[],values:[]})}function l(t,e,n){if(Array.isArray(t)){const r=Array.isArray(t[0])?t[n]:t,i=[];for(let t=0;t<r.length;t++){const n=r[t];i.push({x:t,y:n[e]})}return i}return t.history[e].map((t,e)=>({x:e,y:t}))}function c(t,e,n){return null==t[e]&&(t[e]={}),null==t[e][n]&&(t[e][n]=[]),t[e][n]}e.history=s,e.fitCallbacks=function(t,e,n={}){const i={},u=n.callbacks||["onEpochEnd","onBatchEnd"],l=o.getDrawArea(t),f=Object.assign({},n);delete f.callbacks;const d={};return u.forEach(t=>{d[t]=function(t){return(n,u)=>r(this,void 0,void 0,function*(){/batch/i.test(t)?f.xLabel="Batch":/epoch/i.test(t)&&(f.xLabel="Epoch");const n=[],r=[];for(const o of e)if(null!=u[o]){r.push(o);const e=c(i,t,o);e.push({[o]:u[o]}),n.push(e)}s(a.subSurface(l,t,{title:t}),n,r,f),yield o.nextFrame()})}(t)}),d}},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(37),o=n(5),a=n(24),s=n(7),u=n(23);function l(t){let e;if(Array.isArray(t.outputShape[0])){e=`[${t.outputShape.map(t=>c(t)).join(", ")}]`}else e=c(t.outputShape);return{name:t.name,trainable:t.trainable,parameters:t.countParams(),outputShape:e}}function c(t){const e=t.slice();return 0===e.length?"Scalar":(null===e[0]&&(e[0]="batch"),`[${e.join(",")}]`)}e.modelSummary=function(t,e){return r(this,void 0,void 0,function*(){const n=o.getDrawArea(t),r=function(t){return{layers:t.layers.map(l)}}(e).layers.map(t=>[t.name,t.outputShape,t.parameters,t.trainable]);a.table(n,{headers:["Layer Name","Output Shape","# Of Params","Trainable"],values:r})})},e.layer=function(t,e){return r(this,void 0,void 0,function*(){const n=o.getDrawArea(t),l=yield function(t){return r(this,void 0,void 0,function*(){const e=t.getWeights(),n=t.weights,r=e.map(u.tensorStats),i=yield Promise.all(r),o=e.map(t=>t.shape);return e.map((t,e)=>({name:n[e].name,stats:i[e],shape:c(o[e]),weight:t}))})}(e),f=s.subSurface(n,"layer-weights-info"),d=l.map(t=>[t.name,t.shape,t.stats.min,t.stats.max,t.weight.size,t.stats.numZeros,t.stats.numNans,t.stats.numInfs]);a.table(f,{headers:["Weight Name","Shape","Min","Max","# Params","# Zeros","# NaNs","# Infinity"],values:d});const h=s.subSurface(n,"select-layer"),p=s.subSurface(n,"param-distribution");!function(t,e,n){const r=`<div><button>Show Values Distribution for:</button>${`\n <select>\n ${t.map(t=>`<option value=${t}>${t}</option>`)}\n </select>\n `}</div>`;e.innerHTML=r;const i=e.querySelector("button"),o=e.querySelector("select");i.addEventListener("click",()=>{n(o.selectedOptions[0].label)})}(l.map(t=>t.name),h,t=>r(this,void 0,void 0,function*(){const e=yield l.filter(e=>e.name===t)[0].weight.data();i.histogram(p,e,{height:150,width:460,stats:!1})}))})}},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(5),o=n(24);e.showPerClassAccuracy=function(t,e,n){return r(this,void 0,void 0,function*(){const r=i.getDrawArea(t),a=[];for(let t=0;t<e.length;t++){const r=n?n[t]:t.toString(),i=e[t];a.push([r,i.accuracy,i.count])}return o.table(r,{headers:["Class","Accuracy","# Samples"],values:a})})}},function(t,e,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
* =============================================================================
|
||
|
*/var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const i=n(37),o=n(5),a=n(23);e.valuesDistribution=function(t,e){return r(this,void 0,void 0,function*(){const n=o.getDrawArea(t),r=yield a.tensorStats(e),s=yield e.data();i.histogram(n,s,{height:150,stats:r})})}},function(t,e,n){"use strict";
|
||
|
/** @license See the LICENSE file. */Object.defineProperty(e,"__esModule",{value:!0});e.version="1.4.3"},function(t,e,n){"use strict";n.r(e);var r="http://www.w3.org/1999/xhtml",i={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},o=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),i.hasOwnProperty(e)?{space:i[e],local:t}:t};var a=function(t){var e=o(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===r&&e.documentElement.namespaceURI===r?e.createElement(t):e.createElementNS(n,t)}})(e)};function s(){}var u=function(t){return null==t?s:function(){return this.querySelector(t)}};function l(){return[]}var c=function(t){return null==t?l:function(){return this.querySelectorAll(t)}},f=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var d=document.documentElement;if(!d.matches){var h=d.webkitMatchesSelector||d.msMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector;f=function(t){return function(){return h.call(this,t)}}}}var p=f,g=function(t){return new Array(t.length)};function m(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}m.prototype={constructor:m,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var v="$";function y(t,e,n,r,i,o){for(var a,s=0,u=e.length,l=o.length;s<l;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new m(t,o[s]);for(;s<u;++s)(a=e[s])&&(i[s]=a)}function b(t,e,n,r,i,o,a){var s,u,l,c={},f=e.length,d=o.length,h=new Array(f);for(s=0;s<f;++s)(u=e[s])&&(h[s]=l=v+a.call(u,u.__data__,s,e),l in c?i[s]=u:c[l]=u);for(s=0;s<d;++s)(u=c[l=v+a.call(t,o[s],s,o)])?(r[s]=u,u.__data__=o[s],c[l]=null):n[s]=new m(t,o[s]);for(s=0;s<f;++s)(u=e[s])&&c[h[s]]===u&&(i[s]=u)}function x(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var _=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function w(t,e){return t.style.getPropertyValue(e)||_(t).getComputedStyle(t,null).getPropertyValue(e)}function O(t){return t.trim().split(/^|\s+/)}function j(t){return t.classList||new k(t)}function k(t){this._node=t,this._names=O(t.getAttribute("class")||"")}function A(t,e){for(var n=j(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function E(t,e){for(var n=j(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}k.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function S(){this.textContent=""}function D(){this.innerHTML=""}function C(){this.nextSibling&&this.parentNode.appendChild(this)}function M(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function F(){return null}function $(){var t=this.parentNode;t&&t.removeChild(this)}function N(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function T(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var z={},R=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(z={mouseenter:"mouseover",mouseleave:"mouseout"}));function P(t,e,n){return t=L(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function L(t,e,n){return function(r){var i=R;R=r;try{t.call(this,this.__data__,e,n)}finally{R=i}}}function B(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++
|
||
|
//# sourceMappingURL=tfjs-vis.umd.min.js.map
|