vendor: 1,037 bytes, line 1
1var Ole=Object.defineProperty;var Dle=(c,o,a)=>o in c?Ole(c,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):c[o]=a;var Ka=(c,o,a)=>(Dle(c,typeof o!="symbol"?o+"":o,a),a);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const h of s.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&i(h)}).observe(document,{childList:!0,subtree:!0});function a(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(n){if(n.ep)return;n.ep=!0;const s=a(n);fetch(n.href,s)}})();function Fi(){}const YB=c=>c;function Tle(c,o){for(const a in o)c[a]=o[a];return c}function xK(c){return c()}function x$(){return Object.create(null)}
1function Ul(c){c.forEach(xK)}function Fg(c){return typeof c=="function"}function jo(c,o){return c!=c?o==o:c!==o||c&&typeof c=="object"||typeof c=="function"}let $D;function Qx(c,o){return $D||($D=document.createElement("a")),$D.href=o,c===$D.href}function Nle(c){return Object.keys(c).length===0}function XB(c,...o){if(c==null)return Fi;const a=c.subscribe(...o);return a.unsubscribe?()=>a.unsubscribe():a}function Wo(c){let o;return XB(c,a=>o=a)(),o}function Vi(c,o,a){c.$$.on_destroy.push(XB(o,a))}function Gk(c,o,a,i){if(c){const n=wK(c,o,a,i);return c[0](n)}}function wK(c,o,a,i){return c[1]&&i?Tle(a.ctx.slice(),c[1](i(o))):a.ctx}function Kk(c,o,a,i){if(c[2]&&i){const n=c[2](i(a));if(o.dirty===void 0)return n;if(typeof n=="object"){const s=[],h=Math.max(o.dirty.length,n.length);for(let v=0;v<h;v+=1)s[v]=o.dirty[v]|n[v];return s}return o.dirty|n}return o.dirty}function Yk(c,o,a,i,n,s){if(n){const h=wK(o,a,i,s);c.p(h,n)}}function Xk(c){if(c.ctx.length>32){const o=[],a=c.ctx.length/32;for(let i=0;i<a;i++)o[i]=-1;return o}return-1}function fu(c,o,a){return c.set(a),o}function w$(c){const o=typeof c=="string"&&c.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return o?[parseFloat(o[1]),o[2]||"px"]:[c,"px"]}const _K=typeof window<"u";let kK=_K?()=>window.performance.now():()=>Date.now(),JB=_K?c=>requestAnimationFrame(c):Fi;const vk=new Set;function EK(c){vk.forEach(o=>{o.c(c)||(vk.delete(o),o.f())}),vk.size!==0&&JB(EK)}function CK(c){let o;return vk.size===0&&JB(EK),{promise:new Promise(a=>{vk.add(o={c,f:a})}),abort(){vk.delete(o)}}}function ft(c,o){c.appendChild(o)}function SK(c){if(!c)return document;const o=c.getRootNode?c.getRootNode():c.ownerDocument;return o&&o.host?o:c.ownerDocument}function Ile(c){const o=an("style");return Mle(SK(c),o),o.sheet}function Mle(c,o){return ft(c.head||c,o),o.sheet}function _r(c,o,a){c.insertBefore(o,a||null)}function br(c){c.parentNode&&c.parentNode.removeChild(c)}function Pv(c,o){for(let a=0;a<c.length;a+=1)c[a]&&c[a].d(o)}function an(c){return document.createElement(c)}function Iv(c){return document.createElementNS("http://www.w3.org/2000/svg",c)}function Sr(c){return document.createTextNode(c)}function or(){return Sr(" ")}function Cm(){return Sr("")}function sa(c,o,a,i){return c.addEventListener(o,a,i),()=>c.removeEventListener(o,a,i)}function AK(c){return function(o){return o.stopPropagation(),c.call(this,o)}}function Qt(c,o,a){a==null?c.removeAttribute(o):c.getAttribute(o)!==a&&c.setAttribute(o,a)}function Fle(c){return c===""?null:+c}function Rle(c){return Array.from(c.childNodes)}function Ur(c,o){o=""+o,c.wholeText!==o&&(c.data=o)}function _$(c,o){c.value=o??""}function Fs(c,o,a,i){a===null?c.style.removeProperty(o):c.style.setProperty(o,a,i?"important":"")}function Nk(c,o,a){for(let i=0;i<c.options.length;i+=1){const n=c.options[i];if(n.__value===o){n.selected=!0;return}}(!a||o!==void 0)&&(c.selectedIndex=-1)}function QB(c){const o=c.querySelector(":checked");return o&&o.__value}let HD;function Ble(){if(HD===void 0){HD=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{HD=!0}}return HD}function OK(c,o){getComputedStyle(c).position==="static"&&(c.style.position="relative");const i=an("iframe");i.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),i.setAttribute("aria-hidden","true"),i.tabIndex=-1;const n=Ble();let s;return n?(i.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",s=sa(window,"message",h=>{h.source===i.contentWindow&&o()})):(i.src="about:blank",i.onload=()=>{s=sa(i.contentWindow,"resize",o),o()}),ft(c,i),()=>{(n||s&&i.contentWindow)&&s(),br(i)}}function Bi(c,o,a){c.classList[a?"add":"remove"](o)}function Ple(c,o,{bubbles:a=!1,cancelable:i=!1}={}){const n=document.createEvent("CustomEvent");return n.initCustomEvent(c,a,i,o),n}function hN(c,o){return new c(o)}const pN=new Map;let mN=0;function jle(c){let o=5381,a=c.length;for(;a--;)o=(o<<5)-o^c.charCodeAt(a);return o>>>0}function Lle(c,o){const a={stylesheet:Ile(o),rules:{}};return pN.set(c,a),a}
vendor: 5,349 bytes, lines 1-4
1function _6(c,o,a,i,n,s,h,v=0){const g=16.666/i;let O=`{ 2`;for(let N=0;N<=1;N+=g){const ee=o+(a-o)*s(N);O+=N*100+`%{${h(ee,1-ee)}} 3`}const A=O+`100% {${h(a,1-a)}} 4}`,S=`__svelte_${jle(A)}_${v}`,M=SK(c),{stylesheet:P,rules:L}=pN.get(M)||Lle(M,c);L[S]||(L[S]=!0,P.insertRule(`@keyframes ${S} ${A}`,P.cssRules.length));const V=c.style.animation||"";return c.style.animation=`${V?`${V}, `:""}${S} ${i}ms linear ${n}ms 1 both`,mN+=1,S}function DK(c,o){const a=(c.style.animation||"").split(", "),i=a.filter(o?s=>s.indexOf(o)<0:s=>s.indexOf("__svelte")===-1),n=a.length-i.length;n&&(c.style.animation=i.join(", "),mN-=n,mN||zle())}function zle(){JB(()=>{mN||(pN.forEach(c=>{const{ownerNode:o}=c.stylesheet;o&&br(o)}),pN.clear())})}let ZS;function IS(c){ZS=c}function TK(){if(!ZS)throw new Error("Function called outside component initialization");return ZS}function Zx(c){TK().$$.on_mount.push(c)}function Ule(c){TK().$$.on_destroy.push(c)}function NK(c,o){const a=c.$$.callbacks[o.type];a&&a.slice().forEach(i=>i.call(this,o))}const ok=[],l1=[];let yk=[];const k6=[],Wle=Promise.resolve();let E6=!1;function Vle(){E6||(E6=!0,Wle.then(MK))}function Ll(c){yk.push(c)}function IK(c){k6.push(c)}const g5=new Set;let V_=0;function MK(){if(V_!==0)return;const c=ZS;do{try{for(;V_<ok.length;){const o=ok[V_];V_++,IS(o),$le(o.$$)}}catch(o){throw ok.length=0,V_=0,o}for(IS(null),ok.length=0,V_=0;l1.length;)l1.pop()();for(let o=0;o<yk.length;o+=1){const a=yk[o];g5.has(a)||(g5.add(a),a())}yk.length=0}while(ok.length);for(;k6.length;)k6.pop()();E6=!1,g5.clear(),IS(c)}function $le(c){if(c.fragment!==null){c.update(),Ul(c.before_update);const o=c.dirty;c.dirty=[-1],c.fragment&&c.fragment.p(c.ctx,o),c.after_update.forEach(Ll)}}function Hle(c){const o=[],a=[];yk.forEach(i=>c.indexOf(i)===-1?o.push(i):a.push(i)),a.forEach(i=>i()),yk=o}let qC;function FK(){return qC||(qC=Promise.resolve(),qC.then(()=>{qC=null})),qC}function MS(c,o,a){c.dispatchEvent(Ple(`${o?"intro":"outro"}${a}`))}const LT=new Set;let s1;function Bs(){s1={r:0,c:[],p:s1}}function Ps(){s1.r||Ul(s1.c),s1=s1.p}function hr(c,o){c&&c.i&&(LT.delete(c),c.i(o))}function Cr(c,o,a,i){if(c&&c.o){if(LT.has(c))return;LT.add(c),s1.c.push(()=>{LT.delete(c),i&&(a&&c.d(1),i())}),c.o(o)}else i&&i()}const RK={duration:0};function qle(c,o,a){const i={direction:"out"};let n=o(c,a,i),s=!0,h;const v=s1;v.r+=1;function g(){const{delay:O=0,duration:A=300,easing:S=YB,tick:M=Fi,css:P}=n||RK;P&&(h=_6(c,1,0,A,O,S,P));const L=kK()+O,V=L+A;Ll(()=>MS(c,!1,"start")),CK(N=>{if(s){if(N>=V)return M(0,1),MS(c,!1,"end"),--v.r||Ul(v.c),!1;if(N>=L){const ee=S((N-L)/A);M(1-ee,ee)}}return s})}return Fg(n)?FK().then(()=>{n=n(i),g()}):g(),{end(O){O&&n.tick&&n.tick(1,0),s&&(h&&DK(c,h),s=!1)}}}function Qd(c,o,a,i){const n={direction:"both"};let s=o(c,a,n),h=i?0:1,v=null,g=null,O=null;function A(){O&&DK(c,O)}function S(P,L){const V=P.b-h;return L*=Math.abs(V),{a:h,b:P.b,d:V,duration:L,start:P.start,end:P.start+L,group:P.group}}function M(P){const{delay:L=0,duration:V=300,easing:N=YB,tick:ee=Fi,css:J}=s||RK,K={start:kK()+L,b:P};P||(K.group=s1,s1.r+=1),v||g?g=K:(J&&(A(),O=_6(c,h,P,V,L,N,J)),P&&ee(0,1),v=S(K,V),Ll(()=>MS(c,P,"start")),CK(re=>{if(g&&re>g.start&&(v=S(g,V),g=null,MS(c,v.b,"start"),J&&(A(),O=_6(c,h,v.b,v.duration,0,N,s.css))),v){if(re>=v.end)ee(h=v.b,1-h),MS(c,v.b,"end"),g||(v.b?A():--v.group.r||Ul(v.group.c)),v=null;else if(re>=v.start){const ce=re-v.start;h=v.a+v.d*N(ce/v.duration),ee(h,1-h)}}return!!(v||g)}))}return{run(P){Fg(s)?FK().then(()=>{s=s(n),M(P)}):M(P)},end(){A(),v=g=null}}}function BK(c,o){Cr(c,1,1,()=>{o.delete(c.key)})}function PK(c,o,a,i,n,s,h,v,g,O,A,S){let M=c.length,P=s.length,L=M;const V={};for(;L--;)V[c[L].key]=L;const N=[],ee=new Map,J=new Map,K=[];for(L=P;L--;){const ke=S(n,s,L),Ce=a(ke);let be=h.get(Ce);be?i&&K.push(()=>be.p(ke,o)):(be=O(Ce,ke),be.c()),ee.set(Ce,N[L]=be),Ce in V&&J.set(Ce,Math.abs(L-V[Ce]))}const re=new Set,ce=new Set;function pe(ke){hr(ke,1),ke.m(v,A),h.set(ke.key,ke),A=ke.first,P--}for(;M&&P;){const ke=N[P-1],Ce=c[M-1],be=ke.key,$e=Ce.key;ke===Ce?(A=ke.first,M--,P--):ee.has($e)?!h.has(be)||re.has(be)?pe(ke):ce.has($e)?M--:J.get(be)>J.get($e)?(ce.add(be),pe(ke)):(re.add($e),M--):(g(Ce,h),M--)}for(;M--;){const ke=c[M];ee.has(ke.key)||g(ke,h)}for(;P;)pe(N[P-1]);return Ul(K),N}function jK(c,o,a){const i=c.$$.props[o];i!==void 0&&(c.$$.bound[i]=a,a(c.$$.ctx[i]))}function xi(c){c&&c.c()}function gi(c,o,a,i){const{fragment:n,after_update:s}=c.$$;n&&n.m(o,a),i||Ll(()=>{const h=c.$$.on_mount.map(xK).filter(Fg);c.$$.on_destroy?c.$$.on_destroy.push(...h):Ul(h),c.$$.on_mount=[]}),s.forEach(Ll)}function vi(c,o){const a=c.$$;a.fragment!==null&&(Hle(a.after_update),Ul(a.on_destroy),a.fragment&&a.fragment.d(o),a.on_destroy=a.fragment=null,a.ctx=[])}function Gle(c,o){c.$$.dirty[0]===-1&&(ok.push(c),Vle(),c.$$.dirty.fill(0)),c.$$.dirty[o/31|0]|=1<<o%31}function Vo(c,o,a,i,n,s,h,v=[-1]){const g=ZS;IS(c);const O=c.$$={fragment:null,ctx:[],props:s,update:Fi,not_equal:n,bound:x$(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(o.context||(g?g.$$.context:[])),callbacks:x$(),dirty:v,skip_bound:!1,root:o.target||g.$$.root};h&&h(O.root);let A=!1;if(O.ctx=a?a(c,o.props||{},(S,M,...P)=>{const L=P.length?P[0]:M;return O.ctx&&n(O.ctx[S],O.ctx[S]=L)&&(!O.skip_bound&&O.bound[S]&&O.bound[S](L),A&&Gle(c,S)),M}
4):[],O.update(),A=!0,Ul(O.before_update),O.fragment=i?i(O.ctx):!1,o.target){if(o.hydrate){const S=Rle(o.target);O.fragment&&O.fragment.l(S),S.forEach(br)}else O.fragment&&O.fragment.c();o.intro&&hr(c.$$.fragment),gi(c,o.target,o.anchor,o.customElement),MK()}IS(g)}class $o{$destroy(){vi(this,1),this.$destroy=Fi}$on(o,a){if(!Fg(a))return Fi;const i=this.$$.callbacks[o]||(this.$$.callbacks[o]=[]);return i.push(a),()=>{const n=i.indexOf(a);n!==-1&&i.splice(n,1)}}$set(o){this.$$set&&!Nle(o)&&(this.$$.skip_bound=!0,this.$$set(o),this.$$.skip_bound=!1)}}class mc{static getInputBehaviour(){return this.inputBehaviour}static getOutputBehaviour(){return this.outputBehaviour}static setInputBehaviour(o){this.inputBehaviour=o}static setOutputBehaviour(o){this.outputBehaviour=o}}const $_=[];function Kle(c,o){return{subscribe:Dc(c,o).subscribe}}function Dc(c,o=Fi){let a;const i=new Set;function n(v){if(jo(c,v)&&(c=v,a)){const g=!$_.length;for(const O of i)O[1](),$_.push(O,c);if(g){for(let O=0;O<$_.length;O+=2)$_[O][0]($_[O+1]);$_.length=0}}}function s(v){n(v(c))}function h(v,g=Fi){const O=[v,g];return i.add(O),i.size===1&&(a=o(n)||Fi),v(c),()=>{i.delete(O),i.size===0&&a&&(a(),a=null)}}return{set:n,update:s,subscribe:h}}function Yle(c,o,a){const i=!Array.isArray(c),n=i?[c]:c,s=o.length<2;return Kle(a,h=>{let v=!1;const g=[];let O=0,A=Fi;const S=()=>{if(O)return;A();const P=o(i?g[0]:g,h);s?h(P):A=Fg(P)?P:Fi},M=n.map((P,L)=>XB(P,V=>{g[L]=V,O&=~(1<<L),v&&S()},()=>{O|=1<<L}));return v=!0,S(),function(){Ul(M),A(),v=!1}})}const Xle={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},LK={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Kc={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},ap={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Ex={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class ni{static getFirstMatch(o,a){const i=a.match(o);return i&&i.length>0&&i[1]||""}static getSecondMatch(o,a){const i=a.match(o);return i&&i.length>1&&i[2]||""}static matchAndReturnConst(o,a,i){if(o.test(a))return i}
vendor: 18,677 bytes, lines 4-9
4static getWindowsVersionName(o){switch(o){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(o){const a=o.split(".").splice(0,2).map(i=>parseInt(i,10)||0);if(a.push(0),a[0]===10)switch(a[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(o){const a=o.split(".").splice(0,2).map(i=>parseInt(i,10)||0);if(a.push(0),!(a[0]===1&&a[1]<5)){if(a[0]===1&&a[1]<6)return"Cupcake";if(a[0]===1&&a[1]>=6)return"Donut";if(a[0]===2&&a[1]<2)return"Eclair";if(a[0]===2&&a[1]===2)return"Froyo";if(a[0]===2&&a[1]>2)return"Gingerbread";if(a[0]===3)return"Honeycomb";if(a[0]===4&&a[1]<1)return"Ice Cream Sandwich";if(a[0]===4&&a[1]<4)return"Jelly Bean";if(a[0]===4&&a[1]>=4)return"KitKat";if(a[0]===5)return"Lollipop";if(a[0]===6)return"Marshmallow";if(a[0]===7)return"Nougat";if(a[0]===8)return"Oreo";if(a[0]===9)return"Pie"}}static getVersionPrecision(o){return o.split(".").length}static compareVersions(o,a,i=!1){const n=ni.getVersionPrecision(o),s=ni.getVersionPrecision(a);let h=Math.max(n,s),v=0;const g=ni.map([o,a],O=>{const A=h-ni.getVersionPrecision(O),S=O+new Array(A+1).join(".0");return ni.map(S.split("."),M=>new Array(20-M.length).join("0")+M).reverse()});for(i&&(v=h-Math.min(n,s)),h-=1;h>=v;){if(g[0][h]>g[1][h])return 1;if(g[0][h]===g[1][h]){if(h===v)return 0;h-=1}else if(g[0][h]<g[1][h])return-1}}static map(o,a){const i=[];let n;if(Array.prototype.map)return Array.prototype.map.call(o,a);for(n=0;n<o.length;n+=1)i.push(a(o[n]));return i}static find(o,a){let i,n;if(Array.prototype.find)return Array.prototype.find.call(o,a);for(i=0,n=o.length;i<n;i+=1){const s=o[i];if(a(s,i))return s}}static assign(o,...a){const i=o;let n,s;if(Object.assign)return Object.assign(o,...a);for(n=0,s=a.length;n<s;n+=1){const h=a[n];typeof h=="object"&&h!==null&&Object.keys(h).forEach(g=>{i[g]=h[g]})}return o}static getBrowserAlias(o){return Xle[o]}static getBrowserTypeByAlias(o){return LK[o]||""}}const cu=/version\/(\d+(\.?_?\d+)+)/i,Jle=[{test:[/googlebot/i],describe(c){const o={name:"Googlebot"},a=ni.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/opera/i],describe(c){const o={name:"Opera"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/opr\/|opios/i],describe(c){const o={name:"Opera"},a=ni.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/SamsungBrowser/i],describe(c){const o={name:"Samsung Internet for Android"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/Whale/i],describe(c){const o={name:"NAVER Whale Browser"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/MZBrowser/i],describe(c){const o={name:"MZ Browser"},a=ni.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/focus/i],describe(c){const o={name:"Focus"},a=ni.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/swing/i],describe(c){const o={name:"Swing"},a=ni.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/coast/i],describe(c){const o={name:"Opera Coast"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(c){const o={name:"Opera Touch"},a=ni.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/yabrowser/i],describe(c){const o={name:"Yandex Browser"},a=ni.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/ucbrowser/i],describe(c){const o={name:"UC Browser"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/Maxthon|mxios/i],describe(c){const o={name:"Maxthon"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/epiphany/i],describe(c){const o={name:"Epiphany"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/puffin/i],describe(c){const o={name:"Puffin"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/sleipnir/i],describe(c){const o={name:"Sleipnir"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/k-meleon/i],describe(c){const o={name:"K-Meleon"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/micromessenger/i],describe(c){const o={name:"WeChat"},a=ni.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/qqbrowser/i],describe(c){const o={name:/qqbrowserlite/i.test(c)?"QQ Browser Lite":"QQ Browser"},a=ni.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/msie|trident/i],describe(c){const o={name:"Internet Explorer"},a=ni.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/\sedg\//i],describe(c){const o={name:"Microsoft Edge"},a=ni.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/edg([ea]|ios)/i],describe(c){const o={name:"Microsoft Edge"},a=ni.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/vivaldi/i],describe(c){const o={name:"Vivaldi"},a=ni.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/seamonkey/i],describe(c){const o={name:"SeaMonkey"},a=ni.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/sailfish/i],describe(c){const o={name:"Sailfish"},a=ni.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,c);return a&&(o.version=a),o}},{test:[/silk/i],describe(c){const o={name:"Amazon Silk"},a=ni.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/phantom/i],describe(c){const o={name:"PhantomJS"},a=ni.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/slimerjs/i],describe(c){const o={name:"SlimerJS"},a=ni.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(c){const o={name:"BlackBerry"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/(web|hpw)[o0]s/i],describe(c){const o={name:"WebOS Browser"},a=ni.getFirstMatch(cu,c)||ni.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/bada/i],describe(c){const o={name:"Bada"},a=ni.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/tizen/i],describe(c){const o={name:"Tizen"},a=ni.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/qupzilla/i],describe(c){const o={name:"QupZilla"},a=ni.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/firefox|iceweasel|fxios/i],describe(c){const o={name:"Firefox"},a=ni.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/electron/i],describe(c){const o={name:"Electron"},a=ni.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/MiuiBrowser/i],describe(c){const o={name:"Miui"},a=ni.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/chromium/i],describe(c){const o={name:"Chromium"},a=ni.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,c)||ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/chrome|crios|crmo/i],describe(c){const o={name:"Chrome"},a=ni.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/GSA/i],describe(c){const o={name:"Google Search"},a=ni.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test(c){const o=!c.test(/like android/i),a=c.test(/android/i);return o&&a},describe(c){const o={name:"Android Browser"},a=ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/playstation 4/i],describe(c){const o={name:"PlayStation 4"},a=ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/safari|applewebkit/i],describe(c){const o={name:"Safari"},a=ni.getFirstMatch(cu,c);return a&&(o.version=a),o}},{test:[/.*/i],describe(c){const o=/^(.*)\/(.*) /,a=/^(.*)\/(.*)[ \t]\((.*)/,n=c.search("\\(")!==-1?a:o;return{name:ni.getFirstMatch(n,c),version:ni.getSecondMatch(n,c)}}}],Qle=[{test:[/Roku\/DVP/],describe(c){const o=ni.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,c);return{name:ap.Roku,version:o}}},{test:[/windows phone/i],describe(c){const o=ni.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,c);return{name:ap.WindowsPhone,version:o}}},{test:[/windows /i],describe(c){const o=ni.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,c),a=ni.getWindowsVersionName(o);return{name:ap.Windows,version:o,versionName:a}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(c){const o={name:ap.iOS},a=ni.getSecondMatch(/(Version\/)(\d[\d.]+)/,c);return a&&(o.version=a),o}},{test:[/macintosh/i],describe(c){const o=ni.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,c).replace(/[_\s]/g,"."),a=ni.getMacOSVersionName(o),i={name:ap.MacOS,version:o};return a&&(i.versionName=a),i}},{test:[/(ipod|iphone|ipad)/i],describe(c){const o=ni.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,c).replace(/[_\s]/g,".");return{name:ap.iOS,version:o}}},{test(c){const o=!c.test(/like android/i),a=c.test(/android/i);return o&&a},describe(c){const o=ni.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,c),a=ni.getAndroidVersionName(o),i={name:ap.Android,version:o};return a&&(i.versionName=a),i}},{test:[/(web|hpw)[o0]s/i],describe(c){const o=ni.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,c),a={name:ap.WebOS};return o&&o.length&&(a.version=o),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(c){const o=ni.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,c)||ni.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,c)||ni.getFirstMatch(/\bbb(\d+)/i,c);return{name:ap.BlackBerry,version:o}}},{test:[/bada/i],describe(c){const o=ni.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,c);return{name:ap.Bada,version:o}}},{test:[/tizen/i],describe(c){const o=ni.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,c);return{name:ap.Tizen,version:o}}},{test:[/linux/i],describe(){return{name:ap.Linux}}},{test:[/CrOS/],describe(){return{name:ap.ChromeOS}}},{test:[/PlayStation 4/],describe(c){const o=ni.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,c);return{name:ap.PlayStation4,version:o}}}],Zle=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(c){const o=ni.getFirstMatch(/(can-l01)/i,c)&&"Nova",a={type:Kc.mobile,vendor:"Huawei"};return o&&(a.model=o),a}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:Kc.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:Kc.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:Kc.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:Kc.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:Kc.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:Kc.tablet}}},{test(c){const o=c.test(/ipod|iphone/i),a=c.test(/like (ipod|iphone)/i);return o&&!a},describe(c){const o=ni.getFirstMatch(/(ipod|iphone)/i,c);return{type:Kc.mobile,vendor:"Apple",model:o}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:Kc.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:Kc.mobile}}},{test(c){return c.getBrowserName(!0)==="blackberry"},describe(){return{type:Kc.mobile,vendor:"BlackBerry"}}},{test(c){return c.getBrowserName(!0)==="bada"},describe(){return{type:Kc.mobile}}},{test(c){return c.getBrowserName()==="windows phone"},describe(){return{type:Kc.mobile,vendor:"Microsoft"}}},{test(c){const o=Number(String(c.getOSVersion()).split(".")[0]);return c.getOSName(!0)==="android"&&o>=3},describe(){return{type:Kc.tablet}}},{test(c){return c.getOSName(!0)==="android"},describe(){return{type:Kc.mobile}}},{test(c){return c.getOSName(!0)==="macos"},describe(){return{type:Kc.desktop,vendor:"Apple"}}},{test(c){return c.getOSName(!0)==="windows"},describe(){return{type:Kc.desktop}}},{test(c){return c.getOSName(!0)==="linux"},describe(){return{type:Kc.desktop}}},{test(c){return c.getOSName(!0)==="playstation 4"},describe(){return{type:Kc.tv}}},{test(c){return c.getOSName(!0)==="roku"},describe(){return{type:Kc.tv}}}],efe=[{test(c){return c.getBrowserName(!0)==="microsoft edge"},describe(c){if(/\sedg\//i.test(c))return{name:Ex.Blink};const a=ni.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,c);return{name:Ex.EdgeHTML,version:a}}},{test:[/trident/i],describe(c){const o={name:Ex.Trident},a=ni.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test(c){return c.test(/presto/i)},describe(c){const o={name:Ex.Presto},a=ni.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test(c){const o=c.test(/gecko/i),a=c.test(/like gecko/i);return o&&!a},describe(c){const o={name:Ex.Gecko},a=ni.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Ex.Blink}}},{test:[/(apple)?webkit/i],describe(c){const o={name:Ex.WebKit},a=ni.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,c);return a&&(o.version=a),o}}];class k${constructor(o,a=!1){if(o==null||o==="")throw new Error("UserAgent parameter can't be empty");this._ua=o,this.parsedResult={},a!==!0&&this.parse()}getUA(){return this._ua}test(o){return o.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const o=ni.find(Jle,a=>{if(typeof a.test=="function")return a.test(this);if(a.test instanceof Array)return a.test.some(i=>this.test(i));throw new Error("Browser's test function is not valid")});return o&&(this.parsedResult.browser=o.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(o){return o?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const o=ni.find(Qle,a=>{if(typeof a.test=="function")return a.test(this);if(a.test instanceof Array)return a.test.some(i=>this.test(i));throw new Error("Browser's test function is not valid")});return o&&(this.parsedResult.os=o.describe(this.getUA())),this.parsedResult.os}getOSName(o){const{name:a}=this.getOS();return o?String(a).toLowerCase()||"":a||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(o=!1){const{type:a}=this.getPlatform();return o?String(a).toLowerCase()||"":a||""}parsePlatform(){this.parsedResult.platform={};const o=ni.find(Zle,a=>{if(typeof a.test=="function")return a.test(this);if(a.test instanceof Array)return a.test.some(i=>this.test(i));throw new Error("Browser's test function is not valid")});return o&&(this.parsedResult.platform=o.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(o){return o?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const o=ni.find(efe,a=>{if(typeof a.test=="function")return a.test(this);if(a.test instanceof Array)return a.test.some(i=>this.test(i));throw new Error("Browser's test function is not valid")});return o&&(this.parsedResult.engine=o.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return ni.assign({},this.parsedResult)}satisfies(o){const a={};let i=0;const n={};let s=0;if(Object.keys(o).forEach(v=>{const g=o[v];typeof g=="string"?(n[v]=g,s+=1):typeof g=="object"&&(a[v]=g,i+=1)}),i>0){const v=Object.keys(a),g=ni.find(v,A=>this.isOS(A));if(g){const A=this.satisfies(a[g]);if(A!==void 0)return A}const O=ni.find(v,A=>this.isPlatform(A));if(O){const A=this.satisfies(a[O]);if(A!==void 0)return A}}if(s>0){const v=Object.keys(n),g=ni.find(v,O=>this.isBrowser(O,!0));if(g!==void 0)return this.compareVersion(n[g])}}isBrowser(o,a=!1){const i=this.getBrowserName().toLowerCase();let n=o.toLowerCase();const s=ni.getBrowserTypeByAlias(n);return a&&s&&(n=s.toLowerCase()),n===i}compareVersion(o){let a=[0],i=o,n=!1;const s=this.getBrowserVersion();if(typeof s=="string")return o[0]===">"||o[0]==="<"?(i=o.substr(1),o[1]==="="?(n=!0,i=o.substr(2)):a=[],o[0]===">"?a.push(1):a.push(-1)):o[0]==="="?i=o.substr(1):o[0]==="~"&&(n=!0,i=o.substr(1)),a.indexOf(ni.compareVersions(s,i,n))>-1}isOS(o){return this.getOSName(!0)===String(o).toLowerCase()}isPlatform(o){return this.getPlatformType(!0)===String(o).toLowerCase()}isEngine(o){return this.getEngineName(!0)===String(o).toLowerCase()}is(o,a=!1){return this.isBrowser(o,a)||this.isOS(o)||this.isPlatform(o)}some(o=[]){return o.some(a=>this.is(a))}}/*! 5 * Bowser - a browser detector 6 * https://github.com/lancedikson/bowser 7 * MIT License | (c) Dustin Diaz 2012-2015 8 * MIT License | (c) Denis Demchenko 2015-2019 9 */class D0{static getParser(o,a=!1){if(typeof o!="string")throw new Error("UserAgent should be a string");return new k$(o,a)}static parse(o){return new k$(o).getResult()}static get BROWSER_MAP(){return LK}static get ENGINE_MAP(){return Ex}static get OS_MAP(){return ap}static get PLATFORMS_MAP(){return Kc}}const tfe=["mobile","tablet","tv"];class cp{constructor(o,a){this.majorVersion=o,this.minorVersion=a}static compareSubVersions(o,a){let i=o,n=a;
9if(typeof o=="string"){if(o==="*")return 0;i=parseInt(o)}if(typeof a=="string"){if(a==="*")return 0;n=parseInt(a)}const s=Math.sign(i-n);return console.assert(!isNaN(s)),s}isGreaterThan(o){const a=cp.compareSubVersions(this.majorVersion,o.majorVersion),i=cp.compareSubVersions(this.minorVersion,o.minorVersion);return a<0?!1:a>0?!0:i>0}isEqualTo(o){const a=cp.compareSubVersions(this.majorVersion,o.majorVersion),i=cp.compareSubVersions(this.minorVersion,o.minorVersion);return a==0&&i==0}isLessThan(o){return!this.isGreaterThan(o)&&!this.isEqualTo(o)}toString(){const o=parseInt(this.majorVersion.toString()),a=parseInt(this.minorVersion.toString());return isNaN(a)?o.toString():o.toString()+"."+a.toString()}}class zK{static getMinVersion(o){var a;return(a=this.minVersions.find(i=>i.browser.toLowerCase()===o.toLowerCase()))==null?void 0:a.version}static getSupportedBrowsers(){return this.minVersions}static isVersionExempted(o,a,i){return this.exceptions.filter(n=>n.browser.toLowerCase()==o.toLowerCase()).filter(n=>n.os.toLowerCase()==i.toLowerCase()).filter(n=>n.version.isEqualTo(a)).length>0}static isVersionAtLeastMin(o,a){return this.minVersions.filter(i=>i.browser==o).filter(i=>i.version.isEqualTo(a)||i.version.isLessThan(a)).length>0}static isBrowserSupported(o){return this.minVersions.filter(a=>a.browser.toLowerCase()===o.toLowerCase()).length!=0}static isVersionSupported(o,a,i){return!this.isVersionExempted(o,a,i)&&this.isVersionAtLeastMin(o,a)}static isSupported(o,a,i){throw new Error("isSupported is not implemented on this instance of CompatibilityList!")}}class eA extends zK{static isSupported(o,a,i){return navigator.bluetooth?this.isVersionSupported(o,a,i):!1}}eA.exceptions=[];eA.minVersions=[{browser:D0.BROWSER_MAP.chrome,version:new cp(56,"*")},{browser:D0.BROWSER_MAP.chromium,version:new cp(56,"*")},{browser:D0.BROWSER_MAP.edge,version:new cp(79,"*")},{browser:D0.BROWSER_MAP.opera,version:new cp(43,"*")}];class ZB extends zK{static isSupported(o,a,i){return navigator.usb?this.isVersionSupported(o,a,i):!1}}ZB.exceptions=[{browser:D0.BROWSER_MAP.chrome,version:new cp(105,"*"),os:D0.OS_MAP.ChromeOS}];ZB.minVersions=[{browser:D0.BROWSER_MAP.chrome,version:new cp(61,"*")},{browser:D0.BROWSER_MAP.chromium,version:new cp(61,"*")},{browser:D0.BROWSER_MAP.edge,version:new cp(79,"*")},{browser:D0.BROWSER_MAP.opera,version:new cp(48,"*")}];class eP{}eP.isInDevelopment=!1;class UK{static checkCompatibility(){if(localStorage.getItem("isTesting"))return{bluetooth:!0,usb:!0,platformAllowed:!0};const o=D0.getParser(window.navigator.userAgent),a=o.getBrowser().name??"unknown",i=o.getOS().name??"unknown";if(!o.getBrowserVersion())return{bluetooth:!1,usb:!1,platformAllowed:!0};const s=o.getBrowserVersion().split(".")[0],h=o.getBrowserVersion().split(".")[1],v=new cp(s,h),g=eA.isVersionSupported(a,v,i),O=ZB.isVersionSupported(a,v,i);let A=o.getPlatform().type;A==null&&(A="desktop");const S=eP.isInDevelopment||!tfe.includes(A);return{bluetooth:g,usb:O,platformAllowed:S}}}const WK={da:{"alert.micro.GATTserverInform":"Tilkobling til GATT server...","alert.micro.microBitServiceInform":"Tilkobling til Micro:bit services...","alert.micro.gettingDataInform":"Anskaffer data","alert.micro.nowConnectedInform":"Micro:bit er nu tilkoblet","alert.data.classNameLengthAlert":"Navne mÃ¥ kun bestÃ¥ af 25 tegn","alert.recording.disconnectedDuringRecording":"micro:bit frakoblede under optagelse","alert.output.GATTserverInform":"Tilkobling til GATT server...","alert.output.microBitServiceInform":"Tilkobling til Micro:bit services...","alert.output.connectingToComponents":"Anskaffer forbindelse til enkelte komponenter...","alert.output.nowConnectedInform":"Micro:bit er nu tilkoblet","alert.isRecording":"Du er i gang med at optage!","alert.isTesting":"Du er i gang med at optage!","alert.isTraining":"Du er i gang med at træne en model!","alert.isNotConnected":"Din Micro:bit skal være tilsluttet!","alert.deleteGestureConfirm":"Er du sikker pÃ¥ at du vil slette klassen ","alert.beginModelSetup":"PÃ¥begynder opsætning af model","alert.trainingModel":"Træner modellen","alert.twoGestures":"Du skal have mindst to klasser","alert.oneDataRepresentation":"Du skal have mindst en data-repræsentation","alert.recordingsPerGesture":"Du skal have mindst tre eksempler for hver klasse","content.index.heading":"Gør-det-selv machine learning","content.index.howBody":"Velkommen til 'ultra:bit datatræneren'. Eksperimentér og leg med machine learning og byg dine første machine learning-modeller â kom i gang her!","content.index.ledDescription":"25 LED lys","content.index.recordButtonDescription":'"Optag"-knap',"content.index.videoHeading":"Introvideo","content.index.videoBody":"Du kan finde en introvideo til værktøjet pÃ¥ DR's hjemmeside:","content.index.setupBody2":"Hjemmesiden benytter bluetooth, accelerometer, LED'er, knapper og lyd fra BBC micro:bit'en. For at hjemmesiden kan tilgÃ¥ disse, skal der overføres et program til BBC micro:bit'en. Det downloades første gang, du tilslutter BBC micro:bit'en med USB. Efterfølgende kan du blot tilslutte med bluetooth uden at bruge USB-kablet.","content.index.contactButton":"Kontakt os","content.index.contactBody":"Hvis du finder fejl og mangler pÃ¥ denne platform, skal du være velkommen til at skrive til os. Hvis du har andre efterspørgsler, ideer eller generel interesse, skal du være velkommen til at kontakte os. Skaberne af denne platform kan kontaktes pÃ¥:","content.index.contactMail":"[email protected]","content.index.ultrabit":"ultra:bit","content.index.acknowledgement":"Udviklet af Center for Computational Thinking og Design, Aarhus Universitet","content.data.classPlaceholderNewClass":"Klik for at ændre navnet","content.data.select":"Vælg","content.data.selected":"Valgt","content.data.record":"Optag","content.data.addD
9ata":"Tilføj data","content.data.classHelpHeader":"Klasse","content.data.classHelpBody":"En klasse beskriver en type af bevægelse. Vi kan optage eksempler af en bestemt type bevægelse og putte eksemplerne i samme klasse. Træneren kan finde mønstre i eksemplerne/dataet og bruge disse mønstre til at træne en model, der kan genkende denne type bevægelse. Flere eksmpler vil typisk reulstere i en bedre model, men overvej på hvor mange forskellige måder en bevægelse kan laves.","content.data.classification":"Klasser","content.data.data":"Data","content.data.choice":"Valg","content.data.choice.header":"Valg af klasse","content.data.choice.body":'Her vælger du, hvilken klasse du vil tilføje data til. Efter at du har valgt en klasse at tilføje data til, kan du trykke på "Optag" knappen nedenfor, eller på en af knapperne på din micro:bit for at optage et data-segment. Se billedet nedenfor.',"content.data.dataDescription":"Her kan du se din indsamlede data. Generelt vil det være en fordel at have mere data, da dette giver lærings-algoritmen mere infomration at lære ud fra.","content.data.addD
9ataNoConnection":"Du kan ikke tilføje data, uden at være tilsluttet en micro:bit","content.data.noData":"Du har ingen bevægelser at træne med. Tilføj nogle bevægelser, som du vil træne din BBC micro:bit til at genkende.","content.trainer.failure.header":"Træning mislykkedes","content.trainer.failure.body":"Træningen resulterede ikke i en brugbar model. Grunden til dette ligger sandsynligvis i dataet. Hvis dataet i forskellige klasser minder for meget om hinanden, kan dette resultere i nogle forskellige problemer i træningsprocessen, der ikke gør det muligt at træne modellen ordentligt.","content.trainer.failure.todo":"Gå tilbage til datasiden og ændr i din data.","content.model.trainModelFirstHeading":"Træn modellen først!","content.model.trainModelFirstBody":"Gå til 'Træner'-siden","content.model.classification.helpHeading":"Sandsynligheds-meteret","content.model.classification.helpBody":"For hver forudsigelse, vil modellen producere et procent-tal, der beskriver hvor sikker modellen er i sin fordusigelse. Dette meter går fra 0% til 100%. Med slideren ved siden af, kan du bestemme grænsen for, hvor sikker modellen skal være i sin forudsigelse for at lave et output (fx afspille en lyd)","content.model.output.affect":"Påvirk","content.model.output.optionPin":"Pin","content.model.output.optionSound":"Lyd","content.model.output.soundOptionCongratulations":"Tillykke","content.model.output.soundOptionHighPitchBeep":"Højtone Bip","content.model.output.soundOptionLowPitchBeep":"Lavtone Bip","content.model.output.soundOptionLoser":"Taber","content.model.output.soundOptionMistake":"Fejl","content.model.output.soundOptionHugeMistake":"Kæmpe fejl","content.model.output.prediction.iconTitle":"Forudsigelse","content.model.output.prediction.descriptionTitle":"Forudsigelse","content.model.output.prediction.descriptionBody":"Her kan du se, hvilken klasse din model forudsiger den nuværende bevægelse til at være. Du kan se i meteret hvor sikker modellen er i sin forudsigelse.","content.model.output.ledOutput.descriptionTitle":"LED output","content.model.output.ledOutput.descriptionBody":"Her kan du vælge, hvordan LED-lysene på din output-micro:bit skal opføre sig, når din model forudsiger en klasse. Prøv at tegne nogle mønstre nedenfor og se, hvordan disse mønstre vises på din output-micro:bit, når du bevæger input-micro:bit'en.","content.model.output.sound.iconTitle":"Lyd","content.model.output.sound.descriptionTitle":"Afspilling af lyd","content.model.output.sound.descriptionBody":"Her kan du vælge hvilken lyd din output-micro:bit skal afspille, når din model laver en forudsigelse. Bemærk at lyden afspilles af din computer, hvis du har en micro:bit version 1.","content.model.output.popup.header":"Tilslut output-micro:bit","content.model.output.popup.body":"Hvis du ikke har tilsluttet en output-micro:bit, kan du ikke se resultatet af de ændringer du laver på denne side. Tilslut nedenfor.","footer.connectButtonNotConnected":"Tilslut din BBC micro:bit","footer.disconnectButton":"Frakobl","footer.helpHeader":"Live graf","footer.helpContent":"Når du har forbundet en micro:bit kan du live se Accelerometer-data for alle tre akser på denne graf. Prøv at bevæge din forbundende micro:bit og se, hvordan den data der produceres af bevægelserne ser ud for computeren!","footer.reconnecting":"Genopretter forbindelsen. Vent venligst","menu.data.helpHeading":"Data","menu.data.helpBody":"For at træne en model til at genkende forskellige bevægelser, skal vi have gode eksempler på 'god opførsel', som vi kan vise træneren. Her kan i oprette klasser (en type bevægelse) og optage eksempler til hver klasse. Der skal være mindst 2 klasser med hver 3 eksempler før træneren kan træne en model.","menu.data.examples":"eksempler","menu.trainer.helpHeading":"Træner","menu.trainer.helpBody":"Træneren kigger på eksemplerne i klasserne og forsøger at 'lære', hvordan de forskellige klasser kan genkendes ved at finde mønstre i dataet. Her kan i træne en model, der kan genkende forskellige bevægelser.","menu.trainer.notConnected1":"Du har ikke tilkoblet en BBC micro:bit.","menu.trainer.notConnected2":"Gør dette vha. knappen nedenfor","menu.trainer.notEnoughDataHeader1":`Ikke nok data! 10Gå til Data-siden`,"menu.trainer.notEnoughDataInfoBody":"Der er brug for minimum 2 klasser med 3 eksempler i hver for at kunne træne en model.","menu.trainer.notEnoughDataInfo":"Du har ikke indsamlet nok data til at træne en model. Der er brug for minimum 2 klasser med 3 eksempler i hver. Gå til Data-siden for at indsamle mere data","menu.trainer.trainModelButton":"Træn model","menu.trainer.trainNewModelButton":"Træn en ny model","menu.trainer.TrainingFinished":"Træning færdig","menu.trainer.TrainingFinished.body":"Gå til Model-siden for at undersøge hvor godt din model virker","menu.trainer.isTrainingModelButton":"Træner model...","menu.model.helpHeading":"Model","menu.model.helpBody":"Modellen kan bruges i et interaktivt system. Her bruger vi den trænede model til at forudsige bevægelser. Du kan tilslutte endnu en micro:bit og få den til at reagere på de bevægelser du laver.","menu.model.noModel":"Ingen model","menu.model.connectOutputButton":"Tilslut output-micro:bit","menu.model.disconnect":"Frakobl output-micro:bit","popup.connectMB.main.bluetooth.subtitle":"Tilslut med Bluetooth","popup.connectMB.bluetooth.heading":"Tilslut med Bluetooth","popup.connectMB.bluetooth.cancelledConnection":"Du anullerede forbindelses-processen. Prøv igen hvis du ønsker at fortsætte.","popup.connectMB.bluetooth.step0":"Tilslut et batteri til din BBC micro:bit","popup.connectMB.bluetooth.step1":"Tegn mønstret du ser på BBC micro:bit'en","popup.connectMB.bluetooth.step2":"Tryk på knappen nedenfor.","popup.connectMB.bluetooth.step3"
10:"Vælg din BBC micro:bit og tryk 'tilslut'.","popup.connectMB.bluetooth.connect":"Tilslut","popup.connectMB.bluetooth.connecting":"Tilslutter...","popup.disconnectedWarning.input":"Din input-micro:bit mistede forbindelsen, vil du prøve igen?","popup.disconnectedWarning.output":"Din output-micro:bit mistede forbindelsen, vil du prøve igen?","popup.disconnectedWarning.reconnectButton.input":"Tilslut input igen","popup.disconnectedWarning.reconnectButton.output":"Tilslut output igen","connectMB.main.usbHeader":"DOWNLOAD PROGRAM TIL BBC MICRO:BIT","connectMB.main.btHeader":"TILSLUT DIN BBC MICRO:BIT VIA BLUETOOTH","connectMB.main.usbBody":"Hvis du ikke tidligere har downloadet programmet","connectMB.main.btBody":"Hvis du allerede har downloadet programmet","connectMB.main.connectButton":"Tilslut","connectMB.main.installButton":"Download","connectMB.output.header":"En micro:bit er allerede forbundet","connectMB.usb.header":"DOWNLOAD PROGRAM TIL BBC MICRO:BIT","connectMB.usb.body1":"Tilslut din BBC micro:bit med USB-kabel og tryk på 'næste'","connectMB.usb.body2":"Tryk 'Find USB-enhed' og vælg 'BBC micro:bit CMSIS-DAP' eller 'DAPLink CMSIS-DAP' fra popup-beskeden som kommer","connectMB.usb.button1":"Næste","connectMB.usb.button2":"Find USB-enhed","connectMB.usb.pleaseWait":"Vent venligst. Downloader program til micro:bit'en","connectMB.usb.done.body1":"Færdig - programmet er downloadet.","connectMB.usb.done.body2":"Du kan nu tilkoble dig via bluetooth.","connectMB.usb.done.body3":"Hvis du har et batteri til din micro:bit kan du nu tage usb-kablet ud og tilslutte batteriet i stedet.","connectMB.usb.done.body4":"Hvis du ikke har et batteri kan du fortsætte med at give din micro:bit strøm igennem usb-kablet.","connectMB.usb.manual.header":"Overfør fil til din BBC microbit","connectMB.usb.manual.manualDownload":"Hvis filen ikke downloadede automatisk tryk","connectMB.usb.manual.manualDownloadLink":"her","connectMB.usb.manual.done":"Færdig: Tilslut med bluetooth","connectMB.outputMB.same":"Brug samme BBC micro:bit","connectMB.outputMB.different":"Tilslut anden BBC micro:bit","connectMB.outputMB.sameButton":"Samme","connectMB.outputMB.otherButton":"Anden","cookies.banner.title":"Cookie politik","cookies.banner.subtitle":"Forbrug og analyse","cookies.banner.text.pleaseHelp":"Hjælp os med at forbedre siden! Tillad cookies for at hjælpe os.","cookies.banner.text.description":"Her hos ML-Machine bruger vi cookies for at indsamle information omkring forbrug af siden. Uden disse cookies er vi ikke i stand til at se hvordan vores side bliver brugt.","cookies.banner.text.readMore":"Du kan læse mere omkring vores cookie politik ","cookies.banner.text.readMore.here":"her","cookies.banner.buttons.reject":"Afvis","cookies.banner.buttons.accept":"Accepter","cookies.overlay.title":"Cookie politik","cookies.overlay.question.whatAreCookies":"Hvad er cookies?","cookies.overlay.question.ourReasoning":"Hvad bruger vi cookies til?","cookies.overlay.question.storageDuration":"Hvor lang tid gemmer vi cookies?","cookies.overlay.question.deleting":"Hvordan sletter man cookies?","cookies.overlay.question.consentChange":"Hvordan ændrer jeg mit samtykke?","cookies.overlay.answer.whatAreCookies":"Cookies er små filer med informationer, som der bliver gemt på den enhed du bruger til at browse med. Det er ikke programmer, som kan indeholder malware eller vira.","cookies.overlay.answer.ourReasoning":"Vi bruger cookies for at indsamle information omkring forbrug af siden. Uden disse cookies er vi ikke i stand til at se hvordan vores side bliver brugt. Du gør derfor os en stor tjeneste ved at give samtykke til cookies.","cookies.overlay.answer.storageDuration":"Det varier fra side til side og udnyttelsen af cookie'en. Nogle cookies bliver gemt indtil du forlader siden, andre bliver gemt i længere perioder. Alle vores cookies bliver gemt i et år.","cookies.overlay.answer.deleting":"Det er forskelligt fra browser til browser. Her er dog en liste af manualer til de mest populære browsere.","cookies.overlay.answer.consentChange":"På nuværende tidspunkt har du endnu ikke givet samtykke, men når du gør kan du blot slette din cookie, hvis du ønsker at trække samtykke tilbage eller på andenvis ombestemmer dig.","cookies.overlay.table.title":"Cookies som vi bruger","cookies.overlay.table.header.description":"Beskrivelse","cookies.overlay.table.row.ai_user.description":"Brugt af Microsoft Application Insights til at indsamle statistisk data omkring forbrug. Den gemmer derudover et unik identifikationsnummer, som bruges til at genkende dig næste gang du amkommer på siden. Den gemmer ikke noget personligt omkring dig, og genererer et identifikationsnummer tilfældigt.","cookies.overlay.table.row.ai_session.description":"Gemmer dit nuværende besøg, så vi kan genke
10nde dig pÃ¥ tværs af vores sider.","cookies.overlay.table.row.cookie_consent.description":"Gemmer dine samtykkevalg af vores cookie politik.","popup.compatibility.bluetooth.header":"Browser ikke understøttet!","popup.compatibility.bluetooth.explain":"Din nuværende browser understøtter ikke bluetooth. Bluetooth bruges til at drive siden. Uden det virker den ikke.","popup.compatibility.bluetooth.advice":"Sikre at din browser er opdateret. Ellers kan du vælge en af de nedestÃ¥ende browsere, som understøtter bluetooth.","popup.connectMB.USBCompatibility.transferStep.step1":"Ã
ben placering af den firmware fil du lige har downloadet. Den findes oftest i din download mappe.","popup.connectMB.USBCompatibility.transferStep.step2":"Træk filen over i micro:bit'en gennem din computers stifinder.","popup.connectMB.USBCompatibility.transferStep.step3":"Når overførslen er færdig, kan du tilslutte din micro:bit med Bluetooth.","compatibility.platform.notSupported":"Værktøjet er ikke understøttet på mobil.","compatibility.platform.notSupported.joinDesktop":"Vi ses på computer."},en:{"alert.micro.GATTserverInform":"Connecting to GATT server...","alert.micro.microBitServiceInform":"Connecting to Micro:bit services...","alert.micro.gettingDataInform":"Getting data","alert.micro.nowConnectedInform":"Micro:bit is now connected","alert.data.classNameLengthAlert":"Names must consists of maximum 25 characters.","alert.recording.disconnectedDuringRecording":"micro:bit disconnected during recording","alert.output.GATTserverInform":"Connecting to GATT server...","alert.output.microBitServiceInform":"Connecting to Micro:bit services...","alert.output.connectingToComponents":"Establishing connections to separate components...","alert.output.nowConnectedInform":"Micro:bit is connected","alert.isRecording":"You are currently recording!","alert.isTesting":"You are currently recording!","alert.isTraining":"You are currently training a model!","alert.isNotConnected":"Your Micro:bit should be connected!","alert.deleteGestureConfirm":"Are you sure you want to delete the class ","alert.beginModelSetup":"Initiating model setup","alert.trainingModel":"Training the model","alert.twoGestures":"You need at least two classes","alert.oneDataRepresentation":"You need at least one data representation","alert.recordingsPerGesture":"You need at least three examples per class","content.index.heading":"Do It Yourself Machine Learning","content.index.howBody":"Welcome to the ultra:bit data trainer. Experiment and play with machine larning and build your first machine learning models - start here!","content.index.ledDescription":"25 LED lights","content.index.recordButtonDescription":'"Record"-button',"content.index.videoHeading":"Intro Video","content.index.videoBody":"You can find an intro video to the tool on DR's wepage:","content.index.setupBody2":"The website utilizes the bluetooth, accelerometer, LEDs, buttons, and sounds from the Micro:bit. Subsequetnly, you can connect the micro:bit to your computer via bluetooth without using the USB cable.","content.index.contactButton":"Contact us","content.index.contactBody":"If you find errors and omissions on this platform, please feel free to write us. If you have any other requests, ideas or general interests, please feel free to contact us. The creators of this platform can be contacted at:","content.index.contactMail":"[email protected]","content.index.ultrabit":"ultra:bit","content.index.acknowledgement":"Developed by Center for Computational Thinking and Design, Aarhus University","content.data.classPlaceholderNewClass":"Press here to change name","content.data.select":"Select","content.data.selected":"Selected","content.data.record":"Record","content.data.addD
10ata":"Add Data","content.data.classHelpHeader":"Class","content.data.classHelpBody":"A class describes a type of gesture. We can record examples of a certain type of gesture and put the examples in the same class. The trainer can find patterns in the examples/data and use these patterns to 'train' a model that can recognize this class of gestures. Multiple examples will typically result in a better model, and consider how many different ways a gesture can be performed.","content.data.classification":"Classes","content.data.data":"Data","content.data.choice":"Choice","content.data.choice.header":"Choice of class","content.data.choice.body":'Here, you choose which class you want to add data to. After having selected a class, you can either press the "Record" button below or press one of the buttons on your micro:bit to record a data segment. See the picture below.',"content.data.dataDescription":"Here you can see the gathered data. ","content.data.addDataNoConnection":"You cannot add data without being connected with a micro:bit","content.data.noData":"You do not have any gestures to train on. Add the gestures you wish the micro:bit should learn to recognise.","content.trainer.failure.header":"Training Failed","content.trainer.failure.body":"The training did not result in a useable model. The reason for this is most likely the data used for training. If the data for different classes are too similar, this can result in issues in the training process.","content.trainer.failure.todo":"Return to the data page and change your data.","content.model.trainModelFirstHeading":"Train the model first!","content.model.trainModelFirstBody":"Go to the 'Trainer' page","content.model.classification.helpHeading":"Probabil-ometer","content.model.classification.helpBody":"For each prediction you make, the model will produce a percentage that describes how confident the model is in its prediction. This meter goes from 0% to 100%. With the slider next to it, you can determine the limit of how certain the model should be in its preduction to make an output (e.g. play a sound)","content.model.output.affect":"Affect","content.model.output.optionPin":"Pin","content.model.output.optionSound":"Sound","content.model.output.soundOptionCongratulations":"Congratulations","content.model.output.soundOptionHighPitchBeep":"High pitch beep","content.model.output.soundOptionLowPitchBeep":"Low pitch beep","content.model.output.soundOptionLoser":"Loser","content.model.output.soundOptionMistake":"Mistake","content.model.output.soundOptionHugeMistake":"Huge Mistake","content.model.output.prediction.iconTitle":"Prediction","content.model.output.prediction.descriptionTitle":"Prediction","content.model.output.prediction.descriptionBody":"Here you can see the model's prediction of the current gesture. In the meter, you can see how confident the model is in the prediction.","content.model.output.ledOutput.descriptionTitle":"LED output","content.model.output.ledOutput.descriptionBody":"Here you can choose how the LEDs on your output micro:bit behaves when your model makes predictions. Try draw some patterns and see how they show on the output micro:bit when you move the input micro:bit.","content.model.output.sound.iconTitle":"Sound","content.model.output.sound.descriptionTitle":"Playback of sound","content.model.output.sound.descriptionBody":"Here you can choose which sound you output micro:bit plays when the model makes a prediction. Be aware that the sound plays from your computer if you have a micro:bit version 1.","content.model.output.popup.header":"Connect output micro:bit","content.model.output.popup.body":"If you have not connected an output micro:bit, you cannot see the results of the changed made on this page. Use the connect button below","footer.connectButtonNotConnected":"Connect your micro:bit","footer.disconnectButton":"Disconnect","footer.helpHeader":"Live graph","footer.helpContent":"Once you have connected a micro:bit you can watch the accelerometer data for all three axes on this graph in real time. Try moving your connected micro:bit to see what the data looks like to your computer!","footer.reconnecting":"Reconnecting. Please wait","menu.data.helpHeading":"Data","menu.data.helpBody":"In order to train a model to recognize different movements, we need good examples of 'good behavior' that we can show the Trainer. Here you can create classes (types of gestures) and record examples for each class. There must be at least 2 classes with 3 examples each before the trainer can train a model.","menu.data.examples":"examples","menu.trainer.helpHeading":"Trainer","menu.trainer.helpBody":"The Trainer looks at the examples in each of the classes and tries to 'learn' how the different classes can be recognized by searching for patterns in the data. Here you can train a model to recognize different gestures.","menu.trainer.notConnected1":"You have not connected a micro:bit.","menu.trainer.notConnected2":" Please do so via the button below","menu.trainer.notEnoughDataHeader1":`Not Enough Data 11Go to Data page`,"menu.trainer.notEnoughDataInfoBody":"You need at least 2 classes with 3 examples each to attempt to train a model.","menu.trainer.notEnoughDataInfo":"You have not collected enough data to train a model. You need at least 2 classes with 3 examples each. Please go to the Data page to collect more data","menu.trainer.trainModelButton":"Train model","menu.trainer.trainNewModelButton":"Train a new model","menu.trainer.TrainingFinished":"Training done","menu.trainer.TrainingFinished.body":"Go to the Model-page to examine how well your model works","menu.trainer.isTrainingModelButton":"Training model","menu.model.helpHeading":"Model","menu.model.helpBody":"The model can be used in an interactive system. Here we use the trained model to predict gestures. You can connect another micro:bit and make it respond to the predicted gestures.","menu.model.noModel":"No model","menu.model.connectOutputButton":"Connect output micro:bit","menu.model.disconnect":"Disconnect output micro:bit","popup.connectMB.main.bluetooth.subtitle":"Connect using Bluetooth","popup.connectMB.bluetooth.heading":"Connect using Bluetooth","popup.connectMB.bluetooth.cancelledConnection":"You cancelled the connection process. Try again, if you wish to proceed.","popup.connectMB.bluetooth.step0":"Connect your micro:bit to a battery","popup.connectMB.bluetooth.step1":"Draw the pattern as displayed on the micro:bit","popup.connectMB.bluetooth.step2":"Press the 'Connect' button below.","popup.connectMB.bluetooth.step3"
11:"Select your micro:bit and press 'Connect'.","popup.connectMB.bluetooth.connect":"Connect","popup.connectMB.bluetooth.connecting":"Connecting...","popup.disconnectedWarning.input":"Your input micro:bit lost connection, do want to try again?","popup.disconnectedWarning.output":"Your output micro:bit lost connection, do want to try again?","popup.disconnectedWarning.reconnectButton.input":"Reconnect input","popup.disconnectedWarning.reconnectButton.output":"Reconnect output","connectMB.main.usbHeader":"DOWNLOAD PROGRAM TO MICRO:BIT","connectMB.main.btHeader":"CONNECT YOUR MICRO:BIT USING BLUETOOTH","connectMB.main.usbBody":"If you have not previously downloaded the program","connectMB.main.btBody":"If you have already downloaded the program","connectMB.main.connectButton":"Connect","connectMB.main.installButton":"Download","connectMB.output.header":"A micro:bit is already connected","connectMB.usb.header":"DOWNLOAD PROGRAM TO MICRO:BIT","connectMB.usb.body1":"Connect your micro:bit using a USB-cable and click 'Next'","connectMB.usb.body2":"Click 'Find USB unit' and select 'BBC micro:bit CMSIS-DAP' or 'DAPLink CMSIS-DAP' from the popup that appears","connectMB.usb.button1":"Next","connectMB.usb.button2":"Find USB unit","connectMB.usb.pleaseWait":"Please wait. Downloading program to the micro:bit","connectMB.usb.done.body1":"Done - the program has been downloaded.","connectMB.usb.done.body2":"You can now connect through bluetooth.","connectMB.usb.done.body3":"If you have a battery for the micro:bit, you can now remove the usb-cable and use the battery instead.","connectMB.usb.done.body4":"If you do not have a battery for the micro:bit, you can simply keep powering it through the usb cable.","connectMB.usb.manual.header":"Transfer file to your micro:bit","connectMB.usb.manual.manualDownload":"If the file did not automatically download press","connectMB.usb.manual.manualDownloadLink":"here","connectMB.usb.manual.done":"Done: Connect using bluetooth","connectMB.outputMB.same":"Use the same micro:bit","connectMB.outputMB.different":"Connect another micro:bit","connectMB.outputMB.sameButton":"Same","connectMB.outputMB.otherButton":"Other","cookies.banner.title":"Cookie policy","cookies.banner.subtitle":"Performance & analytics","cookies.banner.text.pleaseHelp":"Please help us make it better by keeping the cookies enabled.","cookies.banner.text.description":"Here at ML-Machine we use cookies to collect information on the usage and performance of the website. Without these cookies, we will not be able to collect vital information on the performance of the site.","cookies.banner.text.readMore":"You can read more about it ","cookies.banner.text.readMore.here":"here","cookies.banner.buttons.reject":"Reject","cookies.banner.buttons.accept":"Accept","cookies.overlay.title":"Cookie policy","cookies.overlay.question.whatAreCookies":"What are cookies?","cookies.overlay.question.ourReasoning":"What do we use cookies for?","cookies.overlay.question.storageDuration":"For how long are cookies stored?","cookies.overlay.question.deleting":"How do i delete cookies?","cookies.overlay.question.consentChange":"How do i change my consent?","cookies.overlay.answer.whatAreCookies":"Cookies are small data files stored on the device you are using to browse websites. They are not programs, that contain harmful malware or viruses.","cookies.overlay.answer.ourReasoning":"We use cookies to collect information on the usage and performance of the website. Without these cookies, we will not be able to collect vital information on the performance of the site.","cookies.overlay.answer.storageDuration":"It varies from site to site and the usage of the cookie. Some may be stored for only the current session, while others may be stored for days. Our cookies are stored for one year.","cookies.overlay.answer.deleting":"It varies from browser to browser. However here are some of the manuals for some of the most commonly used browsers.","cookies.overlay.answer.consentChange":"Currently, you have not rejected nor agreed to our cookie policy. But once you do, you will be able to delete cookies to change your consent at any time.","cookies.overlay.table.title":"The cookies we use","cookies.overlay.table.header.description":"Description","cookies.overlay.table.row.ai_user.description":"Used by Microsoft Application Insights software to collect statistical usage and telemetry information. The cookie stores a unique identifier to recognise users on returning visits over time.","cookies.overlay.table.row.ai_session.description":"Preserves users states across page requests.","cookies.overlay.table.row.cookie_consent.description":"Stores the terms to which you have given consent to in regards to our cookie policy.","popup.compatibility.bluetooth.header":"Bluetooth incompatible browser!","popup.compatibility.bluetooth.explain":"The browser you are currently using does not support bluetooth.","popup.compatibility.bluetooth.advice":"Please update the browser or use another one from our supported browsers list below.","popup.connectMB.USBCompatibility.transferStep.step1":"Open the location to which the firmware was downloaded. Most commonly found in your download folder.","popup.connectMB.USBCompatibility.transferStep.step2":"Drag the file onto the micro:bit on your computer's file explorer.","popup.connectMB.USBCompatibility.transferStep.step3"
11:"Once the file has finished transferring, the micro:bit can be connected using Bluetooth.","compatibility.platform.notSupported":"The tool is not supported on mobile.","compatibility.platform.notSupported.joinDesktop":"Join us on desktop."}},VK=1;function f4(c,o){if(o==null)throw new Error("Do not use 'null' or 'undefined' values as initial value. Later checking for changes, will result in stored changes being deleted");const a=localStorage.getItem(c);let i;try{i=a!=null?JSON.parse(a):null}catch(h){console.warn(h),i=null}o=nfe(i,o)?i.value:o;const s=Dc(o);return s.subscribe(h=>localStorage.setItem(c,JSON.stringify({version:VK,value:h}))),s}function nfe(c,o){if(c==null||typeof c!="object"||!("value"in c)||!("version"in c))return!1;const a=c;return a.version!==VK?!1:C6(o,a.value)}function C6(c,o){if(c===o||c===null)return!0;const a=typeof c;if(a!==typeof o)return!1;if(["boolean","number","string","null"].includes(a))return!0;if(a==="undefined")throw new Error('You should never use "undefined" as values for persistant storage');if(a!=="object")throw new Error("Unrecognised type: "+a);const n=Array.isArray(c),s=Array.isArray(o);if(n!==s)return!1;if(n){const O=c,A=o;if(O.length===0||A.length===0)return!0;for(const S of A)if(!C6(O[0],S))return!1;return!0}const h=c,v=o,g=Object.entries(h);for(const[O,A]of g)if(!(O in v)&&A!=null)return!1;for(const[O,A]of g){const S=v[O];if(!C6(A,S))return!1}return!0}const rfe=ofe(),tA=f4("lang",rfe),gN=Object.keys(WK);function ife(c,o,a){let i=WK[c][o];return i==null?(console.warn(`no translation found for ${c}.${o}`),o):(Object.keys(a).map(n=>{const s=new RegExp(`{{${n}}}`,"g");i=i.replace(s,a[n])}),i)}const La=Yle(tA,c=>(o,a={})=>ife(c,o,a));function ofe(){const o=new URLSearchParams(window.location.search).get("lang");return o==="da"||o==="en"?o:"da"}var S6={},afe={get exports(){return S6},set exports(c){S6=c}};(function(c,o){(function(a,i){c.exports=i()})(window,function(){return function(a){var i={};function n(s){if(i[s])return i[s].exports;var h=i[s]={i:s,l:!1,exports:{}};return a[s].call(h.exports,h,h.exports,n),h.l=!0,h.exports}return n.m=a,n.c=i,n.d=function(s,h,v){n.o(s,h)||Object.defineProperty(s,h,{configurable:!1,enumerable:!0,get:v})},n.r=function(s){Object.defineProperty(s,"__esModule",{value:!0})},n.n=function(s){var h=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(h,"a",h),h},n.o=function(s,h){return Object.prototype.hasOwnProperty.call(s,h)},n.p="/",n(n.s=581)}([function(a,i,n){n.r(i),function(s,h,v,g){n.d(i,"AdadeltaOptimizer",function(){return nt}),n.d(i,"AdagradOptimizer",function(){return lt}),n.d(i,"AdamOptimizer",function(){return Nt}),n.d(i,"AdamaxOptimizer",function(){return Rt}),n.d(i,"Add",function(){return sd}),n.d(i,"AddN",function(){return Ap}),n.d(i,"BroadcastTo",function(){return ql}),n.d(i,"DataStorage",function(){return qt}),n.d(i,"Div",function(){return ya}),n.d(i,"ENV",function(){return V}),n.d(i,"Environment",function(){return P}),n.d(i,"FromPixels",function(){return F0}),n.d(i,"FusedBatchNorm",function(){return Op}),n.d(i,"Identity",function(){return lh}),n.d(i,"KernelBackend",function(){return en}),n.d(i,"MaxPoolWithArgmax",function(){return fd}),n.d(i,"MomentumOptimizer",function(){return Kt}),n.d(i,"NonMaxSuppressionV5",function(){return _f}),n.d(i,"OneHot",function(){return Tp}),n.d(i,"Optimizer",function(){return rt}),n.d(i,"PadV2",function(){return Gl}),n.d(i,"RMSPropOptimizer",function(){return dn}),n.d(i,"Rank",function(){return _e}),n.d(i,"Reduction",function(){return Ds}),n.d(i,"SGDOptimizer",function(){return Pt}),n.d(i,"Square",function(){return Dp}),n.d(i,"SquaredDifference",function(){return ud}),n.d(i,"Tensor",function(){return Zt}),n.d(i,"TensorBuffer",function(){return co}),n.d(i,"Tile",function(){return ld}),n.d(i,"Transpose",function(){return cd}),n.d(i,"Variable",function(){return St}),n.d(i,"abs",function(){return _u}),n.d(i,"acos",function(){return Kl}),n.d(i,"acosh",function(){return xs}),n.d(i,"add",function(){return Pa}),n.d(i,"addN",function(){return Eh}),n.d(i,"addStrict",function(){return gd}),n.d(i,"all",function(){return ug}),n.d(i,"any",function(){return jf}),n.d(i,"argMax",function(){return wy}),n.d(i,"argMin",function(){return o0}),n.d(i,"asin",function(){return Yl}),n.d(i,"asinh",function(){return tl}),n.d(i,"atan",function(){return fh}),n.d(i,"atan2",function(){return gh}),n.d(i,"atanh",function(){return dh}),n.d(i,"avgPool",function(){return Gp}),n.d(i,"avgPool3d",function(){return rv}),n.d(i,"backend",function(){return I0}),n.d(i,"backend_util",function(){return si}
11),n.d(i,"basicLSTMCell",function(){return ky}),n.d(i,"batchNorm",function(){return kd}),n.d(i,"batchNorm2d",function(){return x1}),n.d(i,"batchNorm3d",function(){return Mf}),n.d(i,"batchNorm4d",function(){return Ah}),n.d(i,"batchNormalization",function(){return Ao}),n.d(i,"batchNormalization2d",function(){return b1}),n.d(i,"batchNormalization3d",function(){return Ed}),n.d(i,"batchNormalization4d",function(){return Up}),n.d(i,"batchToSpaceND",function(){return Bm}),n.d(i,"booleanMaskAsync",function(){return ly}),n.d(i,"broadcastTo",function(){return Cd}),n.d(i,"browser",function(){return fe}),n.d(i,"buffer",function(){return Li}),n.d(i,"cast",function(){return Pm}),n.d(i,"ceil",function(){return kf}),n.d(i,"clipByValue",function(){return zm}),n.d(i,"clone",function(){return Sd}),n.d(i,"complex",function(){return zo}),n.d(i,"concat",function(){return va}),n.d(i,"concat1d",function(){return Ep}),n.d(i,"concat2d",function(){return Rm}),n.d(i,"concat3d",function(){return od}),n.d(i,"concat4d",function(){return Cp}),n.d(i,"conv1d",function(){return hy}),n.d(i,"conv2d",function(){return Mh}),n.d(i,"conv2dTranspose",function(){return n0}),n.d(i,"conv3d",function(){return _1}),n.d(i,"conv3dTranspose",function(){return tv}),n.d(i,"cos",function(){return nl}),n.d(i,"cosh",function(){return R0}),n.d(i,"cumsum",function(){return jm}),n.d(i,"customGrad",function(){return H}),n.d(i,"deprecationWarn",function(){return ah}),n.d(i,"depthToSpace",function(){return Lg}),n.d(i,"depthwiseConv2d",function(){return ev}),n.d(i,"diag",function(){return Id}),n.d(i,"disableDeprecationWarnings",function(){return Bg}),n.d(i,"dispose",function(){return ca}),n.d(i,"disposeVariables",function(){return id}),n.d(i,"div",function(){return Da}),n.d(i,"divNoNan",function(){return qg}),n.d(i,"divStrict",function(){return fr}),n.d(i,"dot",function(){return nv}),n.d(i,"dropout",function(){return Mb}),n.d(i,"elu",function(){return Bh}),n.d(i,"enableDebugMode",function(){return Rg}),n.d(i,"enableProdMode",function(){return Nc}),n.d(i,"engine",function(){return Dm}),n.d(i,"env",function(){return L}),n.d(i,"equal",function(){return Zg}),n.d(i,"equalStrict",function(){return X0}),n.d(i,"erf",function(){return Um}),n.d(i,"exp",function(){return dd}),n.d(i,"expandDims",function(){return el}),n.d(i,"expm1",function(){return Ug}),n.d(i,"eye",function(){return tf}),n.d(i,"fft",function(){return of}),n.d(i,"fill",function(){return xu}),n.d(i,"findBackend",function(){return Nm}),n.d(i,"findBackendFactory",function(){return Pg}),n.d(i,"floor",function(){return hh}),n.d(i,"floorDiv",function(){return js}),n.d(i,"frame",function(){return d0}),n.d(i,"fused",function(){return Ln}),n.d(i,"gather",function(){return ag}),n.d(i,"gatherND",function(){return l0}),n.d(i,"gather_util",function(){return Fc}),n.d(i,"getBackend",function(){return yu}),n.d(i,"getGradient",function(){return K}),n.d(i,"getKernel",function(){return J}),n.d(i,"getKernelsForBackend",function(){return re}),n.d(i,"grad",function(){return vd}),n.d(i,"grads",function(){return bh}),n.d(i,"greater",function(){return J0}),n.d(i,"greaterEqual",function(){return ig}),n.d(i,"greaterEqualStrict",function(){return Q0}),n.d(i,"greaterStrict",function(){return e0}),n.d(i,"hammingWindow",function(){return jh}),n.d(i,"hannWindow",function(){return pg}),n.d(i,"ifft",function(){return zs}),n.d(i,"imag",function(){return Os}),n.d(i,"image",function(){return tt}),n.d(i,"inTopKAsync",function(){return uv}),n.d(i,"io",function(){return D}),n.d(i,"irfft",function(){return hg}),n.d(i,"isFinite",function(){return md}),n.d(i,"isInf",function(){return mh}),n.d(i,"isNaN",function(){return Vm}),n.d(i,"keep",function(){return xp}),n.d(i,"leakyRelu",function(){return lg}),n.d(i,"less",function(){return ay}),n.d(i,"lessEqual",function(){return Rf}),n.d(i,"lessEqualStrict",function(){return w1}),n.d(i,"lessStrict",function(){return sy}),n.d(i,"linalg",function(){return U}),n.d(i,"linspace",function(){return kp}),n.d(i,"localResponseNormalization",function(){return dg}),n.d(i,"log",function(){return Ef}),n.d(i,"log1p",function(){return Wm}),n.d(i,"logSigmoid",function(){return Np}),n.d(i,"logSoftmax",function(){return Qe}),n.d(i,"logSumExp",function(){return a0}),n.d(i,"logicalAnd",function(){return Wc}),n.d(i,"logicalNot",function(){return Wp}),n.d(i,"logicalOr",function(){return Oh}),n.d(i,"logicalXor",function(){return Ff}),n.d(i,"losses",function(){return Gr}),n.d(i,"matMul",function(){return Nl}),n.d(i,"math",function(){return Q}),n.d(i,"max",function(){return iv}),n.d(i,"maxPool",function(){return Il}),n.d(i,"maxPool3d",function(){return r0}),n.d(i,"maxPoolWithArgmax",function(){return yy}),n.d(i,"maximum",function(){return as}),n.d(i,"maximumStrict",function(){return ho}),n.d(i,"mean",function(){return nf}),n.d(i,"memory",function(){return yp}),n.d(i,"min",function(){return s0}),n.d(i,"minimum",function(){return Mc}),n.d(i,"minimumStrict",function(){return El}),n.d(i,"mod",function(){return qu}),n.d(i,"modStrict",function(){return Cl}),n.d(i,"moments",function(){return _y}),n.d(i,"movingAverage",function(){return rf}),n.d(i,"mul",function(){return Oa}),n.d(i,"mulStrict",function(){return rl}),n.d(i,"multiRNNCell",function(){return E1}),n.d(i,"multinomial",function(){return Gs}),n.d(i,"neg",function(){return os}),n.d(i,"nextFrame",function(){return On}),n.d(i,"norm",function(){return av}),n.d(i,"notEqual",function(){return og}),n.d(i,"notEqualStrict",function(){return uy}),n.d(i,"oneHot",function(){return Dl}),n.d(i,"ones",function(){return yc}),n.d(i,"onesLike",function(){return eu}),n.d(i,"op",function(){return Bt}),n.d(i,"outerProduct",function(){return gy}),n.d(i,"pad",function(){return Vc}),n.d(i,"pad1d",function(){return bc}),n.d(i,"pad2d",function(){return Vp}),n.d(i,"pad3d",function(){return Gg}),n.d(i,"pad4d",function(){return K0}),n.d(i,"pool",function(){return sg}),n.d(i,"pow",function(){return Gu}),n.d(i,"powStrict",function(){return Mo}),n.d(i,"prelu",function(){return Ys}),n.d(i,"print",function(){return za}),n.d(i,"prod",function(){return cg}),n.d(i,"profile",function(){return bp}),n.d(i,"rand",function(){return Y0}),n.d(i,"randomGamma",function(){return Xg}),n.d(i,"randomNormal",function(){return oy}),n.d(i,"randomUniform",function(){return Jg}),n.d(i,"range",function(){return kl}),n.d(i,"ready",function(){return Tm}),n.d(i,"real",function(){return qa}),n.d(i,"reciprocal",function(){return hd}),n.d(i,"registerBackend",function(){return jg}),n.d(i,"registerGradient",function(){return pe}),n.d(i,"registerKernel",function(){return ce}),n.d(i,"relu",function(){return u0}),n.d(i,"relu6",function(){return ov}),n.d(i,"removeBackend",function(){return _l}),n.d(i,"reshape",function(){return wu}),n.d(i,"reverse",function(){return Dd}),n.d(i,"reverse1d",function(){return k1}),n.d(i,"reverse2d",function(){return Hp}),n.d(i,"reverse3d",function(){return qp}),n.d(i,"reverse4d",function(){return Td}),n.d(i,"rfft",function(){return Yp}),n.d(i,"round",function(){return ku}),n.d(i,"rsqrt",function(){return pd}),n.d(i,"scalar",function(){return Or}),n.d(i,"scatterND",function(){return Ey}),n.d(i,"scatter_util",function(){return Mp}),n.d(i,"selu",function(){return fg}),n.d(i,"separableConv2d",function(){return Pf}),n.d(i,"serialization",function(){return Pe}),n.d(i,"setBackend",function(){return sh}),n.d(i,"setPlatform",function(){return M0}),n.d(i,"setdiff1dAsync",function(){return Qi}),n.d(i,"sigmoid",function(){return ph}),n.d(i,"sign",function(){return Ip}),n.d(i,"signal",function(){return sv}),n.d(i,"sin",function(){return $m}),n.d(i,"sinh",function(){return Hm}),n.d(i,"slice",function(){return Ks}),n.d(i,"slice1d",function(){return by}),n.d(i,"slice2d",function(){return Kp}),n.d(i,"slice3d",function(){return xy}),n.d(i,"slice4d",function(){return i0}),n.d(i,"slice_util",function(){return yh}),n.d(i,"softmax",function(){return Le}),n.d(i,"softplus",function(){return gn}),n.d(i,"spaceToBatchND",function(){return xf}),n.d(i,"sparseToDense",function(){return Cy}),n.d(i,"spectral",function(){return c0}),n.d(i,"split",function(){return to}),n.d(i,"sqrt",function(){return Hu}),n.d(i,"square",function(){return Ad}),n.d(i,"squaredDifference",function(){return Qg}),n.d(i,"squaredDifferenceStrict",function(){return tu}),n.d(i,"squeeze",function(){return Iu}),n.d(i,"stack",function(){return cc}),n.d(i,"step",function(){return Yn}),n.d(i,"stft",function(){return mg}),n.d(i,"stridedSlice",function(){return Ph}),n.d(i,"sub",function(){return ps}),n.d(i,"subStrict",function(){return nu}),n.d(i,"sum",function(){return Lf}),n.d(i,"sumOutType",function(){return rr}),n.d(i,"tan",function(){return Eu}
vendor: 39,207 bytes, lines 11-30
11),n.d(i,"tanh",function(){return Oo}),n.d(i,"tensor",function(){return Qo}),n.d(i,"tensor1d",function(){return Vu}),n.d(i,"tensor2d",function(){return uc}),n.d(i,"tensor3d",function(){return bf}),n.d(i,"tensor4d",function(){return $u}),n.d(i,"tensor5d",function(){return _p}),n.d(i,"tensor6d",function(){return Mm}),n.d(i,"tensor_util",function(){return Wt}),n.d(i,"test_util",function(){return Ih}),n.d(i,"tidy",function(){return eo}),n.d(i,"tile",function(){return Th}),n.d(i,"time",function(){return N0}),n.d(i,"topk",function(){return C1}),n.d(i,"train",function(){return pn}),n.d(i,"transpose",function(){return wt}),n.d(i,"truncatedNormal",function(){return $p}),n.d(i,"unregisterGradient",function(){return Ce}),n.d(i,"unregisterKernel",function(){return ke}),n.d(i,"unsortedSegmentSum",function(){return t0}),n.d(i,"unstack",function(){return Sp}),n.d(i,"util",function(){return fi}),n.d(i,"valueAndGrad",function(){return ae}),n.d(i,"valueAndGrads",function(){return ne}),n.d(i,"variable",function(){return Fm}),n.d(i,"variableGrads",function(){return B}),n.d(i,"version_core",function(){return je}),n.d(i,"webgl",function(){return Ge}),n.d(i,"where",function(){return ef}),n.d(i,"whereAsync",function(){return Dh}),n.d(i,"zeros",function(){return go}),n.d(i,"zerosLike",function(){return Ei});/** 12 * @license 13 * Copyright 2020 Google LLC. All Rights Reserved. 14 * Licensed under the Apache License, Version 2.0 (the "License"); 15 * you may not use this file except in compliance with the License. 16 * You may obtain a copy of the License at 17 * 18 * http://www.apache.org/licenses/LICENSE-2.0 19 * 20 * Unless required by applicable law or agreed to in writing, software 21 * distributed under the License is distributed on an "AS IS" BASIS, 22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 * See the License for the specific language governing permissions and 24 * limitations under the License. 25 * ============================================================================= 26 */var O=function(_,m){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,y){f.__proto__=y}||function(f,y){for(var E in y)y.hasOwnProperty(E)&&(f[E]=y[E])})(_,m)};function A(_,m){function f(){this.constructor=_}O(_,m),_.prototype=m===null?Object.create(m):(f.prototype=m.prototype,new f)}function S(_,m,f,y){return new(f||(f=Promise))(function(E,z){function Y(de){try{le(y.next(de))}catch(we){z(we)}}function Z(de){try{le(y.throw(de))}catch(we){z(we)}}function le(de){de.done?E(de.value):new f(function(we){we(de.value)}).then(Y,Z)}le((y=y.apply(_,m||[])).next())})}function M(_,m){var f,y,E,z,Y={label:0,sent:function(){if(1&E[0])throw E[1];return E[1]},trys:[],ops:[]};return z={next:Z(0),throw:Z(1),return:Z(2)},typeof Symbol=="function"&&(z[Symbol.iterator]=function(){return this}),z;function Z(le){return function(de){return function(we){if(f)throw new TypeError("Generator is already executing.");for(;Y;)try{if(f=1,y&&(E=2&we[0]?y.return:we[0]?y.throw||((E=y.return)&&E.call(y),0):y.next)&&!(E=E.call(y,we[1])).done)return E;switch(y=0,E&&(we=[2&we[0],E.value]),we[0]){case 0:case 1:E=we;break;case 4:return Y.label++,{value:we[1],done:!1};case 5:Y.label++,y=we[1],we=[0];continue;case 7:we=Y.ops.pop(),Y.trys.pop();continue;default:if(!(E=(E=Y.trys).length>0&&E[E.length-1])&&(we[0]===6||we[0]===2)){Y=0;continue}if(we[0]===3&&(!E||we[1]>E[0]&&we[1]<E[3])){Y.label=we[1];break}if(we[0]===6&&Y.label<E[1]){Y.label=E[1],E=we;break}if(E&&Y.label<E[2]){Y.label=E[2],Y.ops.push(we);break}E[2]&&Y.ops.pop(),Y.trys.pop();continue}we=m.call(_,Y)}catch(De){we=[6,De],y=0}finally{f=E=0}if(5&we[0])throw we[1];return{value:we[0]?we[1]:void 0,done:!0}}([le,de])}}}var P=function(){function _(m){this.global=m,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return _.prototype.setPlatform=function(m,f){this.platform!=null&&console.warn("Platform "+this.platformName+" has already been set. Overwriting the platform with "+f+"."),this.platformName=m,this.platform=f},_.prototype.registerFlag=function(m,f,y){if(this.flagRegistry[m]={evaluationFn:f,setHook:y},this.urlFlags[m]!=null){var E=this.urlFlags[m];console.warn("Setting feature override from URL "+m+": "+E+"."),this.set(m,E)}},_.prototype.get=function(m){return m in this.flags?this.flags[m]:(this.flags[m]=this.evaluateFlag(m),this.flags[m])},_.prototype.getNumber=function(m){return this.get(m)},_.prototype.getBool=function(m){return this.get(m)},_.prototype.getFlags=function(){return this.flags},Object.defineProperty(_.prototype,"features",{get:function(){return this.flags},enumerable:!0,configurable:!0}),_.prototype.set=function(m,f){if(this.flagRegistry[m]==null)throw new Error("Cannot set flag "+m+" as it has not been registered.");this.flags[m]=f,this.flagRegistry[m].setHook!=null&&this.flagRegistry[m].setHook(f)},_.prototype.evaluateFlag=function(m){if(this.flagRegistry[m]==null)throw new Error("Cannot evaluate flag '"+m+"': no evaluation function found.");return this.flagRegistry[m].evaluationFn()},_.prototype.setFlags=function(m){this.flags=Object.assign({},m)},_.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},_.prototype.populateURLFlags=function(){var m=this;if(this.global!==void 0&&this.global.location!==void 0&&this.global.location.search!==void 0){var f,y,E=(f=this.global.location.search,y={},f.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(z){for(var Y=[],Z=1;Z<arguments.length;Z++)Y[Z-1]=arguments[Z];return function(le,de,we){le[decodeURIComponent(de)]=decodeURIComponent(we||"")}(y,Y[0],Y[1]),Y.join("=")}),y);"tfjsflags"in E&&E.tfjsflags.split(",").forEach(function(z){var Y=z.split(":"),Z=Y[0],le=Y[1];m.urlFlags[Z]=function(de,we){if((we=we.toLowerCase())==="true"||we==="false")return we==="true";if(""+ +we===we)return+we;throw new Error("Could not parse value flag value "+we+" for flag "+de+".")}(Z,le)})}},_}();function L(){return V}var V=null,N=new Map,ee=new Map;function J(_,m){var f=be(_,m);return N.get(f)}function K(_){return ee.get(_)}function re(_){for(var m=N.entries(),f=[];;){var y=m.next(),E=y.done,z=y.value;if(E)break;var Y=z[0],Z=z[1];Y.split("_")[0]===_&&f.push(Z)}return f}function ce(_){var m=_.kernelName,f=_.backendName,y=be(m,f);if(N.has(y))throw new Error("The kernel '"+m+"' for backend '"+f+"' is already registered");N.set(y,_)}function pe(_){var m=_.kernelName;ee.has(m)&&console.warn("Overriding the gradient for '"+m+"'"),ee.set(m,_)}function ke(_,m){var f=be(_,m);if(!N.has(f))throw new Error("The kernel '"+_+"' for backend '"+m+"' is not registered");N.delete(f)}function Ce(_){if(!ee.has(_))throw new Error("The gradient '"+_+"' for backend is not registered");ee.delete(_)}function be(_,m){return m+"_"+_}function $e(_){for(var m=_.length,f=0,y=0;m>0;)y=Math.random()*m|0,f=_[--m],_[m]=_[y],_[y]=f}function ht(_,m,f){return Math.max(_,Math.min(m,f))}function Dt(_){return _%2==0?_:_+1}function Ut(_){for(var m=0,f=0;f<_.length;f++)m+=_[f];return m}function Ee(_,m){if(!_)throw new Error(typeof m=="string"?m:m())}function Ot(_,m,f){f===void 0&&(f=""),Ee(Tt(_,m),function(){return f+" Shapes "+_+" and "+m+" must match"})}function zt(_){Ee(_!=null,function(){return"The input to the tensor constructor must be a non-null value."})}function Mt(_,m,f){if(m===void 0&&(m=[]),f===void 0&&(f=!1),m==null&&(m=[]),Array.isArray(_)||dt(_)&&!f)for(var y=0;y<_.length;++y)Mt(_[y],m,f);else m.push(_);return m}function Ke(_){if(_.length===0)return 1;for(var m=_[0],f=1;f<_.length;f++)m*=_[f];return m}function Tt(_,m){if(_===m)return!0;if(_==null||m==null||_.length!==m.length)return!1;for(var f=0;f<_.length;f++)if(_[f]!==m[f])return!1;return!0}function vt(_){return _%1==0}function yt(_){if(Math.tanh!=null)return Math.tanh(_);if(_===1/0)return 1;if(_===-1/0)return-1;var m=Math.exp(2*_);return(m-1)/(m+1)}function bt(_){var m=Math.ceil(Math.sqrt(_));return[m,Math.ceil(_/m)]}function Ht(_,m){return m<=_.length?_:_+" ".repeat(m-_.length)}function _t(_,m,f){return m===void 0&&(m=function(y){return 0}),new Promise(function(y,E){var z=0,Y=function(){if(_())y();else{var Z=m(++z);f!=null&&z>=f?E():setTimeout(Y,Z)}};Y()})}function Ze(_,m){for(var f=1,y=-1,E=0;E<_.length;++E)if(_[E]>=0)f*=_[E];else if(_[E]===-1){if(y!==-1)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+y+" and dim "+E);y=E}else if(_[E]<0)throw Error("Shapes can not be < 0. Found "+_[E]+" at dim "+E);if(y===-1){if(m>0&&m!==f)throw Error("Size("+m+") must match the product of shape "+_);return _}if(f===0)throw Error("Cannot infer the missing size in ["+_+"] when there are 0 elements");if(m%f!=0)throw Error("The implicit shape can't be a fractional number. Got "+m+" / "+f);var z=_.slice();return z[y]=m/f,z}function Vt(_,m){var f=m.length;return Ee((_=_==null?m.map(function(y,E){return E}):[].concat(_)).every(function(y){return y>=-f&&y<f}),function(){return"All values in axis param must be in range [-"+f+", "+f+") but got axis "+_}),Ee(_.every(function(y){return vt(y)}),function(){return"All values in axis param must be integers but got axis "+_}),_.map(function(y){return y<0?f+y:y})}function sn(_,m){for(var f=[],y=[],E=m!=null&&Array.isArray(m)&&m.length===0,z=m==null||E?null:Vt(m,_).sort(),Y=0,Z=0;Z<_.length;++Z){if(z!=null){if(z[Y]===Z&&_[Z]!==1)throw new Error("Can't squeeze axis "+Z+" since its dim '"+_[Z]+"' is not 1");(z[Y]==null||z[Y]>Z)&&_[Z]===1&&(f.push(_[Z]),y.push(Z)),z[Y]<=Z&&Y++}_[Z]!==1&&(f.push(_[Z]),y.push(Z))}return{newShape:f,keptDims:y}}function yn(_,m){var f=null;if(_==null||_==="float32")f=new Float32Array(m);else if(_==="int32")f=new Int32Array(m);else{if(_!=="bool")throw new Error("Unknown data type "+_);f=new Uint8Array(m)}return f}function Yt(_,m){var f=null;if(_==null||_==="float32")f=new Float32Array(m);else if(_==="int32")f=new Int32Array(m);else if(_==="bool")f=new Uint8Array(m);else{if(_!=="string")throw new Error("Unknown data type "+_);f=new Array(m)}return f}function We(_,m){for(var f=0;f<_.length;f++){var y=_[f];if(isNaN(y)||!isFinite(y))throw Error("A tensor of type "+m+" being uploaded contains "+y+".")}}function Ye(_){return _==="bool"||_==="complex64"||_==="float32"||_==="int32"||_==="string"}function He(_,m){return!(m==="complex64"||m==="float32"&&_!=="complex64"||m==="int32"&&_!=="float32"&&_!=="complex64"||m==="bool"&&_==="bool")}function dt(_){return _ instanceof Float32Array||_ instanceof Int32Array||_ instanceof Uint8Array}function It(_){if(_==="float32"||_==="int32")return 4;if(_==="complex64")return 8;if(_==="bool")return 1;throw new Error("Unknown dtype "+_)}function ct(_){if(_==null)return 0;var m=0;return _.forEach(function(f){return m+=f.length}),m}function on(_){return typeof _=="string"||_ instanceof String}function Xt(_){return typeof _=="boolean"}function En(_){return typeof _=="number"}function xe(_){return Array.isArray(_)?xe(_[0]):_ instanceof Float32Array?"float32":_ instanceof Int32Array||_ instanceof Uint8Array?"int32":En(_)?"float32":on(_)?"string":Xt(_)?"bool":"float32"}function jn(_){return!!(_&&_.constructor&&_.call&&_.apply)}function nr(_,m){for(var f=m;f<_;++f)if(_%f==0)return f;return _}function ar(_){var m=_.length;if(m<2)return[];var f=new Array(m-1);f[m-2]=_[m-1];for(var y=m-3;y>=0;--y)f[y]=f[y+1]*_[y+1];return f}function cr(_,m,f){if(m==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(_)&&(_=Mt(_)),f&&We(_,m),function(z,Y){return z instanceof Float32Array&&Y==="float32"||z instanceof Int32Array&&Y==="int32"||z instanceof Uint8Array&&Y==="bool"}(_,m))return _;if(m==null||m==="float32"||m==="complex64")return new Float32Array(_);if(m==="int32")return new Int32Array(_);if(m==="bool"){for(var y=new Uint8Array(_.length),E=0;E<y.length;++E)Math.round(_[E])!==0&&(y[E]=1);return y}throw new Error("Unknown data type "+m)}function Er(_,m){if(_.length===0)return m[0];var f=_.reduce(function(y,E){return y*E});if(f===0)return[];if(f!==m.length)throw new Error("["+_+"] does not match the input size.");return function y(E,z,Y){var Z=new Array;if(z.length===1)for(var le=z[0],de=0;de<le;de++)Z[de]=Y[E+de];else{le=z[0];var we=z.slice(1),De=we.reduce(function(Ne,Fe){return Ne*Fe});for(de=0;de<le;de++)Z[de]=y(E+de*De,we,Y)}return Z}(0,_,m)}function hn(_,m){for(var f=rn(_,m),y=0;y<f.length;y++)f[y]=1;return f}function rn(_,m){if(m==null||m==="float32"||m==="complex64")return new Float32Array(_);if(m==="int32")return new Int32Array(_);if(m==="bool")return new Uint8Array(_);throw new Error("Unknown data type "+m)}function fn(){return L().platform.now()}function Xn(_){_.forEach(function(m){Ee(Number.isInteger(m)&&m>=0,function(){return"Tensor must have a shape comprised of positive integers but got shape ["+_+"]."})})}function Fn(_,m){return m===void 0&&(m="utf-8"),m=m||"utf-8",L().platform.encode(_,m)}function Ar(_,m){return m===void 0&&(m="utf-8"),m=m||"utf-8",L().platform.decode(_,m)}function Dr(_,m,f){if(m===0)return 0;if(m===1)return _[0];for(var y=_[_.length-1],E=0;E<_.length-1;++E)y+=f[E]*_[E];return y}function xr(_,m,f){if(m===0)return[];if(m===1)return[_];for(var y=new Array(m),E=0;E<y.length-1;++E)y[E]=Math.floor(_/f[E]),_-=y[E]*f[E];return y[y.length-1]=_,y}var fi=Object.freeze({shuffle:$e,clamp:ht,nearestLargerEven:Dt,sum:Ut,randUniform:function(_,m){var f=Math.random();return m*f+(1-f)*_},distSquared:function(_,m){for(var f=0,y=0;y<_.length;y++){var E=Number(_[y])-Number(m[y]);f+=E*E}return f},assert:Ee,assertShapesMatch:Ot,assertNonNull:zt,flatten:Mt,sizeFromShape:Ke,isScalarShape:function(_){return _.length===0},arraysEqual:Tt,isInt:vt,tanh:yt,sizeToSquarishShape:bt,createShuffledIndices:function(_){for(var m=new Uint32Array(_),f=0;f<_;++f)m[f]=f;return $e(m),m},rightPad:Ht,repeatedTry:_t,inferFromImplicitShape:Ze,parseAxisParam:Vt,squeezeShape:sn,getTypedArrayFromDType:yn,getArrayFromDType:Yt,checkConversionForErrors:We,isValidDtype:Ye,hasEncodingLoss:He,isTypedArray:dt,bytesPerElement:It,bytesFromStringArray:ct,isString:on,isBoolean:Xt,isNumber:En,inferDtype:xe,isFunction:jn,nearestDivisor:nr,computeStrides:ar,toTypedArray:cr,toNestedArray:Er,makeOnesTypedArray:hn,makeZerosTypedArray:rn,now:fn,assertNonNegativeIntegerDimensions:Xn,fetch:function(_,m){return L().platform.fetch(_,m)},encodeString:Fn,decodeString:Ar,locToIndex:Dr,indexToLoc:xr}),ci=function(){function _(m,f){this.backendTimer=m,this.logger=f,f==null&&(this.logger=new qr)}return _.prototype.profileKernel=function(m,f,y){var E,z=this,Y=this.backendTimer.time(function(){E=y()});return E.forEach(function(Z){Z.data().then(function(le){(function(de,we,De){if(we!=="float32")return!1;for(var Ne=0;Ne<de.length;Ne++){var Fe=de[Ne];if(isNaN(Fe)||!isFinite(Fe))return console.warn("Found "+Fe+" in the result of '"+De+"'"),!0}})(le,Z.dtype,m),Y.then(function(de){var we="";de.getExtraProfileInfo!=null&&(we=de.getExtraProfileInfo()),z.logger.logKernelProfile(m,Z,le,de.kernelMs,f,we)})})}),E},_}(),qr=function(){function _(){}return _.prototype.logKernelProfile=function(m,f,y,E,z,Y){var Z=typeof E=="number"?Ht(E+"ms",9):E.error,le=Ht(m,25),de=f.rank,we=f.size,De=Ht(f.shape.toString(),14),Ne="";for(var Fe in z){var Ve=z[Fe].shape||f.shape,Je=Ve.length;Ne+=Fe+": "+Je+"D "+(Je>0?Ve:"")+" "}console.log("%c"+le+" %c"+Z+" %c"+de+"D "+De+" %c"+we+" %c"+Ne+" %c"+Y,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},_}(),mi=20,Ir=3,ti=7;function ri(_,m,f){return Ht(Array.isArray(_)?parseFloat(_[0].toFixed(ti))+" + "+parseFloat(_[1].toFixed(ti))+"j":on(_)?"'"+_+"'":f==="bool"?yi(_):parseFloat(_.toFixed(ti)).toString(),m)}function yi(_){return _===0?"false":"true"}function na(_){for(var m=[],f=0;f<_.length;f+=2)m.push([_[f],_[f+1]]);return m}var co=function(){function _(m,f,y){var E=this;if(this.dtype=f,this.shape=m.slice(),this.size=Ke(m),y!=null){var z=y.length;Ee(z===this.size,function(){return"Length of values '"+z+"' does not match the size inferred by the shape '"+E.size+"'."})}if(f==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=y||Yt(f,this.size),this.strides=ar(m)}return _.prototype.set=function(m){for(var f=this,y=[],E=1;E<arguments.length;E++)y[E-1]=arguments[E];y.length===0&&(y=[0]),Ee(y.length===this.rank,function(){return"The number of provided coordinates ("+y.length+") must match the rank ("+f.rank+")"});var z=this.locToIndex(y);this.values[z]=m},_.prototype.get=function(){for(var m=[],f=0;f<arguments.length;f++)m[f]=arguments[f];m.length===0&&(m=[0]);for(var y=0,E=0,z=m;E<z.length;E++){var Y=z[E];if(Y<0||Y>=this.shape[y]){var Z="Requested out of range element at "+m+". Buffer shape="+this.shape;throw new Error(Z)}y++}for(var le=m[m.length-1],de=0;de<m.length-1;++de)le+=this.strides[de]*m[de];return this.values[le]},_.prototype.locToIndex=function(m){if(this.rank===0)return 0;if(this.rank===1)return m[0];for(var f=m[m.length-1],y=0;y<m.length-1;++y)f+=this.strides[y]*m[y];return f},_.prototype.indexToLoc=function(m){if(this.rank===0)return[];if(this.rank===1)return[m];for(var f=new Array(this.shape.length),y=0;y<f.length-1;++y)f[y]=Math.floor(m/this.strides[y]),m-=f[y]*this.strides[y];return f[f.length-1]=m,f},Object.defineProperty(_.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),_.prototype.toTensor=function(){return $i().makeTensor(this.values,this.shape,this.dtype)},_}(),$i=null,Ft=null,Qr=null,Zt=function(){function _(m,f,y,E){this.kept=!1,this.isDisposedInternal=!1,this.shape=m.slice(),this.dtype=f||"float32",this.size=Ke(m),this.strides=ar(m),this.dataId=y,this.id=E,this.rankType=this.rank<5?this.rank.toString():"higher"}return _.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},_.prototype.asScalar=function(){return this.throwIfDisposed(),Ee(this.size===1,function(){return"The array must have only 1 element."}),this.reshape([])},_.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},_.prototype.as2D=function(m,f){return this.throwIfDisposed(),this.reshape([m,f])},_.prototype.as3D=function(m,f,y){return this.throwIfDisposed(),this.reshape([m,f,y])},_.prototype.as4D=function(m,f,y,E){return this.throwIfDisposed(),this.reshape([m,f,y,E])},_.prototype.as5D=function(m,f,y,E,z){return this.throwIfDisposed(),this.reshape([m,f,y,E,z])},_.prototype.asType=function(m){return this.throwIfDisposed(),Ft.cast(this,m)},Object.defineProperty(_.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),_.prototype.buffer=function(){return S(this,void 0,void 0,function(){var m;return M(this,function(f){switch(f.label){case 0:return[4,this.data()];case 1:return m=f.sent(),[2,Ft.buffer(this.shape,this.dtype,m)]}})})},_.prototype.bufferSync=function(){return Ft.buffer(this.shape,this.dtype,this.dataSync())},_.prototype.array=function(){return S(this,void 0,void 0,function(){var m;return M(this,function(f){switch(f.label){case 0:return[4,this.data()];case 1:return m=f.sent(),[2,Er(this.shape,m)]}})})},_.prototype.arraySync=function(){return Er(this.shape,this.dataSync())},_.prototype.data=function(){return S(this,void 0,void 0,function(){var m,f;return M(this,function(y){switch(y.label){case 0:return this.throwIfDisposed(),m=$i().read(this.dataId),this.dtype!=="string"?[3,2]:[4,m];case 1:f=y.sent();try{return[2,f.map(function(E){return Ar(E)})]}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}y.label=2;case 2:return[2,m]}})})},_.prototype.dataSync=function(){this.throwIfDisposed();var m=$i().readSync(this.dataId);if(this.dtype==="string")try{return m.map(function(f){return Ar(f)})}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return m},_.prototype.bytes=function(){return S(this,void 0,void 0,function(){var m;return M(this,function(f){switch(f.label){case 0:return this.throwIfDisposed(),[4,$i().read(this.dataId)];case 1:return m=f.sent(),this.dtype==="string"?[2,m]:[2,new Uint8Array(m.buffer)]}})})},_.prototype.dispose=function(){this.isDisposed||($i().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(_.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),_.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},_.prototype.toFloat=function(){return this.asType("float32")},_.prototype.toInt=function(){return this.asType("int32")},_.prototype.toBool=function(){return this.asType("bool")},_.prototype.print=function(m){return m===void 0&&(m=!1),Ft.print(this,m)},_.prototype.reshape=function(m){return this.throwIfDisposed(),Ft.reshape(this,m)},_.prototype.reshapeAs=function(m){return this.throwIfDisposed(),this.reshape(m.shape)},_.prototype.expandDims=function(m){return m===void 0&&(m=0),Ft.expandDims(this,m)},_.prototype.cumsum=function(m,f,y){return m===void 0&&(m=0),f===void 0&&(f=!1),y===void 0&&(y=!1),Ft.cumsum(this,m,f,y)},_.prototype.squeeze=function(m){return this.throwIfDisposed(),Ft.squeeze(this,m)},_.prototype.clone=function(){return this.throwIfDisposed(),Ft.clone(this)},_.prototype.toString=function(m){return m===void 0&&(m=!1),function(f,y,E,z){var Y=ar(y),Z=function(De,Ne,Fe,Ve){var Je=Ke(Ne),Xe=Ve[Ve.length-1],ot=new Array(Xe).fill(0),xt=Ne.length,kt=Fe==="complex64"?na(De):De;if(xt>1)for(var At=0;At<Je/Xe;At++)for(var Lt=At*Xe,tn=0;tn<Xe;tn++)ot[tn]=Math.max(ot[tn],ri(kt[Lt+tn],0,Fe).length);return ot}(f,y,E,Y),le=y.length,de=function De(Ne,Fe,Ve,Je,Xe,ot){ot===void 0&&(ot=!0);var xt=Ve==="complex64"?2:1,kt=Fe[0],At=Fe.length;if(At===0)return Ve==="complex64"?[ri(na(Ne)[0],0,Ve)]:Ve==="bool"?[yi(Ne[0])]:[Ne[0].toString()];if(At===1){if(kt>mi){var Lt=Ir*xt,tn=Array.from(Ne.slice(0,Lt)),ln=Array.from(Ne.slice((kt-Ir)*xt,kt*xt));return Ve==="complex64"&&(tn=na(tn),ln=na(ln)),["["+tn.map(function(yr,mr){return ri(yr,Xe[mr],Ve)}).join(", ")+", ..., "+ln.map(function(yr,mr){return ri(yr,Xe[kt-Ir+mr],Ve)}).join(", ")+"]"]}return["["+(Ve==="complex64"?na(Ne):Array.from(Ne)).map(function(yr,mr){return ri(yr,Xe[mr],Ve)}).join(", ")+"]"]}var nn=Fe.slice(1),cn=Je.slice(1),Dn=Je[0]*xt,Rn=[];if(kt>mi){for(var Mn=0;Mn<Ir;Mn++){var tr=(ur=Mn*Dn)+Dn;Rn.push.apply(Rn,De(Ne.slice(ur,tr),nn,Ve,cn,Xe,!1))}for(Rn.push("..."),Mn=kt-Ir;Mn<kt;Mn++)tr=(ur=Mn*Dn)+Dn,Rn.push.apply(Rn,De(Ne.slice(ur,tr),nn,Ve,cn,Xe,Mn===kt-1))}else for(Mn=0;Mn<kt;Mn++){var ur;tr=(ur=Mn*Dn)+Dn,Rn.push.apply(Rn,De(Ne.slice(ur,tr),nn,Ve,cn,Xe,Mn===kt-1))}var vr=At===2?",":"";for(Rn[0]="["+Rn[0]+vr,Mn=1;Mn<Rn.length-1;Mn++)Rn[Mn]=" "+Rn[Mn]+vr;var kr=`, 27`;for(Mn=2;Mn<At;Mn++)kr+=` 28`;return Rn[Rn.length-1]=" "+Rn[Rn.length-1]+"]"+(ot?"":kr),Rn}(f,y,E,Y,Z),we=["Tensor"];return z&&(we.push(" dtype: "+E),we.push(" rank: "+le),we.push(" shape: ["+y+"]"),we.push(" values:")),we.push(de.map(function(De){return" "+De}).join(` 29`)),we.join(` 30`)}(this.dataSync(),this.shape,this.dtype,m)},_.prototype.gather=function(m,f){return f===void 0&&(f=0),this.throwIfDisposed(),Ft.gather(this,m,f)},_.prototype.matMul=function(m,f,y){return f===void 0&&(f=!1),y===void 0&&(y=!1),this.throwIfDisposed(),Ft.matMul(this,m,f,y)},_.prototype.dot=function(m){return this.throwIfDisposed(),Ft.dot(this,m)},_.prototype.norm=function(m,f,y){return m===void 0&&(m="euclidean"),f===void 0&&(f=null),y===void 0&&(y=!1),this.throwIfDisposed(),Ft.norm(this,m,f,y)},_.prototype.slice=function(m,f){return this.throwIfDisposed(),Ft.slice(this,m,f)},_.prototype.reverse=function(m){return this.throwIfDisposed(),Ft.reverse(this,m)},_.prototype.concat=function(m,f){return f===void 0&&(f=0),this.throwIfDisposed(),m instanceof _&&(m=[m]),Ft.concat([this].concat(m),f)},_.prototype.split=function(m,f){return f===void 0&&(f=0),this.throwIfDisposed(),Ft.split(this,m,f)},_.prototype.stack=function(m,f){return f===void 0&&(f=0),Ft.stack([this,m],f)},_.prototype.unstack=function(m){return m===void 0&&(m=0),Ft.unstack(this,m)},_.prototype.batchNormalization=function(m,f,y,E,z){return y===void 0&&(y=.001),Qr("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(m,f,z,E,y)},_.prototype.all=function(m,f){return m===void 0&&(m=null),f===void 0&&(f=!1),this.throwIfDisposed(),Ft.all(this,m,f)},_.prototype.any=function(m,f){return m===void 0&&(m=null),f===void 0&&(f=!1),this.throwIfDisposed(),Ft.any(this,m,f)},_.prototype.logSumExp=function(m,f){return m===void 0&&(m=null),f===void 0&&(f=!1),this.throwIfDisposed(),Ft.logSumExp(this,m,f)},_.prototype.sum=function(m,f){return m===void 0&&(m=null),f===void 0&&(f=!1),this.throwIfDisposed(),Ft.sum(this,m,f)},_.prototype.prod=function(m,f){return m===void 0&&(m=null),f===void 0&&(f=!1),this.throwIfDisposed(),Ft.prod(this,m,f)},_.prototype.mean=function(m,f){return m===void 0&&(m=null),f===void 0&&(f=!1),this.throwIfDisposed(),Ft.mean(this,m,f)},_.prototype.min=function(m,f){return m===void 0&&(m=null),f===void 0&&(f=!1),this.throwIfDisposed(),Ft.min(this,m,f)},_.prototype.max=function(m,f){return m===void 0&&(m=null),f===void 0&&(f=!1),this.throwIfDisposed(),Ft.max(this,m,f)},_.prototype.argMin=function(m){return m===void 0&&(m=null),this.throwIfDisposed(),Ft.argMin(this,m)},_.prototype.argMax=function(m){return m===void 0&&(m=null),this.throwIfDisposed(),Ft.argMax(this,m)},_.prototype.cast=function(m){return this.throwIfDisposed(),Ft.cast(this,m)},_.prototype.addStrict=function(m){return this.throwIfDisposed(),Ft.addStrict(this,m)},_.prototype.atan2=function(m){return this.throwIfDisposed(),Ft.atan2(this,m)},_.prototype.sub=function(m){return this.throwIfDisposed(),Ft.sub(this,m)},_.prototype.subStrict=function(m){return this.throwIfDisposed(),Ft.subStrict(this,m)},_.prototype.pow=function(m){return this.throwIfDisposed(),Ft.pow(this,m)},_.prototype.powStrict=function(m){return this.throwIfDisposed(),Ft.powStrict(this,m)},_.prototype.mul=function(m){return this.throwIfDisposed(),Ft.mul(this,m)},_.prototype.mulStrict=function(m){return this.throwIfDisposed(),Ft.mulStrict(this,m)},_.prototype.floorDiv=function(m){return this.throwIfDisposed(),Ft.floorDiv(this,m)},_.prototype.divStrict=function(m){return this.throwIfDisposed(),Ft.divStrict(this,m)},_.prototype.minimum=function(m){return this.throwIfDisposed(),Ft.minimum(this,m)},_.prototype.minimumStrict=function(m){return this.throwIfDisposed(),Ft.minimumStrict(this,m)},_.prototype.maximum=function(m){return this.throwIfDisposed(),Ft.maximum(this,m)},_.prototype.maximumStrict=function(m){return this.throwIfDisposed(),Ft.maximumStrict(this,m)},_.prototype.mod=function(m){return this.throwIfDisposed(),Ft.mod(this,m)},_.prototype.modStrict=function(m){return this.throwIfDisposed(),Ft.modStrict(this,m)},_.prototype.squaredDifferenceStrict=function(m){return this.throwIfDisposed(),Ft.squaredDifferenceStrict(this,m)},_.prototype.notEqual=function(m){return this.throwIfDisposed(),Ft.notEqual(this,m)},_.prototype.notEqualStrict=function(m){return this.throwIfDisposed(),Ft.notEqualStrict(this,m)},_.prototype.less=function(m){return this.throwIfDisposed(),Ft.less(this,m)},_.prototype.lessStrict=function(m){return this.throwIfDisposed(),Ft.lessStrict(this,m)},_.prototype.equal=function(m){return this.throwIfDisposed(),Ft.equal(this,m)},_.prototype.equalStrict=function(m){return this.throwIfDisposed(),Ft.equalStrict(this,m)},_.prototype.lessEqual=function(m){return this.throwIfDisposed(),Ft.lessEqual(this,m)},_.prototype.lessEqualStrict=function(m){return this.throwIfDisposed(),Ft.lessEqualStrict(this,m)},_.prototype.greater=function(m){return this.throwIfDisposed(),Ft.greater(this,m)},_.prototype.greaterStrict=function(m){return this.throwIfDisposed(),Ft.greaterStrict(this,m)},_.prototype.greaterEqual=function(m){return this.throwIfDisposed(),Ft.greaterEqual(this,m)},_.prototype.greaterEqualStrict=function(m){return this.throwIfDisposed(),Ft.greaterEqualStrict(this,m)},_.prototype.logicalAnd=function(m){return this.throwIfDisposed(),Ft.logicalAnd(this,m)},_.prototype.logicalOr=function(m){return this.throwIfDisposed(),Ft.logicalOr(this,m)},_.prototype.logicalNot=function(){return this.throwIfDisposed(),Ft.logicalNot(this)},_.prototype.logicalXor=function(m){return this.throwIfDisposed(),Ft.logicalXor(this,m)},_.prototype.where=function(m,f){return this.throwIfDisposed(),Ft.where(m,this,f)},_.prototype.neg=function(){return this.throwIfDisposed(),Ft.neg(this)},_.prototype.ceil=function(){return this.throwIfDisposed(),Ft.ceil(this)},_.prototype.floor=function(){return this.throwIfDisposed(),Ft.floor(this)},_.prototype.sign=function(){return this.throwIfDisposed(),Ft.sign(this)},_.prototype.isNaN=function(){return this.throwIfDisposed(),Ft.isNaN(this)},_.prototype.isInf=function(){return this.throwIfDisposed(),Ft.isInf(this)},_.prototype.isFinite=function(){return this.throwIfDisposed(),Ft.isFinite(this)},_.prototype.exp=function(){return this.throwIfDisposed(),Ft.exp(this)},_.prototype.expm1=function(){return this.throwIfDisposed(),Ft.expm1(this)},_.prototype.log=function(){return this.throwIfDisposed(),Ft.log(this)},_.prototype.log1p=function(){return this.throwIfDisposed(),Ft.log1p(this)},_.prototype.sqrt=function(){return this.throwIfDisposed(),Ft.sqrt(this)},_.prototype.rsqrt=function(){return this.throwIfDisposed(),Ft.rsqrt(this)},_.prototype.square=function(){return this.throwIfDisposed(),Ft.square(this)},_.prototype.reciprocal=function(){return this.throwIfDisposed(),Ft.reciprocal(this)},_.prototype.abs=function(){return this.throwIfDisposed(),Ft.abs(this)},_.prototype.clipByValue=function(m,f){return this.throwIfDisposed(),Ft.clipByValue(this,m,f)},_.prototype.relu=function(){return this.throwIfDisposed(),Ft.relu(this)},_.prototype.relu6=function(){return this.throwIfDisposed(),Ft.relu6(this)},_.prototype.elu=function(){return this.throwIfDisposed(),Ft.elu(this)},_.prototype.selu=function(){return this.throwIfDisposed(),Ft.selu(this)},_.prototype.leakyRelu=function(m){return m===void 0&&(m=.2),this.throwIfDisposed(),Ft.leakyRelu(this,m)},_.prototype.prelu=function(m){return this.throwIfDisposed(),Ft.prelu(this,m)},_.prototype.sigmoid=function(){return this.throwIfDisposed(),Ft.sigmoid(this)},_.prototype.logSigmoid=function(){return this.throwIfDisposed(),Ft.logSigmoid(this)},_.prototype.softplus=function(){return this.throwIfDisposed(),Ft.softplus(this)},_.prototype.zerosLike=function(){return this.throwIfDisposed(),Ft.zerosLike(this)},_.prototype.onesLike=function(){return this.throwIfDisposed(),Ft.onesLike(this)},_.prototype.sin=function(){return this.throwIfDisposed(),Ft.sin(this)},_.prototype.cos=function(){return this.throwIfDisposed(),Ft.cos(this)},_.prototype.tan=function(){return this.throwIfDisposed(),Ft.tan(this)},_.prototype.asin=function(){return this.throwIfDisposed(),Ft.asin(this)},_.prototype.acos=function(){return this.throwIfDisposed(),Ft.acos(this)},_.prototype.atan=function(){return this.throwIfDisposed(),Ft.atan(this)},_.prototype.sinh=function(){return this.throwIfDisposed(),Ft.sinh(this)},_.prototype.cosh=function(){return this.throwIfDisposed(),Ft.cosh(this)},_.prototype.tanh=function(){return this.throwIfDisposed(),Ft.tanh(this)},_.prototype.asinh=function(){return this.throwIfDisposed(),Ft.asinh(this)},_.prototype.acosh=function(){return this.throwIfDisposed(),Ft.acosh(this)},_.prototype.atanh=function(){return this.throwIfDisposed(),Ft.atanh(this)},_.prototype.erf=function(){return this.throwIfDisposed(),Ft.erf(this)},_.prototype.round=function(){return this.throwIfDisposed(),Ft.round(this)},_.prototype.step=function(m){return m===void 0&&(m=0),this.throwIfDisposed(),Ft.step(this,m)},_.prototype.softmax=function(m){return m===void 0&&(m=-1),this.throwIfDisposed(),Ft.softmax(this,m)},_.prototype.logSoftmax=function(m){return m===void 0&&(m=-1),this.throwIfDisposed(),Ft.logSoftmax(this,m)},_.prototype.resizeBilinear=function(m,f){return f===void 0&&(f=!1),this.throwIfDisposed(),Ft.image.resizeBilinear(this,m,f)},_.prototype.resizeNearestNeighbor=function(m,f){return f===void 0&&(f=!1),this.throwIfDisposed(),Ft.image.resizeNearestNeighbor(this,m,f)},_.prototype.conv1d=function(m,f,y,E,z,Y){return E===void 0&&(E="NWC"),z===void 0&&(z=1),this.throwIfDisposed(),Ft.conv1d(this,m,f,y,E,z,Y)},_.prototype.conv2d=function(m,f,y,E,z,Y){return E===void 0&&(E="NHWC"),z===void 0&&(z=[1,1]),this.throwIfDisposed(),Ft.conv2d(this,m,f,y,E,z,Y)},_.prototype.conv2dTranspose=function(m,f,y,E,z){return this.throwIfDisposed(),Ft.conv2dTranspose(this,m,f,y,E,z)},_.prototype.depthwiseConv2D=function(m,f,y,E,z,Y){return E===void 0&&(E="NHWC"),z===void 0&&(z=[1,1]),this.throwIfDisposed(),Ft.depthwiseConv2d(this,m,f,y,E,z,Y)},_.prototype.separableConv2d=function(m,f,y,E,z,Y){return z===void 0&&(z=[1,1]),Y===void 0&&(Y="NHWC"),this.throwIfDisposed(),Ft.separableConv2d(this,m,f,y,E,z,Y)},_.prototype.avgPool=function(m,f,y,E){return this.throwIfDisposed(),Ft.avgPool(this,m,f,y,E)},_.prototype.maxPool=function(m,f,y,E){return this.throwIfDisposed(),Ft.maxPool(this,m,f,y,E)},_.prototype.localResponseNormalization=function(m,f,y,E){return m===void 0&&(m=5),f===void 0&&(f=1),y===void 0&&(y=1),E===void 0&&(E=.5),Ft.localResponseNormalization(this,m,f,y,E)},_.prototype.pool=function(m,f,y,E,z){return this.throwIfDisposed(),Ft.pool(this,m,f,y,E,z)},_.prototype.variable=function(m,f,y){return m===void 0&&(m=!0),this.throwIfDisposed(),$i().makeVariable(this,m,f,y)},_.prototype.unsortedSegmentSum=function(m,f){return this.throwIfDisposed(),Ft.unsortedSegmentSum(this,m,f)},_.prototype.batchToSpaceND=function(m,f){return this.throwIfDisposed(),Ft.batchToSpaceND(this,m,f)},_.prototype.spaceToBatchND=function(m,f){return this.throwIfDisposed(),Ft.spaceToBatchND(this,m,f)},_.prototype.topk=function(m,f){return m===void 0&&(m=1),f===void 0&&(f=!0),this.throwIfDisposed(),Ft.topk(this,m,f)},_.prototype.stridedSlice=function(m,f,y,E,z,Y,Z,le){return E===void 0&&(E=0),z===void 0&&(z=0),Y===void 0&&(Y=0),Z===void 0&&(Z=0),le===void 0&&(le=0),this.throwIfDisposed(),Ft.stridedSlice(this,m,f,y,E,z,Y,Z,le)},_.prototype.depthToSpace=function(m,f){return this.throwIfDisposed(),Ft.depthToSpace(this,m,f)},_.prototype.fft=function(){return this.throwIfDisposed(),Ft.spectral.fft(this)},_.prototype.ifft=function(){return this.throwIfDisposed(),Ft.spectral.ifft(this)},_.prototype.rfft=function(){return this.throwIfDisposed(),Ft.spectral.rfft(this)},_.prototype.irfft=function(){return this.throwIfDisposed(),Ft.spectral.irfft(this)},_}();Object.defineProperty(Zt,Symbol.hasInstance,{value:function(_){return!!_&&_.dataId!=null&&_.shape!=null&&_.dtype!=null}});var _e,ge,Ae,Ie,it,St=function(_){function m(f,y,E,z){var Y=_.call(this,f.shape,f.dtype,f.dataId,z)||this;return Y.trainable=y,Y.name=E,Y}return A(m,_),m.prototype.assign=function(f){if(f.dtype!==this.dtype)throw new Error("dtype of the new value ("+f.dtype+") and previous value ("+this.dtype+") must match");if(!Tt(f.shape,this.shape))throw new Error("shape of the new value ("+f.shape+") and previous value ("+this.shape+") must match");$i().disposeTensor(this),this.dataId=f.dataId,$i().incRef(this,null)},m.prototype.dispose=function(){$i().disposeVariable(this),this.isDisposedInternal=!0},m}(Zt);Object.defineProperty(St,Symbol.hasInstance,{value:function(_){return _ instanceof Zt&&_.assign!=null&&_.assign instanceof Function}}),function(_){_.R0="R0",_.R1="R1",_.R2="R2",_.R3="R3",_.R4="R4",_.R5="R5",_.R6="R6"}(_e||(_e={})),function(_){_.float32="float32",_.int32="int32",_.bool="int32",_.complex64="complex64"}(ge||(ge={})),function(_){_.float32="float32",_.int32="int32",_.bool="bool",_.complex64="complex64"}(Ae||(Ae={})),function(_){_.float32="float32",_.int32="float32",_.bool="float32",_.complex64="complex64"}(Ie||(Ie={})),function(_){_.float32="complex64",_.int32="complex64",_.bool="complex64",_.complex64="complex64"}(it||(it={}));var Jt={float32:Ie,int32:ge,bool:Ae,complex64:it};function kn(_,m){if(_==="string"||m==="string"){if(_==="string"&&m==="string")return"string";throw new Error("Can not upcast "+_+" with "+m)}return Jt[_][m]}function rr(_){return kn(_,"int32")}function Bn(_,m){if(_.dtype===m.dtype)return[_,m];var f=kn(_.dtype,m.dtype);return[_.cast(f),m.cast(f)]}function Gn(_,m){Ee(_.dtype===m.dtype,function(){return"The dtypes of the first("+_.dtype+") and second("+m.dtype+") input must match"})}function Zn(_){var m=[];return function f(y,E,z){if(y!=null){if(y instanceof Zt)E.push(y);else if(Y=y,Array.isArray(Y)||typeof Y=="object"){var Y,Z=y;for(var le in Z){var de=Z[le];z.has(de)||(z.add(de),f(de,E,z))}}}}(_,m,new Set),m}var Gt,Wt=Object.freeze({makeTypesMatch:Bn,assertTypesMatch:Gn,isTensorInList:function(_,m){return m.some(function(f){return f.id===_.id})},getTensorsInContainer:Zn}),Sn=function(){function _(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null}}return _.prototype.dispose=function(){for(var m in this.registeredVariables)this.registeredVariables[m].dispose()},_}(),un=function(){function _(m){this.ENV=m,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Sn}return _.prototype.ready=function(){return S(this,void 0,void 0,function(){var m,f,y;return M(this,function(E){switch(E.label){case 0:if(this.pendingBackendInit!=null)return[2,this.pendingBackendInit.then(function(){})];if(this.backendInstance!=null)return[2];m=this.getSortedBackends(),f=0,E.label=1;case 1:return f<m.length?(y=m[f],[4,this.initializeBackend(y).success]):[3,5];case 2:return E.sent()?[4,this.setBackend(y)]:[3,4];case 3:return E.sent(),[2];case 4:return f++,[3,1];case 5:throw new Error("Could not initialize any backends, all backend initializations failed.")}})})},Object.defineProperty(_.prototype,"backend",{get:function(){if(this.pendingBackendInit!=null)throw new Error("Backend '"+this.backendName+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");if(this.backendInstance==null){var m=this.initializeBackendsAndReturnBest(),f=m.name;if(m.asyncInit)throw new Error("The highest priority backend '"+f+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(f)}return this.backendInstance},enumerable:!0,configurable:!0}),_.prototype.backendNames=function(){return Object.keys(this.registryFactory)},_.prototype.findBackend=function(m){return!(m in this.registry)&&(!(m in this.registryFactory)||this.initializeBackend(m).asyncInit)?null:this.registry[m]},_.prototype.findBackendFactory=function(m){return m in this.registryFactory?this.registryFactory[m].factory:null},_.prototype.registerBackend=function(m,f,y){return y===void 0&&(y=1),m in this.registryFactory?(console.warn(m+" backend was already registered. Reusing existi
30ng backend factory."),!1):(this.registryFactory[m]={factory:f,priority:y},!0)},_.prototype.setBackend=function(m){return S(this,void 0,void 0,function(){var f,y,E;return M(this,function(z){switch(z.label){case 0:if(this.registryFactory[m]==null)throw new Error("Backend name '"+m+"' not found in registry");return this.backendName=m,this.registry[m]!=null?[3,4]:(this.backendInstance=null,f=this.initializeBackend(m),y=f.success,f.asyncInit?[4,y]:[3,2]);case 1:return E=z.sent(),[3,3];case 2:E=y,z.label=3;case 3:if(!E)return[2,!1];z.label=4;case 4:return this.backendInstance=this.registry[m],this.setupRegisteredKernels(),this.profiler=new ci(this.backendInstance),[2,!0]}})})},_.prototype.setupRegisteredKernels=function(){var m=this;re(this.backendName).forEach(function(f){f.setupFunc!=null&&f.setupFunc(m.backendInstance)})},_.prototype.disposeRegisteredKernels=function(m){var f=this;re(m).forEach(function(y){y.disposeFunc!=null&&y.disposeFunc(f.registry[m])})},_.prototype.initializeBackend=function(m){var f=this,y=this.registryFactory[m];if(y==null)throw new Error("Cannot initialize backend "+m+", no registration found.");try{var E=y.factory();if(Promise.resolve(E)===E){var z=++this.pendingBackendInitId,Y=E.then(function(Z){return!(z<f.pendingBackendInitId||(f.registry[m]=Z,f.pendingBackendInit=null,0))}).catch(function(Z){return!(z<f.pendingBackendInitId||(f.pendingBackendInit=null,console.warn("Initialization of backend "+m+" failed"),console.warn(Z.stack||Z.message),1))});return this.pendingBackendInit=Y,{success:Y,asyncInit:!0}}return this.registry[m]=E,{success:!0,asyncInit:!1}}catch(Z){return console.warn("Initialization of backend "+m+" failed"),console.warn(Z.stack||Z.message),{success:!1,asyncInit:!1}}},_.prototype.removeBackend=function(m){if(!(m in this.registryFactory))throw new Error(m+" backend not found in registry");this.backendName===m&&this.pendingBackendInit!=null&&this.pendingBackendInitId++,m in this.registry&&(this.disposeRegisteredKernels(m),this.registry[m].dispose(),delete this.registry[m]),delete this.registryFactory[m],this.backendName===m&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)},_.prototype.getSortedBackends=function(){var m=this;if(Object.keys(this.registryFactory).length===0)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(function(f,y){return m.registryFactory[y].priority-m.registryFactory[f].priority})},_.prototype.initializeBackendsAndReturnBest=function(){for(var m=this.getSortedBackends(),f=0;f<m.length;f++){var y=m[f],E=this.initializeBackend(y),z=E.success,Y=E.asyncInit;if(Y||z)return{name:y,asyncInit:Y}}throw new Error("Could not initialize any backends, all backend initializations failed.")},_.prototype.moveData=function(m,f){var y=this.state.tensorInfo.get(f),E=y.backend,z=this.readSync(f);E.disposeData(f),y.backend=m,m.move(f,z,y.shape,y.dtype),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++},_.prototype.tidy=function(m,f){var y,E=this,z=null;if(f==null){if(typeof m!="function")throw new Error("Please provide a function to tidy()");f=m}else{if(typeof m!="string"&&!(m instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if(typeof f!="function")throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");z=m}return this.scopedRun(function(){return E.startScope(z)},function(){return E.endScope(y)},function(){return(y=f())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),y})},_.prototype.scopedRun=function(m,f,y){m();try{var E=y();return f(),E}catch(z){throw f(),z}},_.prototype.nextTensorId=function(){return _.nextTensorId++},_.prototype.nextVariableId=function(){return _.nextVariableId++},_.prototype.clone=function(m){var f=this.makeTensorFromDataId(m.dataId,m.shape,m.dtype),y={x:m};return this.addTapeNode(this.state.activeScope.name,y,[f],function(E){return{x:function(){return E.toFloat()}}},[],{}),f},_.prototype.runKernel=function(m,f,y,E,z){return this.runKernelFunc(null,f,null,m,y,E,z)},_.prototype.shouldCheckForMemLeaks=function(){return this.ENV.getBool("IS_TEST")},_.prototype.checkKernelForMemLeak=function(m,f,y){var E=this.backend.numDataIds(),z=0;
vendor: 28,037 bytes, lines 30-34
30y.forEach(function(le){z+=le.dtype==="complex64"?3:1});var Y=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],Z=E-f-z-Y;if(Z>0)throw new Error("Backend '"+this.backendName+"' has an internal memory leak ("+Z+" data ids) after running '"+m+"'")},_.prototype.runKernelFunc=function(m,f,y,E,z,Y,Z){var le,de=this,we=[],De=this.isTapeOn();E==null&&(E=this.state.activeScope!=null?this.state.activeScope.name:"");var Ne,Fe=this.state.numBytes,Ve=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);var Je,Xe=J(E,this.backendName);if(Xe!=null)Ne=function(){var xt=de.backend.numDataIds();Je=Xe.kernelFunc({inputs:f,attrs:z,backend:de.backend});var kt=Array.isArray(Je)?Je:[Je];de.shouldCheckForMemLeaks()&&de.checkKernelForMemLeak(E,xt,kt);var At=kt.map(function(ln){var nn=ln.dataId,cn=ln.shape,Dn=ln.dtype;return de.makeTensorFromDataId(nn,cn,Dn)});if(De){var Lt=de.getTensorsForGradient(E,f,At);if(Lt==null){Z==null&&(Z=[]);var tn=At.filter(function(ln,nn){return Z[nn]});Lt=(Y||[]).slice().concat(tn)}we=de.saveTensorsForBackwardMode(Lt)}return At};else{var ot=function(xt){De&&(we=xt.map(function(kt){return de.keep(de.clone(kt))}))};Ne=function(){var xt=de.backend.numDataIds();Je=de.tidy(function(){return m(de.backend,ot)});var kt=Array.isArray(Je)?Je:[Je];return de.shouldCheckForMemLeaks()&&de.checkKernelForMemLeak(E,xt,kt),kt}}return this.scopedRun(function(){return de.state.kernelDepth++},function(){return de.state.kernelDepth--},function(){le=de.ENV.getBool("DEBUG")?de.profiler.profileKernel(E,f,function(){return Ne()}):Ne()}),De&&this.addTapeNode(E,f,le,y,we,z),this.state.profiling&&this.state.activeProfile.kernels.push({name:E,bytesAdded:this.state.numBytes-Fe,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-Ve,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(f).map(function(xt){return f[xt].shape}),outputShapes:le.map(function(xt){return xt.shape})}),Array.isArray(Je)?le:le[0]},_.prototype.saveTensorsForBackwardMode=function(m){var f=this;return m.map(function(y){return f.keep(f.clone(y))})},_.prototype.getTensorsForGradient=function(m,f,y){var E=K(m);if(E!=null){var z=E.inputsToSave||[],Y=E.outputsToSave||[],Z=void 0;E.saveAllInputs?(Ee(Array.isArray(f),function(){return"saveAllInputs is true, expected inputs to be an array."}),Z=Object.keys(f).map(function(de){return f[de]})):Z=z.map(function(de){return f[de]});var le=y.filter(function(de,we){return Y[we]});return Z.concat(le)}return null},_.prototype.makeTensor=function(m,f,y,E){if(m==null)throw new Error("Values passed to engine.makeTensor() are null");y=y||"float32",E=E||this.backend;var z=m;y==="string"&&on(m[0])&&(z=m.map(function(we){return Fn(we)}));var Y=E.write(z,f,y),Z=new Zt(f,y,Y,this.nextTensorId());if(this.incRef(Z,E),y==="string"){var le=this.state.tensorInfo.get(Y),de=ct(z);this.state.numBytes+=de-le.bytes,le.bytes=de}return Z},_.prototype.makeTensorFromDataId=function(m,f,y,E){var z=new Zt(f,y=y||"float32",m,this.nextTensorId());return this.incRef(z,E),z},_.prototype.makeVariable=function(m,f,y,E){f===void 0&&(f=!0),y=y||this.nextVariableId().toString(),E!=null&&E!==m.dtype&&(m=m.asType(E));var z=new St(m,f,y,this.nextTensorId());if(this.state.registeredVariables[z.name]!=null)throw new Error("Variable with name "+z.name+" was already registered");return this.state.registeredVariables[z.name]=z,this.incRef(z,this.backend),z},_.prototype.incRef=function(m,f){var y=this.state.tensorInfo.has(m.dataId)?this.state.tensorInfo.get(m.dataId).refCount:0;if(this.state.numTensors++,m.dtype==="string"&&this.state.numStringTensors++,y===0){this.state.numDataBuffers++;var E=0;m.dtype!=="complex64"&&m.dtype!=="string"&&(E=m.size*It(m.dtype)),this.state.tensorInfo.set(m.dataId,{backend:f||this.backend,dtype:m.dtype,shape:m.shape,bytes:E,refCount:0}),this.state.numBytes+=E}this.state.tensorInfo.get(m.dataId).refCount++,m instanceof St||this.track(m)},_.prototype.disposeTensor=function(m){if(this.state.tensorInfo.has(m.dataId)){this.state.numTensors--,m.dtype==="string"&&this.state.numStringTensors--;var f=this.state.tensorInfo.get(m.dataId);f.refCount<=1?(m.dtype!=="complex64"&&(this.state.numBytes-=f.bytes),this.state.numDataBuffers--,f.backend.disposeData(m.dataId),this.state.tensorInfo.delete(m.dataId)):this.state.tensorInfo.get(m.dataId).refCount--}},_.prototype.disposeVariables=function(){for(var m in this.state.registeredVariables){var f=this.state.registeredVariables[m];this.disposeVariable(f)}},_.prototype.disposeVariable=function(m){this.disposeTensor(m),this.state.registeredVariables[m.name]!=null&&delete this.state.registeredVariables[m.name]},_.prototype.memory=function(){var m=this.backend.memory();return m.numTensors=this.state.numTensors,m.numDataBuffers=this.state.numDataBuffers,m.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(m.unreliable=!0,m.reasons==null&&(m.reasons=[]),m.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),m},_.prototype.profile=function(m){return S(this,void 0,void 0,function(){var f,y;return M(this,function(E){return this.state.profiling=!0,f=this.state.numBytes,y=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=m(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map(function(z){return z.totalBytesSnapshot})),this.state.activeProfile.newBytes=this.state.numBytes-f,this.state.activeProfile.newTensors=this.state.numTensors-y,[2,this.state.activeProfile]})})},_.prototype.isTapeOn=function(){return this.state.gradientDepth>0&&this.state.kernelDepth===0},_.prototype.addTapeNode=function(m,f,y,E,z,Y){var Z=this,le={id:this.state.nextTapeNodeId++,kernelName:m,inputs:f,outputs:y,saved:z},de=K(m);de!=null&&(E=de.gradFunc),E!=null&&(le.gradient=function(we){return we=we.map(function(De,Ne){if(De==null){var Fe=y[Ne],Ve=rn(Fe.size,Fe.dtype);return Z.makeTensor(Ve,Fe.shape,Fe.dtype)}return De}),E(we.length>1?we:we[0],z,Y)}),this.state.activeTape.push(le)},_.prototype.keep=function(m){return m.kept=!0,m},_.prototype.startTape=function(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++},_.prototype.endTape=function(){this.state.gradientDepth--},_.prototype.startScope=function(m){var f={track:[],name:"unnamed scope",id:this.state.nextScopeId++};m&&(f.name=m),this.state.scopeStack.push(f),this.state.activeScope=f},_.prototype.endScope=function(m){for(var f=this,y=Zn(m),E=new Set(y.map(function(le){return le.id})),z=0;z<this.state.activeScope.track.length;z++){var Y=this.state.activeScope.track[z];Y.kept||E.has(Y.id)||Y.dispose()}var Z=this.state.scopeStack.pop();this.state.activeScope=this.state.scopeStack.length===0?null:this.state.scopeStack[this.state.scopeStack.length-1],y.forEach(function(le){le.kept||le.scopeId!==Z.id||f.track(le)})},_.prototype.gradients=function(m,f,y,E){var z=this;if(E===void 0&&(E=!1),Ee(f.length>0,function(){return"gradients() received an empty list of xs."}),y!=null&&y.dtype!=="float32")throw new Error("dy must have 'float32' dtype, but has '"+y.dtype+"'");var Y=this.scopedRun(function(){return z.startTape()},function(){return z.endTape()},function(){return z.tidy("forward",m)});Ee(Y instanceof Zt,function(){return"The result y returned by f() must be a tensor."});var Z=function(le,de,we){for(var De={},Ne={},Fe=0;Fe<de.length;Fe++)De[de[Fe].id]=!0;for(Fe=0;Fe<le.length;Fe++){var Ve=(tn=le[Fe]).inputs;for(var Je in Ve){for(var Xe=Ve[Je],ot=!1,xt=0;xt<de.length;xt++)if(De[Xe.id]){tn.outputs.forEach(function(Dn){return De[Dn.id]=!0}),ot=!0,Ne[tn.id]=!0;break}if(ot)break}}var kt={};kt[we.id]=!0;var At={};for(Fe=le.length-1;Fe>=0;Fe--)for(Ve=(tn=le[Fe]).inputs,xt=0;xt<tn.outputs.length;xt++)if(kt[tn.outputs[xt].id]){for(var Je in Ve)kt[Ve[Je].id]=!0,At[tn.id]=!0;break}var Lt=[];for(Fe=0;Fe<le.length;Fe++){var tn;if(Ne[(tn=le[Fe]).id]&&At[tn.id]){var ln={};for(var Je in tn.inputs){var nn=tn.inputs[Je];De[nn.id]&&(ln[Je]=nn)}var cn=Object.assign({},tn);cn.inputs=ln,cn.outputs=tn.outputs,Lt.push(cn)}}return Lt}(this.state.activeTape,f,Y);if(!E&&Z.length===0&&f.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",function(){var le,de,we={};we[Y.id]=y??(de=hn(Ke(le=Y.shape),"float32"),qe.makeTensor(de,le,"float32")),function(Ne,Fe,Ve){for(var Je=function(ot){var xt=Fe[ot],kt=[];if(xt.outputs.forEach(function(ln){var nn=Ne[ln.id];nn!=null?kt.push(nn):kt.push(null)}),xt.gradient==null)throw new Error("Cannot compute gradient: gradient function not found for "+xt.kernelName+".");var At=xt.gradient(kt),Lt=function(ln){if(!(ln in At))throw new Error("Cannot backprop through input "+ln+". Available gradients found: "+Object.keys(At)+".");var nn=Ve(function(){return At[ln]()});if(nn.dtype!=="float32")throw new Error("Error in gradient for op "+xt.kernelName+". The gradient of input "+ln+" must have 'float32' dtype, but has '"+nn.dtype+"'");var cn=xt.inputs[ln];if(!Tt(nn.shape,cn.shape))throw new Error("Error in gradient for op "+xt.kernelName+". The gradient of input '"+ln+"' has shape '"+nn.shape+"', which does not match the shape of the input '"+cn.shape+"'");if(Ne[cn.id]==null)Ne[cn.id]=nn;else{var Dn=Ne[cn.id];Ne[cn.id]=Dn.add(nn),Dn.dispose()}};for(var tn in xt.inputs)Lt(tn)},Xe=Fe.length-1;Xe>=0;Xe--)Je(Xe)}(we,Z,function(Ne){return z.tidy(Ne)});var De=f.map(function(Ne){return we[Ne.id]});return z.state.gradientDepth===0&&(z.state.activeTape.forEach(function(Ne){for(var Fe=0,Ve=Ne.saved;Fe<Ve.length;Fe++)Ve[Fe].dispose()}),z.state.activeTape=null),{value:Y,grads:De}})},_.prototype.customGrad=function(m){var f=this;return Ee(jn(m),function(){return"The f passed in customGrad(f) must be a function."}),function(){for(var y,E=[],z=0;z<arguments.length;z++)E[z]=arguments[z];Ee(E.every(function(Z){return Z instanceof Zt}),function(){return"The args passed in customGrad(f)(x1, x2,...) must all be tensors"});var Y={};return E.forEach(function(Z,le){Y[le]=Z}),f.runKernelFunc(function(Z,le){return Ee((y=m.apply(void 0,E.concat([le]))).value instanceof Zt,function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"}),Ee(jn(y.gradFunc),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."}),y.value},Y,function(Z,le){var de=y.gradFunc(Z,le),we=Array.isArray(de)?de:[de];Ee(we.length===E.length,function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."}),Ee(we.every(function(Ne){return Ne instanceof Zt}),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."});var De={};return we.forEach(function(Ne,Fe){De[Fe]=function(){return Ne}}),De})}},_.prototype.readSync=function(m){return this.state.tensorInfo.get(m).backend.readSync(m)},_.prototype.read=function(m){return this.state.tensorInfo.get(m).backend.read(m)},_.prototype.time=function(m){return S(this,void 0,void 0,function(){var f,y;return M(this,function(E){switch(E.label){case 0:return f=fn(),[4,this.backend.time(m)];case 1:return(y=E.sent()).wallMs=fn()-f,[2,y]}})})},_.prototype.track=function(m){return this.state.activeScope!=null&&(m.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(m)),m},Object.defineProperty(_.prototype,"registeredVariables",{get:function(){return this.state.registeredVariables},enumerable:!0,configurable:!0}),_.prototype.reset=function(){for(var m in this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Sn,this.registry)this.disposeRegisteredKernels(m),this.registry[m].dispose(),delete this.registry[m];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null},_.nextTensorId=0,_.nextVariableId=0,_}(),qe=function(){var _=function(){if(Gt==null){var f=void 0;if(typeof window<"u")f=window;else if(s!==void 0)f=s;else if(h!==void 0)f=h;else{if(typeof self>"u")throw new Error("Could not find a global object");f=self}Gt=f}return Gt}();if(_._tfengine==null){var m=new P(_);_._tfengine=new un(m)}return function(f){V=f}(_._tfengine.ENV),$i=function(){return _._tfengine},_._tfengine}();function $n(){return typeof window<"u"&&window.document!=null||typeof WorkerGlobalScope<"u"}var er=L();er.registerFlag("DEBUG",function(){return!1},function(_){_&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")}),er.registerFlag("IS_BROWSER",function(){return $n()}),er.registerFlag("IS_NODE",function(){return h!==void 0&&h.versions!==void 0&&h.versions.node!==void 0}),er.registerFlag("IS_CHROME",function(){return typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}),er.registerFlag("PROD",function(){return!1}),er.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",function(){return er.getBool("DEBUG")}),er.registerFlag("DEPRECATION_WARNINGS_ENABLED",function(){return!0}),er.registerFlag("IS_TEST",function(){return!1});var sr,pr,Zr,Mr={},Ii={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function Lo(_,m){Mr[_]=m}function Ai(_){_ in Mr||(Mr[_]=function(f){if(f!==1&&f!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var y=function(E){if(typeof OffscreenCanvas<"u"&&E===2)return new OffscreenCanvas(300,150);if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}(f);return y.addEventListener("webglcontextlost",function(E){E.preventDefault(),delete Mr[f]},!1),f===1?y.getContext("webgl",Ii)||y.getContext("experimental-webgl",Ii):y.getContext("webgl2",Ii)}(_));var m=Mr[_];return m.isContextLost()?(delete Mr[_],Ai(_)):(m.disable(m.DEPTH_TEST),m.disable(m.STENCIL_TEST),m.disable(m.BLEND),m.disable(m.DITHER),m.disable(m.POLYGON_OFFSET_FILL),m.disable(m.SAMPLE_COVERAGE),m.enable(m.SCISSOR_TEST),m.enable(m.CULL_FACE),m.cullFace(m.BACK),Mr[_])}function ko(_,m){return[m,_]}function Ji(_){var m=Ke(_);return bt(Math.ceil(m/4))}function ai(_,m){return[Math.max(1,Math.ceil(m/2)),Math.max(1,Math.ceil(_/2))]}function Yr(_,m){var f,y,E,z,Y,Z,le,de,we,De=_;return L().getNumber("WEBGL_VERSION")===2?(f=De.R32F,y=De.R16F,E=De.RGBA16F,z=De.RGBA32F,Y=De.RED,Z=4,le=1,de=De.HALF_FLOAT,we=De.FLOAT):(f=_.RGBA,y=_.RGBA,E=_.RGBA,z=De.RGBA,Y=_.RGBA,Z=4,le=4,de=m!=null?m.HALF_FLOAT_OES:null,we=_.FLOAT),{internalFormatFloat:f,internalFormatHalfFloat:y,internalFormatPackedHalfFloat:E,internalFormatPackedFloat:z,textureFormatFloat:Y,downloadTextureFormat:_.RGBA,downloadUnpackNumChannels:Z,defaultNumChannels:le,textureTypeHalfFloat:de,textureTypeFloat:we}}function Hn(_,m,f){var y=f();return m&&function(E){var z=E.getError();if(z!==E.NO_ERROR)throw new Error("WebGL Error: "+Io(E,z))}(_),y}(function(_){_[_.DENSE=0]="DENSE",_[_.SHARED_BATCH=1]="SHARED_BATCH"})(sr||(sr={})),function(_){_[_.RENDER=0]="RENDER",_[_.UPLOAD=1]="UPLOAD",_[_.PIXELS=2]="PIXELS",_[_.DOWNLOAD=3]="DOWNLOAD"}(pr||(pr={})),function(_){_[_.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",_[_.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",_[_.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",_[_.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",_[_.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}(Zr||(Zr={}));var ki=596e-10,lo=65504;function Kr(_){return!!(L().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||_===0||ki<Math.abs(_)&&Math.abs(_)<lo)}function Io(_,m){switch(m){case _.NO_ERROR:return"NO_ERROR";case _.INVALID_ENUM:return"INVALID_ENUM";case _.INVALID_VALUE:return"INVALID_VALUE";case _.INVALID_OPERATION:return"INVALID_OPERATION";case _.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case _.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case _.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code "+m}}function Ko(_,m,f){return Ha(_,m,function(){return _.getExtension(f)},'Extension "'+f+'" not supported on this browser.')}function Eo(_,m,f){var y=Ha(_,m,function(){return _.createShader(_.VERTEX_SHADER)},"Unable to create vertex WebGLShader.");if(Hn(_,m,function(){return _.shaderSource(y,f)}),Hn(_,m,function(){return _.compileShader(y)}),_.getShaderParameter(y,_.COMPILE_STATUS)===!1)throw console.log(_.getShaderInfoLog(y)),new Error("Failed to compile vertex shader.");return y}function Yo(_,m,f){var y=Ha(_,m,function(){return _.createShader(_.FRAGMENT_SHADER)},"Unable to create fragment WebGLShader.");if(Hn(_,m,function(){return _.shaderSource(y,f)}),Hn(_,m,function(){return _.compileShader(y)}),_.getShaderParameter(y,_.COMPILE_STATUS)===!1)throw function(E,z){var Y=pp.exec(z);if(Y==null)return console.log("Couldn't parse line number in error: "+z),void console.log(E);for(var Z=+Y[1],le=E.split(` 31`),de=le.length.toString().length+2,we=le.map(function(Xe,ot){return Ht((ot+1).toString(),de)+Xe}),De=0,Ne=0;Ne<we.length;Ne++)De=Math.max(we[Ne].length,De);var Fe=we.slice(0,Z-1),Ve=we.slice(Z-1,Z),Je=we.slice(Z);console.log(Fe.join(` 32`)),console.log(z.split(` 33`)[0]),console.log("%c "+Ht(Ve[0],De),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(Je.join(` 34`))}(f,_.getShaderInfoLog(y)),new Error("Failed to compile fragment shader.");return y}var vs,gu,pp=/ERROR: [0-9]+:([0-9]+):/g;function fo(_,m){return Ha(_,m,function(){return _.createProgram()},"Unable to create WebGLProgram.")}function yl(_,m,f){if(Hn(_,m,function(){return _.linkProgram(f)}),_.getProgramParameter(f,_.LINK_STATUS)===!1)throw console.log(_.getProgramInfoLog(f)),new Error("Failed to link vertex and fragment shaders.")}function Tc(_,m,f){if(Hn(_,m,function(){return _.validateProgram(f)}),_.getProgramParameter(f,_.VALIDATE_STATUS)===!1)throw console.log(_.getProgramInfoLog(f)),new Error("Shader program validation failed.")}function Wl(_,m,f){var y=Ha(_,m,function(){return _.createBuffer()},"Unable to create WebGLBuffer");return Hn(_,m,function(){return _.bindBuffer(_.ARRAY_BUFFER,y)}),Hn(_,m,function(){return _.bufferData(_.ARRAY_BUFFER,f,_.STATIC_DRAW)}),y}function Jc(_,m,f){var y=Ha(_,m,function(){return _.createBuffer()},"Unable to create WebGLBuffer");return Hn(_,m,function(){return _.bindBuffer(_.ELEMENT_ARRAY_BUFFER,y)}),Hn(_,m,function(){return _.bufferData(_.ELEMENT_ARRAY_BUFFER,f,_.STATIC_DRAW)}),y}function Vl(_,m){return Ha(_,m,function(){return _.createTexture()},"Unable to create WebGLTexture.")}function Sm(_,m){var f=L().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(_<=0||m<=0){var y="["+_+"x"+m+"]";throw new Error("Requested texture size "+y+" is invalid.")}if(_>f||m>f)throw y="["+_+"x"+m+"]",new Error("Requested texture size "+y+" greater than WebGL maximum on this browser / GPU ["+f+"x"+f+"].")}function Qs(_,m){return Ha(_,m,function(){return _.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function Zd(_,m,f,y,E,z,Y,Z){var le=_.getAttribLocation(f,y);return le!==-1&&(Hn(_,m,function(){return _.bindBuffer(_.ARRAY_BUFFER,E)}),Hn(_,m,function(){return _.vertexAttribPointer(le,z,_.FLOAT,!1,Y,Z)}),Hn(_,m,function(){return _.enableVertexAttribArray(le)}),!0)}function Am(_,m,f,y){bl(_,y),Hn(_,m,function(){return _.activeTexture(_.TEXTURE0+y)}),Hn(_,m,function(){return _.bindTexture(_.TEXTURE_2D,f)})}function Qc(_,m,f,y){return Ha(_,m,function(){return _.getUniformLocation(f,y)},'uniform "'+y+'" not present in program.')}function eh(_,m,f){return _.getUniformLocation(m,f)}function mp(_,m,f,y,E,z){Hn(_,m,function(){return Am(_,m,y,z)}),Hn(_,m,function(){return _.uniform1i(E,z)})}function $l(_,m,f,y){Hn(_,m,function(){return _.bindFramebuffer(_.FRAMEBUFFER,y)}),Hn(_,m,function(){return _.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,f,0)})}function nd(_,m,f){Hn(_,m,function(){return _.bindFramebuffer(_.FRAMEBUFFER,f)}),Hn(_,m,function(){return _.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,null,0)})}function ys(_){var m=_.checkFramebufferStatus(_.FRAMEBUFFER);if(m!==_.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+vf(_,m))}function vf(_,m){switch(m){case _.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case _.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case _.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case _.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+m}}function Ha(_,m,f,y){var E=Hn(_,m,function(){return f()});if(E==null)throw new Error(y);return E}function bl(_,m){var f=_.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,y=m+_.TEXTURE0;if(y<_.TEXTURE0||y>f)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+f+"].")}function Zs(_,m){return m===void 0&&(m=2),Ke(_.slice(0,_.length-m))}function ls(_){if(_.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[_.length>1?_[_.length-2]:1,_[_.length-1]]}function xl(_){var m=[1,1,1];return _.length===0||_.length===1&&_[0]===1||(m=[Zs(_)].concat(ls(_))),m}function rd(_,m){var f;m===void 0&&(m=!1);var y=L().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(m&&(y*=2,(_=_.map(function(de,we){return we>=_.length-2?Dt(_[we]):_[we]})).length===1&&(_=[2,_[0]])),_.length!==2){var E=sn(_);_=E.newShape}var z=Ke(_);if(_.length<=1&&z<=y)return[1,z];if(_.length===2&&_[0]<=y&&_[1]<=y)return _;if(_.length===3&&_[0]*_[1]<=y&&_[2]<=y)return[_[0]*_[1],_[2]];if(_.length===3&&_[0]<=y&&_[1]*_[2]<=y)return[_[0],_[1]*_[2]];if(_.length===4&&_[0]*_[1]*_[2]<=y&&_[3]<=y)return[_[0]*_[1]*_[2],_[3]];if(_.length===4&&_[0]<=y&&_[1]*_[2]*_[3]<=y)return[_[0],_[1]*_[2]*_[3]];if(m){var Y=Zs(_),Z=2,le=2;return _.length&&(Z=(f=ls(_))[0],le=f[1]),bt(z=Y*(Z/2)*(le/2)).map(function(de){return 2*de})}return bt(z)}function wl(_){return _%2==0}function vc(_,m){if(Tt(_=_.slice(-2),m=m.slice(-2))||!_.length||!m.length||_[0]===0||_[1]===0||m[0]===0||m[1]===0)return!0;if(_.length!==m.length){var f=_.slice(-1)[0],y=m.slice(-1)[0];if(f===y||wl(f)&&wl(y)&&(_[0]===1||m[0]===1))return!0}return _[1]===m[1]&&wl(_[0])&&wl(m[0])}function gp(_){if(vs==null){var m=Ai(_);vs=m.getParameter(m.MAX_TEXTURE_SIZE)}return vs}function th(_){if(gu==null){var m=Ai(_);gu=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,gu)}function nh(_){if(_===0)return 0;var m=Ai(_);return Ja(m,"EXT_disjoint_timer_query_webgl2")&&_===2?2:Ja(m,"EXT_disjoint_timer_query")?1:0}function Ja(_,m){return _.getExtension(m)!=null}function vp(_){try{if(Ai(_)!=null)return!0}catch{return!1}return!1}function Om(_){if(_===0)return!1;var m=Ai(_);if(_===1){if(!Ja(m,"OES_texture_float"))return!1}else if(!Ja(m,"EXT_color_buffer_float"))return!1;return ih(m)}function rh(_){if(_===0)return!1;var m=Ai(_);return _!==1?Ja(m,"EXT_color_buffer_float")?ih(m):!!Ja(m,"EXT_color_buffer_half_float")&&function(f,y){var E=Yr(f,y),z=f.createTexture();f.bindTexture(f.TEXTURE_2D,z),f.texImage2D(f.TEXTURE_2D,0,E.internalFormatHalfFloat,1,1,0,E.textureFormatFloat,E.textureTypeHalfFloat,null);var Y=f.createFramebuffer();f.bindFramebuffer(f.FRAMEBUFFER,Y),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,z,0);var Z=f.checkFramebufferStatus(f.FRAMEBUFFER)===f.FRAMEBUFFER_COMPLETE;return f.bindTexture(f.TEXTURE_2D,null),f.bindFramebuffer(f.FRAMEBUFFER,null),f.deleteTexture(z),f.deleteFramebuffer(Y),Z}(m,m.getExtension("EXT_color_buffer_half_float")):!!Ja(m,"OES_texture_float")&&!!Ja(m,"WEBGL_color_buffer_float")&&ih(m)}function ih(_){var m=Yr(_),f=_.createTexture();_.bindTexture(_.TEXTURE_2D,f),_.texImage2D(_.TEXTURE_2D,0,m.internalFormatFloat,1,1,0,m.textureFormatFloat,m.textureTypeFloat,null);var y=_.createFramebuffer();_.bindFramebuffer(_.FRAMEBUFFER,y),_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_2D,f,0);var E=_.checkFramebufferStatus(_.FRAMEBUFFER)===_.FRAMEBUFFER_COMPLETE;return _.bindTexture(_.TEXTURE_2D,null),_.bindFramebuffer(_.FRAMEBUFFER,null),_.deleteTexture(f),_.deleteFramebuffer(y),E}function vu(_){return _===2&&Ai(_).fenceSync!=null}var oh=Object.freeze({callAndCheck:Hn,canBeRepresented:Kr,getWebGLErrorMessage:Io,getExtensionOrThrow:Ko,createVertexShader:Eo,createFragmentShader:Yo,createProgram:fo,linkProgram:yl,validateProgram:Tc,createStaticVertexBuffer:Wl,createStaticIndexBuffer:Jc,getNumChannels:function(){return L().getNumber("WEBGL_VERSION")===2?1:4},createTexture:Vl,validateTextureSize:Sm,createFramebuffer:Qs,bindVertexBufferToProgramAttribute:Zd,bindTextureUnit:Am,unbindTextureUnit:function(_,m,f){bl(_,f),Hn(_,m,function(){return _.activeTexture(_.TEXTURE0+f)}),Hn(_,m,function(){return _.bindTexture(_.TEXTURE_2D,null)})},getProgramUniformLocationOrThrow:Qc,getProgramUniformLocation:eh,bindTextureToProgramUniformSampler:mp,bindCanvasToFramebuffer:function(_,m){Hn(_,m,function(){return _.bindFramebuffer(_.FRAMEBUFFER,null)}),Hn(_,m,function(){return _.viewport(0,0,_.canvas.width,_.canvas.height)}),Hn(_,m,function(){return _.scissor(0,0,_.canvas.width,_.canvas.height)})},bindColorTextureToFramebuffer:$l,unbindColorTextureFromFramebuffer:nd,validateFramebuffer:ys,getFramebufferErrorMessage:vf,getBatchDim:Zs,getRowsCols:ls,getShapeAs3D:xl,getTextureShapeFromLogicalShape:rd,isReshapeFree:vc,getWebGLMaxTextureSize:gp,resetMaxTextureSize:function(){vs=null},resetMaxTexturesInShader:function(){gu=null},getMaxTexturesInShader:th,getWebGLDisjointQueryTimerVersion:nh,hasExtension:Ja,isWebGLVersionEnabled:vp,isCapableOfRenderingToFloatTexture:Om,isDownloadFloatTextureEnabled:rh,isWebGLFenceEnabled:vu}),gr=L();function Nc(){L().set("PROD",!0)}function Rg(){L().set("DEBUG",!0)}function Bg(){L().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function ah(_){L().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(_+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function id(){qe.disposeVariables()}function Dm(){return qe}function yp(){return qe.memory()}function bp(_){return qe.profile(_)}function eo(_,m){return qe.tidy(_,m)}function ca(_){Zn(_).forEach(function(m){return m.dispose()})}function xp(_){return qe.keep(_)}function N0(_){return qe.time(_)}function sh(_){return qe.setBackend(_)}function Tm(){return qe.ready()}function yu(){return qe.backendName}function _l(_){qe.removeBackend(_)}function Nm(_){return qe.findBackend(_)}function Pg(_){return qe.findBackendFactory(_)}function jg(_,m,f){return f===void 0&&(f=1),qe.registerBackend(_,m,f)}function I0(){return qe.backend}function M0(_,m){L().setPlatform(_,m)}function yf(){for(var _=[],m=0;m<arguments.length;m++)_[m]=arguments[m];L().getBool("IS_TEST")||console.warn.apply(console,_)}function As(_,m){var f=_;if(dt(_))return m==="string"?[]:[_.length];if(!Array.isArray(_))return[];for(var y=[];Array.isArray(f)||dt(f)&&m!=="string";)y.push(f.length),f=f[0];return Array.isArray(_)&&L().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function E(z,Y,Z){if(Z=Z||[],Array.isArray(z)||dt(z)){Ee(Y.length>0,function(){return"Element arr["+Z.join("][")+"] should be a primitive, but is an array of "+z.length+" elements"}),Ee(z.length===Y[0],function(){return"Element arr["+Z.join("][")+"] should have "+Y[0]+" elements, but has "+z.length+" elements"});for(var le=Y.slice(1),de=0;de<z.length;++de)E(z[de],le,Z.concat(de))}else Ee(Y.length===0,function(){return"Element arr["+Z.join("][")+"] is a primitive, but should be an array/TypedArray of "+Y[0]+" elements"})}(_,y,[]),y}function wp(_,m,f,y){if(_!=null&&(_!=="numeric"&&_!==m||_==="numeric"&&m==="string"))throw new Error("Argument '"+f+"' passed to '"+y+"' must be "+_+" tensor, but got "+m+" tensor")}function et(_,m,f,y){if(y===void 0&&(y="numeric"),_ instanceof Zt)return wp(y,_.dtype,m,f),_;var E=xe(_);
34if(E!=="string"&&["bool","int32","float32"].indexOf(y)>=0&&(E=y),wp(y,E,m,f),_==null||!dt(_)&&!Array.isArray(_)&&typeof _!="number"&&typeof _!="boolean"&&typeof _!="string"){var z=_==null?"null":_.constructor.name;throw new Error("Argument '"+m+"' passed to '"+f+"' must be a Tensor or TensorLike, but got '"+z+"'")}var Y=As(_,E);dt(_)||Array.isArray(_)||(_=[_]);var Z=E!=="string"?cr(_,E,L().getBool("DEBUG")):Mt(_,[],!0);return qe.makeTensor(Z,Y,E)}function Zc(_,m,f,y){if(y===void 0&&(y="numeric"),!Array.isArray(_))throw new Error("Argument "+m+" passed to "+f+" must be a `Tensor[]` or `TensorLike[]`");return _.map(function(E,z){return et(E,m+"["+z+"]",f)},y)}function uh(_,m){for(var f=0;f<_.length;++f)if(_[_.length-f-1]!==m-1-f)return!1;return!0}function Im(_,m,f){for(var y=_.length+m.length,E=[],z=0,Y=0,Z=0;Z<y;Z++)f.indexOf(Z)===-1?E.push(_[z++]):E.push(m[Y++]);return E}function ra(_,m){for(var f=[],y=_.length,E=0;E<y;E++)m.indexOf(E)===-1&&f.push(_[E]);return[f,m.map(function(z){return _[z]})]}function ia(_,m){return Im(_,m.map(function(f){return 1}),m)}function Aa(_,m,f){Ee(uh(m,f),function(){return _+" supports only inner-most axes for now. Got axes "+m+" and rank-"+f+" input."})}function fs(_,m){if(uh(_,m))return null;for(var f=[],y=0;y<m;++y)_.indexOf(y)===-1&&f.push(y);return _.forEach(function(E){return f.push(E)}),f}function Ic(_){return _.map(function(m,f){return[f,m]}).sort(function(m,f){return m[1]-f[1]}).map(function(m){return m[0]})}function ds(_,m){for(var f=[],y=m-_;y<m;++y)f.push(y);return f}function Hl(_,m){var f=_[0].length;_.forEach(function(E,z){Ee(E.length===f,function(){return"Error in concat"+f+"D: rank of tensors["+z+"] must be the same as the rank of the rest ("+f+")"})}),Ee(m>=0&&m<f,function(){return"Error in concat"+f+"D: axis must be between 0 and "+(f-1)+"."});var y=_[0];_.forEach(function(E,z){for(var Y=0;Y<f;Y++)Ee(Y===m||E[Y]===y[Y],function(){return"Error in concat"+f+"D: Shape of tensors["+z+"] ("+E+") does not match the shape of the rest ("+y+") along the non-concatenated axis "+z+"."})})}function sc(_,m){for(var f=_[0].slice(),y=1;y<_.length;y++)f[m]+=_[y][m];return f}function Bt(_){var m=Object.keys(_);if(m.length!==1)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+m.length+" keys.");var f=m[0],y=_[f];f.endsWith("_")&&(f=f.substring(0,f.length-1));var E=function(){for(var z=[],Y=0;Y<arguments.length;Y++)z[Y]=arguments[Y];qe.startScope(f);try{var Z=y.apply(void 0,z);return Z instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),qe.endScope(Z),Z}catch(le){throw qe.endScope(null),le}};return Object.defineProperty(E,"name",{value:f,configurable:!0}),E}gr.registerFlag("HAS_WEBGL",function(){return gr.getNumber("WEBGL_VERSION")>0}),gr.registerFlag("WEBGL_VERSION",function(){return vp(2)?2:vp(1)?1:0}),gr.registerFlag("WEBGL_BUFFER_SUPPORTED",function(){return gr.get("WEBGL_VERSION")===2}),gr.registerFlag("WEBGL_CPU_FORWARD",function(){return!0}),gr.registerFlag("WEBGL_FORCE_F16_TEXTURES",function(){return!1}),gr.registerFlag("WEBGL_PACK",function(){return gr.getBool("HAS_WEBGL")}),gr.registerFlag("WEBGL_PACK_NORMALIZATION",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_CLIP",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_DEPTHWISECONV",function(){return!1}),gr.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_REDUCE",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_LAZILY_UNPACK",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_CONV_IM2COL",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_MAX_TEXTURE_SIZE",function(){return gp(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",function(){return th(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",function(){var _=gr.getNumber("WEBGL_VERSION");return _===0?0:nh(_)}),gr.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",function(){return gr.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&(_=navigator.userAgent||navigator.vendor||window.opera,!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(_)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
34sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(_.substr(0,4))));var _}),gr.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",function(){return Om(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",function(){return!gr.getBool("WEBGL_FORCE_F16_TEXTURES")&&gr.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")}),gr.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",function(){return rh(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_FENCE_API_ENABLED",function(){return vu(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",function(){return gr.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0}),Qr=ah;var zo=Bt({complex_:function(_,m){var f=et(_,"real","complex"),y=et(m,"imag","complex");return Ot(f.shape,y.shape,"real and imag shapes, "+f.shape+" and "+y.shape+", must match in call to tf.complex()."),qe.runKernelFunc(function(E){return E.complex(f,y)},{$real:f,$imag:y})}}),qa=Bt({real_:function(_){var m=et(_,"input","real");return qe.runKernelFunc(function(f){return f.real(m)},{$input:m})}}),Os=Bt({imag_:function(_){var m=et(_,"input","imag");return qe.runKernelFunc(function(f){return f.imag(m)},{$input:m})}});function Qo(_,m,f){return bu(_,m,As(_,f),f)}function bu(_,m,f,y){if(y==null&&(y=xe(_)),y==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!dt(_)&&!Array.isArray(_)&&typeof _!="number"&&typeof _!="boolean"&&typeof _!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(m!=null){Xn(m);var E=Ke(m),z=Ke(f);Ee(E===z,function(){return"Based on the provided shape, ["+m+"], the tensor should have "+E+" values but has "+z});for(var Y=0;Y<f.length;++Y){var Z=f[Y],le=Y!==f.length-1||Z!==Ke(m.slice(Y));Ee(f[Y]===m[Y]||!le,function(){return"Error creating a new Tensor. Inferred shape ("+f+") does not match the provided shape ("+m+"). "})}}return dt(_)||Array.isArray(_)||(_=[_]),m=m||f,_=y!=="string"?cr(_,y,L().getBool("DEBUG")):Mt(_,[],!0),qe.makeTensor(_,m,y)}function Or(_,m){if((dt(_)&&m!=="string"||Array.isArray(_))&&m!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(m==="string"&&dt(_)&&!(_ instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return bu(_,[],[],m)}function Vu(_,m){zt(_);var f=As(_,m);if(f.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return bu(_,null,f,m)}function uc(_,m,f){if(zt(_),m!=null&&m.length!==2)throw new Error("tensor2d() requires shape to have two numbers");var y=As(_,f);if(y.length!==2&&y.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(y.length===1&&m==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return bu(_,m,y,f)}function bf(_,m,f){if(zt(_),m!=null&&m.length!==3)throw new Error("tensor3d() requires shape to have three numbers");var y=As(_,f);if(y.length!==3&&y.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(y.length===1&&m==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return bu(_,m,y,f)}function $u(_,m,f){if(zt(_),m!=null&&m.length!==4)throw new Error("tensor4d() requires shape to have four numbers");var y=As(_,f);if(y.length!==4&&y.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(y.length===1&&m==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return bu(_,m,y,f)}function _p(_,m,f){if(zt(_),m!=null&&m.length!==5)throw new Error("tensor5d() requires shape to have five numbers");var y=As(_,f);if(y.length!==5&&y.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(y.length===1&&m==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return bu(_,m,y,f)}function Mm(_,m,f){if(zt(_),m!=null&&m.length!==6)throw new Error("tensor6d() requires shape to have six numbers");var y=As(_,f);if(y.length!==6&&y.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(y.length===1&&m==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return bu(_,m=m||y,y,f)}function Fm(_,m,f,y){return m===void 0&&(m=!0),qe.makeVariable(_,m,f,y)}function yc(_,m){if(m===void 0&&(m="float32"),m==="complex64"){var f=yc(_,"float32"),y=go(_,"float32");return zo(f,y)}var E=hn(Ke(_),m);return qe.makeTensor(E,_,m)}function go(_,m){if(m===void 0&&(m="float32"),m==="complex64"){var f=go(_,"float32"),y=go(_,"float32");return zo(f,y)}var E=rn(Ke(_),m);return qe.makeTensor(E,_,m)}function xu(_,m,f){return qe.runKernelFunc(function(y){return y.fill(_,m,f)},{})}function kp(_,m,f){if(f<=0)throw new Error("The number of values should be positive.");return qe.runKernelFunc(function(y){return y.linspace(_,m,f)},{})}function kl(_,m,f,y){if(f===void 0&&(f=1),y===void 0&&(y="float32"),f===0)throw new Error("Cannot have a step of zero");if(_===m||_<m&&f<0||m<_&&f>1)return go([0],y);var E=rn(Math.abs(Math.ceil((m-_)/f)),y);m<_&&f===1&&(f=-1),E[0]=_;for(var z=1;z<E.length;z++)E[z]=E[z-1]+f;return Vu(E,y)}var eu=Bt({onesLike_:function(_){var m=et(_,"x","onesLike");if(m.dtype==="complex64"){var f=eu(qa(m)),y=Ei(Os(m));return zo(f,y)}return qe.runKernelFunc(function(E){return E.onesLike(m)},{x:m},function(E,z){return{x:function(){return Ei(E)}}},"OnesLike")}}),Ei=Bt({zerosLike_:function(_){var m=et(_,"x","zerosLike");return qe.runKernelFunc(function(f){return f.zerosLike(m)},{x:m},function(f,y){return{x:function(){return Ei(f)}}},"ZerosLike")}}),va=Bt({concat_:function(_,m){m===void 0&&(m=0),Ee(_.length>=1,function(){return"Pass at least one tensor to concat"});var f=Zc(_,"tensors","concat");f[0].dtype==="complex64"&&f.forEach(function(Z){if(Z.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor 35 with dtype `+Z.dtype+". ")}),m=Vt(m,f[0].shape)[0];var y=sc(f.map(function(Z){return Z.shape}),m);if(Ke(y)===0)return Qo([],y);if((f=f.filter(function(Z){return Z.size>0})).length===1)return f[0];var E=f.map(function(Z){return Z.shape});Hl(E,m);var z=f,Y={axis:m};return qe.runKernelFunc(function(Z){return Z.concat(f,m)},z,function(Z){var le=E.map(function(de){return de[m]});return to(Z,le,m).map(function(de){return function(){return de}})},"Concat",Y)}}),Ep=Bt({concat1d_:function(_){return va(_,0)}}),Rm=Bt({concat2d_:function(_,m){return va(_,m)}}),od=Bt({concat3d_:function(_,m){return va(_,m)}}),Cp=Bt({concat4d_:function(_,m){return va(_,m)}}),to=Bt({split_:function(_,m,f){f===void 0&&(f=0);var y,E=et(_,"x","split");return f=Vt(f,E.shape)[0],typeof m=="number"?(Ee(E.shape[f]%m==0,function(){return"Number of splits must evenly divide the axis."}),y=new Array(m).fill(E.shape[f]/m)):(Ee(E.shape[f]===m.reduce(function(z,Y){return z+Y}),function(){return"The sum of sizes must match the size of the axis dimension."}),y=m),qe.runKernelFunc(function(z){return z.split(E,y,f)},{$x:E},function(z){return{$x:function(){return va(z,f)}}})}});function Li(_,m,f){return m===void 0&&(m="float32"),m=m||"float32",Xn(_),new co(_,m,f)}function za(_,m){m===void 0&&(m=!1),console.log(_.toString(m))}var Bm=Bt({batchToSpaceND_:function(_,m,f){var y=et(_,"x","batchToSpaceND"),E=m.reduce(function(z,Y){return z*Y});return Ee(y.rank>=1+m.length,function(){return"input rank is "+y.rank+" but should be > than blockShape.length "+m.length}),Ee(f.length===m.length,function(){return"crops.length is "+f.length+" but should be equal to blockShape.length "+m.length}),Ee(y.shape[0]%E==0,function(){return"input tensor batch is "+y.shape[0]+" but is not divisible by the product of the elements of blockS
35hape "+m.join(" * ")+" === "+E}),qe.runKernelFunc(function(z){return z.batchToSpaceND(y,m,f)},{$x:y},function(z){return{$x:function(){return z.spaceToBatchND(m,f)}}})}}),Pm=Bt({cast_:function(_,m){var f=et(_,"x","cast");if(!Ye(m))throw new Error("Failed to cast to unknown dtype "+m);if(m==="string"&&f.dtype!=="string"||m!=="string"&&f.dtype==="string")throw new Error("Only strings can be casted to strings");var y={dtype:m};return qe.runKernelFunc(function(E){return E.cast(f,m)},{x:f},function(E){return{x:function(){return E.clone()}}},"Cast",y)}}),jm=Bt({cumsum_:function(_,m,f,y){m===void 0&&(m=0),f===void 0&&(f=!1),y===void 0&&(y=!1);var E=et(_,"x","cumsum"),z=fs([m|=0],E.rank),Y=E;z!=null&&(Y=E.transpose(z));var Z=ds(1,E.rank)[0],le=qe.runKernelFunc(function(de){return de.cumsum(Y,Z,f,y)},{permutedX:Y},function(de){return{permutedX:function(){return de.cumsum(m,f,!y)}}});return z!=null&&(le=le.transpose(z)),le}}),Lg=Bt({depthToSpace_:function(_,m,f){f===void 0&&(f="NHWC");var y=et(_,"x","depthToSpace"),E=f==="NHWC"?y.shape[1]:y.shape[2],z=f==="NHWC"?y.shape[2]:y.shape[3],Y=f==="NHWC"?y.shape[3]:y.shape[1];return Ee(E*m>=0,function(){return`Negative dimension size caused by overflow when multiplying 36 `+E+" and "+m+` for depthToSpace with input shape 37 `+y.shape}),Ee(z*m>=0,function(){return`Negative dimension size caused by overflow when multiplying 38 `+z+" and "+m+` for depthToSpace with input shape 39 `+y.shape}),Ee(Y%(m*m)==0,function(){return"Dimension size must be evenly divisible by "+m*m+" but is "+Y+" for depthToSpace with input shape "+y.shape}),qe.runKernelFunc(function(Z){return Z.depthToSpace(y,m,f)},{$x:y})}}),el=Bt({expandDims_:function(_,m){m===void 0&&(m=0);var f=et(_,"x","expandDims",null);Ee(m<=f.rank,function(){return"Axis must be <= rank of the tensor"});var y=f.shape.slice();return m<0&&(Ee(-(f.rank+1)<=m,function(){return"Axis must be in the interval ["+-(f.rank+1)+", "+f.rank+"]"}),m=f.rank+m+1),y.splice(m,0,1),wu(f,y)}}),wu=Bt({reshape_:function(_,m){var f=et(_,"x","reshape",null);m=Ze(m,f.size),Ee(f.size===Ke(m),function(){return"new shape and old shape must have the same number of elements."});var y={shape:m};return qe.runKernelFunc(function(E){return E.reshape(f,m)},{x:f},function(E){return{x:function(){return E.reshape(f.shape)}}},"Reshape",y)}}),xf=Bt({spaceToBatchND_:function(_,m,f){var y=et(_,"x","spaceToBatchND");return Ee(y.rank>=1+m.length,function(){return"input rank "+y.rank+" should be > than [blockShape] "+m.length}),Ee(f.length===m.length,function(){return"paddings.shape[0] "+f.length+" must be equal to [blockShape] "+m.length}),Ee(y.shape.reduce(function(E,z,Y){return Y>0&&Y<=m.length?E&&(z+f[Y-1][0]+f[Y-1][1])%m[Y-1]==0:E},!0),function(){return"input spatial dimensions "+y.shape.slice(1)+" with paddings "+f.toString()+" must be divisible by blockShapes "+m.toString()}),qe.runKernelFunc(function(E){return E.spaceToBatchND(y,m,f)},{$x:y},function(E){return{$x:function(){return E.batchToSpaceND(m,f)}}})}}),Iu=Bt({squeeze_:function(_,m){var f=et(_,"x","squeeze");return wu(f,sn(f.shape,m).newShape)}}),cc=Bt({stack_:function(_,m){m===void 0&&(m=0);var f=Zc(_,"tensors","stack");if(Ee(f.length>=1,function(){return"Pass at least one tensor to tf.stack"}),f.length===1)return f[0].expandDims(m);var y=f[0].rank,E=f[0].shape,z=f[0].dtype;Ee(m<=y,function(){return"Axis must be <= rank of the tensor"}),f.forEach(function(Z){Ot(E,Z.shape,"All tensors passed to stack must have matching shapes")}),f.forEach(function(Z){Ee(z===Z.dtype,function(){return"All tensors passed to stack must have matching dtypes"})});var Y=f.map(function(Z){return Z.expandDims(m)});return va(Y,m)}}),Sp=Bt({unstack_:function(_,m){m===void 0&&(m=0),m=m||0;var f=et(_,"x","unstack");Ee(m>=-f.shape.length&&m<f.shape.length,function(){return"Axis = "+m+" is not in [-"+f.shape.length+", "+f.shape.length+")"}),m<0&&(m+=f.shape.length);var y={axis:m};return qe.runKernelFunc(function(E){return E.unstack(f,m)},{x:f},function(E){return{x:function(){return cc(E,m)}}},"Unpack",y)}}),Qi=function(_,m){return S(this,void 0,void 0,function(){var f,y,E,z,Y,Z,le,de,we,De;return M(this,function(Ne){switch(Ne.label){case 0:return f=et(_,"x","setdiff1d"),y=et(m,"y","setdiff1d"),Ee(f.dtype===y.dtype,function(){return"x and y should have the same dtype, but got x ("+f.dtype+") and y ("+y.dtype+")."}),Ee(f.rank===1,function(){return"x should be 1D tensor, but got x ("+f.shape+")."}),Ee(y.rank===1,function(){return"y should be 1D tensor, but got y ("+y.shape+")."}),[4,f.data()];case 1:return E=Ne.sent(),[4,y.data()];case 2:for(z=Ne.sent(),Y=new Set(z),Z=0,we=0;we<E.length;we++)Y.has(E[we])||Z++;for(le=new co([Z],f.dtype),de=new co([Z],"int32"),we=0,De=0;we<E.length;we++)Y.has(E[we])||(le.values[De]=E[we],de.values[De]=we,De++);return[2,[le.toTensor(),de.toTensor()]]}})})};function ch(_,m,f,y){y===void 0&&(y=!0);var E=[];if(y)(E=E.concat(m.slice(0))).push(_[0]/f),E=E.concat(_.slice(1));else{E=E.concat(_[0]);for(var z=m.length,Y=0;Y<z;++Y)E=E.concat([_[Y+1]/m[Y],m[Y]]);E=E.concat(_.slice(z+1))}return E}function wf(_,m,f){f===void 0&&(f=!0);var y=[];if(f){y.push(m);for(var E=m+1;E<_;++E)E<=2*m?(y.push(E),y.push(E-(m+1))):y.push(E)}else{var z=[],Y=[];for(E=1;E<_;++E)E>=2*m+1||E%2==1?Y.push(E):z.push(E);y.push.apply(y,z),y.push(0),y.push.apply(y,Y)}return y}function ad(_,m,f,y){y===void 0&&(y=!0);var E=[];y?E.push(_[0]/f):E.push(_[0]*f);for(var z=1;z<_.length;++z)z<=m.length?y?E.push(m[z-1]*_[z]):E.push(_[z]/m[z-1]):E.push(_[z]);return E}function Lm(_,m){for(var f=[0],y=0;y<m;++y)f.push(_[y][0]);return f}function zg(_,m,f){for(var y=_.slice(0,1),E=0;E<f;++E)y.push(_[E+1]-m[E][0]-m[E][1]);return y}var sd="Add",Ap="AddN",ya="Div",Op="FusedBatchNorm",ud="SquaredDifference",D
vendor: 15,652 bytes, line 39
39p="Square",cd="Transpose",_f="NonMaxSuppressionV5",ql="BroadcastTo",Tp="OneHot",lh="Identity",ld="Tile",Gl="PadV2",F0="FromPixels",fd="MaxPoolWithArgmax",Pa=Bt({add_:function(_,m){var f,y=et(_,"a","add"),E=et(m,"b","add");f=Bn(y,E),y=f[0],E=f[1];var z={a:y,b:E};return qe.runKernelFunc(function(Y,Z){var le=Y.add(y,E);return Z([y,E]),le},z,null,sd)}});function hs(_,m){for(var f=_.length,y=[],E=0;E<f;E++){var z=f-1-E,Y=_[z]||1;(m[m.length-1-E]||1)>1&&Y===1&&y.unshift(z)}return y}function bs(_,m){for(var f=[],y=0;y<m.length;y++){var E=_[_.length-y-1],z=m.length-y-1,Y=m[z];(E==null||E===1&&Y>1)&&f.unshift(z)}return f}function no(_,m){for(var f=[],y=Math.max(_.length,m.length),E=0;E<y;E++){var z=_[_.length-E-1];z==null&&(z=1);var Y=m[m.length-E-1];if(Y==null&&(Y=1),z===1)f.unshift(Y);else if(Y===1)f.unshift(z);else{if(z!==Y)throw Error("Operands could not be broadcast together with shapes "+_+" and "+m+".");f.unshift(z)}}return f}var _u=Bt({abs_:function(_){var m=et(_,"x","abs");return m.dtype==="complex64"?qe.runKernelFunc(function(f){return f.complexAbs(m)},{$x:m}):qe.runKernelFunc(function(f,y){var E=f.abs(m);return y([m]),E},{x:m},function(f,y){var E=y[0];return{x:function(){return f.mul(E.toFloat().step(-1))}}},"Abs")}}),Kl=Bt({acos_:function(_){var m=et(_,"x","acos");return qe.runKernelFunc(function(f,y){var E=f.acos(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.divStrict(Or(1).sub(E.toFloat().square()).sqrt()).neg()}}})}}),xs=Bt({acosh_:function(_){var m=et(_,"x","acosh");return qe.runKernelFunc(function(f,y){var E=f.acosh(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.divStrict(E.toFloat().square().sub(1).sqrt())}}})}}),Yl=Bt({asin_:function(_){var m=et(_,"x","asin");return qe.runKernelFunc(function(f,y){var E=f.asin(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.divStrict(Or(1).sub(E.toFloat().square()).sqrt())}}})}}),tl=Bt({asinh_:function(_){var m=et(_,"x","asinh");return qe.runKernelFunc(function(f,y){var E=f.asinh(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.divStrict(Or(1).add(E.toFloat().square()).sqrt())}}})}}),fh=Bt({atan_:function(_){var m=et(_,"x","atan");return qe.runKernelFunc(function(f,y){var E=f.atan(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.div(E.toFloat().square().add(1))}}})}}),dh=Bt({atanh_:function(_){var m=et(_,"x","atanh");return qe.runKernelFunc(function(f,y){var E=f.atanh(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.div(Or(1).sub(E.toFloat().square()))}}})}}),kf=Bt({ceil_:function(_){var m=et(_,"x","ceil");return qe.runKernelFunc(function(f){return f.ceil(m)},{$x:m},function(f){return{$x:function(){return Ei(f)}}})}}),zm=Bt({clipByValue_:function(_,m,f){var y=et(_,"x","clipByValue");Ee(m<=f,function(){return"Error in clip: min ("+m+") must be less than or equal to max ("+f+")."});var E=[y],z={min:m,max:f};return qe.runKernelFunc(function(Y,Z){var le=Y.clip(y,m,f);return Z([y]),le},{x:y},function(Y,Z){var le=Z[0];return{x:function(){return Y.where(le.greaterEqual(m).logicalAnd(le.lessEqual(f)),Ei(Y))}}},"ClipByValue",z,E)}}),nl=Bt({cos_:function(_){var m=et(_,"x","cos"),f=[m];return qe.runKernelFunc(function(y,E){var z=y.cos(m);return E([m]),z},{x:m},function(y,E){var z=E[0];return{x:function(){return z.toFloat().sin().neg().mul(y)}}},"Cos",{},f)}}),R0=Bt({cosh_:function(_){var m=et(_,"x","cosh");return qe.runKernelFunc(function(f,y){var E=f.cosh(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return E.toFloat().sinh().mulStrict(f)}}})}}),Um=Bt({erf_:function(_){var m=et(_,"x","erf");return Ee(m.dtype==="int32"||m.dtype==="float32",function(){return"Input dtype must be `int32` or `float32`."}),m.dtype==="int32"&&(m=m.toFloat()),qe.runKernelFunc(function(f,y){var E=f.erf(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.mul(E.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}})}}),dd=Bt({exp_:function(_){var m=et(_,"x","exp");return qe.runKernelFunc(function(f,y){var E=f.exp(m);return y([E]),E},{x:m},function(f,y){return{x:function(){return f.mulStrict(y[0])}}},"Exp",{},[],[!0])}}),Ug=Bt({expm1_:function(_){var m=et(_,"x","expm1");return qe.runKernelFunc(function(f,y){var E=f.expm1(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.mul(E.exp())}}})}}),hh=Bt({floor_:function(_){var m=et(_,"x","floor");return qe.runKernelFunc(function(f){return f.floor(m)},{$x:m},function(f){return{$x:function(){return Ei(f)}}})}}),Ef=Bt({log_:function(_){var m=et(_,"x","log"),f=[m];return qe.runKernelFunc(function(y,E){var z=y.log(m);return E([m]),z},{x:m},function(y,E){var z=E[0];return{x:function(){return y.div(z.toFloat())}}},"Log",{},f)}}),Wm=Bt({log1p_:function(_){var m=et(_,"x","log1p");return qe.runKernelFunc(function(f,y){var E=f.log1p(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.div(E.add(1))}}})}}),Np=Bt({logSigmoid_:function(_){var m=et(_,"x","logSigmoid");return qe.runKernelFunc(function(f,y){var E=f.softplus(m.neg()).neg();return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.mul(E.neg().sigmoid())}}})}}),os=Bt({neg_:function(_){var m=et(_,"x","neg"),f=[m];return qe.runKernelFunc(function(y){return y.neg(m)},{x:m},function(y){return{x:function(){return y.neg()}}},"Neg",{},f)}}),hd=Bt({reciprocal_:function(_){var m=et(_,"x","reciprocal");return qe.runKernelFunc(function(f,y){var E=f.reciprocal(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.div(E.square().neg())}}})}}),ku=Bt({round_:function(_){var m=et(_,"x","round");return qe.runKernelFunc(function(f){return f.round(m)},{$x:m},function(f){return{$x:function(){return Ei(f)}}})}}),pd=Bt({rsqrt_:function(_){var m=et(_,"x","rsqrt"),f=[m];return qe.runKernelFunc(function(y,E){var z=y.rsqrt(m);return E([m]),z},{x:m},function(y,E){var z=E[0];return{x:function(){return y.div(z.pow(1.5).mul(2)).neg()}}},"Rsqrt",{},f)}}),ph=Bt({sigmoid_:function(_){var m=et(_,"x","sigmoid");return qe.runKernelFunc(function(f,y){var E=f.sigmoid(m);return y([E]),E},{x:m},function(f,y){var E=y[0];return{x:function(){return f.mul(E.mul(Or(1).sub(E)))}}},"Sigmoid")}}),Ip=Bt({sign_:function(_){var m=et(_,"x","sign");return qe.runKernelFunc(function(f){return f.sign(m)},{$x:m},function(f){return{$x:function(){return Ei(f)}}})}}),Vm=Bt({isNaN_:function(_){var m=et(_,"x","isNaN");return qe.runKernelFunc(function(f){return f.isNaN(m)},{$x:m},function(f){return{$x:function(){return Ei(f)}}})}}),mh=Bt({isInf_:function(_){var m=et(_,"x","isInf");return qe.runKernelFunc(function(f){return f.isInf(m)},{$x:m},function(f){return{$x:function(){return Ei(f)}}})}}),md=Bt({isFinite_:function(_){var m=et(_,"x","isFinite");return qe.runKernelFunc(function(f){return f.isFinite(m)},{$x:m},function(f){return{$x:function(){return Ei(f)}}})}}),$m=Bt({sin_:function(_){var m=et(_,"x","sin"),f=[m];return qe.runKernelFunc(function(y,E){var z=y.sin(m);return E([m]),z},{x:m},function(y,E){var z=E[0];return{x:function(){return z.toFloat().cos().mul(y)}}},"Sin",{},f)}}),Hm=Bt({sinh_:function(_){var m=et(_,"x","sinh");return qe.runKernelFunc(function(f,y){var E=f.sinh(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return E.toFloat().cosh().mulStrict(f)}}})}}),gn=Bt({softplus_:function(_){var m=et(_,"x","softplus");return qe.runKernelFunc(function(f,y){var E=f.softplus(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.mul(E.sigmoid())}}})}}),Hu=Bt({sqrt_:function(_){var m=et(_,"x","sqrt");return qe.runKernelFunc(function(f,y){var E=f.sqrt(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.div(E.toFloat().sqrt().mul(2))}}})}}),Yn=Bt({step_:function(_,m){m===void 0&&(m=0);var f=et(_,"x","step");return qe.runKernelFunc(function(y){return y.step(f,m)},{$x:f},function(y){return{$x:function(){return Ei(y)}}})}}),Eu=Bt({tan_:function(_){var m=et(_,"x","tan");return qe.runKernelFunc(function(f,y){var E=f.tan(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return f.div(E.cos().square())}}})}}),Oo=Bt({tanh_:function(_){var m=et(_,"x","tanh");return qe.runKernelFunc(function(f,y){var E=f.tanh(m);return y([E]),E},{x:m},function(f,y){var E=y[0];return{x:function(){return Or(1).sub(E.square()).mulStrict(f)}}},"Tanh",{},null,[!0])}}),gd=Bt({addStrict_:function(_,m){var f=et(_,"a","addStrict"),y=et(m,"b","addStrict");return Ot(f.shape,y.shape,"Error in addStrict: "),f.add(y)}}),gh=Bt({atan2_:function(_,m){var f,y=et(_,"a","atan2"),E=et(m,"b","atan2");f=Bn(y,E),y=f[0],E=f[1];var z=no(y.shape,E.shape);return qe.runKernelFunc(function(Y,Z){var le=Y.atan2(y,E);return Z([y,E]),le},{$a:y,$b:E},function(Y,Z){var le=Z[0],de=Z[1];return{$a:function(){var we=Pa(le.square(),de.square()),De=Y.mul(de.div(we)),Ne=bs(le.shape,z);return Ne.length>0&&(De=De.sum(Ne)),De.reshape(le.shape)},$b:function(){var we=Pa(le.square(),de.square()),De=os(Y.mul(le.div(we))),Ne=bs(de.shape,z);return Ne.length>0&&(De=De.sum(Ne)),De.reshape(de.shape)}}})}}),fr=Bt({divStrict_:function(_,m){var f=et(_,"a","div"),y=et(m,"b","div");return Ot(f.shape,y.shape,"Error in divideStrict: "),f.div(y)}}),js=Bt({floorDiv_:function(_,m){var f,y=et(_,"a","floorDiv"),E=et(m,"b","floorDiv");f=Bn(y,E),y=f[0],E=f[1];var z=no(y.shape,E.shape);return qe.runKernelFunc(function(Y,Z){var le=Y.floorDiv(y,E);return Z([y,E]),le},{a:y,b:E},function(Y,Z){var le=Z[0],de=Z[1];return{a:function(){var we=Y.div(de.toFloat()),De=bs(le.shape,z);return De.length>0?we.sum(De).reshape(le.shape):we},b:function(){var we=Y.mul(le.toFloat()),De=bs(de.shape,z);De.length>0&&(we=we.sum(De).reshape(de.shape));var Ne=de.square();return we.div(Ne.toFloat()).neg()}}},"FloorDiv")}}),as=Bt({maximum_:function(_,m){var f,y=et(_,"a","maximum"),E=et(m,"b","maximum");return f=Bn(y,E),y=f[0],E=f[1],y.dtype==="bool"&&(y=y.toInt(),E=E.toInt()),no(y.shape,E.shape),qe.runKernelFunc(function(z,Y){var Z=z.maximum(y,E);return Y([y,E]),Z},{a:y,b:E},function(z,Y){var Z=Y[0],le=Y[1];return{a:function(){return z.mul(Z.greaterEqual(le).toFloat())},b:function(){return z.mul(Z.less(le).toFloat())}}},"Maximum")}}),ho=Bt({maximumStrict_:function(_,m){var f=et(_,"a","maximumStrict"),y=et(m,"b","maximumStrict");return Ot(f.shape,y.shape,"Error in maximumStrict: "),f.maximum(y)}}),Mc=Bt({minimum_:function(_,m){var f,y=et(_,"a","minimum"),E=et(m,"b","minimum");return f=Bn(y,E),y=f[0],E=f[1],y.dtype==="bool"&&(y=y.toInt(),E=E.toInt()),no(y.shape,E.shape),qe.runKernelFunc(function(z,Y){var Z=z.minimum(y,E);return Y([y,E]),Z},{a:y,b:E},function(z,Y){var Z=Y[0],le=Y[1];return{a:function(){return z.mul(Z.lessEqual(le).toFloat())},b:function(){return z.mul(Z.greater(le).toFloat())}}},"Minimum")}}),El=Bt({minimumStrict_:function(_,m){var f=et(_,"a","minimumStrict"),y=et(m,"b","minimumStrict");return Ot(f.shape,y.shape,"Error in minimumStrict: "),f.minimum(y)}}),qu=Bt({mod_:function(_,m){var f,y=et(_,"a","mod"),E=et(m,"b","mod");f=Bn(y,E),y=f[0],E=f[1];var z=no(y.shape,E.shape);return qe.runKernelFunc(function(Y,Z){var le=Y.mod(y,E);return Z([y,E]),le},{$a:y,$b:E},function(Y,Z){var le=Z[0],de=Z[1];return{$a:function(){var we=bs(le.shape,z);return we.length>0?Y.sum(we).reshape(le.shape):Y},$b:function(){var we=Y.mul(le.div(de).floor().neg()),De=bs(de.shape,z);return De.length>0?we.sum(De).reshape(de.shape):we}}})}}),Cl=Bt({modStrict_:function(_,m){var f=et(_,"a","modStrict"),y=et(m,"b","modStrict");return Ot(f.shape,y.shape,"Error in modStrict: "),f.mod(y)}}),Oa=Bt({mul_:function(_,m){var f,y=et(_,"a","mul"),E=et(m,"b","mul");f=Bn(y,E),y=f[0],E=f[1];var z=no(y.shape,E.shape);return qe.runKernelFunc(function(Y,Z){var le=Y.multiply(y,E);return Z([y,E]),le},{a:y,b:E},function(Y,Z){var le=Z[0],de=Z[1];return{a:function(){var we=Y.mul(de.toFloat()),De=bs(le.shape,z);return De.length>0?we.sum(De).reshape(le.shape):we},b:function(){var we=Y.mul(le.toFloat()),De=bs(de.shape,z);return De.length>0?we.sum(De).reshape(de.shape):we}}},"Mul")}}),rl=Bt({mulStrict_:function(_,m){var f=et(_,"a","mul"),y=et(m,"b","mul");return Ot(f.shape,y.shape,"Error in multiplyStrict: "),f.mul(y)}}),Gu=Bt({pow_:function(_,m){var f,y=et(_,"base","pow"),E=et(m,"exp","pow");f=Bn(y,E),y=f[0],E=f[1];var z=no(y.shape,E.shape),Y=[y,E];return qe.runKernelFunc(function(Z,le){var de=Z.pow(y,E);return le([y,E,de]),de},{a:y,b:E},function(Z,le){var de=le[0],we=le[1],De=le[2];return{a:function(){var Ne=we.toFloat(),Fe=Z.mul(Ne.mul(de.pow(Ne.sub(Or(1))))),Ve=bs(de.shape,z);return Ve.length>0&&(Fe=Fe.sum(Ve)),Fe.reshape(de.shape)},b:function(){var Ne=de.greater(0),Fe=de.log().where(Ne,Ei(de)),Ve=Z.mul(De.mul(Fe)),Je=bs(we.shape,z);return Je.length>0&&(Ve=Ve.sum(Je)),Ve.reshape(we.shape)}}},"Pow",{},Y,[!0])}}),Mo=Bt({powStrict_:function(_,m){return Ot(_.shape,m.shape,"Error in powStrict: "),_.pow(m)}}),tu=Bt({squaredDifferenceStrict_:function(_,m){var f=et(_,"a","squaredDifferenceStrict"),y=et(m,"b","squaredDifferenceStrict");return Ot(f.shape,y.shape,"Error in squaredDifferenceStrict: "),f.squaredDifference(y)}}),ps=Bt({sub_:function(_,m){var f,y=et(_,"a","sub"),E=et(m,"b","sub");f=Bn(y,E),y=f[0],E=f[1];var z=no(y.shape,E.shape);return qe.runKernelFunc(function(Y){return Y.subtract(y,E)},{a:y,b:E},function(Y){return{a:function(){var Z=Y,le=bs(y.shape,z);return le.length>0&&(Z=Z.sum(le)),Z.reshape(y.shape)},b:function(){var Z=Y,le=bs(E.shape,z);return le.length>0&&(Z=Z.sum(le)),Z.neg().reshape(E.shape)}}},"Sub")}}),nu=Bt({subStrict_:function(_,m){var f=et(_,"a","subStrict"),y=et(m,"b","subStrict");return Ot(f.shape,y.shape,"Error in subStrict: "),f.sub(y)}}),Da=Bt({div_:function(_,m){var f,y=et(_,"a","div"),E=et(m,"b","div");if(f=Bn(y,E),y=f[0],E=f[1],y.dtype==="int32"&&E.dtype==="int32")return js(y,E);var z={a:y,b:E};return qe.runKernelFunc(function(Y,Z){var le=Y.realDivide(y,E);return Z([y,E]),le},z,null,ya,{})}});function Ku(_,m){if(_.rank<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher, but the rank was "+_.rank+".");if(m.rank<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher, but the rank was "+m.rank+".");if(m.dtype!=="int32")throw new Error("tf.gatherND() expects the indices to be int32 type, but the dtype was "+m.dtype+".");if(m.shape[m.rank-1]>_.rank)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+m.shape[m.rank-1]+" vs. "+_.rank);if(_.size===0)throw new Error("Requested more than 0 entries, but input is empty. Input shape: "+_.shape+".");for(var f=m.shape,y=f[f.length-1],E=1,z=0;z<f.length-1;++z)E*=f[z];var Y=_.shape,Z=f.slice();Z.pop();var le=1;for(z=y;z<_.rank;++z)le*=Y[z],Z.push(Y[z]);var de=ar(_.shape).map(function(we){return we/le}).concat([1]).slice(0,y);return[Z,E,le,de]}var Fc=Object.freeze({prepareAndValidate:Ku}),il=30;function Sl(_){return _<=il?_:nr(_,Math.floor(Math.sqrt(_)))}function Rc(_,m,f){var y=m.rank>1?m.shape[m.rank-1]:1,E=m.rank>1?m.rank-1:1,z="Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: "+f.shape+", indices.shape: "+m.shape+", shape: "+_+", sliceDim: "+y+", and batchDim: "+E+".";if(f.rank<E)throw new Error(z+" update.rank < "+E+". ");if(_.length<y+(f.rank-E))throw new Error(z+" Output shape length < "+(y+(f.rank-E)));if(f.rank!==E+_.length-y)throw new Error(z+" update.rank != "+(E+_.length-y));for(var Y=0;Y<E;++Y)if(f.shape[Y]!==m.shape[Y])throw new Error(z+" updates.shape["+Y+"] ("+f.shape[Y]+") != indices.shape["+Y+"] ("+m.shape[Y]+").");for(Y=0;Y<f.rank-E;
39++Y)if(f.shape[Y+E]!==_[Y+y])throw new Error(z+" updates.shape["+(Y+E)+"] ("+f.shape[Y+E]+") != shape["+(Y+E)+"] ("+_[Y+E]+")")}function Cf(_,m,f){if(m.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher, but the rank was "+m.rank+".");if(_.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher, but the rank was "+_.rank+".");if(m.dtype!=="int32")throw new Error("The dtype of 'indices' should be int32, but got dtype: "+m.dtype);if(f.length<1)throw new Error("Output rank must be greater or equal to 1, but got shape: "+f);if(f.length===0){if(m.size===0)throw new Error("Indices specified for empty output. indices shape: "+m.shape);if(_.size===0)throw new Error("Updates specified for empty output. updates shape: "+_.shape)}Rc(f,m,_)}function Sf(_,m,f){for(var y=m.shape.length,E=y>1?m.shape[y-1]:1,z=f.length,Y=1,Z=E;Z<z;++Z)Y*=f[Z];var le=E<1?1:E;return{sliceRank:E,numUpdates:Ke(m.shape)/le,sliceSize:Y,strides:ar(f.slice(0,E)).concat([1]),outputSize:Ke(f)}}var Mp=Object.freeze({validateUpdateShape:Rc,validateInput:Cf,calculateShapes:Sf});function Af(_,m,f){Ee(_.rank===m.length,function(){return"Error in slice"+_.rank+"D: Length of begin "+m+" must match the rank of the array ("+_.rank+")."}),Ee(_.rank===f.length,function(){return"Error in slice"+_.rank+"D: Length of size "+f+" must match the rank of the array ("+_.rank+")."});for(var y=function(z){Ee(m[z]+f[z]<=_.shape[z],function(){return"Error in slice"+_.rank+"D: begin["+z+"] + size["+z+"] ("+(m[z]+f[z])+") would overflow input.shape["+z+"] ("+_.shape[z]+")"})},E=0;E<_.rank;++E)y(E)}function Yu(_){for(var m=[],f=0;_>0;)1&_&&m.push(f),_/=2,f++;return m}function Bc(_,m,f){for(var y=[],E=0;E<_.length;E++)y[E]=Math.ceil((m[E]-_[E])/f[E]);return y}function Pc(_,m,f,y,E){var z=m[E],Y=f[E]||1;(_&1<<E||z==null)&&(z=Y>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var Z=y[E];return z<0&&(z+=Z),ht(0,z,Z-1)}function lc(_,m,f,y,E){var z=m[E],Y=f[E]||1;(_&1<<E||z==null)&&(z=Y>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var Z=y[E];return z<0&&(z+=Z),Y>0?ht(0,z,Z):ht(-1,z,Z-1)}function Fp(_,m,f){for(var y=f.length,E=0;E<f.length;E++)if(f[E]>1){y=E;break}for(E=y+1;E<f.length;E++)if(m[E]>0||f[E]!==_[E])return!1;return!0}function vh(_,m){for(var f=_.length>0?_[_.length-1]:1,y=0;y<_.length-1;y++)f+=_[y]*m[y];return f}var yh=Object.freeze({assertParamsValid:Af,maskToAxes:Yu,computeOutShape:Bc,startForAxis:Pc,stopForAxis:lc,isSliceContinous:Fp,computeFlatOffset:vh});function vd(_){return Ee(jn(_),function(){return"The f passed in grad(f) must be a function"}),function(m,f){var y=et(m,"x","tf.grad",null),E=f!=null?et(f,"dy","tf.grad"):null;return qe.tidy(function(){var z=qe.gradients(function(){return _(y)},[y],E),Y=z.value,Z=z.grads;return E!=null&&Ot(Y.shape,E.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),ue(Z),Z[0]})}}function bh(_){return Ee(jn(_),function(){return"The f passed in grads(f) must be a function"}),function(m,f){Ee(Array.isArray(m),function(){return"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"});var y=Zc(m,"args","tf.grads",null),E=f!=null?et(f,"dy","tf.grads"):null;return qe.tidy(function(){var z=qe.gradients(function(){return _.apply(void 0,y)},y,E),Y=z.value,Z=z.grads;return E!=null&&Ot(Y.shape,E.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),ue(Z),Z})}}function ae(_){return Ee(jn(_),function(){return"The f passed in valueAndGrad(f) must be a function"}),function(m,f){Ee(m instanceof Zt,function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"}),Ee(f==null||f instanceof Zt,function(){return"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"});var y=qe.gradients(function(){return _(m)},[m],f),E=y.grads,z=y.value;return ue(E),{grad:E[0],value:z}}}function ne(_){return Ee(jn(_),function(){return"The f passed in valueAndGrads(f) must be a function"}),function(m,f){Ee(Array.isArray(m)&&m.every(function(E){return E instanceof Zt}),function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"}),Ee(f==null||f instanceof Zt,function(){return"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"});var y=qe.gradients(function(){return _.apply(void 0,m)},m,f);return f!=null&&Ot(y.value.shape,f.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),ue(y.grads),y}}function B(_,m){Ee(jn(_),function(){return"The f passed in variableGrads(f) must be a function"}),Ee(m==null||Array.isArray(m)&&m.every(function(we){return we instanceof St}),function(){return"The varList passed in variableGrads(f, varList) must be an array of variables"});var f=m!=null;if(!f)for(var y in m=[],qe.registeredVariables)m.push(qe.registeredVariables[y]);var E=f?m.filter(function(we){return!we.trainable}):null,z=m.length;Ee((m=m.filter(function(we){return we.trainable})).length>0,function(){return"variableGrads() expects at least one of the input variables to be trainable, but none of the "+z+" variables is trainable."});var Y=qe.gradients(_,m,null,!0),Z=Y.value,le=Y.grads;Ee(le.some(function(we){return we!=null}),function(){return"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."}),Ee(Z.rank===0,function(){return"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+Z.rank+" tensor"});var de={};return m.forEach(function(we,De){le[De]!=null&&(de[we.name]=le[De])}
vendor: 4,909 bytes, lines 39-40
39),E!=null&&E.forEach(function(we){return de[we.name]=null}),{value:Z,grads:de}}function H(_){return qe.customGrad(_)}function ue(_){if(_.filter(function(m){return m==null}).length>0)throw new Error(`Cannot compute gradient of y=f(x) with respect to x. Make sure that 40 the f you passed encloses all operations that lead from x to y.`)}var Le=Bt({softmax_:function(_,m){m===void 0&&(m=-1);var f=et(_,"logits","softmax","float32");if(m===-1&&(m=f.rank-1),m!==f.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. Logits was rank "+f.rank+" and dim was "+m);return qe.runKernelFunc(function(y,E){var z=y.softmax(f,m);return E([z]),z},{logits:f},function(y,E){var z=E[0],Y=y.mul(z);return{logits:function(){return Y.sub(Y.sum([m],!0).mul(z))}}},"Softmax",{dim:m},[],[!0])}}),Qe=Bt({logSoftmax_:function(_,m){m===void 0&&(m=-1);var f=et(_,"logits","logSoftmax");if(m===-1&&(m=f.rank-1),m!==f.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. Logits was rank "+f.rank+" and axis was "+m);return H(function(y,E){var z=y.max(m,!0),Y=y.sub(z),Z=Y.toFloat().sub(Y.exp().sum(m,!0).log());return E([Z]),{value:Z,gradFunc:function(le,de){var we=de[0].exp();return le.sub(le.sum(m,!0).mul(we))}}})(f)}}),wt=Bt({transpose_:function(_,m){var f=et(_,"x","transpose");if(m==null&&(m=f.shape.map(function(E,z){return z}).reverse()),Ee(f.rank===m.length,function(){return"Error in transpose: rank of input "+f.rank+" must match length of perm "+m+"."}),m.forEach(function(E){Ee(E>=0&&E<f.rank,function(){return"All entries in 'perm' must be between 0 and "+(f.rank-1)+" but got "+m})}),f.rank<=1)return f.clone();var y={perm:m};return qe.runKernelFunc(function(E){return E.transpose(f,m)},{x:f},null,"Transpose",y)}}),qt=function(){function _(m,f){this.backend=m,this.dataMover=f,this.data=new WeakMap,this.dataIdsCount=0}return _.prototype.get=function(m){return this.data.has(m)||this.dataMover.moveData(this.backend,m),this.data.get(m)},_.prototype.set=function(m,f){this.dataIdsCount++,this.data.set(m,f)},_.prototype.has=function(m){return this.data.has(m)},_.prototype.delete=function(m){return this.dataIdsCount--,this.data.delete(m)},_.prototype.numDataIds=function(){return this.dataIdsCount},_}(),en=function(){function _(){}return _.prototype.time=function(m){return gt("time")},_.prototype.read=function(m){return gt("read")},_.prototype.readSync=function(m){return gt("readSync")},_.prototype.numDataIds=function(){return gt("numDataIds")},_.prototype.disposeData=function(m){return gt("disposeData")},_.prototype.write=function(m,f,y){return gt("write")},_.prototype.move=function(m,f,y,E){return gt("move")},_.prototype.memory=function(){return gt("memory")},_.prototype.floatPrecision=function(){return gt("floatPrecision")},_.prototype.epsilon=function(){return this.floatPrecision()===32?1e-7:1e-4},_.prototype.batchMatMul=function(m,f,y,E){return gt("batchMatMul")},_.prototype.fusedBatchMatMul=function(m){return m.a,m.b,m.transposeA,m.transposeB,m.bias,m.activation,m.preluActivationWeights,gt("fusedBatchMatMul")},_.prototype.slice=function(m,f,y){return gt("slice")},_.prototype.stridedSlice=function(m,f,y,E){return gt("stridedSlice")},_.prototype.unstack=function(m,f){return gt("unstack")},_.prototype.reverse=function(m,f){return gt("reverse")},_.prototype.concat=function(m,f){return gt("concat")},_.prototype.neg=function(m){return gt("neg")},_.prototype.add=function(m,f){return gt("add")},_.prototype.addN=function(m){return gt("addN")},_.prototype.subtract=function(m,f){return gt("subtract")},_.prototype.multiply=function(m,f){return gt("multiply")},_.prototype.realDivide=function(m,f){return gt("realDivide")},_.prototype.floorDiv=function(m,f){return gt("floorDiv")},_.prototype.sum=function(m,f){return gt("sum")},_.prototype.prod=function(m,f){return gt("prod")},_.prototype.unsortedSegmentSum=function(m,f,y){return gt("unsortedSegmentSum")},_.prototype.argMin=function(m,f){return gt("argMin")},_.prototype.argMax=function(m,f){return gt("argMax")},_.prototype.equal=function(m,f){return gt("equal")},_.prototype.notEqual=function(m,f){return gt("notEqual")},_.prototype.less=function(m,f){return gt("less")},_.prototype.lessEqual=function(m,f){return gt("lessEqual")},_.prototype.greater=function(m,f){return gt("greater")},_.prototype.greaterEqual=function(m,f){return gt("greaterEqual")},_.prototype.logicalNot=function(m){return gt("logicalNot")},_.prototype.logicalAnd=function(m,f){return gt("logicalAnd")},_.prototype.logicalOr=function(m,f){return gt("logicalOr")},_.prototype.where=function(m){return gt("where")},_.prototype.select=function(m,f,y){return gt("select")},_.prototype.topk=function(m,f,y){return gt("topk")},_.prototype.min=function(m,f){return gt("min")},_.prototype.minimum=function(m,f){return gt("minimum")},_.prototype.mod=function(m,f){return gt("mod")},_.prototype.max=function(m,f){return gt("max")}
40,_.prototype.maximum=function(m,f){return gt("maximum")},_.prototype.all=function(m,f){return gt("all")},_.prototype.any=function(m,f){return gt("any")},_.prototype.squaredDifference=function(m,f){return gt("squaredDifference")},_.prototype.ceil=function(m){return gt("ceil")},_.prototype.floor=function(m){return gt("floor")},_.prototype.round=function(m){return gt("round")},_.prototype.sign=function(m){return gt("sign")},_.prototype.isNaN=function(m){return gt("isNaN")},_.prototype.isInf=function(m){return gt("isInf")},_.prototype.isFinite=function(m){return gt("isFinite")},_.prototype.pow=function(m,f){return gt("pow")},_.prototype.exp=function(m){return gt("exp")},_.prototype.expm1=function(m){return gt("expm1")},_.prototype.softmax=function(m,f){return gt("softmax")},_.prototype.log=function(m){return gt("log")},_.prototype.log1p=function(m){return gt("log1p")},_.prototype.sqrt=function(m){return gt("sqrt")},_.prototype.rsqrt=function(m){return gt("rsqrt")},_.prototype.square=function(m){return gt("square")},_.prototype.reciprocal=function(m){return gt("reciprocal")},_.prototype.relu=function(m){return gt("relu")},_.prototype.relu6=function(m){return gt("relu6")},_.prototype.prelu=function(m,f){return gt("prelu")},_.prototype.elu=function(m){return gt("elu")},_.prototype.eluDer=function(m,f){return gt("eluDer")},_.prototype.selu=function(m){return gt("selu")},_.prototype.int=function(m){return gt("int")},_.prototype.clip=function(m,f,y){return gt("clip")},_.prototype.abs=function(m){return gt("abs")},_.prototype.complexAbs=function(m){return gt("complexAbs")},_.prototype.sigmoid=function(m){return gt("sigmoid")},_.prototype.softplus=function(m){return gt("softplus")},_.prototype.sin=function(m){return gt("sin")},_.prototype.cos=function(m){return gt("cos")},_.prototype.tan=function(m){return gt("tan")},_.prototype.asin=function(m){return gt("asin")},_.prototype.acos=function(m){return gt("acos")},_.prototype.atan=function(m){return gt("atan")},_.prototype.atan2=function(m,f){return gt("atan2")},_.prototype.sinh=function(m){return gt("sinh")},_.prototype.cosh=function(m){return gt("cosh")},_.prototype.tanh=function(m){return gt("tanh")},_.prototype.asinh=function(m){return gt("asinh")},_.prototype.acosh=function(m){return gt("acosh")},_.prototype.atanh=function(m){return gt("atanh")},_.prototype.erf=function(m){return gt("erf")},_.prototype.step=function(m,f){return gt("step")},_.prototype.fusedConv2d=function(m){return m.input,m.filter,m.convInfo,m.bias,m.activation,m.preluActivationWeights,gt("fusedConv2d")},_.prototype.conv2d=function(m,f,y){return gt("conv2d")},_.prototype.conv2dDerInput=function(m,f,y){return gt("conv2dDerInput")},_.prototype.conv2dDerFilter=function(m,f,y){return gt("conv2dDerFilter")},_.prototype.fusedDepthwiseConv2D=function(m){return m.input,m.filter,m.convInfo,m.bias,m.activation,m.preluActivationWeights,gt("fusedDepthwiseConv2D")},_.prototype.depthwiseConv2D=function(m,f,y){return gt("depthwiseConv2D")},_.prototype.depthwiseConv2DDerInput=function(m,f,y){return gt("depthwiseConv2DDerInput")},_.prototype.depthwiseConv2DDerFilter=function(m,f,y){return gt("depthwiseConv2DDerFilter")},_.prototype.conv3d=function(m,f,y){return gt("conv3d")},_.prototype.conv3dDerInput=function(m,f,y){return gt("conv3dDerInput")},_.prototype.conv3dDerFilter=function(m,f,y){return gt("conv3dDerFilter")},_.prototype.maxPool=function(m,f){return gt("maxPool")},_.prototype.maxPoolBackprop=function(m,f,y,E){return gt("maxPoolBackprop")},_.prototype.avgPool=function(m,f){return gt("avgPool")},_.prototype.avgPoolBackprop=function(m,f,y){return gt("avgPoolBackprop")},_.prototype.avgPool3d=function(m,f){return gt("avgPool3d")},_.prototype.avgPool3dBackprop=function(m,f,y){return gt("avgPool3dBackprop")},_.prototype.maxPool3d=function(m,f){return gt("maxPool3d")},_.prototype.maxPool3dBackprop=function(m,f,y,E){return gt("maxPool3dBackprop")},_.prototype.reshape=function(m,f){return gt("reshape")},_.prototype.cast=function(m,f){return gt("cast")},_.prototype.tile=function(m,f){return gt("tile")},_.prototype.pad=function(m,f,y){return gt("pad")},_.prototype.transpose=function(m,f){return gt("transpose")},_.prototype.gather=function(m,f,y){return gt("gather")},_.prototype.gatherND=function(m,f){return gt("gatherND")},_.prototype.scatterND=function(m,f,y){return gt("scatterND")},_.prototype.batchToSpaceND=function(m,f,y){return gt("batchToSpaceND")},_.prototype.spaceToBatchND=function(m,f,y){return gt("spaceToBatchND")}
vendor: 13,520 bytes, lines 40-76
40,_.prototype.resizeBilinear=function(m,f,y,E){return gt("resizeBilinear")},_.prototype.resizeBilinearBackprop=function(m,f,y){return gt("resizeBilinearBackprop")},_.prototype.resizeNearestNeighbor=function(m,f,y,E){return gt("resizeNearestNeighbor")},_.prototype.resizeNearestNeighborBackprop=function(m,f,y){return gt("resizeNearestNeighborBackprop")},_.prototype.batchNormalization=function(m,f,y,E,z,Y){return gt("batchNormalization")},_.prototype.localResponseNormalization4D=function(m,f,y,E,z){return gt("localResponseNormalization4D")},_.prototype.LRNGrad=function(m,f,y,E,z,Y,Z){return gt("LRNGrad")},_.prototype.multinomial=function(m,f,y,E){return gt("multinomial")},_.prototype.oneHot=function(m,f,y,E){return gt("oneHot")},_.prototype.cumsum=function(m,f,y,E){return gt("cumsum")},_.prototype.nonMaxSuppression=function(m,f,y,E,z){return gt("nonMaxSuppression")},_.prototype.fft=function(m){return gt("fft")},_.prototype.ifft=function(m){return gt("ifft")},_.prototype.complex=function(m,f){return gt("complex")},_.prototype.real=function(m){return gt("real")},_.prototype.imag=function(m){return gt("imag")},_.prototype.cropAndResize=function(m,f,y,E,z,Y){return gt("cropAndResize")},_.prototype.depthToSpace=function(m,f,y){return gt("depthToSpace")},_.prototype.split=function(m,f,y){return gt("split")},_.prototype.sparseToDense=function(m,f,y,E){return gt("sparseToDense")},_.prototype.diag=function(m){return gt("diag")},_.prototype.fill=function(m,f,y){return gt("fill")},_.prototype.onesLike=function(m){return gt("onesLike")},_.prototype.zerosLike=function(m){return gt("zerosLike")},_.prototype.linspace=function(m,f,y){return gt("linspace")},_.prototype.dispose=function(){return gt("dispose")},_}();function gt(_){throw new Error("'"+_+"' not yet implemented or not found in the registry. Did you forget to import the kernel?")}function Tn(_,m,f,y,E,z,Y){Y===void 0&&(Y="channelsLast");var Z,le=lr(m),de=le[0],we=le[1];if(Y==="channelsLast")Z=[de,we,_[3],_[3]];else{if(Y!=="channelsFirst")throw new Error("Unknown dataFormat "+Y);Z=[de,we,_[1],_[1]]}return zn(_,Z,f,y,E,z,!1,Y)}function Pn(_,m,f,y,E,z,Y){Y===void 0&&(Y="NDHWC");var Z,le,de=dr(m),we=de[0],De=de[1],Ne=de[2];if(Y==="NDHWC")le="channelsLast",Z=[we,De,Ne,_[4],_[4]];else{if(Y!=="NCDHW")throw new Error("Unknown dataFormat "+Y);le="channelsFirst",Z=[we,De,Ne,_[1],_[1]]}return Jn(_,Z,f,y,E,!1,le,z)}function zn(_,m,f,y,E,z,Y,Z){Y===void 0&&(Y=!1),Z===void 0&&(Z="channelsLast");var le=[-1,-1,-1,-1],de=le[0],we=le[1],De=le[2],Ne=le[3];if(Z==="channelsLast")de=_[0],we=_[1],De=_[2],Ne=_[3];else{if(Z!=="channelsFirst")throw new Error("Unknown dataFormat "+Z);de=_[0],Ne=_[1],we=_[2],De=_[3]}var Fe,Ve=m[0],Je=m[1],Xe=m[3],ot=lr(f),xt=ot[0],kt=ot[1],At=lr(y),Lt=At[0],tn=At[1],ln=Tr(Ve,Lt),nn=Tr(Je,tn),cn=function(ur,vr,kr,yr,mr,jr,Pr,ei){var pi,Mi,Ro;if(typeof ur=="number"){pi={top:ur,bottom:ur,left:ur,right:ur,type:ur===0?"VALID":"NUMBER"};var Bo=function(vo,ea,_a,dc,Ru){dc==null&&(dc=Vn(vo,ea,_a));var Bu=vo[1],rm=Hr((vo[0]-ea+2*dc)/_a+1,Ru);Ee(vt(rm),function(){return"The output # of rows ("+rm+") must be an integer. Change the stride and/or zero pad parameters"});var im=Hr((Bu-ea+2*dc)/_a+1,Ru);return Ee(vt(im),function(){return"The output # of columns ("+im+") must be an integer. Change the stride and/or zero pad parameters"}),[rm,im]}([vr,kr],jr,yr,ur,ei);Mi=Bo[0],Ro=Bo[1]}else if(ur==="same"){Mi=Math.ceil(vr/yr),Ro=Math.ceil(kr/mr);var Zo=Math.max(0,(Mi-1)*yr+jr-vr),Jo=Math.max(0,(Ro-1)*mr+Pr-kr),ma=Math.floor(Zo/2),Fa=Zo-ma,Es=Math.floor(Jo/2);pi={top:ma,bottom:Fa,left:Es,right:Jo-Es,type:"SAME"}}else{if(ur!=="valid")throw Error("Unknown padding parameter: "+ur);pi={top:0,bottom:0,left:0,right:0,type:"VALID"},Mi=Math.ceil((vr-jr+1)/yr),Ro=Math.ceil((kr-Pr+1)/mr)}return{padInfo:pi,outHeight:Mi,outWidth:Ro}}(E,we,De,xt,kt,ln,nn,z),Dn=cn.padInfo,Rn=cn.outHeight,Mn=cn.outWidth,tr=Y?Xe*Ne:Xe;return Z==="channelsFirst"?Fe=[de,tr,Rn,Mn]:Z==="channelsLast"&&(Fe=[de,Rn,Mn,tr]),{batchSize:de,dataFormat:Z,inHeight:we,inWidth:De,inChannels:Ne,outHeight:Rn,outWidth:Mn,outChannels:tr,padInfo:Dn,strideHeight:xt,strideWidth:kt,filterHeight:Ve,filterWidth:Je,effectiveFilterHeight:ln,effectiveFilterWidth:nn,dilationHeight:Lt,dilationWidth:tn,inShape:_,outShape:Fe,filterShape:m}}function Jn(_,m,f,y,E,z,Y,Z){z===void 0&&(z=!1),Y===void 0&&(Y="channelsLast");var le=[-1,-1,-1,-1,-1],de=le[0],we=le[1],De=le[2],Ne=le[3],Fe=le[4];if(Y==="channelsLast")de=_[0],we=_[1],De=_[2],Ne=_[3],Fe=_[4];else{if(Y!=="channelsFirst")throw new Error("Unknown dataFormat "+Y);de=_[0],Fe=_[1],we=_[2],De=_[3],Ne=_[4]}var Ve,Je=m[0],Xe=m[1],ot=m[2],xt=m[4],kt=dr(f),At=kt[0],Lt=kt[1],tn=kt[2],ln=dr(y),nn=ln[0],cn=ln[1],Dn=ln[2],Rn=Tr(Je,nn),Mn=Tr(Xe,cn),tr=Tr(ot,Dn),ur=function(Pr,ei,pi,Mi,Ro,Bo,Zo,Jo,ma,Fa,Es){var vo,ea,_a,dc;if(typeof Pr=="number"){vo={top:Pr,bottom:Pr,left:Pr,right:Pr,front:Pr,back:Pr,type:Pr===0?"VALID":"NUMBER"};var Ru=function(Ny,xg,MA,Lb,am,X2){am==null&&(am=Vn(Ny,xg,Lb));var FA=Ny[1],RA=Ny[2],J2=Hr((Ny[0]-xg+2*am)/Lb+1,X2);Ee(vt(J2),function(){return"The output # of depths ("+J2+") must be an integer. Change the stride and/or zero pad parameters"});var Q2=Hr((FA-xg+2*am)/Lb+1,X2);Ee(vt(Q2),function(){return"The output # of rows ("+Q2+") must be an integer. Change the stride and/or zero pad parameters"});var Z2=Hr((RA-xg+2*am)/Lb+1,X2);return Ee(vt(Z2),function(){return"The output # of columns ("+Z2+") must be an integer. Change the stride and/or zero pad parameters"}),[J2,Q2,Z2,1]}([ei,pi,Mi,1],Jo,0,Ro,Pr,Es);ea=Ru[0],_a=Ru[1],dc=Ru[2]}else if(Pr==="same"){var Bu=((ea=Math.ceil(ei/Ro))-1)*Ro+Jo-ei,rm=((_a=Math.ceil(pi/Bo))-1)*Bo+ma-pi,im=((dc=Math.ceil(Mi/Zo))-1)*Zo+Fa-Mi,bg=Math.floor(Bu/2),kc=Bu-bg,lv=Math.floor(rm/2),Ty=rm-lv,om=Math.floor(im/2);vo={top:lv,bottom:Ty,left:om,right:im-om,front:bg,back:kc,type:"SAME"}}else{if(Pr!=="valid")throw Error("Unknown padding parameter: "+Pr);vo={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},ea=Math.ceil((ei-Jo+1)/Ro),_a=Math.ceil((pi-ma+1)/Bo),dc=Math.ceil((Mi-Fa+1)/Zo)}return{padInfo:vo,outDepth:ea,outHeight:_a,outWidth:dc}}(E,we,De,Ne,At,Lt,tn,Rn,Mn,tr,Z),vr=ur.padInfo,kr=ur.outDepth,yr=ur.outHeight,mr=ur.outWidth,jr=z?xt*Fe:xt;return Y==="channelsFirst"?Ve=[de,jr,kr,yr,mr]:Y==="channelsLast"&&(Ve=[de,kr,yr,mr,jr]),{batchSize:de,dataFormat:Y,inDepth:we,inHeight:De,inWidth:Ne,inChannels:Fe,outDepth:kr,outHeight:yr,outWidth:mr,outChannels:jr,padInfo:vr,strideDepth:At,strideHeight:Lt,strideWidth:tn,filterDepth:Je,filterHeight:Xe,filterWidth:ot,effectiveFilterDepth:Rn,effectiveFilterHeight:Mn,effectiveFilterWidth:tr,dilationDepth:nn,dilationHeight:cn,dilationWidth:Dn,inShape:_,outShape:Ve,filterShape:m}}function Vn(_,m,f,y){y===void 0&&(y=1);var E=Tr(m,y);return Math.floor((_[0]*(f-1)-f+E)/2)}function lr(_){return typeof _=="number"?[_,_,_]:_.length===2?[_[0],_[1],1]:_}function dr(_){return typeof _=="number"?[_,_,_]:_}function Tr(_,m){return m<=1?_:_+(_-1)*(m-1)}function Hr(_,m){if(!m)return _;switch(m){case"round":return Math.round(_);case"ceil":return Math.ceil(_);case"floor":return Math.floor(_);default:throw new Error("Unknown roundingMode "+m)}}function oi(_){var m=lr(_),f=m[0],y=m[1],E=m[2];return f===1&&y===1&&E===1}function Br(_,m){return oi(_)||oi(m)}function ui(_){if(_==="NHWC")return"channelsLast";if(_==="NCHW")return"channelsFirst";throw new Error("Unknown dataFormat "+_)}function ii(_,m,f){if(m==="complex64"){if(_.dtype==="complex64")return _.clone();var y=go(_.shape),E=_.toFloat(),z=f.complex(E,y);return y.dispose(),E.dispose(),z}if(!He(_.dtype,m))return qe.makeTensorFromDataId(_.dataId,_.shape,m);if(_.dtype==="complex64"){var Y=f.real(_);return z=Y.cast(m),Y.dispose(),z}if(m==="int32")return f.int(_);if(m==="bool"){var Z=Or(0,_.dtype);return z=f.notEqual(_,Z),Z.dispose(),z}throw new Error("Error in Cast: failed to cast "+_.dtype+" to "+m)}function Ci(_,m){return qe.makeTensorFromDataId(_.dataId,m,_.dtype)}function Di(_,m,f){var y=(m-_)/(f-1),E=rn(f,"float32");E[0]=_;for(var z=1;z<E.length;z++)E[z]=E[z-1]+y;return Vu(E,"float32")}var si=Object.freeze({castTensor:ii,reshapeTensor:Ci,linspaceImpl:Di,upcastType:kn,axesAreInnerMostDims:uh,combineLocations:Im,computeOutAndReduceShapes:ra,expandShapeToKeepDim:ia,assertAxesAreInnerMostDims:Aa,getAxesPermutation:fs,getUndoAxesPermutation:Ic,getInnerMostAxes:ds,getBroadcastDims:hs,getReductionAxes:bs,assertAndGetBroadcastShape:no,assertParamsConsistent:Hl,computeOutShape:sc,computePool2DInfo:Tn,computePool3DInfo:Pn,computeConv2DInfo:zn,computeConv3DInfo:Jn,computeDefaultPad:Vn,tupleValuesAreOne:oi,eitherStridesOrDilationsAreOne:Br,convertConv2DDataFormat:ui,PARALLELIZE_THRESHOLD:il,computeOptimalWindowSize:Sl});function wi(_,m){if(_.length!==m.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+_.length+", imag: "+m.length+".");for(var f=new Float32Array(2*_.length),y=0;y<f.length;y+=2)f[y]=_[y/2],f[y+1]=m[y/2];return f}function Co(_,m){return{real:_[2*m],imag:_[2*m+1]}}function _o(_,m,f,y){_[2*y]=m,_[2*y+1]=f}function ba(_,m,f){var y=(f?2:-2)*Math.PI*(_/m);return{real:Math.cos(y),imag:Math.sin(y)}}function ro(_,m,f){var y=function(z,Y,Z){return function(le,de,we){for(var De=0,Ne=le.length,Fe=0,Ve=!1;De<Ne;){var Je=we(de,le[Fe=De+(Ne-De>>>1)]);Je>0?De=Fe+1:(Ne=Fe,Ve=!Je)}return Ve?De:-De-1}(z,Y,Z||So)}(_,m,f),E=y<0?-(y+1):y;_.splice(E,0,m)}function So(_,m){return _>m?1:_<m?-1:0}function ja(_,m,f,y,E){return Ta(_,m,f,y,E,0).selectedIndices}function pa(_,m,f,y,E,z){var Y=Ta(_,m,f,y,E,z);return Y.numValidOutputs.dispose(),{selectedIndices:Y.selectedIndices,selectedScores:Y.selectedScores}}function Ta(_,m,f,y,E,z,Y,Z){Z===void 0&&(Z=!1);for(var le=Array.from(m).map(function(At,Lt){return{score:At,boxIndex:Lt,suppressBeginIndex:0}}).filter(function(At){return At.score>E}).sort(Ho),de=z>0?-.5/z:0,we=[],De=[];we.length<f&&le.length>0;){var Ne=le.pop(),Fe=Ne.score,Ve=Ne.boxIndex,Je=Ne.suppressBeginIndex;if(Fe<E)break;for(var Xe=!1,ot=we.length-1;ot>=Je;--ot){var xt=Zi(_,Ve,we[ot]);if(xt>=y){Xe=!0;break}if(Ne.score=Ne.score*Xi(y,de,xt),Ne.score<=E)break}Ne.suppressBeginIndex=we.length,Xe||(Ne.score===Fe?(we.push(Ve),De.push(Ne.score)):Ne.score>E&&ro(le,Ne,Ho))}var kt=we.length;return Z&&(we.fill(0,kt),De.fill(0,kt)),{selectedIndices:Vu(we,"int32"),selectedScores:Vu(De,"float32"),numValidOutputs:Or(kt,"int32")}}function Zi(_,m,f){var y=_.subarray(4*m,4*m+4),E=_.subarray(4*f,4*f+4),z=Math.min(y[0],y[2]),Y=Math.min(y[1],y[3]),Z=Math.max(y[0],y[2]),le=Math.max(y[1],y[3]),de=Math.min(E[0],E[2]),we=Math.min(E[1],E[3]),De=Math.max(E[0],E[2]),Ne=Math.max(E[1],E[3]),Fe=(Z-z)*(le-Y),Ve=(De-de)*(Ne-we);if(Fe<=0||Ve<=0)return 0;var Je=Math.max(z,de),Xe=Math.max(Y,we),ot=Math.min(Z,De),xt=Math.min(le,Ne),kt=Math.max(ot-Je,0)*Math.max(xt-Xe,0);return kt/(Fe+Ve-kt)}function Xi(_,m,f){var y=Math.exp(m*f*f);return f<=_?y:0}function Ho(_,m){return _.score-m.score||_.score===m.score&&m.boxIndex-_.boxIndex}function Ga(_,m,f){var y=new Array(_.rank).fill(0),E=_.shape.slice();return m.map(function(z){E[f]=z;var Y=_.slice(y,E);return y[f]+=z,Y})}function Qa(_,m){for(var f=new Array(_.rank),y=0;y<f.length;y++)f[y]=_.shape[y]*m[y];var E=Li(f,_.dtype);for(y=0;y<E.values.length;++y){for(var z=E.indexToLoc(y),Y=new Array(_.rank),Z=0;Z<Y.length;Z++)Y[Z]=z[Z]%_.shape[Z];var le=_.locToIndex(Y);E.values[y]=_.values[le]}return E.toTensor()}function Ua(_,m,f,y,E){for(var z=m[m.length-1],Y=[_.length/z,z],Z=Y[0],le=Y[1],de=yn(f,Z*y),we=yn("int32",Z*y),De=0;De<Z;De++){for(var Ne=De*le,Fe=_.subarray(Ne,Ne+le),Ve=[],Je=0;Je<Fe.length;Je++)Ve.push({value:Fe[Je],index:Je});Ve.sort(function(At,Lt){return Lt.value-At.value});var Xe=De*y,ot=de.subarray(Xe,Xe+y),xt=we.subarray(Xe,Xe+y);for(Je=0;Je<y;Je++)ot[Je]=Ve[Je].value,xt[Je]=Ve[Je].index}var kt=m.slice();return kt[kt.length-1]=y,[Qo(de,kt,f),Qo(we,kt,"int32")]}function Na(_,m){for(var f=[],y=0;y<m.length;y++)m[y]&&f.push(y);var E=Li(_,"int32"),z=Li([f.length,_.length],"int32");for(y=0;y<f.length;y++){var Y=E.indexToLoc(f[y]),Z=y*_.length;z.values.set(Y,Z)}return z.toTensor()}function Hs(_,m){return["x","y","z","w","u","v"].slice(0,m).map(function(f){return _+"."+f})}function Za(_,m){return m===1?[_]:Hs(_,m)}function qo(){var _,m,f,y,E,z,Y,Z,le,de;return L().getNumber("WEBGL_VERSION")===2?(_="#version 300 es",m="in",f="out",y="in",E="texture",z="outputColor",Y="out vec4 outputColor;",Z=` 41 bool isnan_custom(float val) { 42 return (val > 0.0 || val < 0.0) ? false : val != 0.0; 43 } 44 45 bvec4 isnan_custom(vec4 val) { 46 return bvec4(isnan_custom(val.x), 47 isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w)); 48 } 49 50 #define isnan(value) isnan_custom(value) 51 `,le="",de=` 52 #define round(value) newRound(value) 53 int newRound(float value) { 54 return int(floor(value + 0.5)); 55 } 56 57 ivec4 newRound(vec4 value) { 58 return ivec4(floor(value + vec4(0.5))); 59 } 60 `):(_="",m="attribute",f="varying",y="varying",E="texture2D",z="gl_FragColor",Y="",Z=` 61 #define isnan(value) isnan_custom(value) 62 bool isnan_custom(float val) { 63 return (val > 0. || val < 1. || val == 0.) ? false : true; 64 } 65 bvec4 isnan_custom(vec4 val) { 66 return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w)); 67 } 68 `,le=` 69 uniform float INFINITY; 70 71 bool isinf(float val) { 72 return abs(val) == INFINITY; 73 } 74 bvec4 isinf(vec4 val) { 75 return equal(abs(val), vec4(INFINITY)); 76 }
77 `,de=` 78 int round(float value) { 79 return int(floor(value + 0.5)); 80 } 81 82 ivec4 round(vec4 value) { 83 return ivec4(floor(value + vec4(0.5))); 84 } 85 `),{version:_,attribute:m,varyingVs:f,varyingFs:y,texture2D:E,output:z,defineOutput:Y,defineSpecialNaN:Z,defineSpecialInf:le,defineRound:de}}function ss(_,m,f){f===void 0&&(f="index");var y=ar(m);return y.map(function(E,z){return"int "+_[z]+" = "+f+" / "+E+"; "+(z===y.length-1?"int "+_[z+1]+" = "+f+" - "+_[z]+" * "+E:"index -= "+_[z]+" * "+E)+";"}).join("")}function jc(_){var m=ar(_).map(function(f){return f.toString()});return` 86 int getFlatIndex(ivec3 coords) { 87 return coords.x * `+m[0]+" + coords.y * "+m[1]+` + coords.z; 88 } 89`}var ru=` 90 const float FLOAT_MAX = 1.70141184e38; 91 const float FLOAT_MIN = 1.17549435e-38; 92 93 lowp vec4 encode_float(highp float v) { 94 if (isnan(v)) { 95 return vec4(255, 255, 255, 255); 96 } 97 98 highp float av = abs(v); 99 100 if(av < FLOAT_MIN) { 101 return vec4(0.0, 0.0, 0.0, 0.0); 102 } else if(v > FLOAT_MAX) { 103 return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; 104 } else if(v < -FLOAT_MAX) { 105 return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; 106 } 107 108 highp vec4 c = vec4(0,0,0,0); 109 110 highp float e = floor(log2(av)); 111 highp float m = exp2(fract(log2(av))) - 1.0; 112 113 c[2] = floor(128.0 * m); 114 m -= c[2] / 128.0; 115 c[1] = floor(32768.0 * m); 116 m -= c[1] / 32768.0; 117 c[0] = floor(8388608.0 * m); 118 119 highp float ebias = e + 127.0; 120 c[3] = floor(ebias / 2.0); 121 ebias -= c[3] * 2.0; 122 c[2] += floor(ebias) * 128.0; 123 124 c[3] += 128.0 * step(0.0, -v); 125 126 return c / 255.0; 127 } 128`;function ws(_,m,f,y){var E=[];_.forEach(function(Fe){var Ve=Ke(Fe.shapeInfo.logicalShape);Fe.shapeInfo.isUniform?E.push("uniform float "+Fe.name+(Ve>1?"["+Ve+"]":"")+";"):(E.push("uniform sampler2D "+Fe.name+";"),E.push("uniform int offset"+Fe.name+";"))});var z,Y,Z=E.join(` 129`),le=_.map(function(Fe){return function(Ve,Je,Xe){Xe===void 0&&(Xe=!1);var ot="";ot+=Xe?function At(Lt){var tn,ln,nn;switch(Lt.shapeInfo.logicalShape.length){case 0:return tn=Lt.name,ln="get"+tn.charAt(0).toUpperCase()+tn.slice(1),nn=qo(),` 130 vec4 `+ln+`() { 131 return `+nn.texture2D+"("+tn+`, halfCR); 132 } 133 `;case 1:return function(cn){var Dn=cn.name,Rn="get"+Dn.charAt(0).toUpperCase()+Dn.slice(1),Mn=cn.shapeInfo.texShape,tr=[Math.ceil(Mn[0]/2),Math.ceil(Mn[1]/2)],ur=qo();return` 134 vec4 `+Rn+`(int index) { 135 vec2 uv = packedUVfrom1D( 136 `+tr[0]+", "+tr[1]+`, index); 137 return `+ur.texture2D+"("+Dn+`, uv); 138 } 139 `}(Lt);case 2:return function(cn){var Dn=cn.shapeInfo.logicalShape,Rn=cn.name,Mn="get"+Rn.charAt(0).toUpperCase()+Rn.slice(1),tr=cn.shapeInfo.texShape,ur=tr[0],vr=tr[1],kr=qo();if(tr!=null&&Tt(Dn,tr))return` 140 vec4 `+Mn+`(int row, int col) { 141 vec2 uv = (vec2(col, row) + halfCR) / vec2(`+vr+".0, "+ur+`.0); 142 143 return `+kr.texture2D+"("+Rn+`, uv); 144 } 145 `;var yr=[Math.ceil(tr[0]/2),Math.ceil(tr[1]/2)],mr=Math.ceil(Dn[1]/2);return` 146 vec4 `+Mn+`(int row, int col) { 147 vec2 uv = packedUVfrom2D(`+mr+", "+yr[0]+", "+yr[1]+`, row, col); 148 return `+kr.texture2D+"("+Rn+`, uv); 149 } 150 `}(Lt);case 3:return function(cn){var Dn=cn.shapeInfo.logicalShape,Rn=cn.name,Mn="get"+Rn.charAt(0).toUpperCase()+Rn.slice(1),tr=cn.shapeInfo.texShape,ur=[Math.ceil(tr[0]/2),Math.ceil(tr[1]/2)];if(Dn[0]===1){var vr=Dn.slice(1),kr=Cu(cn,vr);return` 151 `+At(kr)+` 152 vec4 `+Mn+`(int b, int row, int col) { 153 return `+Mn+"("+iu(["b","row","col"],[1,2])+`); 154 } 155 `}var yr=ur[0],mr=ur[1],jr=Math.ceil(Dn[2]/2),Pr=jr*Math.ceil(Dn[1]/2),ei=qo();return` 156 vec4 `+Mn+`(int b, int row, int col) { 157 vec2 uv = packedUVfrom3D( 158 `+yr+", "+mr+", "+Pr+", "+jr+`, b, row, col); 159 return `+ei.texture2D+"("+Rn+`, uv); 160 } 161 `}(Lt);default:return function(cn){for(var Dn=cn.shapeInfo.logicalShape,Rn=Dn.length,Mn=cn.name,tr="get"+Mn.charAt(0).toUpperCase()+Mn.slice(1),ur=cn.shapeInfo.texShape,vr=[Math.ceil(ur[0]/2),Math.ceil(ur[1]/2)],kr=vr[0],yr=vr[1],mr=Math.ceil(Dn[Rn-1]/2),jr=mr*Math.ceil(Dn[Rn-2]/2),Pr="int b, int row, int col",ei="b * "+jr+" + (row / 2) * "+mr+" + (col / 2)",pi=2;pi<Rn-1;pi++)Pr="int b"+pi+", "+Pr,jr*=Dn[Rn-pi-1],ei="b"+pi+" * "+jr+" + "+ei;var Mi=qo();return` 162 vec4 `+tr+"("+Pr+`) { 163 int index = `+ei+`; 164 int texR = index / `+yr+`; 165 int texC = index - texR * `+yr+`; 166 vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+yr+", "+kr+`); 167 return `+Mi.texture2D+"("+Mn+`, uv); 168 } 169 `}(Lt)}}(Ve):function At(Lt){var tn=Lt.shapeInfo.logicalShape;switch(tn.length){case 0:return function(ln){var nn=ln.name,cn="get"+nn.charAt(0).toUpperCase()+nn.slice(1);if(ln.shapeInfo.isUniform)return"float "+cn+"() {return "+nn+";}";var Dn=ln.shapeInfo.texShape,Rn=Dn[0],Mn=Dn[1];if(Rn===1&&Mn===1)return` 170 float `+cn+`() {
171 return sampleTexture(`+nn+`, halfCR); 172 } 173 `;var tr=ln.shapeInfo.texShape,ur=tr[0],vr=tr[1],kr=Ia(nn);return` 174 float `+cn+`() { 175 vec2 uv = uvFromFlat(`+ur+", "+vr+", "+kr+`); 176 return sampleTexture(`+nn+`, uv); 177 } 178 `}(Lt);case 1:return function(ln){var nn=ln.name,cn="get"+nn.charAt(0).toUpperCase()+nn.slice(1);if(ln.shapeInfo.isUniform)return` 179 float `+cn+`(int index) { 180 `+Fu(ln)+` 181 } 182 `;var Dn=ln.shapeInfo.texShape,Rn=Dn[0],Mn=Dn[1];if(Mn===1&&Rn===1)return` 183 float `+cn+`(int index) { 184 return sampleTexture(`+nn+`, halfCR); 185 } 186 `;var tr=Ia(nn);return Mn===1?` 187 float `+cn+`(int index) { 188 vec2 uv = vec2(0.5, (float(index + `+tr+") + 0.5) / "+Rn+`.0); 189 return sampleTexture(`+nn+`, uv); 190 } 191 `:Rn===1?` 192 float `+cn+`(int index) { 193 vec2 uv = vec2((float(index + `+tr+") + 0.5) / "+Mn+`.0, 0.5); 194 return sampleTexture(`+nn+`, uv); 195 } 196 `:` 197 float `+cn+`(int index) { 198 vec2 uv = uvFromFlat(`+Rn+", "+Mn+", index + "+tr+`); 199 return sampleTexture(`+nn+`, uv); 200 } 201 `}(Lt);case 2:return function(ln){var nn=ln.shapeInfo.logicalShape,cn=ln.name,Dn="get"+cn.charAt(0).toUpperCase()+cn.slice(1),Rn=ln.shapeInfo.texShape;if(Rn!=null&&Tt(nn,Rn)){var Mn=Rn[0],tr=Rn[1];return` 202 float `+Dn+`(int row, int col) { 203 vec2 uv = (vec2(col, row) + halfCR) / vec2(`+tr+".0, "+Mn+`.0); 204 return sampleTexture(`+cn+`, uv); 205 } 206 `}var ur=sn(nn),vr=ur.newShape,kr=ur.keptDims,yr=vr;if(yr.length<nn.length){var mr=Cu(ln,yr);return` 207 `+At(mr)+` 208 float `+Dn+`(int row, int col) { 209 return `+Dn+"("+iu(["row","col"],kr)+`); 210 } 211 `}if(ln.shapeInfo.isUniform)return` 212 float `+Dn+`(int row, int col) { 213 int index = round(dot(vec2(row, col), vec2(`+nn[1]+`, 1))); 214 `+Fu(ln)+` 215 } 216 `;var jr=Rn[0],Pr=Rn[1],ei=Ia(cn);return Pr===1?` 217 float `+Dn+`(int row, int col) { 218 float index = dot(vec3(row, col, `+ei+"), vec3("+nn[1]+`, 1, 1)); 219 vec2 uv = vec2(0.5, (index + 0.5) / `+jr+`.0); 220 return sampleTexture(`+cn+`, uv); 221 } 222 `:jr===1?` 223 float `+Dn+`(int row, int col) { 224 float index = dot(vec3(row, col, `+ei+"), vec3("+nn[1]+`, 1, 1)); 225 vec2 uv = vec2((index + 0.5) / `+Pr+`.0, 0.5); 226 return sampleTexture(`+cn+`, uv); 227 } 228 `:` 229 float `+Dn+`(int row, int col) { 230 // Explicitly use integer operations as dot() only works on floats. 231 int index = row * `+nn[1]+" + col + "+ei+`; 232 vec2 uv = uvFromFlat(`+jr+", "+Pr+`, index); 233 return sampleTexture(`+cn+`, uv); 234 } 235`}(Lt);case 3:return function(ln){var nn=ln.shapeInfo.logicalShape,cn=ln.name,Dn="get"+cn.charAt(0).toUpperCase()+cn.slice(1),Rn=nn[1]*nn[2],Mn=nn[2],tr=sn(nn),ur=tr.newShape,vr=tr.keptDims,kr=ur;if(kr.length<nn.length){var yr=Cu(ln,kr);return` 236 `+At(yr)+` 237 float `+Dn+`(int row, int col, int depth) { 238 return `+Dn+"("+iu(["row","col","depth"],vr)+`); 239 } 240 `}if(ln.shapeInfo.isUniform)return` 241 float `+Dn+`(int row, int col, int depth) { 242 int index = round(dot(vec3(row, col, depth), 243 vec3(`+Rn+", "+Mn+`, 1))); 244 `+Fu(ln)+` 245 } 246 `;var mr=ln.shapeInfo.texShape,jr=mr[0],Pr=mr[1],ei=ln.shapeInfo.flatOffset;if(Pr===Rn&&ei==null)return` 247 float `+Dn+`(int row, int col, int depth) { 248 float texR = float(row); 249 float texC = dot(vec2(col, depth), vec2(`+Mn+`, 1)); 250 vec2 uv = (vec2(texC, texR) + halfCR) / 251 vec2(`+Pr+".0, "+jr+`.0); 252 return sampleTexture(`+cn+`, uv); 253 } 254 `;if(Pr===Mn&&ei==null)return` 255 float `+Dn+`(int row, int col, int depth) { 256 float texR = dot(vec2(row, col), vec2(`+nn[1]+`, 1)); 257 float texC = float(depth); 258 vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+Pr+".0, "+jr+`.0); 259 return sampleTexture(`+cn+`, uv); 260 } 261 `;var pi=Ia(cn);return` 262 float `+Dn+`(int row, int col, int depth) { 263 // Explicitly use integer operations as dot() only works on floats. 264 int index = row * `+Rn+" + col * "+Mn+" + depth + "+pi+`; 265 vec2 uv = uvFromFlat(`+jr+", "+Pr+`, index); 266 return sampleTexture(`+cn+`, uv); 267 } 268 `}(Lt);case 4:return function(ln){var nn=ln.shapeInfo.logicalShape,cn=ln.name,Dn="get"+cn.charAt(0).toUpperCase()+cn.slice(1),Rn=nn[3],Mn=nn[2]*Rn,tr=nn[1]*Mn,ur=sn(nn),vr=ur.newShape,kr=ur.keptDims;if(vr.length<nn.length){var yr=Cu(ln,vr);return` 269 `+At(yr)+` 270 float `+Dn+`(int row, int col, int depth, int depth2) { 271 return `+Dn+"("+iu(["row","col","depth","depth2"],kr)+`); 272 } 273 `}if(ln.shapeInfo.isUniform)return` 274 float `+Dn+`(int row, int col, int depth, int depth2) { 275 int index = round(dot(vec4(row, col, depth, depth2), 276 vec4(`+tr+", "+Mn+", "+Rn+`, 1))); 277 `+Fu(ln)+` 278 } 279 `;var mr=ln.shapeInfo.flatOffset,jr=ln.shapeInfo.texShape,Pr=jr[0],ei=jr[1];if(ei===tr&&mr==null)return` 280 float `+Dn+`(int row, int col, int depth, int depth2) { 281 float texR = float(row); 282 float texC = 283 dot(vec3(col, depth, depth2), 284 vec3(`+Mn+", "+Rn+`, 1)); 285 vec2 uv = (vec2(texC, texR) + halfCR) / 286 vec2(`+ei+".0, "+Pr+`.0); 287 return sampleTexture(`+cn+`, uv); 288 } 289 `;if(ei===Rn&&mr==null)return` 290 float `+Dn+`(int row, int col, int depth, int depth2) {
291 float texR = dot(vec3(row, col, depth), 292 vec3(`+nn[1]*nn[2]+", "+nn[2]+`, 1)); 293 float texC = float(depth2); 294 vec2 uv = (vec2(texC, texR) + halfCR) / 295 vec2(`+ei+".0, "+Pr+`.0); 296 return sampleTexture(`+cn+`, uv); 297 } 298 `;var pi=Ia(cn);return` 299 float `+Dn+`(int row, int col, int depth, int depth2) { 300 // Explicitly use integer operations as dot() only works on floats. 301 int index = row * `+tr+" + col * "+Mn+` + 302 depth * `+Rn+` + depth2; 303 vec2 uv = uvFromFlat(`+Pr+", "+ei+", index + "+pi+`); 304 return sampleTexture(`+cn+`, uv); 305 } 306 `}(Lt);case 5:return function(ln){var nn=ln.shapeInfo.logicalShape,cn=ln.name,Dn="get"+cn.charAt(0).toUpperCase()+cn.slice(1),Rn=nn[4],Mn=nn[3]*Rn,tr=nn[2]*Mn,ur=nn[1]*tr,vr=sn(nn),kr=vr.newShape,yr=vr.keptDims;if(kr.length<nn.length){var mr=Cu(ln,kr);return` 307 `+At(mr)+` 308 float `+Dn+`(int row, int col, int depth, int depth2, int depth3) { 309 return `+Dn+"("+iu(["row","col","depth","depth2","depth3"],yr)+`); 310 } 311 `}if(ln.shapeInfo.isUniform)return` 312 float `+Dn+`(int row, int col, int depth, int depth2, int depth3) { 313 float index = dot( 314 vec4(row, col, depth, depth2), 315 vec4(`+ur+", "+tr+", "+Mn+", "+Rn+`)) + 316 depth3; 317 `+Fu(ln)+` 318 } 319 `;var jr=ln.shapeInfo.flatOffset,Pr=ln.shapeInfo.texShape,ei=Pr[0],pi=Pr[1];if(pi===ur&&jr==null)return` 320 float `+Dn+`(int row, int col, int depth, int depth2, int depth3) { 321 int texR = row; 322 float texC = dot(vec4(col, depth, depth2, depth3), 323 vec4(`+tr+", "+Mn+", "+Rn+`, 1)); 324 vec2 uv = (vec2(texC, texR) + halfCR) / 325 vec2(`+pi+".0, "+ei+`.0); 326 return sampleTexture(`+cn+`, uv); 327 } 328 `;if(pi===Rn&&jr==null)return` 329 float `+Dn+`(int row, int col, int depth, int depth2, int depth3) { 330 float texR = dot( 331 vec4(row, col, depth, depth2), 332 vec4(`+nn[1]*nn[2]*nn[3]+`, 333 `+nn[2]*nn[3]+", "+nn[3]+`, 1)); 334 int texC = depth3; 335 vec2 uv = (vec2(texC, texR) + halfCR) / 336 vec2(`+pi+".0, "+ei+`.0); 337 return sampleTexture(`+cn+`, uv); 338 } 339 `;var Mi=Ia(cn);return` 340 float `+Dn+`(int row, int col, int depth, int depth2, int depth3) { 341 // Explicitly use integer operations as dot() only works on floats. 342 int index = row * `+ur+" + col * "+tr+" + depth * "+Mn+` + 343 depth2 * `+Rn+" + depth3 + "+Mi+`; 344 vec2 uv = uvFromFlat(`+ei+", "+pi+`, index); 345 return sampleTexture(`+cn+`, uv); 346 } 347 `}(Lt);case 6:return function(ln){var nn=ln.shapeInfo.logicalShape,cn=ln.name,Dn="get"+cn.charAt(0).toUpperCase()+cn.slice(1),Rn=sn(nn),Mn=Rn.newShape,tr=Rn.keptDims;if(Mn.length<nn.length){var ur=Cu(ln,Mn);return` 348 `+At(ur)+` 349 float `+Dn+`(int row, int col, int depth, 350 int depth2, int depth3, int depth4) { 351 return `+Dn+"("+iu(["row","col","depth","depth2","depth3","depth4"],tr)+`); 352 } 353 `}var vr=nn[5],kr=nn[4]*vr,yr=nn[3]*kr,mr=nn[2]*yr,jr=nn[1]*mr;if(ln.shapeInfo.isUniform)return` 354 float `+Dn+`(int row, int col, int depth, 355 int depth2, int depth3, int depth4) { 356 int index = round(dot( 357 vec4(row, col, depth, depth2), 358 vec4(`+jr+", "+mr+", "+yr+", "+kr+`)) + 359 dot( 360 vec2(depth3, depth4), 361 vec2(`+vr+`, 1))); 362 `+Fu(ln)+` 363 } 364 `;var Pr=ln.shapeInfo.flatOffset,ei=ln.shapeInfo.texShape,pi=ei[0],Mi=ei[1];if(Mi===jr&&Pr==null)return` 365 float `+Dn+`(int row, int col, int depth, 366 int depth2, int depth3, int depth4) { 367 int texR = row; 368 float texC = dot(vec4(col, depth, depth2, depth3), 369 vec4(`+mr+", "+yr+", "+kr+", "+vr+`)) + 370 float(depth4); 371 vec2 uv = (vec2(texC, texR) + halfCR) / 372 vec2(`+Mi+".0, "+pi+`.0); 373 return sampleTexture(`+cn+`, uv); 374 } 375 `;if(Mi===vr&&Pr==null)return` 376 float `+Dn+`(int row, int col, int depth, 377 int depth2, int depth3, int depth4) {
378 float texR = dot(vec4(row, col, depth, depth2), 379 vec4(`+nn[1]*nn[2]*nn[3]*nn[4]+`, 380 `+nn[2]*nn[3]*nn[4]+`, 381 `+nn[3]*nn[4]+`, 382 `+nn[4]+`)) + float(depth3); 383 int texC = depth4; 384 vec2 uv = (vec2(texC, texR) + halfCR) / 385 vec2(`+Mi+".0, "+pi+`.0); 386 return sampleTexture(`+cn+`, uv); 387 } 388 `;var Ro=Ia(cn);return` 389 float `+Dn+`(int row, int col, int depth, 390 int depth2, int depth3, int depth4) { 391 // Explicitly use integer operations as dot() only works on floats. 392 int index = row * `+jr+" + col * "+mr+" + depth * "+yr+` + 393 depth2 * `+kr+" + depth3 * "+vr+" + depth4 + "+Ro+`; 394 vec2 uv = uvFromFlat(`+pi+", "+Mi+`, index); 395 return sampleTexture(`+cn+`, uv); 396 } 397 `}(Lt);default:throw new Error(tn.length+"-D input sampling is not yet supported")}}(Ve);var xt=Ve.shapeInfo.logicalShape,kt=Je.logicalShape;return xt.length<=kt.length&&(ot+=Xe?function(At,Lt){var tn,ln=At.name,nn=ln.charAt(0).toUpperCase()+ln.slice(1),cn="get"+nn+"AtOutCoords",Dn=At.shapeInfo.logicalShape.length,Rn=Lt.logicalShape.length,Mn=hs(At.shapeInfo.logicalShape,Lt.logicalShape),tr=fa(Rn),ur=Rn-Dn,vr=["x","y","z","w","u","v"];tn=Dn===0?"":Rn<2&&Mn.length>=1?"coords = 0;":Mn.map(function(pi){return"coords."+vr[pi+ur]+" = 0;"}).join(` 398`);var kr;kr=Rn<2&&Dn>0?"coords":At.shapeInfo.logicalShape.map(function(pi,Mi){return"coords."+vr[Mi+ur]}).join(", ");var yr="return outputValue;",mr=Ke(At.shapeInfo.logicalShape)===1,jr=Ke(Lt.logicalShape)===1;if(Dn!==1||mr||jr){if(mr&&!jr)yr=Rn===1?` 399 return vec4(outputValue.x, outputValue.x, 0., 0.); 400 `:` 401 return vec4(outputValue.x); 402 `;else if(Mn.length){var Pr=Dn-2,ei=Dn-1;Mn.indexOf(Pr)>-1&&Mn.indexOf(ei)>-1?yr="return vec4(outputValue.x);":Mn.indexOf(Pr)>-1?yr="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":Mn.indexOf(ei)>-1&&(yr="return vec4(outputValue.xx, outputValue.zz);")}}else yr=` 403 return vec4(outputValue.xy, outputValue.xy); 404 `;return` 405 vec4 `+cn+`() { 406 `+tr+` coords = getOutputCoords(); 407 `+tn+` 408 vec4 outputValue = get`+nn+"("+kr+`); 409 `+yr+` 410 } 411 `}(Ve,Je):function(At,Lt){var tn=At.name,ln=tn.charAt(0).toUpperCase()+tn.slice(1),nn="get"+ln+"AtOutCoords",cn=Lt.texShape,Dn=At.shapeInfo.texShape,Rn=At.shapeInfo.logicalShape.length,Mn=Lt.logicalShape.length;if(!At.shapeInfo.isUniform&&Rn===Mn&&At.shapeInfo.flatOffset==null&&Tt(Dn,cn))return` 412 float `+nn+`() { 413 return sampleTexture(`+tn+`, resultUV); 414 } 415 `;var tr=fa(Mn),ur=hs(At.shapeInfo.logicalShape,Lt.logicalShape),vr=Mn-Rn,kr=["x","y","z","w","u","v"];return` 416 float `+nn+`() { 417 `+tr+` coords = getOutputCoords(); 418 `+(Rn===0?"":Mn<2&&ur.length>=1?"coords = 0;":ur.map(function(yr){return"coords."+kr[yr+vr]+" = 0;"}).join(` 419`))+` 420 return get`+ln+"("+(Mn<2&&Rn>0?"coords":At.shapeInfo.logicalShape.map(function(yr,mr){return"coords."+kr[mr+vr]}).join(", "))+`); 421 } 422 `}(Ve,Je)),ot}(Fe,m,y)}).join(` 423`),de=m.texShape,we=qo(),De=` 424 float sampleTexture(sampler2D textureSampler, vec2 uv) { 425 return `+we.texture2D+`(textureSampler, uv).r; 426 } 427 `,Ne=function(Fe){return Fe.version+` 428 precision highp float; 429 precision highp int; 430 precision highp sampler2D; 431 `+Fe.varyingFs+` vec2 resultUV; 432 `+Fe.defineOutput+` 433 const vec2 halfCR = vec2(0.5, 0.5); 434 435 struct ivec5 436 { 437 int x; 438 int y; 439 int z; 440 int w; 441 int u; 442 }; 443 444 struct ivec6 445 { 446 int x; 447 int y; 448 int z; 449 int w; 450 int u; 451 int v; 452 }; 453 454 uniform float NAN; 455 `+Fe.defineSpecialNaN+` 456 `+Fe.defineSpecialInf+` 457 `+Fe.defineRound+` 458 459 int imod(int x, int y) { 460 return x - y * (x / y); 461 } 462 463 int idiv(int a, int b, float sign) { 464 int res = a / b; 465 int mod = imod(a, b); 466 if (sign < 0. && mod != 0) { 467 res -= 1; 468 } 469 return res; 470 } 471 472 //Based on the work of Dave Hoskins 473 //https://www.shadertoy.com/view/4djSRW 474 #define HASHSCALE1 443.8975 475 float random(float seed){ 476 vec2 p = resultUV * seed; 477 vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1); 478 p3 += dot(p3, p3.yzx + 19.19); 479 return fract((p3.x + p3.y) * p3.z); 480 } 481 482 `+la+` 483 `+Al+` 484 `+Xu+` 485 `}(we);return m.isPacked?(z=function(Fe,Ve){switch(Fe.length){case 0:return` 486 int getOutputCoords() { 487 return 0; 488 } 489 `;case 1:return function(At,Lt){var tn=[Math.ceil(Lt[0]/2),Math.ceil(Lt[1]/2)];return tn[0]===1?` 490 int getOutputCoords() { 491 return 2 * int(resultUV.x * `+tn[1]+`.0); 492 } 493 `:tn[1]===1?` 494 int getOutputCoords() { 495 return 2 * int(resultUV.y * `+tn[0]+`.0); 496 } 497 `:` 498 int getOutputCoords() {
499 ivec2 resTexRC = ivec2(resultUV.yx * 500 vec2(`+tn[0]+", "+tn[1]+`)); 501 return 2 * (resTexRC.x * `+tn[1]+` + resTexRC.y); 502 } 503 `}(0,Ve);case 2:return function(At,Lt){var tn=[Math.ceil(Lt[0]/2),Math.ceil(Lt[1]/2)];if(Tt(At,Lt))return` 504 ivec2 getOutputCoords() { 505 return 2 * ivec2(resultUV.yx * vec2(`+tn[0]+", "+tn[1]+`)); 506 } 507 `;var ln=Math.ceil(At[1]/2);return` 508 ivec2 getOutputCoords() { 509 ivec2 resTexRC = ivec2(resultUV.yx * 510 vec2(`+tn[0]+", "+tn[1]+`)); 511 512 int index = resTexRC.x * `+tn[1]+` + resTexRC.y; 513 int r = 2 * (index / `+ln+`); 514 int c = imod(index, `+ln+`) * 2; 515 516 return ivec2(r, c); 517 } 518 `}(Fe,Ve);case 3:return Je=Fe,Xe=Ve,ot=[Math.ceil(Xe[0]/2),Math.ceil(Xe[1]/2)],kt=(xt=Math.ceil(Je[2]/2))*Math.ceil(Je[1]/2),` 519 ivec3 getOutputCoords() { 520 ivec2 resTexRC = ivec2(resultUV.yx * 521 vec2(`+ot[0]+", "+ot[1]+`)); 522 int index = resTexRC.x * `+ot[1]+` + resTexRC.y; 523 524 int b = index / `+kt+`; 525 index -= b * `+kt+`; 526 527 int r = 2 * (index / `+xt+`); 528 int c = imod(index, `+xt+`) * 2; 529 530 return ivec3(b, r, c); 531 } 532 `;default:return function(At,Lt){for(var tn=[Math.ceil(Lt[0]/2),Math.ceil(Lt[1]/2)],ln=Math.ceil(At[At.length-1]/2),nn=ln*Math.ceil(At[At.length-2]/2),cn=nn,Dn="",Rn="b, r, c",Mn=2;Mn<At.length-1;Mn++)Dn=` 533 int b`+Mn+" = index / "+(cn*=At[At.length-Mn-1])+`; 534 index -= b`+Mn+" * "+cn+`; 535 `+Dn,Rn="b"+Mn+", "+Rn;return` 536 ivec`+At.length+` getOutputCoords() { 537 ivec2 resTexRC = ivec2(resultUV.yx * 538 vec2(`+tn[0]+", "+tn[1]+`)); 539 int index = resTexRC.x * `+tn[1]+` + resTexRC.y; 540 541 `+Dn+` 542 543 int b = index / `+nn+`; 544 index -= b * `+nn+`; 545 546 int r = 2 * (index / `+ln+`); 547 int c = imod(index, `+ln+`) * 2; 548 549 return ivec`+At.length+"("+Rn+`); 550 } 551 `}(Fe,Ve)}var Je,Xe,ot,xt,kt}(m.logicalShape,de),Y=` 552 void setOutput(vec4 val) { 553 `+we.output+` = val; 554 } 555 `):(z=function(Fe,Ve){switch(Fe.length){case 0:return` 556 int getOutputCoords() { 557 return 0; 558 } 559 `;case 1:return function(ot,xt){return xt[0]===1?` 560 int getOutputCoords() { 561 return int(resultUV.x * `+xt[1]+`.0); 562 } 563 `:xt[1]===1?` 564 int getOutputCoords() { 565 return int(resultUV.y * `+xt[0]+`.0); 566 } 567 `:` 568 int getOutputCoords() { 569 ivec2 resTexRC = ivec2(resultUV.yx * 570 vec2(`+xt[0]+", "+xt[1]+`)); 571 return resTexRC.x * `+xt[1]+` + resTexRC.y; 572 } 573 `}(0,Ve);case 2:return function(ot,xt){return Tt(ot,xt)?` 574 ivec2 getOutputCoords() { 575 return ivec2(resultUV.yx * vec2(`+xt[0]+", "+xt[1]+`)); 576 } 577 `:ot[1]===1?` 578 ivec2 getOutputCoords() { 579 ivec2 resTexRC = ivec2(resultUV.yx * 580 vec2(`+xt[0]+", "+xt[1]+`)); 581 int index = resTexRC.x * `+xt[1]+` + resTexRC.y; 582 return ivec2(index, 0); 583 } 584 `:ot[0]===1?` 585 ivec2 getOutputCoords() { 586 ivec2 resTexRC = ivec2(resultUV.yx * 587 vec2(`+xt[0]+", "+xt[1]+`)); 588 int index = resTexRC.x * `+xt[1]+` + resTexRC.y; 589 return ivec2(0, index); 590 } 591 `:` 592 ivec2 getOutputCoords() { 593 ivec2 resTexRC = ivec2(resultUV.yx * 594 vec2(`+xt[0]+", "+xt[1]+`)); 595 int index = resTexRC.x * `+xt[1]+` + resTexRC.y; 596 int r = index / `+ot[1]+`; 597 int c = index - r * `+ot[1]+`; 598 return ivec2(r, c); 599 } 600 `}(Fe,Ve);case 3:return Je=Ve,Xe=ss(["r","c","d"],Fe),` 601 ivec3 getOutputCoords() { 602 ivec2 resTexRC = ivec2(resultUV.yx * 603 vec2(`+Je[0]+", "+Je[1]+`)); 604 int index = resTexRC.x * `+Je[1]+` + resTexRC.y; 605 `+Xe+` 606 return ivec3(r, c, d); 607 } 608 `;case 4:return function(ot,xt){var kt=ss(["r","c","d","d2"],ot);return` 609 ivec4 getOutputCoords() { 610 ivec2 resTexRC = ivec2(resultUV.yx * 611 vec2(`+xt[0]+", "+xt[1]+`)); 612 int index = resTexRC.x * `+xt[1]+` + resTexRC.y; 613 `+kt+` 614 return ivec4(r, c, d, d2); 615 } 616 `}(Fe,Ve);case 5:return function(ot,xt){var kt=ss(["r","c","d","d2","d3"],ot);return` 617 ivec5 getOutputCoords() {
618 ivec2 resTexRC = ivec2(resultUV.yx * vec2(`+xt[0]+`, 619 `+xt[1]+`)); 620 621 int index = resTexRC.x * `+xt[1]+` + resTexRC.y; 622 623 `+kt+` 624 625 ivec5 outShape = ivec5(r, c, d, d2, d3); 626 return outShape; 627 } 628 `}(Fe,Ve);case 6:return function(ot,xt){var kt=ss(["r","c","d","d2","d3","d4"],ot);return` 629 ivec6 getOutputCoords() { 630 ivec2 resTexRC = ivec2(resultUV.yx * 631 vec2(`+xt[0]+", "+xt[1]+`)); 632 int index = resTexRC.x * `+xt[1]+` + resTexRC.y; 633 634 `+kt+` 635 636 ivec6 result = ivec6(r, c, d, d2, d3, d4); 637 return result; 638 } 639 `}(Fe,Ve);default:throw new Error(Fe.length+"-D output sampling is not yet supported")}var Je,Xe}(m.logicalShape,de),Y=` 640 void setOutput(float val) { 641 `+we.output+` = vec4(val, 0, 0, 0); 642 } 643 `),y&&(Ne+=Mu),[Ne,De,Y,Z,z,le,f].join(` 644`)}var la=` 645vec2 uvFromFlat(int texNumR, int texNumC, int index) { 646 int texR = index / texNumC; 647 int texC = index - texR * texNumC; 648 return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); 649} 650vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { 651 int texelIndex = index / 2; 652 int texR = texelIndex / texNumC; 653 int texC = texelIndex - texR * texNumC; 654 return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); 655} 656`,Al=` 657vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR, 658 int texNumC, int row, int col) { 659 int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); 660 int texR = texelIndex / texNumC; 661 int texC = texelIndex - texR * texNumC; 662 return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); 663} 664`,Xu=` 665vec2 packedUVfrom3D(int texNumR, int texNumC, 666 int texelsInBatch, int texelsInLogicalRow, int b, 667 int row, int col) { 668 int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2); 669 int texR = index / texNumC; 670 int texC = index - texR * texNumC; 671 return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); 672} 673`,Mu=` 674 float getChannel(vec4 frag, vec2 innerDims) { 675 vec2 modCoord = mod(innerDims, 2.); 676 return modCoord.x == 0. ? 677 (modCoord.y == 0. ? frag.r : frag.g) : 678 (modCoord.y == 0. ? frag.b : frag.a); 679 } 680 float getChannel(vec4 frag, int dim) { 681 float modCoord = mod(float(dim), 2.); 682 return modCoord == 0. ? frag.r : frag.g; 683 } 684`;function Ia(_){return"offset"+_}function Fu(_){var m=_.name,f=Ke(_.shapeInfo.logicalShape);return f<2?"return "+m+";":` 685 for (int i = 0; i < `+f+`; i++) { 686 if (i == index) { 687 return `+m+`[i]; 688 } 689 } 690 `}function fa(_){if(_<=1)return"int";if(_===2)return"ivec2";if(_===3)return"ivec3";if(_===4)return"ivec4";if(_===5)return"ivec5";if(_===6)return"ivec6";throw Error("GPU for rank "+_+" is not yet supported")}function Cu(_,m){var f=JSON.parse(JSON.stringify(_));return f.shapeInfo.logicalShape=m,f}function iu(_,m){return m.map(function(f){return _[f]}).join(", ")}var Do=function(_,m,f){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=no(m,f),this.userCode=` 691 float binaryOpComplex( 692 float areal, float aimag, float breal, float bimag) { 693 `+_+` 694 } 695 696 void main() { 697 float areal = getARealAtOutCoords(); 698 float aimag = getAImagAtOutCoords(); 699 float breal = getBRealAtOutCoords(); 700 float bimag = getBImagAtOutCoords(); 701 setOutput(binaryOpComplex(areal, aimag, breal, bimag)); 702 } 703 `},Su="return a + b;",Ls="return a - b;",Ju="return a * b;",Xl="return (a < 0.) ? b * a : a;",xa=function(_,m,f){this.variableNames=["A","B"],this.outputShape=no(m,f),this.userCode=` 704 float binaryOperation(float a, float b) { 705 `+_+` 706 } 707 708 void main() { 709 float a = getAAtOutCoords(); 710 float b = getBAtOutCoords(); 711 setOutput(binaryOperation(a, b)); 712 } 713 `},qs=` 714 vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
715 return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a); 716`,_s=function(_,m,f,y){y===void 0&&(y=!1),this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=no(m,f);var E=this.outputShape.length,z="";if(y)if(E===0||Ke(this.outputShape)===1)z=` 717 result.y = 0.; 718 result.z = 0.; 719 result.w = 0.; 720 `;else if(z=` 721 `+fa(E)+` coords = getOutputCoords(); 722 `,E===1)z+=` 723 result.y = (coords + 1) >= `+this.outputShape[0]+` ? 0. : result.y; 724 result.z = 0.; 725 result.w = 0.; 726 `;else{var Y=Za("coords",E);z+=` 727 bool nextRowOutOfBounds = 728 (`+Y[E-2]+" + 1) >= "+this.outputShape[E-2]+`; 729 bool nextColOutOfBounds = 730 (`+Y[E-1]+" + 1) >= "+this.outputShape[E-1]+`; 731 result.y = nextColOutOfBounds ? 0. : result.y; 732 result.z = nextRowOutOfBounds ? 0. : result.z; 733 result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w; 734 `}this.userCode=` 735 vec4 binaryOperation(vec4 a, vec4 b) { 736 `+_+` 737 } 738 739 void main() { 740 vec4 a = getAAtOutCoords(); 741 vec4 b = getBAtOutCoords(); 742 743 vec4 result = binaryOperation(a, b); 744 `+z+` 745 746 setOutput(result); 747 } 748 `},Ol=function(){function _(m){this.variableNames=["A"],this.outputShape=m,this.userCode=` 749 uniform float minVal; 750 uniform float maxVal; 751 752 void main() { 753 float value = getAAtOutCoords(); 754 if (isnan(value)) { 755 setOutput(value); 756 return; 757 } 758 759 setOutput(clamp(value, minVal, maxVal)); 760 } 761 `}return _.prototype.getCustomSetupFunc=function(m,f){var y=this;return function(E,z){y.minLoc==null&&(y.minLoc=E.getUniformLocationNoThrow(z,"minVal"),y.maxLoc=E.getUniformLocationNoThrow(z,"maxVal")),E.gl.uniform1f(y.minLoc,m),E.gl.uniform1f(y.maxLoc,f)}},_}(),Of=function(){function _(m){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=m,this.userCode=` 762 uniform float minVal; 763 uniform float maxVal; 764 765 void main() { 766 vec4 value = getAAtOutCoords(); 767 768 if (any(isnan(value))) { 769 setOutput(value); 770 return; 771 } 772 773 setOutput(clamp(value, vec4(minVal), vec4(maxVal))); 774 } 775 `}return _.prototype.getCustomSetupFunc=function(m,f){var y=this;return function(E,z){y.minLoc==null&&(y.minLoc=E.getUniformLocationNoThrow(z,"minVal"),y.maxLoc=E.getUniformLocationNoThrow(z,"maxVal")),E.gl.uniform1f(y.minLoc,m),E.gl.uniform1f(y.maxLoc,f)}},_}();function Oi(_,m,f){var y=_.indexOf(m);return _.map(function(E,z){return z===y?E+" - "+f:E}).join()}var qm=function(_,m,f,y){m===void 0&&(m=!1),f===void 0&&(f=null),y===void 0&&(y=!1),this.variableNames=["x","W"],this.outputShape=_.outShape;var E=_.padInfo.top,z=_.padInfo.left,Y=_.strideHeight,Z=_.strideWidth,le=_.dilationHeight,de=_.dilationWidth,we=_.filterHeight,De=_.filterWidth,Ne=4*Math.floor(_.inChannels/4),Fe=_.inChannels%4,Ve=_.dataFormat==="channelsLast",Je=Ve?1:2,Xe=Ve?2:3,ot=Ve?3:1,xt="",kt="";f&&(xt=y?`float activation(float a) { 776 float b = getPreluActivationWeightsAtOutCoords(); 777 `+f+` 778 }`:` 779 float activation(float x) { 780 `+f+` 781 } 782 `,kt="result = activation(result);");var At=m?"result += getBiasAtOutCoords();":"";m&&this.variableNames.push("bias"),y&&this.variableNames.push("preluActivationWeights"),this.userCode=` 783 `+xt+` 784 785 const ivec2 strides = ivec2(`+Y+", "+Z+`); 786 const ivec2 pads = ivec2(`+E+", "+z+`); 787 788 void main() { 789 ivec4 coords = getOutputCoords(); 790 int batch = coords[0]; 791 int d2 = coords[`+ot+`]; 792 793 ivec2 xRCCorner = 794 ivec2(coords[`+Je+"], coords["+Xe+`]) * strides - pads; 795 int xRCorner = xRCCorner.x; 796 int xCCorner = xRCCorner.y; 797 798 // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2). 799 // ? = to be determined. : = across all values in that axis. 800 float dotProd = 0.0; 801 for (int wR = 0; wR < `+we+`; wR++) { 802 int xR = xRCorner + wR * `+le+`; 803 804 if (xR < 0 || xR >= `+_.inHeight+`) { 805 continue; 806 } 807 808 for (int wC = 0; wC < `+De+`; wC++) { 809 int xC = xCCorner + wC * `+de+`; 810 811 if (xC < 0 || xC >= `+_.inWidth+`) { 812 continue; 813 } 814 815 for (int d1 = 0; d1 < `+Ne+`; d1 += 4) { 816 vec4 wValues = vec4( 817 getW(wR, wC, d1, d2), 818 getW(wR, wC, d1 + 1, d2), 819 getW(wR, wC, d1 + 2, d2), 820 getW(wR, wC, d1 + 3, d2) 821 ); 822 823 if (`+Ve+`) { 824 vec4 xValues = vec4( 825 getX(batch, xR, xC, d1), 826 getX(batch, xR, xC, d1 + 1), 827 getX(batch, xR, xC, d1 + 2), 828 getX(batch, xR, xC, d1 + 3) 829 ); 830 dotProd += dot(xValues, wValues); 831 } else { 832 vec4 xValues = vec4( 833 getX(batch, d1, xR, xC), 834 getX(batch, d1 + 1, xR, xC), 835 getX(batch, d1 + 2, xR, xC), 836 getX(batch, d1 + 3, xR, xC) 837 ); 838 dotProd += dot(xValues, wValues); 839 } 840 } 841 842 if (`+(Fe===1)+`) { 843 844 if (`+Ve+`) { 845 dotProd += 846 getX(batch, xR, xC, `+Ne+`) * 847 getW(wR, wC, `+Ne+`, d2); 848 } else { 849 dotProd += 850 getX(batch, `+Ne+`, xR, xC) * 851 getW(wR, wC, `+Ne+`, d2); 852 } 853 854 } else if (`+(Fe===2)+`) { 855 vec2 wValues = vec2( 856 getW(wR, wC, `+Ne+`, d2), 857 getW(wR, wC, `+Ne+` + 1, d2) 858 ); 859 860 if (`+Ve+`) { 861 vec2 xValues = vec2( 862 getX(batch, xR, xC, `+Ne+`), 863 getX(batch, xR, xC, `+Ne+` + 1) 864 ); 865 dotProd += dot(xValues, wValues); 866 } else { 867 vec2 xValues = vec2( 868 getX(batch, `+Ne+`, xR, xC), 869 getX(batch, `+Ne+` + 1, xR, xC) 870 ); 871 dotProd += dot(xValues, wValues); 872 } 873 874 } else if (`+(Fe===3)+`) { 875 vec3 wValues = vec3( 876 getW(wR, wC, `+Ne+`, d2), 877 getW(wR, wC, `+Ne+` + 1, d2), 878 getW(wR, wC, `+Ne+` + 2, d2) 879 ); 880 881 if (`+Ve+`) { 882 vec3 xValues = vec3( 883 getX(batch, xR, xC, `+Ne+`), 884 getX(batch, xR, xC, `+Ne+` + 1), 885 getX(batch, xR, xC, `+Ne+` + 2) 886 ); 887 dotProd += dot(xValues, wValues); 888 } else { 889 vec3 xValues = vec3( 890 getX(batch, `+Ne+`, xR, xC), 891 getX(batch, `+Ne+` + 1, xR, xC), 892 getX(batch, `+Ne+` + 2, xR, xC) 893 ); 894 dotProd += dot(xValues, wValues); 895 } 896 897 } 898 } 899 } 900 901 float result = dotProd; 902 `+At+` 903 `+kt+` 904 setOutput(result); 905 } 906 `},Df=function(_,m,f,y){m===void 0&&(m=!1),f===void 0&&(f=null),y===void 0&&(y=!1),this.variableNames=["x","W"],this.outputShape=_.outShape;var E=_.inHeight,z=_.inWidth,Y=_.padInfo.top,Z=_.padInfo.left,le=_.strideHeight,de=_.strideWidth,we=_.dilationHeight,De=_.dilationWidth,Ne=_.filterHeight,Fe=_.filterWidth,Ve=_.outChannels/_.inChannels,Je="",Xe="";f&&(Je=y?`float activation(float a) { 907 float b = getPreluActivationWeightsAtOutCoords(); 908 `+f+` 909 }`:` 910 float activation(float x) { 911 `+f+` 912 } 913 `,Xe="result = activation(result);");var ot=m?"result += getBiasAtOutCoords();":"";m&&this.variableNames.push("bias"),y&&this.variableNames.push("preluActivationWeights"),this.userCode=` 914 `+Je+` 915 916 const ivec2 strides = ivec2(`+le+", "+de+`); 917 const ivec2 pads = ivec2(`+Y+", "+Z+`); 918 919 void main() { 920 ivec4 coords = getOutputCoords(); 921 int batch = coords.x; 922 ivec2 xRCCorner = coords.yz * strides - pads; 923 int d2 = coords.w; 924 int d1 = d2 / `+Ve+`; 925 int q = d2 - d1 * `+Ve+`; 926 927 int xRCorner = xRCCorner.x; 928 int xCCorner = xRCCorner.y; 929 930 // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2). 931 // ? = to be determined. : = across all values in that axis. 932 float dotProd = 0.0; 933 // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations. 934 for (int wR = 0; wR < `+Ne+`; wR++) { 935 int xR = xRCorner + wR * `+we+`; 936 937 if (xR < 0 || xR >= `+E+`) { 938 continue; 939 } 940 941 for (int wC = 0; wC < `+Fe+`; wC++) { 942 int xC = xCCorner + wC * `+De+`; 943 944 if (xC < 0 || xC >= `+z+`) { 945 continue; 946 } 947 948 float xVal = getX(batch, xR, xC, d1); 949 float wVal = getW(wR, wC, d1, q); 950 dotProd += xVal * wVal; 951 } 952 } 953 954 float result = dotProd; 955 `+ot+` 956 `+Xe+` 957 setOutput(result); 958 } 959 `},yd=function(_,m,f,y){m===void 0&&(m=!1),f===void 0&&(f=null),y===void 0&&(y=!1),this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=_.outShape;for(var E=_.inHeight,z=_.inWidth,Y=_.padInfo.top,Z=_.padInfo.left,le=_.strideHeight,de=_.strideWidth,we=_.dilationHeight,De=_.dilationWidth,Ne=_.filterHeight,Fe=_.filterWidth,Ve=Fe,Je="int xR; int xC; int xCOffset;",Xe=0;Xe<Ne;Xe++)for(var ot=0;ot<Fe;ot++)Je+=` 960 vec4 xTexelR`+Xe+"C"+2*ot+` = vec4(0.); 961 vec4 wR`+Xe+"C"+ot+` = vec4(0.); 962 vec4 xR`+Xe+"C"+ot+" = vec4(0.);";for(Xe=0;Xe<Ne;Xe++)for(var xt=0;xt<Ve;xt++){if(Je+=` 963 xR = xRCorner + `+Xe*we+`; 964 xC = xCCorner + `+(ot=2*xt)*De+`; 965 `,de===1){if(ot<Fe&&(Je+=Z%2==1?` 966 xCOffset = xC + 1; 967 if(xR >= 0 && xR < `+E+" && xCOffset >= 0 && xCOffset < "+z+`) { 968 xTexelR`+Xe+"C"+ot+` = getX(batch, xR, xCOffset, d1); 969 970 // Need to manually clear unused channels in case 971 // we're reading from recycled texture. 972 if(xCOffset + 1 >= `+z+`) { 973 xTexelR`+Xe+"C"+ot+`.zw = vec2(0.); 974 } 975 } else { 976 xTexelR`+Xe+"C"+ot+` = vec4(0.); 977 } 978 979 xCOffset = xC + 1 - 2; 980 if(xR >= 0 && xR < `+E+" && xCOffset >= 0 && xCOffset < "+z+`) { 981 vec4 previous = getX(batch, xR, xCOffset, d1); 982 983 // Need to manually clear unused channels in case 984 // we're reading from recycled texture. 985 if(xCOffset + 1 >= `+z+`) { 986 previous.zw = vec2(0.); 987 } 988 989 xR`+Xe+"C"+ot+" = vec4(previous.zw, xTexelR"+Xe+"C"+ot+`.xy); 990 } else { 991 xR`+Xe+"C"+ot+" = vec4(0, 0, xTexelR"+Xe+"C"+ot+`.xy); 992 } 993 `:` 994 if(xR >= 0 && xR < `+E+" && xC >= 0 && xC < "+z+`) { 995 xTexelR`+Xe+"C"+ot+` = getX(batch, xR, xC, d1); 996 } else { 997 xTexelR`+Xe+"C"+ot+` = vec4(0.); 998 } 999 1000 xR`+Xe+"C"+ot+" = xTexelR"+Xe+"C"+ot+`; 1001 `,ot+1<Fe)){var kt=Z%2==0?Dt(De):De;De%2==0&&Z%2==1||De%2!=0&&Z%2!=1?(Je+=` 1002 xCOffset = xC + `+Z%2+" + "+kt+`; 1003 1004 if(xR >= 0 && xR < `+E+` && 1005 xCOffset >= 0 && xCOffset < `+z+`) { 1006 xTexelR`+Xe+"C"+(ot+2)+` = getX(batch, xR, xCOffset, d1); 1007 } 1008 `,De>1&&(Je+=` 1009 xCOffset -= 2; 1010 if(xR >= 0 && xR < `+E+` && 1011 xCOffset >= 0 && xCOffset < `+z+`) { 1012 xTexelR`+Xe+"C"+ot+` = getX(batch, xR, xCOffset, d1); 1013 } else { 1014 xTexelR`+Xe+"C"+ot+` = vec4(0.); 1015 } 1016 `),Je+=` 1017 xR`+Xe+"C"+(ot+1)+` = vec4( 1018 xTexelR`+Xe+"C"+ot+".zw, xTexelR"+Xe+"C"+(ot+2)+`.xy); 1019 `):Je+=` 1020 xCOffset = xC + `+kt+`; 1021 1022 if(xR >= 0 && xR < `+E+` && 1023 xCOffset >= 0 && xCOffset < `+z+`) { 1024 xTexelR`+Xe+"C"+(ot+2)+` = getX(batch, xR, xCOffset, d1); 1025 } 1026 1027 xR`+Xe+"C"+(ot+1)+" = xTexelR"+Xe+"C"+(ot+2)+`; 1028 `}}else ot<Fe&&(Je+=` 1029 if(xR >= 0 && xR < `+E+`) { 1030 `,Z%2==1?(Je+=` 1031 xCOffset = xC + 1 - `+de+`; 1032 if(xCOffset >= 0 && xCOffset < `+z+`) { 1033 xTexelR`+Xe+"C"+ot+` = getX(batch, xR, xCOffset, d1); 1034 } else { 1035 xTexelR`+Xe+"C"+ot+` = vec4(0.); 1036 } 1037 1038 if(xC + 1 >= 0 && xC + 1 < `+z+`) { 1039 xTexelR`+Xe+"C"+(ot+2)+` = getX(batch, xR, xC + 1, d1); 1040 } else { 1041 xTexelR`+Xe+"C"+(ot+2)+` = vec4(0.); 1042 } 1043 1044 xR`+Xe+"C"+ot+` = vec4( 1045 xTexelR`+Xe+"C"+ot+".zw, xTexelR"+Xe+"C"+(ot+2)+`.zw); 1046 `,ot+1<Fe&&(Je+=` 1047 vec4 final = vec4(0.); 1048 xCOffset = xC + 1 + `+de+`; 1049 if(xCOffset >= 0 && xCOffset < `+z+`) { 1050 final = getX(batch, xR, xCOffset, d1); 1051 } 1052 xR`+Xe+"C"+(ot+1)+" = vec4(xTexelR"+Xe+"C"+(ot+2)+`.xy, final.xy); 1053 `)):(Je+=` 1054 if(xC >= 0 && xC < `+z+`) { 1055 xTexelR`+Xe+"C"+ot+` = getX(batch, xR, xC, d1); 1056 } else { 1057 xTexelR`+Xe+"C"+ot+` = vec4(0.); 1058 } 1059 1060 xCOffset = xC + `+de+`; 1061 if(xCOffset >= 0 && xCOffset < `+z+`) { 1062 xTexelR`+Xe+"C"+(ot+2)+` = getX(batch, xR, xCOffset, d1); 1063 } else { 1064 xTexelR`+Xe+"C"+(ot+2)+` = vec4(0.); 1065 } 1066 1067 xR`+Xe+"C"+ot+` = vec4( 1068 xTexelR`+Xe+"C"+ot+".xy, xTexelR"+Xe+"C"+(ot+2)+`.xy); 1069 `,ot+1<Fe&&(Je+=` 1070 xR`+Xe+"C"+(ot+1)+` = vec4( 1071 xTexelR`+Xe+"C"+ot+".zw, xTexelR"+Xe+"C"+(ot+2)+`.zw); 1072 `)),Je+="}");ot<Fe&&(Je+=` 1073 vec4 wTexelR`+Xe+"C"+ot+" = getW("+Xe+", "+ot+`, d1, q); 1074 wR`+Xe+"C"+ot+" = vec4(wTexelR"+Xe+"C"+ot+".xz, wTexelR"+Xe+"C"+ot+`.xz); 1075 `,ot+1<Fe&&(Je+=` 1076 vec4 wTexelR`+Xe+"C"+(ot+1)+" = getW("+Xe+", "+(ot+1)+`, d1, q); 1077 wR`+Xe+"C"+(ot+1)+` = 1078 vec4(wTexelR`+Xe+"C"+(ot+1)+".xz, wTexelR"+Xe+"C"+(ot+1)+".xz);"))}for(Xe=0;Xe<Ne;Xe++)for(ot=0;ot<Fe;ot++)Je+="dotProd += xR"+Xe+"C"+ot+" * wR"+Xe+"C"+ot+";";var At="",Lt="";f&&(At=y?`vec4 activation(vec4 a) { 1079 vec4 b = getPreluActivationWeightsAtOutCoords(); 1080 `+f+` 1081 }`:`vec4 activation(vec4 x) { 1082 `+f+` 1083 }`,Lt="result = activation(result);");var tn=m?"result += getBiasAtOutCoords();":"";m&&this.variableNames.push("bias"),y&&this.variableNames.push("preluActivationWeights"),this.userCode=` 1084 `+At+` 1085 1086 const ivec2 strides = ivec2(`+le+", "+de+`); 1087 const ivec2 pads = ivec2(`+Y+", "+Z+`); 1088 1089 void main() { 1090 1091 ivec4 coords = getOutputCoords(); 1092 int batch = coords.x; 1093 ivec2 xRCCorner = coords.yz * strides - pads; 1094 int d2 = coords.w; 1095 int d1 = d2; 1096 int q = 0; 1097 int xRCorner = xRCCorner.x; 1098 int xCCorner = xRCCorner.y; 1099 1100 vec4 dotProd = vec4(0.); 1101 1102 `+Je+` 1103 1104 vec4 result = dotProd; 1105 `+tn+` 1106 `+Lt+` 1107 setOutput(result); 1108 } 1109 `};function Wv(_,m){if(_===1)return""+m;if(_===2)return m+".y";if(_===3)return m+".z";if(_===4)return m+".w";throw Error("Cumulative sum for rank "+_+" is not yet supported")}var Vv=function(){function _(m,f,y){this.variableNames=["x"],this.outputShape=[],this.outputShape=m,this.blockSize=f,this.dataFormat=y,this.userCode=` 1110 void main() { 1111 ivec4 coords = getOutputC
1111oords(); 1112 int b = coords[0]; 1113 int h = `+this.getHeightCoordString()+`; 1114 int w = `+this.getWidthCoordString()+`; 1115 int d = `+this.getDepthCoordString()+`; 1116 1117 int in_h = h / `+f+`; 1118 int offset_h = imod(h, `+f+`); 1119 int in_w = w / `+f+`; 1120 int offset_w = imod(w, `+f+`); 1121 int offset_d = (offset_h * `+f+` + offset_w) * 1122 `+this.getOutputDepthSize()+`; 1123 int in_d = d + offset_d; 1124 1125 float result = `+this.getInputSamplingString()+`; 1126 setOutput(result); 1127 } 1128 `}return _.prototype.getHeightCoordString=function(){return this.dataFormat==="NHWC"?"coords[1]":"coords[2]"},_.prototype.getWidthCoordString=function(){return this.dataFormat==="NHWC"?"coords[2]":"coords[3]"},_.prototype.getDepthCoordString=function(){return this.dataFormat==="NHWC"?"coords[3]":"coords[1]"},_.prototype.getOutputDepthSize=function(){return this.dataFormat==="NHWC"?this.outputShape[3]:this.outputShape[1]},_.prototype.getInputSamplingString=function(){return this.dataFormat==="NHWC"?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},_}(),B0=function(_,m,f){this.variableNames=["real","imag"];var y=m[1];this.outputShape=m;var E=f?"2.0 * "+Math.PI:"-2.0 * "+Math.PI,z=f?y+".0":"1.0";this.userCode=` 1129 const float exponentMultiplier = `+E+`; 1130 1131 float unaryOpComplex(float real, float expR, float imag, float expI) { 1132 `+_+` 1133 } 1134 1135 float mulMatDFT(int batch, int index) { 1136 float indexRatio = float(index) / float(`+y+`); 1137 float exponentMultiplierTimesIndexRatio = 1138 exponentMultiplier * indexRatio; 1139 1140 float result = 0.0; 1141 1142 for (int i = 0; i < `+y+`; i++) { 1143 // x = (-2|2 * PI / N) * index * i; 1144 float x = exponentMultiplierTimesIndexRatio * float(i); 1145 float expR = cos(x); 1146 float expI = sin(x); 1147 float real = getReal(batch, i); 1148 float imag = getImag(batch, i); 1149 1150 result += 1151 unaryOpComplex(real, expR, imag, expI) / `+z+`; 1152 } 1153 1154 return result; 1155 } 1156 1157 void main() { 1158 ivec2 coords = getOutputCoords(); 1159 setOutput(mulMatDFT(coords[0], coords[1])); 1160 } 1161 `},P0=function(){function _(m,f){this.outputShape=[],this.variableNames=["x"],this.outputShape=m,this.userCode=` 1162 uniform float value; 1163 void main() { 1164 // Input can be obtained from uniform value. 1165 setOutput(value); 1166 } 1167 `}return _.prototype.getCustomSetupFunc=function(m){var f=this;return function(y,E){f.valueLoc==null&&(f.valueLoc=y.getUniformLocationNoThrow(E,"value")),y.gl.uniform1f(f.valueLoc,m)}},_}();function $v(_,m){var f=qo();return Eo(_,m,f.version+` 1168 precision highp float; 1169 `+f.attribute+` vec3 clipSpacePos; 1170 `+f.attribute+` vec2 uv; 1171 `+f.varyingVs+` vec2 resultUV; 1172 1173 void main() { 1174 gl_Position = vec4(clipSpacePos, 1); 1175 resultUV = uv; 1176 }`)}function j0(_,m){return Wl(_,m,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function Hv(_,m){return Jc(_,m,new Uint16Array([0,1,2,2,1,3]))}function xh(_,m,f,y,E,z,Y){Sm(f,y);var Z=Vl(_,m),le=_.TEXTURE_2D;return Hn(_,m,function(){return _.bindTexture(le,Z)}),Hn(_,m,function(){return _.texParameteri(le,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE)}),Hn(_,m,function(){return _.texParameteri(le,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE)}),Hn(_,m,function(){return _.texParameteri(le,_.TEXTURE_MIN_FILTER,_.NEAREST)}),Hn(_,m,function(){return _.texParameteri(le,_.TEXTURE_MAG_FILTER,_.NEAREST)}),Hn(_,m,function(){return _.texImage2D(le,0,E,f,y,0,z,Y,null)}),Hn(_,m,function(){return _.bindTexture(_.TEXTURE_2D,null)}),Z}function Gm(_,m,f,y,E){var z=ko(f,y);return xh(_,m,z[0],z[1],E.internalFormatFloat,E.textureFormatFloat,_.FLOAT)}function qv(_,m,f,y,E){var z=ko(f,y);return xh(_,m,z[0],z[1],E.internalFormatHalfFloat,E.textureFormatFloat,E.textureTypeHalfFloat)}function Gv(_,m,f,y,E){var z=ko(f,y);return xh(_,m,z[0],z[1],_.RGBA,_.RGBA,_.UNSIGNED_BYTE)}function Kv(_,m,f,y,E){var z=ai(f,y);return xh(_,m,z[0],z[1],E.internalFormatPackedFloat,_.RGBA,_.FLOAT)}function Jl(_,m,f,y,E){var z=ai(f,y);return xh(_,m,z[0],z[1],E.internalFormatPackedHalfFloat,_.RGBA,E.textureTypeHalfFloat)}function wh(_,m,f,y){return Hn(_,m,function(){return _.bindBuffer(_.ARRAY_BUFFER,y)}),Zd(_,m,f,"clipSpacePos",y,3,20,0)&&Zd(_,m,f,"uv",y,2,20,12)}function Km(_,m,f,y,E,z,Y){var Z,le,de;Hn(_,m,function(){return _.bindTexture(_.TEXTURE_2D,f)}),z instanceof Uint8Array?(Z=new Uint8Array(y*E*4),le=_.UNSIGNED_BYTE,de=_.RGBA):(Z=new Float32Array(y*E*4),le=_.FLOAT,de=Y.internalFormatPackedFloat),Z.set(z),Hn(_,m,function(){return _.texImage2D(_.TEXTURE_2D,0,de,y,E,0,_.RGBA,le,Z)}),Hn(_,m,function(){return _.bindTexture(_.TEXTURE_2D,null)})}function L0(_,m,f,y){Hn(_,m,function(){return _.bindTexture(_.TEXTURE_2D,f)}),y.data instanceof Uint8Array?Hn(_,m,function(){return _.texImage2D(_.TEXTURE_2D,0,_.RGBA,y.width,y.height,0,_.RGBA,_.UNSIGNED_BYTE,y.data)}):Hn(_,m,function(){return _.texImage2D(_.TEXTURE_2D,0,_.RGBA,_.RGBA,_.UNSIGNED_BYTE,y)}),Hn(_,m,function(){return _.bindTexture(_.TEXTURE_2D,null)})}function z0(_,m,f,y,E){var z=_.createBuffer();Hn(_,m,function(){return _.bindBuffer(_.PIXEL_PACK_BUFFER,z)});var Y=16*f*y;return Hn(_,m,function(){return _.bufferData(_.PIXEL_PACK_BUFFER,Y,_.STREAM_READ)}),Hn(_,m,function(){return _.readPixels(0,0,y,f,_.RGBA,_.FLOAT,0)}),Hn(_,m,function(){return _.bindBuffer(_.PIXEL_PACK_BUFFER,null)}),z}function g1(_,m,f){var y=_,E=new Float32Array(f);return y.bindBuffer(y.PIXEL_PACK_BUFFER,m),y.getBufferSubData(y.PIXEL_PACK_BUFFER,0,E),y.bindBuffer(y.PIXEL_PACK_BUFFER,null),E}function U0(_,m,f,y,E){var z=ko(f,y),Y=z[0],Z=z[1],le=new Uint8Array(f*y*4);return Hn(_,m,function(){return _.readPixels(0,0,Y,Z,E.downloadTextureFormat,_.UNSIGNED_BYTE,le)}),new Float32Array(le.buffer)}function Rp(_,m,f,y,E,z,Y,Z){var le=_,de=new Float32Array(function(we,De){var Ne=ai(z,Y);return Ne[0]*Ne[1]*4}());return le.bindBuffer(le.PIXEL_PACK_BUFFER,m),le.getBufferSubData(le.PIXEL_PACK_BUFFER,0,de),le.bindBuffer(le.PIXEL_PACK_BUFFER,null),de}function _h(_,m,f,y){var E=new Float32Array(f*y*4);return Hn(_,m,function(){return _.readPixels(0,0,y,f,_.RGBA,_.FLOAT,E)}),E}var Ql=Object.freeze({createVertexShader:$v,createVertexBuffer:j0,createIndexBuffer:Hv,createFloat32MatrixTexture:Gm,createFloat16MatrixTexture:qv,createUnsignedBytesMatrixTexture:Gv,createPackedMatrixTexture:Kv,createFloat16PackedMatrixTexture:Jl,bindVertexProgramAttributeStreams:wh,uploadDenseMatrixToTexture:Km,uploadPixelDataToTexture:L0,createBufferFromOutputTexture:z0,downloadFloat32MatrixFromBuffer:g1,downloadByteEncodedFloatMatrixFromOutputTexture:U0,downloadPackedMatrixFromBuffer:Rp,downloadMatrixFromPackedOutputTexture:_h}),W0=function(){function _(m){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];var f=L().getNumber("WEBGL_VERSION");m!=null?(this.gl=m,Lo(f,m)):this.gl=Ai(f);var y="WEBGL_color_buffer_float";if(L().getNumber("WEBGL_VERSION")===1){if(this.textureFloatExtension=Ko(this.gl,this.debug,"OES_texture_float"),Ja(this.gl,"OES_texture_half_float"))this.textureHalfFloatExtension=Ko(this.gl,this.debug,"OES_texture_half_float");else if(L().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(y),Ja(this.gl,"EXT_color_buffer_half_float"))this.colorBufferHalfFloatExtension=Ko(this.gl,this.debug,"EXT_color_buffer_half_float");else if(L().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(y="EXT_color_buffer_float",Ja(this.gl,y))this.colorBufferFloatExtension=this.gl.getExtension(y);else{if(!Ja(this.gl,"EXT_color_buffer_half_float"))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float")}this.vertexBuffer=j0(this.gl,this.debug),this.indexBuffer=Hv(this.gl,this.debug),this.framebuffer=Qs(this.gl,this.debug),this.textureConfig=Yr(this.gl,this.textureHalfFloatExtension)}return Object.defineProperty(_.prototype,"debug",{get:function(){return L().getBool("DEBUG")},enumerable:!0,configurable:!0}),_.prototype.dispose=function(){var m=this;if(!this.disposed){this.program!=null&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),this.outputTexture!=null&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");var f=this.gl;Hn(f,this.debug,function(){return f.finish()}),Hn(f,this.debug,function(){return f.bindFramebuffer(f.FRAMEBUFFER,null)}),Hn(f,this.debug,function(){return f.deleteFramebuffer(m.framebuffer)}),Hn(f,this.debug,function(){return f.bindBuffer(f.ARRAY_BUFFER,null)}),Hn(f,this.debug,function(){return f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,null)}),Hn(f,this.debug,function(){return f.deleteBuffer(m.indexBuffer)}),this.disposed=!0}},_.prototype.createFloat32MatrixTexture=function(m,f){return this.throwIfDisposed(),Gm(this.gl,this.debug,m,f,this.textureConfig)},_.prototype.createFloat16MatrixTexture=function(m,f){return this.throwIfDisposed(),qv(this.gl,this.debug,m,f,this.textureConfig)},_.prototype.createUnsignedBytesMatrixTexture=function(m,f){return this.throwIfDisposed(),Gv(this.gl,this.debug,m,f,this.textureConfig)},_.prototype.uploadPixelDataToTexture=function(m,f){this.throwIfDisposed(),L0(this.gl,this.debug,m,f)},_.prototype.uploadDenseMatrixToTexture=function(m,f,y,E){this.throwIfDisposed(),Km(this.gl,this.debug,m,f,y,E,this.textureConfig)},_.prototype.createFloat16PackedMatrixTexture=function(m,f){return this.throwIfDisposed(),Jl(this.gl,this.debug,m,f,this.textureConfig)},_.prototype.createPackedMatrixTexture=function(m,f){return this.throwIfDisposed(),Kv(this.gl,this.debug,m,f,this.textureConfig)},_.prototype.deleteMatrixTexture=function(m){var f=this;this.throwIfDisposed(),this.outputTexture===m&&(nd(this.gl,this.debug,this.framebuffer),this.outputTexture=null),Hn(this.gl,this.debug,function(){return f.gl.deleteTexture(m)})},_.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(m,f,y){var E=this;
vendor: 9,196 bytes, lines 1176-1192
1176return this.downloadMatrixDriver(m,function(){return U0(E.gl,E.debug,f,y,E.textureConfig)})},_.prototype.downloadPackedMatrixFromBuffer=function(m,f,y,E,z,Y){return Rp(this.gl,m,0,0,0,z,Y,this.textureConfig)},_.prototype.downloadFloat32MatrixFromBuffer=function(m,f){return g1(this.gl,m,f)},_.prototype.createBufferFromTexture=function(m,f,y){this.bindTextureToFrameBuffer(m);var E=z0(this.gl,this.debug,f,y,this.textureConfig);return this.unbindTextureToFrameBuffer(),E},_.prototype.createAndWaitForFence=function(){var m=this.createFence(this.gl);return this.pollFence(m)},_.prototype.createFence=function(m){var f,y,E=this;if(L().getBool("WEBGL_FENCE_API_ENABLED")){var z=m,Y=z.fenceSync(z.SYNC_GPU_COMMANDS_COMPLETE,0);m.flush(),y=function(){var Z=z.clientWaitSync(Y,0,0);return Z===z.ALREADY_SIGNALED||Z===z.CONDITION_SATISFIED},f=Y}else L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(f=this.beginQuery(),this.endQuery(),y=function(){return E.isQueryAvailable(f,L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):y=function(){return!0};return{query:f,isFencePassed:y}},_.prototype.downloadMatrixFromPackedTexture=function(m,f,y){var E=this;return this.downloadMatrixDriver(m,function(){return _h(E.gl,E.debug,f,y)})},_.prototype.createProgram=function(m){this.throwIfDisposed();var f=this.gl,y=Yo(f,this.debug,m),E=$v(f,this.debug),z=fo(f,this.debug);return Hn(f,this.debug,function(){return f.attachShader(z,E)}),Hn(f,this.debug,function(){return f.attachShader(z,y)}),yl(f,this.debug,z),this.debug&&Tc(f,this.debug,z),this.vertexAttrsAreBound||(this.setProgram(z),this.vertexAttrsAreBound=wh(f,this.debug,this.program,this.vertexBuffer)),z},_.prototype.deleteProgram=function(m){var f=this;this.throwIfDisposed(),m===this.program&&(this.program=null),m!=null&&Hn(this.gl,this.debug,function(){return f.gl.deleteProgram(m)})},_.prototype.setProgram=function(m){var f=this;this.throwIfDisposed(),this.program=m,this.program!=null&&this.debug&&Tc(this.gl,this.debug,this.program),Hn(this.gl,this.debug,function(){return f.gl.useProgram(m)})},_.prototype.getUniformLocation=function(m,f,y){return y===void 0&&(y=!0),this.throwIfDisposed(),y?Qc(this.gl,this.debug,m,f):eh(this.gl,m,f)},_.prototype.getAttributeLocation=function(m,f){var y=this;return this.throwIfDisposed(),Hn(this.gl,this.debug,function(){return y.gl.getAttribLocation(m,f)})},_.prototype.getUniformLocationNoThrow=function(m,f){return this.throwIfDisposed(),this.gl.getUniformLocation(m,f)},_.prototype.setInputMatrixTexture=function(m,f,y){this.throwIfDisposed(),this.throwIfNoProgram(),mp(this.gl,this.debug,this.program,m,f,y)},_.prototype.setOutputMatrixTexture=function(m,f,y){this.setOutputMatrixTextureDriver(m,y,f)},_.prototype.setOutputPackedMatrixTexture=function(m,f,y){this.throwIfDisposed();var E=ai(f,y),z=E[0],Y=E[1];this.setOutputMatrixTextureDriver(m,z,Y)},_.prototype.setOutputMatrixWriteRegion=function(m,f,y,E){this.setOutputMatrixWriteRegionDriver(y,m,E,f)},_.prototype.setOutputPackedMatrixWriteRegion=function(m,f,y,E){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},_.prototype.debugValidate=function(){this.program!=null&&Tc(this.gl,this.debug,this.program),ys(this.gl)},_.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var m=this.gl;this.debug&&this.debugValidate(),Hn(m,this.debug,function(){return m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0)})},_.prototype.blockUntilAllProgramsCompleted=function(){var m=this;this.throwIfDisposed(),Hn(this.gl,this.debug,function(){return m.gl.finish()})},_.prototype.getQueryTimerExtension=function(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=Ko(this.gl,this.debug,L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},_.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},_.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},_.prototype.beginQuery=function(){if(L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){var m=this.gl,f=this.getQueryTimerExtensionWebGL2(),y=m.createQuery();return m.beginQuery(f.TIME_ELAPSED_EXT,y),y}var E=this.getQueryTimerExtensionWebGL1(),z=E.createQueryEXT();return E.beginQueryEXT(E.TIME_ELAPSED_EXT,z),z},_.prototype.endQuery=function(){if(L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")!==2){var m=this.getQueryTimerExtensionWebGL1();m.endQueryEXT(m.TIME_ELAPSED_EXT)}else{var f=this.gl,y=this.getQueryTimerExtensionWebGL2();f.endQuery(y.TIME_ELAPSED_EXT)}},_.prototype.waitForQueryAndGetTime=function(m){return S(this,void 0,void 0,function(){var f=this;return M(this,function(y){switch(y.label){case 0:return[4,_t(function(){return f.disposed||f.isQueryAvailable(m,L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return y.sent(),[2,this.getQueryTime(m,L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}})})},_.prototype.getQueryTime=function(m,f){if(f===0)return null;if(f===2){var y=this.gl;return y.getQueryParameter(m,y.QUERY_RESULT)/1e6}var E=this.getQueryTimerExtensionWebGL1();return E.getQueryObjectEXT(m,E.QUERY_RESULT_EXT)/1e6},_.prototype.isQueryAvailable=function(m,f){if(f===0)return!0;if(f===2){var y=this.gl,E=this.getQueryTimerExtensionWebGL2(),z=y.getQueryParameter(m,y.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(E.GPU_DISJOINT_EXT)),z&&!this.disjoint}return z=(E=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(m,E.QUERY_RESULT_AVAILABLE_EXT),this.disjoint==null&&(this.disjoint=this.gl.getParameter(E.GPU_DISJOINT_EXT)),z&&!this.disjoint},_.prototype.pollFence=function(m){var f=this;return new Promise(function(y){f.addItemToPoll(function(){return m.isFencePassed()},function(){return y()})})},_.prototype.pollItems=function(){for(var m=function(y){for(var E=0;E<y.length&&y[E]();++E);return E-1}(this.itemsToPoll.map(function(y){return y.isDoneFn})),f=0;f<=m;++f)(0,this.itemsToPoll[f].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(m+1)},_.prototype.addItemToPoll=function(m,f){var y=this;this.itemsToPoll.push({isDoneFn:m,resolveFn:f}),this.itemsToPoll.length>1||_t(function(){return y.pollItems(),y.itemsToPoll.length===0})},_.prototype.bindTextureToFrameBuffer=function(m){this.throwIfDisposed(),$l(this.gl,this.debug,m,this.framebuffer),this.debug&&ys(this.gl)},_.prototype.unbindTextureToFrameBuffer=function(){this.outputTexture!=null?($l(this.gl,this.debug,this.outputTexture,this.framebuffer),this.debug&&ys(this.gl)):nd(this.gl,this.debug,this.framebuffer)},_.prototype.downloadMatrixDriver=function(m,f){this.bindTextureToFrameBuffer(m);var y=f();return this.unbindTextureToFrameBuffer(),y},_.prototype.setOutputMatrixTextureDriver=function(m,f,y){this.throwIfDisposed();var E=this.gl;$l(E,this.debug,m,this.framebuffer),this.debug&&ys(E),this.outputTexture=m,Hn(E,this.debug,function(){return E.viewport(0,0,f,y)}),Hn(E,this.debug,function(){return E.scissor(0,0,f,y)})},_.prototype.setOutputMatrixWriteRegionDriver=function(m,f,y,E){var z=this;this.throwIfDisposed(),Hn(this.gl,this.debug,function(){return z.gl.scissor(m,f,y,E)})},_.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},_.prototype.throwIfNoProgram=function(){if(this.program==null)throw new Error("No GPU program is currently set.")},_}();function V0(_,m){if(_.length!==m.length)throw Error("Binary was compiled with "+_.length+" inputs, but was executed with "+m.length+" inputs");_.forEach(function(f,y){var E=f.logicalShape,z=m[y],Y=z.shape;if(!Tt(E,Y))throw Error("Binary was compiled with different shapes than the current args. Shapes "+E+" and "+Y+" must match");if(!f.isUniform||!z.isUniform){var Z=f.texShape,le=z.isUniform?null:z.texData.texShape;if(!Tt(Z,le))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+Z+" and "+le+" must match")}})}var Lc=function(_,m,f,y,E,z,Y){f===void 0&&(f=!1),y===void 0&&(y=!1),E===void 0&&(E=!1),z===void 0&&(z=null),Y===void 0&&(Y=!1),this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=m;var Z=f?_[1]:_[2],le=Math.ceil(Z/2),de=f?"i * 2, rc.y":"rc.y, i * 2",we=y?"rc.z, i * 2":"i * 2, rc.z",De=f?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],Ne=y?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],Fe="",Ve="";z&&(Fe=Y?`vec4 activation(vec4 a) { 1177 vec4 b = getPreluActivationWeightsAtOutCoords(); 1178 `+z+` 1179 }`:`vec4 activation(vec4 x) { 1180 `+z+` 1181 }`,Ve="result = activation(result);");var Je=E?"result += getBiasAtOutCoords();":"";E&&this.variableNames.push("bias"),Y&&this.variableNames.push("preluActivationWeights"),this.userCode=` 1182 `+Fe+` 1183 1184 const float sharedDimension = `+le+`.0; 1185 1186 vec4 dot2x2ARowBCol(ivec3 rc) { 1187 vec4 result = vec4(0); 1188 for (int i = 0; i < `+le+`; i++) { 1189 vec4 a = getMatrixA(rc.x, `+de+`); 1190 vec4 b = getMatrixB(rc.x, `+we+`); 1191 1192 // These swizzled products need to be separately added.
1193 // See: https://github.com/tensorflow/tfjs/issues/1735 1194 result += (`+De[0]+" * "+Ne[0]+`); 1195 result += (`+De[1]+" * "+Ne[1]+`); 1196 } 1197 return result; 1198 } 1199 1200 void main() { 1201 ivec3 rc = getOutputCoords(); 1202 vec4 result = dot2x2ARowBCol(rc); 1203 1204 `+Je+` 1205 1206 `+Ve+` 1207 1208 setOutput(result); 1209 } 1210 `},$0=function(){function _(m,f,y){this.variableNames=["probs"],this.outputShape=[m,y],this.userCode=` 1211 uniform float seed; 1212 1213 void main() { 1214 ivec2 coords = getOutputCoords(); 1215 int batch = coords[0]; 1216 1217 float r = random(seed); 1218 float cdf = 0.0; 1219 1220 for (int i = 0; i < `+(f-1)+`; i++) { 1221 cdf += getProbs(batch, i); 1222 1223 if (r < cdf) { 1224 setOutput(float(i)); 1225 return; 1226 } 1227 } 1228 1229 // If no other event happened, last event happened. 1230 setOutput(float(`+(f-1)+`)); 1231 } 1232 `}return _.prototype.getCustomSetupFunc=function(m){var f=this;return function(y,E){f.seedLoc==null&&(f.seedLoc=y.getUniformLocation(E,"seed")),y.gl.uniform1f(f.seedLoc,m)}},_}(),Bp=function(_,m,f,y,E){if(y===void 0&&(y=!1),E===void 0&&(E=!1),this.variableNames=["x"],m==="avg"&&f)throw new Error("Cannot compute positions for average pool.");var z=_.filterWidth,Y=_.strideHeight,Z=_.strideWidth,le=_.dilationHeight,de=_.dilationWidth,we=_.effectiveFilterHeight,De=_.effectiveFilterWidth,Ne=_.padInfo.top,Fe=_.padInfo.left;this.outputShape=_.outShape;var Ve=m==="avg",Je="((batch * "+_.inHeight+" + xR) * "+_.inWidth+" + xC) * "+_.inChannels+" + d",Xe="(xR * "+_.inWidth+" + xC) * "+_.inChannels+" + d",ot="0.0";if(Ve||(ot="-1.0 / 1e-20"),f)this.userCode=` 1233 const ivec2 strides = ivec2(`+Y+", "+Z+`); 1234 const ivec2 pads = ivec2(`+Ne+", "+Fe+`); 1235 1236 void main() { 1237 ivec4 coords = getOutputCoords(); 1238 int batch = coords[0]; 1239 int d = coords[3]; 1240 1241 ivec2 xRCCorner = coords.yz * strides - pads; 1242 int xRCorner = xRCCorner.x; 1243 int xCCorner = xRCCorner.y; 1244 1245 // max/min x(?, ?, d) to get y(yR, yC, d). 1246 // ? = to be determined 1247 float minMaxValue = 0.0; 1248 float minMaxValueFound = 0.0; 1249 int minMaxPosition = 0; 1250 float avgValue = 0.0; 1251 1252 for (int wR = 0; wR < `+we+`; 1253 wR += `+le+`) { 1254 int xR = xRCorner + wR; 1255 1256 if (xR < 0 || xR >= `+_.inHeight+`) { 1257 continue; 1258 } 1259 1260 for (int wC = 0; wC < `+De+`; 1261 wC += `+de+`) { 1262 int xC = xCCorner + wC; 1263 1264 if (xC < 0 || xC >= `+_.inWidth+`) { 1265 continue; 1266 } 1267 1268 float value = getX(batch, xR, xC, d); 1269 1270 // If a min / max value has already been found, use it. If not, 1271 // use the current value. 1272 float currMinMaxValue = mix( 1273 value, minMaxValue, minMaxValueFound); 1274 if (value >= currMinMaxValue) { 1275 minMaxValue = value; 1276 minMaxValueFound = 1.0; 1277 minMaxPosition = `+(y?E?Je:Xe:"wR * "+De+" + wC")+`; 1278 } 1279 } 1280 } 1281 setOutput(float(minMaxPosition)); 1282 } 1283 `;else{var xt=m+"("+m+"("+m+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";m==="avg"&&(xt="avgValue / count");var kt=4*Math.floor(z/4),At=z%4,Lt=` 1284 if (`+Ve+`) { 1285 avgValue += dot(values, ones); 1286 } else { 1287 minMaxValue = max(values, minMaxValue); 1288 } 1289 `;this.userCode=` 1290 const ivec2 strides = ivec2(`+Y+", "+Z+`); 1291 const ivec2 pads = ivec2(`+Ne+", "+Fe+`); 1292 const float initializationValue = `+ot+`; 1293 const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0); 1294 1295 float count = 0.0; 1296 1297 float getValue(int batch, int xR, int xC, int d) { 1298 if (xC < 0 || xC >= `+_.inWidth+`) { 1299 return initializationValue; 1300 } 1301 count += 1.0; 1302 return getX(batch, xR, xC, d); 1303 } 1304 1305 void main() { 1306 ivec4 coords = getOutputCoords(); 1307 int batch = coords[0]; 1308 int d = coords[3]; 1309 1310 ivec2 xRCCorner = coords.yz * strides - pads; 1311 int xRCorner = xRCCorner.x; 1312 int xCCorner = xRCCorner.y; 1313 1314 // max/min x(?, ?, d) to get y(yR, yC, d). 1315 // ? = to be determined 1316 vec4 minMaxValue = vec4(`+ot+`); 1317 float avgValue = 0.0; 1318 count = 0.0; 1319 1320 for (int wR = 0; wR < `+we+`; 1321 wR += `+le+`) { 1322 int xR = xRCorner + wR; 1323 1324 if (xR < 0 || xR >= `+_.inHeight+`) { 1325 continue; 1326 } 1327 1328 for (int wC = 0; wC < `+kt+`; wC += 4) { 1329 int xC = xCCorner + wC * `+de+`; 1330 1331 vec4 values = vec4( 1332 getValue(batch, xR, xC, d), 1333 getValue(batch, xR, xC + `+de+`, d), 1334 getValue(batch, xR, xC + 2 * `+de+`, d), 1335 getValue(batch, xR, xC + 3 * `+de+`, d) 1336 ); 1337 1338 `+Lt+` 1339 } 1340 1341 int xC = xCCorner + `+kt+`; 1342 if (`+(At===1)+`) { 1343 vec4 values = vec4( 1344 getValue(batch, xR, xC, d), 1345 initializationValue, 1346 initializationValue, 1347 initializationValue 1348 ); 1349 1350 `+Lt+` 1351 } else if (`+(At===2)+`) { 1352 vec4 values = vec4( 1353 getValue(batch, xR, xC, d), 1354 getValue(batch, xR, xC + `+de+`, d), 1355 initializationValue, 1356 initializationValue 1357 ); 1358 1359 `+Lt+` 1360 } else if (`+(At===3)+`) { 1361 vec4 values = vec4( 1362 getValue(batch, xR, xC, d), 1363 getValue(batch, xR, xC + `+de+`, d), 1364 getValue(batch, xR, xC + 2 * `+de+`, d), 1365 initializationValue 1366 ); 1367 1368 `+Lt+` 1369 } 1370 } 1371 setOutput(`+xt+`); 1372 } 1373 `}},Ym=function(_,m,f,y,E){if(y===void 0&&(y=!1),E===void 0&&(E=!1),this.variableNames=["x"],m==="avg"&&f)throw new Error("Cannot compute positions for average pool.");var z=_.filterWidth,Y=_.strideDepth,Z=_.strideHeight,le=_.strideWidth,de=_.dilationDepth,we=_.dilationHeight,De=_.dilationWidth,Ne=_.effectiveFilterDepth,Fe=_.effectiveFilterHeight,Ve=_.effectiveFilterWidth,Je=_.padInfo.front,Xe=_.padInfo.top,ot=_.padInfo.left;this.outputShape=_.outShape;var xt=m==="avg",kt="0.0";if(xt||(kt="-1.0 / 1e-20"),f)this.userCode=` 1374 const ivec3 strides = 1375 ivec3(`+Y+", "+Z+", "+le+`); 1376 const ivec3 pads = ivec3(`+Je+", "+Xe+", "+ot+`); 1377 1378 void main() { 1379 ivec5 coords = getOutputCoords(); 1380 int batch = coords.x; 1381 int ch = coords.u; 1382 1383 ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads; 1384 int xDCorner = xCorner.x; 1385 int xRCorner = xCorner.y; 1386 int xCCorner = xCorner.z; 1387 1388 // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch). 1389 // ? = to be determined 1390 float minMaxValue = 0.0; 1391 float minMaxValueFound = 0.0; 1392 int minMaxPosition = 0; 1393 1394 for (int wD = 0; wD < `+Ne+`; 1395 wD += `+de+`) { 1396 int xD = xDCorner + wD; 1397 1398 if (xD < 0 || xD >= `+_.inDepth+`) { 1399 continue; 1400 } 1401 1402 for (int wR = 0; wR < `+Fe+`; 1403 wR += `+we+`) { 1404 int xR = xRCorner + wR; 1405 1406 if (xR < 0 || xR >= `+_.inHeight+`) { 1407 continue; 1408 } 1409 1410 for (int wC = 0; wC < `+Ve+`; 1411 wC += `+De+`) { 1412 int xC = xCCorner + wC; 1413 1414 if (xC < 0 || xC >= `+_.inWidth+`) { 1415 continue; 1416 } 1417 1418 float value = getX(batch, xD, xR, xC, ch); 1419 1420 // If a min / max value has already been found, use it. If not, 1421 // use the current value. 1422 float currMinMaxValue = mix( 1423 value, minMaxValue, minMaxValueFound); 1424 if (value >= currMinMaxValue) { 1425 minMaxValue = value; 1426 minMaxValueFound = 1.0; 1427 minMaxPosition = `+(y?E?"(((batch * "+_.inDepth+" + xD) * "+_.inHeight+" + xR) * "+_.inWidth+" + xC) * "+_.inChannels+"
1427+ ch":"((xD * "+_.inHeight+" + xR) * "+_.inWidth+" + xC) * "+_.inChannels+" + ch":"wD * "+Fe+" * "+Ve+` + 1428 wR * `+Ve+" + wC")+`; 1429 } 1430 } 1431 } 1432 } 1433 setOutput(float(minMaxPosition)); 1434 } 1435 `;else{var At=m+"("+m+"("+m+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";m==="avg"&&(At="avgValue / count");var Lt=4*Math.floor(z/4),tn=z%4,ln=` 1436 if (`+xt+`) { 1437 avgValue += dot(values, ones); 1438 } else { 1439 minMaxValue = max(values, minMaxValue); 1440 } 1441 `;this.userCode=` 1442 const ivec3 strides = 1443 ivec3(`+Y+", "+Z+", "+le+`); 1444 const ivec3 pads = ivec3(`+Je+", "+Xe+", "+ot+`); 1445 const float initializationValue = `+kt+`; 1446 const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0); 1447 1448 float count = 0.0; 1449 1450 float getValue(int batch, int xD, int xR, int xC, int ch) { 1451 if (xC < 0 || xC >= `+_.inWidth+`) { 1452 return initializationValue; 1453 } 1454 count += 1.0; 1455 return getX(batch, xD, xR, xC, ch); 1456 } 1457 1458 void main() { 1459 ivec5 coords = getOutputCoords(); 1460 int batch = coords.x; 1461 int ch = coords.u; 1462 1463 ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads; 1464 int xDCorner = xCorner.x; 1465 int xRCorner = xCorner.y; 1466 int xCCorner = xCorner.z; 1467 1468 // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch). 1469 // ? = to be determined 1470 vec4 minMaxValue = vec4(`+kt+`); 1471 float avgValue = 0.0; 1472 count = 0.0; 1473 1474 for (int wD = 0; wD < `+Ne+`; 1475 wD += `+de+`) { 1476 int xD = xDCorner + wD; 1477 1478 if (xD < 0 || xD >= `+_.inDepth+`) { 1479 continue; 1480 } 1481 1482 for (int wR = 0; wR < `+Fe+`; 1483 wR += `+we+`) { 1484 int xR = xRCorner + wR; 1485 1486 if (xR < 0 || xR >= `+_.inHeight+`) { 1487 continue; 1488 } 1489 1490 for (int wC = 0; wC < `+Lt+`; wC += 4) { 1491 int xC = xCCorner + wC * `+De+`; 1492 1493 vec4 values = vec4( 1494 getValue(batch, xD, xR, xC, ch), 1495 getValue(batch, xD, xR, xC + `+De+`, ch), 1496 getValue(batch, xD, xR, xC + 2 * `+De+`, ch), 1497 getValue(batch, xD, xR, xC + 3 * `+De+`, ch) 1498 ); 1499 1500 `+ln+` 1501 } 1502 1503 int xC = xCCorner + `+Lt+`; 1504 if (`+(tn===1)+`) { 1505 vec4 values = vec4( 1506 getValue(batch, xD, xR, xC, ch), 1507 initializationValue, 1508 initializationValue, 1509 initializationValue 1510 ); 1511 1512 `+ln+` 1513 } else if (`+(tn===2)+`) { 1514 vec4 values = vec4( 1515 getValue(batch, xD, xR, xC, ch), 1516 getValue(batch, xD, xR, xC + `+De+`, ch), 1517 initializationValue, 1518 initializationValue 1519 ); 1520 1521 `+ln+` 1522 } else if (`+(tn===3)+`) { 1523 vec4 values = vec4( 1524 getValue(batch, xD, xR, xC, ch), 1525 getValue(batch, xD, xR, xC + `+De+`, ch), 1526 getValue(batch, xD, xR, xC + 2 * `+De+`, ch), 1527 initializationValue 1528 ); 1529 1530 `+ln+` 1531 } 1532 } 1533 setOutput(`+At+`); 1534 } 1535 } 1536 `}},v1=function(_,m,f,y,E,z,Y){this.variableNames=["updates","indices","defaultValue"],this.outputShape=z;var Z=fa(E.length),le=fa(z.length),de="";f===1?de="i":f===2&&(de="i, j");var we="getIndices("+de+")",De="";y===1?De="i":y===2&&(De="i, coords[1]");var Ne="getUpdates("+De+")",Fe=m>1?"strides[j]":"strides";this.userCode=` 1537 `+Z+" strides = "+Z+"("+E+`); 1538 1539 void main() { 1540 `+le+` coords = getOutputCoords(); 1541 float sum = 0.0; 1542 bool found = false; 1543 for (int i = 0; i < `+_+`; i++) { 1544 int flattenedIndex = 0; 1545 for (int j = 0; j < `+m+`; j++) { 1546 int index = round(`+we+`); 1547 flattenedIndex += index * `+Fe+`; 1548 } 1549 if (flattenedIndex == coords[0]) { 1550 sum += `+Ne+`; 1551 found = true; 1552 } 1553 } 1554 setOutput(mix(getDefaultValue(), sum, float(found))); 1555 } 1556 `},Xm=function(){function _(m){this.variableNames=["source"],this.outputShape=m,this.rank=m.length;var f,y=fa(this.rank),E="uniform int start["+this.rank+"];",z=function(Y){if(Y===1)return"sourceLoc";if(Y<=6)return Zl.slice(0,Y).map(function(Z){return"sourceLoc."+Z}).join(",");throw Error("Slicing for rank "+Y+" is not yet supported")}(this.rank);f=` 1557 `+y+` sourceLoc; 1558 `+y+` coords = getOutputCoords(); 1559 `+m.map(function(Y,Z){return"sourceLoc."+Zl[Z]+" = start["+Z+"] + coords."+Zl[Z]+";"}).join(` 1560`)+` 1561 `,this.userCode=` 1562 `+E+` 1563 void main() { 1564 `+f+` 1565 setOutput(getSource(`+z+`)); 1566 } 1567 `}return _.prototype.getCustomSetupFunc=function(m){var f=this;if(m.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+m.length+")");return function(y,E){f.startLoc==null&&(f.startLoc=y.getUniformLocationNoThrow(E,"start"),f.startLoc==null)||y.gl.uniform1iv(f.startLoc,m)}},_}(),Zl=["x","y","z","w","u","v"],Jm=function(){function _(m){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=m,this.rank=m.length;var f=fa(this.rank),y=Za("coords",this.rank),E=Za("sourceLoc",this.rank),z=this.rank===1?"sourceLoc":"vec2("+E.slice(-2).join()+")",Y="getChannel(getSource("+E.join()+"), "+z+")",Z=` 1568 result.x = `+Y+`; 1569 if (++`+y[this.rank-1]+" < "+m[this.rank-1]+`) { 1570 ++`+E[this.rank-1]+`; 1571 result.y = `+Y+`; 1572 --`+E[this.rank-1]+`; 1573 } 1574 `,le=this.rank===1?"":` 1575 --`+y[this.rank-1]+`; 1576 if (++`+y[this.rank-2]+" < "+m[this.rank-2]+`) { 1577 ++`+E[this.rank-2]+`; 1578 result.z = `+Y+`; 1579 if (++`+y[this.rank-1]+" < "+m[this.rank-1]+`) { 1580 ++`+E[this.rank-1]+`; 1581 result.w = `+Y+`; 1582 } 1583 }
1584 `,de=this.rank<=4?`sourceLoc = coords + 1585 `+f+"("+m.map(function(we,De){return"start["+De+"]"}).join()+");":m.map(function(we,De){return E[De]+" = "+y[De]+" + start["+De+"];"}).join(` 1586`);this.userCode=` 1587 uniform int start[`+this.rank+`]; 1588 void main() { 1589 `+f+` coords = getOutputCoords(); 1590 `+f+` sourceLoc; 1591 `+de+` 1592 vec4 result = vec4(0.); 1593 `+Z+` 1594 `+le+` 1595 setOutput(result); 1596 } 1597 `}return _.prototype.getCustomSetupFunc=function(m){var f=this;if(m.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+m.length+")");return function(y,E){f.startLoc==null&&(f.startLoc=y.getUniformLocationNoThrow(E,"start"),f.startLoc==null)||y.gl.uniform1iv(f.startLoc,m)}},_}(),Yv=function(){function _(m){this.gpgpu=m,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return _.prototype.acquireTexture=function(m,f,y){var E,z=Xv(f,y),Y=H0(m,z,y);if(Y in this.freeTextures||(this.freeTextures[Y]=[]),Y in this.usedTextures||(this.usedTextures[Y]=[]),this.freeTextures[Y].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var Z=this.freeTextures[Y].shift();return this.usedTextures[Y].push(Z),Z}return this.numUsedTextures++,this.log(),z===Zr.PACKED_2X2_FLOAT32?E=this.gpgpu.createPackedMatrixTexture(m[0],m[1]):z===Zr.PACKED_2X2_FLOAT16?E=this.gpgpu.createFloat16PackedMatrixTexture(m[0],m[1]):z===Zr.UNPACKED_FLOAT32?E=this.gpgpu.createFloat32MatrixTexture(m[0],m[1]):z===Zr.UNPACKED_FLOAT16?E=this.gpgpu.createFloat16MatrixTexture(m[0],m[1]):z===Zr.PACKED_4X1_UNSIGNED_BYTE&&(E=this.gpgpu.createUnsignedBytesMatrixTexture(m[0],m[1])),this.usedTextures[Y].push(E),E},_.prototype.releaseTexture=function(m,f,y,E){if(this.freeTextures!=null){var z=H0(f,Xv(y,E),E);z in this.freeTextures||(this.freeTextures[z]=[]),this.freeTextures[z].push(m),this.numFreeTextures++,this.numUsedTextures--;var Y=this.usedTextures[z],Z=Y.indexOf(m);if(Z<0)throw new Error("Cannot release a texture that was never provided by this texture manager");Y.splice(Z,1),this.log()}},_.prototype.log=function(){if(this.logEnabled){var m=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+m+")")}},_.prototype.getNumUsedTextures=function(){return this.numUsedTextures},_.prototype.getNumFreeTextures=function(){return this.numFreeTextures},_.prototype.dispose=function(){var m=this;if(this.freeTextures!=null){for(var f in this.freeTextures)this.freeTextures[f].forEach(function(y){m.gpgpu.deleteMatrixTexture(y)});for(var f in this.usedTextures)this.usedTextures[f].forEach(function(E){m.gpgpu.deleteMatrixTexture(E)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},_}();function Xv(_,m){if(_===pr.UPLOAD)return Zr.PACKED_2X2_FLOAT32;if(_===pr.RENDER||_==null)return function(f){return L().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?f?Zr.PACKED_2X2_FLOAT32:Zr.UNPACKED_FLOAT32:f?Zr.PACKED_2X2_FLOAT16:Zr.UNPACKED_FLOAT16}(m);if(_===pr.DOWNLOAD||_===pr.PIXELS)return Zr.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type "+_)}function H0(_,m,f){return _[0]+"_"+_[1]+"_"+m+"_"+f}var Db=1.7580993408473768,Tb=1.0507009873554805,Fo=function(_,m){this.variableNames=["A"],this.outputShape=_,this.userCode=` 1598 float unaryOperation(float x) { 1599 `+m+` 1600 } 1601 1602 void main() { 1603 float x = getAAtOutCoords(); 1604 float y = unaryOperation(x); 1605 1606 setOutput(y); 1607 } 1608 `},Jv="if (isnan(x)) return x;",Qv="return x;",Wg="return abs(x);",Zv=Jv+` 1609 return (x < 0.0) ? 0.0 : x; 1610`,Qm=Jv+` 1611 return (x < 0.0) ? 0.0 : min(6.0, x); 1612`,Tf="return (x >= 0.0) ? x : (exp(x) - 1.0);",Nf="return -x;",ey="return ceil(x);",ty="return floor(x);",Pp="return exp(x);",kh="return exp(x) - 1.0;",jp="return x;",Nb="return x;",Vg=` 1613 vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0))); 1614 bvec4 isNaN = isnan(x); 1615 1616 result.r = isNaN.r ? x.r : result.r; 1617 result.g = isNaN.g ? x.g : result.g; 1618 result.b = isNaN.b ? x.b : result.b; 1619 result.a = isNaN.a ? x.a : result.a; 1620 1621 return result; 1622`,If=` 1623 vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0))); 1624 bvec4 isNaN = isnan(x); 1625 1626 result.r = isNaN.r ? x.r : result.r; 1627 result.g = isNaN.g ? x.g : result.g; 1628 result.b = isNaN.b ? x.b : result.b; 1629 result.a = isNaN.a ? x.a : result.a; 1630 1631 return result; 1632`,zc=` 1633 vec4 result; 1634 1635 result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0); 1636 result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0); 1637 result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0); 1638 result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0); 1639 1640 return result; 1641`,bd=function(_,m){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=_,this.userCode=` 1642 vec4 unaryOperation(vec4 x) { 1643 `+m+` 1644 } 1645 1646 void main() { 1647 vec4 x = getAAtOutCoords(); 1648 vec4 y = unaryOperation(x); 1649 1650 setOutput(y); 1651 } 1652 `},xd={};function wd(_,m){if(m===void 0&&(m=!1),_==="linear")return m?Nb:Qv;if(_==="relu")return m?Vg:Zv;if(_==="elu")return m?zc:Tf;if(_==="relu6")return m?If:Qm;if(_==="prelu")return m?qs:Xl;throw new Error("Activation "+_+" has not been implemented for the WebGL backend.")}var ny=600,$g=function(_){function m(f){var y,E=_.call(this)||this;
vendor: 21,085 bytes, lines 1652-1815
1652if(E.pendingRead=new WeakMap,E.pendingDisposal=new WeakSet,E.dataRefCount=new WeakMap,E.numBytesInGPU=0,E.uploadWaitMs=0,E.downloadWaitMs=0,E.warnedAboutMemory=!1,E.pendingDeletes=0,E.disposed=!1,!L().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(f==null){var z=Ai(L().getNumber("WEBGL_VERSION"));E.binaryCache=((y=L().getNumber("WEBGL_VERSION"))in xd||(xd[y]={}),xd[y]),E.gpgpu=new W0(z),E.canvas=z.canvas,E.gpgpuCreatedLocally=!0}else E.gpgpu=f,E.binaryCache={},E.gpgpuCreatedLocally=!1,E.canvas=f.gl.canvas;return E.textureManager=new Yv(E.gpgpu),E.numMBBeforeWarning=L().global.screen==null?1024:L().global.screen.height*L().global.screen.width*window.devicePixelRatio*ny/1024/1024,E.texData=new qt(E,qe),E}return A(m,_),m.prototype.numDataIds=function(){return this.texData.numDataIds()+(this.cpuBackend?this.cpuBackend.numDataIds():0)-this.pendingDeletes},m.prototype.write=function(f,y,E){if(L().getBool("DEBUG")&&this.checkNumericalProblems(f),E==="complex64"&&f!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");var z={};return this.texData.set(z,{shape:y,dtype:E,values:f,usage:pr.UPLOAD}),z},m.prototype.move=function(f,y,E,z){if(L().getBool("DEBUG")&&this.checkNumericalProblems(y),z==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(f,{shape:E,dtype:z,values:y,usage:pr.UPLOAD})},m.prototype.readSync=function(f){var y=this.texData.get(f),E=y.values,z=y.dtype,Y=y.complexTensors,Z=y.slice,le=y.shape,de=y.isPacked;if(Z!=null){var we;we=de?new bd(le,jp):new Fo(le,jp);var De=this.runWebGLProgram(we,[{dataId:f,shape:le,dtype:z}],z),Ne=this.readSync(De.dataId);return this.disposeData(De.dataId),Ne}if(E!=null)return this.convertAndCacheOnCPU(f);if(z==="string")return E;var Fe,Ve,Je=this.activeTimers!=null;return Je&&(Fe=fn()),Ve=z==="complex64"?wi(Y.real.dataSync(),Y.imag.dataSync()):this.getValuesFromTexture(f),Je&&(this.downloadWaitMs+=fn()-Fe),this.convertAndCacheOnCPU(f,Ve)},m.prototype.read=function(f){return S(this,void 0,void 0,function(){var y,E,z,Y,Z,le,de,we,De,Ne,Fe,Ve,Je,Xe,ot,xt,kt,At,Lt,tn,ln,nn;return M(this,function(cn){switch(cn.label){case 0:if(this.pendingRead.has(f))return y=this.pendingRead.get(f),[2,new Promise(function(Dn){return y.push(Dn)})];if(E=this.texData.get(f),z=E.values,Y=E.shape,Z=E.slice,le=E.dtype,de=E.complexTensors,we=E.isPacked,Z!=null)return De=void 0,De=we?new bd(Y,jp):new Fo(Y,jp),Ne=this.runWebGLProgram(De,[{dataId:f,shape:Y,dtype:le}],le),Fe=this.read(Ne.dataId),this.disposeData(Ne.dataId),[2,Fe];if(z!=null)return[2,this.convertAndCacheOnCPU(f)];if(!L().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&L().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return Ve=null,le!=="complex64"&&L().get("WEBGL_BUFFER_SUPPORTED")&&(Je=this.decode(f),Xe=this.texData.get(Je.dataId),Ve=(nn=this.gpgpu).createBufferFromTexture.apply(nn,[Xe.texture].concat(Ji(Y)))),this.pendingRead.set(f,[]),le==="complex64"?[3,2]:[4,this.gpgpu.createAndWaitForFence()];case 1:cn.sent(),cn.label=2;case 2:return le!=="complex64"?[3,4]:[4,Promise.all([de.real.data(),de.imag.data()])];case 3:return xt=cn.sent(),kt=xt[0],At=xt[1],ot=wi(kt,At),[3,5];case 4:Ve==null?ot=this.getValuesFromTexture(f):(Lt=Ke(Y),ot=this.gpgpu.downloadFloat32MatrixFromBuffer(Ve,Lt)),cn.label=5;case 5:return Je!=null&&this.disposeData(Je.dataId),tn=this.convertAndCacheOnCPU(f,ot),ln=this.pendingRead.get(f),this.pendingRead.delete(f),ln.forEach(function(Dn){return Dn(tn)}),this.pendingDisposal.has(f)&&(this.pendingDisposal.delete(f),this.disposeData(f),this.pendingDeletes--),[2,tn]}})})},m.prototype.checkNumericalProblems=function(f){if(f!=null)for(var y=0;y<f.length;y++){var E=f[y];if(!Kr(E))throw L().getBool("WEBGL_RENDER_FLOAT32_CAPABLE")?Error("The value "+E+" cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'"):Error("The value "+E+" cannot be represented on this device.")}},m.prototype.getValuesFromTexture=function(f){var y,E=this.texData.get(f),z=E.shape,Y=E.dtype,Z=E.isPacked,le=Ke(z);if(L().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){var de=this.decode(f),we=this.texData.get(de.dataId),De=(y=this.gpgpu).downloadMatrixFromPackedTexture.apply(y,[we.texture].concat(Ji(z))).subarray(0,le);return this.disposeData(de.dataId),De}var Ne=L().getBool("WEBGL_PACK")&&Z===!0,Fe=Ne?xl(z):z,Ve=Ne?new function(xt){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=pr.DOWNLOAD;var kt=qo();this.outputShape=xt,this.userCode=` 1653 `+ru+` 1654 1655 void main() { 1656 ivec3 coords = getOutputCoords(); 1657 float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z)); 1658 `+kt.output+` = encode_float(x); 1659 } 1660 `}(Fe):new function(xt){this.variableNames=["A"],this.outTexUsage=pr.DOWNLOAD;var kt=qo();this.outputShape=xt,this.userCode=` 1661 `+ru+` 1662 1663 void main() { 1664 float x = getAAtOutCoords(); 1665 `+kt.output+` = encode_float(x); 1666 } 1667 `}(Fe),Je=this.runWebGLProgram(Ve,[{shape:Fe,dtype:Y,dataId:f}],"float32"),Xe=this.texData.get(Je.dataId),ot=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(Xe.texture,Xe.texShape[0],Xe.texShape[1]).subarray(0,le);return this.disposeData(Je.dataId),ot},m.prototype.time=function(f){return S(this,void 0,void 0,function(){var y,E,z,Y,Z,le,de;return M(this,function(we){switch(we.label){case 0:return y=this.activeTimers,E=[],z=!1,this.programTimersStack==null?(this.programTimersStack=E,z=!0):this.activeTimers.push(E),this.activeTimers=E,f(),Y=Mt(this.activeTimers.map(function(De){return De.query})).filter(function(De){return De!=null}),Z=Mt(this.activeTimers.map(function(De){return De.name})).filter(function(De){return De!=null}),this.activeTimers=y,z&&(this.programTimersStack=null),le={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null},L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[4,Promise.all(Y)]:[3,2];case 1:return de=we.sent(),le.kernelMs=Ut(de),le.getExtraProfileInfo=function(){return de.map(function(De,Ne){return{name:Z[Ne],ms:De}}).map(function(De){return De.name+": "+De.ms}).join(", ")},[3,3];case 2:le.kernelMs={error:"WebGL query timers are not supported in this environment."},we.label=3;case 3:return this.uploadWaitMs=0,this.downloadWaitMs=0,[2,le]}})})},m.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},m.prototype.startTimer=function(){return L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:fn(),endMs:null}},m.prototype.endTimer=function(f){return L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),f):(f.endMs=fn(),f)},m.prototype.getQueryTime=function(f){return S(this,void 0,void 0,function(){var y;return M(this,function(E){return L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[2,this.gpgpu.waitForQueryAndGetTime(f)]:[2,(y=f).endMs-y.startMs]})})},m.prototype.disposeData=function(f){if(!this.pendingDisposal.has(f)){if(this.pendingRead.has(f))return this.pendingDisposal.add(f),void this.pendingDeletes++;if(this.texData.has(f)){this.releaseGPUData(f);var y=this.texData.get(f).complexTensors;y!=null&&(y.real.dispose(),y.imag.dispose()),this.texData.delete(f)}}},m.prototype.releaseGPUData=function(f){var y=this.texData.get(f),E=y.texture,z=y.dtype,Y=y.texShape,Z=y.usage,le=y.isPacked,de=y.slice,we=de&&de.origDataId||f,De=this.dataRefCount.get(we);De>1?this.dataRefCount.set(we,De-1):(this.dataRefCount.delete(we),E!=null&&(this.numBytesInGPU-=this.computeBytes(Y,z),this.textureManager.releaseTexture(E,Y,Z,le)));var Ne=this.texData.get(f);Ne.texture=null,Ne.texShape=null,Ne.isPacked=!1,Ne.slice=null},m.prototype.getTexture=function(f){return this.uploadToGPU(f),this.texData.get(f).texture},m.prototype.getDataInfo=function(f){return this.texData.get(f)},m.prototype.getCPUBackend=function(){return L().getBool("WEBGL_CPU_FORWARD")?(this.cpuBackend==null&&(this.cpuBackend=qe.findBackend("cpu")),this.cpuBackend):null},m.prototype.shouldExecuteOnCPU=function(f,y){var E=this;return y===void 0&&(y=128),this.getCPUBackend()!=null&&f.every(function(z){return E.texData.get(z.dataId).texture==null&&Ke(z.shape)<y})},m.prototype.getGPGPUContext=function(){return this.gpgpu},m.prototype.complex=function(f,y){var E=this.makeOutput(f.shape,"complex64");return this.texData.get(E.dataId).complexTensors={real:qe.keep(f.clone()),imag:qe.keep(y.clone())},E},m.prototype.real=function(f){return this.texData.get(f.dataId).complexTensors.real.clone()},m.prototype.imag=function(f){return this.texData.get(f.dataId).complexTensors.imag.clone()},m.prototype.slice=function(f,y,E){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.slice(f,y,E);if(Ke(E)===0)return Qo([],E,f.dtype);var z=this.texData.get(f.dataId).isPacked,Y=Fp(f.shape,y,E);if(z||!Y){var Z=L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Jm(E):new Xm(E),le=Z.getCustomSetupFunc(y);return this.compileAndRun(Z,[f],null,le)}return this.uploadToGPU(f.dataId),this.shallowSlice(f,y,E)},m.prototype.shallowSlice=function(f,y,E){var z=this.texData.get(f.dataId),Y=this.makeOutput(E,f.dtype),Z=this.texData.get(Y.dataId);Object.assign(Z,z),Z.shape=E,Z.dtype=f.dtype;var le=vh(y,f.strides);z.slice&&(le+=z.slice.flatOffset),Z.slice={flatOffset:le,origDataId:z.slice&&z.slice.origDataId||f.dataId};var de=this.dataRefCount.get(Z.slice.origDataId)||1;return this.dataRefCount.set(Z.slice.origDataId,de+1),Y},m.prototype.stridedSlice=function(f,y,E,z){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.stridedSlice(f,y,E,z);var Y=Bc(y,E,z);if(Y.some(function(le){return le===0}))return Qo([],Y);var Z=new function(le,de,we){this.variableNames=["x"],this.outputShape=we;var De=we.length,Ne=fa(we.length),Fe=fa(we.length),Ve="";if(De===1)Ve="coords * strides + begin";else{var Je=0;Ve=we.map(function(Xe,ot){return Je++,we.length===1?"coords * strides["+ot+"] + begin["+ot+"]":"coords["+(Je-1)+"] * strides["+ot+"] + begin["+ot+"]"}).join(",")}this.userCode=` 1668 `+Ne+" begin = "+Ne+"("+le+`); 1669 `+Ne+" strides = "+Ne+"("+de+`); 1670 1671 void main() { 1672 `+Fe+` coords = getOutputCoords(); 1673 setOutput(getX(`+Ve+`)); 1674 } 1675 `}(y,z,Y);return this.compileAndRun(Z,[f])},m.prototype.reverse=function(f,y){var E=L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(z,Y){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;var Z=z.length;if(Z>4)throw new Error("WebGL backend: Reverse of rank-"+Z+" tensor is not yet supported");this.outputShape=z;var le=Za("rc",Z),de=le[Z-1]+" + 1 < "+this.outputShape[Z-1],we=le[Z-2]+" + 1 < "+this.outputShape[Z-2],De=fa(Z);function Ne(Fe){var Ve=z.map(function(Je,Xe){return function(ot,xt){return Y.indexOf(ot)!==-1&&z[ot]!==1?z[ot]+" - "+xt[ot]+" - 1":""+xt[ot]}(Xe,Fe)});return"getChannel(getX("+Ve.join(",")+"), vec2("+Ve.slice(-2).join(",")+"))"}this.userCode=Z===1?` 1676 void main(){ 1677 int rc = getOutputCoords(); 1678 vec4 result = vec4(0.); 1679 result.r = getChannel(getX(`+z[0]+` - rc - 1), 1680 `+z[0]+` - rc - 1); 1681 if(`+de+`){ 1682 result.g = getChannel(getX(`+z[0]+` - (rc + 1) - 1), 1683 `+z[0]+` - (rc + 1) - 1); 1684 } 1685 setOutput(result); 1686 } 1687 `:` 1688 void main() { 1689 `+De+` rc = getOutputCoords(); 1690 vec4 result = vec4(0.); 1691 result.r = `+Ne(le.slice())+`; 1692 if(`+de+`){ 1693 result.g = `+function(Fe){return Fe[Z-1]="("+Fe[Z-1]+" + 1)",Ne(Fe)}(le.slice())+`; 1694 } 1695 if(`+we+`) { 1696 result.b = `+function(Fe){return Fe[Z-2]="("+Fe[Z-2]+" + 1)",Ne(Fe)}(le.slice())+`; 1697 if(`+de+`) { 1698 result.a = `+function(Fe){return Fe[Z-1]="("+Fe[Z-1]+" + 1)",Fe[Z-2]="("+Fe[Z-2]+" + 1)",Ne(Fe)}(le.slice())+`; 1699 } 1700 } 1701 setOutput(result); 1702 } 1703 `}(f.shape,y):new function(z,Y){this.variableNames=["x"];var Z=z.length;if(Z>4)throw new Error("WebGL backend: Reverse of rank-"+Z+" tensor is not yet supported");if(this.outputShape=z,Z!==1){var le=z.map(function(we,De){return function(Ne){return Y.indexOf(Ne)!==-1&&z[Ne]!==1?z[Ne]+" - coords["+Ne+"] - 1":"coords["+Ne+"]"}(De)}).join(","),de=fa(Z);this.userCode=` 1704 void main() { 1705 `+de+` coords = getOutputCoords(); 1706 setOutput(getX(`+le+`)); 1707 } 1708 `}else this.userCode=` 1709 void main() { 1710 int coord = getOutputCoords(); 1711 setOutput(getX(`+z[0]+` - coord - 1)); 1712 } 1713 `}(f.shape,y);return this.compileAndRun(E,[f])},m.prototype.concat=function(f,y){if(f[0].dtype==="complex64"){var E=f.map(function(Fe){return qa(Fe)}),z=f.map(function(Fe){return Os(Fe)});return zo(this.concat(E,y),this.concat(z,y))}if(this.shouldExecuteOnCPU(f))return this.cpuBackend.concat(f,y);if(f.length===1)return f[0];if(f.length>L().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){var Y=Math.floor(f.length/2),Z=this.concat(f.slice(0,Y),y),le=this.concat(f.slice(Y),y);return this.concat([Z,le],y)}if(L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&f[0].rank>1){var de=new function(Fe,Ve){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=sc(Fe,Ve);var Je=this.outputShape,Xe=Je.length,ot=fa(Xe),xt=Za("coords",Xe),kt=["x","y","z","w","u","v"].slice(0,Xe);this.variableNames=Fe.map(function(tr,ur){return"T"+ur});var At=new Array(Fe.length-1);At[0]=Fe[0][Ve];for(var Lt=1;Lt<At.length;Lt++)At[Lt]=At[Lt-1]+Fe[Lt][Ve];var tn=kt[Ve],ln=kt.slice(-2),nn=kt.join(),cn="if ("+tn+" < "+At[0]+`) { 1714 return getChannel( 1715 getT0(`+nn+"), vec2("+ln.join()+`)); 1716 }`;for(Lt=1;Lt<At.length;Lt++){var Dn=At[Lt-1];cn+=` 1717 if (`+tn+" < "+At[Lt]+" && "+tn+" >= "+At[Lt-1]+`) { 1718 return getChannel( 1719 getT`+Lt+"("+Oi(kt,tn,Dn)+`), 1720 vec2(`+Oi(ln,tn,Dn)+`)); 1721 }`}var Rn=At.length,Mn=At[At.length-1];cn+=` 1722 return getChannel( 1723 getT`+Rn+"("+Oi(kt,tn,Mn)+`), 1724 vec2(`+Oi(ln,tn,Mn)+"));",this.userCode=` 1725 float getValue(`+kt.map(function(tr){return"int "+tr})+`) { 1726 `+cn+` 1727 } 1728 1729 void main() { 1730 `+ot+` coords = getOutputCoords(); 1731 vec4 result = vec4(getValue(`+xt+`), 0., 0., 0.); 1732 1733 `+xt[Xe-1]+" = "+xt[Xe-1]+` + 1; 1734 if (`+xt[Xe-1]+" < "+Je[Xe-1]+`) { 1735 result.g = getValue(`+xt+`); 1736 } 1737 1738 `+xt[Xe-2]+" = "+xt[Xe-2]+` + 1; 1739 if (`+xt[Xe-2]+" < "+Je[Xe-2]+`) { 1740 result.a = getValue(`+xt+`); 1741 } 1742 1743 `+xt[Xe-1]+" = "+xt[Xe-1]+` - 1; 1744 if (`+xt[Xe-2]+" < "+Je[Xe-2]+` && 1745 `+xt[Xe-1]+" < "+Je[Xe-1]+`) { 1746 result.b = getValue(`+xt+`); 1747 } 1748 setOutput(result); 1749 } 1750 `}(f.map(function(Fe){return Fe.shape}),y);return this.compileAndRun(de,f)}var we=sc(f.map(function(Fe){return Fe.shape}),y),De=f.map(function(Fe){return Fe.as2D(-1,Ke(Fe.shape.slice(y)))}),Ne=new function(Fe){this.outputShape=[],this.outputShape=sc(Fe,1),this.variableNames=Fe.map(function(At,Lt){return"T"+Lt});var Ve=new Array(Fe.length-1);Ve[0]=Fe[0][1];for(var Je=1;Je<Ve.length;Je++)Ve[Je]=Ve[Je-1]+Fe[Je][1];var Xe=["if (yC < "+Ve[0]+") setOutput(getT0(yR, yC));"];for(Je=1;Je<Ve.length;Je++){var ot=Ve[Je-1];Xe.push("else if (yC < "+Ve[Je]+") setOutput(getT"+Je+"(yR, yC-"+ot+"));")}var xt=Ve.length,kt=Ve[Ve.length-1];Xe.push("else setOutput(getT"+xt+"(yR, yC-"+kt+"));"),this.userCode=` 1751 void main() { 1752 ivec2 coords = getOutputCoords(); 1753 int yR = coords.x; 1754 int yC = coords.y; 1755 1756 `+Xe.join(` 1757 `)+` 1758 } 1759 `}(De.map(function(Fe){return Fe.shape}));return this.compileAndRun(Ne,De).reshape(we)},m.prototype.neg=function(f){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.neg(f);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(f,Nf,f.dtype);var y=new Fo(f.shape,Nf);return this.compileAndRun(y,[f])},m.prototype.batchMatMul=function(f,y,E,z){var Y=E?f.shape[2]:f.shape[1],Z=z?y.shape[1]:y.shape[2],le=E?f.shape[1]:f.shape[2],de=f.shape[0];if((Y===1||Z===1)&&le>1e3){E&&(f=wt(f,[0,2,1])),z&&(y=wt(y,[0,2,1]));var we=Z===1?f:f.as3D(de,le,1),De=Z===1?2:1,Ne=Z===1?y.as3D(de,1,le):y;return this.multiply(we,Ne).sum(De,!0)}var Fe=kn(f.dtype,y.dtype),Ve=new Lc(f.shape,[de,Y,Z],E,z);return this.compileAndRun(Ve,[f,y],Fe)},m.prototype.fusedBatchMatMul=function(f){var y=f.a,E=f.b,z=f.transposeA,Y=f.transposeB,Z=f.bias,le=f.activation,de=f.preluActivationWeights,we=z?y.shape[2]:y.shape[1],De=Y?E.shape[1]:E.shape[2],Ne=y.shape[0],Fe=kn(y.dtype,E.dtype),Ve=Z!=null,Je=de!=null,Xe=le?wd(le,!0):null,ot=new Lc(y.shape,[Ne,we,De],z,Y,Ve,Xe,Je),xt=[y,E];return Z&&xt.push(Z),de&&xt.push(de),this.compileAndRun(ot,xt,Fe)},m.prototype.multiply=function(f,y){if(f.dtype==="complex64"){var E=this.texData.get(f.dataId),z=this.texData.get(y.dataId),Y=new Do("return areal * breal - aimag * bimag;",f.shape,y.shape),Z=new Do("return areal * bimag + aimag * breal;",f.shape,y.shape),le=[this.makeComplexComponentTensorInfo(f,E.complexTensors.real),this.makeComplexComponentTensorInfo(f,E.complexTensors.imag),this.makeComplexComponentTensorInfo(y,z.complexTensors.real),this.makeComplexComponentTensorInfo(y,z.complexTensors.imag)],de=this.compileAndRun(Y,le),we=this.compileAndRun(Z,le),De=this.complex(de,we);return de.dispose(),we.dispose(),De}if(this.shouldExecuteOnCPU([f,y]))return this.cpuBackend.multiply(f,y);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,Ju,f.dtype);var Ne=new xa(Ju,f.shape,y.shape);return this.compileAndRun(Ne,[f,y],f.dtype)},m.prototype.batchNormalization=function(f,y,E,z,Y,Z){var le=[f,y,E],de=null;Z!=null&&(de=Z.shape,le.push(Z));var we=null;if(Y!=null&&(we=Y.shape,le.push(Y)),L().getBool("WEBGL_PACK_NORMALIZATION")){var De=new function(Fe,Ve,Je,Xe,ot,xt){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],no(Fe,Ve),no(Fe,Je);var kt="vec4(0.0)";Xe!=null&&(no(Fe,Xe),this.variableNames.push("offset"),kt="getOffsetAtOutCoords()");var At="vec4(1.0)";ot!=null&&(no(Fe,ot),this.variableNames.push("scale"),At="getScaleAtOutCoords()"),this.outputShape=Fe,this.userCode=` 1760 void main() { 1761 vec4 offset = `+kt+`; 1762 vec4 scale = `+At+`; 1763 1764 vec4 x = getXAtOutCoords(); 1765 vec4 mean = getMeanAtOutCoords(); 1766 vec4 variance = getVarianceAtOutCoords(); 1767 1768 vec4 inv = scale * inversesqrt(variance + vec4(`+xt+`)); 1769 1770 setOutput((x - mean) * inv + offset); 1771 } 1772 `}(f.shape,y.shape,E.shape,de,we,z);return this.compileAndRun(De,le)}var Ne=new function(Fe,Ve,Je,Xe,ot,xt){this.outputShape=[],this.variableNames=["x","mean","variance"],no(Fe,Ve),no(Fe,Je);var kt="0.0";Xe!=null&&(no(Fe,Xe),this.variableNames.push("offset"),kt="getOffsetAtOutCoords()");var At="1.0";ot!=null&&(no(Fe,ot),this.variableNames.push("scale"),At="getScaleAtOutCoords()"),this.outputShape=Fe,this.userCode=` 1773 void main() { 1774 float x = getXAtOutCoords(); 1775 float mean = getMeanAtOutCoords(); 1776 float variance = getVarianceAtOutCoords(); 1777 float offset = `+kt+`; 1778 float scale = `+At+`; 1779 float inv = scale * inversesqrt(variance + float(`+xt+`)); 1780 setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1))); 1781 } 1782 `}(f.shape,y.shape,E.shape,de,we,z);return this.compileAndRun(Ne,le)},m.prototype.localResponseNormalization4D=function(f,y,E,z,Y){var Z=L().getBool("WEBGL_PACK_NORMALIZATION")?new function(le,de,we,De,Ne){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;var Fe,Ve=de,Je=le[3]-1;this.outputShape=le;var Xe="float("+we+") + float("+De+") * sum";Fe=Ne===.5?"inversesqrt("+Xe+")":Ne===1?"1.0/("+Xe+")":"exp(log("+Xe+") * float(-"+Ne+"));",this.userCode=` 1783 void main() { 1784 ivec4 coords = getOutputCoords(); 1785 int b = coords.x; 1786 int r = coords.y; 1787 int c = coords.z; 1788 int d = coords.w; 1789 1790 bool hasNextCol = d < `+this.outputShape[3]+`; 1791 bool hasNextRow = c < `+this.outputShape[2]+`; 1792 1793 vec4 sum = vec4(0.); 1794 vec4 xFragAtOutputCoords = getX(b, r, c, d); 1795 1796 vec4 xAtOutputCoords = vec4( 1797 getChannel(xFragAtOutputCoords, vec2(c, d)), 1798 hasNextCol ? 1799 getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0, 1800 hasNextRow ? 1801 getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0, 1802 (hasNextRow && hasNextCol) ? 1803 getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0 1804 ); 1805 1806 int firstChannel = d - `+Ve+`; 1807 vec2 cache = vec2(0.); 1808 if(firstChannel >= 0){ 1809 vec4 firstChannelFrag = getX(b, r, c, firstChannel); 1810 cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel)); 1811 if(hasNextRow){ 1812 cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel)); 1813 } 1814 } 1815
1816 ivec2 depth = ivec2(d, d + 1); 1817 for (int j = - `+Ve+"; j <= "+Ve+`; j++) { 1818 ivec2 idx = depth + j; 1819 bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0)); 1820 bvec2 belowUpperBound = lessThanEqual(idx, ivec2(`+Je+`)); 1821 1822 bool depthInRange = aboveLowerBound.x && belowUpperBound.x; 1823 bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y; 1824 1825 if(depthInRange || depthPlusOneInRange){ 1826 vec4 z = vec4(0.); 1827 vec4 xFragAtCurrentDepth; 1828 z.xz = cache.xy; 1829 if(depthPlusOneInRange && hasNextCol){ 1830 xFragAtCurrentDepth = idx.y != d ? 1831 getX(b, r, c, idx.y) : xFragAtOutputCoords; 1832 z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y)); 1833 if(hasNextRow){ 1834 z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y)); 1835 } 1836 } 1837 cache.xy = z.yw; 1838 sum += z * z; 1839 } 1840 } 1841 vec4 result = xAtOutputCoords * `+Fe+`; 1842 setOutput(result); 1843 } 1844 `}(f.shape,y,E,z,Y):new function(le,de,we,De,Ne){this.variableNames=["x"],this.outputShape=[];var Fe,Ve=de,Je=le[3]-1;this.outputShape=le;var Xe="float("+we+") + float("+De+") * sum";Fe=Ne===.5?"inversesqrt("+Xe+")":Ne===1?"1.0/("+Xe+")":"exp(log("+Xe+") * float(-"+Ne+"));",this.userCode=` 1845 void main() { 1846 ivec4 coords = getOutputCoords(); 1847 int b = coords[0]; 1848 int r = coords[1]; 1849 int c = coords[2]; 1850 int d = coords[3]; 1851 float x = getX(b, r, c, d); 1852 float sum = 0.0; 1853 for (int j = -`+Ve+"; j <= "+Ve+`; j++) { 1854 int idx = d + j; 1855 if (idx >= 0 && idx <= `+Je+`) { 1856 float z = getX(b, r, c, idx); 1857 sum += z * z; 1858 } 1859 } 1860 float val = x * `+Fe+`; 1861 setOutput(val); 1862 } 1863 `}(f.shape,y,E,z,Y);return this.compileAndRun(Z,[f])},m.prototype.LRNGrad=function(f,y,E,z,Y,Z,le){var de=new function(we,De,Ne,Fe,Ve){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=we,this.depth=we[3],this.depthRadius=De,this.bias=Ne,this.alpha=Fe,this.beta=Ve,this.userCode=` 1864 void main() { 1865 ivec4 coords = getOutputCoords(); 1866 int b = coords[0]; 1867 int r = coords[1]; 1868 int c = coords[2]; 1869 1870 float result = 0.0; 1871 for (int d = 0; d < `+this.depth+`; ++d) { 1872 int depthBegin = int(max(0.0, float(d - `+De+`))); 1873 int depthEnd = int(min(float(`+this.depth+`), 1874 float(d + `+De+` + 1))); 1875 1876 const int MIN_DEPTH_BEGIN = 0; 1877 const int MAX_DEPTH_END = `+this.depth+`; 1878 1879 float norm = 0.0; 1880 for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) { 1881 if (k < depthBegin){ 1882 continue; 1883 } 1884 else if (k >= depthBegin && k < depthEnd) { 1885 norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k); 1886 } 1887 else { 1888 break; 1889 } 1890 } 1891 1892 norm = float(`+Fe+") * norm + float("+Ne+`); 1893 1894 for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){ 1895 if (k < depthBegin){ 1896 continue; 1897 } 1898 else if (k >= depthBegin && k < depthEnd){ 1899 float dyi = -2.0 * float(`+Fe+`) 1900 * float(`+Ve+`) 1901 * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d) 1902 / norm; 1903 if (k == d) { 1904 dyi += pow(norm, -1.0 * `+Ve+`); 1905 } 1906 if (k == coords[3]) { 1907 dyi *= getDy(b, r, c, d); 1908 result += dyi; 1909 } 1910 } 1911 else { 1912 break; 1913 } 1914 } 1915 } 1916 setOutput(result); 1917 } 1918 `}(y.shape,z,Y,Z,le);return this.compileAndRun(de,[y,E,f])},m.prototype.tile=function(f,y){if(f.dtype==="string"){var E=this.readSync(f.dataId).map(function(Y){return Ar(Y)});return Qa(Li(f.shape,f.dtype,E),y)}var z=new function(Y,Z){this.variableNames=["A"];for(var le=new Array(Y.length),de=0;de<le.length;de++)le[de]=Y[de]*Z[de];this.outputShape=le,this.rank=le.length;var we=fa(this.rank),De=function(Ne){var Fe=Ne.length;if(Fe>5)throw Error("Tile for rank "+Fe+" is not yet supported");if(Fe===1)return"imod(resRC, "+Ne[0]+")";for(var Ve=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],Je=[],Xe=0;Xe<Ne.length;Xe++)Je.push("imod("+Ve[Xe]+", "+Ne[Xe]+")");return Je.join()}(Y);this.userCode=` 1919 void main() { 1920 `+we+` resRC = getOutputCoords(); 1921 setOutput(getA(`+De+`)); 1922 } 1923 `}(f.shape,y);return this.compileAndRun(z,[f])},m.prototype.pad=function(f,y,E){var z=L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(Y,Z,le){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=Z.map(function(tn,ln){return tn[0]+Y[ln]+tn[1]});for(var de=Y.length,we=fa(de),De=Z.map(function(tn){return tn[0]}).join(","),Ne=Z.map(function(tn,ln){return tn[0]+Y[ln]}).join(","),Fe=Za("rc",de),Ve=Za("source",de),Je=Fe[de-1]+" < "+this.outputShape[de-1],Xe=de===1?"source":"vec2("+Ve.slice(-2).join()+")",ot=[we+" rc = outputLoc;",Fe[de-1]+` += 1; 1924 if(`+Je+`) { 1925 `,de===1?"":`} 1926 rc = outputLoc; 1927 `+Fe[de-2]+` += 1; 1928 if(`+Fe[de-2]+" < "+this.outputShape[de-2]+") {",de===1?"":" "+Fe[de-1]+` += 1; 1929 if(`+Je+") {"],xt=de===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",kt="",At=0,Lt=de===1?2:4;At<Lt;At++)kt+=` 1930 `+ot[At]+` 1931 if (`+xt+`) { 1932 result[`+At+"] = float("+le+`); 1933 } else { 1934 `+we+` source = rc - start; 1935 result[`+At+"] = getChannel(getX("+Ve.join()+"), "+Xe+`); 1936 } 1937 `;kt+=de===1?"} ":"}}",this.userCode=` 1938 const `+we+" start = "+we+"("+De+`); 1939 const `+we+" end = "+we+"("+Ne+`); 1940 1941 void main() { 1942 `+we+` outputLoc = getOutputCoords(); 1943 vec4 result = vec4(0.); 1944 `+kt+` 1945 setOutput(result); 1946 } 1947 `}(f.shape,y,E):new function(Y,Z,le){this.variableNames=["x"],this.outputShape=Z.map(function(Ve,Je){return Ve[0]+Y[Je]+Ve[1]});var de=Y.length,we=fa(de),De=Z.map(function(Ve){return Ve[0]}).join(","),Ne=Z.map(function(Ve,Je){return Ve[0]+Y[Je]}).join(","),Fe=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,de);this.userCode=de!==1?` 1948 `+we+" start = "+we+"("+De+`); 1949 `+we+" end = "+we+"("+Ne+`); 1950 1951 void main() { 1952 `+we+` outC = getOutputCoords(); 1953 if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) { 1954 setOutput(float(`+le+`)); 1955 } else { 1956 `+we+` coords = outC - start; 1957 setOutput(getX(`+Fe+`)); 1958 } 1959 } 1960 `:` 1961 int start = `+De+`; 1962 int end = `+Ne+`; 1963 1964 void main() { 1965 int outC = getOutputCoords(); 1966 if (outC < start || outC >= end) { 1967 setOutput(float(`+le+`)); 1968 } else { 1969 setOutput(getX(outC - start)); 1970 } 1971 } 1972 `}(f.shape,y,E);return this.compileAndRun(z,[f])},m.prototype.gather=function(f,y,E){if(this.shouldExecuteOnCPU([f,y]))return this.cpuBackend.gather(f,y,E);var z=new function(Y,Z,le){this.variableNames=["A","indices"];var de=Y.slice();de[le]=Z,this.outputShape=de,this.rank=de.length;var we=fa(this.rank),De=function(Ne,Fe){var Ve=Ne.length;if(Ve>4)throw Error("Gather for rank "+Ve+" is not yet supported");if(Ve===1)return"int(getIndices(resRC))";for(var Je=["resRC.x","resRC.y","resRC.z","resRC.w"],Xe=[],ot=0;ot<Ne.length;ot++)ot===Fe?Xe.push("int(getIndices("+Je[ot]+"))"):Xe.push(""+Je[ot]);return Xe.join()}(Y,le);this.userCode=` 1973 void main() { 1974 `+we+` resRC = getOutputCoords(); 1975 setOutput(getA(`+De+`)); 1976 } 1977 `}(f.shape,y.size,E);return this.compileAndRun(z,[f,y])},m.prototype.batchToSpaceND=function(f,y,E){Ee(f.rank<=4,function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"});var z=y.reduce(function(De,Ne){return De*Ne}),Y=ch(f.shape,y,z),Z=wf(Y.length,y.length),le=ad(f.shape,y,z),de=Lm(E,y.length),we=zg(le,E,y.length);return wt(f.reshape(Y),Z).reshape(le).slice(de,we)},m.prototype.spaceToBatchND=function(f,y,E){Ee(f.rank<=4,function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"});var z=y.reduce(function(Ne,Fe){return Ne*Fe}),Y=[[0,0]];Y.push.apply(Y,E);for(var Z=1+y.length;Z<f.shape.length;++Z)Y.push([0,0]);var le=f.pad(Y),de=ch(le.shape,y,z,!1),we=wf(de.length,y.length,!1),De=ad(le.shape,y,z,!1);
vendor: 4,742 bytes, lines 1977-2082
1977return wt(le.reshape(de),we).reshape(De)},m.prototype.reduce=function(f,y,E){var z=f.shape[0],Y=f.shape[1],Z=new function(de,we){this.variableNames=["x"];var De=de.windowSize,Ne=de.batchSize,Fe=de.inSize,Ve=Math.ceil(Fe/De);this.outputShape=[Ne,Ve];var Je="0.0",Xe="";we==="prod"?Je="1.0":we==="min"?(Je="1.0 / 1e-20",Xe="min"):we==="max"&&(Je="-1.0 / 1e-20",Xe="max");var ot=we+"("+we+"("+we+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";we==="sum"?ot="sumValue":we==="prod"?ot="prodValue":we==="all"?ot="allValue":we==="any"&&(ot="anyValue");var xt=4*Math.floor(De/4),kt=De%4,At=` 1978 if (`+(we==="sum")+`) { 1979 sumValue += dot(values, ones); 1980 } else if (`+(we==="prod")+`) { 1981 vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]); 1982 prodValue *= tmp[0] * tmp[1]; 1983 } else { 1984 minMaxValue = `+Xe+`(values, minMaxValue); 1985 } 1986 `,Lt="vec4";we==="all"?(Je="1.0",At=` 1987 bool reducedAllValue = all(values); 1988 float floatedReducedAllValue = float(reducedAllValue); 1989 allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0); 1990 `,Lt="bvec4"):we==="any"&&(Je="0.0",At=` 1991 bool reducedAnyValue = any(values); 1992 float floatedReducedAnyValue = float(reducedAnyValue); 1993 anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0); 1994 `,Lt="bvec4");var tn="";Fe%De>0&&(tn=` 1995 if (inIdx < 0 || inIdx >= `+Fe+`) { 1996 return initializationValue; 1997 } 1998 `),this.userCode=` 1999 const float initializationValue = `+Je+`; 2000 const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0); 2001 2002 float getValue(int batch, int inIdx) { 2003 `+tn+` 2004 return getX(batch, inIdx); 2005 } 2006 2007 void main() { 2008 ivec2 coords = getOutputCoords(); 2009 int batch = coords[0]; 2010 int outIdx = coords[1]; 2011 int inOffset = outIdx * `+De+`; 2012 2013 vec4 minMaxValue = vec4(`+Je+`); 2014 float prodValue = 1.0; 2015 float sumValue = 0.0; 2016 float allValue = 1.0; 2017 float anyValue = 0.0; 2018 2019 for (int i = 0; i < `+xt+`; i += 4) { 2020 int inIdx = inOffset + i; 2021 `+Lt+" values = "+Lt+`( 2022 getValue(batch, inIdx), 2023 getValue(batch, inIdx + 1), 2024 getValue(batch, inIdx + 2), 2025 getValue(batch, inIdx + 3) 2026 ); 2027 2028 `+At+` 2029 } 2030 2031 int inIdx = inOffset + `+xt+`; 2032 if (`+(kt===1)+`) { 2033 `+Lt+" values = "+Lt+`( 2034 getValue(batch, inIdx), 2035 initializationValue, 2036 initializationValue, 2037 initializationValue 2038 ); 2039 2040 `+At+` 2041 } else if (`+(kt===2)+`) { 2042 `+Lt+" values = "+Lt+`( 2043 getValue(batch, inIdx), 2044 getValue(batch, inIdx + 1), 2045 initializationValue, 2046 initializationValue 2047 ); 2048 2049 `+At+` 2050 } else if (`+(kt===3)+`) { 2051 `+Lt+" values = "+Lt+`( 2052 getValue(batch, inIdx), 2053 getValue(batch, inIdx + 1), 2054 getValue(batch, inIdx + 2), 2055 initializationValue 2056 ); 2057 2058 `+At+` 2059 } 2060 setOutput(`+ot+`); 2061 } 2062 `}({windowSize:Sl(Y),inSize:Y,batchSize:z},y),le=this.compileAndRun(Z,[f],E);return le.shape[1]===1?le:this.reduce(le,y,E)},m.prototype.argReduce=function(f,y,E){E===void 0&&(E=null);var z=f.shape[0],Y=f.shape[1];E!=null&&(z=E.shape[0],Y=E.shape[1]);var Z=new function(we,De,Ne){this.variableNames=["A"];var Fe=we.windowSize,Ve=we.batchSize,Je=we.inSize,Xe=Math.ceil(Je/Fe);Ne||this.variableNames.push("bestIndicesA"),this.outputShape=[Ve,Xe];var ot=De==="max"?">":"<",xt=Ne?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=` 2063 void main() { 2064 ivec2 coords = getOutputCoords(); 2065 int batch = coords[0]; 2066 int outIdx = coords[1]; 2067 int inOffset = outIdx * `+Fe+`; 2068 2069 int bestIndex = inOffset; 2070 float bestValue = getA(batch, bestIndex); 2071 2072 for (int i = 0; i < `+Fe+`; i++) { 2073 int inIdx = `+xt+`; 2074 float candidate = getA(batch, inIdx); 2075 if (candidate `+ot+` bestValue) { 2076 bestValue = candidate; 2077 bestIndex = inIdx; 2078 } 2079 } 2080 setOutput(float(bestIndex)); 2081 } 2082 `}({windowSize:Sl(Y),inSize:Y,batchSize:z},y,E==null),le=[f];E!=null&&le.push(E);var de=this.compileAndRun(Z,le,"int32");return de.shape[1]===1?de:this.argReduce(f,y,de)},m.prototype.argReducePacked=function(f,y,E){E===void 0&&(E=null);var z=E!=null?E.shape:f.shape,Y=new function(de,we,De,Ne){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,Ee(de.length>2,function(){return"Packed arg"+(De.charAt(0).toUpperCase()+De.slice(1))+" supports only input
2082s with rank above 2."});var Fe=de[de.length-1],Ve=Math.ceil(Fe/we);this.outputShape=de.slice(0,-1),Ve>1&&this.outputShape.push(Ve),Ne||this.variableNames.push("bestIndicesA");var Je,Xe,ot=this.outputShape,xt=ot.length,kt=fa(xt),At=Za("coords",xt);if(Ve===1){var Lt=fa(Xe=xt+1);Je=` 2083 `+Lt+" sourceLocR = "+Lt+"("+At.join()+`, 0); 2084 ++`+At[xt-1]+`; 2085 `+Lt+" sourceLocG = "+Lt+"("+At.join()+`, 0); 2086 ++`+At[xt-2]+`; 2087 `+Lt+" sourceLocA = "+Lt+"("+At.join()+`, 0); 2088 --`+At[xt-1]+`; 2089 `+Lt+" sourceLocB = "+Lt+"("+At.join()+`, 0); 2090 --`+At[xt-2]+";"}else Xe=xt,Je=` 2091 `+kt+` sourceLocR = coords; 2092 ++`+At[xt-1]+`; 2093 `+kt+` sourceLocG = coords; 2094 ++`+At[xt-2]+`; 2095 `+kt+` sourceLocA = coords; 2096 --`+At[xt-1]+`; 2097 `+kt+` sourceLocB = coords; 2098 --`+At[xt-2]+";";var tn=["x","y","z","w","u","v"].slice(0,Xe),ln="."+tn[Xe-1],nn=tn.map(function(yr){return"int "+yr}),cn=Za("sourceLocR",Xe-1).concat("inIdx.r"),Dn=Za("sourceLocG",Xe-1).concat("inIdx.g"),Rn=Za("sourceLocB",Xe-1).concat("inIdx.b"),Mn=Za("sourceLocA",Xe-1).concat("inIdx.a"),tr=De==="max"?"greaterThan":"lessThan",ur=Ne?"":` 2099 inIdx = round(vec4(getBestIndicesAChannel(`+cn.join()+`), 2100 getBestIndicesAChannel(`+Dn.join()+`), 2101 getBestIndicesAChannel(`+Rn.join()+`), 2102 getBestIndicesAChannel(`+Mn.join()+")));",vr=`vec4( 2103 getAChannel(`+cn.join()+`), 2104 hasNextCol ? getAChannel(`+Dn.join()+`) : 0., 2105 hasNextRow ? getAChannel(`+Rn.join()+`) : 0., 2106 hasNextRow && hasNextCol ? getAChannel(`+Mn.join()+") : 0.)",kr=Ne?"":` 2107 float getBestIndicesAChannel(`+nn.join()+`) { 2108 return getChannel(getBestIndicesA(`+tn.join()+`), 2109 vec2(`+tn.slice(-2).join()+`)); 2110 }`;this.userCode=` 2111 float getAChannel(`+nn.join()+`) { 2112 return getChannel(getA(`+tn.join()+`), 2113 vec2(`+tn.slice(-2).join()+`)); 2114 } 2115 `+kr+` 2116 void main() { 2117 `+kt+` coords = getOutputCoords(); 2118 bool hasNextCol = `+At[xt-1]+" < "+(ot[xt-1]-1)+`; 2119 bool hasNextRow = `+At[xt-2]+" < "+(ot[xt-2]-1)+`; 2120 `+Je+` 2121 ivec4 srcIdx = ivec4(sourceLocR`+ln+", sourceLocG"+ln+`, 2122 sourceLocB`+ln+", sourceLocA"+ln+") * "+we+`; 2123 ivec4 inIdx = srcIdx; 2124 vec4 bestIndex = vec4(inIdx); 2125 vec4 bestValue = `+vr+`; 2126 2127 for (int i = 0; i < `+we+`; i++) { 2128 inIdx = srcIdx; 2129 `+ur+` 2130 vec4 candidate = `+vr+`; 2131 bvec4 nan = isnan(candidate); 2132 bvec4 replace = bvec4( 2133 vec4(`+tr+`(candidate, bestValue)) * (vec4(1.0) - vec4(nan))); 2134 2135 bestValue = vec4(replace.x ? candidate.x : bestValue.x, 2136 replace.y ? candidate.y : bestValue.y, 2137 replace.z ? candidate.z : bestValue.z, 2138 replace.w ? candidate.w : bestValue.w); 2139 bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace)); 2140 srcIdx++; 2141 } 2142 setOutput(bestIndex); 2143 } 2144 `}(z,Sl(z[z.length-1]),y,E==null),Z=E==null?[f]:[f,E],le=this.compileAndRun(Y,Z,"int32");return le.rank===f.rank?this.argReducePacked(f,y,le):le},m.prototype.sum=function(f,y){Aa("sum",y,f.rank);var E=ra(f.shape,y),z=E[0],Y=Ke(E[1]),Z=f.as2D(-1,Y),le=rr(f.dtype);return this.reduce(Z,"sum",le).reshape(z)},m.prototype.prod=function(f,y){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.prod(f,y);var E=ra(f.shape,y),z=E[0],Y=Ke(E[1]),Z=f.as2D(-1,Y),le=rr(f.dtype);return this.reduce(Z,"prod",le).reshape(z)},m.prototype.unsortedSegmentSum=function(f,y,E){var z=0,Y=fs([z],f.rank),Z=f;Y!=null&&(Z=wt(f,Y),z=ds(1,f.rank)[0]);var le=function(Fe,Ve,Je){for(var Xe=[],ot=Fe.length,xt=0;xt<ot;xt++)xt!==Ve?Xe.push(Fe[xt]):Xe.push(Je);return Xe}(Z.shape,z,E),de=Ke([Z.shape[z]]),we=Z.as2D(-1,de),De=rr(f.dtype),Ne=this.segOpCompute(we,"unsortedSegmentSum",y,De,E).reshape(le);return Y!=null&&(Ne=wt(Ne,Ic(Y))),Ne},m.prototype.segOpCompute=function(f,y,E,z,Y){var Z=f.shape[0],le=f.shape[1],de=function(Ne,Fe){var Ve,Je=!1;for(Ne<=il?(Ve=Ne,Je=!0):Ve=nr(Ne,Math.floor(Math.sqrt(Ne)));!Je;)Ve>Fe||Ve===Ne?Je=!0:Ve=nr(Ne,Ve+1);return Ve}(le,Y),we=new function(Ne,Fe){this.variableNames=["x","segmentIds"];var Ve=Ne.windowSize,Je=Ne.batchSize,Xe=Ne.inSize,ot=Ne.numSegments,xt=ot*Math.ceil(Xe/Ve);this.outputShape=[Je,xt];var kt=4*Math.floor(Ve/4),At=Ve%4,Lt=` 2145 sumValue += dot(values, segFilter); 2146 `,tn="";Xe%Ve>0&&(tn=` 2147 if (inIdx < 0 || inIdx >= `+Xe+`) { 2148 return initializationValue; 2149 } 2150 `);var ln="";Xe%Ve>0&&(ln=` 2151 if (inIdx < 0 || inIdx >= `+Xe+`) { 2152 return -1.0; 2153 } 2154 `),this.userCode=` 2155 const float initializationValue = 0.0; 2156 2157 float getValue(int batch, int inIdx) { 2158 `+tn+` 2159 return getX(batch, inIdx); 2160 } 2161 2162 float getSegmentIdAtIndex(int inIdx) { 2163 `+ln+` 2164 return getSegmentIds(inIdx); 2165 } 2166 2167 void main() { 2168 ivec2 coords = getOutputCoords(); 2169 int batch = coords[0]; 2170 int outIdx = coords[1]; 2171 int inOffset = int(floor(float(outIdx) / float( 2172 `+ot+")) * float("+Ve+`)); 2173 int currentSeg = int(mod(float(outIdx), float(`+ot+`))); 2174 2175 float sumValue = 0.0; 2176 2177 for (int i = 0; i < `+kt+`; i += 4) { 2178 int inIdx = inOffset + i; 2179 vec4 values = vec4( 2180 getValue(batch, inIdx), 2181 getValue(batch, inIdx + 1), 2182 getValue(batch, inIdx + 2), 2183 getValue(batch, inIdx + 3) 2184 ); 2185 2186 vec4 segFilter = vec4( 2187 int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0, 2188 int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0, 2189 int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0, 2190 int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0 2191 ); 2192 2193 `+Lt+` 2194 } 2195 2196 int inIdx = inOffset + `+kt+`; 2197 if (`+(At===1)+`) { 2198 vec4 values = vec4( 2199 getValue(batch, inIdx), 2200 initializationValue, 2201 initializationValue, 2202 initializationValue 2203 ); 2204 2205 int inIdxSeg = int(getSegmentIdAtIndex(inIdx)); 2206 2207 vec4 segFilter = vec4( 2208 int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0, 2209 0, 2210 0, 2211 0 2212 ); 2213 2214 `+Lt+` 2215 } else if (`+(At===2)+`) { 2216 vec4 values = vec4( 2217 getValue(batch, inIdx), 2218 getValue(batch, inIdx + 1), 2219 initializationValue, 2220 initializationValue 2221 ); 2222 2223 vec4 segFilter = vec4( 2224 int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0, 2225 int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0, 2226 0, 2227 0 2228 ); 2229 2230 `+Lt+` 2231 } else if (`+(At===3)+`) { 2232 vec4 values = vec4( 2233 getValue(batch, inIdx), 2234 getValue(batch, inIdx + 1), 2235 getValue(batch, inIdx + 2), 2236 initializationValue 2237 ); 2238 2239 vec4 segFilter = vec4( 2240 int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0, 2241 int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0, 2242 int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0, 2243 0 2244 ); 2245 2246 `+Lt+` 2247 } 2248 setOutput(sumValue); 2249 } 2250 `}({windowSize:de,inSize:le,batchSize:Z,numSegments:Y}),De=this.compileAndRun(we,[f,E],z);return De.shape[1]===Y?De:(E=kl(0,Y).tile([le/de]),this.segOpCompute(De,y,E,z,Y))},m.prototype.argMinMaxReduce=function(f,y,E){var z=[y];if(Aa("arg"+E.charAt(0).toUpperCase()+E.slice(1),z,f.rank),!L().getBool("WEBGL_PACK_REDUCE")||f.rank<=2){var Y=ra(f.shape,z),Z=Y[0],le=Ke(Y[1]),de=f.as2D(-1,le);return this.argReduce(de,E).reshape(Z)}return this.argReducePacked(f,E)},m.prototype.argMin=function(f,y){return this.argMinMaxReduce(f,y,"min")},m.prototype.argMax=function(f,y){return this.argMinMaxReduce(f,y,"max")},m.prototype.cumsum=function(f,y,E,z){if(y!==f.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(f.rank-1)+" but got axis="+y);var Y=new function(Z,le,de){this.variableNames=["x"],this.outputShape=Z;var we=Z.length,De=Z[Z.length-1],Ne=de?"<":">";this.userCode=` 2251 int getIndex(int i) { 2252 `+(de?"return "+De+" -i - 1;":"return i;")+` 2253 } 2254 2255 void main() { 2256 `+fa(we)+` coords = getOutputCoords(); 2257 int end = `+Wv(we,"coords")+`; 2258 float val = 0.0; 2259 for (int i = `+De+` - 1; i >= 0; i -= 1) { 2260 int idx = getIndex(i); 2261 if (idx `+Ne+` end) { 2262 continue; 2263 } 2264 if (idx == end && `+le+`) { 2265 continue; 2266 } 2267 `+Wv(we,"coords")+` = idx; 2268 val += getX(`+function(Fe,Ve){if(Fe===1)return""+Ve;if(Fe===2)return Ve+".x, "+Ve+".y";if(Fe===3)return Ve+".x, "+Ve+".y, "+Ve+".z";if(Fe===4)return Ve+".x, "+Ve+".y, "+Ve+".z, "+Ve+".w";throw Error("Cumulative sum for rank "+Fe+" is not yet supported")}(we,"coords")+`); 2269 } 2270 setOutput(val); 2271 } 2272 `}(f.shape,E,z);return this.compileAndRun(Y,[f])},m.prototype.equal=function(f,y){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,` 2273 return vec4(equal(a, b)); 2274`,"bool");var E=new xa("return float(a == b);",f.shape,y.shape);return this.compileAndRun(E,[f,y],"bool")},m.prototype.notEqual=function(f,y){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,` 2275 return vec4(notEqual(a, b)); 2276`,"bool");var E=new xa("return float(a != b);",f.shape,y.shape);return this.compileAndRun(E,[f,y],"bool")},m.prototype.less=function(f,y){if(this.shouldExecuteOnCPU([f,y]))return this.cpuBackend.less(f,y);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,` 2277 return vec4(lessThan(a, b)); 2278`,"bool");var E=new xa("return float(a < b);",f.shape,y.shape);return this.compileAndRun(E,[f,y],"bool")},m.prototype.lessEqual=function(f,y){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,` 2279 return vec4(lessThanEqual(a, b)); 2280`,"bool");var E=new xa("return float(a <= b);",f.shape,y.shape);return this.compileAndRun(E,[f,y],"bool")},m.prototype.greater=function(f,y){if(this.shouldExecuteOnCPU([f,y]))return this.cpuBackend.greater(f,y);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,` 2281 return vec4(greaterThan(a, b)); 2282`,"bool");var E=new xa("return float(a > b);",f.shape,y.shape);return this.compileAndRun(E,[f,y],"bool")},m.prototype.greaterEqual=function(f,y){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,` 2283 return vec4(greaterThanEqual(a, b)); 2284`,"bool");var E=new xa("return float(a >= b);",f.shape,y.shape);return this.compileAndRun(E,[f,y],"bool")},m.prototype.logicalNot=function(f){var y=new Fo(f.shape,"return float(!(x >= 1.0));");return this.compileAndRun(y,[f])},m.prototype.logicalAnd=function(f,y){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,` 2285 return vec4( 2286 vec4(greaterThanEqual(a, vec4(1.0))) * 2287 vec4(greaterThanEqual(b, vec4(1.0)))); 2288`,"bool");var E=new xa("return float(a >= 1.0 && b >= 1.0);",f.shape,y.shape);return this.compileAndRun(E,[f,y],"bool")},m.prototype.logicalOr=function(f,y){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,` 2289 return min( 2290 vec4(greaterThanEqual(a, vec4(1.0))) + 2291 vec4(greaterThanEqual(b, vec4(1.0))), 2292 vec4(1.0)); 2293`,"bool");var E=new xa("return float(a >= 1.0 || b >= 1.0);",f.shape,y.shape);return this.compileAndRun(E,[f,y],"bool")},m.prototype.select=function(f,y,E){var z=new function(Y,Z,le){var de,we;if(this.variableNames=["c","a","b"],this.outputShape=Z,le>4)throw Error("Where for rank "+le+" is not yet supported");
vendor: 8,068 bytes, lines 2293-2419
2293if(le===1)we="resRC",de="resRC";else{for(var De=["resRC.x","resRC.y","resRC.z","resRC.w"],Ne=[],Fe=[],Ve=0;Ve<Z.length;Ve++)Fe.push(""+De[Ve]),Ve<Y&&Ne.push(""+De[Ve]);de=Ne.join(),we=Fe.join()}var Je=fa(le);this.userCode=` 2294 void main() { 2295 `+Je+` resRC = getOutputCoords(); 2296 float cVal = getC(`+de+`); 2297 if (cVal >= 1.0) { 2298 setOutput(getA(`+we+`)); 2299 } else { 2300 setOutput(getB(`+we+`)); 2301 } 2302 } 2303 `}(f.rank,y.shape,y.rank);return this.compileAndRun(z,[f,y,E],kn(y.dtype,E.dtype))},m.prototype.where=function(f){yf("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var y=f.dataSync();return Na(f.shape,y)},m.prototype.topk=function(f,y,E){return Ua(f.dataSync(),f.shape,f.dtype,y)},m.prototype.min=function(f,y){Aa("min",y,f.rank);var E=ra(f.shape,y),z=E[0],Y=Ke(E[1]),Z=f.as2D(-1,Y);return this.reduce(Z,"min",Z.dtype).reshape(z)},m.prototype.minimum=function(f,y){if(this.shouldExecuteOnCPU([f,y]))return this.cpuBackend.minimum(f,y);var E=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new _s(` 2304 vec4 result = vec4(min(a, b)); 2305 vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); 2306 2307 result.r = isNaN.r > 0. ? NAN : result.r; 2308 result.g = isNaN.g > 0. ? NAN : result.g; 2309 result.b = isNaN.b > 0. ? NAN : result.b; 2310 result.a = isNaN.a > 0. ? NAN : result.a; 2311 2312 return result; 2313`,f.shape,y.shape):new xa(` 2314 if (isnan(a)) return a; 2315 if (isnan(b)) return b; 2316 2317 return min(a, b); 2318`,f.shape,y.shape);return this.compileAndRun(E,[f,y])},m.prototype.mod=function(f,y){var E=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new _s(` 2319 vec4 result = mod(a, b); 2320 vec4 isNaN = vec4(equal(b, vec4(0.0))); 2321 2322 result.r = isNaN.r > 0. ? NAN : result.r; 2323 result.g = isNaN.g > 0. ? NAN : result.g; 2324 result.b = isNaN.b > 0. ? NAN : result.b; 2325 result.a = isNaN.a > 0. ? NAN : result.a; 2326 2327 return result; 2328`,f.shape,y.shape):new xa(`if (b == 0.0) return NAN; 2329 return mod(a, b);`,f.shape,y.shape);return this.compileAndRun(E,[f,y])},m.prototype.max=function(f,y){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.max(f,y);Aa("max",y,f.rank);var E=ra(f.shape,y),z=E[0],Y=Ke(E[1]),Z=f.as2D(-1,Y);return this.reduce(Z,"max",Z.dtype).reshape(z)},m.prototype.maximum=function(f,y){if(this.shouldExecuteOnCPU([f,y]))return this.cpuBackend.maximum(f,y);var E=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new _s(` 2330 vec4 result = vec4(max(a, b)); 2331 vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); 2332 2333 result.r = isNaN.r > 0. ? NAN : result.r; 2334 result.g = isNaN.g > 0. ? NAN : result.g; 2335 result.b = isNaN.b > 0. ? NAN : result.b; 2336 result.a = isNaN.a > 0. ? NAN : result.a; 2337 2338 return result; 2339`,f.shape,y.shape):new xa(` 2340 if (isnan(a)) return a; 2341 if (isnan(b)) return b; 2342 2343 return max(a, b); 2344`,f.shape,y.shape);return this.compileAndRun(E,[f,y])},m.prototype.all=function(f,y){Aa("all",y,f.rank);var E=ra(f.shape,y),z=E[0],Y=Ke(E[1]),Z=f.as2D(-1,Y);return this.reduce(Z,"all",Z.dtype).reshape(z)},m.prototype.any=function(f,y){Aa("any",y,f.rank);var E=ra(f.shape,y),z=E[0],Y=Ke(E[1]),Z=f.as2D(-1,Y);return this.reduce(Z,"any",Z.dtype).reshape(z)},m.prototype.floorDiv=function(f,y){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,` 2345 ivec4 ia = round(a); 2346 ivec4 ib = round(b); 2347 bvec4 cond = notEqual(ib, ivec4(0)); 2348 ivec4 result = ivec4(0); 2349 vec4 s = sign(a) * sign(b); 2350 2351 // Windows (D3D) wants guaranteed non-zero int division at compile-time. 2352 if (cond[0]) { 2353 result[0] = idiv(ia[0], ib[0], s[0]); 2354 } 2355 if (cond[1]) { 2356 result[1] = idiv(ia[1], ib[1], s[1]); 2357 } 2358 if (cond[2]) { 2359 result[2] = idiv(ia[2], ib[2], s[2]); 2360 } 2361 if (cond[3]) { 2362 result[3] = idiv(ia[3], ib[3], s[3]); 2363 } 2364 return vec4(result); 2365`,"int32");var E=new xa(` 2366 float s = sign(a) * sign(b); 2367 int ia = round(a); 2368 int ib = round(b); 2369 if (ib != 0) { 2370 // Windows (D3D) wants guaranteed non-zero int division at compile-time. 2371 return float(idiv(ia, ib, s)); 2372 } else { 2373 return NAN; 2374 } 2375`,f.shape,y.shape);return this.compileAndRun(E,[f,y],"int32")},m.prototype.add=function(f,y){if(f.dtype==="complex64"&&y.dtype==="complex64")return this.complexSeparableBinaryOp(f,y,Su);if(this.shouldExecuteOnCPU([f,y]))return this.cpuBackend.add(f,y);var E=kn(f.dtype,y.dtype);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,Su,E);var z=new xa(Su,f.shape,y.shape);return this.compileAndRun(z,[f,y],E)},m.prototype.packedUnaryOp=function(f,y,E){var z=new bd(f.shape,y);return this.compileAndRun(z,[f],E)},m.prototype.packedBinaryOp=function(f,y,E,z,Y){Y===void 0&&(Y=!1);var Z=new _s(E,f.shape,y.shape,Y);return this.compileAndRun(Z,[f,y],z)},m.prototype.complexSeparableBinaryOp=function(f,y,E){var z=this,Y=this.texData.get(f.dataId),Z=this.texData.get(y.dataId),le=[[Y.complexTensors.real,Z.complexTensors.real],[Y.complexTensors.imag,Z.complexTensors.imag]].map(function(Ne){var Fe=Ne[0],Ve=Ne[1],Je=z.makeComplexComponentTensorInfo(f,Fe),Xe=z.makeComplexComponentTensorInfo(y,Ve),ot=new xa(E,f.shape,y.shape);return z.compileAndRun(ot,[Je,Xe],kn(Fe.dtype,Ve.dtype))}),de=le[0],we=le[1],De=this.complex(de,we);return de.dispose(),we.dispose(),De},m.prototype.makeComplexComponentTensorInfo=function(f,y){return{dataId:y.dataId,dtype:y.dtype,shape:f.shape}},m.prototype.addN=function(f){if(f.length===1)return f[0];if(f.length>L().get("WEBGL_MAX_TEXTURES_IN_SHADER")){var y=Math.floor(f.length/2),E=this.addN(f.slice(0,y)),z=this.addN(f.slice(y));return this.addN([E,z])}var Y=f.map(function(de){return de.dtype}).reduce(function(de,we){return kn(de,we)}),Z=f.map(function(de){return de.shape}),le=L().getBool("WEBGL_PACK")?new function(de,we){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=de,this.variableNames=we.map(function(Fe,Ve){return"T"+Ve});var De=[];this.variableNames.forEach(function(Fe){De.push("vec4 v"+Fe+" = get"+Fe+"AtOutCoords();")});var Ne=this.variableNames.map(function(Fe){return"v"+Fe}).join(" + ");this.userCode=` 2376 void main() { 2377 `+De.join(` 2378 `)+` 2379 2380 vec4 result = `+Ne+`; 2381 setOutput(result); 2382 } 2383 `}(f[0].shape,Z):new function(de,we){this.outputShape=[],this.outputShape=de,this.variableNames=we.map(function(Fe,Ve){return"T"+Ve});var De=[];this.variableNames.forEach(function(Fe){De.push("float v"+Fe+" = get"+Fe+"AtOutCoords();")});var Ne=this.variableNames.map(function(Fe){return"v"+Fe}).join(" + ");this.userCode=` 2384 void main() { 2385 `+De.join(` 2386 `)+` 2387 2388 float result = `+Ne+`; 2389 setOutput(result); 2390 } 2391 `}(f[0].shape,Z);return this.compileAndRun(le,f,Y)},m.prototype.subtract=function(f,y){if(f.dtype==="complex64"&&y.dtype==="complex64")return this.complexSeparableBinaryOp(f,y,Ls);if(this.shouldExecuteOnCPU([f,y]))return this.cpuBackend.subtract(f,y);var E=kn(f.dtype,y.dtype);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(f,y,Ls,f.dtype);var z=new xa(Ls,f.shape,y.shape);return this.compileAndRun(z,[f,y],E)},m.prototype.pow=function(f,y){var E=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new _s(` 2392 // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise. 2393 vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1))); 2394 vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1); 2395 vec4 result = multiplier * pow(abs(a), b); 2396 2397 // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS 2398 bvec4 isExpZero = equal(b, vec4(0.0)); 2399 result.r = isExpZero.r ? 1.0 : result.r; 2400 result.g = isExpZero.g ? 1.0 : result.g; 2401 result.b = isExpZero.b ? 1.0 : result.b; 2402 result.a = isExpZero.a ? 1.0 : result.a; 2403 2404 vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b)); 2405 2406 result.r = isNaN.r > 0. ? NAN : result.r; 2407 result.g = isNaN.g > 0. ? NAN : result.g; 2408 result.b = isNaN.b > 0. ? NAN : result.b; 2409 result.a = isNaN.a > 0. ? NAN : result.a; 2410 2411 return result; 2412`,f.shape,y.shape):new xa(` 2413if(a < 0.0 && floor(b) < b){ 2414 return NAN; 2415} 2416if (b == 0.0) { 2417 return 1.0; 2418} 2419return (round(mod(b, 2.0)) != 1) ?
2420 pow(abs(a), b) : sign(a) * pow(abs(a), b); 2421`,f.shape,y.shape),z=kn(f.dtype,y.dtype);return this.compileAndRun(E,[f,y],z)},m.prototype.ceil=function(f){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.ceil(f);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(f,ey,f.dtype);var y=new Fo(f.shape,ey);return this.compileAndRun(y,[f])},m.prototype.floor=function(f){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.floor(f);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(f,ty,f.dtype);var y=new Fo(f.shape,ty);return this.compileAndRun(y,[f])},m.prototype.sign=function(f){var y=new Fo(f.shape,` 2422 if (isnan(x)) { return 0.0; } 2423 return sign(x); 2424`);return this.compileAndRun(y,[f])},m.prototype.isNaN=function(f){var y=new Fo(f.shape,"return float(isnan(x));");return this.compileAndRun(y,[f],"bool")},m.prototype.isInf=function(f){var y=new Fo(f.shape,"return float(isinf(x));");return this.compileAndRun(y,[f],"bool")},m.prototype.isFinite=function(f){var y=new Fo(f.shape,"return float(!isnan(x) && !isinf(x));");return this.compileAndRun(y,[f],"bool")},m.prototype.round=function(f){var y=new Fo(f.shape,` 2425 // OpenGL ES does not support round function. 2426 // The algorithm is based on banker's rounding. 2427 float base = floor(x); 2428 if ((x - base) < 0.5) { 2429 return floor(x); 2430 } else if ((x - base) > 0.5) { 2431 return ceil(x); 2432 } else { 2433 if (mod(base, 2.0) == 0.0) { 2434 return base; 2435 } else { 2436 return base + 1.0; 2437 } 2438 } 2439`);return this.compileAndRun(y,[f])},m.prototype.exp=function(f){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.exp(f);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(f,Pp,f.dtype);var y=new Fo(f.shape,Pp);return this.compileAndRun(y,[f])},m.prototype.expm1=function(f){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.expm1(f);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(f,kh,f.dtype);var y=new Fo(f.shape,kh);return this.compileAndRun(y,[f])},m.prototype.softmax=function(f,y){var E=Vt([y],f.shape),z=this.max(f,E),Y=ia(z.shape,E),Z=this.subtract(f,z.reshape(Y)),le=this.exp(Z),de=this.sum(le,E).reshape(Y);return Da(le,de)},m.prototype.log=function(f){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.log(f);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(f,` 2440 vec4 result = log(x); 2441 vec4 isNaN = vec4(lessThan(x, vec4(0.0))); 2442 result.r = isNaN.r == 1.0 ? NAN : result.r; 2443 result.g = isNaN.g == 1.0 ? NAN : result.g; 2444 result.b = isNaN.b == 1.0 ? NAN : result.b; 2445 result.a = isNaN.a == 1.0 ? NAN : result.a; 2446 2447 return result; 2448`,f.dtype);var y=new Fo(f.shape,`if (x < 0.0) return NAN; 2449 return log(x);`);return this.compileAndRun(y,[f])},m.prototype.log1p=function(f){var y=new Fo(f.shape,"return log(1.0 + x);");return this.compileAndRun(y,[f])},m.prototype.sqrt=function(f){var y=new Fo(f.shape,"return sqrt(x);");return this.compileAndRun(y,[f])},m.prototype.rsqrt=function(f){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.rsqrt(f);var y=new Fo(f.shape,"return inversesqrt(x);");return this.compileAndRun(y,[f])},m.prototype.reciprocal=function(f){var y=new Fo(f.shape,"return 1.0 / x;");return this.compileAndRun(y,[f])},m.prototype.relu=function(f){var y;return y=L().getBool("WEBGL_PACK")?new bd(f.shape,Vg):new Fo(f.shape,Zv),this.compileAndRun(y,[f])},m.prototype.relu6=function(f){var y;return y=L().getBool("WEBGL_PACK")?new bd(f.shape,If):new Fo(f.shape,Qm),this.compileAndRun(y,[f])},m.prototype.prelu=function(f,y){var E=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new _s(qs,f.shape,y.shape):new xa(Xl,f.shape,y.shape);return this.compileAndRun(E,[f,y])},m.prototype.elu=function(f){if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(f,zc,f.dtype);var y=new Fo(f.shape,Tf);return this.compileAndRun(y,[f])},m.prototype.eluDer=function(f,y){var E=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new _s(` 2450 vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));
2451 return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0)))); 2452`,f.shape,y.shape):new xa("return (b >= 1.0) ? a : a * (b + 1.0);",f.shape,y.shape);return this.compileAndRun(E,[f,y])},m.prototype.selu=function(f){var y=new Fo(f.shape,` 2453 // Stable and Attracting Fixed Point (0, 1) for Normalized Weights. 2454 // see: https://arxiv.org/abs/1706.02515 2455 float scaleAlpha = 1.7580993408473768; 2456 float scale = 1.0507009873554805; 2457 return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0); 2458`);return this.compileAndRun(y,[f])},m.prototype.int=function(f){var y=new Fo(f.shape,"return float(int(x));");return this.compileAndRun(y,[f],"int32")},m.prototype.clip=function(f,y,E){var z,Y=(z=L().getBool("WEBGL_PACK_CLIP")?new Of(f.shape):new Ol(f.shape)).getCustomSetupFunc(y,E);return this.compileAndRun(z,[f],null,Y)},m.prototype.abs=function(f){if(this.shouldExecuteOnCPU([f]))return this.cpuBackend.abs(f);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(f,Wg,f.dtype);var y=new Fo(f.shape,Wg);return this.compileAndRun(y,[f])},m.prototype.complexAbs=function(f){var y=this.texData.get(f.dataId),E=new function(Y){this.variableNames=["real","imag"],this.outputShape=Y,this.userCode=` 2459 void main() { 2460 float re = abs(getRealAtOutCoords()); 2461 float im = abs(getImagAtOutCoords()); 2462 float mx = max(re, im); 2463 2464 // sadly the length function in glsl is not underflow-safe 2465 // (at least not on Intel GPUs). So the safe solution is 2466 // to ensure underflow-safety in all cases. 2467 setOutput( 2468 mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx)) 2469 ); 2470 } 2471 `}(f.shape),z=[this.makeComplexComponentTensorInfo(f,y.complexTensors.real),this.makeComplexComponentTensorInfo(f,y.complexTensors.imag)];return this.compileAndRun(E,z)},m.prototype.sigmoid=function(f){var y=new Fo(f.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(y,[f])},m.prototype.softplus=function(f){var y=new Fo(f.shape,` 2472 float epsilon = 1.1920928955078125e-7; 2473 float threshold = log(epsilon) + 2.0; 2474 2475 bool too_large = x > -threshold; 2476 bool too_small = x < threshold; 2477 2478 float result; 2479 float exp_x = exp(x); 2480 2481 if (too_large){ 2482 result = x; 2483 } 2484 else if (too_small){ 2485 result = exp_x; 2486 } 2487 else{ 2488 result = log(exp_x + 1.0); 2489 } 2490 return result; 2491`);return this.compileAndRun(y,[f])},m.prototype.sin=function(f){var y=new Fo(f.shape,`if (isnan(x)) return x; 2492 return sin(x); 2493`);return this.compileAndRun(y,[f])},m.prototype.cos=function(f){var y=new Fo(f.shape,`if (isnan(x)) return x; 2494 return cos(x); 2495`);return this.compileAndRun(y,[f])},m.prototype.tan=function(f){var y=new Fo(f.shape,"return tan(x);");return this.compileAndRun(y,[f])},m.prototype.asin=function(f){var y=new Fo(f.shape,`if (isnan(x)) return x; 2496 if (abs(x) > 1.) { 2497 return NAN; 2498 } 2499 return asin(x); 2500`);return this.compileAndRun(y,[f])},m.prototype.acos=function(f){var y=new Fo(f.shape,`if (isnan(x)) return x; 2501 if (abs(x) > 1.) { 2502 return NAN; 2503 } 2504 return acos(x); 2505`);return this.compileAndRun(y,[f])},m.prototype.atan=function(f){var y=new Fo(f.shape,`if (isnan(x)) return x; 2506 return atan(x); 2507`);return this.compileAndRun(y,[f])},m.prototype.atan2=function(f,y){var E=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new _s(` 2508 vec4 result = atan(a, b); 2509 vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); 2510 2511 result.r = isNaN.r > 0. ? NAN : result.r; 2512 result.g = isNaN.g > 0. ? NAN : result.g; 2513 result.b = isNaN.b > 0. ? NAN : result.b; 2514 result.a = isNaN.a > 0. ? NAN : result.a; 2515 2516 return result; 2517`,f.shape,y.shape):new xa(` 2518 if (isnan(a)) return a; 2519 if (isnan(b)) return b; 2520 2521 return atan(a, b); 2522`,f.shape,y.shape);return this.compileAndRun(E,[f,y])},m.prototype.sinh=function(f){var y=new Fo(f.shape,` 2523 float e2x = exp(x); 2524 return (e2x - 1.0 / e2x) / 2.0; 2525`);return this.compileAndRun(y,[f])},m.prototype.cosh=function(f){var y=new Fo(f.shape,` 2526 float e2x = exp(-x); 2527 return (e2x + 1.0 / e2x) / 2.0; 2528`);return this.compileAndRun(y,[f])},m.prototype.tanh=function(f){var y=new Fo(f.shape,` 2529 float e2x = exp(-2.0 * abs(x)); 2530 return sign(x) * (1.0 - e2x) / (1.0 + e2x); 2531`);return this.compileAndRun(y,[f])},m.prototype.asinh=function(f){var y=new Fo(f.shape,"if (isnan(x)) return x;return log(x + sqrt(x * x + 1.0));");return this.compileAndRun(y,[f])},m.prototype.acosh=function(f){var y=new Fo(f.shape,`if (isnan(x)) return x; 2532 if (x < 1.0) return NAN; 2533 return log(x + sqrt(x * x - 1.0));`);return this.compileAndRun(y,[f])},m.prototype.atanh=function(f){var y=new Fo(f.shape,`if (isnan(x)) return x; 2534 if ((x < -1.0) || (x > 1.0)) return NAN;
2535 return (log(1.0 + x) - log(1.0 - x)) / 2.0;`);return this.compileAndRun(y,[f])},m.prototype.erf=function(f){var y=new Fo(f.shape,` 2536 // Error function is calculated approximately with elementary function. 2537 // See "Handbook of Mathematical Functions with Formulas, 2538 // Graphs, and Mathematical Tables", Abramowitz and Stegun. 2539 float p = 0.3275911; 2540 float a1 = 0.254829592; 2541 float a2 = -0.284496736; 2542 float a3 = 1.421413741; 2543 float a4 = -1.453152027; 2544 float a5 = 1.061405429; 2545 2546 float sign = sign(x); 2547 x = abs(x); 2548 float t = 1.0 / (1.0 + p * x); 2549 return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x)); 2550`);return this.compileAndRun(y,[f])},m.prototype.step=function(f,y){var E=new Fo(f.shape,function(z){return z===void 0&&(z=0),Jv+` 2551 return x > 0.0 ? 1.0 : float(`+z+`); 2552 `}(y));return this.compileAndRun(E,[f])},m.prototype.conv2dByMatMul=function(f,y,E,z,Y,Z){var le=f.shape,de=this.texData.get(f.dataId),we=E.inChannels,De=le[0]*le[1]*le[2],Ne=E.outChannels,Fe=E.dataFormat==="channelsLast",Ve=(De===1||Ne===1)&&we>1e3,Je=le[2]%2!=0&&!!de.isPacked;if(Ve||!L().getBool("WEBGL_LAZILY_UNPACK")||!L().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!Je){var Xe=Fe?le[0]*le[1]*le[2]:le[0]*le[2]*le[3],ot=this.reshape(f,[1,Xe,E.inChannels]),xt=this.reshape(y,[1,E.inChannels,E.outChannels]);return this.reshape(this.fusedBatchMatMul({a:ot,b:xt,transposeA:!1,transposeB:!1,bias:z,activation:Y,preluActivationWeights:Z}),E.outShape)}var kt=Fe?le[0]*le[1]*(le[2]+1):le[0]*le[2]*(le[3]+1),At={dataId:f.dataId,shape:[1,kt,E.inChannels],dtype:f.dtype},Lt=de.shape;de.shape=de.shape.slice(),de.shape[de.shape.length-2]++,Ee(vc(de.shape,At.shape),function(){return"packed reshape "+de.shape+" to "+At.shape+" isn't free"});var tn=this.reshape(y,[1,E.inChannels,E.outChannels]),ln=this.fusedBatchMatMul({a:At,b:tn,transposeA:!1,transposeB:!1,bias:z,activation:Y,preluActivationWeights:Z}),nn=this.texData.get(ln.dataId);return Ee(nn.isPacked,function(){return"batchMatMul result is expected to be packed"}),de.shape=Lt,nn.shape=E.outShape,qe.makeTensorFromDataId(ln.dataId,E.outShape,ln.dtype)},m.prototype.conv2dWithIm2Row=function(f,y,E,z,Y,Z){var le=E.filterWidth,de=E.filterHeight,we=E.inChannels,De=E.outWidth,Ne=E.outHeight,Fe=E.dataFormat==="channelsLast",Ve=le*de*we,Je=Ne*De,Xe=[Ve,Je],ot=f.squeeze([0]),xt=y.reshape([1,Ve,-1]),kt=new function(Rn,Mn,tr){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=Rn;for(var ur=tr.filterWidth,vr=tr.inChannels,kr=tr.strideWidth,yr=tr.strideHeight,mr=tr.padInfo,jr=tr.outWidth,Pr=tr.dilationWidth,ei=tr.dilationHeight,pi=tr.dataFormat,Mi=mr.left,Ro=mr.top,Bo=vr*ur,Zo=qo(),Jo=pi==="channelsLast",ma=Jo?0:1,Fa=Jo?1:2,Es="",vo=0;vo<=1;vo++)for(var ea=0;ea<=1;ea++)Es+=` 2553 blockIndex = rc.y + `+ea+`; 2554 pos = rc.x + `+vo+`; 2555 2556 if(blockIndex < `+Rn[1]+" && pos < "+Rn[0]+`) { 2557 offsetY = int(blockIndex / (`+jr+")) * "+yr+" - "+Ro+`; 2558 d0 = offsetY + `+ei+" * (pos / "+Bo+`); 2559 2560 if(d0 < `+Mn[ma]+` && d0 >= 0) { 2561 2562 offsetX = int(mod(float(blockIndex), `+jr+".) * "+kr+". - "+Mi+`.); 2563 d1 = offsetX + `+Pr+" * (int(mod(float(pos), "+Bo+".) / "+vr+`.)); 2564 2565 if(d1 < `+Mn[Fa]+` && d1 >= 0) { 2566 2567 ch = int(mod(float(pos), `+vr+`.)); 2568 2569 if (`+Jo+`) { 2570 innerDims = vec2(d1, ch); 2571 result[`+(2*vo+ea)+`] = getChannel( 2572 getA(d0, int(innerDims.x), 2573 int(innerDims.y)), innerDims); 2574 } else { 2575 innerDims = vec2(d0, d1); 2576 result[`+(2*vo+ea)+`] = getChannel( 2577 getA(ch, int(innerDims.x), 2578 int(innerDims.y)), innerDims); 2579 } 2580 } 2581 } 2582 } 2583 `;this.userCode=` 2584 void main() { 2585 ivec2 rc = getOutputCoords(); 2586 2587 vec4 result = vec4(0); 2588 2589 int blockIndex, pos, offsetY, d0, offsetX, d1, ch; 2590 vec2 innerDims; 2591 2592 `+Es+` 2593 2594 `+Zo.output+` = result; 2595 } 2596 `}(Xe,ot.shape,E),At=this.compileAndRun(kt,[ot]).reshape([1,Xe[0],Xe[1]]),Lt=z!=null,tn=Z!=null,ln=Y?wd(Y,!0):null,nn=new Lc(At.shape,[1,Je,E.outChannels],!0,!1,Lt,ln,tn),cn=[At,xt];z&&cn.push(z),tn&&cn.push(Z);var Dn=this.compileAndRun(nn,cn);return Fe?Dn.reshape([1,Ne,De,E.outChannels]):Dn.reshape([1,E.outChannels,Ne,De])},m.prototype.fusedConv2d=function(f){var y=f.input,E=f.filter,z=f.convInfo,Y=f.bias,Z=f.activation,le=f.preluActivationWeights;if(z.filterHeight===1&&z.filterWidth===1&&z.dilationHeight===1&&z.dilationWidth===1&&z.strideHeight===1&&z.strideWidth===1&&(z.padInfo.type==="SAME"||z.padInfo.type==="VALID"))return this.conv2dByMatMul(y,E,z,Y,Z,le);if(L().getBool("WEBGL_CONV_IM2COL")&&y.shape[0]===1)return this.conv2dWithIm2Row(y,E,z,Y,Z,le);var de=Y!=null,we=le!=null,De=Z?wd(Z,!1):null,Ne=new qm(z,de,De,we),Fe=[y,E];return Y&&Fe.push(Y),le&&Fe.push(le),this.compileAndRun(Ne,Fe)},m.prototype.conv2d=function(f,y,E){if(E.filterHeight===1&&E.filterWidth===1&&E.dilationHeight===1&&E.dilationWidth===1&&E.strideHeight===1&&E.strideWidth===1&&(E.padInfo.type==="SAME"||E.padInfo.type==="VALID"))return this.conv2dByMatMul(f,y,E);if(L().getBool("WEBGL_CONV_IM2COL")&&f.shape[0]===1)return this.conv2dWithIm2Row(f,y,E);var z=new qm(E);return this.compileAndRun(z,[f,y])}
vendor: 16,221 bytes, lines 2596-3004
2596,m.prototype.conv2dDerInput=function(f,y,E){var z=new function(Y){this.variableNames=["dy","W"],this.outputShape=Y.inShape;var Z=Y.filterHeight,le=Y.filterWidth,de=Y.strideHeight,we=Y.strideWidth,De=Y.dataFormat==="channelsLast",Ne=Z-1-Y.padInfo.top,Fe=le-1-Y.padInfo.left,Ve=De?1:2,Je=De?2:3,Xe=De?3:1;this.userCode=` 2597 const ivec2 pads = ivec2(`+Ne+", "+Fe+`); 2598 2599 void main() { 2600 ivec4 coords = getOutputCoords(); 2601 int batch = coords[0]; 2602 int d1 = coords[`+Xe+`]; 2603 2604 ivec2 dyCorner = ivec2(coords[`+Ve+"], coords["+Je+`]) - pads; 2605 int dyRCorner = dyCorner.x; 2606 int dyCCorner = dyCorner.y; 2607 2608 // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1). 2609 // ? = to be determined. : = across all values in that axis. 2610 float dotProd = 0.0; 2611 for (int wR = 0; wR < `+Z+`; wR++) { 2612 float dyR = float(dyRCorner + wR) / `+de+`.0; 2613 2614 if (dyR < 0.0 || dyR >= `+Y.outHeight+`.0 || fract(dyR) > 0.0) { 2615 continue; 2616 } 2617 int idyR = int(dyR); 2618 2619 int wRPerm = `+Z+` - 1 - wR; 2620 2621 for (int wC = 0; wC < `+le+`; wC++) { 2622 float dyC = float(dyCCorner + wC) / `+we+`.0; 2623 2624 if (dyC < 0.0 || dyC >= `+Y.outWidth+`.0 || 2625 fract(dyC) > 0.0) { 2626 continue; 2627 } 2628 int idyC = int(dyC); 2629 2630 int wCPerm = `+le+` - 1 - wC; 2631 2632 for (int d2 = 0; d2 < `+Y.outChannels+`; d2++) { 2633 2634 if (`+De+`) { 2635 float xValue = getDy(batch, idyR, idyC, d2); 2636 float wValue = getW(wRPerm, wCPerm, d1, d2); 2637 dotProd += xValue * wValue; 2638 } else { 2639 float xValue = getDy(batch, d2, idyR, idyC); 2640 float wValue = getW(wRPerm, wCPerm, d1, d2); 2641 dotProd += xValue * wValue; 2642 } 2643 2644 } 2645 } 2646 } 2647 setOutput(dotProd); 2648 } 2649 `}(E);return this.compileAndRun(z,[f,y])},m.prototype.conv2dDerFilter=function(f,y,E){var z=new function(Y){this.variableNames=["x","dy"],this.outputShape=Y.filterShape;var Z=Y.strideHeight,le=Y.strideWidth,de=Y.padInfo.top,we=Y.padInfo.left,De=Y.dataFormat==="channelsLast";this.userCode=` 2650 void main() { 2651 ivec4 coords = getOutputCoords(); 2652 int wR = coords.x; 2653 int wC = coords.y; 2654 int d1 = coords.z; 2655 int d2 = coords.w; 2656 2657 // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2). 2658 // ? = to be determined. : = across all values in that axis. 2659 float dotProd = 0.0; 2660 2661 for (int b = 0; b < `+Y.batchSize+`; b++) { 2662 for (int yR = 0; yR < `+Y.outHeight+`; yR++) { 2663 int xR = wR + yR * `+Z+" - "+de+`; 2664 2665 if (xR < 0 || xR >= `+Y.inHeight+`) { 2666 continue; 2667 } 2668 2669 for (int yC = 0; yC < `+Y.outWidth+`; yC++) { 2670 int xC = wC + yC * `+le+" - "+we+`; 2671 2672 if (xC < 0 || xC >= `+Y.inWidth+`) { 2673 continue; 2674 } 2675 2676 if (`+De+`) { 2677 float dyValue = getDy(b, yR, yC, d2); 2678 float xValue = getX(b, xR, xC, d1); 2679 dotProd += (xValue * dyValue); 2680 } else { 2681 float dyValue = getDy(b, d2, yR, yC); 2682 float xValue = getX(b, d1, xR, xC); 2683 dotProd += (xValue * dyValue); 2684 } 2685 2686 } 2687 } 2688 } 2689 setOutput(dotProd); 2690 } 2691 `}(E);return this.compileAndRun(z,[f,y])},m.prototype.fusedDepthwiseConv2D=function(f){var y,E=f.input,z=f.filter,Y=f.convInfo,Z=f.bias,le=f.activation,de=f.preluActivationWeights,we=L().getBool("WEBGL_PACK_DEPTHWISECONV")&&Y.strideWidth<=2&&Y.outChannels/Y.inChannels==1,De=le?wd(le,we):null,Ne=[E,z],Fe=Z!=null,Ve=de!=null;return Fe&&Ne.push(Z),Ve&&Ne.push(de),we?(y=new yd(Y,Fe,De,Ve),this.compileAndRun(y,Ne)):(y=new Df(Y,Fe,De,Ve),this.compileAndRun(y,Ne))},m.prototype.depthwiseConv2D=function(f,y,E){var z;return L().getBool("WEBGL_PACK_DEPTHWISECONV")&&E.strideWidth<=2&&E.outChannels/E.inChannels==1?(z=new yd(E),this.compileAndRun(z,[f,y])):(z=new Df(E),this.compileAndRun(z,[f,y]))},m.prototype.depthwiseConv2DDerInput=function(f,y,E){var z=new function(Y){this.variableNames=["dy","W"],this.outputShape=Y.inShape;var Z=Y.filterHeight,le=Y.filterWidth,de=Y.strideHeight,we=Y.strideWidth,De=Z-1-Y.padInfo.top,Ne=le-1-Y.padInfo.left,Fe=Y.outChannels/Y.inChannels;this.userCode=` 2692 const ivec2 pads = ivec2(`+De+", "+Ne+`); 2693 2694 void main() { 2695 ivec4 coords = getOutputCoords(); 2696 int batch = coords[0]; 2697 int d1 = coords[3]; 2698 ivec2 dyCorner = coords.yz - pads; 2699 int dyRCorner = dyCorner.x; 2700 int dyCCorner = dyCorner.y; 2701 2702 float dotProd = 0.0; 2703 2704 for (int wR = 0; wR < `+Z+`; wR++) { 2705 float dyR = float(dyRCorner + wR) / `+de+`.0; 2706 2707 if (dyR < 0.0 || dyR >= `+Y.outHeight+`.0 || fract(dyR) > 0.0) { 2708 continue; 2709 } 2710 int idyR = int(dyR); 2711 2712 int wRPerm = `+Z+` - 1 - wR; 2713 2714 for (int wC = 0; wC < `+le+`; wC++) { 2715 float dyC = float(dyCCorner + wC) / `+we+`.0; 2716 2717 if (dyC < 0.0 || dyC >= `+Y.outWidth+`.0 || 2718 fract(dyC) > 0.0) { 2719 continue; 2720 } 2721 int idyC = int(dyC); 2722 2723 int wCPerm = `+le+` - 1 - wC; 2724 2725 // TO DO: Vec4 over the channelMul 2726 for (int dm = 0; dm < `+Fe+`; dm++) { 2727 int d2 = d1 * `+Fe+` + dm; 2728 float xValue = getDy(batch, idyR, idyC, d2); 2729 float wValue = getW(wRPerm, wCPerm, d1, dm); 2730 dotProd += xValue * wValue; 2731 } 2732 } 2733 } 2734 setOutput(dotProd); 2735 } 2736 `}(E);return this.compileAndRun(z,[f,y])},m.prototype.depthwiseConv2DDerFilter=function(f,y,E){var z=new function(Y){this.variableNames=["x","dy"],this.outputShape=Y.filterShape;var Z=Y.strideHeight,le=Y.strideWidth,de=Y.padInfo.top,we=Y.padInfo.left,De=Y.outChannels/Y.inChannels;this.userCode=` 2737 void main() { 2738 ivec4 coords = getOutputCoords(); 2739 int wR = coords.x; 2740 int wC = coords.y; 2741 int d1 = coords.z; 2742 int dm = coords.w; 2743 int d2 = d1 * `+De+` + dm; 2744 2745 float dotProd = 0.0; 2746 2747 // TO DO: Vec4 over the batch size 2748 for (int b = 0; b < `+Y.batchSize+`; b++) { 2749 for (int yR = 0; yR < `+Y.outHeight+`; yR++) { 2750 int xR = wR + yR * `+Z+" - "+de+`; 2751 2752 if (xR < 0 || xR >= `+Y.inHeight+`) { 2753 continue; 2754 } 2755 2756 for (int yC = 0; yC < `+Y.outWidth+`; yC++) { 2757 int xC = wC + yC * `+le+" - "+we+`; 2758 2759 if (xC < 0 || xC >= `+Y.inWidth+`) { 2760 continue; 2761 } 2762 2763 float dyValue = getDy(b, yR, yC, d2); 2764 float xValue = getX(b, xR, xC, d1); 2765 dotProd += (xValue * dyValue); 2766 } 2767 } 2768 } 2769 setOutput(dotProd); 2770 } 2771 `}(E);return this.compileAndRun(z,[f,y])},m.prototype.conv3d=function(f,y,E){var z=new function(Y){this.variableNames=["x","W"],this.outputShape=Y.outShape;var Z=Y.padInfo.front,le=Y.padInfo.top,de=Y.padInfo.left,we=Y.strideDepth,De=Y.strideHeight,Ne=Y.strideWidth,Fe=Y.dilationDepth,Ve=Y.dilationHeight,Je=Y.dilationWidth,Xe=Y.filterDepth,ot=Y.filterHeight,xt=Y.filterWidth,kt=4*Math.floor(Y.inChannels/4),At=Y.inChannels%4;this.userCode=` 2772 const ivec3 strides = ivec3(`+we+", "+De+", "+Ne+`); 2773 const ivec3 pads = ivec3(`+Z+", "+le+", "+de+`); 2774 2775 void main() { 2776 ivec5 coords = getOutputCoords(); 2777 int batch = coords.x; 2778 int d2 = coords.u; 2779 2780 ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads; 2781 int xFCorner = xFRCCorner.x; 2782 int xRCorner = xFRCCorner.y; 2783 int xCCorner = xFRCCorner.z; 2784 2785 // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get 2786 // y(yF, yR, yC, d2). ? = to be determined. : = across all 2787 // values in that axis. 2788 float dotProd = 0.0; 2789 for (int wF = 0; wF < `+Xe+`; wF++) { 2790 int xF = xFCorner + wF * `+Fe+`; 2791 2792 if (xF < 0 || xF >= `+Y.inDepth+`) { 2793 continue; 2794 } 2795 2796 for (int wR = 0; wR < `+ot+`; wR++) { 2797 int xR = xRCorner + wR * `+Ve+`; 2798 2799 if (xR < 0 || xR >= `+Y.inHeight+`) { 2800 continue; 2801 } 2802 2803 for (int wC = 0; wC < `+xt+`; wC++) { 2804 int xC = xCCorner + wC * `+Je+`; 2805 2806 if (xC < 0 || xC >= `+Y.inWidth+`) { 2807 continue; 2808 } 2809 2810 for (int d1 = 0; d1 < `+kt+`; d1 += 4) { 2811 vec4 xValues = vec4( 2812 getX(batch, xF, xR, xC, d1), 2813 getX(batch, xF, xR, xC, d1 + 1), 2814 getX(batch, xF, xR, xC, d1 + 2), 2815 getX(batch, xF, xR, xC, d1 + 3) 2816 ); 2817 vec4 wValues = vec4( 2818 getW(wF, wR, wC, d1, d2), 2819 getW(wF, wR, wC, d1 + 1, d2), 2820 getW(wF, wR, wC, d1 + 2, d2), 2821 getW(wF, wR, wC, d1 + 3, d2) 2822 ); 2823 2824 dotProd += dot(xValues, wValues); 2825 } 2826 2827 if (`+(At===1)+`) { 2828 dotProd += 2829 getX(batch, xF, xR, xC, `+kt+`) * 2830 getW(wF, wR, wC, `+kt+`, d2); 2831 } else if (`+(At===2)+`) { 2832 vec2 xValues = vec2( 2833 getX(batch, xF, xR, xC, `+kt+`), 2834 getX(batch, xF, xR, xC, `+kt+` + 1) 2835 ); 2836 vec2 wValues = vec2( 2837 getW(wF, wR, wC, `+kt+`, d2), 2838 getW(wF, wR, wC, `+kt+` + 1, d2) 2839 ); 2840 dotProd += dot(xValues, wValues); 2841 } else if (`+(At===3)+`) { 2842 vec3 xValues = vec3( 2843 getX(batch, xF, xR, xC, `+kt+`), 2844 getX(batch, xF, xR, xC, `+kt+` + 1), 2845 getX(batch, xF, xR, xC, `+kt+` + 2) 2846 ); 2847 vec3 wValues = vec3( 2848 getW(wF, wR, wC, `+kt+`, d2), 2849 getW(wF, wR, wC, `+kt+` + 1, d2), 2850 getW(wF, wR, wC, `+kt+` + 2, d2) 2851 ); 2852 dotProd += dot(xValues, wValues); 2853 } 2854 } 2855 } 2856 } 2857 setOutput(dotProd); 2858 } 2859 `}(E);return this.compileAndRun(z,[f,y])},m.prototype.conv3dDerInput=function(f,y,E){var z=new function(Y){this.variableNames=["dy","W"],this.outputShape=Y.inShape;var Z=Y.filterDepth,le=Y.filterHeight,de=Y.filterWidth,we=Y.strideDepth,De=Y.strideHeight,Ne=Y.strideWidth,Fe=Z-1-Y.padInfo.front,Ve=le-1-Y.padInfo.top,Je=de-1-Y.padInfo.left;this.userCode=` 2860 const ivec3 pads = ivec3(`+Fe+", "+Ve+", "+Je+`); 2861 2862 void main() { 2863 ivec5 coords = getOutputCoords(); 2864 int batch = coords.x; 2865 int d1 = coords.u; 2866 2867 2868 ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads; 2869 int dyFCorner = dyCorner.x; 2870 int dyRCorner = dyCorner.y; 2871 int dyCCorner = dyCorner.z; 2872 2873 float dotProd = 0.0; 2874 for (int wF = 0; wF < `+Z+`; wF++) { 2875 float dyF = float(dyFCorner + wF) / `+we+`.0; 2876 2877 if (dyF < 0.0 || dyF >= `+Y.outDepth+`.0 || fract(dyF) > 0.0) { 2878 continue; 2879 } 2880 int idyF = int(dyF); 2881 2882 int wFPerm = `+Z+` - 1 - wF; 2883 2884 for (int wR = 0; wR < `+le+`; wR++) { 2885 float dyR = float(dyRCorner + wR) / `+De+`.0; 2886 2887 if (dyR < 0.0 || dyR >= `+Y.outHeight+`.0 || 2888 fract(dyR) > 0.0) { 2889 continue; 2890 } 2891 int idyR = int(dyR); 2892 2893 int wRPerm = `+le+` - 1 - wR; 2894 2895 for (int wC = 0; wC < `+de+`; wC++) { 2896 float dyC = float(dyCCorner + wC) / `+Ne+`.0; 2897 2898 if (dyC < 0.0 || dyC >= `+Y.outWidth+`.0 || 2899 fract(dyC) > 0.0) { 2900 continue; 2901 } 2902 int idyC = int(dyC); 2903 2904 int wCPerm = `+de+` - 1 - wC; 2905 2906 for (int d2 = 0; d2 < `+Y.outChannels+`; d2++) { 2907 float xValue = getDy(batch, idyF, idyR, idyC, d2); 2908 float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2); 2909 dotProd += xValue * wValue; 2910 } 2911 } 2912 } 2913 } 2914 setOutput(dotProd); 2915 } 2916 `}(E);return this.compileAndRun(z,[f,y])},m.prototype.conv3dDerFilter=function(f,y,E){var z=new function(Y){this.variableNames=["x","dy"],this.outputShape=Y.filterShape;var Z=Y.strideDepth,le=Y.strideHeight,de=Y.strideWidth,we=Y.padInfo.front,De=Y.padInfo.top,Ne=Y.padInfo.left;this.userCode=` 2917 void main() { 2918 ivec5 coords = getOutputCoords(); 2919 int wF = coords.x; 2920 int wR = coords.y; 2921 int wC = coords.z; 2922 int d1 = coords.w; 2923 int d2 = coords.u; 2924 2925 float dotProd = 0.0; 2926 2927 for (int b = 0; b < `+Y.batchSize+`; b++) { 2928 for (int yF = 0; yF < `+Y.outDepth+`; yF++) { 2929 int xF = wF + yF * `+Z+" - "+we+`; 2930 2931 if (xF < 0 || xF >= `+Y.inDepth+`) { 2932 continue; 2933 } 2934 2935 for (int yR = 0; yR < `+Y.outHeight+`; yR++) { 2936 int xR = wR + yR * `+le+" - "+De+`; 2937 2938 if (xR < 0 || xR >= `+Y.inHeight+`) { 2939 continue; 2940 } 2941 2942 for (int yC = 0; yC < `+Y.outWidth+`; yC++) { 2943 int xC = wC + yC * `+de+" - "+Ne+`; 2944 2945 if (xC < 0 || xC >= `+Y.inWidth+`) { 2946 continue; 2947 } 2948 2949 float dyValue = getDy(b, yF, yR, yC, d2); 2950 float xValue = getX(b, xF, xR, xC, d1); 2951 dotProd += (xValue * dyValue); 2952 } 2953 } 2954 } 2955 } 2956 setOutput(dotProd); 2957 } 2958 `}(E);return this.compileAndRun(z,[f,y])},m.prototype.maxPool=function(f,y){var E=new Bp(y,"max",!1);return this.compileAndRun(E,[f])},m.prototype.avgPool=function(f,y){var E=new Bp(y,"avg",!1);return this.compileAndRun(E,[f],"float32")},m.prototype.maxPoolBackprop=function(f,y,E,z){var Y=new Bp(z,"max",!0),Z=this.compileAndRun(Y,[y]),le=new function(we){this.variableNames=["dy","maxPos"],this.outputShape=we.inShape;var De=we.strideHeight,Ne=we.strideWidth,Fe=we.dilationHeight,Ve=we.effectiveFilterHeight,Je=we.effectiveFilterWidth,Xe=Ve-1-we.padInfo.top,ot=Je-1-we.padInfo.left,xt=Ve*Je-1;this.userCode=` 2959 const ivec2 pads = ivec2(`+Xe+", "+ot+`); 2960 2961 void main() { 2962 ivec4 coords = getOutputCoords(); 2963 int b = coords[0]; 2964 int d = coords[3]; 2965 2966 ivec2 dyRCCorner = coords.yz - pads; 2967 int dyRCorner = dyRCCorner.x; 2968 int dyCCorner = dyRCCorner.y; 2969 2970 // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d). 2971 // ? = to be determined. : = across all values in that axis. 2972 float dotProd = 0.0; 2973 for (int wR = 0; wR < `+Ve+`; 2974 wR += `+Fe+`) { 2975 float dyR = float(dyRCorner + wR) / `+De+`.0; 2976 2977 if (dyR < 0.0 || dyR >= `+we.outHeight+`.0 || fract(dyR) > 0.0) { 2978 continue; 2979 } 2980 int idyR = int(dyR); 2981 2982 for (int wC = 0; wC < `+Je+`; wC++) { 2983 float dyC = float(dyCCorner + wC) / `+Ne+`.0; 2984 2985 if (dyC < 0.0 || dyC >= `+we.outWidth+`.0 || 2986 fract(dyC) > 0.0) { 2987 continue; 2988 } 2989 int idyC = int(dyC); 2990 2991 float dyValue = getDy(b, idyR, idyC, d); 2992 int maxPosValue = `+xt+` - int(getMaxPos(b, idyR, idyC, d)); 2993 2994 // Get the current value, check it against the value from the 2995 // position matrix. 2996 int curPosValue = wR * `+Je+` + wC; 2997 float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0); 2998 2999 dotProd += dyValue * mask; 3000 } 3001 } 3002 setOutput(dotProd); 3003 } 3004 `}(z),de=this.compileAndRun(le,[f,Z],y.dtype);return Z.dispose(),de},m.prototype.avgPoolBackprop=function(f,y,E){var z=new function(Y){this.variableNames=["dy"],this.outputShape=Y.inShape;var Z=Y.filterHeight,le=Y.filterWidth,de=Y.strideHeight,we=Y.strideWidth,De=Y.dilationHeight,Ne=Y.dilationWidth,Fe
vendor: 5,036 bytes, lines 3004-3115
3004=Y.effectiveFilterHeight,Ve=Y.effectiveFilterWidth,Je=Fe-1-Y.padInfo.top,Xe=Ve-1-Y.padInfo.left,ot=1/(Z*le);this.userCode=` 3005 const ivec2 pads = ivec2(`+Je+", "+Xe+`); 3006 const float avgMultiplier = float(`+ot+`); 3007 3008 void main() { 3009 ivec4 coords = getOutputCoords(); 3010 int b = coords[0]; 3011 int d = coords[3]; 3012 3013 ivec2 dyRCCorner = coords.yz - pads; 3014 int dyRCorner = dyRCCorner.x; 3015 int dyCCorner = dyRCCorner.y; 3016 3017 // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d). 3018 // ? = to be determined. : = across all values in that axis. 3019 float dotProd = 0.0; 3020 for (int wR = 0; wR < `+Fe+`; 3021 wR += `+De+`) { 3022 float dyR = float(dyRCorner + wR) / `+de+`.0; 3023 3024 if (dyR < 0.0 || dyR >= `+Y.outHeight+`.0 || fract(dyR) > 0.0) { 3025 continue; 3026 } 3027 int idyR = int(dyR); 3028 3029 for (int wC = 0; wC < `+Ve+`; 3030 wC+= `+Ne+`) { 3031 float dyC = float(dyCCorner + wC) / `+we+`.0; 3032 3033 if (dyC < 0.0 || dyC >= `+Y.outWidth+`.0 || 3034 fract(dyC) > 0.0) { 3035 continue; 3036 } 3037 int idyC = int(dyC); 3038 3039 float dyValue = getDy(b, idyR, idyC, d); 3040 3041 dotProd += dyValue * avgMultiplier; 3042 } 3043 } 3044 setOutput(dotProd); 3045 } 3046 `}(E);return this.compileAndRun(z,[f],y.dtype)},m.prototype.cast=function(f,y){return ii(f,y,this)},m.prototype.unstack=function(f,y){for(var E=f.shape[y],z=new Array(f.rank-1),Y=0,Z=0;Z<f.rank;Z++)Z!==y&&(z[Y++]=f.shape[Z]);var le=new Array(f.rank).fill(0),de=f.shape.slice();de[y]=1;var we=new Array(E);for(Z=0;Z<we.length;Z++)le[y]=Z,we[Z]=this.slice(f,le,de).reshape(z);return we},m.prototype.avgPool3d=function(f,y){var E=new Ym(y,"avg",!1);return this.compileAndRun(E,[f],"float32")},m.prototype.avgPool3dBackprop=function(f,y,E){var z=new function(Y){this.variableNames=["dy"],this.outputShape=Y.inShape;var Z=Y.filterDepth,le=Y.filterHeight,de=Y.filterWidth,we=Y.strideDepth,De=Y.strideHeight,Ne=Y.strideWidth,Fe=Y.dilationDepth,Ve=Y.dilationHeight,Je=Y.dilationWidth,Xe=Y.effectiveFilterDepth,ot=Y.effectiveFilterHeight,xt=Y.effectiveFilterWidth,kt=Xe-1-Y.padInfo.front,At=ot-1-Y.padInfo.top,Lt=xt-1-Y.padInfo.left,tn=1/(Z*le*de);this.userCode=` 3047 const ivec3 pads = ivec3(`+kt+", "+At+", "+Lt+`); 3048 const float avgMultiplier = float(`+tn+`); 3049 3050 void main() { 3051 ivec5 coords = getOutputCoords(); 3052 int batch = coords.x; 3053 int ch = coords.u; 3054 3055 ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads; 3056 int dyDCorner = dyCorner.x; 3057 int dyRCorner = dyCorner.y; 3058 int dyCCorner = dyCorner.z; 3059 3060 // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get 3061 // dx(xD, xR, xC, ch). 3062 // ? = to be determined. : = across all values in that axis. 3063 float dotProd = 0.0; 3064 3065 for (int wD = 0; wD < `+Xe+`; 3066 wD += `+Fe+`) { 3067 float dyD = float(dyDCorner + wD) / `+we+`.0; 3068 3069 if (dyD < 0.0 || dyD >= `+Y.outDepth+`.0 || fract(dyD) > 0.0) { 3070 continue; 3071 } 3072 int idyD = int(dyD); 3073 3074 for (int wR = 0; wR < `+ot+`; 3075 wR += `+Ve+`) { 3076 float dyR = float(dyRCorner + wR) / `+De+`.0; 3077 3078 if (dyR < 0.0 || dyR >= `+Y.outHeight+`.0 || 3079 fract(dyR) > 0.0) { 3080 continue; 3081 } 3082 int idyR = int(dyR); 3083 3084 for (int wC = 0; wC < `+xt+`; 3085 wC += `+Je+`) { 3086 float dyC = float(dyCCorner + wC) / `+Ne+`.0; 3087 3088 if (dyC < 0.0 || dyC >= `+Y.outWidth+`.0 || 3089 fract(dyC) > 0.0) { 3090 continue; 3091 } 3092 int idyC = int(dyC); 3093 3094 float dyValue = getDy(batch, idyD, idyR, idyC, ch); 3095 3096 dotProd += dyValue * avgMultiplier; 3097 } 3098 } 3099 } 3100 setOutput(dotProd); 3101 } 3102 `}(E);return this.compileAndRun(z,[f],y.dtype)},m.prototype.maxPool3d=function(f,y){var E=new Ym(y,"max",!1);return this.compileAndRun(E,[f],"float32")},m.prototype.maxPool3dBackprop=function(f,y,E,z){var Y=new Ym(z,"max",!0),Z=this.compileAndRun(Y,[y]),le=new function(we){this.variableNames=["dy","maxPos"],this.outputShape=we.inShape;var De=we.strideDepth,Ne=we.strideHeight,Fe=we.strideWidth,Ve=we.dilationDepth,Je=we.dilationHeight,Xe=we.dilationWidth,ot=we.effectiveFilterDepth,xt=we.effectiveFilterHeight,kt=we.effectiveFilterWidth,At=ot-1-we.padInfo.front,Lt=xt-1-we.padInfo.top,tn=kt-1-we.padInfo.left,ln=ot*xt*kt-1;this.userCode=` 3103 const ivec3 pads = ivec3(`+At+", "+Lt+", "+tn+`); 3104 3105 void main() { 3106 ivec5 coords = getOutputCoords(); 3107 int batch = coords.x; 3108 int ch = coords.u; 3109 3110 ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads; 3111 int dyDCorner = dyCorner.x; 3112 int dyRCorner = dyCorner.y; 3113 int dyCCorner = dyCorner.z; 3114 3115 // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get
3116 // dx(xD, xR, xC, ch). 3117 // ? = to be determined. : = across all values in that axis. 3118 float dotProd = 0.0; 3119 3120 for (int wD = 0; wD < `+ot+`; 3121 wD += `+Ve+`) { 3122 float dyD = float(dyDCorner + wD) / `+De+`.0; 3123 3124 if (dyD < 0.0 || dyD >= `+we.outDepth+`.0 || fract(dyD) > 0.0) { 3125 continue; 3126 } 3127 int idyD = int(dyD); 3128 3129 for (int wR = 0; wR < `+xt+`; 3130 wR += `+Je+`) { 3131 float dyR = float(dyRCorner + wR) / `+Ne+`.0; 3132 3133 if (dyR < 0.0 || dyR >= `+we.outHeight+`.0 || 3134 fract(dyR) > 0.0) { 3135 continue; 3136 } 3137 int idyR = int(dyR); 3138 3139 for (int wC = 0; wC < `+kt+`; 3140 wC += `+Xe+`) { 3141 float dyC = float(dyCCorner + wC) / `+Fe+`.0; 3142 3143 if (dyC < 0.0 || dyC >= `+we.outWidth+`.0 || 3144 fract(dyC) > 0.0) { 3145 continue; 3146 } 3147 int idyC = int(dyC); 3148 3149 float dyValue = getDy(batch, idyD, idyR, idyC, ch); 3150 int maxPosValue = `+ln+` - 3151 int(getMaxPos(batch, idyD, idyR, idyC, ch)); 3152 3153 // Get the current value, check it against the value from the 3154 // position matrix. 3155 int curPosValue = 3156 wD * `+xt+" * "+kt+` + 3157 wR * `+kt+` + wC; 3158 float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0); 3159 3160 dotProd += dyValue * mask; 3161 } 3162 } 3163 } 3164 setOutput(dotProd); 3165 } 3166 `}(z),de=this.compileAndRun(le,[f,Z],y.dtype);return Z.dispose(),de},m.prototype.reshape=function(f,y){var E=this.texData.get(f.dataId);if(E.isPacked&&!vc(f.shape,y)&&(E.texture===null||!vc(E.shape,y))){var z=this.packedReshape(f,y);return qe.makeTensorFromDataId(z.dataId,z.shape,z.dtype)}return Ci(f,y)},m.prototype.resizeBilinear=function(f,y,E,z){var Y=L().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new function(Z,le,de,we){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];var De=Z[0],Ne=Z[1],Fe=Z[2],Ve=Z[3];this.outputShape=[De,le,de,Ve];var Je=[we&&le>1?Ne-1:Ne,we&&de>1?Fe-1:Fe],Xe=[we&&le>1?le-1:le,we&&de>1?de-1:de];this.userCode=` 3167 const vec3 effectiveInputOverOutputRatioRC = vec3( 3168 `+Je[0]/Xe[0]+`, 3169 `+Je[1]/Xe[1]+`, 3170 `+Je[1]/Xe[1]+`); 3171 const vec3 inputShapeRC = vec3(`+Ne+".0, "+Fe+`.0, 3172 `+Fe+`.0); 3173 3174 float getAValue(int b, int r, int c, int d) { 3175 return getChannel(getA(b, r, c, d), vec2(c, d)); 3176 } 3177 3178 void main() { 3179 ivec4 coords = getOutputCoords(); 3180 int b = coords[0]; 3181 int d = coords[3]; 3182 // Calculate values for next column in yRC.z. 3183 ivec3 yRC = coords.yzz + ivec3(0, 0, 1); 3184 3185 // Fractional source index. 3186 vec3 sourceFracIndexRC = vec3(yRC) * effectiveInputOverOutputRatioRC; 3187 3188 // Compute the four integer indices. 3189 ivec3 sourceFloorRC = ivec3(sourceFracIndexRC); 3190 ivec3 sourceCeilRC = ivec3( 3191 min(inputShapeRC - 1.0, ceil(sourceFracIndexRC))); 3192 3193 // Should we calculate next column and row elements in 2x2 packed cell. 3194 bool hasNextCol = d < `+(Ve-1)+`; 3195 bool hasNextRow = coords.z < `+(de-1)+`; 3196 3197 // In parallel, construct four corners for all four components in 3198 // packed 2x2 cell. 3199 vec4 topLeft = vec4( 3200 getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d), 3201 hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1) 3202 : 0.0, 3203 hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d) 3204 : 0.0, 3205 (hasNextRow && hasNextCol) ? 3206 getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0); 3207 3208 vec4 bottomLeft = vec4( 3209 getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d), 3210 hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1) 3211 : 0.0, 3212 hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d) 3213 : 0.0, 3214 (hasNextRow && hasNextCol) ?
3215 getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0); 3216 3217 vec4 topRight = vec4( 3218 getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d), 3219 hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1) 3220 : 0.0, 3221 hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d) 3222 : 0.0, 3223 (hasNextRow && hasNextCol) ? 3224 getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0); 3225 3226 vec4 bottomRight = vec4( 3227 getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d), 3228 hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1) 3229 : 0.0, 3230 hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d) 3231 : 0.0, 3232 (hasNextRow && hasNextCol) ? 3233 getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0); 3234 3235 vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC); 3236 3237 vec4 top = mix(topLeft, topRight, fracRC.yyzz); 3238 vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz); 3239 vec4 newValue = mix(top, bottom, fracRC.x); 3240 3241 setOutput(newValue); 3242 } 3243 `}(f.shape,y,E,z):new function(Z,le,de,we){this.variableNames=["A"],this.outputShape=[];var De=Z[0],Ne=Z[1],Fe=Z[2],Ve=Z[3];this.outputShape=[De,le,de,Ve];var Je=[we&&le>1?Ne-1:Ne,we&&de>1?Fe-1:Fe],Xe=[we&&le>1?le-1:le,we&&de>1?de-1:de];this.userCode=` 3244 const vec2 effectiveInputOverOutputRatioRC = vec2( 3245 `+Je[0]/Xe[0]+`, 3246 `+Je[1]/Xe[1]+`); 3247 const vec2 inputShapeRC = vec2(`+Ne+".0, "+Fe+`.0); 3248 3249 void main() { 3250 ivec4 coords = getOutputCoords(); 3251 int b = coords[0]; 3252 int d = coords[3]; 3253 ivec2 yRC = coords.yz; 3254 3255 // Fractional source index. 3256 vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC; 3257 3258 // Compute the four integer indices. 3259 ivec2 sourceFloorRC = ivec2(sourceFracIndexRC); 3260 ivec2 sourceCeilRC = ivec2( 3261 min(inputShapeRC - 1.0, ceil(sourceFracIndexRC))); 3262 3263 float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d); 3264 float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d); 3265 float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d); 3266 float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d); 3267 3268 vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC); 3269 3270 float top = topLeft + (topRight - topLeft) * fracRC.y; 3271 float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y; 3272 float newValue = top + (bottom - top) * fracRC.x; 3273 3274 setOutput(newValue); 3275 } 3276 `}(f.shape,y,E,z);return this.compileAndRun(Y,[f],"float32")},m.prototype.resizeBilinearBackprop=function(f,y,E){var z=new function(Y,Z,le){this.variableNames=["dy"],this.outputShape=[],this.outputShape=Z.shape;var de=Z.shape,we=de[1],De=de[2],Ne=Y.shape,Fe=Ne[1],Ve=Ne[2],Je=[le&&Fe>1?we-1:we,le&&Ve>1?De-1:De],Xe=[le&&Fe>1?Fe-1:Fe,le&&Ve>1?Ve-1:Ve],ot=Je[0]/Xe[0],xt=Je[1]/Xe[1],kt=1/ot,At=1/xt,Lt=2*Math.ceil(kt)+2,tn=2*Math.ceil(At)+2;this.userCode=` 3277 void main() { 3278 ivec4 coords = getOutputCoords(); 3279 int b = coords[0]; 3280 int d = coords[3]; 3281 int r = coords[1]; 3282 int c = coords[2]; 3283 3284 float accumulator = 0.0; 3285 3286 const float heightScale = float(`+ot+`); 3287 const float widthScale = float(`+xt+`); 3288 3289 const float invHeightScale = float(`+kt+`); 3290 const float invWidthScale = float(`+At+`); 3291 3292 const int winHeight = int(`+Lt+`); 3293 const int winWidth = int(`+tn+`); 3294 3295 // Compute bounds for where in dy we will look 3296 float startRLerp = floor(float(r) * invHeightScale); 3297 int startDyR = int(startRLerp - float(winHeight / 2)); 3298 3299 float startCLerp = floor(float(c) * invWidthScale); 3300 int startDyC = int(startCLerp - float(winWidth / 2)); 3301 3302 // Loop over dy 3303 for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) { 3304 int dyR = dyROffset + startDyR; 3305 3306 // Guard against the window exceeding the bounds of dy 3307 if (dyR < 0 || dyR >= `+Fe+`) { 3308 continue; 3309 } 3310 3311 for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) { 3312 int dyC = dyCOffset + startDyC; 3313 3314 // Guard against the window exceeding the bounds of dy 3315 if (dyC < 0 || dyC >= `+Ve+`) { 3316 continue; 3317 } 3318 3319 float dxR = float(dyR) * heightScale; 3320 int topDxRIndex = int(floor(dxR)); 3321 int bottomDxRIndex = int(min(ceil(dxR), `+(we-1)+`.0)); 3322 float dxRLerp = dxR - float(topDxRIndex); 3323 float inverseDxRLerp = 1.0 - dxRLerp; 3324 3325 float dxC = float(dyC) * widthScale; 3326 int leftDxCIndex = int(floor(dxC)); 3327 int rightDxCIndex = int(min(ceil(dxC), `+(De-1)+`.0)); 3328 float dxCLerp = dxC - float(leftDxCIndex); 3329 float inverseDxCLerp = 1.0 - dxCLerp; 3330 3331 if (r == topDxRIndex && c == leftDxCIndex) { 3332 // topLeft 3333 accumulator += 3334 getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp; 3335 } 3336 3337 if (r == topDxRIndex && c == rightDxCIndex) { 3338 // topRight 3339 accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp; 3340 } 3341 3342 if (r == bottomDxRIndex && c == leftDxCIndex) { 3343 // bottomLeft 3344 accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp; 3345 } 3346 3347 if (r == bottomDxRIndex && c == rightDxCIndex) { 3348 // bottomRight 3349 accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp; 3350 } 3351 } 3352 } 3353 // End loop over dy 3354 3355 setOutput(accumulator); 3356 } 3357 `}(f,y,E);return this.compileAndRun(z,[f])},m.prototype.resizeNearestNeighbor=function(f,y,E,z){var Y=new function(Z,le,de,we){this.variableNames=["A"],this.outputShape=[];var De=Z[0],Ne=Z[1],Fe=Z[2],Ve=Z[3];this.outputShape=[De,le,de,Ve];var Je=[we&&le>
vendor: 12,234 bytes, lines 3357-3557
33571?Ne-1:Ne,we&&de>1?Fe-1:Fe],Xe=[we&&le>1?le-1:le,we&&de>1?de-1:de],ot=we?"0.5":"0.0";this.userCode=` 3358 const vec2 effectiveInputOverOutputRatioRC = vec2( 3359 `+Je[0]/Xe[0]+`, 3360 `+Je[1]/Xe[1]+`); 3361 const vec2 inputShapeRC = vec2(`+Ne+".0, "+Fe+`.0); 3362 3363 void main() { 3364 ivec4 coords = getOutputCoords(); 3365 int b = coords[0]; 3366 int d = coords[3]; 3367 ivec2 yRC = coords.yz; 3368 3369 // Fractional source index. 3370 vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC; 3371 3372 // Compute the coordinators of nearest neighbor point. 3373 ivec2 sourceNearestRC = ivec2( 3374 min(inputShapeRC - 1.0, floor(sourceFracIndexRC + `+ot+`))); 3375 3376 float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d); 3377 3378 setOutput(newValue); 3379 } 3380 `}(f.shape,y,E,z);return this.compileAndRun(Y,[f])},m.prototype.resizeNearestNeighborBackprop=function(f,y,E){var z=new function(Y,Z,le){this.variableNames=["dy"],this.outputShape=[],this.outputShape=Z.shape;var de=Z.shape,we=de[1],De=de[2],Ne=Y.shape,Fe=Ne[1],Ve=Ne[2],Je=[le&&Fe>1?we-1:we,le&&Ve>1?De-1:De],Xe=[le&&Fe>1?Fe-1:Fe,le&&Ve>1?Ve-1:Ve],ot=Je[0]/Xe[0],xt=Je[1]/Xe[1],kt=1/ot,At=1/xt,Lt=2*Math.ceil(kt)+2,tn=2*Math.ceil(At)+2;this.userCode=` 3381 void main() { 3382 ivec4 coords = getOutputCoords(); 3383 int b = coords[0]; 3384 int d = coords[3]; 3385 int r = coords[1]; 3386 int c = coords[2]; 3387 3388 float accumulator = 0.0; 3389 3390 const float heightScale = float(`+ot+`); 3391 const float widthScale = float(`+xt+`); 3392 3393 const float invHeightScale = float(`+kt+`); 3394 const float invWidthScale = float(`+At+`); 3395 3396 const int winHeight = int(`+Lt+`); 3397 const int winWidth = int(`+tn+`); 3398 3399 // Compute bounds for where in dy we will look 3400 float startRLerp = floor(float(r) * invHeightScale); 3401 int startDyR = int(floor(startRLerp - float(winHeight / 2))); 3402 3403 float startCLerp = floor(float(c) * invWidthScale); 3404 int startDyC = int(floor(startCLerp - float(winWidth / 2))); 3405 3406 // Loop over dy 3407 for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) { 3408 int dyR = dyROffset + startDyR; 3409 3410 // Guard against the window exceeding the bounds of dy 3411 if (dyR < 0 || dyR >= `+Fe+`) { 3412 continue; 3413 } 3414 3415 for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) { 3416 int dyC = dyCOffset + startDyC; 3417 3418 // Guard against the window exceeding the bounds of dy 3419 if (dyC < 0 || dyC >= `+Ve+`) { 3420 continue; 3421 } 3422 3423 float sourceFracRow = 3424 float(`+Je[0]+`) * 3425 (float(dyR) / float(`+Xe[0]+`)); 3426 3427 float sourceFracCol = 3428 float(`+Je[1]+`) * 3429 (float(dyC) / float(`+Xe[1]+`)); 3430 3431 int sourceNearestRow = int(min( 3432 float(int(`+we+`) - 1), 3433 `+le+` ? float(round(sourceFracRow)) : 3434 float(floor(sourceFracRow)))); 3435 3436 int sourceNearestCol = int(min( 3437 float(int(`+De+`) - 1), 3438 `+le+` ? float(round(sourceFracCol)) : 3439 float(floor(sourceFracCol)))); 3440 3441 if (r == sourceNearestRow && c == sourceNearestCol) { 3442 accumulator += getDy(b, dyR, dyC, d); 3443 } 3444 } 3445 } 3446 // End loop over dy 3447 3448 setOutput(accumulator); 3449 } 3450 `}(f,y,E);return this.compileAndRun(z,[f])},m.prototype.multinomial=function(f,y,E,z){var Y=y?f:Le(f),Z=Y.shape[0],le=Y.shape[1],de=new $0(Z,le,E),we=de.getCustomSetupFunc(z);return this.compileAndRun(de,[Y],"int32",we)},m.prototype.oneHot=function(f,y,E,z){var Y=new function(Z,le,de,we){this.variableNames=["indices"],this.outputShape=[Z,le],this.userCode=` 3451 void main() { 3452 ivec2 coords = getOutputCoords(); 3453 int index = round(getIndices(coords.x)); 3454 setOutput(mix(float(`+we+"), float("+de+`), 3455 float(index == coords.y))); 3456 } 3457 `}(f.size,y,E,z);return this.compileAndRun(Y,[f])},m.prototype.diag=function(f){var y=new function(E){this.variableNames=["X"],this.outputShape=[E,E],this.userCode=` 3458 void main() { 3459 ivec2 coords = getOutputCoords(); 3460 float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0; 3461 setOutput(val); 3462 } 3463 `}(f.size);return this.compileAndRun(y,[f])},m.prototype.nonMaxSuppression=function(f,y,E,z,Y){return yf("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead"),ja(f.dataSync(),y.dataSync(),E,z,Y)},m.prototype.cropAndResize=function(f,y,E,z,Y,Z){var le=new function(de,we,De,Ne,Fe){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var Ve=de[0],Je=de[1],Xe=de[2],ot=de[3],xt=we[0],kt=De[0],At=De[1];this.outputShape=[xt,kt,At,ot];var Lt=Ne==="bilinear"?1:0,tn=[Je-1+".0",Xe-1+".0"],ln=tn[0],nn=tn[1],cn=kt>1?[""+(Je-1)/(kt-1),"(y2-y1) * height_ratio","y1*"+ln+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+ln],Dn=cn[0],Rn=cn[1],Mn=cn[2],tr=At>1?[""+(Xe-1)/(At-1),"(x2-x1) * width_ratio","x1*"+nn+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+nn],ur=tr[0],vr=tr[1],kr=tr[2];this.userCode=` 3464 const float height_ratio = float(`+Dn+`); 3465 const float width_ratio = float(`+ur+`); 3466 void main() { 3467 ivec4 coords = getOutputCoords(); 3468 int b = coords[0]; 3469 int y = coords[1]; 3470 int x = coords[2]; 3471 int d = coords[3]; 3472 3473 // get box vals 3474 float y1 = getBoxes(b,0); 3475 float x1 = getBoxes(b,1); 3476 float y2 = getBoxes(b,2); 3477 float x2 = getBoxes(b,3); 3478 3479 // get image in batch index 3480 int bInd = round(getBoxInd(b)); 3481 if(bInd < 0 || bInd >= `+Ve+`) { 3482 return; 3483 } 3484 3485 float height_scale = `+Rn+`; 3486 float width_scale = `+vr+`; 3487 3488 float in_y = `+Mn+`; 3489 if( in_y < 0.0 || in_y > `+ln+` ) { 3490 setOutput(float(`+Fe+`)); 3491 return; 3492 } 3493 float in_x = `+kr+`; 3494 if( in_x < 0.0 || in_x > `+nn+` ) { 3495 setOutput(float(`+Fe+`)); 3496 return; 3497 } 3498 3499 vec2 sourceFracIndexCR = vec2(in_x,in_y); 3500 if(`+Lt+` == 1) { 3501 // Compute the four integer indices. 3502 ivec2 sourceFloorCR = ivec2(sourceFracIndexCR); 3503 ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR)); 3504 3505 float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d); 3506 float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d); 3507 float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d); 3508 float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d); 3509 3510 vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR); 3511 3512 float top = topLeft + (topRight - topLeft) * fracCR.x; 3513 float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x; 3514 float newValue = top + (bottom - top) * fracCR.y; 3515 setOutput(newValue); 3516 } else { 3517 // Compute the coordinators of nearest neighbor point. 3518 ivec2 sourceNearestCR = ivec2(floor( 3519 sourceFracIndexCR + vec2(0.5,0.5))); 3520 float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d); 3521 setOutput(newValue); 3522 } 3523 } 3524 `}(f.shape,y.shape,z,Y,Z);return this.compileAndRun(le,[f,y,E],"float32")},m.prototype.depthToSpace=function(f,y,E){Ee(y>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+y});var z=f.shape[0],Y=E==="NHWC"?f.shape[1]:f.shape[2],Z=E==="NHWC"?f.shape[2]:f.shape[3],le=E==="NHWC"?f.shape[3]:f.shape[1],de=Y*y,we=Z*y,De=le/(y*y),Ne=new Vv(E==="NHWC"?[z,de,we,De]:[z,De,de,we],y,E);return this.compileAndRun(Ne,[f])},m.prototype.split=function(f,y,E){return Ga(f,y,E)},m.prototype.scatterND=function(f,y,E){var z=Sf(0,f,E),Y=z.sliceRank,Z=z.numUpdates,le=z.sliceSize,de=z.strides,we=z.outputSize,De=[we/le,le],Ne=f.reshape([Z,Y]),Fe=y.reshape([Z,le]);if(we===0)return Ci(Qo([]),E);var Ve=Or(0),Je=new v1(Z,Y,Ne.rank,Fe.rank,de,De);return this.compileAndRun(Je,[Fe,Ne,Ve]).reshape(E)},m.prototype.sparseToDense=function(f,y,E,z){var Y=Sf(0,f,E),Z=Y.sliceRank,le=Y.numUpdates,de=Y.strides,we=Y.outputSize,De=new v1(le,Z,f.rank,y.rank,de,[we,1]);return this.compileAndRun(De,[y,f,z]).reshape(E)},m.prototype.fft=function(f){return this.fftImpl(f,!1)},m.prototype.ifft=function(f){return this.fftImpl(f,!0)},m.prototype.fftImpl=function(f,y){var E=this.texData.get(f.dataId),z=new B0("return real * expR - imag * expI;",f.shape,y),Y=new B0("return real * expI + imag * expR;",f.shape,y),Z=[this.makeComplexComponentTensorInfo(f,E.complexTensors.real),this.makeComplexComponentTensorInfo(f,E.complexTensors.imag)],le=this.compileAndRun(z,Z),de=this.compileAndRun(Y,Z),we=this.complex(le,de).as2D(f.shape[0],f.shape[1]);return le.dispose(),de.dispose(),we},m.prototype.gatherND=function(f,y){var E=y.shape,z=E[E.length-1],Y=Ku(f,y),Z=Y[0],le=Y[1],de=Y[2],we=Y[3],De=y.reshape([le,z]),Ne=f.reshape([f.size/de,de]),Fe=new function(Ve,Je,Xe){this.sliceDim=Ve,this.strides=Je,this.variableNames=["x","indices"],this.outputShape=Xe;var ot=fa(Je.length),xt=fa(Xe.length),kt=this.sliceDim>1?"strides[j]":"strides";this.userCode=` 3525 `+ot+" strides = "+ot+"("+this.strides+`); 3526 void main() { 3527 `+xt+` coords = getOutputCoords(); 3528 int flattenIndex = 0; 3529 for (int j = 0; j < `+this.sliceDim+`; j++) { 3530 int index = round(getIndices(coords[0], j)); 3531 flattenIndex += index * `+kt+`; 3532 } 3533 setOutput(getX(flattenIndex, coords[1])); 3534 } 3535 `}(z,we,[le,de]);return this.compileAndRun(Fe,[Ne,De]).reshape(Z)},m.prototype.fill=function(f,y,E){if((E=E||xe(y))==="string"){var z=Yt(E,Ke(f));return z.fill(y),qe.makeTensor(z,f,E,this)}var Y=new P0(f,y),Z=Y.getCustomSetupFunc(y);return this.compileAndRun(Y,[],E,Z)},m.prototype.onesLike=function(f){if(f.dtype==="string")throw new Error("onesLike is not supported under string dtype");return this.fill(f.shape,1,f.dtype)},m.prototype.zerosLike=function(f){return this.fill(f.shape,f.dtype==="string"?"":0,f.dtype)},m.prototype.linspace=function(f,y,E){return Di(f,y,E)},m.prototype.makeTensorInfo=function(f,y){var E=this.write(null,f,y);return this.texData.get(E).usage=null,{dataId:E,shape:f,dtype:y}},m.prototype.makeOutput=function(f,y){var E=this.makeTensorInfo(f,y).dataId;return qe.makeTensorFromDataId(E,f,y,this)},m.prototype.unpackTensor=function(f){var y=new function(E){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=E;var z=E.length,Y=Za("rc",z),Z=fa(z),le=function(De,Ne){if(De===1)return"rc";for(var Fe="",Ve=0;Ve<De;Ve++)Fe+=Ne[Ve],Ve<De-1&&(Fe+=",");return Fe}(z,Y),de=Y.slice(-2),we=z<=1?"rc":"vec2("+de.join(",")+")";this.userCode=` 3536 void main() { 3537 `+Z+` rc = getOutputCoords(); 3538 vec4 packedInput = getA(`+le+`); 3539 3540 setOutput(getChannel(packedInput, `+we+`)); 3541 } 3542 `}(f.shape);return this.runWebGLProgram(y,[f],f.dtype)},m.prototype.packTensor=function(f){var y=new function(E){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=E;var z=E.length;if(z===0)this.userCode=` 3543 void main() { 3544 setOutput(vec4(getA(), 0., 0., 0.)); 3545 } 3546 `;else{var Y=Za("rc",z),Z=fa(z),le=function(De,Ne,Fe){if(De===1)return"rc > "+Ne[0];for(var Ve="",Je=De-2;Je<De;Je++)Ve+=Fe[Je]+" >= "+Ne[Je],Je<De-1&&(Ve+="||");return Ve}(z,E,Y),de=function(De,Ne,Fe,Ve){if(De===1)return"";var Je=Ve.slice(-2);return` 3547 int r = `+Je[0]+`; 3548 int c = `+Je[1]+`; 3549 int rp1 = r + 1; 3550 int cp1 = c + 1; 3551 3552 bool cEdge = cp1 >= `+Ne+`; 3553 bool rEdge = rp1 >= `+Fe+`; 3554 `}(z,E[E.length-1],E[E.length-2],Y),we=function(De,Ne){var Fe=De.length,Ve=function(Je,Xe){for(var ot=[],xt=0;xt<=1;xt++)for(var kt=0;kt<=1;kt++){for(var At=(xt===0?"r":"rp1")+", "+(kt===0?"c":"cp1"),Lt=2;Lt<Je;Lt++)At=Xe[Xe.length-1-Lt]+","+At;ot.push(At)}return ot}(Fe,Ne);return Fe===1?`getA(rc), 3555 rc + 1 >= `+De[0]+` ? 0. : getA(rc + 1), 3556 0, 0`:"getA("+Ve[0]+`), 3557 cEdge ? 0. : getA(`+Ve[1]+`),
3558 rEdge ? 0. : getA(`+Ve[2]+`), 3559 rEdge || cEdge ? 0. : getA(`+Ve[3]+")"}(E,Y);this.userCode=` 3560 void main() { 3561 `+Z+` rc = getOutputCoords(); 3562 3563 if(`+le+`) { 3564 setOutput(vec4(0)); 3565 } else { 3566 `+de+` 3567 3568 setOutput(vec4(`+we+`)); 3569 } 3570 } 3571 `}}(f.shape);return this.runWebGLProgram(y,[f],f.dtype,null,!0)},m.prototype.packedReshape=function(f,y){var E=[Zs(f.shape)].concat(ls(f.shape)),z={dtype:f.dtype,shape:E,dataId:f.dataId},Y=new function(le,de){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=le;for(var we="",De=0;De<4;De++){var Ne="thisRC = rc;";De%2==1&&(Ne+="thisRC.z += 1;"),De>1&&(Ne+="thisRC.y += 1;"),we+=` 3572 `+Ne+` 3573 `+(De>0?"if(thisRC.y < rows && thisRC.z < cols){":"")+` 3574 int flatIndex = getFlatIndex(thisRC); 3575 3576 ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex); 3577 vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z)); 3578 3579 result[`+De+`] = 3580 getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims); 3581 `+(De>0?"}":"")+` 3582 `}this.userCode=` 3583 3584 ivec3 inputCoordsFromReshapedOutCoords(int index) { 3585 `+ss(["r","c","d"],de)+` 3586 return ivec3(r, c, d); 3587 } 3588 3589 `+jc(le)+` 3590 3591 void main() { 3592 ivec3 rc = getOutputCoords(); 3593 3594 vec4 result = vec4(0.); 3595 3596 ivec3 thisRC; 3597 int rows = `+le[1]+`; 3598 int cols = `+le[2]+`; 3599 3600 `+we+` 3601 3602 setOutput(result); 3603 } 3604 `}([Zs(y)].concat(ls(y)),E),Z=this.runWebGLProgram(Y,[z],f.dtype,null,!0);return{dataId:Z.dataId,shape:y,dtype:Z.dtype}},m.prototype.decode=function(f){var y,E=this.texData.get(f),z=E.isPacked,Y=E.shape,Z=E.dtype,le=xl(Y);return y=z?new function(de){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=sr.DENSE;var we=Ji(de),De=qo();this.outputShape=de,this.userCode=` 3605 ivec3 outCoordsFromFlatIndex(int index) { 3606 `+ss(["r","c","d"],de)+` 3607 return ivec3(r, c, d); 3608 } 3609 3610 void main() { 3611 ivec2 resTexRC = ivec2(resultUV.yx * 3612 vec2(`+we[0]+", "+we[1]+`)); 3613 int index = 4 * (resTexRC.x * `+we[1]+` + resTexRC.y); 3614 3615 vec4 result = vec4(0.); 3616 3617 for (int i=0; i<4; i++) { 3618 int flatIndex = index + i; 3619 ivec3 rc = outCoordsFromFlatIndex(flatIndex); 3620 result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z)); 3621 } 3622 3623 `+De.output+` = result; 3624 } 3625 `}(le):new function(de){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=sr.DENSE;var we=Ji(de),De=qo();this.outputShape=de,this.userCode=` 3626 ivec3 outCoordsFromFlatIndex(int index) { 3627 `+ss(["r","c","d"],de)+` 3628 return ivec3(r, c, d); 3629 } 3630 3631 void main() { 3632 ivec2 resTexRC = ivec2(resultUV.yx * 3633 vec2(`+we[0]+", "+we[1]+`)); 3634 int index = 4 * (resTexRC.x * `+we[1]+` + resTexRC.y); 3635 3636 vec4 result = vec4(0.); 3637 3638 for (int i=0; i<4; i++) { 3639 int flatIndex = index + i; 3640 ivec3 rc = outCoordsFromFlatIndex(flatIndex); 3641 result[i] = getA(rc.x, rc.y, rc.z); 3642 } 3643 3644 `+De.output+` = result; 3645 } 3646 `}(le),{dtype:Z,shape:Y,dataId:this.runWebGLProgram(y,[{shape:le,dtype:Z,dataId:f}],Z,null,!0).dataId}},m.prototype.runWebGLProgram=function(f,y,E,z,Y){var Z=this;Y===void 0&&(Y=!1);var le=this.makeTensorInfo(f.outputShape,E),de=this.texData.get(le.dataId);if(f.packedOutput&&(de.isPacked=!0),f.outPackingScheme===sr.DENSE){var we=Ji(f.outputShape);de.texShape=we.map(function(kt){return 2*kt})}if(f.outTexUsage!=null&&(de.usage=f.outTexUsage),Ke(le.shape)===0)return de.values=yn(le.dtype,0),le;var De=[],Ne=y.map(function(kt){if(kt.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var At=Z.texData.get(kt.dataId);if(At.texture==null){if(!f.packedInputs&&Ke(kt.shape)<=L().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:kt.shape,texData:null,isUniform:!0,uniformValues:At.values};f.packedInputs&&(At.isPacked=!0,At.shape=kt.shape)}else if(!!At.isPacked!=!!f.packedInputs)kt=At.isPacked?Z.unpackTensor(kt):Z.packTensor(kt),De.push(kt),At=Z.texData.get(kt.dataId);else if(At.isPacked&&!vc(At.shape,kt.shape)){var Lt=kt,tn=kt.shape;kt.shape=At.shape,kt=Z.packedReshape(kt,tn),De.push(kt),At=Z.texData.get(kt.dataId),Lt.shape=tn}return Z.uploadToGPU(kt.dataId),{shape:kt.shape,texData:At,isUniform:!1}});this.uploadToGPU(le.dataId);var Fe,Ve={shape:le.shape,texData:de,isUniform:!1},Je=function(kt,At,Lt){var tn="";Ne.concat(Lt).forEach(function(nn){var cn=nn.texData!=null&&nn.texData.slice!=null&&nn.texData.slice.flatOffset>0,Dn=nn.isUniform?"uniform":nn.texData.texShape;tn+=nn.shape+"_"+Dn+"_"+cn});var ln=kt.userCode;return kt.constructor.name+"_"+tn+"_"+ln}(f,0,Ve),Xe=this.getAndSaveBinary(Je,function(){return function(kt,At,Lt,tn){var ln=At.userCode,nn=Lt.map(function(mr,jr){var Pr={logicalShape:mr.shape,texShape:mr.isUniform?null:mr.texData.texShape,isUniform:mr.isUniform,isPacked:!mr.isUniform&&mr.texData.isPacked,flatOffset:null};return mr.texData!=null&&mr.texData.slice!=null&&mr.texData.slice.flatOffset>0&&(Pr.flatOffset=mr.texData.slice.flatOffset),{name:At.variableNames[jr],shapeInfo:Pr}}),cn=nn.map(function(mr){return mr.shapeInfo}),Dn={logicalShape:tn.shape,texShape:tn.texData.texShape,isUniform:!1,isPacked:tn.texData.isPacked,flatOffset:null},Rn=ws(nn,Dn,ln,At.packedInputs),Mn=kt.createProgram(Rn),tr=null,ur=kt.getUniformLocation(Mn,"NAN",!1);L().getNumber("WEBGL_VERSION")===1&&(tr=kt.getUniformLocation(Mn,"INFINITY",!1));for(var vr={},kr=0;kr<At.variableNames.length;
vendor: 156,516 bytes, lines 3646-3728
3646kr++){var yr=At.variableNames[kr];vr[yr]=kt.getUniformLocation(Mn,yr,!1),vr["offset"+yr]=kt.getUniformLocation(Mn,"offset"+yr,!1)}return{program:At,source:Rn,webGLProgram:Mn,uniformLocations:vr,inShapeInfos:cn,outShapeInfo:Dn,infLoc:tr,nanLoc:ur}}(Z.gpgpu,f,Ne,Ve)}),ot=this.activeTimers!=null;if(ot&&(Fe=this.startTimer()),function(kt,At,Lt,tn,ln){V0(At.inShapeInfos,Lt),V0([At.outShapeInfo],[tn]);var nn=tn.texData.texture,cn=tn.texData.texShape;tn.texData.isPacked?kt.setOutputPackedMatrixTexture(nn,cn[0],cn[1]):kt.setOutputMatrixTexture(nn,cn[0],cn[1]),kt.setProgram(At.webGLProgram),L().getNumber("WEBGL_VERSION")===1&&At.infLoc!==null&&kt.gl.uniform1f(At.infLoc,1/0),At.nanLoc!==null&&kt.gl.uniform1f(At.nanLoc,NaN),Lt.forEach(function(Dn,Rn){var Mn=At.program.variableNames[Rn],tr=At.uniformLocations[Mn],ur=At.uniformLocations["offset"+Mn];if(tr!=null)if(Dn.isUniform)if(Ke(Dn.shape)<2)kt.gl.uniform1f(tr,Dn.uniformValues[0]);else{var vr=Dn.uniformValues;vr instanceof Float32Array||(vr=new Float32Array(vr)),kt.gl.uniform1fv(tr,vr)}else Dn.texData.slice!=null&&ur!=null&&kt.gl.uniform1i(ur,Dn.texData.slice.flatOffset),kt.setInputMatrixTexture(Dn.texData.texture,tr,Rn)}),ln!=null&&ln(kt,At.webGLProgram),kt.executeProgram()}(this.gpgpu,Xe,Ne,Ve,z),De.forEach(function(kt){return Z.disposeData(kt.dataId)}),ot&&(Fe=this.endTimer(Fe),this.activeTimers.push({name:f.constructor.name,query:this.getQueryTime(Fe)})),!L().getBool("WEBGL_LAZILY_UNPACK")&&de.isPacked&&Y===!1){var xt=this.unpackTensor(le);return this.disposeData(le.dataId),xt}return le},m.prototype.compileAndRun=function(f,y,E,z,Y){Y===void 0&&(Y=!1),E=E||y[0].dtype;var Z=this.runWebGLProgram(f,y,E,z,Y);return qe.makeTensorFromDataId(Z.dataId,Z.shape,Z.dtype)},m.prototype.getAndSaveBinary=function(f,y){return f in this.binaryCache||(this.binaryCache[f]=y()),this.binaryCache[f]},m.prototype.getTextureManager=function(){return this.textureManager},m.prototype.dispose=function(){var f=this;this.disposed||(L().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(function(y){f.gpgpu.deleteProgram(f.binaryCache[y].webGLProgram),delete f.binaryCache[y]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement<"u"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)},m.prototype.floatPrecision=function(){var f=this;return this.floatPrecisionValue==null&&(this.floatPrecisionValue=eo(function(){if(!L().get("WEBGL_RENDER_FLOAT32_ENABLED")){var y=L().getBool("DEBUG");L().set("DEBUG",!1);var E=f.abs(Or(1e-8)).dataSync()[0];if(L().set("DEBUG",y),E>0)return 32}return 16})),this.floatPrecisionValue},m.prototype.epsilon=function(){return this.floatPrecision()===32?1e-7:1e-4},m.prototype.uploadToGPU=function(f){var y,E=this.texData.get(f),z=E.shape,Y=E.dtype,Z=E.values,le=E.texture,de=E.usage,we=E.isPacked;if(le==null){var De,Ne=this.activeTimers!=null;Ne&&(De=fn());var Fe=E.texShape;if(Fe==null&&(Fe=rd(z,we),E.texShape=Fe),Z!=null){var Ve=xl(z),Je=void 0,Xe=Fe[1],ot=Fe[0],xt=Z instanceof Uint8Array;we?(Xe=(y=ai(Fe[0],Fe[1]))[0],Je=new function(ln,nn,cn){cn===void 0&&(cn=!1),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var Dn=qo(),Rn=nn[0],Mn=nn[1];this.outputShape=ln;var tr="",ur="result";cn&&(ur="floor(result * 255. + 0.5)");for(var vr=0;vr<=1;vr++)for(var kr=0;kr<=1;kr++){var yr=2*vr+kr;tr+=` 3647 localCoords = coords; 3648 if(localCoords[2] + `+kr+" < "+ln[2]+`) { 3649 localCoords[2] += `+kr+`; 3650 if(localCoords[1] + `+vr+" < "+ln[1]+`) { 3651 localCoords[1] += `+vr+`; 3652 3653 flatIndex = getFlatIndex(localCoords); 3654 offset = imod(flatIndex, 4); 3655 3656 flatIndex = idiv(flatIndex, 4, 1.); 3657 3658 r = flatIndex / `+Mn+`; 3659 c = imod(flatIndex, `+Mn+`); 3660 uv = (vec2(c, r) + halfCR) / vec2(`+Mn+".0, "+Rn+`.0); 3661 values = `+Dn.texture2D+`(A, uv); 3662 3663 if(offset == 0) { 3664 result[`+yr+`] = values[0]; 3665 } else if(offset == 1) { 3666 result[`+yr+`] = values[1]; 3667 } else if(offset == 2) { 3668 result[`+yr+`] = values[2]; 3669 } else { 3670 result[`+yr+`] = values[3]; 3671 } 3672 } 3673 } 3674 `}this.userCode=` 3675 `+jc(ln)+` 3676 3677 void main() { 3678 ivec3 coords = getOutputCoords(); 3679 3680 vec4 result = vec4(0.); 3681 int flatIndex, r, c, offset; 3682 ivec3 localCoords; 3683 vec2 uv; 3684 vec4 values; 3685 3686 `+tr+` 3687 3688 `+Dn.output+" = "+ur+`; 3689 } 3690 `}(Ve,[ot=y[1],Xe],xt)):Je=new function(ln,nn,cn){cn===void 0&&(cn=!1),this.variableNames=["A"];var Dn=qo(),Rn=nn[0],Mn=nn[1];this.outputShape=ln;var tr="result";cn&&(tr="floor(result * 255. + 0.5)"),this.userCode=` 3691 `+jc(ln)+` 3692 3693 void main() { 3694 ivec3 coords = getOutputCoords(); 3695 3696 int flatIndex = getFlatIndex(coords); 3697 int offset = imod(flatIndex, 4); 3698 3699 flatIndex = idiv(flatIndex, 4, 1.); 3700 3701 int r = flatIndex / `+Mn+`; 3702 int c = imod(flatIndex, `+Mn+`); 3703 vec2 uv = (vec2(c, r) + halfCR) / vec2(`+Mn+".0, "+Rn+`.0); 3704 vec4 values = `+Dn.texture2D+`(A, uv); 3705 3706 float result; 3707 3708 if(offset == 0) { 3709 result = values[0]; 3710 } else if(offset == 1) { 3711 result = values[1]; 3712 } else if(offset == 2) { 3713 result = values[2]; 3714 } else { 3715 result = values[3]; 3716 } 3717 3718 `+Dn.output+" = vec4("+tr+`, 0., 0., 0.); 3719 } 3720 `}(Ve,[ot,Xe],xt);var kt=this.makeTensorInfo([ot,Xe],Y);this.texData.get(kt.dataId).usage=xt?pr.PIXELS:pr.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(kt.dataId),Xe,ot,Z);var At=this.runWebGLProgram(Je,[kt],Y,null,!0),Lt=this.texData.get(At.dataId);E.texture=Lt.texture,E.texShape=Lt.texShape,E.isPacked=Lt.isPacked,E.usage=Lt.usage,this.disposeData(kt.dataId),this.texData.delete(At.dataId),E.values=null,Ne&&(this.uploadWaitMs+=fn()-De)}else{var tn=this.acquireTexture(Fe,de,Y,we);E.texture=tn}}},m.prototype.convertAndCacheOnCPU=function(f,y){var E=this.texData.get(f),z=E.dtype;return this.releaseGPUData(f),y!=null&&(E.values=function(Y,Z){if(Z==="float32"||Z==="complex64")return Y;if(Z==="int32"||Z==="bool"){for(var le=Z==="int32"?new Int32Array(Y.length):new Uint8Array(Y.length),de=0;de<le.length;++de)le[de]=Math.round(Y[de]);return le}throw new Error("Unknown dtype "+Z)}(y,z)),E.values},m.prototype.acquireTexture=function(f,y,E,z){if(this.numBytesInGPU+=this.computeBytes(f,E),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){var Y=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: "+Y+" MB, most likely due to a memory leak")}return this.textureManager.acquireTexture(f,y,z)},m.prototype.computeBytes=function(f,y){return f[0]*f[1]*It(y)},m}(en);function Uc(_,m){return _(m={exports:{}},m.exports),m.exports}$n()&&qe.registerBackend("webgl",function(){return new $g},2);var ol=Uc(function(_){(function(m,f,y){function E(Y,Z){return Z.c=Y.c,Z.s0=Y.s0,Z.s1=Y.s1,Z.s2=Y.s2,Z}function z(Y,Z){var le=new function(De){var Ne,Fe=this,Ve=(Ne=4022871197,function(Je){Je=Je.toString();for(var Xe=0;Xe<Je.length;Xe++){var ot=.02519603282416938*(Ne+=Je.charCodeAt(Xe));ot-=Ne=ot>>>0,Ne=(ot*=Ne)>>>0,Ne+=4294967296*(ot-=Ne)}return 23283064365386963e-26*(Ne>>>0)});Fe.next=function(){var Je=2091639*Fe.s0+23283064365386963e-26*Fe.c;return Fe.s0=Fe.s1,Fe.s1=Fe.s2,Fe.s2=Je-(Fe.c=0|Je)},Fe.c=1,Fe.s0=Ve(" "),Fe.s1=Ve(" "),Fe.s2=Ve(" "),Fe.s0-=Ve(De),Fe.s0<0&&(Fe.s0+=1),Fe.s1-=Ve(De),Fe.s1<0&&(Fe.s1+=1),Fe.s2-=Ve(De),Fe.s2<0&&(Fe.s2+=1),Ve=null}(Y),de=Z&&Z.state,we=le.next;return we.int32=function(){return 4294967296*le.next()|0},we.double=function(){return we()+11102230246251565e-32*(2097152*we()|0)},we.quick=we,de&&(typeof de=="object"&&E(de,le),we.state=function(){return E(le,{})}),we}f&&f.exports?f.exports=z:this.alea=z})(0,_)}),ry=Uc(function(_){(function(m,f,y){function E(Y,Z){return Z.x=Y.x,Z.y=Y.y,Z.z=Y.z,Z.w=Y.w,Z}function z(Y,Z){var le=new function(De){var Ne=this,Fe="";Ne.x=0,Ne.y=0,Ne.z=0,Ne.w=0,Ne.next=function(){var Je=Ne.x^Ne.x<<11;return Ne.x=Ne.y,Ne.y=Ne.z,Ne.z=Ne.w,Ne.w^=Ne.w>>>19^Je^Je>>>8},De===(0|De)?Ne.x=De:Fe+=De;for(var Ve=0;Ve<Fe.length+64;Ve++)Ne.x^=0|Fe.charCodeAt(Ve),Ne.next()}(Y),de=Z&&Z.state,we=function(){return(le.next()>>>0)/4294967296};return we.double=function(){do var De=((le.next()>>>11)+(le.next()>>>0)/4294967296)/2097152;while(De===0);return De},we.int32=le.next,we.quick=we,de&&(typeof de=="object"&&E(de,le),we.state=function(){return E(le,{})}),we}f&&f.exports?f.exports=z:this.xor128=z})(0,_)}),Zm=Uc(function(_){(function(m,f,y){function E(Y,Z){return Z.x=Y.x,Z.y=Y.y,Z.z=Y.z,Z.w=Y.w,Z.v=Y.v,Z.d=Y.d,Z}function z(Y,Z){var le=new function(De){var Ne=this,Fe="";Ne.next=function(){var Je=Ne.x^Ne.x>>>2;return Ne.x=Ne.y,Ne.y=Ne.z,Ne.z=Ne.w,Ne.w=Ne.v,(Ne.d=Ne.d+362437|0)+(Ne.v=Ne.v^Ne.v<<4^Je^Je<<1)|0},Ne.x=0,Ne.y=0,Ne.z=0,Ne.w=0,Ne.v=0,De===(0|De)?Ne.x=De:Fe+=De;for(var Ve=0;Ve<Fe.length+64;Ve++)Ne.x^=0|Fe.charCodeAt(Ve),Ve==Fe.length&&(Ne.d=Ne.x<<10^Ne.x>>>4),Ne.next()}(Y),de=Z&&Z.state,we=function(){return(le.next()>>>0)/4294967296};return we.double=function(){do var De=((le.next()>>>11)+(le.next()>>>0)/4294967296)/2097152;while(De===0);return De},we.int32=le.next,we.quick=we,de&&(typeof de=="object"&&E(de,le),we.state=function(){return E(le,{})}),we}f&&f.exports?f.exports=z:this.xorwow=z})(0,_)}),q0=Uc(function(_){(function(m,f,y){function E(Y,Z){return Z.x=Y.x.slice(),Z.i=Y.i,Z}function z(Y,Z){Y==null&&(Y=+new Date);var le=new function(De){var Ne=this;Ne.next=function(){var Fe,Ve,Je=Ne.x,Xe=Ne.i;return Fe=Je[Xe],Ve=(Fe^=Fe>>>7)^Fe<<24,Ve^=(Fe=Je[Xe+1&7])^Fe>>>10,Ve^=(Fe=Je[Xe+3&7])^Fe>>>3,Ve^=(Fe=Je[Xe+4&7])^Fe<<7,Fe=Je[Xe+7&7],Ve^=(Fe^=Fe<<13)^Fe<<9,Je[Xe]=Ve,Ne.i=Xe+1&7,Ve},function(Fe,Ve){var Je,Xe=[];if(Ve===(0|Ve))Xe[0]=Ve;else for(Ve=""+Ve,Je=0;Je<Ve.length;++Je)Xe[7&Je]=Xe[7&Je]<<15^Ve.charCodeAt(Je)+Xe[Je+1&7]<<13;for(;Xe.length<8;)Xe.push(0);for(Je=0;Je<8&&Xe[Je]===0;++Je);for(Je==8?Xe[7]=-1:Xe[Je],Fe.x=Xe,Fe.i=0,Je=256;Je>0;--Je)Fe.next()}(Ne,De)}(Y),de=Z&&Z.state,we=function(){return(le.next()>>>0)/4294967296};return we.double=function(){do var De=((le.next()>>>11)+(le.next()>>>0)/4294967296)/2097152;while(De===0);return De},we.int32=le.next,we.quick=we,de&&(de.x&&E(de,le),we.state=function(){return E(le,{})}),we}f&&f.exports?f.exports=z:this.xorshift7=z})(0,_)}),Ib=Uc(function(_){(function(m,f,y){function E(Y,Z){return Z.i=Y.i,Z.w=Y.w,Z.X=Y.X.slice(),Z}function z(Y,Z){Y==null&&(Y=+new Date);var le=new function(De){var Ne=this;Ne.next=function(){var Fe,Ve,Je=Ne.w,Xe=Ne.X,ot=Ne.i;return Ne.w=Je=Je+1640531527|0,Ve=Xe[ot+34&127],Fe=Xe[ot=ot+1&127],Ve^=Ve<<13,Fe^=Fe<<17,Ve^=Ve>>>15,Fe^=Fe>>>12,Ve=Xe[ot]=Ve^Fe,Ne.i=ot,Ve+(Je^Je>>>16)|0},function(Fe,Ve){var Je,Xe,ot,xt,kt,At=[],Lt=128;for(Ve===(0|Ve)?(Xe=Ve,Ve=null):(Ve+="\0",Xe=0,Lt=Math.max(Lt,Ve.length)),ot=0,xt=-32;xt<Lt;++xt)Ve&&(Xe^=Ve.charCodeAt((xt+32)%Ve.length)),xt===0&&(kt=Xe),Xe^=Xe<<10,Xe^=Xe>>>15,Xe^=Xe<<4,Xe^=Xe>>>13,xt>=0&&(kt=kt+1640531527|0,ot=(Je=At[127&xt]^=Xe+kt)==0?ot+1:0);for(ot>=128&&(At[127&(Ve&&Ve.length||0)]=-1),ot=127,xt=512;xt>0;--xt)Xe=At[ot+34&127],Je=At[ot=ot+1&127],Xe^=Xe<<13,Je^=Je<<17,Xe^=Xe>>>15,Je^=Je>>>12,At[ot]=Xe^Je;Fe.w=kt,Fe.X=At,Fe.i=ot}(Ne,De)}(Y),de=Z&&Z.state,we=function(){return(le.next()>>>0)/4294967296};return we.double=function(){do var De=((le.next()>>>11)+(le.next()>>>0)/4294967296)/2097152;while(De===0);return De},we.int32=le.next,we.quick=we,de&&(de.X&&E(de,le),we.state=function(){return E(le,{})}),we}f&&f.exports?f.exports=z:this.xor4096=z})(0,_)}),y1=Uc(function(_){(function(m,f,y){function E(Y,Z){return Z.a=Y.a,Z.b=Y.b,Z.c=Y.c,Z.d=Y.d,Z}function z(Y,Z){var le=new function(De){var Ne=this,Fe="";Ne.next=function(){var Je=Ne.b,Xe=Ne.c,ot=Ne.d,xt=Ne.a;return Je=Je<<25^Je>>>7^Xe,Xe=Xe-ot|0,ot=ot<<24^ot>>>8^xt,xt=xt-Je|0,Ne.b=Je=Je<<20^Je>>>12^Xe,Ne.c=Xe=Xe-ot|0,Ne.d=ot<<16^Xe>>>16^xt,Ne.a=xt-Je|0},Ne.a=0,Ne.b=0,Ne.c=-1640531527,Ne.d=1367130551,De===Math.floor(De)?(Ne.a=De/4294967296|0,Ne.b=0|De):Fe+=De;for(var Ve=0;Ve<Fe.length+20;Ve++)Ne.b^=0|Fe.charCodeAt(Ve),Ne.next()}(Y),de=Z&&Z.state,we=function(){return(le.next()>>>0)/4294967296};return we.double=function(){do var De=((le.next()>>>11)+(le.next()>>>0)/4294967296)/2097152;while(De===0);return De},we.int32=le.next,we.quick=we,de&&(typeof de=="object"&&E(de,le),we.state=function(){return E(le,{})}),we}f&&f.exports?f.exports=z:this.tychei=z})(0,_)}),_d=Uc(function(_){(function(m,f){var y,E=this,z=256,Y=6,Z="random",le=f.pow(z,Y),de=f.pow(2,52),we=2*de,De=z-1;function Ne(ot,xt,kt){var At=[],Lt=Je(function nn(cn,Dn){var Rn,Mn=[],tr=typeof cn;if(Dn&&tr=="object")for(Rn in cn)try{Mn.push(nn(cn[Rn],Dn-1))}catch{}return Mn.length?Mn:tr=="string"?cn:cn+"\0"}((xt=xt==1?{entropy:!0}:xt||{}).entropy?[ot,Xe(m)]:ot??function(){try{var nn;return y&&(nn=y.randomBytes)?nn=nn(z):(nn=new Uint8Array(z),(E.crypto||E.msCrypto).getRandomValues(nn)),Xe(nn)}catch{var cn=E.navigator,Dn=cn&&cn.plugins;return[+new Date,E,Dn,E.screen,Xe(m)]}}(),3),At),tn=new Fe(At),ln=function(){for(var nn=tn.g(Y),cn=le,Dn=0;nn<de;)nn=(nn+Dn)*z,cn*=z,Dn=tn.g(1);for(;nn>=we;)nn/=2,cn/=2,Dn>>>=1;return(nn+Dn)/cn};return ln.int32=function(){return 0|tn.g(4)},ln.quick=function(){return tn.g(4)/4294967296},ln.double=ln,Je(Xe(tn.S),m),(xt.pass||kt||function(nn,cn,Dn,Rn){return Rn&&(Rn.S&&Ve(Rn,tn),nn.state=function(){return Ve(tn,{})}),Dn?(f[Z]=nn,cn):nn})(ln,Lt,"global"in xt?xt.global:this==f,xt.state)}function Fe(ot){var xt,kt=ot.length,At=this,Lt=0,tn=At.i=At.j=0,ln=At.S=[];for(kt||(ot=[kt++]);Lt<z;)ln[Lt]=Lt++;for(Lt=0;Lt<z;Lt++)ln[Lt]=ln[tn=De&tn+ot[Lt%kt]+(xt=ln[Lt])],ln[tn]=xt;(At.g=function(nn){for(var cn,Dn=0,Rn=At.i,Mn=At.j,tr=At.S;nn--;)cn=tr[Rn=De&Rn+1],Dn=Dn*z+tr[De&(tr[Rn]=tr[Mn=De&Mn+cn])+(tr[Mn]=cn)];return At.i=Rn,At.j=Mn,Dn})(z)}function Ve(ot,xt){return xt.i=ot.i,xt.j=ot.j,xt.S=ot.S.slice(),xt}function Je(ot,xt){for(var kt,At=ot+"",Lt=0;Lt<At.length;)xt[De&Lt]=De&(kt^=19*xt[De&Lt])+At.charCodeAt(Lt++);return Xe(xt)}function Xe(ot){return String.fromCharCode.apply(0,ot)}if(f["seed"+Z]=Ne,Je(f.random(),m),_.exports){_.exports=Ne;try{y=n(390)}catch{}}})([],Math)});_d.alea=ol,_d.xor128=ry,_d.xorwow=Zm,_d.xorshift7=q0,_d.xor4096=Ib,_d.tychei=y1;var Lp=_d.alea,Eh=Bt({addN_:function(_){Ee(Array.isArray(_),function(){return"The argument passed to tf.addN() must be a list of tensors"}),Ee(_.length>=1,function(){return"Must pass at least one tensor to tf.addN(), but got "+_.length});var m=_.map(function(E,z){return et(E,"tensors"+z,"addN")}),f=m[0];m.forEach(function(E){if(E.dtype!==f.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),m.forEach(function(E){if(!Tt(E.shape,f.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var y=m;return qe.runKernelFunc(function(E,z){return E.addN(m)},y,null,"AddN")}});function Ch(){ah("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")}function iy(_){return _.rank===0||_.rank===1?_.as4D(1,1,1,_.size):_.rank===2?_.as4D(1,1,_.shape[0],_.shape[1]):_.rank===3?_.as4D(1,_.shape[0],_.shape[1],_.shape[2]):_}function G0(_,m,f,y,E,z){z==null&&(z=.001);var Y,Z,le=et(_,"x","batchNorm"),de=et(m,"mean","batchNorm"),we=et(f,"variance","batchNorm");E!=null&&(Y=et(E,"scale","batchNorm")),y!=null&&(Z=et(y,"offset","batchNorm")),Ee(de.rank===we.rank,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),Ee(Z==null||de.rank===Z.rank,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),Ee(Y==null||de.rank===Y.rank,function(){return"Batch normalization gradient requires mean and scale to have equal ranks."});var De={x:le,scale:Y,offset:Z,mean:de,variance:we},Ne={varianceEpsilon:z};return qe.runKernelFunc(function(Fe,Ve){var Je=iy(le),Xe=Fe.batchNormalization(Je,Sh(de),Sh(we),z,Sh(Y),Sh(Z));return Ve([le,de,we,Y]),Xe},De,null,"FusedBatchNorm",Ne).reshape(le.shape)}function Sh(_){return _==null?null:_.rank===0?_.as1D():_.rank===1?_:_.rank===2?_.as4D(1,1,_.shape[0],_.shape[1]):_.rank===3?_.as4D(1,_.shape[0],_.shape[1],_.shape[2]):_}var Ao=Bt({batchNormalization_:function(_,m,f,y,E,z){return y===void 0&&(y=.001),Ch(),G0(_,m,f,z,E,y)}}),kd=Bt({batchNorm_:G0});function zp(_,m,f,y,E,z){var Y,Z,le=et(_,"x","batchNorm"),de=et(m,"mean","batchNorm"),we=et(f,"variance","batchNorm");return E!=null&&(Y=et(E,"scale","batchNorm")),y!=null&&(Z=et(y,"offset","batchNorm")),Ee(le.rank===2,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+le.rank+"."}),Ee(de.rank===2||de.rank===1,function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+de.rank+"."}),Ee(we.rank===2||we.rank===1,function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+we.rank+"."}),Y!=null&&Ee(Y.rank===2||Y.rank===1,function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank "+Y.rank+"."}),Z!=null&&Ee(Z.rank===2||Z.rank===1,function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank "+Z.rank+"."}),kd(le,de,we,Z,Y,z)}var b1=Bt({batchNormalization2d_:function(_,m,f,y,E,z){return y===void 0&&(y=.001),Ch(),zp(_,m,f,z,E,y)}}),x1=Bt({batchNorm2d_:zp});function Hg(_,m,f,y,E,z){var Y,Z,le=et(_,"x","batchNorm"),de=et(m,"mean","batchNorm"),we=et(f,"variance","batchNorm");return E!=null&&(Y=et(E,"scale","batchNorm")),y!=null&&(Z=et(y,"offset","batchNorm")),Ee(le.rank===3,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+le.rank+"."}),Ee(de.rank===3||de.rank===1,function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+de.rank+"."}),Ee(we.rank===3||we.rank===1,function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+we.rank+"."}),Y!=null&&Ee(Y.rank===3||Y.rank===1,function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank "+Y.rank+"."}),Z!=null&&Ee(Z.rank===3||Z.rank===1,function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank "+Z.rank+"."}),kd(le,de,we,Z,Y,z)}var Ed=Bt({batchNormalization3d_:function(_,m,f,y,E,z){return y===void 0&&(y=.001),Ch(),Hg(_,m,f,z,E,y)}}),Mf=Bt({batchNorm3d_:Hg});function eg(_,m,f,y,E,z){var Y,Z,le=et(_,"x","batchNorm"),de=et(m,"mean","batchNorm"),we=et(f,"variance","batchNorm");return E!=null&&(Y=et(E,"scale","batchNorm")),y!=null&&(Z=et(y,"offset","batchNorm")),Ee(le.rank===4,function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+le.rank+"."}),Ee(de.rank===4||de.rank===1,function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+de.rank+"."}),Ee(we.rank===4||we.rank===1,function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+we.rank+"."}),Y!=null&&Ee(Y.rank===4||Y.rank===1,function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank "+Y.rank+"."}),Z!=null&&Ee(Z.rank===4||Z.rank===1,function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank "+Z.rank+"."}),kd(le,de,we,Z,Y,z)}var Up=Bt({batchNormalization4d_:function(_,m,f,y,E,z){return y===void 0&&(y=.001),Ch(),eg(_,m,f,z,E,y)}}),Ah=Bt({batchNorm4d_:eg}),Cd=Bt({broadcastTo_:function(_,m){var f=et(_,"broadcastTo","x"),y=f.shape;if(m.some(function(De){return!(De>0)||De%1!=0}))throw new Error("broadcastTo(): Invalid broadcast shape ["+m+"].");if(m.length<f.rank)throw new Error("broadcastTo(): shape.length="+m.length+" < input.rank="+f.rank+".");if(m.length>f.rank){for(var E=f.shape.slice();E.length<m.length;)E.unshift(1);f=f.reshape(E)}for(var z=f.shape,Y=Array.from(m),Z=m.length-1;Z>=0;Z--)if(z[Z]===m[Z])Y[Z]=1;else if(f.shape[Z]!==1)throw new Error("broadcastTo(): ["+y+"] cannot be broadcast to ["+m+"].");var le=Y.map(function(De,Ne){return De>1?Ne:-1}).filter(function(De){return De>=0});if(le.length===0)return f.clone();var de={x:f},we={shape:m,inputShape:z};return qe.runKernelFunc(function(De){return De.tile(f,Y)},de,function(De){return{x:function(){return De.sum(le,!0)}}},ql,we)}}),Sd=Bt({clone_:function(_){var m=et(_,"x","clone",null);return qe.runKernelFunc(function(){return qe.makeTensorFromDataId(m.dataId,m.shape,m.dtype)},{x:m},null,lh)}}),Wc=Bt({logicalAnd_:function(_,m){var f=et(_,"a","logicalAnd","bool"),y=et(m,"b","logicalAnd","bool");return no(f.shape,y.shape),qe.runKernelFunc(function(E){return E.logicalAnd(f,y)},{a:f,b:y},null,"LogicalAnd")}}),Wp=Bt({logicalNot_:function(_){var m=et(_,"x","logicalNot","bool");return qe.runKernelFunc(function(f){return f.logicalNot(m)},{$x:m})}}),Oh=Bt({logicalOr_:function(_,m){var f=et(_,"a","logicalOr","bool"),y=et(m,"b","logicalOr","bool");return no(f.shape,y.shape),qe.runKernelFunc(function(E){return E.logicalOr(f,y)},{$a:f,$b:y})}}),Ff=Bt({logicalXor_:function(_,m){var f=et(_,"a","logicalXor","bool"),y=et(m,"b","logicalXor","bool");return no(f.shape,y.shape),Oh(_,m).logicalAnd(Wc(_,m).logicalNot())}}),ef=Bt({where_:function(_,m,f){var y=et(m,"a","where"),E=et(f,"b","where"),z=et(_,"condition","where","bool");return Ot(y.shape,E.shape,"Error in where: "),z.rank===1?Ee(z.shape[0]===y.shape[0],function(){return"The first dimension of `a` must match the size of `condition`."}):Ot(z.shape,E.shape,"Error in where: "),qe.runKernelFunc(function(Y,Z){var le=Y.select(z,y,E);return Z([z]),le},{$condition:z,$a:y,$b:E},function(Y,Z){var le=Z[0];return{$condition:function(){return Ei(le).toFloat()},$a:function(){return Y.mul(le.cast(Y.dtype))},$b:function(){return Y.mul(le.logicalNot().cast(Y.dtype))}}})}}),Dh=function(_){return S(this,void 0,void 0,function(){var m,f,y;return M(this,function(E){switch(E.label){case 0:return[4,(m=et(_,"condition","whereAsync","bool")).data()];case 1:return f=E.sent(),y=Na(m.shape,f),_!==m&&m.dispose(),[2,y]}})})},qg=Bt({divNoNan_:function(_,m){var f,y=et(_,"a","div"),E=et(m,"b","div");y=(f=Bn(y,E))[0],E=f[1];var z=Da(y,E),Y=Ei(z),Z=E.equal(Y);return ef(Z,Y,z)}}),Th=Bt({tile_:function(_,m){var f=et(_,"x","tile",null);Ee(f.rank===m.length,function(){return"Error in transpose: rank of input "+f.rank+" must match length of reps "+m+"."});var y=[f],E={x:f},z={reps:m};return qe.runKernelFunc(function(Y,Z){var le=Y.tile(f,m);return Z([f]),le},E,null,ld,z,y)}}),tf=Bt({eye_:function(_,m,f,y){y===void 0&&(y="float32"),m==null&&(m=_);for(var E=Li([_,m],y),z=_<=m?_:m,Y=0;Y<z;++Y)E.set(1,Y,Y);var Z=E.toTensor().as2D(_,m);if(f==null)return Z;if(f.length===1)return Th(el(Z,0),[f[0],1,1]);if(f.length===2)return Th(el(el(Z,0),0),[f[0],f[1],1,1]);if(f.length===3)return Th(el(el(el(Z,0),0),0),[f[0],f[1],f[2],1,1]);throw new Error("eye() currently supports only 1D and 2D batchShapes, but received "+f.length+"D.")}}),Gs=Bt({multinomial_:function(_,m,f,y){y===void 0&&(y=!1);var E=et(_,"logits","multinomial"),z=E.size,Y=E.rank;if(z<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+z+".");if(Y>2)throw new Error("Rank of probabilities must be 1 or 2, but is "+Y);f=f||Math.random();var Z=Y===1?E.as2D(1,-1):E,le=qe.runKernelFunc(function(de){return de.multinomial(Z,y,m,f)},{logits2D:Z});return Y===1?le.as1D():le}}),Dl=Bt({oneHot_:function(_,m,f,y){if(f===void 0&&(f=1),y===void 0&&(y=0),m<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+m);var E=et(_,"indices","oneHot","int32"),z=E.shape.concat([m]),Y={indices:E=E.flatten()},Z={depth:m,onValue:f,offValue:y};return qe.runKernelFunc(function(le,de){return de([E]),le.oneHot(E,m,f,y)},Y,null,Tp,Z).reshape(z)}}),Vc=Bt({pad_:function(_,m,f){f===void 0&&(f=0);var y=et(_,"x","pad");if(y.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var E={paddings:m,constantValue:f},z={x:y};return qe.runKernelFunc(function(Y,Z){return Z([y]),Y.pad(y,m,f)},z,null,Gl,E)}}),bc=Bt({pad1d_:function(_,m,f){return f===void 0&&(f=0),Ee(m.length===2,function(){return"Invalid number of paddings. Must be length of 2."}),Vc(_,[m],f)}}),Vp=Bt({pad2d_:function(_,m,f){return f===void 0&&(f=0),Ee(m.length===2&&m[0].length===2&&m[1].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Vc(_,m,f)}}),Gg=Bt({pad3d_:function(_,m,f){return f===void 0&&(f=0),Ee(m.length===3&&m[0].length===2&&m[1].length===2&&m[2].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Vc(_,m,f)}}),K0=Bt({pad4d_:function(_,m,f){return f===void 0&&(f=0),Ee(m.length===4&&m[0].length===2&&m[1].length===2&&m[2].length===2&&m[3].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Vc(_,m,f)}}),Y0=Bt({rand_:function(_,m,f){var y=Ke(_),E=null;if(f==null||f==="float32")E=new Float32Array(y);else if(f==="int32")E=new Int32Array(y);else{if(f!=="bool")throw new Error("Unknown data type "+f);E=new Uint8Array(y)}for(var z=0;z<y;z++)E[z]=m();return qe.makeTensor(E,_,f)}}),tg=.001,da=.1;function ng(){return qe.backend.floatPrecision()===32?tg:da}function Tl(_,m,f){var y=!0;if((dt(_)||dt(m))&&(y=!1),dt(_)&&dt(m)&&(y=!0),y){var E=_.constructor.name,z=m.constructor.name;if(E!==z)throw new Error("Arrays are of different type. Actual: "+E+". Expected: "+z)}if(Array.isArray(_)&&Array.isArray(m)){var Y=As(_),Z=As(m);if(!Tt(Y,Z))throw new Error("Arrays have different shapes. Actual: ["+Y+"]. Expected: ["+Z+"]")}var le=dt(_)?_:Mt(_),de=dt(m)?m:Mt(m);if(le.length!==de.length)throw new Error("Arrays have different lengths actual: "+le.length+" vs expected: "+de.length+`. 3721Actual: `+le+`. 3722Expected: `+de+".");for(var we=0;we<de.length;++we){var De=le[we],Ne=de[we];if(!f(De,Ne))throw new Error("Arrays differ: actual["+we+"] = "+De+", expected["+we+"] = "+Ne+`. 3723Actual: `+le+`. 3724Expected: `+de+".")}}function Nh(_,m,f){return!isFinite(_)&&!isFinite(m)||!(isNaN(_)||isNaN(m)||Math.abs(_-m)>f)}var Ih=Object.freeze({TEST_EPSILON_FLOAT16:da,expectArraysClose:function(_,m,f){return f==null&&(f=ng()),Tl(_,m,function(y,E){return Nh(y,E,f)})},testEpsilon:ng,expectPromiseToFail:function(_,m){_().then(function(){return m.fail()},function(){return m()})},expectArraysEqual:function(_,m){var f=typeof m=="string"||typeof m=="number"||typeof m=="boolean"?[m]:m;return on(_)||on(_[0])||on(m)||on(m[0])?Tl(_,f,function(y,E){return y==E}):Tl(_,m,function(y,E){return Nh(y,E,0)})},expectNumbersClose:function(_,m,f){if(f==null&&(f=ng()),!Nh(_,m,f))throw new Error("Numbers differ: actual === "+_+", expected === "+m)},expectValuesInRange:function(_,m,f){for(var y=0;y<_.length;y++)if(_[y]<m||_[y]>f)throw new Error("Value out of range:"+_[y]+" low: "+m+", high: "+f)},expectArrayBuffersEqual:function(_,m){expect(new Float32Array(_)).toEqual(new Float32Array(m))}}),rg=function(){function _(m,f,y,E,z){this.mean=m,this.stdDev=f,this.dtype=y,this.nextVal=NaN,this.truncated=E,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var Y=z||Math.random();this.random=Lp(Y.toString())}return _.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var m=this.nextVal;return this.nextVal=NaN,m}for(var f,y,E=!1;!E;){var z=void 0,Y=void 0,Z=void 0;do Z=(z=2*this.random()-1)*z+(Y=2*this.random()-1)*Y;while(Z>=1||Z===0);var le=Math.sqrt(-2*Math.log(Z)/Z);f=this.mean+this.stdDev*z*le,y=this.mean+this.stdDev*Y*le,this.truncated&&!this.isValidTruncated(f)||(E=!0)}return this.truncated&&!this.isValidTruncated(y)||(this.nextVal=this.convertValue(y)),this.convertValue(f)},_.prototype.convertValue=function(m){return this.dtype==null||this.dtype==="float32"?m:Math.round(m)},_.prototype.isValidTruncated=function(m){return m<=this.upper&&m>=this.lower},_}(),Kg=function(){function _(m,f,y,E){this.alpha=m,this.beta=1/f,this.dtype=y;var z=E||Math.random();this.randu=Lp(z.toString()),this.randn=new rg(0,1,y,!1,this.randu()),this.d=m<1?m+2/3:m-1/3,this.c=1/Math.sqrt(9*this.d)}return _.prototype.nextValue=function(){for(var m,f,y,E,z,Y;;){do E=this.randn.nextValue(),Y=1+this.c*E;while(Y<=0);if(Y*=Y*Y,f=1-.331*(m=E*E)*m,y=.5*m+this.d*(1-Y+Math.log(Y)),(z=this.randu())<f||Math.log(z)<y)break}return Y=1/this.beta*this.d*Y,this.alpha<1&&(Y*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(Y)},_.prototype.convertValue=function(m){return this.dtype==="float32"?m:Math.round(m)},_}(),Yg=function(){function _(m,f,y,E){var z=this;if(m===void 0&&(m=0),f===void 0&&(f=1),this.canReturnFloat=function(){return z.dtype==null||z.dtype==="float32"},this.min=m,this.range=f-m,this.dtype=y,E==null&&(E=Math.random()),typeof E=="number"&&(E=E.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error("The difference between "+m+" - "+f+" <= 1 and dtype is not float");this.random=Lp(E)}return _.prototype.convertValue=function(m){return this.canReturnFloat()?m:Math.round(m)},_.prototype.nextValue=function(){return this.convertValue(this.min+this.range*this.random())},_}(),Xg=Bt({randomGamma_:function(_,m,f,y,E){if(f===void 0&&(f=1),y===void 0&&(y="float32"),f==null&&(f=1),y==null&&(y="float32"),y!=="float32"&&y!=="int32")throw new Error("Unsupported data type "+y);for(var z=new Kg(m,f,y,E),Y=Li(_,y),Z=0;Z<Y.values.length;Z++)Y.values[Z]=z.nextValue();return Y.toTensor()}}),oy=Bt({randomNormal_:function(_,m,f,y,E){if(m===void 0&&(m=0),f===void 0&&(f=1),y!=null&&y==="bool")throw new Error("Unsupported data type "+y);for(var z=new rg(m,f,y,!1,E),Y=Li(_,y),Z=0;Z<Y.values.length;Z++)Y.values[Z]=z.nextValue();return Y.toTensor()}}),Jg=Bt({randomUniform_:function(_,m,f,y,E){m===void 0&&(m=0),f===void 0&&(f=1),y===void 0&&(y="float32");for(var z=Li(_,y),Y=new Yg(m,f,null,E),Z=0;Z<z.values.length;Z++)z.values[Z]=Y.nextValue();return z.toTensor()}}),Ad=Bt({square_:function(_){var m=et(_,"x","square"),f=[m];return qe.runKernelFunc(function(y,E){return E([m]),y.square(m)},{x:m},null,"Square",{},f,[])}}),Qg=Bt({squaredDifference_:function(_,m){var f,y=et(_,"a","squaredDifference"),E=et(m,"b","squaredDifference");f=Bn(y,E),y=f[0],E=f[1],no(y.shape,E.shape);var z={a:y,b:E},Y=[y,E];return qe.runKernelFunc(function(Z,le){var de=Z.squaredDifference(y,E);return le([y,E]),de},z,function(Z,le){var de=le[0],we=le[1],De=Or(2);return{a:function(){return Z.mul(de.sub(we).mul(De))},b:function(){return Z.mul(we.sub(de).mul(De))}}},ud,{},Y,[])}}),$p=Bt({truncatedNormal_:function(_,m,f,y,E){if(m===void 0&&(m=0),f===void 0&&(f=1),y!=null&&y==="bool")throw new Error("Unsupported data type $ { dtype }");for(var z=new rg(m,f,y,!0,E),Y=Li(_,y),Z=0;Z<Y.values.length;Z++)Y.values[Z]=z.nextValue();return Y.toTensor()}}),Zg=Bt({equal_:function(_,m){var f,y=et(_,"a","equal"),E=et(m,"b","equal");return f=Bn(y,E),y=f[0],E=f[1],no(y.shape,E.shape),qe.runKernelFunc(function(z){return z.equal(y,E)},{$a:y,$b:E})}}),X0=Bt({equalStrict_:function(_,m){var f=et(_,"a","equalStrict"),y=et(m,"b","equalStrict");return Ot(f.shape,y.shape,"Error in equalStrict: "),f.equal(y)}}),J0=Bt({greater_:function(_,m){var f,y=et(_,"a","greater"),E=et(m,"b","greater");return f=Bn(y,E),y=f[0],E=f[1],no(y.shape,E.shape),qe.runKernelFunc(function(z){return z.greater(y,E)},{a:y,b:E},null,"Greater")}}),ig=Bt({greaterEqual_:function(_,m){var f,y=et(_,"a","greaterEqual"),E=et(m,"b","greaterEqual");return f=Bn(y,E),y=f[0],E=f[1],no(y.shape,E.shape),qe.runKernelFunc(function(z,Y){var Z=z.greaterEqual(y,E);return Y([y,E]),Z},{a:y,b:E},function(z,Y){var Z=Y[0],le=Y[1];return{a:function(){return Ei(Z)},b:function(){return Ei(le)}}},"GreaterEqual")}}),Q0=Bt({greaterEqualStrict_:function(_,m){var f=et(_,"a","greaterEqualStrict"),y=et(m,"b","greaterEqualStrict");return Ot(f.shape,y.shape,"Error in greaterEqualStrict: "),f.greaterEqual(y)}}),e0=Bt({greaterStrict_:function(_,m){var f=et(_,"a","greaterStrict"),y=et(m,"b","greaterStrict");return Ot(f.shape,y.shape,"Error in greaterStrict: "),f.greater(y)}}),ay=Bt({less_:function(_,m){var f,y=et(_,"a","less"),E=et(m,"b","less");return f=Bn(y,E),y=f[0],E=f[1],no(y.shape,E.shape),qe.runKernelFunc(function(z){return z.less(y,E)},{a:y,b:E},null,"Less")}}),Rf=Bt({lessEqual_:function(_,m){var f,y=et(_,"a","lessEqual"),E=et(m,"b","lessEqual");return f=Bn(y,E),y=f[0],E=f[1],no(y.shape,E.shape),qe.runKernelFunc(function(z,Y){var Z=z.lessEqual(y,E);return Y([y,E]),Z},{a:y,b:E},null,"LessEqual")}}),w1=Bt({lessEqualStrict_:function(_,m){var f=et(_,"a","lessEqualStrict"),y=et(m,"b","lessEqualStrict");return Ot(f.shape,y.shape,"Error in lessEqualStrict: "),f.lessEqual(y)}}),sy=Bt({lessStrict_:function(_,m){var f=et(_,"a","lessStrict"),y=et(m,"b","lessStrict");return Ot(f.shape,y.shape,"Error in lessStrict: "),f.less(y)}}),og=Bt({notEqual_:function(_,m){var f,y=et(_,"a","notEqual"),E=et(m,"b","notEqual");return f=Bn(y,E),y=f[0],E=f[1],no(y.shape,E.shape),qe.runKernelFunc(function(z){return z.notEqual(y,E)},{a:y,b:E},null,"NotEqual")}}),uy=Bt({notEqualStrict_:function(_,m){var f=et(_,"a","notEqualStrict"),y=et(m,"b","notEqualStrict");return Ot(f.shape,y.shape,"Error in notEqualStrict: "),f.notEqual(y)}});function Od(_,m){for(var f=[],y=_;y<m;++y)f.push(y);return f}function cy(_){for(var m=[],f=0;f<_.length;++f)for(var y=0;y<_[f].length;++y)m.push(_[f][y]);return m}var ag=Bt({gather_:function(_,m,f){f===void 0&&(f=0);var y=et(_,"x","gather"),E=et(m,"indices","gather","int32");f=Vt(f,y.shape)[0];var z=function(Y,Z,le){for(var de=Y.shape[le],we=[],De=1,Ne=1,Fe=0;Fe<le;Fe++)we.push(Y.shape[Fe]),De*=Y.shape[Fe];for(Fe=0;Fe<Z.rank;Fe++)we.push(Z.shape[Fe]);for(Fe=le+1;Fe<Y.rank;Fe++)we.push(Y.shape[Fe]),Ne*=Y.shape[Fe];return{batchSize:De,sliceSize:Ne,dimSize:de,outputShape:we}}(y,E,f);return qe.runKernelFunc(function(Y,Z){var le=Y.gather(y,E.flatten(),f);return Z([E]),le},{x:y,indices:E},function(Y,Z){var le=Z[0];return{x:function(){var de=y.shape,we=le.size,De=de.slice(0,f),Ne=De.length,Fe=de.slice(f,de.length).slice(1),Ve=Fe.length,Je=Od(0,Ne),Xe=Od(Ne+1,Ne+1+Ve),ot=cy([De,[we],Fe]),xt=Y.reshape(ot),kt=le.reshape([we]),At=cy([[Ne],Je,Xe]),Lt=xt.transpose(At),tn=t0(Lt,kt,y.shape[f]),ln=Ic(At);return tn.transpose(ln)},indices:function(){return le}}},"Gather",{axis:f}).reshape(z.outputShape)}}),t0=Bt({unsortedSegmentSum_:function(_,m,f){var y=et(_,"x","unsortedSegmentSum"),E=et(m,"segmentIds","unsortedSegmentSum","int32");return Ee(vt(f),function(){return"numSegments must be of dtype int"}),qe.runKernelFunc(function(z,Y){var Z=z.unsortedSegmentSum(y,E,f);return Y([E]),Z},{$x:y},function(z,Y){var Z=Y[0];return{$x:function(){return function(le,de){for(var we=as(de,Ei(de)),De=ag(le,we),Ne=ig(de,Or(0,"int32")),Fe=De.rank-Ne.rank,Ve=0;Ve<Fe;++Ve)Ne=el(Ne,Ve+1);Ne=Wc(Ne,yc(De.shape,"bool"));var Je=Ei(De);return ef(Ne,De,Je)}(z,Z)}}})}}),ly=function(_,m,f){return S(this,void 0,void 0,function(){var y,E,z,Y,Z,le,de,we,De,Ne,Fe,Ve,Je;return M(this,function(Xe){switch(Xe.label){case 0:for(y=et(_,"tensor","boolMask"),E=et(m,"mask","boolMask","bool"),z=f??0,Y=E.rank,Z=y.shape,Ee(Y>0,function(){return"mask cannot be scalar"}),Ot(Z.slice(z,z+Y),E.shape,"mask's shape must match the first K dimensions of tensor's shape,"),le=1,de=z;de<z+Y;de++)le*=Z[de];return we=Z.slice(0,z).concat([le],Z.slice(z+Y)),De=y.reshape(we),Ne=E.reshape([-1]),[4,Dh(Ne)];case 1:return Fe=Xe.sent(),Ve=Fe.squeeze([1]),Je=ag(De,Ve,z),_!==y&&y.dispose(),m!==E&&E.dispose(),Ve.dispose(),De.dispose(),Ne.dispose(),Fe.dispose(),[2,Je]}})})};function fy(_,m,f,y,E,z,Y){z===void 0&&(z="NHWC"),Ee(_.length===m.rank,function(){return"Length of inShape ("+_.length+") and rank of dy ("+m.rank+") must match"});var Z=_,le=m,de=!1;m.rank===3&&(de=!0,le=m.as4D(1,m.shape[0],m.shape[1],m.shape[2]),Z=[1,_[0],_[1],_[2]]),Ee(Z.length===4,function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+Z.length+"."}),Ee(le.rank===4,function(){return"Error in conv2dDerInput: dy must be rank 4, but got rank "+le.rank}),Ee(f.rank===4,function(){return"Error in conv2dDerInput: filter must be rank 4, but got rank "+f.rank});var we=z==="NHWC"?Z[3]:Z[1],De=z==="NHWC"?le.shape[3]:le.shape[1];Ee(we===f.shape[2],function(){return"Error in conv2dDerInput: depth of input ("+we+") must match input depth for filter "+f.shape[2]+"."}),Ee(De===f.shape[3],function(){return"Error in conv2dDerInput: depth of output ("+De+") must match output depth for filter "+f.shape[3]+"."}),Y!=null&&Ee(vt(E),function(){return"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+Y+" but got pad "+E+"."});var Ne=ui(z),Fe=zn(Z,f.shape,y,1,E,Y,!1,Ne),Ve=qe.runKernelFunc(function(Je,Xe){var ot=Je.conv2dDerInput(le,f,Fe);return Xe([f,le]),ot},{dy4D:le,filter:f},function(Je,Xe){var ot=Xe[0],xt=Xe[1];return{dy4D:function(){return Mh(Je,ot,y,E,z,1,Y)},filter:function(){return py(Je,xt,ot.shape,y,E,z,Y)}}});return de?Ve.as3D(Ve.shape[1],Ve.shape[2],Ve.shape[3]):Ve}function Z0(_){var m=function(z){return typeof z=="number"?[z,z,z]:z.length===2?[z[0],z[1],1]:z}(_),f=m[0],y=m[1],E=m[2];return f===1&&y===1&&E===1}function dy(_,m,f,y,E){Ee(_.length===m.rank,function(){return"Length of inShape ("+_.length+") and rank of dy ("+m.rank+") must match"});var z=_,Y=m,Z=!1;m.rank===4&&(Z=!0,Y=m.as5D(1,m.shape[0],m.shape[1],m.shape[2],m.shape[3]),z=[1,_[0],_[1],_[2],_[3]]);var le=z[4],de=Y.shape[4];Ee(z.length===5,function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+z.length+"."}),Ee(Y.rank===5,function(){return"Error in conv3dDerInput: dy must be rank 5, but got rank "+Y.rank}),Ee(f.rank===5,function(){return"Error in conv3dDerInput: filter must be rank 5, but got rank "+f.rank}),Ee(le===f.shape[3],function(){return"Error in conv3dDerInput: depth of input ("+le+") must match input depth for filter "+f.shape[3]+"."}),Ee(de===f.shape[4],function(){return"Error in conv3dDerInput: depth of output ("+de+") must match output depth for filter "+f.shape[4]+"."});var we=Jn(z,f.shape,y,1,E),De=qe.runKernelFunc(function(Ne){return Ne.conv3dDerInput(Y,f,we)},{dy5D:Y});return Z?De.as4D(De.shape[1],De.shape[2],De.shape[3],De.shape[4]):De}var hy=Bt({conv1d_:function(_,m,f,y,E,z,Y){E===void 0&&(E="NWC"),z===void 0&&(z=1);var Z=et(_,"x","conv1d"),le=et(m,"filter","conv1d"),de=Z,we=!1;Z.rank===2&&(we=!0,de=Z.as3D(1,Z.shape[0],Z.shape[1])),Ee(de.rank===3,function(){return"Error in conv1d: input must be rank 3, but got rank "+de.rank+"."}),Ee(le.rank===3,function(){return"Error in conv1d: filter must be rank 3, but got rank "+le.rank+"."}),Y!=null&&Ee(vt(y),function(){return"Error in conv1d: pad must be an integer when using, dimRoundingMode "+Y+" but got pad "+y+"."}),Ee(de.shape[2]===le.shape[1],function(){return"Error in conv1d: depth of input ("+de.shape[2]+") must match input depth for filter "+le.shape[1]+"."}),Ee(Br(f,z),function(){return"Error in conv1D: Either stride or dilation must be 1. Got stride "+f+" and dilation '"+z+"'"}),Ee(E==="NWC",function(){return"Error in conv1d: got dataFormat of "+E+" but only NWC is currently supported."});var De=le.as4D(1,le.shape[0],le.shape[1],le.shape[2]),Ne=de.as4D(de.shape[0],1,de.shape[1],de.shape[2]),Fe=Mh(Ne,De,[1,f],y,"NHWC",[1,z],Y);return we?Fe.as2D(Fe.shape[2],Fe.shape[3]):Fe.as3D(Fe.shape[0],Fe.shape[2],Fe.shape[3])}}),Mh=Bt({conv2d_:function(_,m,f,y,E,z,Y){E===void 0&&(E="NHWC"),z===void 0&&(z=[1,1]);var Z=et(_,"x","conv2d"),le=et(m,"filter","conv2d"),de=Z,we=!1;Z.rank===3&&(we=!0,de=Z.as4D(1,Z.shape[0],Z.shape[1],Z.shape[2])),Ee(de.rank===4,function(){return"Error in conv2d: input must be rank 4, but got rank "+de.rank+"."}),Ee(le.rank===4,function(){return"Error in conv2d: filter must be rank 4, but got rank "+le.rank+"."}),Y!=null&&Ee(vt(y),function(){return"Error in conv2d: pad must be an integer when using, dimRoundingMode "+Y+" but got pad "+y+"."});var De=E==="NHWC"?de.shape[3]:de.shape[1];Ee(De===le.shape[2],function(){return"Error in conv2d: depth of input ("+De+") must match input depth for filter "+le.shape[2]+"."}),Ee(Br(f,z),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+f+" and dilations '"+z+"'"});var Ne=ui(E),Fe=zn(de.shape,le.shape,f,z,y,Y,!1,Ne),Ve=[le,de],Je=qe.runKernelFunc(function(Xe,ot){var xt=Xe.conv2d(de,le,Fe);return ot([le,de]),xt},{x:de,filter:le},function(Xe,ot){var xt=ot,kt=xt[0],At=xt[1];return Ee(oi(z),function(){return"Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+z+"'"}),{x:function(){return Bf(At.shape,Xe,kt,f,y,E)},filter:function(){return py(At,Xe,kt.shape,f,y,E)}}},"Conv2D",Fe,Ve);return we?Je.as3D(Je.shape[1],Je.shape[2],Je.shape[3]):Je}}),_1=Bt({conv3d_:function(_,m,f,y,E,z){E===void 0&&(E="NDHWC"),z===void 0&&(z=[1,1,1]);var Y=et(_,"x","conv3d"),Z=et(m,"filter","conv3d"),le=Y,de=!1;Y.rank===4&&(de=!0,le=Y.as5D(1,Y.shape[0],Y.shape[1],Y.shape[2],Y.shape[3])),Ee(le.rank===5,function(){return"Error in conv3d: input must be rank 5, but got rank "+le.rank+"."}),Ee(Z.rank===5,function(){return"Error in conv3d: filter must be rank 5, but got rank "+Z.rank+"."}),Ee(le.shape[4]===Z.shape[3],function(){return"Error in conv3d: depth of input ("+le.shape[4]+") must match input depth for filter "+Z.shape[3]+"."}),Ee(function(Ne,Fe){return Z0(f)||Z0(Fe)}(0,z),function(){return"Error in conv3D: Either strides or dilations must be 1. Got strides "+f+" and dilations '"+z+"'"}),Ee(E==="NDHWC",function(){return"Error in conv3d: got dataFormat of "+E+" but only NDHWC is currently supported."});var we=Jn(le.shape,Z.shape,f,z,y),De=qe.runKernelFunc(function(Ne,Fe){var Ve=Ne.conv3d(le,Z,we);return Fe([le,Z]),Ve},{x:le,$filter:Z},function(Ne,Fe){Ee(Z0(z),function(){return"Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+z+"'"});var Ve=Fe[0],Je=Fe[1];return{x:function(){return dy(Ve.shape,Ne,Je,f,y)},$filter:function(){return function(Xe,ot,xt,kt,At){var Lt=Xe;Xe.rank===4&&(Lt=Xe.as5D(1,Xe.shape[0],Xe.shape[1],Xe.shape[2],Xe.shape[3]));var tn=ot;tn.rank===4&&(tn=ot.as5D(1,ot.shape[0],ot.shape[1],ot.shape[2],ot.shape[3])),Ee(Lt.rank===5,function(){return"Error in conv3dDerFilter: input must be rank 5, but got shape "+Lt.shape+"."}),Ee(tn.rank===5,function(){return"Error in conv3dDerFilter: dy must be rank 5, but got shape "+tn.shape+"."}),Ee(xt.length===5,function(){return"Error in conv3dDerFilter: filterShape must be length 5, but got "+xt+"."}),Ee(Lt.shape[4]===xt[3],function(){return"Error in conv3dDerFilter: depth of input "+Lt.shape[4]+") must match input depth in filter ("+xt[3]+"."}),Ee(tn.shape[4]===xt[4],function(){return"Error in conv3dDerFilter: depth of dy ("+tn.shape[4]+") must match output depth for filter ("+xt[4]+")."});var ln=Jn(Lt.shape,xt,kt,1,At);return qe.runKernelFunc(function(nn){return nn.conv3dDerFilter(Lt,tn,ln)},{x5D:Lt,dy5D:tn})}(Ve,Ne,Je.shape,f,y)}}});return de?De.as4D(De.shape[1],De.shape[2],De.shape[3],De.shape[4]):De}}),py=Bt({conv2dDerFilter_:function(_,m,f,y,E,z,Y){z===void 0&&(z="NHWC");var Z=_;_.rank===3&&(Z=_.as4D(1,_.shape[0],_.shape[1],_.shape[2]));var le=m;le.rank===3&&(le=m.as4D(1,m.shape[0],m.shape[1],m.shape[2])),Ee(Z.rank===4,function(){return"Error in conv2dDerFilter: input must be rank 4, but got shape "+Z.shape+"."}),Ee(le.rank===4,function(){return"Error in conv2dDerFilter: dy must be rank 4, but got shape "+le.shape+"."}),Ee(f.length===4,function(){return"Error in conv2dDerFilter: filterShape must be length 4, but got "+f+"."});var de=z==="NHWC"?Z.shape[3]:Z.shape[1],we=z==="NHWC"?le.shape[3]:le.shape[1];Ee(de===f[2],function(){return"Error in conv2dDerFilter: depth of input "+de+") must match input depth in filter ("+f[2]+"."}),Ee(we===f[3],function(){return"Error in conv2dDerFilter: depth of dy ("+we+") must match output depth for filter ("+f[3]+")."}),Y!=null&&Ee(vt(E),function(){return"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+Y+" but got pad "+E+"."});var De=ui(z),Ne=zn(Z.shape,f,y,1,E,Y,!1,De);return qe.runKernelFunc(function(Fe){return Fe.conv2dDerFilter(Z,le,Ne)},{x4D:Z,dy4D:le})}}),Bf=Bt({conv2dDerInput_:fy}),ev=Bt({depthwiseConv2d_:function(_,m,f,y,E,z,Y){z===void 0&&(z=[1,1]);var Z=et(_,"x","depthwiseConv2d"),le=et(m,"filter","depthwiseConv2d"),de=Z,we=!1;Z.rank===3&&(we=!0,de=Z.as4D(1,Z.shape[0],Z.shape[1],Z.shape[2])),Ee(de.rank===4,function(){return"Error in depthwiseConv2d: input must be rank 4, but got rank "+de.rank+"."}),Ee(le.rank===4,function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+le.rank+"."}),Ee(de.shape[3]===le.shape[2],function(){return"Error in depthwiseConv2d: number of input channels ("+de.shape[3]+") must match the inChannels dimension in filter "+le.shape[2]+"."}),z==null&&(z=[1,1]),Ee(Br(f,z),function(){return"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+f+" and dilations '"+z+"'"}),Y!=null&&Ee(vt(y),function(){return"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+Y+" but got pad "+y+"."});var De=zn(de.shape,le.shape,f,z,y,Y,!0),Ne=[de,le],Fe=qe.runKernelFunc(function(Ve,Je){var Xe=Ve.depthwiseConv2D(de,le,De);return Je([de,le]),Xe},{x:de,filter:le},function(Ve,Je){Ee(oi(z),function(){return"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+z+"'"});var Xe=Je[0],ot=Je[1];return{x:function(){return my(Xe.shape,Ve,ot,De)},filter:function(){return Fh(Xe,Ve,ot.shape,De)}}},"DepthwiseConv2dNative",De,Ne);return we?Fe.as3D(Fe.shape[1],Fe.shape[2],Fe.shape[3]):Fe}}),my=Bt({depthwiseConv2dDerInput_:function(_,m,f,y){var E=m,z=!1;m.rank===3&&(z=!0,E=m.as4D(1,m.shape[0],m.shape[1],m.shape[2]));var Y=qe.runKernelFunc(function(Z){return Z.depthwiseConv2DDerInput(E,f,y)},{dy4D:E});return z?Y.as3D(Y.shape[1],Y.shape[2],Y.shape[3]):Y}}),Fh=Bt({depthwiseConv2dDerFilter_:function(_,m,f,y){var E=_;_.rank===3&&(E=_.as4D(1,_.shape[0],_.shape[1],_.shape[2]));var z=m;return z.rank===3&&(z=m.as4D(1,m.shape[0],m.shape[1],m.shape[2])),qe.runKernelFunc(function(Y){return Y.depthwiseConv2DDerFilter(E,z,y)},{x4D:E,dy4D:z})}}),Pf=Bt({separableConv2d_:function(_,m,f,y,E,z,Y){z===void 0&&(z=[1,1]),Y===void 0&&(Y="NHWC");var Z=et(_,"x","separableConv2d"),le=et(m,"depthwiseFilter","separableConv2d"),de=et(f,"pointwiseFilter","separableConv2d"),we=Z,De=!1;if(Z.rank===3&&(De=!0,we=Z.as4D(1,Z.shape[0],Z.shape[1],Z.shape[2])),Y==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");Ee(we.rank===4,function(){return"Error in separableConv2d: input must be rank 4, but got rank "+we.rank+"."}),Ee(le.rank===4,function(){return"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+le.rank+"."}),Ee(de.rank===4,function(){return"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+le.rank+"."}),Ee(de.shape[0]===1,function(){return"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+de.shape[0]+"."}),Ee(de.shape[1]===1,function(){return"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+de.shape[1]+"."});var Ne=le.shape[2],Fe=le.shape[3];Ee(de.shape[2]===Ne*Fe,function(){return"Error in separableConv2d: the third dimension of pointwise filter must be "+Ne*Fe+", but got "+de.shape[2]+"."});var Ve=ev(we,le,y,E,Y,z),Je=Mh(Ve,de,1,"valid",Y);return De?Je.as3D(Je.shape[1],Je.shape[2],Je.shape[3]):Je}}),n0=Bt({conv2dTranspose_:function(_,m,f,y,E,z){return fy(f,et(_,"x","conv2dTranspose"),et(m,"filter","conv2dTranspose"),y,E,"NHWC",z)}}),tv=Bt({conv3dTranspose_:function(_,m,f,y,E){return dy(f,et(_,"x","conv3dTranspose"),et(m,"filter","conv3dTranspose"),y,E)}}),Nl=Bt({matMul_:function(_,m,f,y){var E;f===void 0&&(f=!1),y===void 0&&(y=!1);var z=et(_,"a","matMul"),Y=et(m,"b","matMul");E=Bn(z,Y),z=E[0],Y=E[1];var Z=f?z.shape[z.rank-2]:z.shape[z.rank-1],le=y?Y.shape[Y.rank-1]:Y.shape[Y.rank-2],de=f?z.shape[z.rank-1]:z.shape[z.rank-2],we=y?Y.shape[Y.rank-2]:Y.shape[Y.rank-1],De=z.shape.slice(0,-2),Ne=Y.shape.slice(0,-2),Fe=Ke(De),Ve=Ke(Ne);Ee(z.rank>=2&&Y.rank>=2&&z.rank===Y.rank,function(){return"Error in matMul: inputs must have the same rank of at least 2, got ranks "+z.rank+" and "+Y.rank+"."}),Ee(Tt(De,Ne),function(){return"Error in matMul: outer dimensions ("+De+") and ("+Ne+") of Tensors with shapes "+z.shape+" and "+Y.shape+" must match."}),Ee(Z===le,function(){return"Error in matMul: inner shapes ("+Z+") and ("+le+") of Tensors with shapes "+z.shape+" and "+Y.shape+" and transposeA="+f+" and transposeB="+y+" must match."});var Je=z.shape.slice(0,-2).concat([de,we]),Xe=f?z.as3D(Fe,Z,de):z.as3D(Fe,de,Z),ot=y?Y.as3D(Ve,we,le):Y.as3D(Ve,le,we),xt={transposeA:f,transposeB:y};return qe.runKernelFunc(function(kt,At){var Lt=kt.batchMatMul(Xe,ot,f,y);return At([Xe,ot]),Lt},{a:Xe,b:ot},function(kt,At){var Lt=At,tn=Lt[0],ln=Lt[1];return f||y?!f&&y?{a:function(){return kt.matMul(ln,!1,!1)},b:function(){return kt.matMul(tn,!0,!1)}}:f&&!y?{a:function(){return ln.matMul(kt,!1,!0)},b:function(){return tn.matMul(kt,!1,!1)}}:{a:function(){return ln.matMul(kt,!0,!0)},b:function(){return kt.matMul(tn,!0,!0)}}:{a:function(){return kt.matMul(ln,!1,!0)},b:function(){return tn.matMul(kt,!0,!1)}}},"BatchMatMul",xt).reshape(Je)}}),nv=Bt({dot_:function(_,m){var f=et(_,"t1","dot"),y=et(m,"t2","dot");Ee(!(f.rank!==1&&f.rank!==2||y.rank!==1&&y.rank!==2),function(){return"Error in dot: inputs must all be rank 1 or 2, but got ranks "+f.rank+" and "+y.rank+"."});var E=f.rank===1?f.size:f.shape[1],z=y.rank===1?y.size:y.shape[0];return Ee(E===z,function(){return"Error in dot: inner dimensions of inputs must match, but got "+E+" and "+z+"."}),f.rank===1&&y.rank===1?f.as2D(1,-1).matMul(y.as2D(-1,1)).asScalar():f.rank===1&&y.rank===2?f.as2D(1,-1).matMul(y.as2D(y.shape[0],y.shape[1])).as1D():f.rank===2&&y.rank===1?f.matMul(y.as2D(-1,1)).as1D():f.matMul(y.as2D(y.shape[0],y.shape[1]))}}),gy=Bt({outerProduct_:function(_,m){var f=et(_,"v1","outerProduct"),y=et(m,"v2","outerProduct");return Ee(f.rank===1&&y.rank===1,function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+f.rank+" and "+y.rank+"."}),f.as2D(-1,1).matMul(y.as2D(1,-1))}}),Dd=Bt({reverse_:function(_,m){var f=et(_,"x","reverse");if(f.rank===0)return f.clone();var y=Vt(m,f.shape);return qe.runKernelFunc(function(E){return E.reverse(f,y)},{$x:f},function(E){return{$x:function(){return E.reverse(y)}}}).reshapeAs(f)}}),k1=Bt({reverse1d_:function(_){var m=et(_,"x","reverse");return Ee(m.rank===1,function(){return"Error in reverse1D: x must be rank 1 but got rank "+m.rank+"."}),Dd(m,0)}}),Hp=Bt({reverse2d_:function(_,m){var f=et(_,"x","reverse");return Ee(f.rank===2,function(){return"Error in reverse2D: x must be rank 2 but got rank "+f.rank+"."}),Dd(f,m)}}),qp=Bt({reverse3d_:function(_,m){var f=et(_,"x","reverse");return Ee(f.rank===3,function(){return"Error in reverse3D: x must be rank 3 but got rank "+f.rank+"."}),Dd(f,m)}}),Td=Bt({reverse4d_:function(_,m){var f=et(_,"x","reverse");return Ee(f.rank===4,function(){return"Error in reverse4D: x must be rank 4 but got rank "+f.rank+"."}),Dd(f,m)}});function vy(_,m,f,y,E,z){var Y=et(_,"x","maxPool"),Z=Y,le=!1;Y.rank===3&&(le=!0,Z=Y.as4D(1,Y.shape[0],Y.shape[1],Y.shape[2])),y==null&&(y=[1,1]),Ee(Z.rank===4,function(){return"Error in maxPool: input must be rank 4 but got rank "+Z.rank+"."}),Ee(Br(f,y),function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+f+" and dilations '"+y+"'"}),z!=null&&Ee(vt(E),function(){return"Error in maxPool: pad must be an integer when using, dimRoundingMode "+z+" but got pad "+E+"."});var de=Tn(Z.shape,m,f,y,E,z);if(de.filterWidth===1&&de.filterHeight===1&&Tt(de.inShape,de.outShape))return Y.clone();var we=[Z],De=qe.runKernelFunc(function(Ne,Fe){var Ve=Ne.maxPool(Z,de);return Fe([Z,Ve]),Ve},{x:Z},function(Ne,Fe){var Ve=Fe[0],Je=Fe[1];return{x:function(){return function(Xe,ot,xt,kt,At,Lt,tn,ln){var nn=et(Xe,"dy","maxPoolBackprop"),cn=et(ot,"input","maxPoolBackprop"),Dn=et(xt,"output","maxPoolBackprop");Ee(cn.rank===nn.rank,function(){return"Rank of input ("+cn.rank+") does not match rank of dy ("+nn.rank+")"}),Lt==null&&(Lt=[1,1]),Ee(Br(At,Lt),function(){return"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+At+" and dilations '"+Lt+"'"}),Ee(nn.rank===4,function(){return"Error in maxPoolBackprop: dy must be rank 4 but got rank "+nn.rank+"."}),Ee(cn.rank===4,function(){return"Error in maxPoolBackprop: input must be rank 4 but got rank "+cn.rank+"."});var Rn=Tn(cn.shape,kt,At,Lt,tn,ln);return qe.runKernelFunc(function(Mn){return Mn.maxPoolBackprop(nn,cn,Dn,Rn)},{$dy:nn,$input:cn})}(Ne,Ve,Je,m,f,y,E)}}},"MaxPool",de,we);return le?De.as3D(De.shape[1],De.shape[2],De.shape[3]):De}function Rh(_,m,f,y,E,z){var Y=et(_,"x","avgPool","float32");y==null&&(y=[1,1]),Ee(Br(f,y),function(){return"Error in avgPool: Either strides or dilations must be 1. Got strides "+f+" and dilations '"+y+"'"});var Z=Y,le=!1;Y.rank===3&&(le=!0,Z=Y.as4D(1,Y.shape[0],Y.shape[1],Y.shape[2])),Ee(Z.rank===4,function(){return"Error in avgPool: x must be rank 4 but got rank "+Z.rank+"."}),z!=null&&Ee(vt(E),function(){return"Error in avgPool: pad must be an integer when using, dimRoundingMode "+z+" but got pad "+E+"."});var de=Tn(Z.shape,m,f,y,E,z);if(de.filterWidth===1&&de.filterHeight===1&&Tt(de.inShape,de.outShape))return Y.clone();var we=qe.runKernelFunc(function(De){return De.avgPool(Z,de)},{x:Z},function(De){return{x:function(){return function(Ne,Fe,Ve,Je,Xe,ot){var xt=et(Ne,"dy","avgPoolBackprop"),kt=et(Fe,"input","avgPoolBackprop");Ee(kt.rank===xt.rank,function(){return"Rank of input ("+kt.rank+") does not match rank of dy ("+xt.rank+")"}),Xe==null&&(Xe=[1,1]),Ee(Br(Je,Xe),function(){return"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+Je+" and dilations '"+Xe+"'"});var At=kt,Lt=xt,tn=!1;kt.rank===3&&(tn=!0,At=kt.as4D(1,kt.shape[0],kt.shape[1],kt.shape[2]),Lt=xt.as4D(1,xt.shape[0],xt.shape[1],xt.shape[2])),Ee(Lt.rank===4,function(){return"Error in avgPoolBackprop: dy must be rank 4 but got rank "+Lt.rank+"."}),Ee(At.rank===4,function(){return"Error in avgPoolBackprop: input must be rank 4 but got rank "+At.rank+"."});var ln=Tn(At.shape,Ve,Je,Xe,ot),nn=qe.runKernelFunc(function(cn){return cn.avgPoolBackprop(Lt,At,ln)},{dy4D:Lt,input4D:At});return tn?nn.as3D(nn.shape[1],nn.shape[2],nn.shape[3]):nn}(De,Z,m,f,y,E)}}},"AvgPool",de);return we=we.cast(Y.dtype),le?we.as3D(we.shape[1],we.shape[2],we.shape[3]):we}var Il=Bt({maxPool_:function(_,m,f,y,E){return vy(_,m,f,1,y,E)}}),Gp=Bt({avgPool_:function(_,m,f,y,E){return Rh(_,m,f,1,y,E)}}),sg=Bt({pool_:function(_,m,f,y,E,z){E==null&&(E=[1,1]),z==null&&(z=1),y===0&&(y="valid");var Y=et(_,"x","maxPool"),Z=Y,le=!1;Y.rank===3&&(le=!0,Z=Y.as4D(1,Y.shape[0],Y.shape[1],Y.shape[2])),Ee(Br(z,E),function(){return"Error in pool: Either strides or dilations must be 1. Got strides "+z+" and dilations '"+E+"'"});var de,we=Tn(Z.shape,m,z,E,y),De=[we.dilationHeight,we.dilationWidth];de=y==="same"?function(At,Lt){var tn=At.map(function(cn,Dn){return cn+(cn-1)*(Lt[Dn]-1)}).map(function(cn){return cn-1}),ln=tn.map(function(cn){return Math.floor(cn/2)}),nn=tn.map(function(cn,Dn){return cn-ln[Dn]});return tn.map(function(cn,Dn){return[ln[Dn],nn[Dn]]})}([we.filterHeight,we.filterWidth],De):[[0,0],[0,0]];var Ne=De[0]===1&&De[1]===1,Fe=function(At,Lt,tn){var ln=tn.map(function(Mn){return Mn[0]}),nn=tn.map(function(Mn){return Mn[1]}),cn=At.concat(ln,nn),Dn=Lt.map(function(Mn,tr){return(Mn-cn[tr]%Mn)%Mn}),Rn=nn.map(function(Mn,tr){return Mn+Dn[tr]});return[Lt.map(function(Mn,tr){return[ln[tr],Rn[tr]]}),Lt.map(function(Mn,tr){return[0,Dn[tr]]})]}([we.inHeight,we.inWidth],De,de),Ve=Fe[0],Je=Fe[1],Xe=Ne?y:"valid",ot=Ne?Z:xf(Z,De,Ve),xt=(f==="avg"?function(){return Rh(ot,m,z,1,Xe)}:function(){return vy(ot,m,z,1,Xe)})(),kt=Ne?xt:Bm(xt,De,Je);return le?kt.as3D(kt.shape[1],kt.shape[2],kt.shape[3]):kt}}),r0=Bt({maxPool3d_:function(_,m,f,y,E,z,Y){z===void 0&&(z="NDHWC");var Z=et(_,"x","maxPool3d"),le=Z,de=!1;Z.rank===4&&(de=!0,le=Z.as5D(1,Z.shape[0],Z.shape[1],Z.shape[2],Z.shape[3])),Y==null&&(Y=[1,1,1]),Ee(le.rank===5,function(){return"Error in maxPool3d: x must be rank 5 but got rank "+le.rank+"."}),Ee(z==="NDHWC",function(){return"Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of "+z}),Ee(Br(f,Y),function(){return"Error in maxPool3d: Either strides or dilations must be 1. Got strides "+f+" and dilations '"+Y+"'"}),E!=null&&Ee(vt(y),function(){return"Error in maxPool3d: pad must be an integer when using, dimRoundingMode "+E+" but got pad "+y+"."});var we=Pn(le.shape,m,f,Y,y,E,z),De=qe.runKernelFunc(function(Ne,Fe){var Ve=Ne.maxPool3d(le,we);return Fe([le,Ve]),Ve},{x:le},function(Ne,Fe){var Ve=Fe[0],Je=Fe[1];return{x:function(){return function(Xe,ot,xt,kt,At,Lt,tn,ln){var nn=et(Xe,"dy","maxPool3dBackprop"),cn=et(ot,"input","maxPool3dBackprop"),Dn=et(xt,"output","maxPool3dBackprop"),Rn=nn,Mn=cn,tr=Dn,ur=!1;cn.rank===4&&(ur=!0,Rn=nn.as5D(1,nn.shape[0],nn.shape[1],nn.shape[2],nn.shape[3]),Mn=cn.as5D(1,cn.shape[0],cn.shape[1],cn.shape[2],cn.shape[3]),tr=Dn.as5D(1,Dn.shape[0],Dn.shape[1],Dn.shape[2],Dn.shape[3])),Ee(Rn.rank===5,function(){return"Error in maxPool3dBackprop: dy must be rank 5 but got rank "+Rn.rank+"."}),Ee(Mn.rank===5,function(){return"Error in maxPool3dBackprop: input must be rank 5 but got rank "+Mn.rank+"."}),Ee(tr.rank===5,function(){return"Error in maxPool3dBackprop: output must be rank 5 but got rank "+tr.rank+"."}),Lt==null&&(Lt=[1,1,1]),Ee(Br(At,Lt),function(){return"Error in maxPool3dBackprop: Either strides or dilations must be 1. Got strides "+At+" and dilations '"+Lt+"'"}),ln!=null&&Ee(vt(tn),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+ln+" but got pad "+tn+"."});var vr=Pn(Mn.shape,kt,At,Lt,tn,ln),kr=qe.runKernelFunc(function(yr){return yr.maxPool3dBackprop(Rn,Mn,tr,vr)},{dy5D:Rn,input5D:Mn});return ur?kr.as4D(kr.shape[1],kr.shape[2],kr.shape[3],kr.shape[4]):kr}(Ne,Ve,Je,m,f,Y,y,E)}}});return de?De.as4D(De.shape[1],De.shape[2],De.shape[3],De.shape[4]):De}}),rv=Bt({avgPool3d_:function(_,m,f,y,E,z,Y){z===void 0&&(z="NDHWC");var Z=et(_,"x","avgPool3d","float32"),le=Z,de=!1;Z.rank===4&&(de=!0,le=Z.as5D(1,Z.shape[0],Z.shape[1],Z.shape[2],Z.shape[3])),Y==null&&(Y=[1,1,1]),Ee(le.rank===5,function(){return"Error in avgPool3d: x must be rank 5 but got rank "+le.rank+"."}),Ee(z==="NDHWC",function(){return"Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of "+z}),Ee(Br(f,Y),function(){return"Error in avgPool3d: Either strides or dilations must be 1. Got strides "+f+" and dilations '"+Y+"'"}),E!=null&&Ee(vt(y),function(){return"Error in avgPool3d: pad must be an integer when using, dimRoundingMode "+E+" but got pad "+y+"."});var we=Pn(le.shape,m,f,Y,y,E,z),De=qe.runKernelFunc(function(Ne){return Ne.avgPool3d(le,we)},{x:le},function(Ne){return{x:function(){return function(Fe,Ve,Je,Xe,ot,xt,kt){var At=et(Fe,"dy","avgPool3dBackprop"),Lt=et(Ve,"input","avgPool3dBackprop"),tn=At,ln=Lt,nn=!1;Lt.rank===4&&(nn=!0,tn=At.as5D(1,At.shape[0],At.shape[1],At.shape[2],At.shape[3]),ln=Lt.as5D(1,Lt.shape[0],Lt.shape[1],Lt.shape[2],Lt.shape[3])),Ee(tn.rank===5,function(){return"Error in avgPool3dBackprop: dy must be rank 5 but got rank "+tn.rank+"."}),Ee(ln.rank===5,function(){return"Error in avgPool3dBackprop: input must be rank 5 but got rank "+ln.rank+"."}),ot==null&&(ot=[1,1,1]),Ee(Br(Xe,ot),function(){return"Error in avgPool3dBackprop: Either strides or dilations must be 1. Got strides "+Xe+" and dilations '"+ot+"'"}),kt!=null&&Ee(vt(xt),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+kt+" but got pad "+xt+"."});var cn=Pn(ln.shape,Je,Xe,ot,xt,kt),Dn=qe.runKernelFunc(function(Rn){return Rn.avgPool3dBackprop(tn,ln,cn)},{dy5D:tn,input5D:ln});return nn?Dn.as4D(Dn.shape[1],Dn.shape[2],Dn.shape[3],Dn.shape[4]):Dn}(Ne,le,m,f,Y,y,E)}}});return De=De.cast(le.dtype),de?De.as4D(De.shape[1],De.shape[2],De.shape[3],De.shape[4]):De}}),yy=Bt({maxPoolWithArgmax_:function(_,m,f,y,E){E===void 0&&(E=!1);var z=et(_,"x","maxPoolWithArgmax"),Y={filterSize:m,strides:f,pad:y,includeBatchInIndex:E},Z=qe.runKernel("MaxPoolWithArgmax",{x:z},Y);return{result:Z[0],indexes:Z[1]}}}),Ks=Bt({slice_:function(_,m,f){var y,E,z=et(_,"x","slice");if(z.rank===0)throw new Error("Slicing scalar is not possible");(y=typeof m=="number"?[m].concat(new Array(z.rank-1).fill(0)):m.length<z.rank?m.concat(new Array(z.rank-m.length).fill(0)):m.slice()).forEach(function(le){Ee(le!==-1,function(){return"slice() does not support negative begin indexing."})}),E=(E=f==null?new Array(z.rank).fill(-1):typeof f=="number"?[f].concat(new Array(z.rank-1).fill(-1)):f.length<z.rank?f.concat(new Array(z.rank-f.length).fill(-1)):f).map(function(le,de){return le>=0?le:(Ee(le===-1,function(){return"Negative size values should be exactly -1 but got "+le+" for the slice() size at index "+de+"."}),z.shape[de]-y[de])}),Af(z,y,E);var Y=z.shape,Z={begin:y,size:E};return qe.runKernelFunc(function(le){return le.slice(z,y,E)},{x:z},function(le){for(var de=[],we=0;we<le.rank;we++)de.push([y[we],Y[we]-y[we]-E[we]]);return{x:function(){return Vc(le,de)}}},"Slice",Z)}}),by=Bt({slice1d_:function(_,m,f){var y=et(_,"x","slice1d");return Ee(y.rank===1,function(){return"slice1d expects a rank-1 tensor, but got a rank-"+y.rank+" tensor"}),Ks(y,[m],[f])}}),Kp=Bt({slice2d_:function(_,m,f){var y=et(_,"x","slice2d");return Ee(y.rank===2,function(){return"slice2d expects a rank-2 tensor, but got a rank-"+y.rank+" tensor"}),Ks(y,m,f)}}),xy=Bt({slice3d_:function(_,m,f){var y=et(_,"x","slice3d");return Ee(y.rank===3,function(){return"slice3d expects a rank-3 tensor, but got a rank-"+y.rank+" tensor"}),Ks(y,m,f)}}),i0=Bt({slice4d_:function(_,m,f){var y=et(_,"x","slice4d");return Ee(y.rank===4,function(){return"slice4d expects a rank-4 tensor, but got a rank-"+y.rank+" tensor"}),Ks(y,m,f)}});function Nd(_,m,f,y,E){return m.rank<f.rank&&(m=m.reshape(ia(m.shape,y))),_.rank<f.rank&&(_=_.reshape(ia(_.shape,y))),{x:function(){var z=_.mul(f.equal(m).cast(_.dtype));return E==null?z:z.transpose(E)}}}var ug=Bt({all_:function(_,m,f){m===void 0&&(m=null),f===void 0&&(f=!1);var y=et(_,"x","all","bool"),E=Vt(m,y.shape),z=E,Y=fs(z,y.rank);Y!=null&&(y=y.transpose(Y),z=ds(z.length,y.rank));var Z=qe.runKernelFunc(function(de){return de.all(y,z)},{$x:y});if(f){var le=ia(Z.shape,E);return Z.reshape(le)}return Z}}),jf=Bt({any_:function(_,m,f){m===void 0&&(m=null),f===void 0&&(f=!1);var y=et(_,"x","any","bool"),E=Vt(m,y.shape),z=E,Y=fs(z,y.rank);Y!=null&&(y=y.transpose(Y),z=ds(z.length,y.rank));var Z=qe.runKernelFunc(function(de){return de.any(y,z)},{$x:y});if(f){var le=ia(Z.shape,E);return Z.reshape(le)}return Z}}),wy=Bt({argMax_:function(_,m){m===void 0&&(m=0);var f=et(_,"x","argMax");m==null&&(m=0);var y=Vt(m,f.shape),E=fs(y,f.rank);E!=null&&(f=f.transpose(E),y=ds(y.length,f.rank));var z={axis:y[0]},Y=[f];return qe.runKernelFunc(function(Z,le){var de=Z.argMax(f,y[0]);return le([f]),de},{x:f},function(Z,le){var de=le[0];return{x:function(){return Ei(de)}}},"ArgMax",z,Y)}}),o0=Bt({argMin_:function(_,m){m===void 0&&(m=0);var f=et(_,"x","argMin");m==null&&(m=0);var y=Vt(m,f.shape),E=fs(y,f.rank);return E!=null&&(f=f.transpose(E),y=ds(y.length,f.rank)),qe.runKernelFunc(function(z,Y){var Z=z.argMin(f,y[0]);return Y([f]),Z},{$x:f},function(z,Y){var Z=Y[0];return{$x:function(){return Ei(Z)}}})}}),a0=Bt({logSumExp_:function(_,m,f){m===void 0&&(m=null),f===void 0&&(f=!1);var y=et(_,"x","logSumExp"),E=Vt(m,y.shape),z=y.max(E,!0),Y=y.sub(z).exp().sum(E).log(),Z=z.reshape(Y.shape).add(Y);if(f){var le=ia(Z.shape,E);return Z.reshape(le)}return Z}}),iv=Bt({max_:function(_,m,f){m===void 0&&(m=null),f===void 0&&(f=!1);var y=et(_,"x","max"),E=y,z=Vt(m,y.shape),Y=z,Z=fs(Y,y.rank);Z!=null&&(y=y.transpose(Z),Y=ds(Y.length,y.rank));var le=[y],de=qe.runKernelFunc(function(De,Ne){var Fe=De.max(y,Y);return Ne([E,Fe]),Fe},{x:y},function(De,Ne){return Nd(De,Ne[1],Ne[0],z,Z)},"Max",{axes:Y},le,[!0]);if(f){var we=ia(de.shape,z);de=de.reshape(we)}return de}}),nf=Bt({mean_:function(_,m,f){m===void 0&&(m=null),f===void 0&&(f=!1);var y=et(_,"x","mean"),E=Vt(m,y.shape),z=Ke(ra(y.shape,E)[1]);return H(function(Y){var Z=Or(z);return{value:(Z.dtype===Y.dtype?Y:Y.cast(Z.dtype)).div(Z).sum(m,f),gradFunc:function(le){var de=Y.shape.slice();return E.forEach(function(we){de[we]=1}),le.reshape(de).mul(yc(Y.shape,"float32")).div(z)}}})(y)}}),s0=Bt({min_:function(_,m,f){m===void 0&&(m=null),f===void 0&&(f=!1);var y=et(_,"x","min"),E=y,z=Vt(m,y.shape),Y=z,Z=fs(Y,y.rank);Z!=null&&(y=y.transpose(Z),Y=ds(Y.length,y.rank));var le=[y],de=qe.runKernelFunc(function(De,Ne){var Fe=De.min(y,Y);return Ne([E,Fe]),Fe},{x:y},function(De,Ne){return Nd(De,Ne[1],Ne[0],z,Z)},"Min",{axes:Y},le,[!0]);if(f){var we=ia(de.shape,z);de=de.reshape(we)}return de}}),_y=Bt({moments_:function(_,m,f){m===void 0&&(m=null),f===void 0&&(f=!1);var y=Vt(m,(_=et(_,"x","moments")).shape),E=_.mean(y,f),z=E.shape;return f||(z=ia(E.shape,y)),{mean:E,variance:_.toFloat().sub(E.reshape(z)).square().mean(y,f)}}}),Lf=Bt({sum_:function(_,m,f){m===void 0&&(m=null),f===void 0&&(f=!1);var y=et(_,"x","sum");y.dtype==="bool"&&(y=y.toInt());var E=Vt(m,y.shape);return H(function(z){var Y=fs(E,z.rank),Z=E,le=z;Y!=null&&(le=z.transpose(Y),Z=ds(Z.length,z.rank));var de=function(Fe){var Ve=z.shape.slice();return E.forEach(function(Je){Ve[Je]=1}),Fe.reshape(Ve).mul(yc(z.shape,"float32"))},we={axes:Z},De=qe.runKernelFunc(function(Fe){return Fe.sum(le,Z)},{x:le},function(Fe){return{x:function(){return de(Fe)}}},"Sum",we);if(f){var Ne=ia(De.shape,E);De=De.reshape(Ne)}return{value:De,gradFunc:de}})(y)}}),cg=Bt({prod_:function(_,m,f){m===void 0&&(m=null),f===void 0&&(f=!1);var y=et(_,"x","prod");y.dtype==="bool"&&(y=y.toInt());var E=Vt(m,y.shape),z=fs(E,y.rank),Y=E,Z=y;z!=null&&(Z=y.transpose(z),Y=ds(Y.length,y.rank));var le=qe.runKernelFunc(function(we){return we.prod(Z,Y)},{permutedX:Z});if(f){var de=ia(le.shape,E);le=le.reshape(de)}return le}}),Bh=Bt({elu_:function(_){var m=et(_,"x","elu");return qe.runKernelFunc(function(f,y){var E=f.elu(m);return y([E]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){return qe.runKernelFunc(function(z){return z.eluDer(f,E)},{dy:f,y:E})}}})}}),lg=Bt({leakyRelu_:function(_,m){m===void 0&&(m=.2);var f=et(_,"x","leakyRelu");return as(Or(m).mul(f),f)}}),Ys=Bt({prelu_:function(_,m){var f=et(_,"x","prelu"),y=et(m,"alpha","prelu");return qe.runKernelFunc(function(E,z){var Y=E.prelu(f,y);return z([f,y]),Y},{x:f,alpha:y},function(E,z){var Y=z[0],Z=z[1],le=Y.greater(0);return{x:function(){return ef(le,E,E.mul(Z))},alpha:function(){var de=ef(le,Ei(E),E.mul(Y)),we=bs(Z.shape,E.shape);return we.length>0&&(de=de.sum(we)),de.reshape(Z.shape)}}},"Prelu")}}),u0=Bt({relu_:function(_){var m=et(_,"x","relu");return m.dtype==="bool"?m.toInt():qe.runKernelFunc(function(f,y){var E=f.relu(m);return y([m]),E},{x:m},function(f,y){var E=y[0];return{x:function(){return f.mulStrict(E.step().toFloat())}}},"Relu")}}),ov=Bt({relu6_:function(_){var m=et(_,"x","relu6");return m.dtype==="bool"?m.toInt():qe.runKernelFunc(function(f,y){var E=f.relu6(m);return y([m]),E},{x:m},function(f,y){var E=y[0],z=E.lessEqual(6).mul(E.step());return{x:function(){return f.mulStrict(z.toFloat())}}},"Relu6")}}),fg=Bt({selu_:function(_){var m=et(_,"x","selu");return qe.runKernelFunc(function(f,y){var E=f.selu(m);return y([m]),E},{$x:m},function(f,y){var E=y[0];return{$x:function(){var z=E.greater(Or(0)),Y=Or(Db),Z=Or(Tb),le=f.mul(Z),de=f.mul(Y).mul(E.toFloat().exp());return ef(z,le,de)}}})}}),dg=Bt({localResponseNormalization_:function(_,m,f,y,E){m===void 0&&(m=5),f===void 0&&(f=1),y===void 0&&(y=1),E===void 0&&(E=.5);var z=et(_,"x","localResponseNormalization");Ee(z.rank===4||z.rank===3,function(){return`Error in localResponseNormalization: x must be rank 3 or 4 but got 3725 rank `+z.rank+"."}),Ee(vt(m),function(){return"Error in localResponseNormalization: depthRadius must be an integer but got depthRadius "+m+"."});var Y=z,Z=!1;z.rank===3&&(Z=!0,Y=z.as4D(1,z.shape[0],z.shape[1],z.shape[2]));var le=qe.runKernelFunc(function(de,we){var De=de.localResponseNormalization4D(Y,m,f,y,E);return we([Y,De]),De},{x4D:Y},function(de,we){var De=we[0],Ne=we[1];return{x4D:function(){return qe.runKernelFunc(function(Fe){return Fe.LRNGrad(de,De,Ne,m,f,y,E)},{})}}});return Z?le.as3D(le.shape[1],le.shape[2],le.shape[3]):le}}),av=Bt({norm_:function(_,m,f,y){m===void 0&&(m="euclidean"),f===void 0&&(f=null),y===void 0&&(y=!1);var E=function Z(le,de,we){if(we===void 0&&(we=null),le.rank===0)return le.abs();if(le.rank!==1&&we===null)return Z(le.reshape([-1]),de,we);if(le.rank===1||typeof we=="number"||Array.isArray(we)&&we.length===1){if(de===1)return le.abs().sum(we);if(de===1/0)return le.abs().max(we);if(de===-1/0)return le.abs().min(we);if(de==="euclidean"||de===2)return le.abs().pow(Or(2,"int32")).sum(we).sqrt();throw new Error("Error in norm: invalid ord value: "+de)}if(Array.isArray(we)&&we.length===2){if(de===1)return le.abs().sum(we[0]).max(we[1]-1);if(de===1/0)return le.abs().sum(we[1]).max(we[0]);if(de===-1/0)return le.abs().sum(we[1]).min(we[0]);if(de==="fro"||de==="euclidean")return le.square().sum(we).sqrt();throw new Error("Error in norm: invalid ord value: "+de)}throw new Error("Error in norm: invalid axis: "+we)}(_=et(_,"x","norm"),m,f),z=E.shape;if(y){var Y=Vt(f,_.shape);z=ia(E.shape,Y)}return E.reshape(z)}}),ky=Bt({basicLSTMCell_:function(_,m,f,y,E,z){var Y=et(_,"forgetBias","basicLSTMCell"),Z=et(m,"lstmKernel","basicLSTMCell"),le=et(f,"lstmBias","basicLSTMCell"),de=et(y,"data","basicLSTMCell"),we=et(E,"c","basicLSTMCell"),De=et(z,"h","basicLSTMCell"),Ne=de.concat(De,1).matMul(Z).add(le),Fe=Ne.shape[0],Ve=Ne.shape[1]/4,Je=[Fe,Ve],Xe=Ne.slice([0,0],Je),ot=Ne.slice([0,Ve],Je),xt=Ne.slice([0,2*Ve],Je),kt=Ne.slice([0,3*Ve],Je),At=Xe.sigmoid().mulStrict(ot.tanh()).addStrict(we.mulStrict(Y.add(xt).sigmoid()));return[At,At.tanh().mulStrict(kt.sigmoid())]}}),E1=Bt({multiRNNCell_:function(_,m,f,y){for(var E=et(m,"data","multiRNNCell"),z=Zc(f,"c","multiRNNCell"),Y=Zc(y,"h","multiRNNCell"),Z=E,le=[],de=0;de<_.length;de++){var we=_[de](Z,z[de],Y[de]);le.push(we[0]),le.push(we[1]),Z=we[1]}var De=[],Ne=[];for(de=0;de<le.length;de+=2)De.push(le[de]),Ne.push(le[de+1]);return[De,Ne]}}),rf=Bt({movingAverage_:function(_,m,f,y,E){E===void 0&&(E=!0);var z=et(_,"v","movingAverage"),Y=et(m,"x","movingAverage"),Z=et(f,"decay","movingAverage");Gn(z,Y),Ee(Tt(z.shape,Y.shape),function(){return"Shape mismatch in v and x"});var le=Or(1),de=le.sub(Z),we=Y.sub(z).mul(de);if(E){Ee(y!=null,function(){return"When using zeroDebias: true, step is required."});var De=et(y,"step","movingAverage");we=we.div(le.sub(Gu(Z,De)))}return z.add(we)}}),Ph=Bt({stridedSlice_:function(_,m,f,y,E,z,Y,Z,le){if(E===void 0&&(E=0),z===void 0&&(z=0),Y===void 0&&(Y=0),Z===void 0&&(Z=0),le===void 0&&(le=0),y==null&&(y=new Array(m.length)),Y!==0)throw new Error("ellipsis mask is not yet supported");var de=et(_,"x","stridedSlice"),we=Yu(Z),De=de.shape.slice();we.forEach(function(Xe){m[Xe]=0,f[Xe]=1,De.splice(Xe,0,1)}),de=de.reshape(De);for(var Ne=0;Ne<de.rank;Ne++)m[Ne]=Pc(E,m,y,de.shape,Ne),f[Ne]=lc(z,f,y,de.shape,Ne),y[Ne]=y[Ne]||1;var Fe=Yu(le);Fe.forEach(function(Xe){f[Xe]=m[Xe]+1,y[Xe]=1});var Ve=Bc(m,f,y),Je=Ve.filter(function(Xe,ot){return Fe.indexOf(ot)===-1});return y.every(function(Xe){return Xe===1})?Ks(de,m,Ve).reshape(Je):qe.runKernelFunc(function(Xe){return Xe.stridedSlice(de,m,f,y)},{$x:de}).reshape(Je)}}),C1=Bt({topk_:function(_,m,f){m===void 0&&(m=1),f===void 0&&(f=!0);var y=et(_,"x","topk");if(y.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");var E=y.shape[y.shape.length-1];if(m>E)throw new Error("'k' passed to topk() must be <= the last dimension ("+E+") but got "+m);var z=qe.runKernelFunc(function(Y){return Y.topk(y,m,f)},{$x:y});return{values:z[0],indices:z[1]}}}),Ey=Bt({scatterND_:function(_,m,f){var y=et(_,"indices","scatterND","int32"),E=et(m,"updates","scatterND");return Cf(E,y,f),qe.runKernelFunc(function(z){return z.scatterND(y,E,f)},{indices:y,updates:E},null,"ScatterNd",{shape:f})}}),of=Bt({fft_:function(_){Ee(_.dtype==="complex64",function(){return"The dtype for tf.spectral.fft() must be complex64 but got "+_.dtype+"."});var m=_.shape[_.shape.length-1],f=_.size/m,y=_.as2D(f,m);return qe.runKernelFunc(function(E){return E.fft(y)},{input:_}).reshape(_.shape)}}),zs=Bt({ifft_:function(_){Ee(_.dtype==="complex64",function(){return"The dtype for tf.spectral.ifft() must be complex64 but got "+_.dtype+"."});var m=_.shape[_.shape.length-1],f=_.size/m,y=_.as2D(f,m);return qe.runKernelFunc(function(E){return E.ifft(y)},{input:_}).reshape(_.shape)}}),Yp=Bt({rfft_:function(_,m){Ee(_.dtype==="float32",function(){return"The dtype for rfft() must be real value but got "+_.dtype});var f,y=_.shape[_.shape.length-1],E=_.size/y;if(m!=null&&m<y){var z=_.shape.map(function(ot){return 0}),Y=_.shape.map(function(ot){return ot});Y[_.shape.length-1]=m,f=_.slice(z,Y),y=m}else if(m!=null&&m>y){var Z=_.shape.map(function(ot){return ot});Z[_.shape.length-1]=m-y,f=_.concat(go(Z),_.shape.length-1),y=m}else f=_;var le=f.zerosLike(),de=zo(f,le).as2D(E,y),we=of(de),De=Math.floor(y/2)+1,Ne=qa(we),Fe=Os(we),Ve=Ne.split([De,y-De],Ne.shape.length-1),Je=Fe.split([De,y-De],Fe.shape.length-1),Xe=f.shape.slice();return Xe[f.shape.length-1]=De,zo(Ve[0],Je[0]).reshape(Xe)}}),hg=Bt({irfft_:function(_){var m=_.shape[_.shape.length-1],f=_.size/m;if(m<=2){var y=_.as2D(f,m),E=zs(y);return qa(E)}var z=[f,2*(m-1)],Y=qa(_).as2D(f,m),Z=Os(_).as2D(f,m),le=Y.slice([0,1],[f,m-2]).reverse(1),de=Z.slice([0,1],[f,m-2]).reverse(1).mul(Or(-1)),we=Y.concat(le,1),De=Z.concat(de,1);return y=zo(we,De).as2D(z[0],z[1]),E=zs(y),qa(E)}}),c0=Object.freeze({fft:of,ifft:zs,rfft:Yp,irfft:hg}),Cy=Bt({sparseToDense_:function(_,m,f,y){y===void 0&&(y=0);var E=et(_,"sparseIndices","sparseToDense","int32"),z=et(m,"sparseValues","sparseToDense"),Y=et(y,"defaultValue","sparseToDense",z.dtype);return function(Z,le,de,we){if(Z.dtype!=="int32")throw new Error("tf.sparseToDense() expects the indices to be int32 type, but the dtype was "+Z.dtype+".");if(Z.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix, but got shape "+Z.shape+".");var De=Z.rank>0?Z.shape[0]:1,Ne=Z.rank>1?Z.shape[1]:1;if(de.length!==Ne)throw new Error("outputShape has incorrect number of elements:, "+de.length+", should be: "+Ne+".");var Fe=le.size;if(le.rank!==0&&(le.rank!==1||Fe!==De))throw new Error("sparseValues has incorrect shape "+le.shape+", should be [] or ["+De+"]");if(le.dtype!==we.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(E,z,f,Y),qe.runKernelFunc(function(Z){return Z.sparseToDense(E,z,f,Y)},{$sparseIndices:E,$sparseValues:z,$defaultValue:Y})}}),l0=Bt({gatherND_:function(_,m){var f=et(m,"indices","gatherND","int32"),y=et(_,"x","gatherND");return qe.runKernelFunc(function(E){return E.gatherND(y,f)},{x:y,indices:f},null,"GatherNd")}}),Id=Bt({diag_:function(_){var m=et(_,"x","diag").flatten(),f=_.shape.concat(_.shape);return qe.runKernelFunc(function(y){return y.diag(m)},{$x:m}).reshape(f)}}),Mb=Bt({dropout_:function(_,m,f,y){var E=et(_,"x","dropout");if(Ee(E.dtype==="float32",function(){return"x has to be a floating point tensor since it's going to be scaled, but got a "+E.dtype+" tensor instead."}),Ee(m>=0&&m<1,function(){return"rate must be a float in the range [0, 1), but got "+m+"."}),m===0)return _ instanceof Zt?E.clone():E;var z=function(le,de){if(de==null)return le.shape.slice();if(Tt(le.shape,de))return de;if(le.shape.length===de.length){for(var we=[],De=0;De<le.shape.length;De++)de[De]==null&&le.shape[De]!=null?we.push(le.shape[De]):we.push(de[De]);return we}return de}(E,f),Y=1-m,Z=Jg(z,0,1,"float32",y).add(Y).floor().div(Y);return E.mul(Z)}});function f0(_,m,f){for(var y=1-_%2,E=new Float32Array(_),z=0;z<_;++z){var Y=2*Math.PI*z/(_+y-1);E[z]=m-f*Math.cos(Y)}return Vu(E,"float32")}var Ds,pg=Bt({hannWindow_:function(_){return f0(_,.5,.5)}}),jh=Bt({hammingWindow_:function(_){return f0(_,.54,.46)}}),d0=Bt({frame_:function(_,m,f,y,E){y===void 0&&(y=!1),E===void 0&&(E=0);for(var z=0,Y=[];z+m<=_.size;)Y.push(Ks(_,z,m)),z+=f;if(y)for(;z<_.size;){var Z=z+m-_.size,le=va([Ks(_,z,m-Z),xu([Z],E)]);Y.push(le),z+=f}return Y.length===0?uc([],[0,m]):va(Y).as2D(Y.length,m)}}),mg=Bt({stft_:function(_,m,f,y,E){var z;E===void 0&&(E=pg),y==null&&(z=m,y=Math.floor(Math.pow(2,Math.ceil(Math.log(z)/Math.log(2)))));for(var Y=d0(_,m,f),Z=Oa(Y,E(m)),le=[],de=0;de<Y.shape[0];de++)le.push(Yp(Z.slice([de,0],[1,m]),y));return va(le)}}),sv=Object.freeze({hannWindow:pg,hammingWindow:jh,frame:d0,stft:mg}),uv=function(_,m,f){return f===void 0&&(f=1),S(this,void 0,void 0,function(){var y,E,z,Y,Z,le,de,we,De,Ne,Fe,Ve,Je,Xe;return M(this,function(ot){switch(ot.label){case 0:return y=et(_,"predictions","inTopK"),E=et(m,"targets","inTopK"),Ee(y.rank>1,function(){return"inTopK() expects the predictions to be of rank 2 or higher, but got "+y.rank}),Ee(y.rank-1===E.rank,function(){return"predictions rank should be 1 larger than targets rank, but got predictions rank "+y.rank+" and targets rank "+E.rank}),Ot(y.shape.slice(0,y.shape.length-1),E.shape,"predictions's shape should be align with the targets' shape, except the last dimension."),z=y.shape[y.shape.length-1],Ee(f>0&&f<=z,function(){return"'k' passed to inTopK() must be > 0 && <= the predictions last dimension ("+z+"), but got "+f}),[4,y.data()];case 1:return Y=ot.sent(),[4,E.data()];case 2:for(Z=ot.sent(),le=[Y.length/z,z],we=le[1],De=yn("bool",de=le[0]),Ne=0;Ne<de;Ne++){for(Fe=Ne*we,Ve=Y.subarray(Fe,Fe+we),Je=[],Xe=0;Xe<Ve.length;Xe++)Je.push({value:Ve[Xe],index:Xe});for(Je.sort(function(xt,kt){return kt.value-xt.value}),De[Ne]=0,Xe=0;Xe<f;Xe++)if(Je[Xe].index===Z[Ne]){De[Ne]=1;break}}return _!==y&&y.dispose(),m!==E&&E.dispose(),[2,Qo(De,E.shape,"bool")]}})})};(function(_){_[_.NONE=0]="NONE",_[_.MEAN=1]="MEAN",_[_.SUM=2]="SUM",_[_.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(Ds||(Ds={}));var Md=Bt({absoluteDifference_:function(_,m,f,y){y===void 0&&(y=Ds.SUM_BY_NONZERO_WEIGHTS);var E=et(_,"labels","absoluteDifference"),z=et(m,"predictions","absoluteDifference"),Y=null;f!=null&&(Y=et(f,"weights","absoluteDifference")),Ot(E.shape,z.shape,"Error in absoluteDifference: ");var Z=E.sub(z).abs();return al(Z,Y,y)}}),al=Bt({computeWeightedLoss_:function(_,m,f){f===void 0&&(f=Ds.SUM_BY_NONZERO_WEIGHTS);var y=et(_,"losses","computeWeightedLoss"),E=null;m!=null&&(E=et(m,"weights","computeWeightedLoss"));var z=E==null?y:y.mul(E);if(f===Ds.NONE)return z;if(f===Ds.SUM)return z.sum();if(f===Ds.MEAN){if(E==null)return z.mean();var Y=y.size/E.size,Z=z.sum().div(E.sum());return Y>1?Z.div(Or(Y)):Z}if(f===Ds.SUM_BY_NONZERO_WEIGHTS){if(E==null)return z.sum().div(Or(y.size));var le=E.mul(yc(y.shape)).notEqual(Or(0)).sum().toFloat();return z.sum().div(le)}throw Error("Unknown reduction: "+f)}}),Sy=Bt({cosineDistance_:function(_,m,f,y,E){E===void 0&&(E=Ds.SUM_BY_NONZERO_WEIGHTS);var z=et(_,"labels","cosineDistance"),Y=et(m,"predictions","cosineDistance"),Z=null;y!=null&&(Z=et(y,"weights","cosineDistance")),Ot(z.shape,Y.shape,"Error in cosineDistance: ");var le=Or(1).sub(z.mul(Y).sum(f,!0));return al(le,Z,E)}}),Ay=Bt({hingeLoss_:function(_,m,f,y){y===void 0&&(y=Ds.SUM_BY_NONZERO_WEIGHTS);var E=et(_,"labels","hingeLoss"),z=et(m,"predictions","hingeLoss"),Y=null;f!=null&&(Y=et(f,"weights","hingeLoss")),Ot(E.shape,z.shape,"Error in hingeLoss: ");var Z=Or(1);E=Or(2).mul(E).sub(Z);var le=Z.sub(E.mul(z)).relu();return al(le,Y,y)}}),Xp=Bt({huberLoss_:function(_,m,f,y,E){y===void 0&&(y=1),E===void 0&&(E=Ds.SUM_BY_NONZERO_WEIGHTS);var z=et(_,"labels","huberLoss"),Y=et(m,"predictions","huberLoss"),Z=null;f!=null&&(Z=et(f,"weights","huberLoss")),Ot(z.shape,Y.shape,"Error in huberLoss: ");var le=Or(y),de=Y.sub(z).abs(),we=Mc(de,le),De=de.sub(we),Ne=Or(.5).mul(we.square()).add(le.mul(De));return al(Ne,Z,E)}}),gg=Bt({logLoss_:function(_,m,f,y,E){y===void 0&&(y=1e-7),E===void 0&&(E=Ds.SUM_BY_NONZERO_WEIGHTS);var z=et(_,"labels","logLoss"),Y=et(m,"predictions","logLoss"),Z=null;f!=null&&(Z=et(f,"weights","logLoss")),Ot(z.shape,Y.shape,"Error in logLoss: ");var le=Or(1),de=Or(y),we=z.mul(Y.add(de).log()).neg().sub(le.sub(z).mul(le.sub(Y).add(de).log()));return al(we,Z,E)}}),S1=Bt({meanSquaredError_:function(_,m,f,y){y===void 0&&(y=Ds.SUM_BY_NONZERO_WEIGHTS);var E=et(_,"labels","meanSquaredError"),z=et(m,"predictions","meanSquaredError"),Y=null;f!=null&&(Y=et(f,"weights","meanSquaredError")),Ot(E.shape,z.shape,"Error in meanSquaredError: ");var Z=E.squaredDifference(z);return al(Z,Y,y)}}),cv=Bt({sigmoidCrossEntropy_:function(_,m,f,y,E){y===void 0&&(y=0),E===void 0&&(E=Ds.SUM_BY_NONZERO_WEIGHTS);var z=et(_,"multiClassLabels","sigmoidCrossEntropy"),Y=et(m,"logits","sigmoidCrossEntropy"),Z=null;if(f!=null&&(Z=et(f,"weights","sigmoidCrossEntropy")),Ot(z.shape,Y.shape,"Error in sigmoidCrossEntropy: "),y>0){var le=Or(y),de=Or(1),we=Or(.5);z=z.mul(de.sub(le)).add(we.mul(le))}var De=function(Ne,Fe){var Ve=et(Ne,"labels","sigmoidCrossEntropyWithLogits"),Je=et(Fe,"logits","sigmoidCrossEntropyWithLogits");Ot(Ve.shape,Je.shape,"Error in sigmoidCrossEntropyWithLogits: ");var Xe=Je.relu(),ot=Je.mul(Ve),xt=Je.abs().neg().exp().log1p();return Xe.sub(ot).add(xt)}(z,Y);return al(De,Z,E)}}),h0=Bt({softmaxCrossEntropy_:function(_,m,f,y,E){y===void 0&&(y=0),E===void 0&&(E=Ds.SUM_BY_NONZERO_WEIGHTS);var z=et(_,"onehotLabels","softmaxCrossEntropy"),Y=et(m,"logits","softmaxCrossEntropy"),Z=null;if(f!=null&&(Z=et(f,"weights","softmaxCrossEntropy")),Ot(z.shape,Y.shape,"Error in softmaxCrossEntropy: "),y>0){var le=Or(y),de=Or(1),we=Or(z.shape[1]);z=z.mul(de.sub(le)).add(le.div(we))}var De=function(Ne,Fe,Ve){if(Ve===void 0&&(Ve=-1),Ve===-1&&(Ve=Fe.rank-1),Ve!==Fe.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+Fe.rank+" and dim was "+Ve);return H(function(Je,Xe,ot){var xt=Xe.logSumExp([Ve],!0),kt=Xe.toFloat().sub(xt);return ot([Je,kt]),{value:kt.mul(Je).neg().sum([Ve]),gradFunc:function(At,Lt){var tn=Lt[0],ln=Lt[1],nn=ia(At.shape,[Ve]);return[At.reshape(nn).mul(tn.toFloat().sub(ln.exp())),At.reshape(nn).mul(ln.exp().sub(tn.toFloat()))]}}})(Ne,Fe)}(z,Y);return al(De,Z,E)}}),Gr=Object.freeze({get Reduction(){return Ds},absoluteDifference:Md,computeWeightedLoss:al,cosineDistance:Sy,hingeLoss:Ay,huberLoss:Xp,logLoss:gg,meanSquaredError:S1,sigmoidCrossEntropy:cv,softmaxCrossEntropy:h0});function q(_,m){return m===void 0&&(m=!1),qe.tidy(function(){if(_.shape.length!==2)throw new Error("qr2d() requires a 2D Tensor, but got a "+_.shape.length+"D Tensor.");for(var f=_.shape[0],y=_.shape[1],E=tf(f),z=_.clone(),Y=uc([[1]],[1,1]),Z=Y.clone(),le=f>=y?y:f,de=function(De){var Ne,Fe=z,Ve=Z,Je=E;Ne=qe.tidy(function(){var Xe=z.slice([De,De],[f-De,1]),ot=Xe.norm(),xt=z.slice([De,De],[1,1]),kt=uc([[-1]]).where(xt.greater(0),uc([[1]])),At=xt.sub(kt.mul(ot)),Lt=Xe.div(At);Z=Lt.shape[0]===1?Y.clone():Y.concat(Lt.slice([1,0],[Lt.shape[0]-1,Lt.shape[1]]),0);var tn=kt.matMul(At).div(ot).neg(),ln=z.slice([De,0],[f-De,y]),nn=tn.mul(Z),cn=Z.transpose();if(De===0)z=ln.sub(nn.matMul(cn.matMul(ln)));else{var Dn=ln.sub(nn.matMul(cn.matMul(ln)));z=z.slice([0,0],[De,y]).concat(Dn,0)}var Rn=nn.transpose(),Mn=E.slice([0,De],[f,E.shape[1]-De]);if(De===0)E=Mn.sub(Mn.matMul(Z).matMul(Rn));else{var tr=Mn.sub(Mn.matMul(Z).matMul(Rn));E=E.slice([0,0],[f,De]).concat(tr,1)}return[Z,z,E]}),Z=Ne[0],z=Ne[1],E=Ne[2],ca([Fe,Ve,Je])},we=0;we<le;++we)de(we);return!m&&f>y&&(E=E.slice([0,0],[f,y]),z=z.slice([0,0],[y,y])),[E,z]})}var R=Bt({bandPart_:function(_,m,f){if(m%1!=0)throw new Error("bandPart(): numLower must be an integer, got "+m+".");if(f%1!=0)throw new Error("bandPart(): numUpper must be an integer, got "+f+".");var y=et(_,"a","bandPart");if(y.rank<2)throw new Error("bandPart(): Rank must be at least 2, got "+y.rank+".");var E=y.shape,z=y.shape.slice(-2),Y=z[0],Z=z[1];if(!(m<=Y))throw new Error("bandPart(): numLower ("+m+") must not be greater than the number of rows ("+Y+").");if(!(f<=Z))throw new Error("bandPart(): numUpper ("+f+") must not be greater than the number of columns ("+Z+").");m<0&&(m=Y),f<0&&(f=Z);var le=kl(0,Y,1,"int32").reshape([-1,1]),de=kl(0,Z,1,"int32"),we=ps(le,de),De=Wc(we.lessEqual(Or(+m,"int32")),we.greaterEqual(Or(-f,"int32"))),Ne=go([Y,Z],y.dtype);return cc(Sp(y.reshape([-1,Y,Z])).map(function(Fe){return ef(De,Fe,Ne)})).reshape(E)}}),F=Bt({gramSchmidt_:function(_){var m;if(Array.isArray(_)){m=!1,Ee(_!=null&&_.length>0,function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"});for(var f=_[0].shape[0],y=function(le){Ee(_[le].shape[0]===f,function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+_[le].shape[0]+" vs. "+f+")"})},E=1;E<_.length;++E)y(E)}else m=!0,_=to(_,_.shape[0],0).map(function(le){return Iu(le,[0])});Ee(_.length<=_[0].shape[0],function(){return"Gram-Schmidt: Number of vectors ("+_.length+") exceeds number of dimensions ("+_[0].shape[0]+")."});var z=[],Y=_,Z=function(le){z.push(qe.tidy(function(){var de=Y[le];if(le>0)for(var we=0;we<le;++we){var De=Lf(z[we].mulStrict(de)).mul(z[we]);de=de.sub(De)}return de.div(av(de,"euclidean"))}))};for(E=0;E<_.length;++E)Z(E);return m?cc(z,0):z}}),I=Bt({qr_:function(_,m){if(m===void 0&&(m=!1),_.rank<2)throw new Error("qr() requires input tensor to have a rank >= 2, but got rank "+_.rank);if(_.rank===2)return q(_,m);var f=_.shape.slice(0,_.shape.length-2).reduce(function(z,Y){return z*Y}),y=[],E=[];return Sp(_.reshape([f,_.shape[_.shape.length-2],_.shape[_.shape.length-1]]),0).forEach(function(z){var Y=q(z,m),Z=Y[0],le=Y[1];y.push(Z),E.push(le)}),[cc(y,0).reshape(_.shape),cc(E,0).reshape(_.shape)]}}),U=Object.freeze({bandPart:R,gramSchmidt:F,qr:I});function X(_,m,f,y,E,z){y==null&&(y=.5),E==null&&(E=Number.NEGATIVE_INFINITY),z==null&&(z=0);var Y=_.shape[0];return f=Math.min(f,Y),Ee(0<=y&&y<=1,function(){return"iouThreshold must be in [0, 1], but was '"+y+"'"}),Ee(_.rank===2,function(){return"boxes must be a 2D tensor, but was of rank '"+_.rank+"'"}),Ee(_.shape[1]===4,function(){return"boxes must have 4 columns, but 2nd dimension was "+_.shape[1]}),Ee(m.rank===1,function(){return"scores must be a 1D tensor"}),Ee(m.shape[0]===Y,function(){return"scores has incompatible shape with boxes. Expected "+Y+", but was "+m.shape[0]}),Ee(0<=z&&z<=1,function(){return"softNmsSigma must be in [0, 1], but was '"+z+"'"}),{maxOutputSize:f,iouThreshold:y,scoreThreshold:E,softNmsSigma:z}}var oe=Bt({resizeBilinear_:function(_,m,f){f===void 0&&(f=!1);var y=et(_,"images","resizeBilinear");Ee(y.rank===3||y.rank===4,function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+y.rank+"."}),Ee(m.length===2,function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+m+"."});var E=y,z=!1;y.rank===3&&(z=!0,E=y.as4D(1,y.shape[0],y.shape[1],y.shape[2]));var Y=m[0],Z=m[1],le=qe.runKernelFunc(function(de,we){return we([E]),de.resizeBilinear(E,Y,Z,f)},{x:E},function(de,we){return{x:function(){return qe.runKernelFunc(function(De){return De.resizeBilinearBackprop(de,we[0],f)},{})}}},"ResizeBilinear",{alignCorners:f,newHeight:Y,newWidth:Z});return z?le.as3D(le.shape[1],le.shape[2],le.shape[3]):le}}),me=Bt({resizeNearestNeighbor_:function(_,m,f){f===void 0&&(f=!1);var y=et(_,"images","resizeNearestNeighbor");Ee(y.rank===3||y.rank===4,function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+y.rank+"."}),Ee(m.length===2,function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+m+"."}),Ee(y.dtype==="float32"||y.dtype==="int32",function(){return"`images` must have `int32` or `float32` as dtype"});var E=y,z=!1;y.rank===3&&(z=!0,E=y.as4D(1,y.shape[0],y.shape[1],y.shape[2]));var Y=m[0],Z=m[1],le=qe.runKernelFunc(function(de,we){return we([E]),de.resizeNearestNeighbor(E,Y,Z,f)},{batchImages:E},function(de,we){return{batchImages:function(){return qe.runKernelFunc(function(De){return De.resizeNearestNeighborBackprop(de,we[0],f)},{})}}});return z?le.as3D(le.shape[1],le.shape[2],le.shape[3]):le}}),Se=Bt({nonMaxSuppression_:function(_,m,f,y,E){y===void 0&&(y=.5),E===void 0&&(E=Number.NEGATIVE_INFINITY);var z=et(_,"boxes","nonMaxSuppression"),Y=et(m,"scores","nonMaxSuppression"),Z=X(z,Y,f,y,E);f=Z.maxOutputSize,y=Z.iouThreshold,E=Z.scoreThreshold;var le={maxOutputSize:f,iouThreshold:y,scoreThreshold:E};return qe.runKernelFunc(function(de){return de.nonMaxSuppression(z,Y,f,y,E)},{boxes:z,scores:Y},null,"NonMaxSuppressionV3",le)}}),Me=Bt({nonMaxSuppressionWithScore_:function(_,m,f,y,E,z){y===void 0&&(y=.5),E===void 0&&(E=Number.NEGATIVE_INFINITY),z===void 0&&(z=0);var Y=et(_,"boxes","nonMaxSuppression"),Z=et(m,"scores","nonMaxSuppression"),le=X(Y,Z,f,y,E,z),de={maxOutputSize:f=le.maxOutputSize,iouThreshold:y=le.iouThreshold,scoreThreshold:E=le.scoreThreshold,softNmsSigma:z=le.softNmsSigma},we=qe.runKernel("NonMaxSuppressionV5",{boxes:Y,scores:Z},de);return{selectedIndices:we[0],selectedScores:we[1]}}}),Te=Bt({cropAndResize_:function(_,m,f,y,E,z){var Y=et(_,"image","cropAndResize"),Z=et(m,"boxes","cropAndResize","float32"),le=et(f,"boxInd","cropAndResize","int32");E=E||"bilinear",z=z||0;var de=Z.shape[0];return Ee(Y.rank===4,function(){return"Error in cropAndResize: image must be rank 4,but got rank "+Y.rank+"."}),Ee(Z.rank===2&&Z.shape[1]===4,function(){return"Error in cropAndResize: boxes must be have size ["+de+",4] but had shape "+Z.shape+"."}),Ee(le.rank===1&&le.shape[0]===de,function(){return"Error in cropAndResize: boxInd must be have size ["+de+"] but had shape "+Z.shape+"."}),Ee(y.length===2,function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+y.length+"."}),Ee(y[0]>=1&&y[1]>=1,function(){return"cropSize must be atleast [1,1], but was "+y}),Ee(E==="bilinear"||E==="nearest",function(){return"method must be bilinear or nearest, but was "+E}),qe.runKernelFunc(function(we,De){return we.cropAndResize(Y,Z,le,y,E,z)},{images:Y,boxes:Z,boxInd:le},null,"CropAndResize",{method:E,extrapolationValue:z,cropSize:y})}}),tt=Object.freeze({resizeBilinear:oe,resizeNearestNeighbor:me,nonMaxSuppression:Se,nonMaxSuppressionAsync:function(_,m,f,y,E){return y===void 0&&(y=.5),E===void 0&&(E=Number.NEGATIVE_INFINITY),S(this,void 0,void 0,function(){var z,Y,Z,le,de,we,De;return M(this,function(Ne){switch(Ne.label){case 0:return z=et(_,"boxes","nonMaxSuppressionAsync"),Y=et(m,"scores","nonMaxSuppressionAsync"),Z=X(z,Y,f,y,E),f=Z.maxOutputSize,y=Z.iouThreshold,E=Z.scoreThreshold,[4,Promise.all([z.data(),Y.data()])];case 1:return le=Ne.sent(),de=le[0],we=le[1],De=ja(de,we,f,y,E),z!==_&&z.dispose(),Y!==m&&Y.dispose(),[2,De]}})})},nonMaxSuppressionWithScore:Me,nonMaxSuppressionWithScoreAsync:function(_,m,f,y,E,z){return y===void 0&&(y=.5),E===void 0&&(E=Number.NEGATIVE_INFINITY),z===void 0&&(z=0),S(this,void 0,void 0,function(){var Y,Z,le,de,we,De,Ne;return M(this,function(Fe){switch(Fe.label){case 0:return Y=et(_,"boxes","nonMaxSuppressionAsync"),Z=et(m,"scores","nonMaxSuppressionAsync"),le=X(Y,Z,f,y,E,z),f=le.maxOutputSize,y=le.iouThreshold,E=le.scoreThreshold,z=le.softNmsSigma,[4,Promise.all([Y.data(),Z.data()])];case 1:return de=Fe.sent(),we=de[0],De=de[1],Ne=pa(we,De,f,y,E,z),Y!==_&&Y.dispose(),Z!==m&&Z.dispose(),[2,Ne]}})})},cropAndResize:Te}),at=function(_,m){return!(_>0)||m==="linear"},jt=function(_,m,f){if(f==null||f==="linear")return _;if(f==="relu")return _.mul(m.step());throw new Error("Gradient for activation "+f+" has not been implemented yet.")},$t=function(_,m){var f=m,y=bs(_.shape,m.shape);return y.length>0&&(f=f.sum(y)),f.reshape(_.shape)},vn=function(_,m,f){if(m==="linear")return _;if(m==="relu")return u0(_);if(m==="elu")return Bh(_);if(m==="relu6")return ov(_);if(m==="prelu")return Ys(_,f);throw new Error("Unknown fused activation "+m+".")},wn=Bt({fusedMatMul_:function(_){var m,f=_.a,y=_.b,E=_.transposeA,z=E!==void 0&&E,Y=_.transposeB,Z=Y!==void 0&&Y,le=_.bias,de=_.activation,we=de===void 0?"linear":de,De=_.preluActivationWeights;if(at(qe.state.gradientDepth,we)===!1){var Ne=Nl(f,y,z,Z);return le!=null&&(Ne=Pa(Ne,le)),vn(Ne,we,De)}var Fe=et(f,"a","fused matMul"),Ve=et(y,"b","fused matMul");m=Bn(Fe,Ve),Fe=m[0],Ve=m[1];var Je=z?Fe.shape[Fe.rank-2]:Fe.shape[Fe.rank-1],Xe=Z?Ve.shape[Ve.rank-1]:Ve.shape[Ve.rank-2],ot=z?Fe.shape[Fe.rank-1]:Fe.shape[Fe.rank-2],xt=Z?Ve.shape[Ve.rank-2]:Ve.shape[Ve.rank-1],kt=Fe.shape.slice(0,-2),At=Ve.shape.slice(0,-2),Lt=Ke(kt),tn=Ke(At);Ee(Fe.rank>=2&&Ve.rank>=2&&Fe.rank===Ve.rank,function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+Fe.rank+" and "+Ve.rank+"."}),Ee(Tt(kt,At),function(){return"Error in fused matMul: outer dimensions ("+kt+") and ("+At+") of Tensors with shapes "+Fe.shape+" and "+Ve.shape+" must match."}),Ee(Je===Xe,function(){return"Error in fused matMul: inner shapes ("+Je+") and ("+Xe+") of Tensors with shapes "+Fe.shape+" and "+Ve.shape+" and transposeA="+z+" and transposeB="+Z+" must match."});var ln,nn,cn=Fe.shape.slice(0,-2).concat([ot,xt]),Dn=z?Fe.as3D(Lt,Je,ot):Fe.as3D(Lt,ot,Je),Rn=Z?Ve.as3D(tn,xt,Xe):Ve.as3D(tn,Xe,xt);le!=null&&no(cn,(ln=Bn(ln=et(le,"bias","fused matMul"),Fe)[0]).shape),De!=null&&(nn=et(De,"prelu weights","fused matMul"));var Mn={a:Dn,b:Rn};le!=null&&(Mn.bias=ln),De!=null&&(Mn.preluActivationWeights=nn);var tr=[Dn,Rn];return qe.runKernelFunc(function(ur,vr){var kr=ur.fusedBatchMatMul({a:Dn,b:Rn,transposeA:z,transposeB:Z,bias:ln,activation:we,preluActivationWeights:nn});return vr([Dn,Rn,kr]),kr},Mn,function(ur,vr){var kr=vr[0],yr=vr[1],mr=vr[2],jr=jt(ur,mr,we),Pr={};return le!=null&&(Pr={bias:function(){return $t(ln,jr)}}),Object.assign(z||Z?!z&&Z?{a:function(){return jr.matMul(yr,!1,!1)},b:function(){return jr.matMul(kr,!0,!1)}}:z&&!Z?{a:function(){return yr.matMul(jr,!1,!0)},b:function(){return kr.matMul(jr,!1,!1)}}:{a:function(){return yr.matMul(jr,!0,!0)},b:function(){return jr.matMul(kr,!0,!0)}}:{a:function(){return jr.matMul(yr,!1,!0)},b:function(){return kr.matMul(jr,!0,!1)}},Pr)},"_FusedMatMul",{transposeA:z,transposeB:Z,activation:we},tr,[!0]).reshape(cn)}}),Nn=Bt({fusedConv2d_:function(_){var m=_.x,f=_.filter,y=_.strides,E=_.pad,z=_.dataFormat,Y=z===void 0?"NHWC":z,Z=_.dilations,le=Z===void 0?[1,1]:Z,de=_.dimRoundingMode,we=_.bias,De=_.activation,Ne=De===void 0?"linear":De,Fe=_.preluActivationWeights;if(Ne=Ne||"linear",at(qe.state.gradientDepth,Ne)===!1){var Ve=Mh(m,f,y,E,Y,le,de);return we!=null&&(Ve=Pa(Ve,we)),vn(Ve,Ne,Fe)}var Je=et(m,"x","conv2d"),Xe=et(f,"filter","conv2d"),ot=Je,xt=!1;Je.rank===3&&(xt=!0,ot=Je.as4D(1,Je.shape[0],Je.shape[1],Je.shape[2])),Ee(ot.rank===4,function(){return"Error in fused conv2d: input must be rank 4, but got rank "+ot.rank+"."}),Ee(Xe.rank===4,function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+Xe.rank+"."}),de!=null&&Ee(vt(E),function(){return"Error in fused conv2d: pad must be an integer when using, dimRoundingMode "+de+" but got pad "+E+"."}),Ee(ot.shape[3]===Xe.shape[2],function(){return"Error in conv2d: depth of input ("+ot.shape[3]+") must match input depth for filter "+Xe.shape[2]+"."}),Ee(Br(y,le),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+y+" and dilations '"+le+"'"}),Ee(Y==="NHWC",function(){return"Error in conv2d: got dataFormat of "+Y+" but only NHWC is currently supported."});var kt,At,Lt=zn(ot.shape,Xe.shape,y,le,E,de);we!=null&&(kt=Bn(kt=et(we,"bias","fused conv2d"),Je)[0],no(Lt.outShape,kt.shape)),Fe!=null&&(At=et(Fe,"prelu weights","fused conv2d"));var tn={x:ot,filter:Xe};we!=null&&(tn.bias=kt),Fe!=null&&(tn.preluActivationWeights=At);var ln=[Xe,ot],nn=qe.runKernelFunc(function(cn,Dn){var Rn=cn.fusedConv2d({input:ot,filter:Xe,convInfo:Lt,bias:kt,activation:Ne,preluActivationWeights:At});return Dn([Xe,ot,Rn]),Rn},tn,function(cn,Dn){var Rn=Dn,Mn=Rn[0],tr=Rn[1],ur=Rn[2],vr=jt(cn,ur,Ne);Ee(oi(le),function(){return"Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+le+"'"});var kr={};return we!=null&&(kr={bias:function(){return $t(kt,vr)}}),Object.assign({x:function(){return Bf(tr.shape,vr,Mn,y,E)},filter:function(){return py(tr,vr,Mn.shape,y,E)}},kr)},"FusedConv2D",{convInfo:Lt,activation:Ne},ln,[!0]);return xt?nn.as3D(nn.shape[1],nn.shape[2],nn.shape[3]):nn}}),In=Bt({fusedDepthwiseConv2d_:function(_){var m=_.x,f=_.filter,y=_.strides,E=_.pad,z=_.dataFormat,Y=z===void 0?"NHWC":z,Z=_.dilations,le=Z===void 0?[1,1]:Z,de=_.dimRoundingMode,we=_.bias,De=_.activation,Ne=De===void 0?"linear":De,Fe=_.preluActivationWeights;if(at(qe.state.gradientDepth,Ne)===!1){var Ve=ev(m,f,y,E,Y,le,de);return we!=null&&(Ve=Pa(Ve,we)),vn(Ve,Ne,Fe)}var Je=et(m,"x","depthwiseConv2d"),Xe=et(f,"filter","depthwiseConv2d"),ot=Je,xt=!1;Je.rank===3&&(xt=!0,ot=Je.as4D(1,Je.shape[0],Je.shape[1],Je.shape[2])),Ee(ot.rank===4,function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got rank "+ot.rank+"."}),Ee(Xe.rank===4,function(){return"Error in fused depthwiseConv2d: filter must be rank 4, but got rank "+Xe.rank+"."}),Ee(ot.shape[3]===Xe.shape[2],function(){return"Error in fused depthwiseConv2d: number of input channels ("+ot.shape[3]+") must match the inChannels dimension in filter "+Xe.shape[2]+"."}),le==null&&(le=[1,1]),Ee(Br(y,le),function(){return"Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides "+y+" and dilations '"+le+"'"}),de!=null&&Ee(vt(E),function(){return"Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode "+de+" but got pad "+E+"."});var kt,At,Lt=zn(ot.shape,Xe.shape,y,le,E,de,!0);we!=null&&(kt=Bn(kt=et(we,"bias","fused conv2d"),Je)[0],no(Lt.outShape,kt.shape)),Fe!=null&&(At=et(Fe,"prelu weights","fused depthwiseConv2d"));var tn={x:ot,filter:Xe};we!=null&&(tn.bias=kt),Fe!=null&&(tn.preluActivationWeights=At);var ln=[Xe,ot],nn=qe.runKernelFunc(function(cn,Dn){var Rn=cn.fusedDepthwiseConv2D({input:ot,filter:Xe,convInfo:Lt,bias:kt,activation:Ne,preluActivationWeights:At});return Dn([Xe,ot,Rn]),Rn},tn,function(cn,Dn){Ee(oi(le),function(){return"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+le+"'"});var Rn=Dn[0],Mn=Dn[1],tr=Dn[2],ur=jt(cn,tr,Ne),vr={};return we!=null&&(vr={bias:function(){return $t(kt,ur)}}),Object.assign({x:function(){return my(Mn.shape,ur,Rn,Lt)},filter:function(){return Fh(Mn,ur,Rn.shape,Lt)}},vr)},"FusedDepthwiseConv2D",{convInfo:Lt,activation:Ne},ln,[!0]);return xt?nn.as3D(nn.shape[1],nn.shape[2],nn.shape[3]):nn}}),Ln=Object.freeze({matMul:wn,conv2d:Nn,depthwiseConv2d:In}),qn=Object.freeze({image:tt,linalg:U,losses:Gr,spectral:c0,fused:Ln,signal:sv,add:Pa,addN:Eh,batchNorm:kd,batchNormalization:Ao,batchNorm2d:x1,batchNormalization2d:b1,batchNorm3d:Mf,batchNormalization3d:Ed,batchNorm4d:Ah,batchNormalization4d:Up,broadcastTo:Cd,clone:Sd,div:Da,divNoNan:qg,eye:tf,multinomial:Gs,oneHot:Dl,pad:Vc,pad1d:bc,pad2d:Vp,pad3d:Gg,pad4d:K0,rand:Y0,randomGamma:Xg,randomNormal:oy,randomUniform:Jg,square:Ad,squaredDifference:Qg,tile:Th,truncatedNormal:$p,conv1d:hy,conv2d:Mh,conv3d:_1,depthwiseConv2d:ev,separableConv2d:Pf,conv2dTranspose:n0,conv3dTranspose:tv,op:Bt,booleanMaskAsync:ly,complex:zo,real:qa,imag:Os,concat:va,concat1d:Ep,concat2d:Rm,concat3d:od,concat4d:Cp,split:to,matMul:Nl,dot:nv,outerProduct:gy,reverse:Dd,reverse1d:k1,reverse2d:Hp,reverse3d:qp,reverse4d:Td,maxPool:Il,avgPool:Gp,pool:sg,maxPool3d:r0,avgPool3d:rv,maxPoolWithArgmax:yy,slice:Ks,slice1d:by,slice2d:Kp,slice3d:xy,slice4d:i0,abs:_u,acos:Kl,acosh:xs,asin:Yl,asinh:tl,atan:fh,atanh:dh,ceil:kf,clipByValue:zm,cos:nl,cosh:R0,erf:Um,exp:dd,expm1:Ug,floor:hh,log:Ef,log1p:Wm,logSigmoid:Np,neg:os,reciprocal:hd,round:ku,rsqrt:pd,sigmoid:ph,sign:Ip,isNaN:Vm,isInf:mh,isFinite:md,sin:$m,sinh:Hm,softplus:gn,sqrt:Hu,step:Yn,tan:Eu,tanh:Oo,all:ug,any:jf,argMax:wy,argMin:o0,logSumExp:a0,max:iv,mean:nf,min:s0,moments:_y,sum:Lf,prod:cg,equal:Zg,equalStrict:X0,greater:J0,greaterEqual:ig,greaterEqualStrict:Q0,greaterStrict:e0,less:ay,lessEqual:Rf,lessEqualStrict:w1,lessStrict:sy,notEqual:og,notEqualStrict:uy,addStrict:gd,atan2:gh,divStrict:fr,floorDiv:js,maximum:as,maximumStrict:ho,minimum:Mc,minimumStrict:El,mod:qu,modStrict:Cl,mul:Oa,mulStrict:rl,pow:Gu,powStrict:Mo,squaredDifferenceStrict:tu,sub:ps,subStrict:nu,elu:Bh,leakyRelu:lg,prelu:Ys,relu:u0,relu6:ov,selu:fg,logicalAnd:Wc,logicalNot:Wp,logicalOr:Oh,logicalXor:Ff,where:ef,whereAsync:Dh,buffer:Li,print:za,batchToSpaceND:Bm,cast:Pm,cumsum:jm,depthToSpace:Lg,expandDims:el,reshape:wu,spaceToBatchND:xf,squeeze:Iu,stack:cc,unstack:Sp,setdiff1dAsync:Qi,fill:xu,linspace:kp,ones:yc,range:kl,scalar:Or,tensor:Qo,tensor1d:Vu,tensor2d:uc,tensor3d:bf,tensor4d:$u,tensor5d:_p,tensor6d:Mm,variable:Fm,zeros:go,onesLike:eu,zerosLike:Ei,transpose:wt,softmax:Le,logSoftmax:Qe,localResponseNormalization:dg,norm:av,gather:ag,unsortedSegmentSum:t0,basicLSTMCell:ky,multiRNNCell:E1,movingAverage:rf,stridedSlice:Ph,topk:C1,scatterND:Ey,fft:of,ifft:zs,rfft:Yp,irfft:hg,sparseToDense:Cy,gatherND:l0,diag:Id,dropout:Mb,hannWindow:pg,hammingWindow:jh,frame:d0,stft:mg,inTopKAsync:uv});function Cn(_,m){Array.isArray(_)||(_=[_]),_.forEach(function(f){f!=null&&Ee(f.dtype!=="complex64",function(){return m+" does not support complex64 tensors."})})}function wr(_,m,f,y,E,z){for(var Y=E.strideHeight,Z=E.strideWidth,le=E.dilationHeight,de=E.dilationWidth,we=E.effectiveFilterHeight,De=E.effectiveFilterWidth,Ne=E.padInfo.top,Fe=E.padInfo.left,Ve=z==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,Je=Li(E.outShape,f),Xe=Je.values,ot=E.outShape[1]*E.outShape[2]*E.outShape[3],xt=E.outShape[2]*E.outShape[3],kt=E.outShape[3],At=0;At<E.batchSize;++At)for(var Lt=At*ot,tn=At*y[0],ln=0;ln<E.inChannels;++ln)for(var nn=0;nn<E.outHeight;++nn)for(var cn=nn*Y-Ne,Dn=Math.max(0,cn),Rn=Math.min(E.inHeight,we+cn),Mn=Lt+nn*xt,tr=0;tr<E.outWidth;++tr){for(var ur=tr*Z-Fe,vr=Math.max(0,ur),kr=Math.min(E.inWidth,De+ur),yr=Ve,mr=0,jr=0,Pr=Dn;Pr<Rn;Pr+=le){for(var ei=tn+Pr*y[1],pi=vr;pi<kr;pi+=de){var Mi=_[ei+pi*y[2]+ln];z==="max"&&Mi>yr?yr=Mi:z==="avg"&&(mr+=Mi,jr++)}if(isNaN(yr))break}Xe[Mn+tr*kt+ln]=z==="avg"?mr/jr:yr}return Je}function Fr(_,m,f,y,E,z){E===void 0&&(E=!1),z===void 0&&(z=!1);for(var Y=Li(y.outShape,"int32"),Z=y.strideHeight,le=y.strideWidth,de=y.dilationHeight,we=y.dilationWidth,De=y.effectiveFilterHeight,Ne=y.effectiveFilterWidth,Fe=y.padInfo.top,Ve=y.padInfo.left,Je=Li(m,f,_),Xe=0;Xe<y.batchSize;++Xe)for(var ot=0;ot<y.inChannels;++ot)for(var xt=0;xt<y.outHeight;++xt){for(var kt=xt*Z-Fe,At=kt;At<0;)At+=de;for(var Lt=Math.min(y.inHeight,De+kt),tn=0;tn<y.outWidth;++tn){for(var ln=tn*le-Ve,nn=ln;nn<0;)nn+=we;for(var cn=Math.min(y.inWidth,Ne+ln),Dn=Number.NEGATIVE_INFINITY,Rn=-1,Mn=At;Mn<Lt;Mn+=de)for(var tr=Mn-kt,ur=nn;ur<cn;ur+=we){var vr=ur-ln,kr=Je.get(Xe,Mn,ur,ot);kr>Dn&&(Dn=kr,Rn=E?z?((Xe*y.inHeight+Mn)*y.inWidth+ur)*y.inChannels+ot:(Mn*y.inWidth+ur)*y.inChannels+ot:tr*Ne+vr)}Y.set(Rn,Xe,xt,tn,ot)}}return Y}function Rr(_,m,f,y){if(f==="linear")return _.linear(m);if(f==="relu")return _.relu(m);if(f==="elu")return _.elu(m);if(f==="relu6")return _.relu6(m);if(f==="prelu")return _.prelu(m,y);throw new Error("Activation "+f+" has not been implemented for the CPU backend.")}var Xr=function(_){function m(){var f=_.call(this)||this;return f.blockSize=48,f.firstUse=!0,f.data=new qt(f,qe),f}return A(m,_),m.prototype.write=function(f,y,E){this.firstUse&&(this.firstUse=!1,L().get("IS_NODE")&&yf(` 3726============================ 3727Hi there ð. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details. 3728============================`));var z={};return this.data.set(z,{values:f,dtype:E}),z},m.prototype.move=function(f,y,E,z){this.data.set(f,{values:y,dtype:z})},m.prototype.numDataIds=function(){return this.data.numDataIds()},m.prototype.read=function(f){return S(this,void 0,void 0,function(){return M(this,function(y){return[2,this.readSync(f)]})})},m.prototype.readSync=function(f){var y=this.data.get(f),E=y.dtype,z=y.complexTensors;return E==="complex64"?wi(this.readSync(z.real.dataId),this.readSync(z.imag.dataId)):this.data.get(f).values},m.prototype.bufferSync=function(f){var y=this.readSync(f.dataId),E=y;if(f.dtype==="string")try{E=y.map(function(z){return Ar(z)})}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return Li(f.shape,f.dtype,E)},m.prototype.makeOutput=function(f,y,E){var z=this.write(f,y,E);return qe.makeTensorFromDataId(z,y,E,this)},m.prototype.disposeData=function(f){if(this.data.has(f)){var y=this.data.get(f).complexTensors;y!=null&&(y.real.dispose(),y.imag.dispose()),this.data.delete(f)}},m.prototype.time=function(f){return S(this,void 0,void 0,function(){var y;return M(this,function(E){return y=fn(),f(),[2,{kernelMs:fn()-y}]})})},m.prototype.memory=function(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}},m.prototype.complex=function(f,y){var E=this.makeOutput(null,f.shape,"complex64");return this.data.get(E.dataId).complexTensors={real:qe.keep(f.clone()),imag:qe.keep(y.clone())},E},m.prototype.real=function(f){return this.data.get(f.dataId).complexTensors.real.clone()},m.prototype.imag=function(f){return this.data.get(f.dataId).complexTensors.imag.clone()},m.prototype.slice=function(f,y,E){if(Cn(f,"slice"),Fp(f.shape,y,E)){var z=vh(y,f.strides),Y=Ke(E);return Qo(this.readSync(f.dataId).subarray(z,z+Y),E,f.dtype)}for(var Z=Li(E,f.dtype),le=this.bufferSync(f),de=0;de<Z.size;++de){var we=Z.indexToLoc(de).map(function(De,Ne){return De+y[Ne]});Z.values[de]=le.get.apply(le,we)}return Z.toTensor()},m.prototype.stridedSlice=function(f,y,E,z){Cn(f,"stridedSlice");var Y=Bc(y,E,z);if(Y.some(function(Fe){return Fe===0}))return Qo([],Y);for(var Z=Li(Y,f.dtype),le=this.bufferSync(f),de=0;de<Z.size;de++){for(var we=Z.indexToLoc(de),De=new Array(we.length),Ne=0;Ne<De.length;Ne++)De[Ne]=we[Ne]*z[Ne]+y[Ne];Z.set.apply(Z,[le.get.apply(le,De)].concat(we))}return Z.toTensor()},m.prototype.diag=function(f){for(var y=this.readSync(f.dataId),E=Li([f.size,f.size],f.dtype),z=E.values,Y=0;Y<y.length;Y++)z[Y*f.size+Y]=y[Y];return E.toTensor()},m.prototype.unstack=function(f,y){for(var E=f.shape[y],z=new Array(f.rank-1),Y=0,Z=0;Z<f.rank;Z++)Z!==y&&(z[Y++]=f.shape[Z]);var le=new Array(f.rank).fill(0),de=f.shape.slice();de[y]=1;var we=new Array(E);for(Z=0;Z<we.length;Z++)le[y]=Z,we[Z]=this.slice(f,le,de).reshape(z);return we},m.prototype.reverse=function(f,y){Cn(f,"reverse");for(var E=Li(f.shape,f.dtype),z=this.bufferSync(f),Y=function(le){var de=E.indexToLoc(le),we=de.slice();y.forEach(function(De){return we[De]=f.shape[De]-1-we[De]}),E.set.apply(E,[z.get.apply(z,we)].concat(de))},Z=0;Z<E.size;Z++)Y(Z);return E.toTensor()},m.prototype.concat=function(f,y){var E=this;if(f[0].dtype==="complex64"){var z=f.map(function(Fe){return qa(Fe)}),Y=f.map(function(Fe){return Os(Fe)});return zo(this.concat(z,y),this.concat(Y,y))}var Z=f.map(function(Fe){var Ve=Ke(Fe.shape.slice(y));return Fe.as2D(-1,Ve)}),le=sc(Z.map(function(Fe){return Fe.shape}),1),de=Li(le,f[0].dtype).values;if(Z[0].shape[0]===1){var we=0;Z.forEach(function(Fe){de.set(E.readSync(Fe.dataId),we),we+=Fe.size})}else{var De=0;Z.forEach(function(Fe){for(var Ve=E.readSync(Fe.dataId),Je=0,Xe=0;Xe<Fe.shape[0];++Xe)for(var ot=Xe*le[1]+De,xt=0;xt<Fe.shape[1];++xt)de[ot+xt]=Ve[Je++];De+=Fe.shape[1]})}var Ne=sc(f.map(function(Fe){return Fe.shape}),y);return Qo(de,Ne,f[0].dtype)},m.prototype.neg=function(f){return Cn(f,"neg"),this.multiply(Or(-1),f)},m.prototype.add=function(f,y){return f.dtype==="complex64"||y.dtype==="complex64"?this.broadcastedBinaryComplexOp(f.cast("complex64"),y.cast("complex64"),function(E,z,Y,Z){return{real:E+Y,imag:z+Z}}):this.broadcastedBinaryOp(f,y,kn(f.dtype,y.dtype),function(E,z){return E+z})},m.prototype.addN=function(f){var y=this;Cn(f,"addN");for(var E=f.map(function(we){return y.readSync(we.dataId)}),z=Li(f[0].shape,f[0].dtype),Y=z.values,Z=0;Z<f.length;Z++)for(var le=E[Z],de=0;de<Y.length;de++)Y[de]+=le[de];return z.toTensor()},m.prototype.softmax=function(f,y){var E=Vt([y],f.shape),z=this.max(f,E),Y=ia(z.shape,E),Z=this.subtract(f,z.reshape(Y)),le=this.exp(Z),de=this.sum(le,E).reshape(Y);return Da(le,de)},m.prototype.subtract=function(f,y){return f.dtype==="complex64"||y.dtype==="complex64"?this.broadcastedBinaryComplexOp(f.cast("complex64"),y.cast("complex64"),function(E,z,Y,Z){return{real:E-Y,imag:z-Z}}):this.broadcastedBinaryOp(f,y,kn(f.dtype,y.dtype),function(E,z){return E-z})},m.prototype.pow=function(f,y){return Cn([f,y],"pow"),this.broadcastedBinaryOp(f,y,f.dtype,function(E,z){return Math.pow(E,z)})},m.prototype.batchMatMul=function(f,y,E,z){Cn([f,y],"matMul");for(var Y=E?f.shape[1]:f.shape[2],Z=E?f.shape[2]:f.shape[1],le=z?y.shape[1]:y.shape[2],de=f.shape[0],we=this.readSync(f.dataId),De=this.readSync(y.dataId),Ne=E?[f.strides[0],1,f.strides[1]]:[f.strides[0],f.strides[1],1],Fe=Ne[0],Ve=Ne[1],Je=Ne[2],Xe=z?[1,y.strides[1],y.strides[0]]:[y.strides[1],1,y.strides[0]],ot=Xe[0],xt=Xe[1],kt=Xe[2],At=Z*le,Lt=Li([de,Z,le],f.dtype),tn=Lt.values,ln=this.blockSize,nn=0;nn<de;nn++)for(var cn=0;cn<Z;cn+=ln)for(var Dn=0;Dn<le;Dn+=ln)for(var Rn=0;Rn<Y;Rn+=ln)for(var Mn=Math.min(cn+ln,Z),tr=Math.min(Dn+ln,le),ur=Math.min(Rn+ln,Y),vr=cn;vr<Mn;vr++)for(var kr=Dn;kr<tr;kr++){for(var yr=0,mr=Rn;mr<ur;mr++)yr+=we[nn*Fe+vr*Ve+mr*Je]*De[mr*ot+kr*xt+nn*kt];tn[nn*At+(vr*le+kr)]+=yr}return Lt.toTensor()},m.prototype.fusedBatchMatMul=function(f){var y=f.a,E=f.b,z=f.transposeA,Y=f.transposeB,Z=f.bias,le=f.activation,de=f.preluActivationWeights,we=this.batchMatMul(y,E,z,Y);return Z&&(we=this.add(we,Z)),le&&(we=Rr(this,we,le,de)),we},m.prototype.multiply=function(f,y){return f.dtype==="complex64"||y.dtype==="complex64"?this.broadcastedBinaryComplexOp(f.cast("complex64"),y.cast("complex64"),function(E,z,Y,Z){return{real:E*Y-z*Z,imag:E*Z+z*Y}}):this.broadcastedBinaryOp(f,y,kn(f.dtype,y.dtype),function(E,z){return E*z})},m.prototype.floorDiv=function(f,y){return Cn([f,y],"floorDiv"),this.broadcastedBinaryOp(f,y,"int32",function(E,z){return Math.floor(E/z)})},m.prototype.sum=function(f,y){Cn(f,"sum"),Aa("sum",y,f.rank);for(var E=ra(f.shape,y),z=E[0],Y=E[1],Z=go(z,kn(f.dtype,"int32")),le=Ke(Y),de=this.readSync(Z.dataId),we=this.readSync(f.dataId),De=0;De<de.length;++De){for(var Ne=De*le,Fe=0,Ve=0;Ve<le;++Ve)Fe+=we[Ne+Ve];de[De]=Fe}return Z},m.prototype.prod=function(f,y){Cn(f,"sum");for(var E=ra(f.shape,y),z=E[0],Y=E[1],Z=go(z,kn(f.dtype,"int32")),le=Ke(Y),de=this.readSync(Z.dataId),we=this.readSync(f.dataId),De=0;De<de.length;++De){for(var Ne=De*le,Fe=1,Ve=0;Ve<le;++Ve)Fe*=we[Ne+Ve];de[De]=Fe}return Z},m.prototype.unsortedSegmentSum=function(f,y,E){Cn(f,"unsortedSegmentSum");for(var z=[],Y=f.rank-y.rank,Z=0;Z<Y;++Z)y=y.expandDims(Z+1);for(Z=0;Z<E;++Z){var le=Or(Z,"int32"),de=Zg(le,y).asType("float32").mul(f).sum(0);z.push(de)}return cc(z)},m.prototype.argMin=function(f,y){Cn(f,"argMin");var E=[y];Aa("argMin",E,f.rank);for(var z=ra(f.shape,E),Y=z[0],Z=z[1],le=go(Y,"int32"),de=Ke(Z),we=this.readSync(le.dataId),De=this.readSync(f.dataId),Ne=0;Ne<we.length;++Ne){for(var Fe=Ne*de,Ve=De[Fe],Je=0,Xe=0;Xe<de;++Xe){var ot=De[Fe+Xe];ot<Ve&&(Ve=ot,Je=Xe)}we[Ne]=Je}return le},m.prototype.argMax=function(f,y){Cn(f,"argMax");var E=[y];Aa("argMax",E,f.rank);for(var z=ra(f.shape,E),Y=z[0],Z=z[1],le=go(Y,"int32"),de=Ke(Z),we=this.readSync(le.dataId),De=this.readSync(f.dataId),Ne=0;Ne<we.length;++Ne){for(var Fe=Ne*de,Ve=De[Fe],Je=0,Xe=0;Xe<de;++Xe){var ot=De[Fe+Xe];ot>Ve&&(Ve=ot,Je=Xe)}we[Ne]=Je}return le},m.prototype.cumsum=function(f,y,E,z){if(Cn(f,"cumsum"),y!==f.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(f.rank-1)+" but got axis="+y);for(var Y=kn(f.dtype,"int32"),Z=go(f.shape,Y),le=this.readSync(Z.dataId),de=this.readSync(f.dataId),we=f.shape[f.rank-1],De=z?function(Xe,ot){return Xe+we-ot-1}:function(Xe,ot){return Xe+ot},Ne=0;Ne<de.length;Ne+=we)for(var Fe=0;Fe<we;Fe++){var Ve=De(Ne,Fe);if(Fe===0)le[Ve]=E?0:de[Ve];else{var Je=De(Ne,Fe-1);le[Ve]=E?de[Je]+le[Je]:de[Ve]+le[Je]}}return Z},m.prototype.equal=function(f,y){return Cn([f,y],"equal"),this.broadcastedBinaryOp(f,y,"bool",function(E,z){return E===z?1:0})},m.prototype.notEqual=function(f,y){return Cn([f,y],"notEqual"),this.broadcastedBinaryOp(f,y,"bool",function(E,z){return E!==z?1:0})},m.prototype.less=function(f,y){return Cn([f,y],"less"),this.broadcastedBinaryOp(f,y,"bool",function(E,z){return E<z?1:0})},m.prototype.lessEqual=function(f,y){return Cn([f,y],"lessEqual"),this.broadcastedBinaryOp(f,y,"bool",function(E,z){return E<=z?1:0})},m.prototype.greater=function(f,y){return Cn([f,y],"greater"),this.broadcastedBinaryOp(f,y,"bool",function(E,z){return E>z?1:0})},m.prototype.greaterEqual=function(f,y){return Cn([f,y],"greaterEqual"),this.broadcastedBinaryOp(f,y,"bool",function(E,z){return E>=z?1:0})},m.prototype.logicalNot=function(f){Cn(f,"logicalNot");for(var y=this.readSync(f.dataId),E=new Uint8Array(y.length),z=0;z<y.length;++z)E[z]=y[z]?0:1;return this.makeOutput(E,f.shape,"bool")},m.prototype.logicalAnd=function(f,y){return Cn([f,y],"logicalAnd"),this.broadcastedBinaryOp(f,y,"bool",function(E,z){return E&&z})},m.prototype.logicalOr=function(f,y){return Cn([f,y],"logicalOr"),this.broadcastedBinaryOp(f,y,"bool",function(E,z){return E||z})},m.prototype.select=function(f,y,E){Cn([f,y,E],"select");for(var z=this.readSync(f.dataId),Y=this.readSync(y.dataId),Z=this.readSync(E.dataId),le=go(y.shape,kn(y.dtype,E.dtype)),de=this.readSync(le.dataId),we=0,De=f.rank===0||f.rank>1||y.rank===1?1:Ke(y.shape.slice(1)),Ne=0;Ne<z.length;Ne++)for(var Fe=0;Fe<De;Fe++)z[Ne]===1?de[we++]=Y[Ne]:de[we++]=Z[Ne];return le},m.prototype.where=function(f){Cn([f],"where");var y=this.readSync(f.dataId);return Na(f.shape,y)},m.prototype.topk=function(f,y,E){return Cn(f,"topk"),Ua(this.readSync(f.dataId),f.shape,f.dtype,y)},m.prototype.min=function(f,y){Cn(f,"min"),Aa("min",y,f.rank);for(var E=ra(f.shape,y),z=E[0],Y=E[1],Z=go(z,f.dtype),le=Ke(Y),de=this.readSync(Z.dataId),we=this.readSync(f.dataId),De=0;De<de.length;++De){for(var Ne=De*le,Fe=we[Ne],Ve=0;Ve<le;++Ve){var Je=we[Ne+Ve];Je<Fe&&(Fe=Je)}de[De]=Fe}return Z},m.prototype.minimum=function(f,y){return Cn([f,y],"minimum"),this.broadcastedBinaryOp(f,y,f.dtype,function(E,z){return Math.min(E,z)})},m.prototype.mod=function(f,y){return Cn([f,y],"mod"),this.broadcastedBinaryOp(f,y,f.dtype,function(E,z){var Y=E%z;return E<0&&z<0||E>=0&&z>=0?Y:(Y+z)%z})},m.prototype.max=function(f,y){Cn(f,"max"),Aa("max",y,f.rank);for(var E=ra(f.shape,y),z=E[0],Y=E[1],Z=go(z,f.dtype),le=Ke(Y),de=this.readSync(Z.dataId),we=this.readSync(f.dataId),De=0;De<de.length;++De){for(var Ne=De*le,Fe=we[Ne],Ve=0;Ve<le;++Ve){var Je=we[Ne+Ve];Je>Fe&&(Fe=Je)}de[De]=Fe}return Z},m.prototype.maximum=function(f,y){return Cn([f,y],"maximum"),this.broadcastedBinaryOp(f,y,f.dtype,function(E,z){return Math.max(E,z)})},m.prototype.all=function(f,y){Cn(f,"all"),Aa("all",y,f.rank);for(var E=ra(f.shape,y),z=E[0],Y=E[1],Z=go(z,f.dtype),le=Ke(Y),de=this.readSync(Z.dataId),we=this.readSync(f.dataId),De=0;De<de.length;++De){for(var Ne=De*le,Fe=we[Ne],Ve=0;Ve<le;++Ve){var Je=we[Ne+Ve];Fe=Fe&&Je}de[De]=Fe}return Z},m.prototype.any=function(f,y){Cn(f,"any"),Aa("any",y,f.rank);for(var E=ra(f.shape,y),z=E[0],Y=E[1],Z=go(z,f.dtype),le=Ke(Y),de=this.readSync(Z.dataId),we=this.readSync(f.dataId),De=0;De<de.length;++De){for(var Ne=De*le,Fe=we[Ne],Ve=0;Ve<le;++Ve){var Je=we[Ne+Ve];Fe=Fe||Je}de[De]=Fe}return Z},m.prototype.squaredDifference=function(f,y){return Cn([f,y],"squaredDifference"),this.broadcastedBinaryOp(f,y,f.dtype,function(E,z){var Y=E-z;return Y*Y})},m.prototype.ceil=function(f){Cn(f,"ceil");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z)E[z]=Math.ceil(y[z]);return this.makeOutput(E,f.shape,"float32")},m.prototype.floor=function(f){Cn(f,"floor");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z)E[z]=Math.floor(y[z]);return this.makeOutput(E,f.shape,"float32")},m.prototype.sign=function(f){Cn(f,"x");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z)y[z]<0?E[z]=-1:y[z]>0?E[z]=1:E[z]=0;return this.makeOutput(E,f.shape,"float32")},m.prototype.isNaN=function(f){Cn(f,"x");for(var y=this.readSync(f.dataId),E=new Uint8Array(y.length),z=0;z<y.length;++z)Number.isNaN(y[z])&&(E[z]=1);return this.makeOutput(E,f.shape,"bool")},m.prototype.isInf=function(f){Cn(f,"x");for(var y=this.readSync(f.dataId),E=new Uint8Array(y.length),z=0;z<y.length;++z)Math.abs(y[z])===1/0&&(E[z]=1);return this.makeOutput(E,f.shape,"bool")},m.prototype.isFinite=function(f){Cn(f,"x");for(var y=this.readSync(f.dataId),E=new Uint8Array(y.length),z=0;z<y.length;++z)Number.isFinite(y[z])&&(E[z]=1);return this.makeOutput(E,f.shape,"bool")},m.prototype.round=function(f){Cn(f,"round");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z){var Y=Math.floor(y[z]);y[z]-Y<.5?E[z]=Math.floor(y[z]):y[z]-Y>.5?E[z]=Math.ceil(y[z]):E[z]=Y%2==0?Y:Y+1}return this.makeOutput(E,f.shape,"float32")},m.prototype.exp=function(f){Cn(f,"exp");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z)E[z]=Math.exp(y[z]);return this.makeOutput(E,f.shape,"float32")},m.prototype.expm1=function(f){Cn(f,"expm1");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z)E[z]=Math.expm1(y[z]);return this.makeOutput(E,f.shape,"float32")},m.prototype.log=function(f){Cn(f,"log");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z){var Y=y[z];E[z]=Math.log(Y)}return this.makeOutput(E,f.shape,"float32")},m.prototype.log1p=function(f){Cn(f,"log1p");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z){var Y=y[z];E[z]=Math.log1p(Y)}return this.makeOutput(E,f.shape,"float32")},m.prototype.sqrt=function(f){Cn(f,"sqrt");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z){var Y=y[z];E[z]=Math.sqrt(Y)}return this.makeOutput(E,f.shape,"float32")},m.prototype.rsqrt=function(f){Cn(f,"rsqrt");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z){var Y=y[z];E[z]=1/Math.sqrt(Y)}return this.makeOutput(E,f.shape,"float32")},m.prototype.reciprocal=function(f){Cn(f,"reciprocal");for(var y=this.readSync(f.dataId),E=new Float32Array(y.length),z=0;z<y.length;++z)E[z]=1/y[z];return this.makeOutput(E,f.shape,"float32")},m.prototype.linear=function(f){return f},m.prototype.relu=function(f){Cn(f,"relu");for(var y=go(f.shape,f.dtype),E=this.readSync(y.dataId),z=this.readSync(f.dataId),Y=0;Y<z.length;++Y)E[Y]=Math.max(0,z[Y]);return y},m.prototype.relu6=function(f){Cn(f,"relu");for(var y=go(f.shape,f.dtype),E=this.readSync(y.dataId),z=this.readSync(f.dataId),Y=0;Y<z.length;++Y)E[Y]=Math.min(Math.max(0,z[Y]),6);return y},m.prototype.prelu=function(f,y){return Cn([f,y],"prelu"),this.broadcastedBinaryOp(f,y,f.dtype,function(E,z){return E<0?z*E:E})},m.prototype.elu=function(f){Cn(f,"elu");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z){var Y=E[z];y[z]=Y>=0?Y:Math.exp(Y)-1}return this.makeOutput(y,f.shape,"float32")},m.prototype.eluDer=function(f,y){Cn([f,y],"eluDer");for(var E=new Float32Array(y.size),z=this.readSync(y.dataId),Y=this.readSync(f.dataId),Z=0;Z<z.length;++Z){var le=z[Z];E[Z]=le>=1?Y[Z]:Y[Z]*(le+1)}return this.makeOutput(E,y.shape,"float32")},m.prototype.selu=function(f){Cn(f,"selu");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z){var Y=E[z];y[z]=Y>=0?1.0507009873554805*Y:1.7580993408473768*(Math.exp(Y)-1)}return this.makeOutput(y,f.shape,"float32")},m.prototype.clip=function(f,y,E){Cn(f,"clip");for(var z=new Float32Array(f.size),Y=this.readSync(f.dataId),Z=0;Z<Y.length;++Z){var le=Y[Z];z[Z]=le>E?E:le<y?y:le}return this.makeOutput(z,f.shape,"float32")},m.prototype.abs=function(f){for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.abs(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.complexAbs=function(f){for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<f.size;++z){var Y=E[2*z],Z=E[2*z+1];y[z]=Math.hypot(Y,Z)}return this.makeOutput(y,f.shape,"float32")},m.prototype.int=function(f){Cn(f,"int");for(var y=new Int32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=E[z];return this.makeOutput(y,f.shape,"int32")},m.prototype.sigmoid=function(f){Cn(f,"sigmoid");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=1/(1+Math.exp(-E[z]));return this.makeOutput(y,f.shape,"float32")},m.prototype.softplus=function(f){Cn(f,"softplus");for(var y=Math.log(11920928955078125e-23)+2,E=new Float32Array(f.size),z=this.readSync(f.dataId),Y=0;Y<z.length;++Y){var Z,le=z[Y]>-y,de=z[Y]<y,we=Math.exp(z[Y]);Z=de?we:le?z[Y]:Math.log(1+we),E[Y]=Z}return this.makeOutput(E,f.shape,"float32")},m.prototype.sin=function(f){Cn(f,"sin");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.sin(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.cos=function(f){Cn(f,"cos");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.cos(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.tan=function(f){Cn(f,"tan");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.tan(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.asin=function(f){Cn(f,"asin");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.asin(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.acos=function(f){Cn(f,"acos");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.acos(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.atan=function(f){Cn(f,"atan");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.atan(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.atan2=function(f,y){return Cn([f,y],"atan2"),this.broadcastedBinaryOp(f,y,f.dtype,function(E,z){return Math.atan2(E,z)})},m.prototype.sinh=function(f){Cn(f,"sinh");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.sinh(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.cosh=function(f){Cn(f,"cosh");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.cosh(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.tanh=function(f){Cn(f,"tanh");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=yt(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.asinh=function(f){Cn(f,"asinh");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.asinh(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.acosh=function(f){Cn(f,"acosh");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.acosh(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.atanh=function(f){Cn(f,"atanh");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z)y[z]=Math.atanh(E[z]);return this.makeOutput(y,f.shape,"float32")},m.prototype.erf=function(f){Cn(f,"erf");for(var y=new Float32Array(f.size),E=this.readSync(f.dataId),z=0;z<E.length;++z){var Y=Math.sign(E[z]),Z=Math.abs(E[z]),le=1/(1+.3275911*Z);y[z]=Y*(1-((((1.061405429*le-1.453152027)*le+1.421413741)*le-.284496736)*le+.254829592)*le*Math.exp(-Z*Z))}return this.makeOutput(y,f.shape,"float32")},m.prototype.step=function(f,y){y===void 0&&(y=0),Cn(f,"step");for(var E=new Float32Array(f.size),z=this.readSync(f.dataId),Y=0;Y<z.length;++Y){var Z=z[Y];isNaN(Z)?E[Y]=NaN:E[Y]=Z>0?1:y}return this.makeOutput(E,f.shape,"float32")},m.prototype.fusedConv2d=function(f){var y=f.input,E=f.filter,z=f.convInfo,Y=f.bias,Z=f.activation,le=f.preluActivationWeights,de=this.conv2d(y,E,z);return Y&&(de=this.add(de,Y)),Z&&(de=Rr(this,de,Z,le)),de},m.prototype.conv2d=function(f,y,E){Cn([f,y],"conv2d");for(var z=E.filterHeight,Y=E.filterWidth,Z=E.dilationHeight,le=E.dilationWidth,de=E.padInfo.left,we=E.padInfo.top,De=E.dataFormat==="channelsLast",Ne=Li(E.outShape,f.dtype),Fe=f.strides[0],Ve=De?f.strides[1]:f.strides[2],Je=De?f.strides[2]:1,Xe=De?1:f.strides[1],ot=Ne.strides[0],xt=De?Ne.strides[1]:Ne.strides[2],kt=De?Ne.strides[2]:1,At=De?1:Ne.strides[1],Lt=this.readSync(f.dataId),tn=this.readSync(y.dataId),ln=Ne.values,nn=0;nn<E.batchSize;++nn)for(var cn=nn*Fe,Dn=nn*ot,Rn=0;Rn<E.outHeight;++Rn)for(var Mn=Dn+Rn*xt,tr=Rn*E.strideHeight-we,ur=0;ur<z;ur++){var vr=tr+ur*Z;if(!(vr<0||vr>=E.inHeight))for(var kr=ur*y.strides[0],yr=cn+vr*Ve,mr=0;mr<E.outWidth;++mr)for(var jr=Mn+mr*kt,Pr=mr*E.strideWidth-de,ei=0;ei<Y;ei++){var pi=Pr+ei*le;if(!(pi<0||pi>=E.inWidth))for(var Mi=yr+pi*Je,Ro=kr+ei*y.strides[1],Bo=0;Bo<E.inChannels;++Bo){for(var Zo=Lt[Mi+Bo*Xe],Jo=0;Jo<E.outChannels;++Jo)ln[jr+Jo*At]+=Zo*tn[Ro+Jo];Ro+=E.outChannels}}}return Ne.toTensor()},m.prototype.conv3d=function(f,y,E){for(var z=E.filterDepth,Y=E.filterHeight,Z=E.filterWidth,le=E.dilationDepth,de=E.dilationHeight,we=E.dilationWidth,De=E.padInfo.front,Ne=E.padInfo.left,Fe=E.padInfo.top,Ve=Li(E.outShape,f.dtype),Je=this.readSync(f.dataId),Xe=this.readSync(y.dataId),ot=Ve.values,xt=0;xt<E.batchSize;++xt)for(var kt=xt*f.strides[0],At=xt*Ve.strides[0],Lt=0;Lt<E.outDepth;++Lt)for(var tn=At+Lt*Ve.strides[1],ln=Lt*E.strideDepth-De,nn=0;nn<z;nn++){var cn=ln+nn*le;if(!(cn<0||cn>=E.inDepth))for(var Dn=nn*y.strides[0],Rn=kt+cn*f.strides[1],Mn=0;Mn<E.outHeight;++Mn)for(var tr=tn+Mn*Ve.strides[2],ur=Mn*E.strideHeight-Fe,vr=0;vr<Y;vr++){var kr=ur+vr*de;if(!(kr<0||kr>=E.inHeight))for(var yr=Dn+vr*y.strides[1],mr=Rn+kr*f.strides[2],jr=0;jr<E.outWidth;++jr)for(var Pr=tr+jr*E.outChannels,ei=jr*E.strideWidth-Ne,pi=0;pi<Z;pi++){var Mi=ei+pi*we;if(!(Mi<0||Mi>=E.inWidth))for(var Ro=yr+pi*y.strides[2],Bo=mr+Mi*E.inChannels,Zo=Ro,Jo=0;Jo<E.inChannels;++Jo){for(var ma=Je[Bo+Jo],Fa=0;Fa<E.outChannels;++Fa)ot[Pr+Fa]+=ma*Xe[Zo+Fa];Zo+=E.outChannels}}}}return Ve.toTensor()},m.prototype.conv2dDerInput=function(f,y,E){Cn([f,y],"conv2dDerInput");for(var z=Li(E.inShape,"float32"),Y=z.values,Z=this.readSync(f.dataId),le=this.readSync(y.dataId),de=y.strides,we=de[0],De=de[1],Ne=de[2],Fe=E.batchSize,Ve=E.filterHeight,Je=E.filterWidth,Xe=E.inChannels,ot=E.inHeight,xt=E.inWidth,kt=E.outChannels,At=E.outHeight,Lt=E.outWidth,tn=E.strideHeight,ln=E.strideWidth,nn=E.dataFormat,cn=Ve-1-E.padInfo.top,Dn=Je-1-E.padInfo.left,Rn=nn==="channelsLast",Mn=z.strides[0],tr=Rn?z.strides[1]:z.strides[2],ur=Rn?z.strides[2]:1,vr=Rn?1:z.strides[1],kr=f.strides[0],yr=Rn?f.strides[1]:f.strides[2],mr=Rn?f.strides[2]:1,jr=Rn?1:f.strides[1],Pr=0;Pr<Fe;++Pr)for(var ei=0;ei<Xe;++ei)for(var pi=0;pi<ot;++pi)for(var Mi=pi-cn,Ro=Math.max(0,Math.ceil(Mi/tn)),Bo=Math.min(At,(Ve+Mi)/tn),Zo=0;Zo<xt;++Zo){for(var Jo=Zo-Dn,ma=Math.max(0,Math.ceil(Jo/ln)),Fa=Math.min(Lt,(Je+Jo)/ln),Es=0,vo=Ro;vo<Bo;++vo)for(var ea=vo*tn-Mi,_a=ma;_a<Fa;++_a)for(var dc=kr*Pr+yr*vo+mr*_a,Ru=we*(Ve-1-ea)+De*(Je-1-(_a*ln-Jo))+Ne*ei,Bu=0;Bu<kt;++Bu)Es+=Z[dc+jr*Bu]*le[Ru+Bu];Y[Mn*Pr+tr*pi+ur*Zo+vr*ei]=Es}return z.toTensor()},m.prototype.conv3dDerInput=function(f,y,E){for(var z=Li(E.inShape,"float32"),Y=z.values,Z=z.strides,le=Z[0],de=Z[1],we=Z[2],De=Z[3],Ne=this.readSync(f.dataId),Fe=f.strides,Ve=Fe[0],Je=Fe[1],Xe=Fe[2],ot=Fe[3],xt=this.readSync(y.dataId),kt=y.strides,At=kt[0],Lt=kt[1],tn=kt[2],ln=kt[3],nn=E.batchSize,cn=E.filterDepth,Dn=E.filterHeight,Rn=E.filterWidth,Mn=E.inChannels,tr=E.inDepth,ur=E.inHeight,vr=E.inWidth,kr=E.outChannels,yr=E.outDepth,mr=E.outHeight,jr=E.outWidth,Pr=E.strideDepth,ei=E.strideHeight,pi=E.strideWidth,Mi=cn-1-E.padInfo.front,Ro=Dn-1-E.padInfo.top,Bo=Rn-1-E.padInfo.left,Zo=0;Zo<nn;++Zo)for(var Jo=0;Jo<Mn;++Jo)for(var ma=0;ma<tr;++ma)for(var Fa=ma-Mi,Es=Math.max(0,Math.ceil(Fa/Pr)),vo=Math.min(yr,(cn+Fa)/Pr),ea=0;ea<ur;++ea)for(var _a=ea-Ro,dc=Math.max(0,Math.ceil(_a/ei)),Ru=Math.min(mr,(Dn+_a)/ei),Bu=0;Bu<vr;++Bu){for(var rm=Bu-Bo,im=Math.max(0,Math.ceil(rm/pi)),bg=Math.min(jr,(Rn+rm)/pi),kc=0,lv=Es;lv<vo;++lv)for(var Ty=lv*Pr-Fa,om=dc;om<Ru;++om)for(var Ny=om*ei-_a,xg=im;xg<bg;++xg)for(var MA=Ve*Zo+Je*lv+Xe*om+ot*xg,Lb=At*(cn-1-Ty)+Lt*(Dn-1-Ny)+tn*(Rn-1-(xg*pi-rm))+ln*Jo,am=0;am<kr;++am)kc+=Ne[MA+am]*xt[Lb+am];Y[le*Zo+de*ma+we*ea+De*Bu+Jo]=kc}return z.toTensor()},m.prototype.conv2dDerFilter=function(f,y,E){Cn([f,y],"conv2dDerFilter");for(var z=E.strideHeight,Y=E.strideWidth,Z=E.filterHeight,le=E.filterWidth,de=E.dataFormat==="channelsLast",we=Li(E.filterShape,"float32"),De=E.padInfo.left,Ne=E.padInfo.top,Fe=this.bufferSync(f),Ve=this.bufferSync(y),Je=0;Je<Z;++Je)for(var Xe=Math.max(0,Math.ceil((Ne-Je)/z)),ot=Math.min(E.outHeight,(E.inHeight+Ne-Je)/z),xt=0;xt<le;++xt)for(var kt=Math.max(0,Math.ceil((De-xt)/Y)),At=Math.min(E.outWidth,(E.inWidth+De-xt)/Y),Lt=0;Lt<E.inChannels;++Lt)for(var tn=0;tn<E.outChannels;++tn){for(var ln=0,nn=0;nn<E.batchSize;++nn)for(var cn=Xe;cn<ot;++cn)for(var Dn=Je+cn*z-Ne,Rn=kt;Rn<At;++Rn){var Mn=xt+Rn*Y-De;ln+=de?Fe.get(nn,Dn,Mn,Lt)*Ve.get(nn,cn,Rn,tn):Fe.get(nn,Lt,Dn,Mn)*Ve.get(nn,tn,cn,Rn)}we.set(ln,Je,xt,Lt,tn)}return we.toTensor()},m.prototype.conv3dDerFilter=function(f,y,E){for(var z=E.strideDepth,Y=E.strideHeight,Z=E.strideWidth,le=E.filterDepth,de=E.filterHeight,we=E.filterWidth,De=Li(E.filterShape,"float32"),Ne=De.values,Fe=De.strides,Ve=Fe[0],Je=Fe[1],Xe=Fe[2],ot=Fe[3],xt=this.readSync(y.dataId),kt=y.strides,At=kt[0],Lt=kt[1],tn=kt[2],ln=kt[3],nn=this.readSync(f.dataId),cn=f.strides,Dn=cn[0],Rn=cn[1],Mn=cn[2],tr=cn[3],ur=E.padInfo.front,vr=E.padInfo.left,kr=E.padInfo.top,yr=0;yr<le;++yr)for(var mr=Math.max(0,Math.ceil((ur-yr)/z)),jr=Math.min(E.outDepth,(E.inDepth+ur-yr)/z),Pr=yr*Ve,ei=0;ei<de;++ei)for(var pi=Math.max(0,Math.ceil((kr-ei)/Y)),Mi=Math.min(E.outHeight,(E.inHeight+kr-ei)/Y),Ro=ei*Je+Pr,Bo=0;Bo<we;++Bo)for(var Zo=Math.max(0,Math.ceil((vr-Bo)/Z)),Jo=Math.min(E.outWidth,(E.inWidth+vr-Bo)/Z),ma=Bo*Xe+Ro,Fa=0;Fa<E.inChannels;++Fa)for(var Es=Fa*ot+ma,vo=0;vo<E.outChannels;++vo){for(var ea=0,_a=0;_a<E.batchSize;++_a)for(var dc=_a*Dn,Ru=_a*At,Bu=mr;Bu<jr;++Bu)for(var rm=(yr+Bu*z-ur)*Rn+dc,im=Bu*Lt+Ru,bg=pi;bg<Mi;++bg)for(var kc=(ei+bg*Y-kr)*Mn+rm,lv=bg*tn+im,Ty=Zo;Ty<Jo;++Ty){var om=Ty*ln+lv;ea+=nn[(Bo+Ty*Z-vr)*tr+kc+Fa]*xt[om+vo]}Ne[Es+vo]=ea}return De.toTensor()},m.prototype.fusedDepthwiseConv2D=function(f){var y=f.input,E=f.filter,z=f.convInfo,Y=f.bias,Z=f.activation,le=f.preluActivationWeights,de=this.depthwiseConv2D(y,E,z);return Y&&(de=this.add(de,Y)),Z&&(de=Rr(this,de,Z,le)),de},m.prototype.depthwiseConv2D=function(f,y,E){Cn([f,y],"depthwiseConv2D");for(var z=E.filterHeight,Y=E.filterWidth,Z=E.dilationHeight,le=E.dilationWidth,de=E.padInfo.left,we=E.padInfo.top,De=E.outChannels/E.inChannels,Ne=Li(E.outShape,f.dtype),Fe=this.readSync(f.dataId),Ve=this.readSync(y.dataId),Je=Ne.values,Xe=0;Xe<E.batchSize;++Xe)for(var ot=Xe*f.strides[0],xt=Xe*Ne.strides[0],kt=0;kt<E.outHeight;++kt)for(var At=xt+kt*Ne.strides[1],Lt=kt*E.strideHeight-de,tn=0;tn<z;++tn){var ln=Lt+tn*Z;if(!(ln<0||ln>=E.inHeight))for(var nn=tn*y.strides[0],cn=ot+ln*f.strides[1],Dn=0;Dn<E.outWidth;++Dn)for(var Rn=At+Dn*Ne.strides[2],Mn=Dn*E.strideWidth-we,tr=0;tr<Y;++tr){var ur=Mn+tr*le;if(!(ur<0||ur>=E.inWidth))for(var vr=nn+tr*y.strides[1],kr=cn+ur*E.inChannels,yr=Rn,mr=vr,jr=0;jr<E.inChannels;++jr){for(var Pr=Fe[kr+jr],ei=0;ei<De;++ei)Je[yr+ei]+=Pr*Ve[mr+ei];yr+=De,mr+=De}}}return Ne.toTensor()},m.prototype.depthwiseConv2DDerInput=function(f,y,E){Cn([f,y],"depthwiseConv2DDerInput");for(var z=Li(E.inShape,"float32"),Y=z.values,Z=z.strides,le=Z[0],de=Z[1],we=Z[2],De=this.readSync(f.dataId),Ne=f.strides,Fe=Ne[0],Ve=Ne[1],Je=Ne[2],Xe=this.readSync(y.dataId),ot=y.strides,xt=ot[0],kt=ot[1],At=ot[2],Lt=E.batchSize,tn=E.filterHeight,ln=E.filterWidth,nn=E.inChannels,cn=E.inHeight,Dn=E.inWidth,Rn=E.outChannels,Mn=E.outHeight,tr=E.outWidth,ur=E.strideHeight,vr=E.strideWidth,kr=tn-1-E.padInfo.top,yr=ln-1-E.padInfo.left,mr=Rn/nn,jr=0;jr<Lt;++jr)for(var Pr=0;Pr<nn;++Pr)for(var ei=0;ei<cn;++ei)for(var pi=ei-kr,Mi=Math.max(0,Math.ceil(pi/ur)),Ro=Math.min(Mn,(tn+pi)/ur),Bo=0;Bo<Dn;++Bo){for(var Zo=Bo-yr,Jo=Math.max(0,Math.ceil(Zo/vr)),ma=Math.min(tr,(ln+Zo)/vr),Fa=0,Es=Mi;Es<Ro;++Es)for(var vo=Es*ur-pi,ea=Jo;ea<ma;++ea)for(var _a=Fe*jr+Ve*Es+Je*ea,dc=xt*(tn-1-vo)+kt*(ln-1-(ea*vr-Zo))+At*Pr,Ru=0;Ru<mr;++Ru)Fa+=De[_a+(Pr*mr+Ru)]*Xe[dc+Ru];Y[le*jr+de*ei+we*Bo+Pr]=Fa}return z.toTensor()},m.prototype.depthwiseConv2DDerFilter=function(f,y,E){Cn([f,y],"depthwiseConv2DDerFilter");for(var z=E.strideHeight,Y=E.strideWidth,Z=E.filterHeight,le=E.filterWidth,de=Li(E.filterShape,"float32"),we=E.padInfo.left,De=E.padInfo.top,Ne=E.outChannels/E.inChannels,Fe=this.bufferSync(f),Ve=this.bufferSync(y),Je=0;Je<Z;++Je)for(var Xe=Math.max(0,Math.ceil((De-Je)/z)),ot=Math.min(E.outHeight,(E.inHeight+De-Je)/z),xt=0;xt<le;++xt)for(var kt=Math.max(0,Math.ceil((we-xt)/Y)),At=Math.min(E.outWidth,(E.inWidth+we-xt)/Y),Lt=0;Lt<E.outChannels;++Lt){for(var tn=Math.trunc(Lt/Ne),ln=Lt%Ne,nn=0,cn=0;cn<E.batchSize;++cn)for(var Dn=Xe;Dn<ot;++Dn)for(var Rn=Je+Dn*z-De,Mn=kt;Mn<At;++Mn){var tr=xt+Mn*Y-we;nn+=Fe.get(cn,Rn,tr,tn)*Ve.get(cn,Dn,Mn,Lt)}de.set(nn,Je,xt,tn,ln)}return de.toTensor()},m.prototype.tile=function(f,y){return Cn(f,"tile"),Qa(this.bufferSync(f),y)},m.prototype.pad=function(f,y,E){Cn(f,"pad");var z=y.map(function(Ne,Fe){return Ne[0]+f.shape[Fe]+Ne[1]}),Y=y.map(function(Ne){return Ne[0]}),Z=this.bufferSync(f),le=Li(z,f.dtype);E!==0&&le.values.fill(E);for(var de=0;de<f.size;de++){var we=Z.indexToLoc(de),De=we.map(function(Ne,Fe){return Ne+Y[Fe]});le.set.apply(le,[Z.get.apply(Z,we)].concat(De))}return le.toTensor()},m.prototype.gather=function(f,y,E){Cn([f,y],"gather");var z=f.shape.slice(),Y=this.readSync(y.dataId);z[E]=Y.length;for(var Z=Li(z,f.dtype),le=this.bufferSync(f),de=0;de<Z.size;++de){var we=Z.indexToLoc(de),De=we.slice();De[E]=Y[we[E]];var Ne=le.locToIndex(De);Z.values[de]=le.values[Ne]}return Z.toTensor()},m.prototype.batchToSpaceND=function(f,y,E){Cn([f],"batchToSpaceND");var z=y.reduce(function(De,Ne){return De*Ne}),Y=ch(f.shape,y,z),Z=wf(Y.length,y.length),le=ad(f.shape,y,z),de=Lm(E,y.length),we=zg(le,E,y.length);return wt(f.reshape(Y),Z).reshape(le).slice(de,we)},m.prototype.spaceToBatchND=function(f,y,E){Cn([f],"spaceToBatchND");var z=y.reduce(function(Ne,Fe){return Ne*Fe}),Y=[[0,0]];Y.push.apply(Y,E);for(var Z=1+y.length;Z<f.shape.length;++Z)Y.push([0,0]);var le=f.pad(Y),de=ch(le.shape,y,z,!1),we=wf(de.length,y.length,!1),De=ad(le.shape,y,z,!1);return wt(le.reshape(de),we).reshape(De)},m.prototype.maxPool=function(f,y){return Cn(f,"maxPool"),wr(this.readSync(f.dataId),f.shape,f.dtype,f.strides,y,"max").toTensor()},m.prototype.maxPoolBackprop=function(f,y,E,z){Cn([y,E],"maxPoolBackprop");for(var Y=this.readSync(y.dataId),Z=Li(z.outShape,y.dtype,Fr(Y,y.shape,y.dtype,z).values),le=z.strideHeight,de=z.strideWidth,we=z.dilationHeight,De=z.dilationWidth,Ne=z.effectiveFilterHeight,Fe=z.effectiveFilterWidth,Ve=Fe-1-z.padInfo.left,Je=Ne-1-z.padInfo.top,Xe=Li(y.shape,"float32"),ot=this.bufferSync(f),xt=0;xt<z.batchSize;++xt)for(var kt=0;kt<z.inChannels;++kt)for(var At=0;At<z.inHeight;++At)for(var Lt=0;Lt<z.inWidth;++Lt){for(var tn=At-Je,ln=Lt-Ve,nn=0,cn=0;cn<Ne;cn+=we){var Dn=(tn+cn)/le;if(!(Dn<0||Dn>=z.outHeight||Math.floor(Dn)!==Dn))for(var Rn=0;Rn<Fe;Rn+=De){var Mn=(ln+Rn)/de;if(!(Mn<0||Mn>=z.outWidth||Math.floor(Mn)!==Mn)){var tr=Ne*Fe-1-Z.get(xt,Dn,Mn,kt)===cn*Fe+Rn?1:0;tr!==0&&(nn+=ot.get(xt,Dn,Mn,kt)*tr)}}}Xe.set(nn,xt,At,Lt,kt)}return Xe.toTensor()},m.prototype.avgPoolBackprop=function(f,y,E){Cn([f,y],"avgPoolBackprop");for(var z=E.strideHeight,Y=E.strideWidth,Z=E.filterHeight,le=E.filterWidth,de=E.dilationHeight,we=E.dilationWidth,De=E.effectiveFilterHeight,Ne=E.effectiveFilterWidth,Fe=Ne-1-E.padInfo.left,Ve=De-1-E.padInfo.top,Je=Li(y.shape,"float32"),Xe=1/(Z*le),ot=this.bufferSync(f),xt=0;xt<E.batchSize;++xt)for(var kt=0;kt<E.inChannels;++kt)for(var At=0;At<E.inHeight;++At)for(var Lt=0;Lt<E.inWidth;++Lt){for(var tn=At-Ve,ln=Lt-Fe,nn=0,cn=0;cn<De;cn+=de){var Dn=(tn+cn)/z;if(!(Dn<0||Dn>=E.outHeight||Math.floor(Dn)!==Dn))for(var Rn=0;Rn<Ne;Rn+=we){var Mn=(ln+Rn)/Y;Mn<0||Mn>=E.outWidth||Math.floor(Mn)!==Mn||(nn+=ot.get(xt,Dn,Mn,kt))}}Je.set(nn*Xe,xt,At,Lt,kt)}return Je.toTensor()},m.prototype.pool3d=function(f,y,E){Cn(f,"pool3d");for(var z=y.strideDepth,Y=y.strideHeight,Z=y.strideWidth,le=y.dilationDepth,de=y.dilationHeight,we=y.dilationWidth,De=y.effectiveFilterDepth,Ne=y.effectiveFilterHeight,Fe=y.effectiveFilterWidth,Ve=y.padInfo.front,Je=y.padInfo.top,Xe=y.padInfo.left,ot=E==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,xt=this.readSync(f.dataId),kt=Li(y.outShape,f.dtype),At=kt.values,Lt=y.outShape[1]*y.outShape[2]*y.outShape[3]*y.outShape[4],tn=y.outShape[2]*y.outShape[3]*y.outShape[4],ln=y.outShape[3]*y.outShape[4],nn=y.outShape[4],cn=0;cn<y.batchSize;++cn)for(var Dn=cn*Lt,Rn=cn*f.strides[0],Mn=0;Mn<y.inChannels;++Mn)for(var tr=0;tr<y.outDepth;++tr){for(var ur=tr*z-Ve,vr=ur;vr<0;)vr+=le;for(var kr=Math.min(y.inDepth,De+ur),yr=Dn+tr*tn,mr=0;mr<y.outHeight;++mr){for(var jr=mr*Y-Je,Pr=jr;Pr<0;)Pr+=de;for(var ei=Math.min(y.inHeight,Ne+jr),pi=yr+mr*ln,Mi=0;Mi<y.outWidth;++Mi){for(var Ro=Mi*Z-Xe,Bo=Ro;Bo<0;)Bo+=we;for(var Zo=Math.min(y.inWidth,Fe+Ro),Jo=pi+Mi*nn,ma=ot,Fa=0,Es=0,vo=vr;vo<kr;vo+=le){for(var ea=Rn+vo*f.strides[1],_a=Pr;_a<ei;_a+=de){for(var dc=ea+_a*f.strides[2],Ru=Bo;Ru<Zo;Ru+=we){var Bu=xt[dc+Ru*f.strides[3]+Mn];if(E==="max"&&Bu>ma?ma=Bu:E==="avg"&&(Fa+=Bu,Es++),isNaN(ma))break}if(isNaN(ma))break}if(isNaN(ma))break}At[Jo+Mn]=E==="avg"?Fa/Es:ma}}}return kt.toTensor()},m.prototype.avgPool3d=function(f,y){return Cn(f,"avgPool3d"),this.pool3d(f,y,"avg").toFloat()},m.prototype.avgPool3dBackprop=function(f,y,E){Cn([f,y],"avgPool3dBackprop");for(var z=E.strideDepth,Y=E.strideHeight,Z=E.strideWidth,le=E.filterDepth,de=E.filterHeight,we=E.filterWidth,De=E.dilationDepth,Ne=E.dilationHeight,Fe=E.dilationWidth,Ve=E.effectiveFilterDepth,Je=E.effectiveFilterHeight,Xe=E.effectiveFilterWidth,ot=Ve-1-E.padInfo.front,xt=Xe-1-E.padInfo.left,kt=Je-1-E.padInfo.top,At=Li(y.shape,"float32"),Lt=1/(le*de*we),tn=this.bufferSync(f),ln=0;ln<E.batchSize;++ln)for(var nn=0;nn<E.inChannels;++nn)for(var cn=0;cn<E.inDepth;++cn)for(var Dn=0;Dn<E.inHeight;++Dn)for(var Rn=0;Rn<E.inWidth;++Rn){for(var Mn=cn-ot,tr=Dn-kt,ur=Rn-xt,vr=0,kr=0;kr<Ve;kr+=De){var yr=(Mn+kr)/z;if(!(yr<0||yr>=E.outDepth||Math.floor(yr)!==yr))for(var mr=0;mr<Je;mr+=Ne){var jr=(tr+mr)/Y;if(!(jr<0||jr>=E.outHeight||Math.floor(jr)!==jr))for(var Pr=0;Pr<Xe;Pr+=Fe){var ei=(ur+Pr)/Z;ei<0||ei>=E.outWidth||Math.floor(ei)!==ei||(vr+=tn.get(ln,yr,jr,ei,nn))}}}At.set(vr*Lt,ln,cn,Dn,Rn,nn)}return At.toTensor()},m.prototype.maxPool3d=function(f,y){return Cn(f,"maxPool3d"),this.pool3d(f,y,"max").toFloat()},m.prototype.maxPool3dPositions=function(f,y){for(var E=Li(y.outShape,"int32"),z=y.strideDepth,Y=y.strideHeight,Z=y.strideWidth,le=y.dilationDepth,de=y.dilationHeight,we=y.dilationWidth,De=y.effectiveFilterDepth,Ne=y.effectiveFilterHeight,Fe=y.effectiveFilterWidth,Ve=y.padInfo.front,Je=y.padInfo.top,Xe=y.padInfo.left,ot=this.bufferSync(f),xt=0;xt<y.batchSize;++xt)for(var kt=0;kt<y.inChannels;++kt)for(var At=0;At<y.outDepth;++At){for(var Lt=At*z-Ve,tn=Lt;tn<0;)tn+=le;for(var ln=Math.min(y.inDepth,De+Lt),nn=0;nn<y.outHeight;++nn){for(var cn=nn*Y-Je,Dn=cn;Dn<0;)Dn+=de;for(var Rn=Math.min(y.inHeight,Ne+cn),Mn=0;Mn<y.outWidth;++Mn){for(var tr=Mn*Z-Xe,ur=tr;ur<0;)ur+=we;for(var vr=Math.min(y.inWidth,Fe+tr),kr=Number.NEGATIVE_INFINITY,yr=-1,mr=tn;mr<ln;mr+=le)for(var jr=mr-Lt,Pr=Dn;Pr<Rn;Pr+=de)for(var ei=Pr-cn,pi=ur;pi<vr;pi+=we){var Mi=pi-tr,Ro=ot.get(xt,mr,Pr,pi,kt);Ro>=kr&&(kr=Ro,yr=jr*Ne*Fe+ei*Ne+Mi)}E.set(yr,xt,At,nn,Mn,kt)}}}return E.toTensor()},m.prototype.maxPool3dBackprop=function(f,y,E,z){Cn([y,E],"maxPool3dBackprop");for(var Y=this.maxPool3dPositions(y,z),Z=z.strideDepth,le=z.strideHeight,de=z.strideWidth,we=z.dilationDepth,De=z.dilationHeight,Ne=z.dilationWidth,Fe=z.effectiveFilterDepth,Ve=z.effectiveFilterHeight,Je=z.effectiveFilterWidth,Xe=Fe-1-z.padInfo.front,ot=Je-1-z.padInfo.left,xt=Ve-1-z.padInfo.top,kt=Li(y.shape,"float32"),At=this.bufferSync(Y),Lt=this.bufferSync(f),tn=0;tn<z.batchSize;++tn)for(var ln=0;ln<z.inChannels;++ln)for(var nn=0;nn<z.inDepth;++nn)for(var cn=0;cn<z.inHeight;++cn)for(var Dn=0;Dn<z.inWidth;++Dn){for(var Rn=nn-Xe,Mn=cn-xt,tr=Dn-ot,ur=0,vr=0;vr<Fe;vr+=we){var kr=(Rn+vr)/Z;if(!(kr<0||kr>=z.outDepth||Math.floor(kr)!==kr))for(var yr=0;yr<Ve;yr+=De){var mr=(Mn+yr)/le;if(!(mr<0||mr>=z.outHeight||Math.floor(mr)!==mr))for(var jr=0;jr<Je;jr+=Ne){var Pr=(tr+jr)/de;if(!(Pr<0||Pr>=z.outWidth||Math.floor(Pr)!==Pr)){var ei=Fe*Ve*Je-1-At.get(tn,kr,mr,Pr,ln)===vr*Ve*Je+yr*Je+jr?1:0;ei!==0&&(ur+=Lt.get(tn,kr,mr,Pr,ln)*ei)}}}}kt.set(ur,tn,nn,cn,Dn,ln)}return kt.toTensor()},m.prototype.cast=function(f,y){return ii(f,y,this)},m.prototype.reshape=function(f,y){return Ci(f,y)},m.prototype.avgPool=function(f,y){return Cn(f,"avgPool"),Cn(f,"maxPool"),wr(this.readSync(f.dataId),f.shape,f.dtype,f.strides,y,"avg").toTensor().toFloat()},m.prototype.resizeBilinear=function(f,y,E,z){Cn(f,"resizeBilinear");for(var Y=f.shape,Z=Y[0],le=Y[1],de=Y[2],we=Y[3],De=this.readSync(f.dataId),Ne=new Float32Array(Ke([Z,y,E,we])),Fe=[z&&y>1?le-1:le,z&&E>1?de-1:de],Ve=[z&&y>1?y-1:y,z&&E>1?E-1:E],Je=0,Xe=Fe[0]/Ve[0],ot=Fe[1]/Ve[1],xt=0;xt<Z;xt++)for(var kt=0;kt<y;kt++)for(var At=Xe*kt,Lt=Math.floor(At),tn=At-Lt,ln=Math.min(le-1,Math.ceil(At)),nn=xt*f.strides[0]+Lt*f.strides[1],cn=xt*f.strides[0]+ln*f.strides[1],Dn=0;Dn<E;Dn++)for(var Rn=ot*Dn,Mn=Math.floor(Rn),tr=Rn-Mn,ur=Math.min(de-1,Math.ceil(Rn)),vr=nn+Mn*f.strides[2],kr=cn+Mn*f.strides[2],yr=nn+ur*f.strides[2],mr=cn+ur*f.strides[2],jr=0;jr<we;jr++){var Pr=De[vr+jr],ei=De[kr+jr],pi=Pr+(De[yr+jr]-Pr)*tr,Mi=pi+(ei+(De[mr+jr]-ei)*tr-pi)*tn;Ne[Je++]=Mi}return Qo(Ne,[Z,y,E,we])},m.prototype.resizeBilinearBackprop=function(f,y,E){Cn([f,y],"resizeBilinearBackprop");for(var z=y.shape,Y=z[0],Z=z[1],le=z[2],de=z[3],we=f.shape,De=we[1],Ne=we[2],Fe=new Float32Array(Y*Z*le*de),Ve=[E&&De>1?Z-1:Z,E&&Ne>1?le-1:le],Je=[E&&De>1?De-1:De,E&&Ne>1?Ne-1:Ne],Xe=Ve[0]/Je[0],ot=Ve[1]/Je[1],xt=this.readSync(f.dataId),kt=0,At=0;At<Y;At++)for(var Lt=At*y.strides[0],tn=0;tn<De;tn++)for(var ln=tn*Xe,nn=Math.floor(ln),cn=Math.min(Math.ceil(ln),Z-1),Dn=Lt+nn*y.strides[1],Rn=Lt+cn*y.strides[1],Mn=ln-nn,tr=1-Mn,ur=0;ur<Ne;ur++)for(var vr=ur*ot,kr=Math.floor(vr),yr=Math.min(Math.ceil(vr),le-1),mr=vr-kr,jr=1-mr,Pr=Dn+kr*y.strides[2],ei=Dn+yr*y.strides[2],pi=Rn+kr*y.strides[2],Mi=Rn+yr*y.strides[2],Ro=tr*jr,Bo=tr*mr,Zo=Mn*jr,Jo=Mn*mr,ma=0;ma<de;ma++){var Fa=xt[kt++];Fe[Pr+ma]+=Fa*Ro,Fe[ei+ma]+=Fa*Bo,Fe[pi+ma]+=Fa*Zo,Fe[Mi+ma]+=Fa*Jo}return $u(Fe,[Y,le,Z,de],y.dtype)},m.prototype.resizeNearestNeighbor=function(f,y,E,z){Cn(f,"resizeNearestNeighbor");for(var Y=f.shape,Z=Y[0],le=Y[1],de=Y[2],we=Y[3],De=this.readSync(f.dataId),Ne=new Float32Array(Z*y*E*we),Fe=[z&&y>1?le-1:le,z&&E>1?de-1:de],Ve=[z&&y>1?y-1:y,z&&E>1?E-1:E],Je=Fe[0]/Ve[0],Xe=Fe[1]/Ve[1],ot=0,xt=0;xt<Z;xt++)for(var kt=xt*f.strides[0],At=0;At<y;At++)for(var Lt=Je*At,tn=kt+Math.min(le-1,z?Math.round(Lt):Math.floor(Lt))*f.strides[1],ln=0;ln<E;ln++)for(var nn=Xe*ln,cn=tn+Math.min(de-1,z?Math.round(nn):Math.floor(nn))*f.strides[2],Dn=0;Dn<we;Dn++){var Rn=De[cn+Dn];Ne[ot++]=Rn}return Qo(Ne,[Z,y,E,we],f.dtype)},m.prototype.resizeNearestNeighborBackprop=function(f,y,E){Cn([f,y],"resizeNearestNeighborBackprop");for(var z=y.shape,Y=z[0],Z=z[1],le=z[2],de=z[3],we=f.shape,De=we[1],Ne=we[2],Fe=new Float32Array(Y*Z*le*de),Ve=this.readSync(f.dataId),Je=[E&&De>1?Z-1:Z,E&&Ne>1?le-1:le],Xe=[E&&De>1?De-1:De,E&&Ne>1?Ne-1:Ne],ot=Je[0]/Xe[0],xt=Je[1]/Xe[1],kt=1/ot,At=1/xt,Lt=2*Math.ceil(kt)+2,tn=2*Math.ceil(At)+2,ln=0;ln<Y;ln++)for(var nn=ln*y.strides[0],cn=0;cn<Z;cn++)for(var Dn=nn+cn*y.strides[1],Rn=Math.floor(cn*kt),Mn=Math.floor(Rn-Lt/2),tr=0;tr<le;tr++)for(var ur=Dn+tr*y.strides[2],vr=Math.floor(tr*At),kr=Math.floor(vr-tn/2),yr=0;yr<de;yr++){for(var mr=0,jr=0;jr<Lt;jr++){var Pr=jr+Mn;if(!(Pr<0||Pr>=De)){var ei=nn+Pr*f.strides[1],pi=Pr*ot;if(cn===Math.min(Z-1,E?Math.round(pi):Math.floor(pi)))for(var Mi=0;Mi<tn;Mi++){var Ro=Mi+kr;if(!(Ro<0||Ro>=Ne)){var Bo=ei+Ro*f.strides[2],Zo=Ro*xt;tr===Math.min(le-1,E?Math.round(Zo):Math.floor(Zo))&&(mr+=Ve[Bo+yr])}}}}Fe[ur+yr]=mr}return $u(Fe,y.shape,y.dtype)},m.prototype.batchNormalization=function(f,y,E,z,Y,Z){Cn([f,y,E,Y,Z],"batchNorm");for(var le=this.readSync(f.dataId),de=this.readSync(y.dataId),we=this.readSync(E.dataId),De=Y?this.readSync(Y.dataId):new Float32Array([1]),Ne=Z?this.readSync(Z.dataId):new Float32Array([0]),Fe=new Float32Array(le.length),Ve=Ne.length,Je=De.length,Xe=we.length,ot=de.length,xt=0,kt=0,At=0,Lt=0,tn=0;tn<le.length;++tn)Fe[tn]=Ne[xt++]+(le[tn]-de[kt++])*De[At++]/Math.sqrt(we[Lt++]+z),xt>=Ve&&(xt=0),kt>=ot&&(kt=0),At>=Je&&(At=0),Lt>=Xe&&(Lt=0);return $u(Fe,f.shape)},m.prototype.localResponseNormalization4D=function(f,y,E,z,Y){Cn(f,"localResponseNormalization4D");var Z=f.shape[3],le=Z-1,de=this.readSync(f.dataId),we=f.size,De=new Float32Array(we);function Ne(Xe){for(var ot=Xe%Z,xt=Xe-ot+Math.max(0,ot-y),kt=Xe-ot+Math.min(ot+y,le),At=0;xt<=kt;xt++){var Lt=de[xt];At+=Lt*Lt}return At}for(var Fe=0;Fe<we;Fe++){var Ve=Ne(Fe),Je=de[Fe]*Math.pow(E+z*Ve,-Y);De[Fe]=Je}return $u(De,f.shape)},m.prototype.LRNGrad=function(f,y,E,z,Y,Z,le){Cn(f,"LRNGrad");for(var de=f.shape[3],we=this.readSync(f.dataId),De=this.readSync(y.dataId),Ne=this.readSync(E.dataId),Fe=new Float32Array(f.size),Ve=f.size,Je=0;Je<Ve;Je++){for(var Xe=Je%de,ot=Je-Xe+Math.max(0,Xe-z),xt=Je-Xe+Math.min(de,Xe+z+1),kt=0,At=ot;At<xt;At++)kt+=Math.pow(De[At],2);for(kt=Z*kt+Y,At=ot;At<xt;At++){var Lt=-2*Z*le*De[At]*Ne[Je]/kt;Je===At&&(Lt+=Math.pow(kt,-le)),Lt*=we[Je],Fe[At]+=Lt}}return $u(Fe,f.shape)},m.prototype.multinomial=function(f,y,E,z){Cn(f,"multinomial");for(var Y=y?f:Le(f),Z=Y.shape[0],le=Y.shape[1],de=go([Z,E],"int32"),we=this.readSync(de.dataId),De=this.readSync(Y.dataId),Ne=0;Ne<Z;++Ne){var Fe=Ne*le,Ve=new Float32Array(le-1);Ve[0]=De[Fe];for(var Je=1;Je<Ve.length;++Je)Ve[Je]=Ve[Je-1]+De[Fe+Je];for(var Xe=Lp(z.toString()),ot=Ne*E,xt=0;xt<E;++xt){var kt=Xe();we[ot+xt]=Ve.length;for(var At=0;At<Ve.length;At++)if(kt<Ve[At]){we[ot+xt]=At;break}}}return de},m.prototype.oneHot=function(f,y,E,z){Cn(f,"oneHot");var Y=new Float32Array(f.size*y);Y.fill(z);for(var Z=this.readSync(f.dataId),le=0;le<f.size;++le)Z[le]>=0&&Z[le]<y&&(Y[le*y+Z[le]]=E);return uc(Y,[f.size,y],"int32")},m.prototype.nonMaxSuppression=function(f,y,E,z,Y){return Cn(f,"nonMaxSuppression"),ja(this.readSync(f.dataId),this.readSync(y.dataId),E,z,Y)},m.prototype.fft=function(f){return this.fftBatch(f,!1)},m.prototype.ifft=function(f){return this.fftBatch(f,!0)},m.prototype.fftBatch=function(f,y){for(var E=f.shape[0],z=f.shape[1],Y=Li(f.shape,"float32"),Z=Li(f.shape,"float32"),le=qa(f).as2D(E,z),de=Os(f).as2D(E,z),we=0;we<E;we++)for(var De=le.slice([we,0],[1,z]),Ne=de.slice([we,0],[1,z]),Fe=zo(De,Ne),Ve=this.readSync(this.fftImpl(Fe,y).dataId),Je=0;Je<z;Je++){var Xe=Co(Ve,Je);Y.values[we*z+Je]=Xe.real,Z.values[we*z+Je]=Xe.imag}return zo(Y.toTensor(),Z.toTensor()).as2D(E,z)},m.prototype.fftImpl=function(f,y){var E=f.as1D(),z=E.size;if(this.isExponentOf2(z)){var Y=this.fftRadix2(E,z,y).as2D(f.shape[0],f.shape[1]);return y&&(Y=zo(qa(Y).div(Or(z)),Os(Y).div(Or(z)))),Y}var Z=this.readSync(f.dataId),le=function(de){for(var we=new Float32Array(de.length/2),De=new Float32Array(de.length/2),Ne=0;Ne<de.length;Ne+=2)we[Ne/2]=de[Ne],De[Ne/2]=de[Ne+1];return{real:we,imag:De}}(this.fourierTransformByMatmul(Z,z,y));return zo(le.real,le.imag).as2D(f.shape[0],f.shape[1])},m.prototype.isExponentOf2=function(f){return(f&f-1)==0},m.prototype.fftRadix2=function(f,y,E){if(y===1)return f;var z=this.readSync(f.dataId),Y=y/2,Z=function(ot){for(var xt=Math.ceil(ot.length/4),kt=new Float32Array(xt),At=new Float32Array(xt),Lt=0;Lt<ot.length;Lt+=4)kt[Math.floor(Lt/4)]=ot[Lt],At[Math.floor(Lt/4)]=ot[Lt+1];return{real:kt,imag:At}}(z),le=zo(Z.real,Z.imag).as1D(),de=function(ot){for(var xt=Math.floor(ot.length/4),kt=new Float32Array(xt),At=new Float32Array(xt),Lt=2;Lt<ot.length;Lt+=4)kt[Math.floor(Lt/4)]=ot[Lt],At[Math.floor(Lt/4)]=ot[Lt+1];return{real:kt,imag:At}}(z),we=zo(de.real,de.imag).as1D();le=this.fftRadix2(le,Y,E),we=this.fftRadix2(we,Y,E);var De=function(ot,xt){for(var kt=new Float32Array(ot/2),At=new Float32Array(ot/2),Lt=0;Lt<Math.ceil(ot/2);Lt++){var tn=(xt?2:-2)*Math.PI*(Lt/ot);kt[Lt]=Math.cos(tn),At[Lt]=Math.sin(tn)}return{real:kt,imag:At}}(y,E),Ne=zo(De.real,De.imag).mul(we),Fe=le.add(Ne),Ve=le.sub(Ne),Je=qa(Fe).concat(qa(Ve)),Xe=Os(Fe).concat(Os(Ve));return zo(Je,Xe).as1D()},m.prototype.fourierTransformByMatmul=function(f,y,E){for(var z=new Float32Array(2*y),Y=0;Y<y;Y++){for(var Z=0,le=0,de=0;de<y;de++){var we=ba(Y*de,y,E),De=Co(f,de);Z+=De.real*we.real-De.imag*we.imag,le+=De.real*we.imag+De.imag*we.real}E&&(Z/=y,le/=y),_o(z,Z,le,Y)}return z},m.prototype.depthToSpace=function(f,y,E){Ee(E==="NHWC",function(){return"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+E}),Ee(y>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+y});for(var z=f.shape[0],Y=f.shape[1],Z=f.shape[2],le=f.shape[3],de=Y*y,we=Z*y,De=le/(y*y),Ne=this.readSync(f.dataId),Fe=new Float32Array(z*de*we*De),Ve=0,Je=0;Je<z;++Je)for(var Xe=0;Xe<de;++Xe)for(var ot=Math.floor(Xe/y),xt=Xe%y,kt=0;kt<we;++kt)for(var At=Math.floor(kt/y),Lt=(xt*y+kt%y)*De,tn=0;tn<De;++tn){var ln=tn+Lt+le*(At+Z*(ot+Y*Je));Fe[Ve++]=Ne[ln]}return $u(Fe,[z,de,we,De])},m.prototype.broadcastedBinaryOp=function(f,y,E,z){var Y=no(f.shape,y.shape),Z=Li(Y,E),le=this.readSync(f.dataId),de=this.readSync(y.dataId),we=hs(f.shape,Y),De=hs(y.shape,Y),Ne=Z.values;if(we.length+De.length===0)for(var Fe=0;Fe<Ne.length;++Fe)Ne[Fe]=z(le[Fe%le.length],de[Fe%de.length]);else{var Ve=this.bufferSync(f),Je=this.bufferSync(y),Xe=function(ot){var xt=Z.indexToLoc(ot),kt=xt.slice(-f.rank);we.forEach(function(ln){return kt[ln]=0});var At=Ve.locToIndex(kt),Lt=xt.slice(-y.rank);De.forEach(function(ln){return Lt[ln]=0});var tn=Je.locToIndex(Lt);Ne[ot]=z(le[At],de[tn])};for(Fe=0;Fe<Ne.length;++Fe)Xe(Fe)}return Z.toTensor()},m.prototype.broadcastedBinaryComplexOp=function(f,y,E){var z=no(f.shape,y.shape),Y=Li(z,"float32"),Z=Li(z,"float32"),le=this.readSync(f.dataId),de=this.readSync(y.dataId),we=hs(f.shape,z),De=hs(y.shape,z),Ne=Y.values,Fe=Z.values;if(we.length+De.length===0)for(var Ve=0;Ve<Ne.length;Ve++){var Je=Ve%le.length,Xe=Ve%de.length,ot=E(le[2*Je],le[2*Je+1],de[2*Xe],de[2*Xe+1]);Ne[Ve]=ot.real,Fe[Ve]=ot.imag}else{var xt=this.bufferSync(this.data.get(f.dataId).complexTensors.real),kt=this.bufferSync(this.data.get(y.dataId).complexTensors.real),At=function(Lt){var tn=Y.indexToLoc(Lt),ln=tn.slice(-f.rank);we.forEach(function(Mn){return ln[Mn]=0});var nn=xt.locToIndex(ln),cn=tn.slice(-y.rank);De.forEach(function(Mn){return cn[Mn]=0});var Dn=kt.locToIndex(cn),Rn=E(le[2*nn],le[2*nn+1],de[2*Dn],de[2*Dn+1]);Ne[Lt]=Rn.real,Fe[Lt]=Rn.imag};for(Ve=0;Ve<Ne.length;Ve++)At(Ve)}return this.complex(Y.toTensor(),Z.toTensor())},m.prototype.split=function(f,y,E){return Ga(f,y,E)},m.prototype.dispose=function(){},m.prototype.floatPrecision=function(){return 32},m.prototype.epsilon=function(){return 1e-7},m.prototype.cropAndResize=function(f,y,E,z,Y,Z){for(var le=f.shape,de=le[0],we=le[1],De=le[2],Ne=le[3],Fe=y.shape[0],Ve=z[0],Je=z[1],Xe=Li([Fe,Ve,Je,Ne],"float32"),ot=this.readSync(y.dataId),xt=this.readSync(E.dataId),kt=this.readSync(f.dataId),At=f.strides,Lt=Xe.strides,tn=0;tn<Fe;tn++){var ln=4*tn,nn=ot[ln],cn=ot[ln+1],Dn=ot[ln+2],Rn=ot[ln+3],Mn=xt[tn];if(!(Mn>=de))for(var tr=Ve>1?(Dn-nn)*(we-1)/(Ve-1):0,ur=Je>1?(Rn-cn)*(De-1)/(Je-1):0,vr=0;vr<Ve;vr++){var kr=Ve>1?nn*(we-1)+vr*tr:.5*(nn+Dn)*(we-1);if(kr<0||kr>we-1)for(var yr=0;yr<Je;yr++)for(var mr=0;mr<Ne;mr++){var jr=mr+yr*Lt[2]+vr*Lt[1]+tn*Lt[0];Xe.values[jr]=Z}else if(Y==="bilinear"){var Pr=Math.floor(kr),ei=Math.ceil(kr),pi=kr-Pr;for(yr=0;yr<Je;yr++)if((vo=Je>1?cn*(De-1)+yr*ur:.5*(cn+Rn)*(De-1))<0||vo>De-1)for(mr=0;mr<Ne;mr++)jr=mr+yr*Lt[2]+vr*Lt[1]+tn*Lt[0],Xe.values[jr]=Z;else{var Mi=Math.floor(vo),Ro=Math.ceil(vo),Bo=vo-Mi;for(mr=0;mr<Ne;mr++){var Zo=kt[jr=mr+Mi*At[2]+Pr*At[1]+Mn*At[0]],Jo=kt[jr=mr+Ro*At[2]+Pr*At[1]+Mn*At[0]],ma=kt[jr=mr+Mi*At[2]+ei*At[1]+Mn*At[0]],Fa=Zo+(Jo-Zo)*Bo,Es=ma+(kt[jr=mr+Ro*At[2]+ei*At[1]+Mn*At[0]]-ma)*Bo;jr=mr+yr*Lt[2]+vr*Lt[1]+tn*Lt[0],Xe.values[jr]=Fa+(Es-Fa)*pi}}}else for(yr=0;yr<Je;++yr){var vo;if((vo=Je>1?cn*(De-1)+yr*ur:.5*(cn+Rn)*(De-1))<0||vo>De-1)for(mr=0;mr<Ne;mr++)jr=mr+yr*Lt[2]+vr*Lt[1]+tn*Lt[0],Xe.values[jr]=Z;else{var ea=Math.round(vo),_a=Math.round(kr);for(mr=0;mr<Ne;mr++){var dc=mr+ea*At[2]+_a*At[1]+Mn*At[0],Ru=mr+yr*Lt[2]+vr*Lt[1]+tn*Lt[0];Xe.values[Ru]=kt[dc]}}}}}return Xe.toTensor()},m.prototype.sparseToDense=function(f,y,E,z){var Y=Sf(0,f,E),Z=Y.sliceRank,le=Y.numUpdates,de=Y.sliceSize,we=Y.strides,De=Y.outputSize;return this.scatter(f,y,E,De,de,le,Z,we,z,!1)},m.prototype.gatherND=function(f,y){var E=y.shape,z=E[E.length-1],Y=Ku(f,y),Z=Y[0],le=Y[1],de=Y[2],we=Y[3];if(le===0)return Qo([],Z,f.dtype);for(var De=new co([le,de],f.dtype),Ne=this.readSync(y.dataId),Fe=this.readSync(f.dataId),Ve=0;Ve<le;Ve++){for(var Je=[],Xe=0,ot=0;ot<z;ot++){var xt=Ne[Ve*z+ot];Xe+=xt*we[ot],Je.push(xt)}if(Xe<0||Xe>=f.size/de)throw new Error("Invalid indices: "+Je+" does not index into "+f.shape);for(var kt=0;kt<de;kt++)De.values[Ve*de+kt]=Fe[Xe*de+kt]}return De.toTensor().reshape(Z)},m.prototype.scatterND=function(f,y,E){var z=Sf(0,f,E),Y=z.sliceRank,Z=z.numUpdates,le=z.sliceSize,de=z.strides,we=z.outputSize,De=Or(0);return this.scatter(f,y,E,we,le,Z,Y,de,De,!0)},m.prototype.fill=function(f,y,E){var z=Yt(E=E||xe(y),Ke(f));return z.fill(y),qe.makeTensor(z,f,E,this)},m.prototype.onesLike=function(f){if(f.dtype==="string")throw new Error("onesLike is not supported for string tensors");return this.fill(f.shape,1,f.dtype)},m.prototype.zerosLike=function(f){var y=Yt(f.dtype,Ke(f.shape));return this.makeOutput(y,f.shape,f.dtype)},m.prototype.linspace=function(f,y,E){return Di(f,y,E)},m.prototype.scatter=function(f,y,E,z,Y,Z,le,de,we,De){var Ne=[z/Y,Y],Fe=this.readSync(f.dataId),Ve=this.readSync(y.dataId);if(z===0)return Qo([],E,y.dtype);var Je=new co(Ne,y.dtype);Je.values.fill(this.readSync(we.dataId)[0]);for(var Xe=0;Xe<Z;Xe++){for(var ot=[],xt=0,kt=0;kt<le;kt++){var At=Fe[Xe*le+kt];ot.push(At),xt+=At*de[kt]}if(xt<0||xt>=z/Y)throw new Error("Invalid indices: "+ot+" does not index into "+E);for(var Lt=0;Lt<Y;Lt++)De?Je.values[xt*Y+Lt]+=Ve[Xe*Y+Lt]:Je.values[xt*Y+Lt]=y.rank===0?Ve[0]:Ve[Xe*Y+Lt]}return Je.toTensor().reshape(E)},m}(en);function zr(_,m){return{kernelName:_,backendName:"cpu",kernelFunc:function(f){var y=f.inputs,E=f.backend,z=y,Y=z.a,Z=z.b,le=E;Cn([Y,Z],_);var de=le.data.get(Y.dataId).values,we=le.data.get(Z.dataId).values,De=m(Y.shape,Z.shape,de,we,Y.dtype),Ne=De[0],Fe=De[1];return{dataId:le.write(Ne,Fe,Y.dtype),shape:Fe,dtype:Y.dtype}}}}function Ti(_){return function(m,f,y,E,z){var Y=no(m,f),Z=Y.length,le=ar(Y),de=yn(z,Ke(Y)),we=m.length,De=f.length,Ne=ar(m),Fe=ar(f),Ve=hs(m,Y),Je=hs(f,Y);if(Ve.length+Je.length===0)for(var Xe=0;Xe<de.length;++Xe)de[Xe]=_(y[Xe%y.length],E[Xe%E.length]);else{var ot=function(xt){var kt=xr(xt,Z,le),At=kt.slice(-we);Ve.forEach(function(nn){return At[nn]=0});var Lt=Dr(At,we,Ne),tn=kt.slice(-De);Je.forEach(function(nn){return tn[nn]=0});var ln=Dr(tn,De,Fe);de[xt]=_(y[Lt],E[ln])};for(Xe=0;Xe<de.length;++Xe)ot(Xe)}return[de,Y]}}qe.registerBackend("cpu",function(){return new Xr},1);var Wi=Ti(function(_,m){return _/m}),zi=zr(ya,Wi),Xo={kernelName:"MaxPoolWithArgmax",backendName:"cpu",kernelFunc:function(_){var m=_.input
3728s,f=_.attrs,y=_.backend,E=m.x,z=f,Y=z.filterSize,Z=z.strides,le=z.pad,de=z.includeBatchInIndex,we=y;Cn(E,"MaxPoolWithArgmax");var De=we.data.get(E.dataId).values,Ne=Tn(E.shape,Y,Z,[1,1],le),Fe=function(xt,kt,At,Lt,tn){var ln=wr(xt,0,At,ar(kt),tn,"max"),nn=Fr(xt,kt,At,tn,!0,Lt);return[ln.values,nn.values]}(De,E.shape,E.dtype,de,Ne),Ve=Fe[0],Je=Fe[1],Xe=we.write(Ve,Ne.outShape,E.dtype),ot=we.write(Je,Ne.outShape,E.dtype);return[{dataId:Xe,shape:Ne.outShape,dtype:E.dtype},{dataId:ot,shape:Ne.outShape,dtype:"int32"}]}},wa={kernelName:"NonMaxSuppressionV5",backendName:"cpu",kernelFunc:function(_){var m=_.inputs,f=_.backend,y=_.attrs,E=m,z=E.boxes,Y=E.scores,Z=y,le=Z.maxOutputSize,de=Z.iouThreshold,we=Z.scoreThreshold,De=Z.softNmsSigma,Ne=f;Cn(z,"NonMaxSuppressionWithScore");var Fe=pa(Ne.data.get(z.dataId).values,Ne.data.get(Y.dataId).values,le,de,we,De);return[Fe.selectedIndices,Fe.selectedScores]}},ua={kernelName:"Square",backendName:"cpu",kernelFunc:function(_){var m=_.inputs,f=_.backend,y=m.x,E=f;Cn(y,"square");for(var z=E.data.get(y.dataId).values,Y=new Float32Array(z.length),Z=0;Z<z.length;++Z){var le=z[Z];Y[Z]=le*le}return{dataId:E.write(Y,y.shape,y.dtype),shape:y.shape,dtype:y.dtype}}},oa=Ti(function(_,m){var f=_-m;return f*f});function ha(_,m,f,y,E){for(var z=Ke(m),Y=m.length,Z=ar(m),le=ar(E),de=yn(f,Ke(E)),we=0;we<z;++we){for(var De=xr(we,Y,Z),Ne=new Array(De.length),Fe=0;Fe<Ne.length;Fe++)Ne[Fe]=De[y[Fe]];de[Dr(Ne,Y,le)]=_[we]}return de}for(var Ma=0,Wa=[wa,ua,zr(ud,oa),zi,{kernelName:"Transpose",backendName:"cpu",kernelFunc:function(_){var m=_.input
3728s,f=_.attrs,y=_.backend,E=m.x,z=f.perm,Y=y;Cn(E,"transpose");for(var Z=E.shape.length,le=new Array(Z),de=0;de<le.length;de++)le[de]=E.shape[z[de]];var we=ha(Y.data.get(E.dataId).values,E.shape,E.dtype,z,le);return{dataId:Y.write(we,le,E.dtype),shape:le,dtype:E.dtype}}},Xo];Ma<Wa.length;Ma++)ce(Wa[Ma]);for(var us,Qu=0,Hi=[{kernelName:"FromPixels",backendName:"webgl",kernelFunc:function(_){var m=_.inputs,f=_.backend,y=_.attrs,E=m.pixels,z=y.numChannels,Y=typeof HTMLVideoElement<"u"&&E instanceof HTMLVideoElement,Z=typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement,le=Y?[E.videoWidth,E.videoHeight]:[E.width,E.height],de=le[0],we=le[1],De=[we,de],Ne=[we,de,z];(Z||Y)&&(us==null&&(us=document.createElement("canvas").getContext("2d")),us.canvas.width=de,us.canvas.height=we,us.drawImage(E,0,0,de,we),E=us.canvas);var Fe=f.makeTensorInfo(De,"int32");f.texData.get(Fe.dataId).usage=pr.PIXELS,f.gpgpu.uploadPixelDataToTexture(f.getTexture(Fe.dataId),E);var Ve=L().getBool("WEBGL_PACK")?new function(Xe){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var ot=qo(),xt=Xe[0],kt=Xe[1];this.outputShape=Xe,this.userCode=` 3729 void main() { 3730 ivec3 coords = getOutputCoords(); 3731 int texR = coords[0]; 3732 int texC = coords[1]; 3733 int depth = coords[2]; 3734 3735 vec4 result = vec4(0.); 3736 3737 for(int row=0; row<=1; row++) { 3738 for(int col=0; col<=1; col++) { 3739 texC = coords[1] + row; 3740 depth = coords[2] + col; 3741 3742 vec2 uv = (vec2(texC, texR) + halfCR) / 3743 vec2(`+kt+".0, "+xt+`.0); 3744 vec4 values = `+ot.texture2D+`(A, uv); 3745 float value; 3746 if (depth == 0) { 3747 value = values.r; 3748 } else if (depth == 1) { 3749 value = values.g; 3750 } else if (depth == 2) { 3751 value = values.b; 3752 } else if (depth == 3) { 3753 value = values.a; 3754 } 3755 3756 result[row * 2 + col] = floor(value * 255.0 + 0.5); 3757 } 3758 } 3759 3760 `+ot.output+` = result; 3761 } 3762 `}(Ne):new function(Xe){this.variableNames=["A"];var ot=qo(),xt=Xe[0],kt=Xe[1];this.outputShape=Xe,this.userCode=` 3763 void main() { 3764 ivec3 coords = getOutputCoords(); 3765 int texR = coords[0]; 3766 int texC = coords[1]; 3767 int depth = coords[2]; 3768 vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+kt+".0, "+xt+`.0); 3769 3770 vec4 values = `+ot.texture2D+`(A, uv); 3771 float value; 3772 if (depth == 0) { 3773 value = values.r; 3774 } else if (depth == 1) { 3775 value = values.g; 3776 } else if (depth == 2) { 3777 value = values.b; 3778 } else if (depth == 3) { 3779 value = values.a; 3780 } 3781 3782 setOutput(floor(value * 255.0 + 0.5)); 3783 } 3784 `}(Ne),Je=f.runWebGLProgram(Ve,[Fe],"int32");return f.disposeData(Fe.dataId),Je}},{kernelName:ya,backendName:"webgl",kernelFunc:function(_){var m=_.input
3784s,f=_.backend,y=m;return function(E,z,Y){var Z=new xa(` 3785if (a == b) { 3786 return 1.0; 3787}; 3788return a / b;`,E.shape,z.shape);return L().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&(Z=new _s(` 3789 // vec4 one = vec4(equal(a, b)); 3790 // return one + (vec4(1.0) - one) * a / b; 3791 vec4 result = a / b; 3792 if(a.x == b.x) { 3793 result.x = 1.; 3794 } 3795 if(a.y == b.y) { 3796 result.y = 1.; 3797 } 3798 if(a.z == b.z) { 3799 result.z = 1.; 3800 } 3801 if(a.w == b.w) { 3802 result.w = 1.; 3803 } 3804 3805 return result; 3806`,E.shape,z.shape,!0)),Y.runWebGLProgram(Z,[E,z],"float32")}(y.a,y.b,f)}},{kernelName:"NonMaxSuppressionV5",backendName:"webgl",kernelFunc:function(_){var m=_.inputs,f=_.backend,y=_.attrs;yf("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");var E=m,z=E.boxes,Y=E.scores,Z=y,le=Z.maxOutputSize,de=Z.iouThreshold,we=Z.scoreThreshold,De=Z.softNmsSigma,Ne=f,Fe=pa(Ne.readSync(z.dataId),Ne.readSync(Y.dataId),le,de,we,De);return[Fe.selectedIndices,Fe.selectedScores]}},{kernelName:"Square",backendName:"webgl",kernelFunc:function(_){var m=_.input
3806s,f=_.backend,y=m.x,E=f,z=new Fo(y.shape,"return x * x;");return E.runWebGLProgram(z,[y],y.dtype)}},{kernelName:ud,backendName:"webgl",kernelFunc:function(_){var m=_.inputs,f=_.backend,y=m,E=y.a,z=y.b,Y=f,Z=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new _s("return (a - b) * (a - b);",E.shape,z.shape):new xa("return (a - b) * (a - b);",E.shape,z.shape);return Y.compileAndRun(Z,[E,z])}},{kernelName:"Transpose",backendName:"webgl",kernelFunc:function(_){for(var m,f=_.inputs,y=_.attrs,E=_.backend,z=f.x,Y=y.perm,Z=E,le=z.shape.length,de=new Array(le),we=0;we<de.length;we++)de[we]=z.shape[Y[we]];if(Z.shouldExecuteOnCPU([z])){var De=ha(Z.texData.get(z.dataId).values,z.shape,z.dtype,Y,de);m=Z.makeTensorInfo(de,z.dtype),Z.texData.get(m.dataId).values=De}else m=function(Ne,Fe,Ve){var Je=L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(Xe,ot){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;for(var xt=new Array(Xe.length),kt=0;kt<xt.length;kt++)xt[kt]=Xe[ot[kt]];if(this.outputShape=xt,this.rank=xt.length,this.rank>6)throw Error("Packed transpose for rank "+this.rank+" is not yet supported.");var At=fa(this.rank),Lt=Hs("rc",this.rank),tn=new Array(this.rank);for(kt=0;kt<ot.length;kt++)tn[ot[kt]]=Lt[kt];var ln="vec2("+tn.slice(-2).join()+")",nn="++"+Lt[this.rank-1]+" < "+xt[this.rank-1],cn="getChannel(getA("+tn.join()+"), "+ln+")";this.userCode=` 3807 void main() { 3808 `+At+` rc = getOutputCoords(); 3809 vec4 result = vec4(0.); 3810 result[0] = `+cn+`; 3811 if(`+nn+`) { 3812 result[1] = `+cn+`; 3813 } 3814 --`+Lt[this.rank-1]+`; 3815 if(++`+Lt[this.rank-2]+" < "+xt[this.rank-2]+`) { 3816 result[2] = `+cn+`; 3817 if(`+nn+`) { 3818 result[3] = `+cn+`; 3819 } 3820 } 3821 setOutput(result); 3822 } 3823 `}(Ne.shape,Fe):new function(Xe,ot){this.variableNames=["A"];for(var xt=new Array(Xe.length),kt=0;kt<xt.length;kt++)xt[kt]=Xe[ot[kt]];this.outputShape=xt,this.rank=xt.length;var At=fa(this.rank),Lt=function(tn){var ln=tn.length;if(ln>6)throw Error("Transpose for rank "+ln+" is not yet supported");for(var nn=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],cn=new Array(ln),Dn=0;Dn<tn.length;Dn++)cn[tn[Dn]]=nn[Dn];return cn.join()}(ot);this.userCode=` 3824 void main() { 3825 `+At+` resRC = getOutputCoords(); 3826 setOutput(getA(`+Lt+`)); 3827 } 3828 `}(Ne.shape,Fe);return Ve.runWebGLProgram(Je,[Ne],Ne.dtype)}(z,Y,Z);return m}},{kernelName:"MaxPoolWithArgmax",backendName:"webgl",kernelFunc:function(_){var m=_.input
3828s,f=_.attrs,y=_.backend,E=m.x,z=f,Y=z.filterSize,Z=z.strides,le=z.pad,de=z.includeBatchInIndex,we=y;Ee(E.shape.length===4,function(){return"Error in maxPool: input must be rank 4 but got rank "+E.shape.length+"."});var De=[1,1];Ee(Br(Z,De),function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+Z+" and dilations '"+De+"'"});var Ne=Tn(E.shape,Y,Z,De,le),Fe=function(Ve,Je,Xe,ot){var xt=new Bp(Xe,"max",!1),kt=ot.runWebGLProgram(xt,[Ve],"float32");return xt=new Bp(Xe,"max",!0,!0,Je),[kt,ot.runWebGLProgram(xt,[Ve],"float32")]}(E,de,Ne,we);return[Fe[0],Fe[1]]}}];Qu<Hi.length;Qu++)ce(Hi[Qu]);for(var Ts=0,Us=[{kernelName:sd,inputsToSave:["a","b"],gradFunc:function(_,m){var f=m[0],y=m[1],E=no(f.shape,y.shape);return{a:function(){var z=_,Y=bs(f.shape,E);return Y.length>0&&(z=z.sum(Y)),z.reshape(f.shape)},b:function(){var z=_,Y=bs(y.shape,E);return Y.length>0&&(z=z.sum(Y)),z.reshape(y.shape)}}}},{kernelName:"AddN",saveAllInputs:!0,gradFunc:function(_,m){var f={};return m.forEach(function(y,E){f[E]=function(){return _.clone()}}),f}},{kernelName:ql,gradFunc:function(_,m,f){for(var y=f,E=y.inputShape,z=y.shape,Y=Array.from(z),Z=E.length-1;Z>=0;Z--)if(E[Z]===z[Z])Y[Z]=1;else if(E[Z]!==1)throw new Error("broadcastTo(): ["+E+"] cannot be broadcast to ["+z+"].");var le=[];for(Z=0;Z<Y.length;Z++)Y[Z]>1&&le.push(Z);return{x:function(){return _.sum(le,!0)}}}},{kernelName:ya,inputsToSave:["a","b"],gradFunc:function(_,m){var f=m[0],y=m[1],E=no(f.shape,y.shape);return{a:function(){var z=Da(_,y.toFloat()),Y=bs(f.shape,E);return Y.length>0?Lf(z,Y).reshape(f.shape):z},b:function(){var z=_.mul(f.toFloat()),Y=bs(y.shape,E);Y.length>0&&(z=Lf(z,Y).reshape(y.shape));var Z=Ad(y);return os(Da(z,Z.toFloat()))}}}},{kernelName:"FusedBatchNorm",inputsToSave:["x","mean","variance","scale"],gradFunc:function(_,m,f){var y=f.varianceEpsilon,E=m[0],z=m[1],Y=m[2],Z=m[3],le=iy(E),de=Z??Or(1),we=bs(z.shape,le.shape),De=[];if(z.rank===1){for(var Ne=0;Ne<le.shape.length-1;++Ne)De.push(le.shape[Ne]);De.push(1)}var Fe=ps(E,z),Ve=Oa(_,de),Je=pd(Pa(Y,Or(y))),Xe=Oa(Oa(Oa(Je,Je),Je),Or(-.5));return{x:function(){return z.rank===1?wu(Oa(Oa(_,Th(Je.as4D(1,1,1,z.shape[0]),De)),de),E.shape):wu(Oa(Oa(_,Je),de),E.shape)},mean:function(){var ot=Oa(Oa(Je,Or(-1)),Ve);return z.rank===1&&(ot=Lf(ot,we)),wu(ot,z.shape)},variance:function(){var ot=Oa(Oa(Xe,Fe),Ve);return z.rank===1&&(ot=Lf(ot,we)),wu(ot,z.shape)},scale:function(){var ot=Oa(Fe,Je),xt=Oa(_,ot);return z.rank===1&&(xt=Lf(xt,we)),wu(xt,z.shape)},offset:function(){var ot=_;return z.rank===1&&(ot=Lf(ot,we)),wu(ot,z.shape)}}}},{kernelName:lh,gradFunc:function(_){return{x:function(){return _.toFloat()}}}},{kernelName:Tp,inputsToSave:["indices"],gradFunc:function(_,m){var f=m[0];return{indices:function(){return go(f.shape,"float32")}}}},{kernelName:Gl,inputsToSave:["x"],gradFunc:function(_,m,f){var y=m[0],E=f.paddings.map(function(z){return z[0]});return{x:function(){return _.slice(E,y.shape)}}}},{kernelName:"Square",inputsToSave:["x"],gradFunc:function(_,m){var f=m[0];return{x:function(){return _.mul(f.toFloat().mul(2))}}}},{kernelName:ud,inputsToSave:["a","b"],gradFunc:function(_,m){var f=m[0],y=m[1],E=Or(2);return{a:function(){return Oa(_,Oa(E,ps(f,y)))},b:function(){return Oa(_,Oa(E,ps(y,f)))}}}},{kernelName:ld,inputsToSave:["x"],gradFunc:function(_,m,f){var y=m[0],E=f.reps;return{x:function(){var z=Ei(y);if(y.rank===1)for(var Y=0;Y<E[0];++Y)z=z.add(_.slice([Y*y.shape[0]],[y.shape[0]]));else if(y.rank===2)for(Y=0;Y<E[0];++Y)for(var Z=0;Z<E[1];++Z)z=z.add(_.slice([Y*y.shape[0],Z*y.shape[1]],[y.shape[0],y.shape[1]]));else if(y.rank===3)for(Y=0;Y<E[0];++Y)for(Z=0;Z<E[1];++Z)for(var le=0;le<E[2];++le)z=z.add(_.slice([Y*y.shape[0],Z*y.shape[1],le*y.shape[2]],[y.shape[0],y.shape[1],y.shape[2]]));else{if(y.rank!==4)throw new Error("Gradient for tile operation is not implemented for rank-"+y.rank+" tensors yet.");for(Y=0;Y<E[0];++Y)for(Z=0;Z<E[1];++Z)for(le=0;le<E[2];++le)for(var de=0;de<E[3];++de)z=z.add(_.slice([Y*y.shape[0],Z*y.shape[1],le*y.shape[2],de*y.shape[3]],[y.shape[0],y.shape[1],y.shape[2],y.shape[3]]))}return z}}}}
vendor: 25,137 bytes, lines 3828-3829
3828,{kernelName:"Transpose",gradFunc:function(_,m,f){var y=Ic(f.perm);return{x:function(){return wt(_,y)}}}}];Ts<Us.length;Ts++)pe(Us[Ts]);var Zu=function(){function _(){}return _.prototype.fetch=function(m,f){return fetch(m,f)},_.prototype.now=function(){return performance.now()},_.prototype.encode=function(m,f){if(f!=="utf-8"&&f!=="utf8")throw new Error("Browser's encoder only supports utf-8, but got "+f);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(m)},_.prototype.decode=function(m,f){return new TextDecoder(f).decode(m)},_}();L().get("IS_BROWSER")&&L().setPlatform("browser",new Zu);var Au,xc=function(){function _(){this.util=n(388),this.textEncoder=new this.util.TextEncoder}return _.prototype.fetch=function(m,f){return L().global.fetch!=null?L().global.fetch(m,f):(Au==null&&(Au=n(389)),Au(m,f))},_.prototype.now=function(){var m=h.hrtime();return 1e3*m[0]+m[1]/1e6},_.prototype.encode=function(m,f){if(f!=="utf-8"&&f!=="utf8")throw new Error("Node built-in encoder only supports utf-8, but got "+f);return this.textEncoder.encode(m)},_.prototype.decode=function(m,f){return m.length===0?"":new this.util.TextDecoder(f).decode(m)},_}();L().get("IS_NODE")&&L().setPlatform("node",new xc);var wc={float32:4,int32:4,uint16:2,uint8:1,bool:1},_c=4;function Jp(_,m){for(var f={},y=0,E=function(Z){var le=Z.name,de=Z.dtype,we=Z.shape,De=Ke(we),Ne=void 0;if("quantization"in Z){var Fe=Z.quantization;if(Fe.dtype!=="uint8"&&Fe.dtype!=="uint16")throw new Error("Weight "+Z.name+" has unknown quantization dtype "+Fe.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var Ve=wc[Fe.dtype],Je=_.slice(y,y+De*Ve),Xe=Fe.dtype==="uint8"?new Uint8Array(Je):new Uint16Array(Je);if(de==="float32")Ne=Float32Array.from(Xe,function(tn){return tn*Fe.scale+Fe.min});else{if(de!=="int32")throw new Error("Unsupported dtype in weight '"+le+"': "+de);Ne=Int32Array.from(Xe,function(tn){return Math.round(tn*Fe.scale+Fe.min)})}y+=De*Ve}else if(de==="string"){var ot=Ke(Z.shape);Ne=[];for(var xt=0;xt<ot;xt++){var kt=new Uint32Array(_.slice(y,y+_c))[0];y+=_c;var At=new Uint8Array(_.slice(y,y+kt));Ne.push(At),y+=kt}}else{var Lt=wc[de];if(Je=_.slice(y,y+De*Lt),de==="float32")Ne=new Float32Array(Je);else if(de==="int32")Ne=new Int32Array(Je);else{if(de!=="bool")throw new Error("Unsupported dtype in weight '"+le+"': "+de);Ne=new Uint8Array(Je)}y+=De*Lt}f[le]=Qo(Ne,we,de)},z=0,Y=m;z<Y.length;z++)E(Y[z]);return f}var Lh=v!==void 0&&(typeof Blob>"u"||typeof atob>"u"||typeof btoa>"u");function zf(_){return Lh?v.byteLength(_):new Blob([_]).size}function Fd(_){var m=0;_.forEach(function(E){m+=E.byteLength});var f=new Uint8Array(m),y=0;return _.forEach(function(E){f.set(new Uint8Array(E),y),y+=E.byteLength}),f.buffer}function Uf(_){for(_=_.trim();_.endsWith("/");)_=_.slice(0,_.length-1);var m=_.split("/");return m[m.length-1]}function sl(_){if(_.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:_.modelTopology==null?0:zf(JSON.stringify(_.modelTopology)),weightSpecsBytes:_.weightSpecs==null?0:zf(JSON.stringify(_.weightSpecs)),weightDataBytes:_.weightData==null?0:_.weightData.byteLength}}var ks=function(){function _(){this.saveRouters=[],this.loadRouters=[]}return _.getInstance=function(){return _.instance==null&&(_.instance=new _),_.instance},_.registerSaveRouter=function(m){_.getInstance().saveRouters.push(m)},_.registerLoadRouter=function(m){_.getInstance().loadRouters.push(m)},_.getSaveHandlers=function(m){return _.getHandlers(m,"save")},_.getLoadHandlers=function(m,f){return _.getHandlers(m,"load",f)},_.getHandlers=function(m,f,y){var E=[];return(f==="load"?_.getInstance().loadRouters:_.getInstance().saveRouters).forEach(function(z){var Y=z(m,y);Y!==null&&E.push(Y)}),E},_}(),Rd="://",zh=function(){function _(){this.managers={}}return _.getInstance=function(){return _.instance==null&&(_.instance=new _),_.instance},_.registerManager=function(m,f){Ee(m!=null,function(){return"scheme must not be undefined or null."}),m.endsWith(Rd)&&(m=m.slice(0,m.indexOf(Rd))),Ee(m.length>0,function(){return"scheme must not be an empty string."});var y=_.getInstance();Ee(y.managers[m]==null,function(){return"A model store manager is already registered for scheme '"+m+"'."}),y.managers[m]=f},_.getManager=function(m){var f=this.getInstance().managers[m];if(f==null)throw new Error("Cannot find model manager for scheme '"+m+"'");return f},_.getSchemes=function(){return Object.keys(this.getInstance().managers)},_}();function Qp(_){if(_.indexOf(Rd)===-1)throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+zh.getSchemes().join(","));return{scheme:_.split(Rd)[0],path:_.split(Rd)[1]}}function Bd(_,m,f){return f===void 0&&(f=!1),S(this,void 0,void 0,function(){var y,E,z,Y,Z,le,de,we,De;return M(this,function(Ne){switch(Ne.label){case 0:return Ee(_!==m,function(){return"Old path and new path are the same: '"+_+"'"}),Ee((y=ks.getLoadHandlers(_)).length>0,function(){return"Copying failed because no load handler is found for source URL "+_+"."}),Ee(y.length<2,function(){return"Copying failed because more than one ("+y.length+") load handlers for source URL "+_+"."}),E=y[0],Ee((z=ks.getSaveHandlers(m)).length>0,function(){return"Copying failed because no save handler is found for destination URL "+m+"."}),Ee(z.length<2,function(){return"Copying failed because more than one ("+y.length+") save handlers for destination URL "+m+"."}),Y=z[0],Z=Qp(_).scheme,le=Qp(_).path,de=Z===Qp(_).scheme,[4,E.load()];case 1:return we=Ne.sent(),f&&de?[4,zh.getManager(Z).removeModel(le)]:[3,3];case 2:Ne.sent(),Ne.label=3;case 3:return[4,Y.save(we)];case 4:return De=Ne.sent(),!f||de?[3,6]:[4,zh.getManager(Z).removeModel(le)];case 5:Ne.sent(),Ne.label=6;case 6:return[2,De.modelArtifactsInfo]}})})}var ou="models_store",Uh="model_info_store";function Zp(){if(!L().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var _=window||self,m=_.indexedDB||_.mozIndexedDB||_.webkitIndexedDB||_.msIndexedDB||_.shimIndexedDB;if(m==null)throw new Error("The current browser does not appear to support IndexedDB.");return m}function em(_){var m=_.result;m.createObjectStore(ou,{keyPath:"modelPath"}),m.createObjectStore(Uh,{keyPath:"modelPath"})}var af=function(){function _(m){if(this.indexedDB=Zp(),m==null||!m)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=m}return _.prototype.save=function(m){return S(this,void 0,void 0,function(){return M(this,function(f){if(m.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,m)]})})},_.prototype.load=function(){return S(this,void 0,void 0,function(){return M(this,function(m){return[2,this.databaseAction(this.modelPath)]})})},_.prototype.databaseAction=function(m,f){var y=this;return new Promise(function(E,z){var Y=y.indexedDB.open("tensorflowjs",1);Y.onupgradeneeded=function(){return em(Y)},Y.onsuccess=function(){var Z=Y.result;if(f==null){var le=Z.transaction(ou,"readonly"),de=le.objectStore(ou).get(y.modelPath);de.onsuccess=function(){if(de.result==null)return Z.close(),z(new Error("Cannot find model with path '"+y.modelPath+"' in IndexedDB."));E(de.result.modelArtifacts)},de.onerror=function(Je){return Z.close(),z(de.error)},le.oncomplete=function(){return Z.close()}}else{var we,De=sl(f),Ne=Z.transaction(Uh,"readwrite"),Fe=Ne.objectStore(Uh),Ve=Fe.put({modelPath:y.modelPath,modelArtifactsInfo:De});Ve.onsuccess=function(){var Je=(we=Z.transaction(ou,"readwrite")).objectStore(ou).put({modelPath:y.modelPath,modelArtifacts:f,modelArtifactsInfo:De});Je.onsuccess=function(){return E({modelArtifactsInfo:De})},Je.onerror=function(Xe){var ot=(Fe=Ne.objectStore(Uh)).delete(y.modelPath);ot.onsuccess=function(){return Z.close(),z(Je.error)},ot.onerror=function(xt){return Z.close(),z(Je.error)}}},Ve.onerror=function(Je){return Z.close(),z(Ve.error)},Ne.oncomplete=function(){we==null?Z.close():we.oncomplete=function(){return Z.close()}}}},Y.onerror=function(Z){return z(Y.error)}})},_.URL_SCHEME="indexeddb://",_}(),vg=function(_){return L().getBool("IS_BROWSER")&&!Array.isArray(_)&&_.startsWith(af.URL_SCHEME)?(m=_.slice(af.URL_SCHEME.length),new af(m)):null;var m};ks.registerSaveRouter(vg),ks.registerLoadRouter(vg);var ul=function(){function _(){this.indexedDB=Zp()}return _.prototype.listModels=function(){return S(this,void 0,void 0,function(){var m=this;return M(this,function(f){return[2,new Promise(function(y,E){var z=m.indexedDB.open("tensorflowjs",1);z.onupgradeneeded=function(){return em(z)},z.onsuccess=function(){var Y=z.result,Z=Y.transaction(Uh,"readonly"),le=Z.objectStore(Uh).getAll();le.onsuccess=function(){for(var de={},we=0,De=le.result;we<De.length;we++){var Ne=De[we];de[Ne.modelPath]=Ne.modelArtifactsInfo}y(de)},le.onerror=function(de){return Y.close(),E(le.error)},Z.oncomplete=function(){return Y.close()}},z.onerror=function(Y){return E(z.error)}})]})})},_.prototype.removeModel=function(m){return S(this,void 0,void 0,function(){var f=this;return M(this,function(y){var E;return m=(E=m).startsWith(af.URL_SCHEME)?E.slice(af.URL_SCHEME.length):E,[2,new Promise(function(z,Y){var Z=f.indexedDB.open("tensorflowjs",1);Z.onupgradeneeded=function(){return em(Z)},Z.onsuccess=function(){var le,de=Z.result,we=de.transaction(Uh,"readwrite"),De=we.objectStore(Uh),Ne=De.get(m);Ne.onsuccess=function(){if(Ne.result==null)return de.close(),Y(new Error("Cannot find model with path '"+m+"' in IndexedDB."));var Fe=De.delete(m),Ve=function(){var Je=(le=de.transaction(ou,"readwrite")).objectStore(ou).delete(m);Je.onsuccess=function(){return z(Ne.result.modelArtifactsInfo)},Je.onerror=function(Xe){return Y(Ne.error)}};Fe.onsuccess=Ve,Fe.onerror=function(Je){return Ve(),de.close(),Y(Ne.error)}},Ne.onerror=function(Fe){return de.close(),Y(Ne.error)},we.oncomplete=function(){le==null?de.close():le.oncomplete=function(){return de.close()}}},Z.onerror=function(le){return Y(Z.error)}})]})})},_}();if(L().getBool("IS_BROWSER"))try{zh.registerManager(af.URL_SCHEME,new ul)}catch{}var Ou="/",$c="tensorflowjs_models",au="info",Wf="model_topology",Wh="weight_specs",tm="weight_data",Vh="model_metadata";function yg(_){return{info:[$c,_,au].join(Ou),topology:[$c,_,Wf].join(Ou),weightSpecs:[$c,_,Wh].join(Ou),weightData:[$c,_,tm].join(Ou),modelMetadata:[$c,_,Vh].join(Ou)}}function Vf(_){var m=_.split(Ou);if(m.length<3)throw new Error("Invalid key format: "+_);return m.slice(1,m.length-1).join(Ou)}var fc=function(){function _(m){if(!L().getBool("IS_BROWSER")||typeof window>"u"||window.localStorage===void 0)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,m==null||!m)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=m,this.keys=yg(this.modelPath)}return _.prototype.save=function(m){return S(this,void 0,void 0,function(){var f,y,E;return M(this,function(z){if(m.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");f=JSON.stringify(m.modelTopology),y=JSON.stringify(m.weightSpecs),E=sl(m);try{return this.LS.setItem(this.keys.info,JSON.stringify(E)),this.LS.setItem(this.keys.topology,f),this.LS.setItem(this.keys.weightSpecs,y),this.LS.setItem(this.keys.weightData,function(Y){if(Lh)return v.from(Y).toString("base64");for(var Z=new Uint8Array(Y),le="",de=0,we=Z.length;de<we;de++)le+=String.fromCharCode(Z[de]);return btoa(le)}(m.weightData)),this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:m.format,generatedBy:m.generatedBy,convertedBy:m.convertedBy,userDefinedMetadata:m.userDefinedMetadata})),[2,{modelArtifactsInfo:E}]}catch{throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error("Failed to save model '"+this.modelPath+"' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes="+E.modelTopologyBytes+", weightSpecsBytes="+E.weightSpecsBytes+", weightDataBytes="+E.weightDataBytes+".")}return[2]})})},_.prototype.load=function(){return S(this,void 0,void 0,function(){var m,f,y,E,z,Y,Z;return M(this,function(le){if((m=JSON.parse(this.LS.getItem(this.keys.info)))==null)throw new Error("In local storage, there is no model with name '"+this.modelPath+"'");if(m.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");if(f={},(y=JSON.parse(this.LS.getItem(this.keys.topology)))==null)throw new Error("In local storage, the topology of model '"+this.modelPath+"' is missing.");if(f.modelTopology=y,(E=JSON.parse(this.LS.getItem(this.keys.weightSpecs)))==null)throw new Error("In local storage, the weight specs of model '"+this.modelPath+"' are missing.");if(f.weightSpecs=E,(z=this.LS.getItem(this.keys.modelMetadata))!=null&&(Y=JSON.parse(z),f.format=Y.format,f.generatedBy=Y.generatedBy,f.convertedBy=Y.convertedBy,f.userDefinedMetadata=Y.userDefinedMetadata),(Z=this.LS.getItem(this.keys.weightData))==null)throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return f.weightData=function(de){if(Lh){var we=v.from(de,"base64");return we.buffer.slice(we.byteOffset,we.byteOffset+we.byteLength)}for(var De=atob(de),Ne=new Uint8Array(De.length),Fe=0;Fe<De.length;++Fe)Ne.set([De.charCodeAt(Fe)],Fe);return Ne.buffer}(Z),[2,f]})})},_.URL_SCHEME="localstorage://",_}(),Fb=function(_){return L().getBool("IS_BROWSER")&&!Array.isArray(_)&&_.startsWith(fc.URL_SCHEME)?(m=_.slice(fc.URL_SCHEME.length),new fc(m)):null;var m};ks.registerSaveRouter(Fb),ks.registerLoadRouter(Fb);var $f=function(){function _(){Ee(L().getBool("IS_BROWSER"),function(){return"Current environment is not a web browser"}),Ee(typeof window>"u"||window.localStorage!==void 0,function(){return"Current browser does not appear to support localStorage"}),this.LS=window.localStorage}return _.prototype.listModels=function(){return S(this,void 0,void 0,function(){var m,f,y,E,z,Y;return M(this,function(Z){for(m={},f=$c+Ou,y=Ou+au,E=0;E<this.LS.length;++E)(z=this.LS.key(E)).startsWith(f)&&z.endsWith(y)&&(Y=Vf(z),m[Y]=JSON.parse(this.LS.getItem(z)));return[2,m]})})},_.prototype.removeModel=function(m){return S(this,void 0,void 0,function(){var f,y;return M(this,function(E){var z;if(m=(z=m).startsWith(fc.URL_SCHEME)?z.slice(fc.URL_SCHEME.length):z,f=yg(m),this.LS.getItem(f.info)==null)throw new Error("Cannot find model at path '"+m+"'");return y=JSON.parse(this.LS.getItem(f.info)),this.LS.removeItem(f.info),this.LS.removeItem(f.topology),this.LS.removeItem(f.weightSpecs),this.LS.removeItem(f.weightData),[2,y]})})},_}();if(L().getBool("IS_BROWSER"))try{zh.registerManager(fc.URL_SCHEME,new $f)}catch{}var nm="model",Rb=".json",Bb=".weights.bin";function Pb(_){return new Promise(function(m){return setTimeout(m)}).then(_)}var Oy=function(){function _(m){if(!L().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");m.startsWith(_.URL_SCHEME)&&(m=m.slice(_.URL_SCHEME.length)),m!=null&&m.length!==0||(m=nm),this.modelTopologyFileName=m+Rb,this.weightDataFileName=m+Bb}return _.prototype.save=function(m){return S(this,void 0,void 0,function(){var f,y,E,z,Y,Z;return M(this,function(le){switch(le.label){case 0:if(typeof document>"u")throw new Error("Browser downloads are not supported in this environment since `document` is not present");if(f=window.URL.createObjectURL(new Blob([m.weightData],{type:"application/octet-stream"})),!(m.modelTopology instanceof ArrayBuffer))return[3,1];throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");case 1:return y=[{paths:["./"+this.weightDataFileName],weights:m.weightSpecs}],E={modelTopology:m.modelTopology,format:m.format,generatedBy:m.generatedBy,convertedBy:m.convertedBy,weightsManifest:y},z=window.URL.createObjectURL(new Blob([JSON.stringify(E)],{type:"application/json"})),(Y=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor).download=this.modelTopologyFileName,Y.href=z,[4,Pb(function(){return Y.dispatchEvent(new MouseEvent("click"))})];case 2:return le.sent(),m.weightData==null?[3,4]:((Z=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,Z.href=f,[4,Pb(function(){return Z.dispatchEvent(new MouseEvent("click"))})]);case 3:le.sent(),le.label=4;case 4:return[2,{modelArtifactsInfo:sl(m)}]}})})},_.URL_SCHEME="downloads://",_}(),A1=function(){function _(m){if(m==null||m.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+m);this.files=m}return _.prototype.load=function(){return S(this,void 0,void 0,function(){var m,f,y=this;return M(this,function(E){return m=this.files[0],f=this.files.slice(1),[2,new Promise(function(z,Y){var Z=new FileReader;Z.onload=function(le){var de=JSON.parse(le.target.result),we=de.modelTopology;if(we!=null){f.length===0&&z({modelTopology:we});var De=de.weightsManifest;if(De!=null){var Ne;try{Ne=y.checkManifestAndWeightFiles(De,f)}catch(Xe){return void Y(Xe)}var Fe=[],Ve=[],Je=[];De.forEach(function(Xe){Xe.paths.forEach(function(ot){Ve.push(ot),Je.push(null)}),Fe.push.apply(Fe,Xe.weights)}),De.forEach(function(Xe){Xe.paths.forEach(function(ot){var xt=new FileReader;xt.onload=function(kt){var At=kt.target.result,Lt=Ve.indexOf(ot);Je[Lt]=At,Je.indexOf(null)===-1&&z({modelTopology:we,weightSpecs:Fe,weightData:Fd(Je),format:de.format,generatedBy:de.generatedBy,convertedBy:de.convertedBy,userDefinedMetadata:de.userDefinedMetadata})},xt.onerror=function(kt){return Y("Failed to weights data from file of path '"+ot+"'.")},xt.readAsArrayBuffer(Ne[ot])})})}else Y(new Error("weightManifest field is missing from file "+m.name))}else Y(new Error("modelTopology field is missing from file "+m.name))},Z.onerror=function(le){return Y("Failed to read model topology and weights manifest JSON from file '"+m.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},Z.readAsText(m)})]})})},_.prototype.checkManifestAndWeightFiles=function(m,f){for(var y=[],E=f.map(function(le){return Uf(le.name)}),z={},Y=0,Z=m;Y<Z.length;Y++)Z[Y].paths.forEach(function(le){var de=Uf(le);if(y.indexOf(de)!==-1)throw new Error("Duplicate file basename found in weights manifest: '"+de+"'");if(y.push(de),E.indexOf(de)===-1)throw new Error("Weight file with basename '"+de+"' is not provided.");z[le]=f[E.indexOf(de)]});if(y.length!==f.length)throw new Error("Mismatch in the number of files in weights manifest ("+y.length+") and the number of weight files provided ("+f.length+").");return z},_}();function Dy(_,m,f,y){(function(z){Ee(z!=null&&Array.isArray(z)&&z.length>0,function(){return"promises must be a none empty array"})})(_),function(z,Y){Ee(z>=0&&z<=1,function(){return"Progress fraction must be in range [0, 1], but got startFraction "+z}),Ee(Y>=0&&Y<=1,function(){return"Progress fraction must be in range [0, 1], but got endFraction "+Y}),Ee(Y>=z,function(){return"startFraction must be no more than endFraction, but got startFraction "+z+" and endFraction "+Y})}(f=f??0,y=y??1);var E=0;return Promise.all(_.map(function(z){return z.then(function(Y){var Z=f+ ++E/_.length*(y-f);return m(Z),Y}),z}))}function O1(_,m){return S(this,void 0,void 0,function(){var f,y,E,z,Y,Z,le,de,we;return M(this,function(De){switch(De.label){case 0:return m==null&&(m={}),f=m.fetchFunc==null?L().platform.fetch:m.fetchFunc,y=_.map(function(Ne){return f(Ne,m.requestInit,{isBinary:!0})}),E=0,z=.5,m.onProgress!=null?[3,2]:[4,Promise.all(y)];case 1:return Y=De.sent(),[3,4];case 2:return[4,Dy(y,m.onProgress,E,z)];case 3:Y=De.sent(),De.label=4;case 4:return Z=Y.map(function(Ne){return Ne.arrayBuffer()}),le=.5,de=1,m.onProgress!=null?[3,6]:[4,Promise.all(Z)];case 5:return we=De.sent(),[3,8];case 6:return[4,Dy(Z,m.onProgress,le,de)];case 7:we=De.sent(),De.label=8;case 8:return[2,we]}})})}function Ml(_){var m=this;return function(f,y,E){return y===void 0&&(y=""),S(m,void 0,void 0,function(){var z,Y,Z,le,de,we,De,Ne,Fe,Ve;return M(this,function(Je){switch(Je.label){case 0:if(z=f.map(function(){return!1}),Y={},Z=E!=null?E.map(function(){return!1}):[],le=[],f.forEach(function(Xe,ot){var xt=0;Xe.weights.forEach(function(kt){var At="quantization"in kt?kt.quantization.dtype:kt.dtype,Lt=wc[At]*Ke(kt.shape),tn=function(){z[ot]=!0,Y[ot]==null&&(Y[ot]=[]),Y[ot].push({manifestEntry:kt,groupOffset:xt,sizeBytes:Lt})};E!=null?E.forEach(function(ln,nn){ln===kt.name&&(tn(),Z[nn]=!0)}):tn(),le.push(kt.name),xt+=Lt})}),!Z.every(function(Xe){return Xe}))throw de=E.filter(function(Xe,ot){return!Z[ot]}),new Error("Could not find weights in manifest with names: "+de.join(", ")+`. 3829Manifest JSON has weights with names: `+le.join(", ")+".");return we=z.reduce(function(Xe,ot,xt){return ot&&Xe.push(xt),Xe},[]),De=[],we.forEach(function(Xe){f[Xe].paths.forEach(function(ot){var xt=y+(y.endsWith("/")?"":"/")+ot;De.push(xt)})}),[4,_(De)];case 1:return Ne=Je.sent(),Fe={},Ve=0,we.forEach(function(Xe){for(var ot=f[Xe].paths.length,xt=0,kt=0;kt<ot;kt++)xt+=Ne[Ve+kt].byteLength;for(var At=new ArrayBuffer(xt),Lt=new Uint8Array(At),tn=0,ln=0;ln<ot;ln++){var nn=new Uint8Array(Ne[Ve+ln]);Lt.set(nn,tn),tn+=nn.byteLength}Y[Xe].forEach(function(cn){var Dn=Jp(At.slice(cn.groupOffset,cn.groupOffset+cn.sizeBytes),[cn.manifestEntry]);for(var Rn in Dn)Fe[Rn]=Dn[Rn]}),Ve+=ot}),[2,Fe]}})})}}ks.registerSaveRouter(function(_){return L().getBool("IS_BROWSER")&&!Array.isArray(_)&&_.startsWith(Oy.URL_SCHEME)?function(m){return m===void 0&&(m="model"),new Oy(m)}(_.slice(Oy.URL_SCHEME.length)):null});var jb=function(){function _(m,f){if(this.DEFAULT_METHOD="POST",f==null&&(f={}),this.weightPathPrefix=f.weightPathPrefix,this.onProgress=f.onProgress,f.fetchFunc!=null?(Ee(typeof f.fetchFunc=="function",function(){return"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"}),this.fetch=f.fetchFunc):this.fetch=L().platform.fetch,Ee(m!=null&&m.length>0,function(){return"URL path for http must not be null, undefined or empty."}),Array.isArray(m)&&Ee(m.length===2,function(){return"URL paths for http must have a length of 2, (actual length is "+m.length+")."}),this.path=m,f.requestInit!=null&&f.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=f.requestInit||{}}return _.prototype.save=function(m){return S(this,void 0,void 0,function(){var f,y,E,z;return M(this,function(Y){switch(Y.label){case 0:if(m.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(f=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,y=[{paths:["./model.weights.bin"],weights:m.weightSpecs}],E={modelTopology:m.modelTopology,format:m.format,generatedBy:m.generatedBy,convertedBy:m.convertedBy,userDefinedMetadata:m.userDefinedMetadata,weightsManifest:y},f.body.append("model.json",new Blob([JSON.stringify(E)],{type:"application/json"}),"model.json"),m.weightData!=null&&f.body.append("model.weights.bin",new Blob([m.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,this.fetch(this.path,f)];case 1:if((z=Y.sent()).ok)return[2,{modelArtifactsInfo:sl(m),responses:[z]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+z.status+".")}})})},_.prototype.load=function(){return S(this,void 0,void 0,function(){var m,f,y,E,z,Y,Z,le,de,we,De,Ne;return M(this,function(Fe){switch(Fe.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(m=Fe.sent()).ok)throw new Error("Request to "+this.path+" failed with status code "+m.status+". Please verify this URL points to the model JSON of the model to load.");Fe.label=2;case 2:return Fe.trys.push([2,4,,5]),[4,m.json()];case 3:return f=Fe.sent(),[3,5];case 4:throw Fe.sent(),y="Failed to parse model JSON of response from "+this.path+".",this.path.endsWith(".pb")?y+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":y+=" Please make sure the server is serving valid JSON for this request.",new Error(y);case 5:if(E=f.modelTopology,z=f.weightsManifest,Y=f.generatedBy,Z=f.convertedBy,le=f.format,de=f.userDefinedMetadata,E==null&&z==null)throw new Error("The JSON from HTTP path "+this.path+" contains
3829neither model topology or manifest for weights.");return z==null?[3,7]:[4,this.loadWeights(z)];case 6:Ne=Fe.sent(),we=Ne[0],De=Ne[1],Fe.label=7;case 7:return[2,{modelTopology:E,weightSpecs:we,weightData:De,userDefinedMetadata:de,generatedBy:Y,convertedBy:Z,format:le}]}})})},_.prototype.loadWeights=function(m){return S(this,void 0,void 0,function(){var f,y,E,z,Y,Z,le,de,we,De,Ne;return M(this,function(Fe){switch(Fe.label){case 0:for(f=Array.isArray(this.path)?this.path[1]:this.path,y=function(Ve){var Je=Ve.lastIndexOf("/"),Xe=Ve.lastIndexOf("?");return[Ve.substring(0,Je)+"/",Xe>Je?Ve.substring(Xe):""]}(f),E=y[0],z=y[1],Y=this.weightPathPrefix||E,Z=[],le=0,de=m;le<de.length;le++)we=de[le],Z.push.apply(Z,we.weights);return De=[],m.forEach(function(Ve){Ve.paths.forEach(function(Je){De.push(Y+Je+z)})}),[4,O1(De,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress})];case 1:return Ne=Fe.sent(),[2,[Z,Fd(Ne)]]}})})},_.URL_SCHEME_REGEX=/^https?:\/\//,_}();function cl(_){return _.match(jb.URL_SCHEME_REGEX)!=null}var Pd=function(_,m){return typeof fetch>"u"?null:(Array.isArray(_)?_.every(function(f){return cl(f)}):cl(_))?C(_,{onProgress:m}):null};function C(_,m){return new jb(_,m)}ks.registerSaveRouter(Pd),ks.registerLoadRouter(Pd);var x,p=function(){function _(m){this.modelArtifacts=m}return _.prototype.load=function(){return S(this,void 0,void 0,function(){return M(this,function(m){return[2,this.modelArtifacts]})})},_}(),w=function(){function _(m){this.saveHandler=m}return _.prototype.save=function(m){return S(this,void 0,void 0,function(){return M(this,function(f){return[2,this.saveHandler(m)]})})},_}(),D=Object.freeze({browserFiles:function(_){return new A1(_)},browserHTTPRequest:function(_,m){return C(_,m)},concatenateArrayBuffers:Fd,decodeWeights:Jp,encodeWeights:function(_,m){return S(this,void 0,void 0,function(){var f,y,E,z,Y,Z=this;return M(this,function(le){switch(le.label){case 0:for(f=[],y=[],E=Array.isArray(_)?_.map(function(de){return de.name}):Object.keys(_),z=function(de){var we=E[de],De=Array.isArray(_)?_[de].tensor:_[we];if(De.dtype!=="float32"&&De.dtype!=="int32"&&De.dtype!=="bool"&&De.dtype!=="string")throw new Error("Unsupported dtype in weight '"+we+"': "+De.dtype);var Ne={name:we,shape:De.shape,dtype:De.dtype};if(De.dtype==="string"){var Fe=new Promise(function(Ve){return S(Z,void 0,void 0,function(){var Je,Xe,ot,xt,kt,At,Lt;return M(this,function(tn){switch(tn.label){case 0:return[4,De.bytes()];case 1:for(Je=tn.sent(),Xe=Je.reduce(function(ln,nn){return ln+nn.length},0)+_c*Je.length,ot=new Uint8Array(Xe),xt=0,kt=0;kt<Je.length;kt++)At=Je[kt],Lt=new Uint8Array(new Uint32Array([At.length]).buffer),ot.set(Lt,xt),xt+=_c,ot.set(At,xt),xt+=At.length;return Ve(ot),[2]}})})});y.push(Fe)}else y.push(De.data());m!=null&&(Ne.group=m),f.push(Ne)},Y=0;Y<E.length;++Y)z(Y);return[4,Promise.all(y)];case 1:return[2,{data:function(de){if(de===null)throw new Error("Invalid input value: "+JSON.stringify(de));var we=0,De=[];de.forEach(function(Ve){if(we+=Ve.byteLength,De.push(Ve.byteLength===Ve.buffer.byteLength?Ve:new Ve.constructor(Ve)),!(Ve instanceof Float32Array||Ve instanceof Int32Array||Ve instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: "+Ve.constructor.name)});var Ne=new Uint8Array(we),Fe=0;return De.forEach(function(Ve){Ne.set(new Uint8Array(Ve.buffer),Fe),Fe+=Ve.byteLength}),Ne.buffer}(le.sent()),specs:f}]}})})},fromMemory:function(_,m,f,y){return arguments.length===1?_.modelTopology!=null||_.weightSpecs!=null?new p(_):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new p({modelTopology:_})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new p({modelTopology:_,weightSpecs:m,weightData:f,trainingConfig:y}))},getLoadHandlers:function(_,m){return ks.getLoadHandlers(_,m)},getModelArtifactsInfoForJSON:sl,getSaveHandlers:function(_){return ks.getSaveHandlers(_)},http:C,isHTTPScheme:cl,loadWeights:function(_,m,f,y){return m===void 0&&(m=""),S(this,void 0,void 0,function(){return M(this,function(E){return[2,Ml(function(z){return O1(z,{requestInit:y}
vendor: 24,769 bytes, line 3829
3829)})(_,m,f)]})})},registerLoadRouter:function(_){return ks.registerLoadRouter(_)},registerSaveRouter:function(_){return ks.registerSaveRouter(_)},weightsLoaderFactory:Ml,withSaveHandler:function(_){return new w(_)},copyModel:function(_,m){return S(this,void 0,void 0,function(){return M(this,function(f){return[2,Bd(_,m,!1)]})})},listModels:function(){return S(this,void 0,void 0,function(){var _,m,f,y,E,z,Y;return M(this,function(Z){switch(Z.label){case 0:_=zh.getSchemes(),m={},f=0,y=_,Z.label=1;case 1:return f<y.length?(E=y[f],[4,zh.getManager(E).listModels()]):[3,4];case 2:for(Y in z=Z.sent())m[E+Rd+Y]=z[Y];Z.label=3;case 3:return f++,[3,1];case 4:return[2,m]}})})},moveModel:function(_,m){return S(this,void 0,void 0,function(){return M(this,function(f){return[2,Bd(_,m,!0)]})})},removeModel:function(_){return S(this,void 0,void 0,function(){var m;return M(this,function(f){return m=Qp(_),[2,zh.getManager(m.scheme).removeModel(m.path)]})})}}),W=Bt({confusionMatrix_:function(_,m,f){var y=et(_,"labels","confusionMatrix"),E=et(m,"predictions","confusionMatrix");Ee(f==null||f>0&&Number.isInteger(f),function(){return"If provided, numClasses must be a positive integer, but got "+f}),Ee(y.rank===1,function(){return"Expected the rank of labels to be 1, but got "+y.rank}),Ee(E.rank===1,function(){return"Expected the rank of predictions to be 1, but got "+E.rank}),Ee(y.shape[0]===E.shape[0],function(){return"Mismatch in the number of examples: "+y.shape[0]+" vs. "+E.shape[0]+". Labels and predictions should have the same number of elements."}),Ee(f>0&&Number.isInteger(f),function(){return"numClasses is required to be a positive integer, but got "+f});var z=Dl(y.asType("int32"),f),Y=Dl(E.asType("int32"),f);return z.transpose().matMul(Y).asType("int32")}}),Q=Object.freeze({confusionMatrix:W}),ie=Bt({fromPixels_:function(_,m){if(m===void 0&&(m=3),m>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(_==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var f=!1,y=!1,E=!1,z=!1,Y=!1;if(_.data instanceof Uint8Array)f=!0;else if(typeof ImageData<"u"&&_ instanceof ImageData)y=!0;else if(typeof HTMLVideoElement<"u"&&_ instanceof HTMLVideoElement)E=!0;else if(typeof HTMLImageElement<"u"&&_ instanceof HTMLImageElement)z=!0;else{if(_.getContext==null)throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was "+_.constructor.name);Y=!0}if(E&&E&&_.readyState<2)throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the <video> element.");if(J("FromPixels",qe.backendName)!=null)return qe.runKernel("FromPixels",{pixels:_},{numChannels:m});var Z,le,de=E?[_.videoWidth,_.videoHeight]:[_.width,_.height],we=de[0],De=de[1];if(Y?Z=_.getContext("2d").getImageData(0,0,we,De).data:y||f?Z=_.data:(z||E)&&(x==null&&(x=document.createElement("canvas").getContext("2d")),x.canvas.width=we,x.canvas.height=De,x.drawImage(_,0,0,we,De),Z=x.getImageData(0,0,we,De).data),m===4)le=new Int32Array(Z);else{var Ne=we*De;le=new Int32Array(Ne*m);for(var Fe=0;Fe<Ne;Fe++)for(var Ve=0;Ve<m;++Ve)le[Fe*m+Ve]=Z[4*Fe+Ve]}return bf(le,[De,we,m],"int32")}}),fe=Object.freeze({toPixels:function(_,m){return S(this,void 0,void 0,function(){var f,y,E,z,Y,Z,le,de,we,De,Ne,Fe,Ve,Je,Xe,ot,xt,kt,At,Lt,tn,ln,nn;return M(this,function(cn){switch(cn.label){case 0:if(f=et(_,"img","toPixels"),_ instanceof Zt||(f=f.toInt()),f.rank!==2&&f.rank!==3)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+f.rank+".");if(y=f.shape.slice(0,2),E=y[0],z=y[1],(Y=f.rank===2?1:f.shape[2])>4||Y===2)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+Y);return[4,f.data()];case 1:return Z=cn.sent(),le=f.min(),de=f.max(),[4,Promise.all([le.data(),de.data()])];case 2:if(we=cn.sent(),De=we[0],Ne=we[1],Fe=De[0],Ve=Ne[0],le.dispose(),de.dispose(),f.dtype==="float32"){if(Fe<0||Ve>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+Fe+" - "+Ve+"].")}else{if(f.dtype!=="int32")throw new Error("Unsupported type for toPixels: "+f.dtype+". Please use float32 or int32 tensors.");if(Fe<0||Ve>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+Fe+" - "+Ve+"].")}for(Je=f.dtype==="float32"?255:1,Xe=new Uint8ClampedArray(z*E*4),ot=0;ot<E*z;++ot)xt=void 0,kt=void 0,At=void 0,Lt=void 0,Y===1?(xt=Z[ot]*Je,kt=Z[ot]*Je,At=Z[ot]*Je,Lt=255):Y===3?(xt=Z[3*ot]*Je,kt=Z[3*ot+1]*Je,At=Z[3*ot+2]*Je,Lt=255):Y===4&&(xt=Z[4*ot]*Je,kt=Z[4*ot+1]*Je,At=Z[4*ot+2]*Je,Lt=Z[4*ot+3]*Je),Xe[0+(tn=4*ot)]=Math.round(xt),Xe[tn+1]=Math.round(kt),Xe[tn+2]=Math.round(At),Xe[tn+3]=Math.round(Lt);return m!=null&&(m.width=z,m.height=E,ln=m.getContext("2d"),nn=new ImageData(Xe,z,E),ln.putImageData(nn,0,0)),f!==_&&f.dispose(),[2,Xe]}})})},fromPixels:ie}),ye=function(){function _(){}return _.prototype.getClassName=function(){return this.constructor.className},_.fromConfig=function(m,f){return new m(f)},_}(),Oe=function(){function _(){this.classNameMap={}}return _.getMap=function(){return _.instance==null&&(_.instance=new _),_.instance},_.register=function(m){_.getMap().classNameMap[m.className]=[m,m.fromConfig]},_}();function Re(_){Ee(_.className!=null,function(){return"Class being registered does not have the static className property defined."}),Ee(typeof _.className=="string",function(){return"className is required to be a string, but got type "+typeof _.className}),Ee(_.className.length>0,function(){return"Class being registered has an empty-string as its className, which is disallowed."}),Oe.register(_)}var Pe=Object.freeze({Serializable:ye,SerializationMap:Oe,registerClass:Re}),je="1.7.4",Ge=Object.freeze({gpgpu_util:Ql,webgl_util:oh,forceHalfFloat:function(){L().set("WEBGL_FORCE_F16_TEXTURES",!0)},MathBackendWebGL:$g,setWebGLContext:Lo,GPGPUContext:W0}),rt=function(_){function m(){return _!==null&&_.apply(this,arguments)||this}return A(m,_),m.prototype.minimize=function(f,y,E){y===void 0&&(y=!1);var z=this.computeGradients(f,E),Y=z.value,Z=z.grads;if(E!=null){var le=E.map(function(de){return{name:de.name,tensor:Z[de.name]}});this.applyGradients(le)}else this.applyGradients(Z);return ca(Z),y?Y:(Y.dispose(),null)},Object.defineProperty(m.prototype,"iterations",{get:function(){return this.iterations_==null&&(this.iterations_=0),this.iterations_},enumerable:!0,configurable:!0}),m.prototype.incrementIterations=function(){this.iterations_=this.iterations+1},m.prototype.computeGradients=function(f,y){return B(f,y)},m.prototype.dispose=function(){this.iterations_!=null&&ca(this.iterations_)},m.prototype.saveIterations=function(){return S(this,void 0,void 0,function(){return M(this,function(f){return this.iterations_==null&&(this.iterations_=0),[2,{name:"iter",tensor:Or(this.iterations_,"int32")}]})})},m.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(f){throw new Error("getWeights() is not implemented for this optimizer yet.")})})},m.prototype.setWeights=function(f){return S(this,void 0,void 0,function(){return M(this,function(y){throw new Error("setWeights() is not implemented for this optimizer class "+this.getClassName())})})},m.prototype.extractIterations=function(f){return S(this,void 0,void 0,function(){var y;return M(this,function(E){switch(E.label){case 0:return y=this,[4,f[0].tensor.data()];case 1:return y.iterations_=E.sent()[0],[2,f.slice(1)]}})})},m}(ye);Object.defineProperty(rt,Symbol.hasInstance,{value:function(_){return _.minimize!=null&&_.computeGradients!=null&&_.applyGradients!=null}});var nt=function(_){function m(f,y,E){E===void 0&&(E=null);var z=_.call(this)||this;return z.learningRate=f,z.rho=y,z.epsilon=E,z.accumulatedGrads=[],z.accumulatedUpdates=[],E==null&&(z.epsilon=qe.backend.epsilon()),z}return A(m,_),m.prototype.applyGradients=function(f){var y=this;(Array.isArray(f)?f.map(function(E){return E.name}):Object.keys(f)).forEach(function(E,z){var Y=qe.registeredVariables[E];y.accumulatedGrads[z]==null&&(y.accumulatedGrads[z]={originalName:E+"/accum_grad",variable:eo(function(){return Ei(Y).variable(!1)})}),y.accumulatedUpdates[z]==null&&(y.accumulatedUpdates[z]={originalName:E+"/accum_var",variable:eo(function(){return Ei(Y).variable(!1)})});var Z=Array.isArray(f)?f[z].tensor:f[E];if(Z!=null){var le=y.accumulatedGrads[z].variable,de=y.accumulatedUpdates[z].variable;eo(function(){var we=le.mul(y.rho).add(Z.square().mul(1-y.rho)),De=de.add(y.epsilon).sqrt().div(le.add(y.epsilon).sqrt()).mul(Z),Ne=de.mul(y.rho).add(De.square().mul(1-y.rho));le.assign(we),de.assign(Ne);var Fe=De.mul(-y.learningRate).add(Y);Y.assign(Fe)})}}),this.incrementIterations()},m.prototype.dispose=function(){this.accumulatedUpdates!=null&&(ca(this.accumulatedGrads.map(function(f){return f.variable})),ca(this.accumulatedUpdates.map(function(f){return f.variable})))},m.prototype.getWeights=function(){return S(this,void 0,void 0,function(){var f;return M(this,function(y){switch(y.label){case 0:return f=this.accumulatedGrads.concat(this.accumulatedUpdates),[4,this.saveIterations()];case 1:return[2,[y.sent()].concat(f.map(function(E){return{name:E.originalName,tensor:E.variable}}))]}})})},m.prototype.setWeights=function(f){return S(this,void 0,void 0,function(){var y;return M(this,function(E){switch(E.label){case 0:return[4,this.extractIterations(f)];case 1:return f=E.sent(),y=f.length/2,this.accumulatedGrads=f.slice(0,y).map(function(z){return{originalName:z.name,variable:z.tensor.variable(!1)}}),this.accumulatedUpdates=f.slice(y,2*y).map(function(z){return{originalName:z.name,variable:z.tensor.variable(!1)}}),[2]}})})},m.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},m.fromConfig=function(f,y){return new f(y.learningRate,y.rho,y.epsilon)},m.className="Adadelta",m}(rt);Re(nt);var lt=function(_){function m(f,y){y===void 0&&(y=.1);var E=_.call(this)||this;return E.learningRate=f,E.initialAccumulatorValue=y,E.accumulatedGrads=[],E}return A(m,_),m.prototype.applyGradients=function(f){var y=this;(Array.isArray(f)?f.map(function(E){return E.name}):Object.keys(f)).forEach(function(E,z){var Y=qe.registeredVariables[E];y.accumulatedGrads[z]==null&&(y.accumulatedGrads[z]={originalName:E+"/accumulator",variable:eo(function(){return xu(Y.shape,y.initialAccumulatorValue).variable(!1)})});var Z=Array.isArray(f)?f[z].tensor:f[E];if(Z!=null){var le=y.accumulatedGrads[z].variable;eo(function(){var de=le.add(Z.square());le.assign(de);var we=Z.div(de.add(qe.backend.epsilon()).sqrt()).mul(-y.learningRate).add(Y);Y.assign(we)})}}),this.incrementIterations()},m.prototype.dispose=function(){this.accumulatedGrads!=null&&ca(this.accumulatedGrads.map(function(f){return f.variable}))},m.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(f){switch(f.label){case 0:return[4,this.saveIterations()];case 1:return[2,[f.sent()].concat(this.accumulatedGrads.map(function(y){return{name:y.originalName,tensor:y.variable}}))]}})})},m.prototype.setWeights=function(f){return S(this,void 0,void 0,function(){return M(this,function(y){switch(y.label){case 0:return[4,this.extractIterations(f)];case 1:return f=y.sent(),this.accumulatedGrads=f.map(function(E){return{originalName:E.name,variable:E.tensor.variable(!1)}}),[2]}})})},m.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},m.fromConfig=function(f,y){return new f(y.learningRate,y.initialAccumulatorValue)},m.className="Adagrad",m}(rt);Re(lt);var Nt=function(_){function m(f,y,E,z){z===void 0&&(z=null);var Y=_.call(this)||this;return Y.learningRate=f,Y.beta1=y,Y.beta2=E,Y.epsilon=z,Y.accumulatedFirstMoment=[],Y.accumulatedSecondMoment=[],eo(function(){Y.accBeta1=Or(y).variable(),Y.accBeta2=Or(E).variable()}),z==null&&(Y.epsilon=qe.backend.epsilon()),Y}return A(m,_),m.prototype.applyGradients=function(f){var y=this,E=Array.isArray(f)?f.map(function(z){return z.name}):Object.keys(f);eo(function(){var z=ps(1,y.accBeta1),Y=ps(1,y.accBeta2);E.forEach(function(Z,le){var de=qe.registeredVariables[Z];y.accumulatedFirstMoment[le]==null&&(y.accumulatedFirstMoment[le]={originalName:Z+"/m",variable:eo(function(){return Ei(de).variable(!1)})}),y.accumulatedSecondMoment[le]==null&&(y.accumulatedSecondMoment[le]={originalName:Z+"/v",variable:eo(function(){return Ei(de).variable(!1)})});var we=Array.isArray(f)?f[le].tensor:f[Z];if(we!=null){var De=y.accumulatedFirstMoment[le].variable,Ne=y.accumulatedSecondMoment[le].variable,Fe=De.mul(y.beta1).add(we.mul(1-y.beta1)),Ve=Ne.mul(y.beta2).add(we.square().mul(1-y.beta2)),Je=Fe.div(z),Xe=Ve.div(Y);De.assign(Fe),Ne.assign(Ve);var ot=Je.div(Xe.sqrt().add(y.epsilon)).mul(-y.learningRate).add(de);de.assign(ot)}}),y.accBeta1.assign(y.accBeta1.mul(y.beta1)),y.accBeta2.assign(y.accBeta2.mul(y.beta2))}),this.incrementIterations()},m.prototype.dispose=function(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&ca(this.accumulatedFirstMoment.map(function(f){return f.variable})),this.accumulatedSecondMoment!=null&&ca(this.accumulatedSecondMoment.map(function(f){return f.variable}))},m.prototype.getWeights=function(){return S(this,void 0,void 0,function(){var f;return M(this,function(y){switch(y.label){case 0:return f=this.accumulatedFirstMoment.concat(this.accumulatedSecondMoment),[4,this.saveIterations()];case 1:return[2,[y.sent()].concat(f.map(function(E){return{name:E.originalName,tensor:E.variable}}))]}})})},m.prototype.setWeights=function(f){return S(this,void 0,void 0,function(){var y,E=this;return M(this,function(z){switch(z.label){case 0:return[4,this.extractIterations(f)];case 1:return f=z.sent(),eo(function(){E.accBeta1.assign(Gu(E.beta1,E.iterations_+1)),E.accBeta2.assign(Gu(E.beta2,E.iterations_+1))}),y=f.length/2,this.accumulatedFirstMoment=f.slice(0,y).map(function(Y){return{originalName:Y.name,variable:Y.tensor.variable(!1)}}),this.accumulatedSecondMoment=f.slice(y,2*y).map(function(Y){return{originalName:Y.name,variable:Y.tensor.variable(!1)}}),[2]}})})},m.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},m.fromConfig=function(f,y){return new f(y.learningRate,y.beta1,y.beta2,y.epsilon)},m.className="Adam",m}(rt);Re(Nt);var Rt=function(_){function m(f,y,E,z,Y){z===void 0&&(z=null),Y===void 0&&(Y=0);var Z=_.call(this)||this;return Z.learningRate=f,Z.beta1=y,Z.beta2=E,Z.epsilon=z,Z.decay=Y,Z.accumulatedFirstMoment=[],Z.accumulatedWeightedInfNorm=[],eo(function(){Z.iteration=Or(0).variable(),Z.accBeta1=Or(y).variable()}),z==null&&(Z.epsilon=qe.backend.epsilon()),Z}return A(m,_),m.prototype.applyGradients=function(f){var y=this,E=Array.isArray(f)?f.map(function(z){return z.name}):Object.keys(f);eo(function(){var z=ps(1,y.accBeta1),Y=Da(-y.learningRate,y.iteration.mul(y.decay).add(1));E.forEach(function(Z,le){var de=qe.registeredVariables[Z];y.accumulatedFirstMoment[le]==null&&(y.accumulatedFirstMoment[le]={originalName:Z+"/m",variable:Ei(de).variable(!1)}),y.accumulatedWeightedInfNorm[le]==null&&(y.accumulatedWeightedInfNorm[le]={originalName:Z+"/v",variable:Ei(de).variable(!1)});var we=Array.isArray(f)?f[le].tensor:f[Z];if(we!=null){var De=y.accumulatedFirstMoment[le].variable,Ne=y.accumulatedWeightedInfNorm[le].variable,Fe=De.mul(y.beta1).add(we.mul(1-y.beta1)),Ve=Ne.mul(y.beta2),Je=we.abs(),Xe=Ve.maximum(Je);De.assign(Fe),Ne.assign(Xe);var ot=Y.div(z).mul(Fe.div(Xe.add(y.epsilon))).add(de);de.assign(ot)}}),y.iteration.assign(y.iteration.add(1)),y.accBeta1.assign(y.accBeta1.mul(y.beta1))}),this.incrementIterations()},m.prototype.dispose=function(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&ca(this.accumulatedFirstMoment.map(function(f){return f.variable})),this.accumulatedWeightedInfNorm!=null&&ca(this.accumulatedWeightedInfNorm.map(function(f){return f.variable}))},m.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(f){throw new Error("getWeights() is not implemented for Adamax yet.")})})},m.prototype.setWeights=function(f){return S(this,void 0,void 0,function(){return M(this,function(y){throw new Error("setWeights() is not implemented for Adamax yet.")})})},m.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},m.fromConfig=function(f,y){return new f(y.learningRate,y.beta1,y.beta2,y.epsilon,y.decay)},m.className="Adamax",m}(rt);Re(Rt);var Pt=function(_){function m(f){var y=_.call(this)||this;return y.learningRate=f,y.setLearningRate(f),y}return A(m,_),m.prototype.applyGradients=function(f){var y=this;(Array.isArray(f)?f.map(function(E){return E.name}):Object.keys(f)).forEach(function(E,z){var Y=Array.isArray(f)?f[z].tensor:f[E];if(Y!=null){var Z=qe.registeredVariables[E];eo(function(){var le=y.c.mul(Y).add(Z);Z.assign(le)})}}),this.incrementIterations()},m.prototype.setLearningRate=function(f){this.learningRate=f,this.c!=null&&this.c.dispose(),this.c=xp(Or(-f))},m.prototype.dispose=function(){this.c.dispose()},m.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(f){switch(f.label){case 0:return[4,this.saveIterations()];case 1:return[2,[f.sent()]]}})})},m.prototype.setWeights=function(f){return S(this,void 0,void 0,function(){return M(this,function(y){switch(y.label){case 0:return[4,this.extractIterations(f)];case 1:if((f=y.sent()).length!==0)throw new Error("SGD optimizer does not have settable weights.");return[2]}})})},m.prototype.getConfig=function(){return{learningRate:this.learningRate}},m.fromConfig=function(f,y){return new f(y.learningRate)},m.className="SGD",m}(rt);Re(Pt);var Kt=function(_){function m(f,y,E){E===void 0&&(E=!1);var z=_.call(this,f)||this;return z.learningRate=f,z.momentum=y,z.useNesterov=E,z.accumulations=[],z.m=Or(z.momentum),z}return A(m,_),m.prototype.applyGradients=function(f){var y=this;(Array.isArray(f)?f.map(function(E){return E.name}):Object.keys(f)).forEach(function(E,z){var Y=qe.registeredVariables[E];y.accumulations[z]==null&&(y.accumulations[z]={originalName:E+"/momentum",variable:eo(function(){return Ei(Y).variable(!1)})});var Z=y.accumulations[z].variable,le=Array.isArray(f)?f[z].tensor:f[E];le!=null&&eo(function(){var de,we=y.m.mul(Z).add(le);de=y.useNesterov?y.c.mul(le.add(we.mul(y.m))).add(Y):y.c.mul(we).add(Y),Z.assign(we),Y.assign(de)})}),this.incrementIterations()},m.prototype.dispose=function(){this.m.dispose(),this.accumulations!=null&&ca(this.accumulations.map(function(f){return f.variable}))},m.prototype.setMomentum=function(f){this.momentum=f},m.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(f){switch(f.label){case 0:return[4,this.saveIterations()];case 1:return[2,[f.sent()].concat(this.accumulations.map(function(y){return{name:y.originalName,tensor:y.variable}}))]}})})},m.prototype.setWeights=function(f){return S(this,void 0,void 0,function(){return M(this,function(y){switch(y.label){case 0:return[4,this.extractIterations(f)];case 1:return f=y.sent(),this.accumulations=f.map(function(E){return{originalName:E.name,variable:E.tensor.variable(!1)}}),[2]}})})},m.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},m.fromConfig=function(f,y){return new f(y.learningRate,y.momentum,y.useNesterov)},m.className="Momentum",m}(Pt);Re(Kt);var dn=function(_){function m(f,y,E,z,Y){y===void 0&&(y=.9),E===void 0&&(E=0),z===void 0&&(z=null),Y===void 0&&(Y=!1);var Z=_.call(this)||this;if(Z.learningRate=f,Z.decay=y,Z.momentum=E,Z.epsilon=z,Z.accumulatedMeanSquares=[],Z.accumulatedMoments=[],Z.accumulatedMeanGrads=[],Z.centered=Y,z==null&&(Z.epsilon=qe.backend.epsilon()),f==null)throw new Error("learningRate for RMSPropOptimizer must be defined.");return Z}return A(m,_),m.prototype.applyGradients=function(f){var y=this;(Array.isArray(f)?f.map(function(E){return E.name}):Object.keys(f)).forEach(function(E,z){var Y=qe.registeredVariables[E];y.accumulatedMeanSquares[z]==null&&(y.accumulatedMeanSquares[z]={originalName:E+"/rms",variable:eo(function(){return Ei(Y).variable(!1)})}),y.accumulatedMoments[z]==null&&(y.accumulatedMoments[z]={originalName:E+"/momentum",variable:eo(function(){return Ei(Y).variable(!1)})}),y.accumulatedMeanGrads[z]==null&&y.centered&&(y.accumulatedMeanGrads[z]={originalName:E+"/mg",variable:eo(function(){return Ei(Y).variable(!1)})});var Z=Array.isArray(f)?f[z].tensor:f[E];if(Z!=null){var le=y.accumulatedMeanSquares[z].variable,de=y.accumulatedMoments[z].variable;eo(function(){var we=le.mul(y.decay).add(Z.square().mul(1-y.decay));if(y.centered){var De=y.accumulatedMeanGrads[z].variable,Ne=De.mul(y.decay).add(Z.mul(1-y.decay)),Fe=de.mul(y.momentum).add(Z.mul(y.learningRate).div(we.sub(Ne.square().add(y.epsilon)).sqrt()));le.assign(we),De.assign(Ne),de.assign(Fe);var Ve=Y.sub(Fe);Y.assign(Ve)}else{var Je=le.mul(y.decay).add(Z.square().mul(1-y.decay));Fe=de.mul(y.momentum).add(Z.mul(y.learningRate).div(Je.add(y.epsilon).sqrt())),le.assign(Je),de.assign(Fe),Ve=Y.sub(Fe),Y.assign(Ve)}})}}),this.incrementIterations()},m.prototype.dispose=function(){this.accumulatedMeanSquares!=null&&ca(this.accumulatedMeanSquares.map(function(f){return f.variable})),this.accumulatedMeanGrads!=null&&this.centered&&ca(this.accumulatedMeanGrads.map(function(f){return f.variable})),this.accumulatedMoments!=null&&ca(this.accumulatedMoments.map(function(f){return f.variable}))},m.prototype.getWeights=function(){return S(this,void 0,void 0,function(){var f;return M(this,function(y){switch(y.label){case 0:return f=this.accumulatedMeanSquares.concat(this.accumulatedMoments),this.centered&&f.push.apply(f,this.accumulatedMeanGrads),[4,this.saveIterations()];case 1:return[2,[y.sent()].concat(f.map(function(E){return{name:E.originalName,tensor:E.variable}}))]}})})},m.prototype.setWeights=function(f){return S(this,void 0,void 0,function(){var y;return M(this,function(E){switch(E.label){case 0:return[4,this.extractIterations(f)];case 1:return f=E.sent(),y=this.centered?f.length/3:f.length/2,this.accumulatedMeanSquares=f.slice(0,y).map(function(z){return{originalName:z.name,variable:z.tensor.variable(!1)}}),this.accumulatedMoments=f.slice(y,2*y).map(function(z){return{originalName:z.name,variable:z.tensor.variable(!1)}}),this.centered&&(this.accumulatedMeanGrads=f.slice(2*y,3*y).map(function(z){return{originalName:z.name,variable:z.tensor.variable(!1)}})),[2]}})})},m.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},m.fromConfig=function(f,y){return new f(y.learningRate,y.decay,y.momentum,y.epsilon,y.centered)},m.className="RMSProp",m}(rt);Re(dn);var bn=function(){function _(){}return _.sgd=function(m){return new Pt(m)},_.momentum=function(m,f,y){return y===void 0&&(y=!1),new Kt(m,f,y)},_.rmsprop=function(m,f,y,E,z){return f===void 0&&(f=.9),y===void 0&&(y=0),E===void 0&&(E=null),z===void 0&&(z=!1),new dn(m,f,y,E,z)},_.adam=function(m,f,y,E){return m===void 0&&(m=.001),f===void 0&&(f=.9),y===void 0&&(y=.999),E===void 0&&(E=null),new Nt(m,f,y,E)},_.adadelta=function(m,f,y){return m===void 0&&(m=.001),f===void 0&&(f=.95),y===void 0&&(y=null),new nt(m,f,y)},_.adamax=function(m,f,y,E,z){return m===void 0&&(m=.002),f===void 0&&(f=.9),y===void 0&&(y=.999),E===void 0&&(E=null),z===void 0&&(z=0),new Rt(m,f,y,E,z)},_.adagrad=function(m,f){return f===void 0&&(f=.1),new lt(m,f)},_}(),pn={sgd:bn.sgd,momentum:bn.momentum,adadelta:bn.adadelta,adagrad:bn.adagrad,rmsprop:bn.rmsprop,adamax:bn.adamax,adam:bn.adam},_n=typeof requestAnimationFrame<"u"?requestAnimationFrame:g!==void 0?g:function(_){return _()};function On(){return new Promise(function(_){return _n(function(){return _()})})}Zt.prototype.add=function(_){return Pa(this,_)},Zt.prototype.broadcastTo=function(_){return Cd(this,_)},Zt.prototype.div=function(_){return Da(this,_)},Zt.prototype.divNoNan=function(_){return qg(this,_)},Zt.prototype.squaredDifference=function(_){return Qg(this,_)},Zt.prototype.tile=function(_){return Th(this,_)},Zt.prototype.oneHot=function(_,m,f){return m===void 0&&(m=1),f===void 0&&(f=0),Dl(this,_,m,f)},Zt.prototype.transpose=function(_){return wt(this,_)},Zt.prototype.pad=function(_,m){return Vc(this,_,m)},Zt.prototype.batchNorm=function(_,m,f,y,E){return kd(this,_,m,f,y,E)},Ft=qn}.call(this,n(59),n(75),n(92).Buffer,n(207).setImmediate)}
3829,function(a,i,n){function s(Gt,Wt,Sn){return Gt.fields=Wt||[],Gt.fname=Sn,Gt}function h(Gt){return Gt==null?null:Gt.fname}function v(Gt){return Gt==null?null:Gt.fields}function g(Gt){return Gt.length===1?O(Gt[0]):A(Gt)}n.d(i,"a",function(){return be}),n.d(i,"b",function(){return pe}),n.d(i,"c",function(){return Ce}),n.d(i,"d",function(){return ce}),n.d(i,"e",function(){return ke}),n.d(i,"f",function(){return s}),n.d(i,"g",function(){return v}),n.d(i,"h",function(){return h}),n.d(i,"i",function(){return on}),n.d(i,"j",function(){return nr}),n.d(i,"k",function(){return Xt}),n.d(i,"l",function(){return jn}),n.d(i,"m",function(){return hn}),n.d(i,"n",function(){return rn}),n.d(i,"o",function(){return S}),n.d(i,"p",function(){return fn}),n.d(i,"q",function(){return Xn}),n.d(i,"r",function(){return Fn}),n.d(i,"s",function(){return K}),n.d(i,"t",function(){return fi}),n.d(i,"u",function(){return P}),n.d(i,"v",function(){return ci}),n.d(i,"w",function(){return Dr}),n.d(i,"x",function(){return L}),n.d(i,"y",function(){return V}),n.d(i,"z",function(){return qr}),n.d(i,"A",function(){return mi}),n.d(i,"B",function(){return ht}),n.d(i,"C",function(){return Ir}),n.d(i,"D",function(){return ti}),n.d(i,"E",function(){return En}),n.d(i,"F",function(){return ri}),n.d(i,"G",function(){return yi}),n.d(i,"H",function(){return Dt}),n.d(i,"I",function(){return na}),n.d(i,"J",function(){return co}),n.d(i,"K",function(){return $i}),n.d(i,"L",function(){return Ft}),n.d(i,"M",function(){return $e}),n.d(i,"N",function(){return Zt}),n.d(i,"O",function(){return _e}),n.d(i,"P",function(){return Ee}),n.d(i,"Q",function(){return ee}),n.d(i,"R",function(){return Ae}),n.d(i,"S",function(){return Ze}),n.d(i,"T",function(){return Vt}),n.d(i,"U",function(){return sn}),n.d(i,"V",function(){return yn}),n.d(i,"W",function(){return Mt}),n.d(i,"X",function(){return It}),n.d(i,"Y",function(){return ge}),n.d(i,"Z",function(){return Ie}),n.d(i,"Aa",function(){return M}),n.d(i,"Ba",function(){return it}),n.d(i,"Ca",function(){return St}),n.d(i,"Da",function(){return kn}),n.d(i,"Ea",function(){return Ke}),n.d(i,"Fa",function(){return Bn}),n.d(i,"Ga",function(){return rr}),n.d(i,"Ha",function(){return Gn}),n.d(i,"Ia",function(){return J}),n.d(i,"Ja",function(){return ct}),n.d(i,"Ka",function(){return Zn}),n.d(i,"La",function(){return Ot}),n.d(i,"Ma",function(){return N}),n.d(i,"Na",function(){return We}),n.d(i,"Oa",function(){return Ye}),n.d(i,"Pa",function(){return He}),n.d(i,"Qa",function(){return dt});const O=Gt=>function(Wt){return Wt[Gt]},A=Gt=>{const Wt=Gt.length;return function(Sn){for(let un=0;un<Wt;++un)Sn=Sn[Gt[un]];return Sn}};function S(Gt){throw Error(Gt)}function M(Gt){const Wt=[],Sn=Gt.length;let un,qe,$n,er=null,sr=0,pr="";function Zr(){Wt.push(pr+Gt.substring(un,qe)),pr="",un=qe+1}for(Gt+="",un=qe=0;qe<Sn;++qe)if(($n=Gt[qe])==="\\")pr+=Gt.substring(un,qe),pr+=Gt.substring(++qe,++qe),un=qe;else if($n===er)Zr(),er=null,sr=-1;else{if(er)continue;un===sr&&$n==='"'||un===sr&&$n==="'"?(un=qe+1,er=$n):$n!=="."||sr?$n==="["?(qe>un&&Zr(),sr=un=qe+1):$n==="]"&&(sr||S("Access path missing open bracket: "+Gt),sr>0&&Zr(),sr=0,un=qe+1):qe>un?Zr():un=qe+1}return sr&&S("Access path missing closing bracket: "+Gt),er&&S("Access path missing closing quote: "+Gt),qe>un&&(qe++,Zr()),Wt}function P(Gt,Wt,Sn){const un=M(Gt);return Gt=un.length===1?un[0]:Gt,s((Sn&&Sn.get||g)(un),[Gt],Wt||Gt)}const L=P("id"),V=s(Gt=>Gt,[],"identity"),N=s(()=>0,[],"zero"),ee=s(()=>1,[],"one"),J=s(()=>!0,[],"true"),K=s(()=>!1,[],"false");function re(Gt,Wt,Sn){const un=[Wt].concat([].slice.call(Sn));console[Gt].apply(console,un)}const ce=0,pe=1,ke=2,Ce=3,be=4;function $e(Gt,Wt){let Sn=Gt||ce;return{level(un){return arguments.length?(Sn=+un,this):Sn},error(){return Sn>=pe&&re(Wt||"error","ERROR",arguments),this},warn(){return Sn>=ke&&re(Wt||"warn","WARN",arguments),this},info(){return Sn>=Ce&&re(Wt||"log","INFO",arguments),this},debug(){return Sn>=be&&re(Wt||"log","DEBUG",arguments),this}}}var ht=Array.isArray;function Dt(Gt){return Gt===Object(Gt)}const Ut=Gt=>Gt!=="__proto__";function Ee(...Gt){return Gt.reduce((Wt,Sn)=>{for(const un in Sn)if(un==="signals")Wt.signals=zt(Wt.signals,Sn.signals);else{const qe=un==="legend"?{layout:1}:un==="style"||null;Ot(Wt,un,Sn[un],qe)}return Wt},{})}function Ot(Gt,Wt,Sn,un){if(!Ut(Wt))return;let qe,$n;if(Dt(Sn)&&!ht(Sn))for(qe in $n=Dt(Gt[Wt])?Gt[Wt]:Gt[Wt]={},Sn)un&&(un===!0||un[qe])?Ot($n,qe,Sn[qe]):Ut(qe)&&($n[qe]=Sn[qe]);else Gt[Wt]=Sn}function zt(Gt,Wt){if(Gt==null)return Wt;const Sn={},un=[];function qe($n){Sn[$n.name]||(Sn[$n.name]=1,un.push($n))}return Wt.forEach(qe),Gt.forEach(qe),un}function Mt(Gt){return Gt[Gt.length-1]}function Ke(Gt){return Gt==null||Gt===""?null:+Gt}const Tt=Gt=>Wt=>Gt*Math.exp(Wt),vt=Gt=>Wt=>Math.log(Gt*Wt),yt=Gt=>Wt=>
3829Math.sign(Wt)*Math.log1p(Math.abs(Wt/Gt)),bt=Gt=>Wt=>Math.sign(Wt)*Math.expm1(Math.abs(Wt))*Gt,Ht=Gt=>Wt=>Wt<0?-Math.pow(-Wt,Gt):Math.pow(Wt,Gt);function _t(Gt,Wt,Sn,un){const qe=Sn(Gt[0]),$n=Sn(Mt(Gt)),er=($n-qe)*Wt;return[un(qe-er),un($n-er)]}function Ze(Gt,Wt){return _t(Gt,Wt,Ke,V)}function Vt(Gt,Wt){var Sn=Math.sign(Gt[0]);return _t(Gt,Wt,vt(Sn),Tt(Sn))}function sn(Gt,Wt,Sn){return _t(Gt,Wt,Ht(Sn),Ht(1/Sn))}function yn(Gt,Wt,Sn){return _t(Gt,Wt,yt(Sn),bt(Sn))}function Yt(Gt,Wt,Sn,un,qe){const $n=un(Gt[0]),er=un(Mt(Gt)),sr=Wt!=null?un(Wt):($n+er)/2;return[qe(sr+($n-sr)*Sn),qe(sr+(er-sr)*Sn)]}function We(Gt,Wt,Sn){return Yt(Gt,Wt,Sn,Ke,V)}function Ye(Gt,Wt,Sn){const un=Math.sign(Gt[0]);return Yt(Gt,Wt,Sn,vt(un),Tt(un))}function He(Gt,Wt,Sn,un){return Yt(Gt,Wt,Sn,Ht(un),Ht(1/un))}function dt(Gt,Wt,Sn,un){return Yt(Gt,Wt,Sn,yt(un),bt(un))}function It(Gt){return 1+~~(new Date(Gt).getMonth()/3)}function ct(Gt){return 1+~~(new Date(Gt).getUTCMonth()/3)}function on(Gt){return Gt!=null?ht(Gt)?Gt:[Gt]:[]}function Xt(Gt,Wt,Sn){let un,qe=Gt[0],$n=Gt[1];return $n<qe&&(un=$n,$n=qe,qe=un),(un=$n-qe)>=Sn-Wt?[Wt,Sn]:[qe=Math.min(Math.max(qe,Wt),Sn-un),qe+un]}function En(Gt){return typeof Gt=="function"}const xe="descending";function jn(Gt,Wt,Sn){Sn=Sn||{},Wt=on(Wt)||[];const un=[],qe=[],$n={},er=Sn.comparator||ar;return on(Gt).forEach((sr,pr)=>{sr!=null&&(un.push(Wt[pr]===xe?-1:1),qe.push(sr=En(sr)?sr:P(sr,null,Sn)),(v(sr)||[]).forEach(Zr=>$n[Zr]=1))}),qe.length===0?null:s(er(qe,un),Object.keys($n))}const nr=(Gt,Wt)=>(Gt<Wt||Gt==null)&&Wt!=null?-1:(Gt>Wt||Wt==null)&&Gt!=null?1:(Wt=Wt instanceof Date?+Wt:Wt,(Gt=Gt instanceof Date?+Gt:Gt)!==Gt&&Wt==Wt?-1:Wt!=Wt&&Gt==Gt?1:0),ar=(Gt,Wt)=>Gt.length===1?cr(Gt[0],Wt[0]):Er(Gt,Wt,Gt.length),cr=(Gt,Wt)=>function(Sn,un){return nr(Gt(Sn),Gt(un))*Wt},Er=(Gt,Wt,Sn)=>(Wt.push(0),function(un,qe){let $n,er=0,sr=-1;for(;er===0&&++sr<Sn;)$n=Gt[sr],er=nr($n(un),$n(qe));return er*Wt[sr]});function hn(Gt){return En(Gt)?Gt:()=>Gt}function rn(Gt,Wt){let Sn;return un=>{Sn&&clearTimeout(Sn),Sn=setTimeout(()=>(Wt(un),Sn=null),Gt)}}function fn(Gt){for(let Wt,Sn,un=1,qe=arguments.length;un<qe;++un)for(Sn in Wt=arguments[un])Gt[Sn]=Wt[Sn];return Gt}function Xn(Gt,Wt){let Sn,un,qe,$n,er=0;if(Gt&&(Sn=Gt.length))if(Wt==null){for(un=Gt[er];er<Sn&&(un==null||un!=un);un=Gt[++er]);for(qe=$n=un;er<Sn;++er)(un=Gt[er])!=null&&(un<qe&&(qe=un),un>$n&&($n=un))}else{for(un=Wt(Gt[er]);er<Sn&&(un==null||un!=un);un=Wt(Gt[++er]));for(qe=$n=un;er<Sn;++er)(un=Wt(Gt[er]))!=null&&(un<qe&&(qe=un),un>$n&&($n=un))}return[qe,$n]}function Fn(Gt,Wt){const Sn=Gt.length;let un,qe,$n,er,sr,pr=-1;if(Wt==null){for(;++pr<Sn;)if((qe=Gt[pr])!=null&&qe>=qe){un=$n=qe;break}if(pr===Sn)return[-1,-1];for(er=sr=pr;++pr<Sn;)(qe=Gt[pr])!=null&&(un>qe&&(un=qe,er=pr),$n<qe&&($n=qe,sr=pr))}else{for(;++pr<Sn;)if((qe=Wt(Gt[pr],pr,Gt))!=null&&qe>=qe){un=$n=qe;break}if(pr===Sn)return[-1,-1];for(er=sr=pr;++pr<Sn;)(qe=Wt(Gt[pr],pr,Gt))!=null&&(un>qe&&(un=qe,er=pr),$n<qe&&($n=qe,sr=pr))}return[er,sr]}const Ar=Object.prototype.hasOwnProperty;function Dr(Gt,Wt){return Ar.call(Gt,Wt)}const xr={};function fi(Gt){let Wt,Sn={};function un($n){return Dr(Sn,$n)&&Sn[$n]!==xr}const qe={size:0,empty:0,object:Sn,has:un,get:$n=>un($n)?Sn[$n]:void 0,set($n,er){return un($n)||(++qe.size,Sn[$n]===xr&&--qe.empty),Sn[$n]=er,this},delete($n){return un($n)&&(--qe.size,++qe.empty,Sn[$n]=xr),this},clear(){qe.size=qe.empty=0,qe.object=Sn={}},test($n){return arguments.length?(Wt=$n,qe):Wt},clean(){const $n={};let er=0;for(const sr in Sn){const pr=Sn[sr];pr===xr||Wt&&Wt(pr)||($n[sr]=pr,++er)}qe.size=er,qe.empty=0,qe.object=Sn=$n}};return Gt&&Object.keys(Gt).forEach($n=>{qe.set($n,Gt[$n])}),qe}function ci(Gt,Wt,Sn,un,qe,$n){if(!Sn&&Sn!==0)return $n;const er=+Sn;let sr,pr=Gt[0],Zr=Mt(Gt);Zr<pr&&(sr=pr,pr=Zr,Zr=sr),sr=Math.abs(Wt-pr);const Mr=Math.abs(Zr-Wt);return sr<Mr&&sr<=er?un:Mr<=er?qe:$n}function qr(Gt,Wt,Sn){const un=Gt.prototype=Object.create(Wt.prototype);return Object.defineProperty(un,"constructor",{value:Gt,writable:!0,enumerable:!0,configurable:!0}),fn(un,Sn)}function mi(Gt,Wt,Sn,un){let qe,$n=Wt[0],er=Wt[Wt.length-1];return $n>er&&(qe=$n,$n=er,er=qe),Sn=Sn===void 0||Sn,un=un===void 0||un,(Sn?$n<=Gt:$n<Gt)&&(un?Gt<=er:Gt<er)}function Ir(Gt){return typeof Gt=="boolean"}function ti(Gt){return Object.prototype.toString.call(Gt)==="[object Date]"}function ri(Gt){return Gt&&En(Gt[Symbol.iterator])}function yi(Gt){return typeof Gt=="number"}function na(Gt){return Object.prototype.toString.call(Gt)==="[object RegExp]"}function co(Gt){return typeof Gt=="string"}function $i(Gt,Wt,Sn){Gt&&(Gt=Wt?on(Gt).map(sr=>sr.replace(/\\(.)/g,"$1")):on(Gt));
3829const un=Gt&&Gt.length,qe=Sn&&Sn.get||g,$n=sr=>qe(Wt?[sr]:M(sr));let er;if(un)if(un===1){const sr=$n(Gt[0]);er=function(pr){return""+sr(pr)}}else{const sr=Gt.map($n);er=function(pr){let Zr=""+sr[0](pr),Mr=0;for(;++Mr<un;)Zr+="|"+sr[Mr](pr);return Zr}}else er=function(){return""};return s(er,Gt,"key")}function Ft(Gt,Wt){const Sn=Gt[0],un=Mt(Gt),qe=+Wt;return qe?qe===1?un:Sn+qe*(un-Sn):Sn}const Qr=1e4;function Zt(Gt){let Wt,Sn,un;Gt=+Gt||Qr;const qe=()=>{Wt={},Sn={},un=0},$n=(er,sr)=>(++un>Gt&&(Sn=Wt,Wt={},un=1),Wt[er]=sr);return qe(),{clear:qe,has:er=>Dr(Wt,er)||Dr(Sn,er),get:er=>Dr(Wt,er)?Wt[er]:Dr(Sn,er)?$n(er,Sn[er]):void 0,set:(er,sr)=>Dr(Wt,er)?Wt[er]=sr:$n(er,sr)}}function _e(Gt,Wt,Sn,un){const qe=Wt.length,$n=Sn.length;if(!$n)return Wt;if(!qe)return Sn;const er=un||new Wt.constructor(qe+$n);let sr=0,pr=0,Zr=0;for(;sr<qe&&pr<$n;++Zr)er[Zr]=Gt(Wt[sr],Sn[pr])>0?Sn[pr++]:Wt[sr++];for(;sr<qe;++sr,++Zr)er[Zr]=Wt[sr];for(;pr<$n;++pr,++Zr)er[Zr]=Sn[pr];return er}function ge(Gt,Wt){let Sn="";for(;--Wt>=0;)Sn+=Gt;return Sn}function Ae(Gt,Wt,Sn,un){const qe=Sn||" ",$n=Gt+"",er=Wt-$n.length;return er<=0?$n:un==="left"?ge(qe,er)+$n:un==="center"?ge(qe,~~(er/2))+$n+ge(qe,Math.ceil(er/2)):$n+ge(qe,er)}function Ie(Gt){return Gt&&Mt(Gt)-Gt[0]||0}function it(Gt){return ht(Gt)?"["+Gt.map(it)+"]":Dt(Gt)||co(Gt)?JSON.stringify(Gt).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):Gt}function St(Gt){return Gt==null||Gt===""?null:!(!Gt||Gt==="false"||Gt==="0")&&!!Gt}const Jt=Gt=>yi(Gt)||ti(Gt)?Gt:Date.parse(Gt);function kn(Gt,Wt){return Wt=Wt||Jt,Gt==null||Gt===""?null:Wt(Gt)}function rr(Gt){return Gt==null||Gt===""?null:Gt+""}function Bn(Gt){const Wt={},Sn=Gt.length;for(let un=0;un<Sn;++un)Wt[Gt[un]]=!0;return Wt}function Gn(Gt,Wt,Sn,un){const qe=un??"â¦",$n=Gt+"",er=$n.length,sr=Math.max(0,Wt-qe.length);return er<=Wt?$n:Sn==="left"?qe+$n.slice(er-sr):Sn==="center"?$n.slice(0,Math.ceil(sr/2))+qe+$n.slice(er-~~(sr/2)):$n.slice(0,sr)+qe}function Zn(Gt,Wt,Sn){if(Gt)if(Wt){const un=Gt.length;for(let qe=0;qe<un;++qe){const $n=Wt(Gt[qe]);$n&&Sn($n,qe,Gt)}}else Gt.forEach(Sn)}},function(a,i,n){n.r(i);var s=n(0),h=function(ae,ne){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,H){B.__proto__=H}||function(B,H){for(var ue in H)H.hasOwnProperty(ue)&&(B[ue]=H[ue])})(ae,ne)};/** 3830 * @license 3831 * Copyright 2020 Google LLC. All Rights Reserved. 3832 * Licensed under the Apache License, Version 2.0 (the "License"); 3833 * you may not use this file except in compliance with the License. 3834 * You may obtain a copy of the License at 3835 * 3836 * http://www.apache.org/licenses/LICENSE-2.0 3837 * 3838 * Unless required by applicable law or agreed to in writing, software 3839 * distributed under the License is distributed on an "AS IS" BASIS, 3840 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3841 * See the License for the specific language governing permissions and 3842 * limitations under the License. 3843 * ============================================================================= 3844 */function v(ae,ne){function B(){this.constructor=ae}h(ae,ne),ae.prototype=ne===null?Object.create(ne):(B.prototype=ne.prototype,new B)}var g,O=function(){return(O=Object.assign||function(ae){for(var ne,B=1,H=arguments.length;B<H;B++)for(var ue in ne=arguments[B])Object.prototype.hasOwnProperty.call(ne,ue)&&(ae[ue]=ne[ue]);return ae}).apply(this,arguments)};function A(ae,ne,B,H){return new(B||(B=Promise))(function(ue,Le){function Qe(en){try{qt(H.next(en))}catch(gt){Le(gt)}}function wt(en){try{qt(H.throw(en))}catch(gt){Le(gt)}}function qt(en){en.done?ue(en.value):new B(function(gt){gt(en.value)}).then(Qe,wt)}qt((H=H.apply(ae,ne||[])).next())})}function S(ae,ne){var B,H,ue,Le,Qe={label:0,sent:function(){if(1&ue[0])throw ue[1];return ue[1]},trys:[],ops:[]};return Le={next:wt(0),throw:wt(1),return:wt(2)},typeof Symbol=="function"&&(Le[Symbol.iterator]=function(){return this}),Le;function wt(qt){return function(en){return function(gt){if(B)throw new TypeError("Generator is already executing.");for(;Qe;)try{if(B=1,H&&(ue=2>[0]?H.return:gt[0]?H.throw||((ue=H.return)&&ue.call(H),0):H.next)&&!(ue=ue.call(H,gt[1])).done)return ue;
3844switch(H=0,ue&&(gt=[2>[0],ue.value]),gt[0]){case 0:case 1:ue=gt;break;case 4:return Qe.label++,{value:gt[1],done:!1};case 5:Qe.label++,H=gt[1],gt=[0];continue;case 7:gt=Qe.ops.pop(),Qe.trys.pop();continue;default:if(!(ue=(ue=Qe.trys).length>0&&ue[ue.length-1])&&(gt[0]===6||gt[0]===2)){Qe=0;continue}if(gt[0]===3&&(!ue||gt[1]>ue[0]&>[1]<ue[3])){Qe.label=gt[1];break}if(gt[0]===6&&Qe.label<ue[1]){Qe.label=ue[1],ue=gt;break}if(ue&&Qe.label<ue[2]){Qe.label=ue[2],Qe.ops.push(gt);break}ue[2]&&Qe.ops.pop(),Qe.trys.pop();continue}gt=ne.call(ae,Qe)}catch(Tn){gt=[6,Tn],H=0}finally{B=ue=0}if(5>[0])throw gt[1];return{value:gt[0]?gt[1]:void 0,done:!0}}([qt,en])}}}function M(){return g==null&&(g=Object(s.backend)().epsilon()),g}var P=function(ae){function ne(B){var H=ae.call(this,B)||this;return Object.setPrototypeOf(H,ne.prototype),H}return v(ne,ae),ne}(Error),L=function(ae){function ne(B){var H=ae.call(this,B)||this;return Object.setPrototypeOf(H,ne.prototype),H}return v(ne,ae),ne}(Error),V=function(ae){function ne(B){var H=ae.call(this,B)||this;return Object.setPrototypeOf(H,ne.prototype),H}return v(ne,ae),ne}(Error),N=function(ae){function ne(B){var H=ae.call(this,B)||this;return Object.setPrototypeOf(H,ne.prototype),H}return v(ne,ae),ne}(Error),ee=function(ae){function ne(B){var H=ae.call(this,B)||this;return Object.setPrototypeOf(H,ne.prototype),H}return v(ne,ae),ne}(Error);(function(ae){function ne(B){var H=ae.call(this,B)||this;return Object.setPrototypeOf(H,ne.prototype),H}v(ne,ae)})(Error);function J(ae,ne){if(Array.isArray(ae)){for(var B=[],H=0;H<ne;H++)B=B.concat(ae);return B}return(B=new Array(ne)).fill(ae),B}function K(ae,ne){if(!ae)throw new ee(ne)}function re(ae,ne){for(var B=0,H=0,ue=ae;H<ue.length;H++)ue[H]===ne&&B++;return B}function ce(ae){return ae.length===1?ae[0]:ae}function pe(ae){return Array.isArray(ae)?ae:[ae]}function ke(ae){var ne=ae.replace(/(.)([A-Z][a-z0-9]+)/g,"$1_$2").replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return ne[0]!=="_"?ne:"private"+ne}function Ce(ae){return ae.length<=1||ae.indexOf("_")===-1?ae:ae.replace(/[_]+(\w|$)/g,function(ne,B){return B.toUpperCase()})}var be={};function $e(ae){if(ae==null)return null;var ne={};return ne.className=ae.getClassName(),ne.config=ae.getConfig(),ne}function ht(ae,ne,B,H,ue){var Le,Qe,wt;if(ne===void 0&&(ne={}),B===void 0&&(B={}),H===void 0&&(H="object"),ue===void 0&&(ue=!1),typeof ae=="string"){var qt=ae,en=void 0;if(qt in B)en=B[qt];else if(qt in be)en=be[qt];else if((en=ne[qt])==null)throw new V("Unknown "+H+": "+ae+`. This may be due to one of the following reasons: 38451. The `+H+` is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. 38462. The custom `+H+" is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().");return en}var gt=ae;if(gt.className==null||gt.config==null)throw new V(H+": Improper config format: "+JSON.stringify(gt)+`. 3847'className' and 'config' must set.`);var Tn=gt.className,Pn=void 0,zn=void 0;if(Tn in B?(Pn=(Le=B[Tn])[0],zn=Le[1]):Tn in be?(Pn=(Qe=be.className)[0],zn=Qe[1]):Tn in ne&&(Pn=(wt=ne[Tn])[0],zn=wt[1]),Pn==null)throw new V("Unknown "+H+": "+Tn+`. This may be due to one of the following reasons: 38481. The `+H+` is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. 38492. The custom `+H+" is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().");if(zn!=null){for(var Jn={},Vn=0,lr=Object.keys(be);Vn<lr.length;Vn++)Jn[ui=lr[Vn]]=be[ui];for(var dr=0,Tr=Object.keys(B);dr<Tr.length;dr++)Jn[ui=Tr[dr]]=B[ui];gt.config.customObjects=Jn;for(var Hr=O({},be),oi=0,Br=Object.keys(B);oi<Br.length;oi++){var ui=Br[oi];be[ui]=B[ui]}(function si(wi){if(wi!=null&&typeof wi=="object")if(Array.isArray(wi))wi.forEach(function(So){return si(So)});else for(var Co=0,_o=Object.keys(wi);Co<_o.length;Co++){var ba=_o[Co],ro=wi[ba];ro!=null&&typeof ro=="object"&&(Array.isArray(ro)||ro.type!=="ndarray"||typeof ro.value!="number"?si(ro):wi[ba]=ro.value)}})(gt.config);var ii=zn(Pn,gt.config,B,ue);return be=O({},Hr),ii}Hr=O({},be);for(var Ci=0,Di=Object.keys(B);Ci<Di.length;Ci++)ui=Di[Ci],be[ui]=B[ui];return ii=new Pn(gt.config),be=O({},Hr),ii}function Dt(ae,ne){return-1*function(B,H){return B<H?-1:B>H?1:0}(ae,ne)}function Ut(ae){if(ae==null)return ae;for(var ne=[],B=0,H=ae;B<H.length;B++){var ue=H[B];ne.indexOf(ue)===-1&&ne.push(ue)}return ne}function Ee(ae){if(ae==null)throw new V("Invalid value in obj: "+JSON.stringify(ae));for(var ne in ae)if(ae.hasOwnProperty(ne))return!1;return!0}function Ot(ae,ne,B){if(B!=null&&ae.indexOf(B)<0)throw new V(B+" is not a valid "+ne+". Valid values are "+ae+" or null/undefined.")}function zt(ae,ne,B,H){return B===void 0&&(B=0),H===void 0&&(H=1/0),K(B>=0),K(H>=B),Array.isArray(ae)&&ae.length>=B&&ae.length<=H&&ae.every(function(ue){return typeof ue===ne})}function Mt(ae,ne){Array.isArray(ae)?(s.util.assert(ae.length>0,function(){return ne+" is unexpectedly an empty array."}),ae.forEach(function(B,H){return Mt(B,"element "+(H+1)+" of "+ne)})):s.util.assert(Number.isInteger(ae)&&ae>0,function(){return"Expected "+ne+" to be a positive integer, but got "+function B(H){return H===null?"null":Array.isArray(H)?"["+H.map(function(ue){return B(ue)}).join(",")+"]":typeof H=="string"?'"'+H+'"':""+H}(ae)+"."})}function Ke(ae){return ae==="relu"?"relu":ae==="linear"?"linear":ae==="elu"?"elu":null}function Tt(ae,ne){return Object(s.tidy)(function(){return Object(s.sqrt)(Object(s.sum)(Object(s.mulStrict)(ae,ae),ne,!0))})}var vt=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.getConfig=function(){return{}},ne}(s.serialization.Serializable),yt=function(ae){function ne(B){var H=ae.call(this)||this;return H.defaultMaxValue=2,H.defaultAxis=0,H.maxValue=B.maxValue!=null?B.maxValue:H.defaultMaxValue,H.axis=B.axis!=null?B.axis:H.defaultAxis,H}return v(ne,ae),ne.prototype.apply=function(B){var H=this;return Object(s.tidy)(function(){var ue=Tt(B,H.axis),Le=Object(s.clipByValue)(ue,0,H.maxValue);return Object(s.mul)(B,Object(s.div)(Le,Object(s.add)(M(),ue)))})},ne.prototype.getConfig=function(){return{maxValue:this.maxValue,axis:this.axis}},ne.className="MaxNorm",ne}(vt);s.serialization.registerClass(yt);var bt=function(ae){function ne(B){var H=ae.call(this)||this;return H.defaultAxis=0,H.axis=B.axis!=null?B.axis:H.defaultAxis,H}return v(ne,ae),ne.prototype.apply=function(B){var H=this;return Object(s.tidy)(function(){return Object(s.div)(B,Object(s.add)(M(),Tt(B,H.axis))
vendor: 5,951 bytes, line 3849
3849)})},ne.prototype.getConfig=function(){return{axis:this.axis}},ne.className="UnitNorm",ne}(vt);s.serialization.registerClass(bt);var Ht=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return Object(s.relu)(B)},ne.className="NonNeg",ne}(vt);s.serialization.registerClass(Ht);var _t=function(ae){function ne(B){var H=ae.call(this)||this;return H.defaultMinValue=0,H.defaultMaxValue=1,H.defaultRate=1,H.defaultAxis=0,H.minValue=B.minValue!=null?B.minValue:H.defaultMinValue,H.maxValue=B.maxValue!=null?B.maxValue:H.defaultMaxValue,H.rate=B.rate!=null?B.rate:H.defaultRate,H.axis=B.axis!=null?B.axis:H.defaultAxis,H}return v(ne,ae),ne.prototype.apply=function(B){var H=this;return Object(s.tidy)(function(){var ue=Tt(B,H.axis),Le=Object(s.add)(Object(s.mul)(H.rate,Object(s.clipByValue)(ue,H.minValue,H.maxValue)),Object(s.mul)(1-H.rate,ue));return Object(s.mul)(B,Object(s.div)(Le,Object(s.add)(M(),ue)))})},ne.prototype.getConfig=function(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}},ne.className="MinMaxNorm",ne}(vt);s.serialization.registerClass(_t);var Ze={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function Vt(ae){return $e(ae)}function sn(ae,ne){return ne===void 0&&(ne={}),ht(ae,s.serialization.SerializationMap.getMap().classNameMap,ne,"constraint")}function yn(ae){return ae==null?null:typeof ae=="string"?sn({className:ae in Ze?Ze[ae]:ae,config:{}}):ae instanceof vt?ae:sn(ae)}var Yt=Object.freeze({maxNorm:function(ae){return new yt(ae)},unitNorm:function(ae){return new bt(ae)},nonNeg:function(){return new Ht},minMaxNorm:function(ae){return new _t(ae)}}),We=["channelsFirst","channelsLast"],Ye=["valid","same","causal"],He=["max","avg"],dt=["sum","mul","concat","ave"],It=new Map;function ct(ae){Ot(We,"DataFormat",ae)}function on(ae){Ot(Ye,"PaddingMode",ae)}function Xt(ae){Ot(He,"PoolMode",ae)}var En=[],xe="/";function jn(ae,ne){En.push(ae);try{var B=ne();return En.pop(),B}catch(H){throw En.pop(),H}}function nr(ae){if(!Er(ae))throw new Error("Not a valid tensor name: '"+ae+"'");return(En.length===0?"":En.join(xe)+xe)+ae}function ar(ae){if(!Er(ae))throw new Error("Not a valid tensor name: '"+ae+"'");It.has(ae)||It.set(ae,0);var ne=It.get(ae);if(It.set(ae,It.get(ae)+1),ne>0){var B=ae+"_"+ne;return It.set(B,1),B}return ae}var cr=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function Er(ae){return!!ae.match(cr)}function hn(ae){return ae===parseInt(ae.toString(),10)}function rn(ae,ne,B){ne==null&&(ne=0),B==null&&(B=ae.length);for(var H=1,ue=ne;ue<B;++ue)H*=ae[ue];return H}function fn(ae){return ae=Array.isArray(ae)?new Float32Array(ae):ae,Object(s.tensor1d)(ae)}function Xn(ae){return Object(s.min)(fn(ae)).dataSync()[0]}function Fn(ae){return Object(s.max)(fn(ae)).dataSync()[0]}function Ar(ae,ne){if(ne<ae)throw new V("end ("+ne+") < begin ("+ae+") is forbidden.");for(var B=[],H=ae;H<ne;++H)B.push(H);return B}function Dr(ae,ne){return ae.asType(ne)}function xr(ae,ne){ne===void 0&&(ne=-1);var B=ae.shape.slice();return ne<0&&(ne=B.length+ne+1),B.splice(ne,0,1),ae.reshape(B)}function fi(ae,ne,B){return Object(s.tidy)(function(){switch(ae.rank){case 1:return Object(s.slice1d)(ae,ne,B);case 2:return Object(s.slice2d)(ae,[ne,0],[B,ae.shape[1]]);case 3:return Object(s.slice3d)(ae,[ne,0,0],[B,ae.shape[1],ae.shape[2]]);case 4:return Object(s.slice4d)(ae,[ne,0,0,0],[B,ae.shape[1],ae.shape[2],ae.shape[3]]);case 5:return Object(s.slice)(ae,[ne,0,0,0,0],[B,ae.shape[1],ae.shape[2],ae.shape[3],ae.shape[4]]);case 6:return Object(s.slice)(ae,[ne,0,0,0,0,0],[B,ae.shape[1],ae.shape[2],ae.shape[3],ae.shape[4],ae.shape[5]]);default:throw new V("sliceAlongFirstAxis() received an unsupported tensor rank: "+ae.rank)}})}function ci(ae,ne,B){return Object(s.tidy)(function(){switch(ae.rank){case 1:return Object(s.slice1d)(ae,ne,B);case 2:return Object(s.slice2d)(ae,[0,ne],[ae.shape[0],B]);case 3:return Object(s.slice3d)(ae,[0,0,ne],[ae.shape[0],ae.shape[1],B]);case 4:return Object(s.slice4d)(ae,[0,0,0,ne],[ae.shape[0],ae.shape[1],ae.shape[2],B]);default:throw new V("sliceAlongLastAxis() received an unsupported tensor rank: "+ae.rank)}})}function qr(ae,ne,B,H){return Object(s.tidy)(function(){switch(ae.rank){case 1:return Object(s.slice1d)(ae,ne,B);case 2:switch(H){case 1:return fi(ae,ne,B);case 2:return ci(ae,ne,B);default:throw new V("The axis is not within the rank of the tensor "+H)}case 3:switch(H){case 1:return fi(ae,ne,B);case 2:return Object(s.slice3d)(ae,[0,ne,0],[ae.shape[0],B,ae.shape[2]]);case 3:return ci(ae,ne,B);default:throw new V("The axis is not within the rank of the tensor "+H)}case 4:switch(H){case 1:return fi(ae,ne,B);case 2:return Object(s.slice4d)(ae,[0,ne,0,0],[ae.shape[0],B,ae.shape[2],ae.shape[3]]);case 3:return Object(s.slice4d)(ae,[0,0,ne,0],[ae.shape[0],ae.shape[1],B,ae.shape[3]]);case 4:return ci(ae,ne,B);default:throw new V("The axis is not within the rank of the tensor "+H)}default:throw new V("sliceAlongLastAxis() received an unsupported tensor rank: "+ae.rank)}})}function mi(ae,ne){var B;return ne===void 0&&(ne=-1),ne<0&&(ne=(B=ae[0].rank)!==0?B:0),ne===ae[0].rank&&(ne=-1),Object(s.concat)(ae,ne)}function Ir(ae,ne){switch(ae.rank){case 1:return Object(s.concat1d)([ae,ne]);case 2:return Object(s.concat2d)([ae,ne],0);case 3:return Object(s.concat3d)([ae,ne],0);case 4:return Object(s.concat4d)([ae,ne],0);default:throw new V("concatAlongFirstAxis() received an unsupported tensor rank: "+ae.rank)}}function ti(ae,ne){if(Array.isArray(ne)||(ne=[ne]),ae.rank!==ne.length)throw new V("The length of input n ("+ne.length+") does not match the number of dimensions in input x ("+ae.rank+")");return Object(s.tile)(ae,ne)}function ri(ae,ne,B,H,ue){return ne===void 0&&(ne=0),B===void 0&&(B=1),Object(s.randomNormal)(ae,ne,B,H,ue)}function yi(ae,ne,B,H){if(ae.rank<2||ne.rank<2)throw new N("dot requires both inputs to be rank >
3849= 2 but got x shape = "+ae.shape+" and y shape = "+ne.shape);if(ne.rank>=3&&ae.shape.slice(-1)[0]!==(gt=ne.shape.slice(-2)[0]))throw new N("If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = "+ae.shape+" and y shape = "+ne.shape);if(ae.rank===2&&ne.rank===2){var ue=!1,Le=!1;return s.fused.matMul({a:ae,b:ne,transposeA:ue,transposeB:Le,bias:H?$i(ae.rank,H,"channelsLast"):null,activation:B})}var Qe=ae.shape.slice(),wt=Qe.pop();ae=ae.reshape([-1,wt]);var qt=ne.shape.slice(),en=qt.pop(),gt=qt.pop(),Tn=qt.concat([en]),Pn=Array.from({length:ne.rank},function(Jn,Vn){return Vn===0?ne.rank-2:Vn<=ne.rank-2?Vn-1:Vn});ne=ne.transpose(Pn).reshape([gt,-1]);var zn=Qe.concat(Tn);return ue=!1,Le=!1,s.fused.matMul({a:ae,b:ne,transposeA:ue,transposeB:Le,bias:H?$i(ae.rank,H,"channelsLast"):null,activation:B}).reshape(zn)}function na(ae,ne,B){return Object(s.tidy)(function(){return ne=Array.isArray(ne)?Object(s.tensor1d)(ne,"int32"):ne.toInt(),Object(s.gather)(ae,ne,B)})}function co(ae){return Object(s.mulStrict)(ae,ae)}function $i(ae,ne,B){var H=ne.shape;if(ne.rank!==1&&ne.rank!==ae)throw new V("Unexpected bias dimensions: "+ne.rank+"; expected it to be 1 or "+ae);if(ae===5){if(B==="channelsFirst")return H.length===1?ne.reshape([1,H[0],1,1,1]):ne.reshape([1,H[3],H[0],H[1],H[2]]);if(B==="channelsLast")return H.length===1?ne.reshape([1,1,1,1,H[0]]):ne.reshape([1].concat(H))}else if(ae===4){if(B==="channelsFirst")return H.length===1?ne.reshape([1,H[0],1,1]):ne.reshape([1,H[2],H[0],H[1]]);if(B==="channelsLast")return H.length===1?ne.reshape([1,1,1,H[0]]):ne.reshape([1].concat(H))}else if(ae===3){if(B==="channelsFirst")return H.length===1?ne.reshape([1,H[0],1]):ne.reshape([1,H[1],H[0]]);if(B==="channelsLast")return H.length===1?ne.reshape([1,1,H[0]]):ne.reshape([1].concat(H))}else if(ae<3)return ne;throw new V("Unsupported input rank by biasAdd: "+ne.rank)}function Ft(ae,ne,B){return Object(s.tidy)(function(){return B==null&&(B="channelsLast"),ct(B),ae.add($i(ae.rank,ne,B))})}function Qr(ae,ne,B,H){return Object(s.tidy)(function(){return Object(s.dropout)(ae,ne,B,H)})}function Zt(ae,ne,B){return B===void 0&&(B=!1),B?ae():ne()}var _e=["fanIn","fanOut","fanAvg"],ge=["normal","uniform","truncatedNormal"],Ae=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.fromConfigUsesCustomObjects=function(){return!1},ne.prototype.getConfig=function(){return{}},ne}(s.serialization.Serializable),Ie=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B,H){return Object(s.zeros)(B,H)},ne.className="Zeros",ne}(Ae);s.serialization.registerClass(Ie);var it=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B,H){return Object(s.ones)(B,H)},ne.className="Ones",ne}(Ae);s.serialization.registerClass(it);var St=function(ae){function ne(B){var H=ae.call(this)||this;if(typeof B!="object")throw new V("Expected argument of type ConstantConfig but got "+B);if(B.value===void 0)throw new V("config must have value set but got "+B);return H.value=B.value,H}return v(ne,ae),ne.prototype.apply=function(B,H){var ue=this;return Object(s.tidy)(function(){return Object(s.mul)(Object(s.scalar)(ue.value),Object(s.ones)(B,H))})},ne.prototype.getConfig=function(){return{value:this.value}},ne.className="Constant",ne}(Ae);s.serialization.registerClass(St);var Jt=function(ae){function ne(B){var H=ae.call(this)||this;return H.DEFAULT_MINVAL=-.05,H.DEFAULT_MAXVAL=.05,H.minval=B.minval||H.DEFAULT_MINVAL,H.maxval=B.maxval||H.DEFAULT_MAXVAL,H.seed=B.seed,H}return v(ne,ae),ne.prototype.apply=function(B,H){return Object(s.randomUniform)(B,this.minval,this.maxval,H)},ne.prototype.getConfig=function(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}},ne.className="RandomUniform",ne}(Ae);s.serialization.registerClass(Jt);var kn=function(ae){function ne(B){var H=ae.call(this)||this;return H.DEFAULT_MEAN=0,H.DEFAULT_STDDEV=.05,H.mean=B.mean||H.DEFAULT_MEAN,H.stddev=B.stddev||H.DEFAULT_STDDEV,H.seed=B.seed,H}return v(ne,ae),ne.prototype.apply=function(B,H){if((H=H||"float32")!=="float32"&&H!=="int32")throw new N("randomNormal does not support dType "+H+".");return ri(B,this.mean,this.stddev,H,this.seed)},ne.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},ne.className="RandomNormal",ne}(Ae);s.serialization.registerClass(kn);var rr=function(ae){function ne(B){var H=ae.call(this)||this;return H.DEFAULT_MEAN=0,H.DEFAULT_STDDEV=.05,H.mean=B.mean||H.DEFAULT_MEAN,H.stddev=B.stddev||H.DEFAULT_STDDEV,H.seed=B.seed,H}return v(ne,ae),ne.prototype.apply=function(B,H){if((H=H||"float32")!=="float32"&&H!=="int32")throw new N("truncatedNormal does not support dType "+H+".");return Object(s.truncatedNormal)(B,this.mean,this.stddev,H,this.seed)},ne.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},ne.className="TruncatedNormal",ne}(Ae);s.serialization.registerClass(rr);var Bn=function(ae){function ne(B){var H=ae.call(this)||this;return H.gain=B.gain!=null?B.gain:1,H}return v(ne,ae),ne.prototype.apply=function(B,H){var ue=this;return Object(s.tidy)(function(){if(B.length!==2||B[0]!==B[1])throw new V("Identity matrix initializer can only be used for 2D square matrices.");return Object(s.mul)(ue.gain,Object(s.eye)(B[0]))})},ne.prototype.getConfig=function(){return{gain:this.gain}},ne.className="Identity",ne}(Ae);s.serialization.registerClass(Bn);var Gn=function(ae){function ne(B){var H=ae.call(this)||this;if(B.scale<0)throw new V("scale must be a positive float. Got: "+B.scale);return H.scale=B.scale==null?1:B.scale,H.mode=B.mode==null?"fanIn":B.mode,function(ue){Ot(_e,"FanMode",ue)}(H.mode),H.distribution=B.distribution==null?"normal":B.distribution,function(ue){Ot(ge,"Distribution",ue)}(H.distribution),H.seed=B.seed,H}return v(ne,ae),ne.prototype.apply=function(B,H){var ue=function(gt,Tn){var Pn,zn;if(Tn===void 0&&(Tn="channelsLast"),ct(Tn),gt.length===2)Pn=gt[0],zn=gt[1];else if([3,4,5].indexOf(gt.length)!==-1)if(Tn==="channelsFirst"){var Jn=rn(gt,2);Pn=gt[1]*Jn,zn=gt[0]*Jn}else Tn==="channelsLast"&&(Jn=rn(gt,0,gt.length-2),Pn=gt[gt.length-2]*Jn,zn=gt[gt.length-1]*Jn);else{var Vn=rn(gt);Pn=Math.sqrt(Vn),zn=Math.sqrt(Vn)}return[Pn,zn]}(B),Le=ue[0],Qe=ue[1],wt=this.scale;if(this.mode==="fanIn"?wt/=Math.max(1,Le):this.mode==="fanOut"?wt/=Math.max(1,Qe):wt/=Math.max(1,(Le+Qe)/2),this.distribution==="normal"){var qt=Math.sqrt(wt);if((H=H||"float32")!=="float32"&&H!=="int32")throw new N(this.getClassName()+" does not support dType "+H+".");return Object(s.truncatedNormal)(B,0,qt,H,this.seed)}var en=Math.sqrt(3*wt);return Object(s.randomUniform)(B,-en,en,H)},ne.prototype.getConfig=function(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}},ne.className="VarianceScaling",ne}(Ae);s.serialization.registerClass(Gn);var Zn=function(ae){function ne(B){return ae.call(this,{scale:1,mode:"fanAvg",distribution:"uniform",seed:B==null?null:B.seed})||this}return v(ne,ae),ne.prototype.getClassName=function(){return Gn.className},ne.className="GlorotUniform",ne}(Gn);s.serialization.registerClass(Zn);var Gt=function(ae){function ne(B){return ae.call(this,{scale:1,mode:"fanAvg",distribution:"normal",seed:B==null?null:B.seed})||this}return v(ne,ae),ne.prototype.getClassName=function(){return Gn.className},ne.className="GlorotNormal",ne}(Gn);s.serialization.registerClass(Gt);var Wt=function(ae){function ne(B){return ae.call(this,{scale:2,mode:"fanIn",distribution:"normal",seed:B==null?null:B.seed})||this}return v(ne,ae),ne.prototype.getClassName=function(){return Gn.className},ne.className="HeNormal",ne}(Gn);s.serialization.registerClass(Wt);var Sn=function(ae){function ne(B){return ae.call(this,{scale:2,mode:"fanIn",distribution:"uniform",seed:B==null?null:B.seed})||this}return v(ne,ae),ne.prototype.getClassName=function(){return Gn.className},ne.className="HeUniform",ne}(Gn);s.serialization.registerClass(Sn);var un=function(ae){function ne(B){return ae.call(this,{scale:1,mode:"fanIn",distribution:"normal",seed:B==null?null:B.seed})||this}return v(ne,ae),ne.prototype.getClassName=function(){return Gn.className},ne.className="LeCunNormal",ne}(Gn);s.serialization.registerClass(un);var qe=function(ae){function ne(B){return ae.call(this,{scale:1,mode:"fanIn",distribution:"uniform",seed:B==null?null:B.seed})||this}return v(ne,ae),ne.prototype.getClassName=function(){return Gn.className},ne.className="LeCunNormal",ne}(Gn);s.serialization.registerClass(qe);var $n=function(ae){function ne(B){var H=ae.call(this)||this;if(H.DEFAULT_GAIN=1,H.gain=B.gain==null?H.DEFAULT_GAIN:B.gain,H.seed=B.seed,H.seed!=null)throw new N("Random seed is not implemented for Orthogonal Initializer yet.");return H}return v(ne,ae),ne.prototype.apply=function(B,H){var ue=this;return Object(s.tidy)(function(){if(B.length!==2)throw new N("The Orthogonal Initializer does not support non-2D shapes yet.");B[0]*B[1]>2e3&&console.warn("Orthogonal initializer is being called on a matrix with more than 2000 ("+B[0]*B[1]+") elements: Slowness may result.");var Le=ri(B[0]>B[1]?[B[1],B[0]]:B,0,1,"float32"),Qe=s.linalg.gramSchmidt(Le);return B[0]>B[1]&&(Qe=Qe.transpose()),Object(s.mul)(ue.gain,Qe)})},ne.prototype.getConfig=function(){return{gain:this.gain,seed:this.seed}},ne.className="Orthogonal",ne}(Ae);s.serialization.registerClass($n);var er={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",le
3849CunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function sr(ae,ne){return ne===void 0&&(ne={}),ht(ae,s.serialization.SerializationMap.getMap().classNameMap,ne,"initializer")}function pr(ae){return $e(ae)}function Zr(ae){if(typeof ae=="string"){var ne=ae in er?er[ae]:ae;if(ne==="GlorotNormal")return new Gt;if(ne==="GlorotUniform")return new Zn;if(ne==="HeNormal")return new Wt;if(ne==="HeUniform")return new Sn;if(ne==="LeCunNormal")return new un;if(ne==="LeCunUniform")return new qe;var B={};return B.className=ne,B.config={},sr(B)}return ae instanceof Ae?ae:sr(ae)}var Mr=Object.freeze({zeros:function(){return new Ie},ones:function(){return new it},constant:function(ae){return new St(ae)},randomUniform:function(ae){return new Jt(ae)},randomNormal:function(ae){return new kn(ae)},truncatedNormal:function(ae){return new rr(ae)},identity:function(ae){return new Bn(ae)},varianceScaling:function(ae){return new Gn(ae)},glorotUniform:function(ae){return new Zn(ae)},glorotNormal:function(ae){return new Gt(ae)},heNormal:function(ae){return new Wt(ae)},heUniform:function(ae){return new Sn(ae)},leCunNormal:function(ae){return new un(ae)},leCunUniform:function(ae){return new qe(ae)},orthogonal:function(ae){return new $n(ae)}}),Ii=0;function Lo(){return Ii++}var Ai={};function ko(ae){return ae===void 0&&(ae=""),ae in Ai||(Ai[ae]=0),Ai[ae]+=1,ae+Ai[ae].toString()}function Ji(ae){return Array.isArray(ae)&&Array.isArray(ae[0])}function ai(ae){return ae.length===0?[]:Array.isArray(ae[0])?ae:[ae]}function Yr(ae){var ne;if(Array.isArray(ae)){if(ae.length!==1)throw new V("Expected Tensor length to be 1; got "+ae.length);ne=ae[0]}else ne=ae;return ne}function Hn(ae){if(Array.isArray(ae)&&Array.isArray(ae[0])){if(ae.length===1)return(ae=ae)[0];throw new V("Expected exactly 1 Shape; got "+ae.length)}return ae}function ki(ae){for(var ne=0,B=0,H=ae;B<H.length;B++){var ue=H[B];ue.shape.length===0?ne+=1:ne+=ue.shape.reduce(function(Le,Qe){return Le*Qe})}return ne}var lo="Variable",Kr=function(){function ae(ne,B,H,ue,Le){B===void 0&&(B="float32"),H===void 0&&(H=lo),ue===void 0&&(ue=!0),Le===void 0&&(Le=null),this.dtype=B??"float32",this.shape=ne.shape,this.id=Lo(),H=H??lo,this.originalName=nr(H),this.name=ar(this.originalName),this.trainable_=ue,this.constraint=Le,this.val=Object(s.variable)(ne,this.trainable_,this.name,this.dtype)}return ae.prototype.read=function(){return this.assertNotDisposed(),this.val},ae.prototype.write=function(ne){return this.assertNotDisposed(),function(B,H){if(B.shape.toString()!==H.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(B.shape)+" vs. "+JSON.stringify(H.shape))}(this.val,ne),this.val.id!==ne.id&&(this.val.assign(ne),this.constraint!=null&&this.val.assign(this.constraint.apply(this.val))),this},ae.prototype.dispose=function(){this.assertNotDisposed(),this.val.dispose()},ae.prototype.assertNotDisposed=function(){if(this.val.isDisposed)throw new Error("LayersVariable "+this.name+" is already disposed.")},Object.defineProperty(ae.prototype,"trainable",{get:function(){return this.trainable_},set:function(ne){this.trainable_=ne,this.val.trainable=ne},enumerable:!0,configurable:!0}),ae}();function Io(ae){return ae.map(function(ne){return ne.read()})}function Ko(ae){ae.forEach(function(ne){ne[0].write(ne[1])})}var Eo=function(ae){this.dtype=ae.dtype,this.shape=ae.shape,ae.shape!=null?this.ndim=ae.shape.length:this.ndim=ae.ndim,this.maxNDim=ae.maxNDim,this.minNDim=ae.minNDim,this.axes=ae.axes||{}},Yo=function(ae,ne,B,H,ue,Le,Qe){this.dtype=ae,this.shape=ne,this.sourceLayer=B,this.inputs=H,this.callArgs=ue,this.outputTensorIndex=Qe,this.id=Lo(),Le!=null&&(this.originalName=nr(Le),this.name=ar(this.originalName)),this.rank=ne.length},vs=0,gu=function(){function ae(ne,B){this.callArgs=B,this.id=vs++,this.outboundLayer=ne.outboundLayer,this.inboundLayers=ne.inboundLayers,this.nodeIndices=ne.nodeIndices,this.tensorIndices=ne.tensorIndices,this.inputTensors=ne.inputTensors,this.outputTensors=ne.outputTensors,this.inputMasks=ne.inputMasks,this.outputMasks=ne.outputMasks,this.inputShapes=ne.inputShapes,this.outputShapes=ne.outputShapes;for(var H=0,ue=ne.inboundLayers;H<ue.length;H++){var Le=ue[H];Le!=null&&Le.outboundNodes.push(this)}ne.outboundLayer.inboundNodes.push(this)}return ae.prototype.getConfig=function(){for(var ne=[],B=0,H=this.inboundLayers;B<H.length;B++){var ue=H[B];ue!=null?ne.push(ue.name):ne.push(null)}return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inbou
3849ndLayers:ne,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}},ae}(),pp=0,fo=function(ae){function ne(B){var H=ae.call(this)||this;H._callHook=null,H._addedWeightNames=[],H._stateful=!1,H.id=pp++,H.activityRegularizer=null,H.inputSpec=null,H.supportsMasking=!1,H._trainableWeights=[],H._nonTrainableWeights=[],H._losses=[],H._updates=[],H._built=!1,H.inboundNodes=[],H.outboundNodes=[];var ue=B.name;if(!ue){var Le=H.getClassName();ue=ke(Le)+"_"+ko(Le)}if(H.name=ue,H.trainable_=B.trainable==null||B.trainable,B.inputShape!=null||B.batchInputShape!=null){var Qe=void 0;if(B.batchInputShape!=null)Qe=B.batchInputShape;else if(B.inputShape!=null){var wt=null;B.batchSize!=null&&(wt=B.batchSize),Qe=[wt].concat(B.inputShape)}H.batchInputShape=Qe;var qt=B.dtype;qt==null&&(qt=B.inputDType),qt==null&&(qt="float32"),H.dtype=qt}return B.weights!=null?H.initialWeights=B.weights:H.initialWeights=null,H._refCount=null,H.fastWeightInitDuringBuild=!1,H}return v(ne,ae),ne.nodeKey=function(B,H){return B.name+"_ib-"+H.toString()},ne.prototype.getNodeAtIndex=function(B,H){if(this.inboundNodes.length===0)throw new L("The layer has never been called and thus has no defined "+H+".");if(this.inboundNodes.length<=B)throw new V("Asked to get "+H+" at node "+B+", but the layer has only "+this.inboundNodes.length+" inbound nodes.");return this.inboundNodes[B]},ne.prototype.getInputAt=function(B){return ce(this.getNodeAtIndex(B,"input").inputTensors)},ne.prototype.getOutputAt=function(B){return ce(this.getNodeAtIndex(B,"output").outputTensors)},Object.defineProperty(ne.prototype,"input",{get:function(){if(this.inboundNodes.length>1)throw new P("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use `getInputAt(nodeIndex)` instead.');if(this.inboundNodes.length===0)throw new P("Layer "+this.name+" is not connected, no input to return.");return ce(this.getNodeAtIndex(0,"input").inputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"output",{get:function(){if(this.inboundNodes.length===0)throw new P("Layer "+this.name+" has no inbound nodes.");if(this.inboundNodes.length>1)throw new P("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `getOutputAt(nodeIndex)` instead.');return ce(this.getNodeAtIndex(0,"output").outputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"losses",{get:function(){return this._losses},enumerable:!0,configurable:!0}),ne.prototype.calculateLosses=function(){return this.losses.map(function(B){return B()})},Object.defineProperty(ne.prototype,"updates",{get:function(){return this._updates},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"built",{get:function(){return this._built},set:function(B){this._built=B},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"trainable",{get:function(){return this.trainable_},set:function(B){this._trainableWeights.forEach(function(H){return H.trainable=B}),this.trainable_=B},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"trainableWeights",{get:function(){return this.trainable_?this._trainableWeights.filter(function(B){return B.trainable}):[]},set:function(B){this._trainableWeights=B},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this._trainableWeights.filter(function(B){return!B.trainable}).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)},set:function(B){this._nonTrainableWeights=B},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"stateful",{get:function(){return this._stateful},enumerable:!0,configurable:!0}),ne.prototype.resetStates=function(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")},ne.prototype.assertInputCompatibility=function(B){if(B=pe(B),this.inputSpec!=null&&this.inputSpec.length!==0){var H=pe(this.inputSpec);if(B.length!==H.length)throw new V("Layer "+this.name+" expects "+H.length+" inputs, but it received "+B.length+" input tensors. Input received: "+B);for(var ue=0;ue<B.length;
3849ue++){var Le=B[ue],Qe=H[ue];if(Qe!=null){var wt=Le.rank;if(Qe.ndim!=null&&wt!==Qe.ndim)throw new V("Input "+ue+" is incompatible with layer "+this.name+": expected ndim="+Qe.ndim+", found ndim="+wt);if(Qe.maxNDim!=null&&wt>Qe.maxNDim)throw new V("Input "+ue+" is incompatible with layer "+this.name+": expected max_ndim="+Qe.maxNDim+", found ndim="+wt);if(Qe.minNDim!=null&&wt<Qe.minNDim)throw new V("Input "+ue+" is incompatible with layer "+this.name+": expected min_ndim="+Qe.minNDim+", found ndim="+wt+".");if(Qe.dtype!=null&&Le.dtype!==Qe.dtype)throw new V("Input "+ue+" is incompatible with layer "+this.name+" : expected dtype="+Qe.dtype+", found dtype="+Le.dtype+".");if(Qe.axes){var qt=Le.shape;for(var en in Qe.axes){var gt=Number(en),Tn=Qe.axes[en],Pn=gt>=0?qt[gt]:qt[qt.length+gt];if(Tn!=null&&[Tn,null].indexOf(Pn)===-1)throw new V("Input "+ue+" is incompatible with layer "+this.name+": expected axis "+gt+" of input shape to have value "+Tn+" but got shape "+qt+".")}}if(Qe.shape!=null)for(var zn=0;zn<Qe.shape.length;++zn){var Jn=Qe.shape[zn],Vn=Le.shape[zn];if(Jn!=null&&Vn!=null&&Jn!==Vn)throw new V("Input "+ue+" is incompatible with layer "+this.name+": expected shape="+Qe.shape+", found shape="+Le.shape+".")}}}}},ne.prototype.call=function(B,H){return B},ne.prototype.invokeCallHook=function(B,H){this._callHook!=null&&this._callHook(B,H)},ne.prototype.setCallHook=function(B){this._callHook=B},ne.prototype.clearCallHook=function(){this._callHook=null},ne.prototype.apply=function(B,H){var ue=this;H=H||{},this.assertNotDisposed();for(var Le=pe(B),Qe=!0,wt=0,qt=Le;wt<qt.length;wt++)if(!(qt[wt]instanceof Yo)){Qe=!1;break}for(var en=!0,gt=0,Tn=Le;gt<Tn.length;gt++)if(Tn[gt]instanceof Yo){en=!1;break}if(Qe===en)throw new V("Arguments to apply() must be all SymbolicTensors or all Tensors");return jn(this.name,function(){if(!ue.built){ue.assertInputCompatibility(B);for(var Pn=[],zn=0,Jn=pe(B);zn<Jn.length;zn++){var Vn=Jn[zn];Pn.push(Vn.shape)}ue.build(ce(Pn)),ue.built=!0,ue.initialWeights&&ue.setWeights(ue.initialWeights),ue._refCount===null&&en&&(ue._refCount=1)}if(ue.assertInputCompatibility(B),en){for(var lr=[],dr=0,Tr=pe(ui=ue.call(B,H));dr<Tr.length;dr++){var Hr=Tr[dr];Le.indexOf(Hr)!==-1&&(Hr=Hr.clone()),lr.push(Hr)}if(ui=ce(lr),ue.activityRegularizer!=null)throw new N("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return ui}var oi=function(Ci){for(var Di=[],si=0,wi=Ci=pe(Ci);si<wi.length;si++){var Co=wi[si];Di.push(Co.shape)}return ce(Di)}(B),Br=ue.computeOutputShape(oi),ui=void 0,ii="float32";if(ue.warnOnIncompatibleInputShape(Array.isArray(B)?oi[0]:oi),ui=Br!=null&&Br.length>0&&Array.isArray(Br[0])?Br.map(function(Ci,Di){return new Yo(ii,Ci,ue,pe(B),H,ue.name,Di)}):new Yo(ii,Br,ue,pe(B),H,ue.name),ue.addInboundNode(B,ui,null,null,oi,Br,H),ue._refCount++,ue.activityRegularizer!=null)throw new N("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return ui})},ne.prototype.warnOnIncompatibleInputShape=function(B){if(this.batchInputShape!=null)if(B.length!==this.batchInputShape.length)console.warn("The rank of the input tensor provided (shape: "+JSON.stringify(B)+") does not match that of the batchInputShape ("+JSON.stringify(this.batchInputShape)+") of the layer "+this.name);else{var H=!1;this.batchInputShape.forEach(function(ue,Le){ue!=null&&B[Le]!=null&&B[Le]!==ue&&(H=!0)}),H&&console.warn("The shape of the input tensor ("+JSON.stringify(B)+") does not match the expectation of layer "+this.name+": "+JSON.stringify(this.batchInputShape))}},Object.defineProperty(ne.prototype,"outputShape",{get:function(){if(this.inboundNodes==null||this.inboundNodes.length===0)throw new P("The layer "+this.name+" has never been called and thus has no defined output shape.");for(var B=[],H=0,ue=this.inboundNodes;H<ue.length;H++){var Le=ue[H],Qe=JSON.stringify(Le.outputShapes);B.indexOf(Qe)===-1&&B.push(Qe)}if(B.length===1){var wt=this.inboundNodes[0].outputShapes;return Array.isArray(wt)&&Array.isArray(wt[0])&&wt.length===1?wt[0]:wt}throw new P("The layer "+this.name+' has multiple inbound nodes with different output shapes. Hence the notion of "outut shape" is ill-defined for the layer.')},enumerable:!0,configurable:!0}),ne.prototype.countParams=function(){if(!this.built)throw new L("You tried to call countParams() on "+this.name+", but the layer is not built yet. Build it first by calling build(batchInputShape).");return ki(this.weights)},ne.prototype.build=function(B){this.built=!0},ne.prototype.getWeights=function(B){return B===void 0&&(B=!1),Io(B?this.trainableWeights:this.weights)},ne.prototype.setWeights=function(B){var H=this;Object(s.tidy)(function(){var ue=H.weights;if(ue.length!==B.length)throw new V('You called setWeights(weights) on layer "'+H.name+'" with a weight list of length '+B.length+", but the layer was expecting "+ue.length+" weights. Provided weights: "+B+"...");if(ue.length!==0){for(var Le=[],Qe=Io(ue),wt=0;wt<Qe.length;++wt){var qt=Qe[wt],en=ue[wt],gt=B[wt];
3849if(!s.util.arraysEqual(qt.shape,gt.shape))throw new V("Layer weight shape "+qt.shape+" not compatible with provided weight shape "+gt.shape);Le.push([en,gt])}Ko(Le)}})},ne.prototype.addWeight=function(B,H,ue,Le,Qe,wt,qt){if(this._addedWeightNames.indexOf(B)!==-1)throw new V("Duplicate weight name "+B+" for layer "+this.name);this._addedWeightNames.push(B),ue==null&&(ue="float32"),this.fastWeightInitDuringBuild&&(Le=Zr("zeros"));var en=Le.apply(H,ue),gt=new Kr(en,ue,B,wt,qt);return en.dispose(),Qe!=null&&this.addLoss(function(){return Qe.apply(gt.read())}),wt==null&&(wt=!0),wt?this._trainableWeights.push(gt):this._nonTrainableWeights.push(gt),gt},ne.prototype.setFastWeightInitDuringBuild=function(B){this.fastWeightInitDuringBuild=B},ne.prototype.addLoss=function(B){var H;B==null||Array.isArray(B)&&B.length===0||(B=pe(B),this._losses!==void 0&&this._losses!==null&&(H=this.losses).push.apply(H,B))},ne.prototype.computeOutputShape=function(B){return B},ne.prototype.computeMask=function(B,H){var ue=this;if(!this.supportsMasking){if(H!=null){if(!Array.isArray(H))throw new TypeError("Layer "+this.name+" does not support masking, but was passed an inputMask.");H.forEach(function(Le){if(Le!=null)throw new TypeError("Layer "+ue.name+" does not support masking, but was passed an inputMask.")})}return null}return H},ne.prototype.addInboundNode=function(B,H,ue,Le,Qe,wt,qt){qt===void 0&&(qt=null);var en=pe(B);H=pe(H),ue=pe(ue),Le=pe(Le),Qe=ai(Qe),wt=ai(wt);for(var gt=[],Tn=[],Pn=[],zn=0,Jn=en;zn<Jn.length;zn++){var Vn=Jn[zn];gt.push(Vn.sourceLayer),Tn.push(Vn.nodeIndex),Pn.push(Vn.tensorIndex)}new gu({outboundLayer:this,inboundLayers:gt,nodeIndices:Tn,tensorIndices:Pn,inputTensors:en,outputTensors:H,inputMasks:ue,outputMasks:Le,inputShapes:Qe,outputShapes:wt},qt);for(var lr=0;lr<H.length;lr++)H[lr].sourceLayer=this,H[lr].nodeIndex=this.inboundNodes.length-1,H[lr].tensorIndex=lr},ne.prototype.getConfig=function(){var B={name:this.name,trainable:this.trainable};return this.batchInputShape!=null&&(B.batchInputShape=this.batchInputShape),this.dtype!=null&&(B.dtype=this.dtype),B},ne.prototype.disposeWeights=function(){return this.weights.forEach(function(B){return B.dispose()}),this.weights.length},ne.prototype.assertNotDisposed=function(){if(this._refCount===0)throw new Error("Layer '"+this.name+"' is already disposed.")},ne.prototype.dispose=function(){if(!this.built)throw new Error("Cannot dispose Layer "+this.name+" because it has not been built yet.");if(this._refCount===null)throw new Error("Cannot dispose Layer "+this.name+" because it has not been used yet.");this.assertNotDisposed();var B=0;return--this._refCount==0&&(B=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:B}},ne}(s.serialization.Serializable),yl,Tc=function(ae){function ne(B){var H=ae.call(this,{dtype:B.dtype,name:B.name!=null?B.name:ko("input").toString()})||this;if(B.batchSize==null&&(B.batchSize=null),B.sparse==null&&(B.sparse=!1),H.trainable=!1,H.built=!0,H.sparse=B.sparse,B.inputShape!=null&&B.batchInputShape!=null)throw new V("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");var ue=B.batchInputShape;if(ue==null){if(B.inputShape==null)throw new V("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");ue=[B.batchSize].concat(B.inputShape)}else if(B.batchSize!=null)throw new V("Cannot specify batchSize if batchInputShape is specified when creating an InputLayer.");var Le=B.dtype||"float32";H.batchInputShape=ue,H.dtype=Le,H.inputSpec=[{shape:ue}];var Qe=new Yo(H.dtype,H.batchInputShape,H,[],{},H.name);return Qe.nodeIndex=0,Qe.tensorIndex=0,new gu({outboundLayer:H,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[Qe],outputTensors:[Qe],inputMasks:[null],outputMasks:[null],inputShapes:[ue],outputShapes:[ue]}),H}return v(ne,ae),ne.prototype.apply=function(B,H){throw new V("Cannot pass any input to an InputLayer's apply() method. InputLayer name: "+this.name)},ne.prototype.dispose=function(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}},ne.prototype.getConfig=function(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}},ne.className="InputLayer",ne}(fo);function Wl(ae){if(ae.batchShape==null&&ae.shape==null)throw new Error("Please provide to Input either a `shape` or a `batchShape` argument. Note that `shape` does not include the batch dimension.");
3849if(ae.batchShape!=null&&ae.shape!=null)throw new V("Please provide either a `shape` or `batchShape` argument to Input, but not both.");var ne=ae.batchShape;ae.shape!=null&&ne==null&&(ne=[null].concat(ae.shape));var B=ae.dtype;return B==null&&(B="float32"),new Tc({batchInputShape:ne,name:ae.name,dtype:B,sparse:ae.sparse}).inboundNodes[0].outputTensors[0]}function Jc(ae){return A(this,void 0,void 0,function(){var ne,B,H,ue,Le,Qe,wt,qt;return S(this,function(en){switch(en.label){case 0:if(ae==null)return[2];for(ue in ne=[],B=[],H=[],ae)typeof(Le=ae[ue])!="number"&&(Qe=Le,ne.push(Qe.data()),B.push(ue),H.push(Qe));return ne.length>0?[4,Promise.all(ne)]:[3,2];case 1:for(wt=en.sent(),qt=0;qt<wt.length;++qt)ae[B[qt]]=wt[qt][0];Object(s.dispose)(H),en.label=2;case 2:return[2]}})})}function Vl(ae){if(ae!=null)for(var ne in ae){var B=ae[ne];typeof B!="number"&&B.dispose()}}s.serialization.registerClass(Tc),function(ae){ae[ae.SILENT=0]="SILENT",ae[ae.VERBOSE=1]="VERBOSE"}(yl||(yl={}));var Sm=125,Qs=function(){function ae(){this.validationData=null}return ae.prototype.setParams=function(ne){this.params=ne},ae.prototype.onEpochBegin=function(ne,B){return A(this,void 0,void 0,function(){return S(this,function(H){return[2]})})},ae.prototype.onEpochEnd=function(ne,B){return A(this,void 0,void 0,function(){return S(this,function(H){return[2]})})},ae.prototype.onBatchBegin=function(ne,B){return A(this,void 0,void 0,function(){return S(this,function(H){return[2]})})},ae.prototype.onBatchEnd=function(ne,B){return A(this,void 0,void 0,function(){return S(this,function(H){return[2]})})},ae.prototype.onTrainBegin=function(ne){return A(this,void 0,void 0,function(){return S(this,function(B){return[2]})})},ae.prototype.onTrainEnd=function(ne){return A(this,void 0,void 0,function(){return S(this,function(B){return[2]})})},ae.prototype.setModel=function(ne){},ae}(),Zd=function(){function ae(ne,B){B===void 0&&(B=10),ne==null&&(ne=[]),this.callbacks=ne,this.queueLength=B}return ae.prototype.append=function(ne){this.callbacks.push(ne)},ae.prototype.setParams=function(ne){for(var B=0,H=this.callbacks;B<H.length;B++)H[B].setParams(ne)},ae.prototype.setModel=function(ne){for(var B=0,H=this.callbacks;B<H.length;B++)H[B].setModel(ne)},ae.prototype.onEpochBegin=function(ne,B){return A(this,void 0,void 0,function(){var H,ue;return S(this,function(Le){switch(Le.label){case 0:B==null&&(B={}),H=0,ue=this.callbacks,Le.label=1;case 1:return H<ue.length?[4,ue[H].onEpochBegin(ne,B)]:[3,4];case 2:Le.sent(),Le.label=3;case 3:return H++,[3,1];case 4:return[2]}})})},ae.prototype.onEpochEnd=function(ne,B){return A(this,void 0,void 0,function(){var H,ue;return S(this,function(Le){switch(Le.label){case 0:B==null&&(B={}),H=0,ue=this.callbacks,Le.label=1;case 1:return H<ue.length?[4,ue[H].onEpochEnd(ne,B)]:[3,4];case 2:Le.sent(),Le.label=3;case 3:return H++,[3,1];case 4:return[2]}})})},ae.prototype.onBatchBegin=function(ne,B){return A(this,void 0,void 0,function(){var H,ue;return S(this,function(Le){switch(Le.label){case 0:B==null&&(B={}),H=0,ue=this.callbacks,Le.label=1;case 1:return H<ue.length?[4,ue[H].onBatchBegin(ne,B)]:[3,4];case 2:Le.sent(),Le.label=3;case 3:return H++,[3,1];case 4:return[2]}})})},ae.prototype.onBatchEnd=function(ne,B){return A(this,void 0,void 0,function(){var H,ue;return S(this,function(Le){switch(Le.label){case 0:B==null&&(B={}),H=0,ue=this.callbacks,Le.label=1;case 1:return H<ue.length?[4,ue[H].onBatchEnd(ne,B)]:[3,4];case 2:Le.sent(),Le.label=3;case 3:return H++,[3,1];case 4:return[2]}})})},ae.prototype.onTrainBegin=function(ne){return A(this,void 0,void 0,function(){var B,H;return S(this,function(ue){switch(ue.label){case 0:ne==null&&(ne={}),B=0,H=this.callbacks,ue.label=1;case 1:return B<H.length?[4,H[B].onTrainBegin(ne)]:[3,4];case 2:ue.sent(),ue.label=3;case 3:return B++,[3,1];case 4:return[2]}})})},ae.prototype.onTrainEnd=function(ne){return A(this,void 0,void 0,function(){var B,H;return S(this,function(ue){switch(ue.label){case 0:ne==null&&(ne={}),B=0,H=this.callbacks,ue.label=1;case 1:return B<H.length?[4,H[B].onTrainEnd(ne)]:[3,4];case 2:ue.sent(),ue.label=3;case 3:return B++,[3,1];case 4:return[2]}})})},ae}(),Am=function(ae){function ne(){return ae.call(this)||this}return v(ne,ae),ne.prototype.onEpochBegin=function(B){return A(this,void 0,void 0,function(){return S(this,function(H){return this.seen=0,this.totals={},[2]})})},ne.prototype.onBatchEnd=function(B,H){return A(this,void 0,void 0,function(){var ue,Le,Qe,wt,qt=this;return S(this,function(en){for(wt in H==null&&(H={}),ue=H.size==null?0:H.size,this.seen+=ue,Le=function(gt){var Tn=H[gt];if(typeof Tn=="number")Qe.totals.hasOwnProperty(gt)||(Qe.totals[gt]=0),Qe.totals[gt]=Qe.totals[gt]+Tn*ue;else{var Pn=void 0;gt in Qe.totals?Pn=Qe.totals[gt]:Qe.totals[gt]=0;var zn=Object(s.tidy)(function(){return Object(s.add)(qt.totals[gt],Object(s.mul)(Tn,ue))});Qe.totals[gt]=zn,Pn!=null&&Pn.dispose()}},Qe=this,H)Le(wt);return[2]})})},ne.prototype.onEpochEnd=function(B,H){return A(this,void 0,void 0,function(){var ue,Le,Qe,wt,qt,en=this;return S(this,function(gt){if(H!=null)for(ue=function(Tn){if(Le.totals[Tn]==null)return"continue";typeof Le.totals[Tn]=="number"?H[Tn]=Le.totals[Tn]/Le.seen:Object(s.tidy)(function(){var Pn=Object(s.mul)(Object(s.div)(1,en.seen),en.totals[Tn]);H[Tn]=Pn,en.totals[Tn].dispose(),Object(s.keep)(H[Tn])})},Le=this,Qe=0,wt=this.params.metrics;Qe<wt.length;Qe++)qt=wt[Qe],ue(qt);return[2]})})},ne}(Qs),Qc=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.onTrainBegin=function(B){return A(this,void 0,void 0,function(){return S(this,function(H){return this.epoch=[],this.history={},[2]})})},ne.prototype.onEpochEnd=function(B,H){return A(this,void 0,void 0,function(){var ue;return S(this,function(Le){for(ue in H==null&&(H={}),this.epoch.push(B),H)this.history[ue]==null&&(this.history[ue]=[]),this.history[ue].push(H[ue]);return[2]})})},ne.prototype.syncData=function(){return A(this,void 0,void 0,function(){var B,H,ue,Le,Qe,wt,qt,en,gt;return S(this,function(Tn){switch(Tn.label){case 0:for(Le in B=[],H=[],ue=[],this.history)for(Qe=this.history[Le],wt=0;wt<Qe.length;++wt)typeof Qe[wt]!="number"&&(qt=Qe[wt],B.push(qt.data()),H.push(Le),ue.push(wt));return[4,Promise.all(B)];case 1:for(en=Tn.sent(),gt=0;gt<en.length;++gt)this.history[H[gt]][ue[gt]].dispose(),this.history[H[gt]][ue[gt]]=en[gt][0];return[2]}})})},ne}(Qs),eh=function(ae){function ne(B,H){var ue=ae.call(this)||this;if(ue.currentEpoch=0,ue.yieldEvery=H||"auto",ue.yieldEvery==="auto"&&(ue.yieldEvery=Sm),ue.yieldEvery==="never"&&B.onYield!=null)throw new Error("yieldEvery is `never` but you provided an `onYield` callback. Either change `yieldEvery` or remove the callback");return s.util.isNumber(ue.yieldEvery)&&(ue.maybeWait=function(Le,Qe){var wt,qt=s.util.now();return function(){for(var en=[],gt=0;gt<arguments.length;gt++)en[gt]=arguments[gt];var Tn=s.util.now();return Tn-qt<Qe?wt:(qt=Tn,wt=Le.apply(void 0,en))}}(ue.maybeWait.bind(ue),ue.yieldEvery)),ue.trainBegin=B.onTrainBegin,ue.trainEnd=B.onTrainEnd,ue.epochBegin=B.onEpochBegin,ue.epochEnd=B.onEpochEnd,ue.batchBegin=B.onBatchBegin,ue.batchEnd=B.onBatchEnd,ue.yield=B.onYield,ue}return v(ne,ae),ne.prototype.maybeWait=function(B,H,ue){return A(this,void 0,void 0,function(){var Le;return S(this,function(Qe){switch(Qe.label){case 0:return Le=[],this.yield==null?[3,2]:[4,Jc(ue)];case 1:Qe.sent(),Le.push(this.yield(B,H,ue)),Qe.label=2;case 2:return Le.push(Object(s.nextFrame)()),[4,Promise.all(Le)];case 3:return Qe.sent(),[2]}})})},ne.prototype.onEpochBegin=function(B,H){return A(this,void 0,void 0,function(){return S(this,function(ue){switch(ue.label){case 0:return this.currentEpoch=B,this.epochBegin==null?[3,3]:[4,Jc(H)];case 1:return ue.sent(),[4,this.epochBegin(B,H)];case 2:ue.sent(),ue.label=3;case 3:return[2]}})})},ne.prototype.onEpochEnd=function(B,H){return A(this,void 0,void 0,function(){var ue;return S(this,function(Le){switch(Le.label){case 0:return ue=[],this.epochEnd==null?[3,2]:[4,Jc(H)];case 1:Le.sent(),ue.push(this.epochEnd(B,H)),Le.label=2;case 2:return this.yieldEvery==="epoch"&&ue.push(Object(s.nextFrame)()),[4,Promise.all(ue)];case 3:return Le.sent(),[2]}})})},ne.prototype.onBatchBegin=function(B,H){return A(this,void 0,void 0,function(){return S(this,function(ue){switch(ue.label){case 0:return this.batchBegin==null?[3,3]:[4,Jc(H)];case 1:return ue.sent(),[4,this.batchBegin(B,H)];case 2:ue.sent(),ue.label=3;case 3:return[2]}})})},ne.prototype.onBatchEnd=function(B,H){return A(this,void 0,void 0,function(){var ue;return S(this,function(Le){switch(Le.label){case 0:return ue=[],this.batchEnd==null?[3,2]:[4,Jc(H)];case 1:Le.sent(),ue.push(this.batchEnd(B,H)),Le.label=2;case 2:return this.yieldEvery==="batch"?ue.push(Object(s.nextFrame)()):s.util.isNumber(this.yieldEvery)&&ue.push(this.maybeWait(this.currentEpoch,B,H)),[4,Promise.all(ue)];case 3:return Le.sent(),[2]}})})},ne.prototype.onTrainBegin=function(B){return A(this,void 0,void 0,function(){return S(this,function(H){switch(H.label){case 0:return this.trainBegin==null?[3,3]:[4,Jc(B)];case 1:return H.sent(),[4,this.trainBegin(B)];case 2:H.sent(),H.label=3;case 3:return[2]}})})},ne.prototype.onTrainEnd=function(B){return A(this,void 0,void 0,function(){return S(this,function(H){switch(H.label){case 0:return this.trainEnd==null?[3,3]:[4,Jc(B)];case 1:return H.sent(),[4,this.trainEnd(B)];case 2:H.sent(),H.label=3;case 3:return[2]}})})},ne}(Qs);function mp(ae,ne){return ae==null&&(ae={}),ae instanceof Qs?[ae]:Array.isArray(ae)&&ae[0]instanceof Qs?ae:pe(ae).map(function(B){return new eh(B,ne)})}var $l=function(){function ae(){}return ae.registerCallbackConstructor=function(ne,B){s.util.assert(ne>=0&&Number.isInteger(ne),function(){return"Verbosity level is expected to be an integer >= 0, but got "+ne}),ae.checkForDuplicate(B),ae.constructors[ne]==null&&(ae.constructors[ne]=[]),ae.constructors[ne].push(B)},ae.checkForDuplicate=function(ne){for(var B in ae.constructors)ae.constructors[+B].forEac
3849h(function(H){if(H===ne)throw new V("Duplicate callback constructor.")})},ae.clear=function(){ae.constructors={}},ae.createCallbacks=function(ne){var B=[];for(var H in ae.constructors){var ue=+H;ne>=ue&&B.push.apply(B,ae.constructors[ue])}return B.map(function(Le){return new Le})},ae.constructors={},ae}();function nd(ae,ne,B,H,ue,Le,Qe,wt,qt){var en=new Qc,gt=[new Am].concat($l.createCallbacks(ne));ae!=null&>.push.apply(gt,ae),gt.push(en);var Tn=new Zd(gt);return Tn.setParams({epochs:B,initialEpoch:H,samples:ue,steps:Le,batchSize:Qe,verbose:ne,doValidation:wt,metrics:qt}),{callbackList:Tn,history:en}}function ys(ae,ne,B){return ne===void 0&&(ne={}),B===void 0&&(B=!1),ht(ae,s.serialization.SerializationMap.getMap().classNameMap,ne,"layer",B)}function vf(ae,ne){return Object(s.tidy)(function(){ae.dtype!=="float32"&&(ae=ae.asType("float32"));var B=Object(s.sum)(co(ae),ne,!0),H=Object(s.fill)(B.shape,M()),ue=Object(s.sqrt)(Object(s.maximum)(B,H));return Object(s.div)(ae,ue)})}function Ha(ae,ne){return Object(s.tidy)(function(){return Object(s.mean)(co(Object(s.sub)(ne,ae)),-1)})}function bl(ae,ne){return Object(s.tidy)(function(){return Object(s.mean)(Object(s.abs)(Object(s.sub)(ne,ae)),-1)})}function Zs(ae,ne){return Object(s.tidy)(function(){var B=Object(s.sub)(ae,ne),H=Object(s.clipByValue)(Object(s.abs)(ae),M(),Number.MAX_VALUE),ue=Object(s.abs)(Object(s.div)(B,H));return Object(s.mul)(100,Object(s.mean)(ue,-1))})}function ls(ae,ne,B){return B===void 0&&(B=!1),Object(s.tidy)(function(){if(B)ne=Object(s.softmax)(ne);else{var H=Object(s.sum)(ne,ne.shape.length-1,!0);ne=Object(s.div)(ne,H)}return ne=Object(s.clipByValue)(ne,M(),1-M()),Object(s.neg)(Object(s.sum)(Object(s.mul)(ae.toFloat(),Object(s.log)(ne)),ne.shape.length-1))})}function xl(ae,ne){return Object(s.tidy)(function(){var B=Object(s.floor)(function(ue){var Le=[rn(ue.shape)];return ue.reshape(Le)}(ae)).toInt(),H=(ne=Object(s.clipByValue)(ne,M(),1-M())).shape;return ls(Object(s.oneHot)(B,H[H.length-1]).reshape(H),ne,!1)})}function rd(ae,ne){return Object(s.tidy)(function(){var B;return B=Object(s.clipByValue)(ne,M(),1-M()),B=Object(s.log)(Object(s.div)(B,Object(s.sub)(1,B))),Object(s.mean)(function(H,ue){if(!s.util.arraysEqual(H.shape,ue.shape))throw new V("logits and labels must have the same shape, but got shapes "+JSON.stringify(H.shape)+" and "+JSON.stringify(ue.shape));return Object(s.tidy)(function(){var Le=ue.relu(),Qe=ue.abs().neg();return Le.sub(ue.mul(H)).add(Qe.exp().log1p())})}(ae,B),-1)})}function wl(ae,ne){return Object(s.tidy)(function(){var B=vf(ae,-1),H=vf(ne,-1),ue=Object(s.mul)(B,H);return Object(s.neg)(Object(s.sum)(ue,-1))})}var vc={meanSquaredError:Ha,meanAbsoluteError:bl,meanAbsolutePercentageError:Zs,meanSquaredLogarithmicError:function(ae,ne){return Object(s.tidy)(function(){var B=Object(s.clipByValue)(ne,M(),Number.MAX_VALUE),H=Object(s.log)(Object(s.add)(1,B)),ue=Object(s.clipByValue)(ae,M(),Number.MAX_VALUE),Le=Object(s.log)(Object(s.add)(1,ue));return Object(s.mean)(co(Object(s.sub)(H,Le)),-1)})},squaredHinge:function(ae,ne){return Object(s.tidy)(function(){var B=Object(s.maximum)(0,Object(s.sub)(1,Object(s.mul)(ae,ne)));return Object(s.mean)(co(B),-1)})},hinge:function(ae,ne){return Object(s.tidy)(function(){var B=Object(s.maximum)(0,Object(s.sub)(1,Object(s.mul)(ae,ne)));return Object(s.mean)(B,-1)})},categoricalHinge:function(ae,ne){return Object(s.tidy)(function(){var B=Object(s.sum)(Object(s.mul)(ae,ne),-1),H=Object(s.max)(Object(s.mul)(Object(s.sub)(1,ae),ne),-1);return Object(s.maximum)(0,Object(s.add)(1,Object(s.sub)(H,B)))})},logcosh:function(ae,ne){return Object(s.tidy)(function(){var B=Math.log(2),H=Object(s.sub)(ne,ae),ue=Object(s.sub)(Object(s.add)(H,Object(s.softplus)(Object(s.mul)(-2,H))),B);return Object(s.mean)(ue,-1)})},categoricalCrossentropy:ls,sparseCategoricalCrossentropy:xl,binaryCrossentropy:rd,kullbackLeiblerDivergence:function(ae,ne){return Object(s.tidy)(function(){var B=Object(s.clipByValue)(ae,M(),1),H=Object(s.clipByValue)(ne,M(),1);return Object(s.sum)(Object(s.mul)(ae,Object(s.log)(Object(s.div)(B,H))),-1)})},poisson:function(ae,ne){return Object(s.tidy)(function(){var B=Object(s.log)(Object(s.add)(M(),ne));return Object(s.mean)(Object(s.sub)(ne,Object(s.mul)(ae,B)),-1)})},cosineProximity:wl};function gp(ae){if(typeof ae=="string"){if(ae in vc)return vc[ae];var ne="Unknown loss "+ae;throw ae.toLowerCase().includes("softmaxcrossentropy")&&(ne="Unknown loss "+ae+'. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy'),new V(ne)}return ae}function th(ae,ne){return Object(s.tidy)(function(){var B=Object(s.mul)(.5,Object(s.onesLike)(ne)),H=Dr(Object(s.greater)(ne,B),ae.dtype);return Object(s.mean)(Object(s.equal)(ae,H),-1)})}function nh(ae,ne){return Object(s.tidy)(function(){return Dr(Object(s.equal)(Object(s.argMax)(ae,-1),Object(s.argMax)(ne,-1)),"float32")})}function Ja(ae,ne){return Object(s.tidy)(function(){return Object(s.logicalAnd)(ae.equal(1),ne.equal(1)).sum().cast("float32")})}function vp(ae,ne){return Object(s.tidy)(function(){var B=Ja(ae,ne),H=function(Le,Qe){return Object(s.tidy)(function(){return Object(s.logicalAnd)(Le.equal(0),Qe.equal(1)).sum().cast("float32")})}(ae,ne),ue=B.add(H);return Object(s.where)(Object(s.greater)(ue,0),B.div(ue),0).cast("float32")})}
3849function Om(ae,ne){return Object(s.tidy)(function(){var B=Ja(ae,ne),H=function(Le,Qe){return Object(s.tidy)(function(){return Object(s.logicalAnd)(Le.equal(1),Qe.equal(0)).sum().cast("float32")})}(ae,ne),ue=B.add(H);return Object(s.where)(Object(s.greater)(ue,0),B.div(ue),0).cast("float32")})}function rh(ae,ne){return rd(ae,ne)}function ih(ae,ne){return ae.rank===ne.rank&&(ae=ae.squeeze([ae.rank-1])),(ne=ne.argMax(-1)).dtype!==ae.dtype&&(ne=ne.asType(ae.dtype)),Object(s.equal)(ae,ne).asType("float32")}var vu=ls,oh=xl,gr={binaryAccuracy:th,categoricalAccuracy:nh,precision:vp,categoricalCrossentropy:vu,sparseCategoricalCrossentropy:oh,mse:Ha,MSE:Ha,mae:bl,MAE:bl,mape:Zs,MAPE:Zs,cosine:wl};function Nc(ae){if(K(ae!==null,"Unknown LossOrMetricFn "+ae),typeof ae=="string")return ae;for(var ne=void 0,B=0,H=Object.keys(vc);B<H.length;B++){var ue=H[B];if(vc[ue]===ae){ne=ue;break}}if(ne!==void 0)return ne;for(var Le=0,Qe=Object.keys(gr);Le<Qe.length;Le++)if(ue=Qe[Le],gr[ue]===ae){ne=ue;break}return ne!==void 0?ne:ae.name}var Rg=1048576;function Bg(ae,ne,B){if(B===void 0&&(B=!1),ae==null||typeof ae!="object"||Object.getPrototypeOf(ae)!==Object.prototype||!function ue(Le){if(Le===null)return!0;if(typeof Le=="object"){if(Object.getPrototypeOf(Le)===Object.prototype){for(var Qe=0,wt=Object.keys(Le);Qe<wt.length;Qe++){var qt=wt[Qe];if(typeof qt!="string"||!ue(Le[qt]))return!1}return!0}if(Array.isArray(Le)){for(var en=0,gt=Le;en<gt.length;en++)if(!ue(gt[en]))return!1;return!0}return!1}var Tn=typeof Le;return Tn==="string"||Tn==="number"||Tn==="boolean"}(ae))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(B){var H=JSON.stringify(ae);H.length>Rg&&console.warn('User-defined metadata of model "'+ne+'" is too large in size (length='+H.length+" when serialized). It is not recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= "+Rg+".")}}function ah(ae,ne,B,H){H===void 0&&(H=console.log);var ue,Le=function(Pn){var zn=!0,Jn=[],Vn=[];for(var lr in Pn.nodesByDepth)Jn.push(Pn.nodesByDepth[lr]);for(var dr=0,Tr=Jn;dr<Tr.length;dr++){var Hr=Tr[dr];if(Hr.length>1||Hr.length===1&&Hr[0].inboundLayers.length>1){zn=!1;break}Vn.push.apply(Vn,Hr)}if(zn)for(var oi=0,Br=Pn.layers;oi<Br.length;oi++){for(var ui=!1,ii=0,Ci=Br[oi].inboundNodes;ii<Ci.length;ii++){var Di=Ci[ii];if(Vn.indexOf(Di)!==-1){if(ui){zn=!1;break}ui=!0}}if(!zn)break}return zn}(ae),Qe=["Layer (type)","Output shape","Param #"];if(Le?(ne=ne||65,B=B||[.45,.85,1]):(ne=ne||98,B=B||[.33,.55,.67,1]),B[B.length-1]<=1&&(B=B.map(function(Pn){return Math.floor(ne*Pn)})),!Le)for(var wt in Qe.push("Receives inputs"),ue=[],ae.nodesByDepth)ue.push.apply(ue,ae.nodesByDepth[wt]);H("_".repeat(ne)),id(Qe,B,H),H("=".repeat(ne));for(var qt=ae.layers,en=0;en<qt.length;++en)Le?Dm(qt[en],B,H):yp(qt[en],B,ue,H),H((en===qt.length-1?"=":"_").repeat(ne));ae.checkTrainableWeightsConsistency();var gt=function(Pn){return Pn.collectedTrainableWeights!=null?ki(Pn.collectedTrainableWeights):ki(Pn.trainableWeights)}(ae),Tn=ki(ae.nonTrainableWeights);H("Total params: "+(gt+Tn)),H("Trainable params: "+gt),H("Non-trainable params: "+Tn),H("_".repeat(ne))}function id(ae,ne,B){B===void 0&&(B=console.log);for(var H="",ue=0;ue<ae.length;++ue)ue>0&&(H=H.slice(0,H.length-1)+" "),H=(H+=ae[ue]).slice(0,ne[ue]),H+=" ".repeat(ne[ue]-H.length);B(H)}function Dm(ae,ne,B){var H;try{H=JSON.stringify(ae.outputShape)}catch{H="multiple"}id([ae.name+" ("+ae.getClassName()+")",H,ae.countParams().toString()],ne,B)}function yp(ae,ne,B,H){var ue;try{ue=JSON.stringify(ae.outputShape)}catch{ue="multiple"}for(var Le=[],Qe=0,wt=ae.inboundNodes;Qe<wt.length;Qe++){var qt=wt[Qe];if(!(B!=null&&B.length>0&&B.indexOf(qt)===-1))for(var en=0;en<qt.inboundLayers.length;++en){var gt=qt.inboundLayers[en].name,Tn=qt.nodeIndices[en],Pn=qt.tensorIndices[en];Le.push(gt+"["+Tn+"]["+Pn+"]")}}var zn=ae.name,Jn=ae.getClassName(),Vn=Le.length===0?"":Le[0];for(id([zn+" ("+Jn+")",ue,ae.countParams().toString(),Vn],ne,H),en=1;en<Le.length;++en)id(["","","",Le[en]],ne,H)}function bp(ae,ne,B){return(ae==="inboundNodes"||ae==="outputLayers"||ae==="inputLayers")&&ne===0&&typeof B=="str
3849ing"}function eo(ae,ne){if(ae===null)return null;if(typeof ae=="string")return Ce(ae);if(typeof ae=="number"||typeof ae=="boolean")return ae;if(ae instanceof Array){for(var B=[],H=ae.length,ue=0;ue<H;++ue){var Le=ae[ue];bp(ne,ue,Le)?B.push(Le):B.push(eo(Le,ne))}return B}for(var Qe={},wt=0,qt=Object.keys(ae);wt<qt.length;wt++){var en=qt[wt],gt=ae[en];if(en==="name"&&typeof gt=="string")Qe[en]=gt;else{var Tn=Ce(en);Qe[Tn]=eo(gt,Tn)}}return Qe}var ca=function(){function ae(ne){if(this.id2Value={},this.id2Mask={},this.name2Id={},ne instanceof ae)for(var B in ne.id2Value)this.id2Value[B]=ne.id2Value[B],B in ne.id2Mask&&(this.id2Mask[B]=ne.id2Mask[B]);else{if(ne==null)return;for(var H=0,ue=ne;H<ue.length;H++){var Le=ue[H];this.add(Le.key,Le.value)}}}return ae.prototype.add=function(ne,B,H){if(this.id2Value[ne.id]!=null)throw new V("Duplicate key: name="+ne.name+", id="+ne.id);return this.id2Value[ne.id]=function(ue,Le){if(ue.dtype==null||ue.dtype===Le.dtype)return Le;try{return Object(s.cast)(Le,ue.dtype)}catch{throw new V("The dtype of the feed ("+Le.dtype+") can not be cast to the dtype of the key '"+ue.name+"' ("+ue.dtype+").")}}(ne,B),this.name2Id[ne.name]=ne.id,H!=null&&(this.id2Mask[ne.id]=H),this},ae.prototype.addFeed=function(ne){this.add(ne.key,ne.value)},ae.prototype.hasKey=function(ne){return this.id2Value[ne.id]!=null},ae.prototype.names=function(){return Object.keys(this.name2Id)},ae.prototype.getValue=function(ne){if(ne instanceof Yo){if(this.id2Value[ne.id]==null)throw new V("Nonexistent key: "+ne.name);return this.id2Value[ne.id]}var B=this.name2Id[ne];if(B==null)throw new V("Feed dict has no SymbolicTensor name: "+ne);return this.id2Value[B]},ae.prototype.getMask=function(ne){if(ne instanceof Yo){if(this.id2Value[ne.id]==null)throw new V("Nonexistent key: "+ne.name);return this.id2Mask[ne.id]}var B=this.name2Id[ne];if(B==null)throw new V("Feed dict has no SymbolicTensor name: "+ne);return this.id2Mask[B]},ae.prototype.disposeMasks=function(){this.id2Mask!=null&&Object(s.dispose)(this.id2Mask)},ae}(),xp={},N0={};function sh(ae,ne,B,H){for(var ue=B!=null&&B.training,Le=Array.isArray(ae),Qe=Le?ae:[ae],wt=Qe.map(function(Xi){return Xi.name}),qt=[],en=ne.names(),gt=0,Tn=wt;gt<Tn.length;gt++){var Pn=Tn[gt];en.indexOf(Pn)!==-1?qt.push(ne.getValue(Pn)):qt.push(null)}H!=null&&(H.maxNumTensors=-1/0,H.minNumTensors=1/0);var zn,Jn,Vn=wt.join(",")+"|"+ne.names().join(",");if(xp[Vn]==null){var lr=function(Xi,Ho){s.util.assert(Xi!=null&&Xi.length>0,function(){return"Expected at least one fetch, got none"});var Ga=[],Qa={};if(Xi.length===1){var Ua=Tm(Xi[0],Ho);Ga=Ua.sorted,Qa=Ua.recipientMap}else for(var Na=new Set,Hs=0,Za=Xi;Hs<Za.length;Hs++){for(var qo=Tm(Za[Hs],Ho),ss=qo.sorted,jc=qo.recipientMap,ru=0,ws=ss;ru<ws.length;ru++){var la=ws[ru];Na.has(la.name)||(Ga.push(la),Na.add(la.name))}var Al=function(Mu){Qa[Mu]==null&&(Qa[Mu]=new Set),jc[Mu].forEach(function(Ia){return Qa[Mu].add(Ia)})};for(var Xu in jc)Al(Xu)}return{sorted:Ga,recipientCounts:function(Mu){var Ia={};for(var Fu in Mu)Ia[Fu]=Mu[Fu].size;return Ia}(Qa)}}(Qe,ne);zn=lr.sorted,Jn=lr.recipientCounts,xp[Vn]=zn,N0[Vn]=Jn}zn=xp[Vn],Jn={},ue||Object.assign(Jn,N0[Vn]);for(var dr=new ca(ne),Tr=0;Tr<zn.length;++Tr){if(H!=null){var Hr=Object(s.memory)().numTensors;Hr>H.maxNumTensors&&(H.maxNumTensors=Hr),Hr<H.minNumTensors&&(H.minNumTensors=Hr)}var oi=zn[Tr],Br=oi.sourceLayer;if(!(Br instanceof Tc)){for(var ui=[],ii=[],Ci=[],Di=!1,si=0,wi=oi.inputs;si<wi.length;si++){var Co=wi[si],_o=dr.getValue(Co),ba=dr.getMask(Co);ui.push(_o),ii.push(ba),ba!=null&&(Di=!0),ue||(Jn[Co.name]--,Jn[Co.name]!==0||ne.hasKey(Co)||wt.indexOf(Co.name)!==-1||_o.isDisposed||Co.sourceLayer.stateful===!0||Ci.push(_o))}Di&&((B=B||{}).mask=ii[0]);var ro=pe(Br.apply(ui,B)),So=null;Br.supportsMasking&&(So=Br.computeMask(ui,ii));for(var ja=yu(oi),pa=Array.isArray(ja)?ja:[ja],Ta=0;Ta<pa.length;++Ta){dr.hasKey(pa[Ta])||dr.add(pa[Ta],ro[Ta],Array.isArray(So)?So[0]:So);var Zi=wt.indexOf(pa[Ta].name);Zi!==-1&&(qt[Zi]=ro[Ta])}ue||Object(s.dispose)(Ci)}}return dr.disposeMasks(),Le?qt:qt[0]}function Tm(ae,ne){for(var B=new Set,H=[],ue={},Le=0,Qe=ne.names();Le<Qe.length;Le++){var wt=Qe[Le];B.add(wt)}var qt=[],en=[];for(qt.push(ae);qt.length>0;){var gt=qt[qt.length-1];if(B.has(gt.name))qt.pop();else{var Tn=en[en.length-1]===qt.length-1;
3849if(gt.inputs.length===0||Tn)qt.pop(),H.push(gt),B.add(gt.name),Tn&&en.pop();else{en.push(qt.length-1);for(var Pn=0,zn=gt.inputs;Pn<zn.length;Pn++){var Jn=zn[Pn];ue[Jn.name]==null&&(ue[Jn.name]=new Set),ue[Jn.name].add(gt.name),B.has(Jn.name)||qt.push(Jn)}}}}return{sorted:H,recipientMap:ue}}function yu(ae){var ne;if(ae.sourceLayer.inboundNodes.length===1)ne=ae.sourceLayer.output;else{for(var B=null,H=0;H<ae.sourceLayer.inboundNodes.length;++H)for(var ue=0,Le=ae.sourceLayer.inboundNodes[H].outputTensors;ue<Le.length;ue++)if(Le[ue].id===ae.id){B=H;break}ne=ae.sourceLayer.getOutputAt(B)}return ne}function _l(ae,ne){return function(B,H,ue){var Le=H.length;if(B==null||Array.isArray(B)&&B.length===0)return H.map(function(wt){return null});if(Le===1)return Array.isArray(B)&&B.length===1?B:typeof B=="object"&&H[0]in B?[B[H[0]]]:[B];if(Array.isArray(B)){if(B.length!==Le)throw new Error("Provided "+ue+" is an array of "+B.length+" element(s), but the model has "+Le+" outputs. Make sure a set of weights is provided for each model output.");return B}if(typeof B=="object"&&Object.keys(B).length>0&&typeof B[Object.keys(B)[0]]=="object"){var Qe=[];return H.forEach(function(wt){wt in B?Qe.push(B[wt]):Qe.push(null)}),Qe}throw new Error("The model has multiple ("+Le+") outputs, so "+ue+" must be either an array with "+Le+" elements or an object with "+H+" keys. Provided "+ue+" not understood: "+JSON.stringify(B))}(ae,ne,"classWeight")}function Nm(ae,ne,B,H){return A(this,void 0,void 0,function(){var ue,Le,Qe,wt,qt;return S(this,function(en){switch(en.label){case 0:if(ne!=null||H!=null)throw new Error("Support sampleWeight is not implemented yet");return B==null?[3,2]:(ue=Object(s.tidy)(function(){if(ae.shape.length===1)return ae.clone();if(ae.shape.length===2){if(ae.shape[1]>1)return ae.argMax(1);if(ae.shape[1]===1)return ae.reshape([ae.shape[0]]);throw new Error("Encountered unexpected last-dimension size ("+ae.shape[1]+") during handling of class weights. The size is expected to be >= 1.")}throw new Error("Unexpected rank of target (y) tensor ("+ae.rank+") during handling of class weights. The rank is expected to be 1 or 2.")}),wt=(Qe=Array).from,[4,ue.data()]);case 1:return Le=wt.apply(Qe,[en.sent()]),Object(s.dispose)(ue),qt=[],Le.forEach(function(gt){if(B[gt]==null)throw new Error("classWeight must contain all classes in the training data. The class "+gt+" exists in the data but not in classWeight");qt.push(B[gt])}),[2,Object(s.tensor1d)(qt,"float32")];case 2:return[2,null]}})})}function Pg(ae,ne){return Object(s.mul)(ae,ne)}var jg=32;function I0(ae,ne){var B,H,ue=ne;B=ue.xs,H=ue.ys,s.util.assert(B!=null&&H!=null,function(){return"A Dataset iterator for fitDataset() is expected to generate objects of the form `{xs: xVal, ys: yVal}`, where the two values may be `tf.Tensor`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates "+ne});var Le=M0("input",ae.inputNames,B),Qe=M0("output",ae.outputNames,H),wt=Le[0].shape[0];
3849s.util.assert(Le.length===ae.inputs.length,function(){return"LayersModel has "+ae.inputs.length+" inputs, but the dataset provides "+Le.length+" inputs. (Expected input keys: "+JSON.stringify(ae.inputNames)+")"}),s.util.assert(Qe.length===ae.outputs.length,function(){return"LayersModel has "+ae.outputs.length+" outputs, but the dataset provides "+Qe.length+" outputs. (Expected output keys: "+JSON.stringify(ae.outputNames)+")"});for(var qt=function(Pn){s.util.assert(Le[Pn].shape[0]===wt,function(){return"Batch size mismatch: input "+ae.inputNames[Pn]+" has "+Le[Pn].shape[0]+"; expected "+wt+" based on input "+ae.inputNames[0]+"."})},en=0;en<Le.length;en++)qt(en);for(var gt=function(Pn){s.util.assert(Qe[Pn].shape[0]===wt,function(){return"Batch size mismatch: output "+ae.outputNames[Pn]+" has "+Qe[Pn].shape[0]+"; expected "+wt+" based on input "+ae.inputNames[0]+"."})},Tn=0;Tn<Qe.length;Tn++)gt(Tn);return{xs:Le,ys:Qe}}function M0(ae,ne,B){if(B instanceof s.Tensor)return[B];if(Array.isArray(B))return s.util.assert(B.length===ne.length,function(){return"Received an array of "+B.length+" Tensors, but expected "+ne.length+" to match the "+ae+" keys "+ne+"."}),B;for(var H=[],ue=0,Le=ne;ue<Le.length;ue++){var Qe=Le[ue];if(B[Qe]==null)throw new V("The feature data generated by the dataset lacks the required "+ae+" key '"+Qe+"'.");H.push(B[Qe])}return H}function yf(ae,ne,B){return A(this,void 0,void 0,function(){var H,ue,Le,Qe,wt,qt,en,gt,Tn,Pn,zn,Jn,Vn,lr,dr,Tr,Hr,oi,Br,ui,ii,Ci,Di,si,wi,Co,_o,ba,ro,So,ja,pa,Ta,Zi;return S(this,function(Xi){switch(Xi.label){case 0:if(H=B.batchesPerEpoch!=null,s.util.assert(ae.optimizer!=null,function(){return"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."}),s.util.assert(B!=null,function(){return"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."}),s.util.assert(B.epochs!=null&&B.epochs>0&&Number.isInteger(B.epochs),function(){return"For fitDataset(), config.epochs is expected to be a positive integer, but got "+B.epochs}),s.util.assert(!H||B.batchesPerEpoch>0&&Number.isInteger(B.batchesPerEpoch),function(){return"For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got "+B.batchesPerEpoch}),s.util.assert(B.validationSplit==null,function(){return"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."}),ae.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");ae.isTraining=!0,Xi.label=1;case 1:return Xi.trys.push([1,,26,27]),ue=B.validationData!=null,Le=void 0,Qe=void 0,ue&&(As(B.validationData)?s.util.assert(B.validationBatches==null||B.validationBatches>0&&Number.isInteger(B.validationBatches),function(){return"For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got "+B.validationBatches}):(wt=function(Ho){if(Ho.length===3)throw new N("Validation with sample weights is not implemented yet.");return{xs:Ho[0],ys:Ho[1]}}(B.validationData),Le=wt.xs,Qe=wt.ys)),qt=ae.makeTrainFunction(),en=ae.getDedupedMetricsNames(),gt=void 0,gt=ue?en.slice().concat(en.map(function(Ho){return"val_"+Ho})):en.slice(),Tn=mp(B.callbacks,B.yieldEvery),Pn=B.verbose==null?1:B.verbose,zn=nd(Tn,Pn,B.epochs,null,null,function(Ho,Ga){var Qa=null;return Ga.batchesPerEpoch!=null?Qa=Ga.batchesPerEpoch:Number.isFinite(Ho.size)&&(Qa=Ho.size),Qa}(ne,B),null,ue,gt),Jn=zn.callbackList,Vn=zn.history,Jn.setModel(ae),ae.history=Vn,[4,Jn.onTrainBegin()];case 2:return Xi.sent(),ae.stopTraining_=!1,lr=B.initialEpoch==null?0:B.initialEpoch,[4,ne.iterator()];case 3:dr=Xi.sent(),Xi.label=4;case 4:return lr<B.epochs?(Tr={},[4,Jn.onEpochBegin(lr)]):[3,23];case 5:return Xi.sent(),Hr=0,oi=0,H?[3,7]:[4,ne.iterator()];case 6:dr=Xi.sent(),Xi.label=7;case 7:return!H||Hr<B.batchesPerEpoch?[4,dr.next()]:[3,21];case 8:return Br=Xi.sent(),H&&Br.done?(console.warn("You provided `batchesPerEpoch` as "+B.batchesPerEpoch+", but your dataset iterator ran out of data after "+Hr+" batches; interrupting training. Make sure that your dataset can generate at least `batchesPerEpoch * epochs` batches (in this case, "+B.batchesPerEpoch*B.epochs+" batches). You may need to use the repeat() function when building your dataset."),[3,21]):Br.value==null?[3,15]:(ui=I0(ae,Br.value),ii=ui.xs,Ci=ui.ys,(Di={}).batch=oi,Di.size=ii[0].shape[0],[4,Jn.onBatchBegin(oi,Di)]);case 9:if(Xi.sent(),si=[],B.classWeight==null)return[3,13];
3849wi=_l(B.classWeight,ae.outputNames),Zi=0,Xi.label=10;case 10:return Zi<wi.length?(_o=(Co=si).push,[4,Nm(Ci[Zi],null,wi[Zi])]):[3,13];case 11:_o.apply(Co,[Xi.sent()]),Xi.label=12;case 12:return++Zi,[3,10];case 13:for(ba=ii.concat(Ci).concat(si),ro=qt(ba),Object(s.dispose)(ba),Zi=0;Zi<en.length;++Zi)So=en[Zi],ja=ro[Zi],Di[So]=ja,Object(s.keep)(ja);return[4,Jn.onBatchEnd(oi,Di)];case 14:Xi.sent(),Vl(Di),oi++,Hr++,Xi.label=15;case 15:return(H?Hr>=B.batchesPerEpoch:Br.done)?ue?(pa=void 0,As(B.validationData)?(Ta=pe,[4,ae.evaluateDataset(B.validationData,{batches:B.validationBatches})]):[3,17]):[3,19]:[3,20];case 16:return pa=Ta.apply(void 0,[Xi.sent()]),[3,18];case 17:pa=pe(ae.evaluate(Le,Qe,{batchSize:B.validationBatchSize==null?jg:B.validationBatchSize,verbose:0})),Xi.label=18;case 18:for(Zi=0;Zi<ae.metricsNames.length;++Zi)Tr["val_"+ae.metricsNames[Zi]]=pa[Zi];Xi.label=19;case 19:return[3,21];case 20:return ae.stopTraining_?[3,21]:[3,7];case 21:return[4,Jn.onEpochEnd(lr,Tr)];case 22:return Xi.sent(),lr++,ae.stopTraining_?[3,23]:[3,4];case 23:return[4,Jn.onTrainEnd()];case 24:return Xi.sent(),[4,ae.history.syncData()];case 25:return Xi.sent(),[2,ae.history];case 26:return ae.isTraining=!1,[7];case 27:return[2]}})})}function As(ae){return typeof ae.iterator=="function"}function wp(ae){s.util.assert(ae>0&&Number.isInteger(ae),function(){return"batchSize is required to be a positive integer, but got "+ae})}function et(ae,ne,B){return ae==null?[null]:Array.isArray(ae)?ae.map(function(H){return fi(H,ne,B-ne)}):fi(ae,ne,B-ne)}function Zc(ae,ne){return Object(s.tidy)(function(){return ae==null?null:Array.isArray(ae)?ae.map(function(B){return Zc(B,ne)}):na(ae,ne.dtype==="int32"?ne:ne.toInt())})}function uh(ae,ne){for(var B=[],H=0,ue=null;H<ae;)(ue=H+ne)>=ae&&(ue=ae),B.push([H,ue]),H=ue;return B}function Im(ae,ne,B,H){return H===void 0&&(H={}),A(this,void 0,void 0,function(){var ue,Le,Qe,wt,qt,en,gt,Tn,Pn,zn,Jn,Vn,lr,dr,Tr,Hr,oi,Br,ui,ii,Ci,Di;return S(this,function(si){switch(si.label){case 0:if(ae.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");ae.isTraining=!0,si.label=1;case 1:return si.trys.push([1,,7,8]),wp(Tn=H.batchSize==null?32:H.batchSize),Pn=!1,[4,ae.standardizeUserData(ne,B,H.sampleWeight,H.classWeight,Pn,Tn)];case 2:if(zn=si.sent(),ue=zn[0],Le=zn[1],gt=zn[2],Jn=!1,Vn=void 0,!(H.validationData!=null&&H.validationData.length>0))return[3,4];if(Jn=!0,H.validationData.length!==2)throw H.validationData.length===3?new N("validationData including sample weights is not supported yet."):new V("When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; "+H.validationData+" is invalid.");return Qe=H.validationData[0],wt=H.validationData[1],lr=!0,[4,ae.standardizeUserData(Qe,wt,null,null,lr,Tn)];case 3:return dr=si.sent(),qt=dr[0],en=dr[1],Vn=qt.concat(en),[3,5];case 4:H.validationSplit!=null&&H.validationSplit>0&&H.validationSplit<1?(Jn=!0,Tr=Math.floor(ue[0].shape[0]*(1-H.validationSplit)),Hr=ue[0].shape[0],qt=et(ue,Tr,Hr),ue=et(ue,0,Tr),en=et(Le,Tr,Hr),Le=et(Le,0,Tr),Vn=qt.concat(en)):H.validationSteps!=null&&(Jn=!0),si.label=5;case 5:return oi=ue.concat(Le).concat(gt),ae.checkTrainableWeightsConsistency(),Br=ae.makeTrainFunction(),ui=ae.getDedupedMetricsNames(),ii=void 0,Ci=void 0,Jn?(ae.makeTestFunction(),ii=ae.testFunction,Ci=ui.slice().concat(ui.map(function(wi){return"val_"+wi}))):(ii=null,Vn=[],Ci=ui.slice()),Di=mp(H.callbacks,H.yieldEvery),[4,function(wi,Co,_o,ba,ro,So,ja,pa,Ta,Zi,Xi,Ho,Ga,Qa,Ua){return A(this,void 0,void 0,function(){var Na,Hs,Za,qo,ss,jc,ru,ws;return S(this,function(la){switch(la.label){case 0:if(ro==null&&(ro=32),So==null&&(So=1),Xi==null&&(Xi=!0),Ga==null&&(Ga=0),Na=!1,Ta!=null&&Zi!=null&&(Na=!0),Ua!=null&&(Na=!0,Qa==null))throw new V("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");return(Hs=wi.checkNumSamples(_o,ro,Qa,"steps_per_epoch"))!=null&&(Za=Ar(0,Hs)),ja==null&&(ja=1),qo=nd(pa,ja,So,Ga,Hs,Qa,ro,Na,Ho),ss=qo.callbackList,jc=qo.history,ss.setModel(wi),wi.history=jc,[4,ss.onTrainBegin()];case 1:la.sent(),wi.stopTraining_=!1,ru=function(Al){var Xu,Mu,Ia,Fu,fa;return S(this,function(Cu){switch(Cu.label){case 0:return[4,ss.onE
3849pochBegin(Al)];case 1:if(Cu.sent(),Xu={},Qa==null)return[3,2];throw new N("stepsPerEpoch mode is not implemented yet.");case 2:if(Xi==="batch")throw new N("batch shuffling is not implemneted yet");Xi&&s.util.shuffle(Za),Mu=Object(s.tensor1d)(Za),Ia=uh(Hs,ro),Fu=function(iu){var Do;return S(this,function(Su){switch(Su.label){case 0:return Do={},[4,ss.onBatchBegin(iu,Do)];case 1:return Su.sent(),Object(s.tidy)(function(){var Ls=Ia[iu][0],Ju=Ia[iu][1],Xl=fi(Mu,Ls,Ju-Ls);Do.batch=iu,Do.size=Ju-Ls;for(var xa=Zc(_o,Xl),qs=Co(xa),_s=0;_s<ba.length;++_s){var Ol=ba[_s],Of=qs[_s];Do[Ol]=Of,Object(s.keep)(Of)}if(iu===Ia.length-1&&Na){var Oi=wi.testLoop(Ta,Zi,ro);for(_s=0;_s<ba.length;++_s)Ol=ba[_s],Of=Oi[_s],Object(s.keep)(Of),Xu["val_"+Ol]=Of}}),[4,ss.onBatchEnd(iu,Do)];case 2:return Su.sent(),Vl(Do),wi.stopTraining_?[2,"break"]:[2]}})},fa=0,Cu.label=3;case 3:return fa<Ia.length?[5,Fu(fa)]:[3,6];case 4:if(Cu.sent()==="break")return[3,6];Cu.label=5;case 5:return++fa,[3,3];case 6:Mu.dispose(),Cu.label=7;case 7:return[4,ss.onEpochEnd(Al,Xu)];case 8:return Cu.sent(),wi.stopTraining_?[2,"break"]:[2]}})},ws=Ga,la.label=2;case 2:return ws<So?[5,ru(ws)]:[3,5];case 3:if(la.sent()==="break")return[3,5];la.label=4;case 4:return++ws,[3,2];case 5:return[4,ss.onTrainEnd()];case 6:return la.sent(),[4,wi.history.syncData()];case 7:return la.sent(),[2,wi.history]}})})}(ae,Br,oi,ui,Tn,H.epochs,H.verbose,Di,ii,Vn,H.shuffle,Ci,H.initialEpoch,null,null)];case 6:return[2,si.sent()];case 7:return ae.isTraining=!1,ia(ue,ne),ia(Le,B),ia(qt,Qe),ia(en,wt),gt!=null&&Object(s.dispose)(gt),[7];case 8:return[2]}})})}function ra(ae){var ne=[];ae instanceof s.Tensor&&(ae=[ae]);for(var B=0;B<ae.length;++B){var H=ae[B];if(H.rank===1)ne.push(xr(H,1));else{if(H.rank===0)throw new Error("Expected tensor to be at least 1D, but received a 0D tensor (scalar).");ne.push(H)}}return ne}function ia(ae,ne){if(ae!=null){var B=[];if(ne instanceof s.Tensor)B.push(ne.id);else if(Array.isArray(ne))ne.forEach(function(qt){return B.push(qt.id)});else if(ne!=null)for(var H in ne){var ue=ne[H];B.push(ue.id)}var Le=[];if(ae instanceof s.Tensor)B.indexOf(ae.id)===-1&&Le.push(ae);else if(Array.isArray(ae))ae.forEach(function(qt){B.indexOf(qt.id)===-1&&Le.push(qt)});else if(ae!=null)for(var Qe in ae){var wt=ae[Qe];B.indexOf(wt.id)===-1&&Le.push(wt)}Le.forEach(function(qt){qt.isDisposed||qt.dispose()})}}function Aa(ae){return Array.isArray(ae)}function fs(ae){return!function(ne){return ne instanceof s.Tensor}(ae)&&!Aa(ae)}function Ic(ae,ne,B,H,ue){if(H===void 0&&(H=!0),ue===void 0&&(ue=""),ne==null||ne.length===0){if(ae!=null){var Le=!1;if(Aa(ae)&&ae.length>0)Le=!0;else if(fs(ae)){for(var Qe in ae)if(ae.hasOwnProperty(Qe)){Le=!0;break}}else Le=!0;if(Le)throw new V("Error when checking model "+ue+" expected no data, but got "+ae)}return[]}if(ae==null)return ne.map(function(lr){return null});var wt;if(fs(ae)){ae=ae,wt=[];for(var qt=0,en=ne;qt<en.length;qt++){var gt=en[qt];if(ae[gt]==null)throw new V('No data provided for "'+gt+'". Need data for each key in: '+ne);wt.push(ae[gt])}}else if(Aa(ae)){if((ae=ae).length!==ne.length)throw new V("Error when checking model "+ue+": the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see "+ne.length+" Tensor(s), but instead got the following list of Tensor(s): "+ae);wt=ae}else{if(ae=ae,ne.length>1)throw new V("The model "+ue+" expects "+ne.length+" Tensor(s), but only received one Tensor. Found: Tensor with shape "+ae.shape);wt=[ae]}if(wt=ra(wt),B!=null){for(var Tn=0;Tn<ne.length;++Tn)if(B[Tn]!=null){var Pn=wt[Tn];if(Pn.shape.length!==B[Tn].length)throw new V("Error when checking "+ue+": expected "+ne[Tn]+" to have "+B[Tn].length+" dimension(s). but got array with shape "+Pn.shape);for(var zn=0;zn<B[Tn].length;++zn)if(zn!==0||H){var Jn=Pn.shape[zn],Vn=B[Tn][zn];if(Vn!=null&&Vn>=0&&Jn!==Vn)throw new V("Error when checking "+ue+": expected "+ne[Tn]+" to have shape ["+B[Tn]+"], but got array with shape ["+Pn.shape+"].")}}}return wt}function ds(ae,ne,B,H,ue){var Le;if(H===void 0&&(H=!0),ue===void 0&&(ue=""),Array.isArray(ae)){if(ae.length!==ne.length)throw new V("Error when checking model "+ue+": the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see "+ne.length+" Tensor(s), but instead got "+ae.length+" Tensors(s).");Le=ae}else{if(ne.length>1)throw new V("The model expects "+ne.length+" "+ue+" Tensors, but only received one Tensor. Found: array with shape "+JSON.stringify(ae.shape)+".");Le=[ae]}if(B!=null){for(var Qe=0;Qe<ne.length;++Qe)if(B[Qe]!=null){var wt=Le[Qe];if(wt.shape.length!==B[Qe].length)throw new V("Error when checking "+ue+": expected "+ne[Qe]+" to have "+B[Qe].length+" dimension(s), but got array with shape "+JSON.stringify(wt.shape));for(var qt=0;qt<B[Qe].length;++qt)if(qt!==0||H){var en=wt.shape[qt],gt=B[Qe][qt];if(gt!=null&>!==en)throw new V("Error when checking "+ue+": expected "+ne[Qe]+" to have shape "+JSON.stringify(B[Qe])+" but got array with shape "+JSON.stringify(wt.shape)+".")}}}}var Hl=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.isTraining=!1,H}return v(ne,ae),ne.prototype.summary=function(B,H,ue){if(ue===void 0&&(ue=console.log),!this.built)throw new V("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");ah(this,B,H,ue)},ne.prototype.compile=function(B){var H=this;if(B.loss==null&&(B.loss=[]),this.loss=B.loss,typeof B.optimizer
3849=="string")this.optimizer_=function(lr){var dr={Adagrad:function(){return s.train.adagrad(.01)},Adadelta:function(){return s.train.adadelta(1,.95,M())},Adam:function(){return s.train.adam(.001,.9,.999,M())},Adamax:function(){return s.train.adamax(.002,.9,.999,M(),0)},RMSProp:function(){return s.train.rmsprop(.001,.9,0,M())},SGD:function(){return s.train.sgd(.01)}};if(dr.adagrad=dr.Adagrad,dr.adadelta=dr.Adadelta,dr.adam=dr.Adam,dr.adamax=dr.Adamax,dr.rmsprop=dr.RMSProp,dr.sgd=dr.SGD,lr in dr)return dr[lr]();throw new V("Unknown Optimizer "+lr)}(B.optimizer),this.isOptimizerOwned=!0;else{if(!(B.optimizer instanceof s.Optimizer))throw new V("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=B.optimizer,this.isOptimizerOwned=!1}var ue=[];if(Array.isArray(B.loss)||typeof B.loss=="string"||typeof B.loss=="function")if(Array.isArray(B.loss)){if(B.loss.length!==this.outputs.length)throw new V("When passing an Array as loss, it should have one entry per model output. The model has "+this.outputs.length+" output(s), but you passed loss="+B.loss+".");var Le=B.loss;ue=Le.map(function(lr){return gp(lr)})}else{var Qe=gp(B.loss);this.outputs.forEach(function(lr){ue.push(Qe)})}else{for(var wt in B.loss=B.loss,B.loss)if(this.outputNames.indexOf(wt)===-1)throw new V('Unknown entry in loss dictionary: "'+wt+'". Only expected the following keys: '+this.outputNames);for(var qt=0,en=this.outputNames;qt<en.length;qt++){var gt=en[qt];B.loss[gt]==null&&console.warn('Output "'+gt+'" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to '+gt+" during training"),ue.push(gp(B.loss[gt]))}}this.lossFunctions=ue,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(var Tn=0;Tn<this.outputs.length;++Tn){var Pn=this.internalOutputShapes[Tn],zn=this.outputNames[Tn];this.feedOutputNames.push(zn),this.feedOutputShapes.push(Pn),this.feedLossFns.push(this.lossFunctions[Tn])}var Jn=[];this.metrics=B.metrics,this.metricsNames=["loss"],this.metricsTensors=[],jn("loss",function(){for(var lr=0;lr<H.outputs.length;++lr)if(Jn.indexOf(lr)===-1){var dr=H.lossFunctions[lr];H.outputs.length>1&&(H.metricsTensors.push([dr,lr]),H.metricsNames.push(H.outputNames[lr]+"_loss"))}});var Vn=function(lr,dr){if(lr==null||Array.isArray(lr)&&lr.length===0)return dr.map(function(Ci){return[]});var Tr;if(typeof lr=="string"||typeof lr=="function")Tr=[lr];else{if(!Array.isArray(lr)&&typeof lr!="object")throw new TypeError("Type of metrics argument not understood. Expected an string,function, Array, or Object, found: "+lr);Tr=lr}if(Array.isArray(Tr))return dr.map(function(Ci){return Tr});for(var Hr=[],oi=0,Br=dr;oi<Br.length;oi++){var ui=Br[oi],ii=Tr.hasOwnProperty(ui)?Tr[ui]:[];Array.isArray(ii)||(ii=[ii]),Hr.push(ii)}return Hr}(B.metrics,this.outputNames);jn("metric",function(){for(var lr=function(Tr){if(Jn.indexOf(Tr)!==-1)return"continue";(function(Hr){for(var oi,Br,ui,ii=function(si){if(typeof si=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(si)!==-1){var wi=H.internalOutputShapes[Tr];wi[wi.length-1]===1||H.lossFunctions[Tr]===rd?["accuracy","acc"].indexOf(si)!==-1?Br=th:["crossentropy","ce"].indexOf(si)!==-1&&(Br=rh):H.lossFunctions[Tr]===xl?["accuracy","acc"].indexOf(si)!==-1?Br=ih:["crossentropy","ce"].indexOf(si)!==-1&&(Br=oh):["accuracy","acc"].indexOf(si)!==-1?Br=nh:["crossentropy","ce"].indexOf(si)!==-1&&(Br=vu);var Co=void 0;["accuracy","acc"].indexOf(si)!==-1?Co="acc":["crossentropy","ce"].indexOf(si)!==-1&&(Co="ce"),ui=Br,oi=""+Co}else{var _o=function(ro){if(typeof ro=="string"&&ro in gr)return gr[ro];if(typeof ro!="string"&&ro!=null)return ro;throw new V("Unknown metric "+ro)}(si);ui=_o,oi=""+Nc(si)}var ba;jn(oi,function(){ba=ui}),function(ro,So,ja){H.outputNames.length>1&&(So=H.outputNames[ro]+"_"+So),H.metricsNames.push(So),H.metricsTensors.push([ja,ro])}(Tr,oi,ba)},Ci=0,Di=Vn[Tr];Ci<Di.length;Ci++)ii(Di[Ci])})()},dr=0;dr<H.outputs.length;++dr)lr(dr)}),this.collectedTrainableWeights=this.trainableWeights},ne.prototype.checkTrainableWeightsConsistency=function(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did
3849you set `model.trainable` without calling `model.compile()` afterwards?")},ne.prototype.evaluate=function(B,H,ue){ue===void 0&&(ue={});var Le=ue.batchSize==null?32:ue.batchSize;wp(Le);var Qe=this.standardizeUserDataXY(B,H,!0,Le);try{var wt=Qe[0].concat(Qe[1]);this.makeTestFunction();var qt=this.testFunction;return ce(this.testLoop(qt,wt,Le,ue.verbose,ue.steps))}finally{ia(Qe[0],B),ia(Qe[1],H)}},ne.prototype.evaluateDataset=function(B,H){return A(this,void 0,void 0,function(){return S(this,function(ue){return this.makeTestFunction(),[2,function(Le,Qe,wt){return A(this,void 0,void 0,function(){var qt,en,gt,Tn,Pn,zn,Jn,Vn,lr,dr;return S(this,function(Tr){switch(Tr.label){case 0:if(qt=(wt=wt||{}).batches!=null,en=Le.testFunction,gt=[],wt.verbose>0)throw new N("Verbose mode is not implemented yet.");return s.util.assert(!qt||wt.batches>0&&Number.isInteger(wt.batches),function(){return"Test loop expects `batches` to be a positive integer, but received "+JSON.stringify(wt.batches)}),function(Hr){return typeof Hr.next=="function"}(Qe)?(Pn=Qe,[3,3]):[3,1];case 1:return[4,Qe.iterator()];case 2:Pn=Tr.sent(),Tr.label=3;case 3:Tn=Pn,zn=0,Jn=0,Vn=function(){var Hr;return S(this,function(oi){switch(oi.label){case 0:return[4,Tn.next()];case 1:return Hr=oi.sent(),gt=Object(s.tidy)(function(){if(Hr.value){var Br=I0(Le,Hr.value),ui=Br.xs,ii=Br.ys,Ci=ui.concat(ii),Di=Object(s.tidy)(function(){return en(Ci)});if(Object(s.dispose)(Ci),Jn===0)for(var si=0;si<Di.length;++si)gt.push(Object(s.scalar)(0));var wi=Ci[0].shape[0],Co=function(_o){var ba=Di[_o],ro=gt[_o];gt[_o]=Object(s.tidy)(function(){return Object(s.add)(gt[_o],Object(s.mul)(wi,ba))}),Jn>0&&Object(s.dispose)(ro)};for(si=0;si<Di.length;++si)Co(si);Object(s.dispose)(Di),zn+=wi,++Jn}return gt}),Hr.done?(qt&&console.warn("Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least `batches` batches (in this case, "+wt.batches+" batches). You may need to use the repeat() function when building your dataset."),[2,"break"]):[2]}})},Tr.label=4;case 4:return!qt||Jn<wt.batches?[5,Vn()]:[3,6];case 5:return Tr.sent()==="break"?[3,6]:[3,4];case 6:for(lr=0;lr<gt.length;++lr)dr=gt[lr],gt[lr]=Object(s.div)(gt[lr],zn),Object(s.dispose)(dr);return[2,ce(gt)]}})})}(this,B,H)]})})},ne.prototype.checkNumSamples=function(B,H,ue,Le){var Qe;if(Le===void 0&&(Le="steps"),ue!=null){if(Qe=null,H!=null)throw new V("If "+Le+" is set, batchSize must be null or undefined.Got batchSize = "+H)}else{if(B==null)throw new V("Either the input data should have a defined shape, or "+Le+" shoud be specified.");Qe=Array.isArray(B)?B[0].shape[0]:B.shape[0]}return Qe},ne.prototype.execute=function(B,H){if(Array.isArray(H)&&H.length===0)throw new V("`outputs` is an empty Array, which is not allowed.");var ue=Array.isArray(H),Le=ue?H:[H],Qe=this.retrieveSymbolicTensors(Le),wt=new ca;if(B instanceof s.Tensor&&(B=[B]),Array.isArray(B)){if(B.length!==this.inputs.length)throw new V("The number of inputs provided ("+B.length+") does not match the number of inputs of this model ("+this.inputs.length+").");for(var qt=0;qt<this.inputs.length;++qt)wt.add(this.inputs[qt],B[qt])}else for(var en=0,gt=this.inputs;en<gt.length;en++){var Tn=gt[en],Pn=B[Tn.name];if(Pn==null)throw new V("No value is provided for the model's input "+Tn.name);wt.add(Tn,Pn)}var zn=sh(Qe,wt);return ue?zn:zn[0]},ne.prototype.retrieveSymbolicTensors=function(B){for(var H=J(null,B.length),ue=B.length,Le=0,Qe=this.layers;Le<Qe.length;Le++){for(var wt=Qe[Le],qt=Array.isArray(wt.output)?wt.output:[wt.output],en=qt.map(function(zn){return zn.name}),gt=0;gt<B.length;++gt){var Tn=en.indexOf(B[gt]);if(Tn!==-1&&(H[gt]=qt[Tn],ue--),ue===0)break}if(ue===0)break}if(ue>0){var Pn=[];throw H.forEach(function(zn,Jn){zn==null&&Pn.push(B[Jn])}),new V("Cannot find SymbolicTensors for output name(s): "+JSON.stringify(Pn))}return H},ne.prototype.predictLoop=function(B,H,ue){var Le=this;return H===void 0&&(H=32),ue===void 0&&(ue=!1),Object(s.tidy)(function(){var Qe=Le.checkNumSamples(B);if(ue)throw new N("Verbose predictLoop() is not implemented yet.");for(var wt=uh(Qe,H),qt=Le.outputs.map(function(Tn){return[]}),en=function(Tn){Object(s.tidy)(function(){var Pn=wt[Tn][0],zn=wt[Tn][1],Jn=et(
3849B,Pn,zn),Vn=[];if(Array.isArray(Jn))for(var lr=0;lr<Jn.length;++lr)Vn.push({key:Le.inputs[lr],value:Jn[lr]});else Vn.push({key:Le.inputs[0],value:Jn});var dr=new ca(Vn);return sh(Le.outputs,dr)}).forEach(function(Pn,zn){return qt[zn].push(Pn)})},gt=0;gt<wt.length;++gt)en(gt);return ce(qt.map(function(Tn){return Object(s.concat)(Tn,0)}))})},ne.prototype.predict=function(B,H){H===void 0&&(H={});var ue=ra(B);ds(ue,this.inputNames,this.feedInputShapes,!1);try{var Le=H.batchSize==null?32:H.batchSize;return wp(Le),this.predictLoop(ue,Le)}finally{ia(ue,B)}},ne.prototype.predictOnBatch=function(B){ds(B,this.inputNames,this.feedInputShapes,!0);var H=(Array.isArray(B)?B[0]:B).shape[0];return this.predictLoop(B,H)},ne.prototype.standardizeUserDataXY=function(B,H,ue,Le){if(this.optimizer_==null)throw new L("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");for(var Qe=[],wt=0;wt<this.feedOutputShapes.length;++wt){var qt=this.feedOutputShapes[wt];this.feedLossFns[wt]===xl?Qe.push(qt.slice(0,qt.length-1).concat([1])):Qe.push(qt)}if(function(en,gt,Tn){var Pn=Ut(en.map(function(Jn){return Jn.shape[0]}));Pn.sort();var zn=Ut(gt.map(function(Jn){return Jn.shape[0]}));if(zn.sort(),Pn.length>1)throw new V("All input Tensors (x) should have the same number of samples. Got array shapes: "+JSON.stringify(en.map(function(Jn){return Jn.shape})));if(zn.length>1)throw new V("All target Tensors (y) should have the same number of samples. Got array shapes: "+JSON.stringify(gt.map(function(Jn){return Jn.shape})));if(Pn.length>0&&zn.length>0&&!s.util.arraysEqual(Pn,zn))throw new V("Input Tensors should have the same number of samples as target Tensors. Found "+Pn[0]+" input sample(s) and "+zn[0]+" target sample(s).")}(B=Ic(B,this.feedInputNames,this.feedInputShapes,!1,"input"),H=Ic(H,this.feedOutputNames,Qe,!1,"target")),function(en,gt,Tn){for(var Pn=[Ha,rd,ls],zn=0;zn<en.length;++zn){var Jn=en[zn],Vn=gt[zn],lr=Tn[zn];if(Vn!=null){if(Vn===ls&&Jn.shape[Jn.shape.length-1]===1)throw new V("You are passing a target array of shape "+Jn.shape+" while using a loss 'categorical_crossentropy'. 'categorical_crossentropy'expects targets to be binary matrices (1s and 0s) of shape [samples, classes].");if(Pn.indexOf(Vn)!==-1)for(var dr=Jn.shape.slice(1),Tr=lr.slice(1),Hr=0;Hr<dr.length;++Hr){var oi=dr[Hr],Br=Tr[Hr];if(Br!=null&&oi!==Br)throw new V("A target Tensor with shape "+Jn.shape+" was passed for an output of shape "+lr+", while using a loss function that expects targets to have the same shape as the output.")}}}}(H,this.feedLossFns,this.feedOutputShapes),this.stateful&&Le!=null&&Le>0&&B[0].shape[0]%Le!=0)throw new V("In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size "+Le+". Found: "+B[0].shape[0]+" sample(s).");return[B,H]},ne.prototype.standardizeUserData=function(B,H,ue,Le,Qe,wt){return Qe===void 0&&(Qe=!0),A(this,void 0,void 0,function(){var qt,en,gt,Tn,Pn,zn,Jn,Vn;return S(this,function(lr){switch(lr.label){case 0:if(qt=this.standardizeUserDataXY(B,H,Qe,wt),en=qt[0],gt=qt[1],ue!=null)throw new Error("sample weight is not supported yet.");if(Tn=null,Le==null)return[3,4];Pn=_l(Le,this.outputNames),Tn=[],zn=0,lr.label=1;case 1:return zn<Pn.length?(Vn=(Jn=Tn).push,[4,Nm(gt[zn],null,Pn[zn])]):[3,4];case 2:Vn.apply(Jn,[lr.sent()]),lr.label=3;case 3:return++zn,[3,1];case 4:return[2,[en,gt,Tn]]}})})},ne.prototype.testLoop=function(B,H,ue,Le,Qe){var wt=this;return Le===void 0&&(Le=0),Object(s.tidy)(function(){var qt=wt.checkNumSamples(H,ue,Qe,"steps"),en=[];if(Le>0)throw new N("Verbose mode is not implemented yet.");if(Qe!=null)throw new N("steps mode in testLoop() is not implemented yet");for(var gt=uh(qt,ue),Tn=Object(s.tensor1d)(Ar(0,qt)),Pn=0;Pn<gt.length;++Pn){var zn=gt[Pn][0],Jn=gt[Pn][1],Vn=fi(Tn,zn,Jn-zn),lr=Zc(H,Vn),dr=B(lr);if(Pn===0)for(var Tr=0;Tr<dr.length;++Tr)en.push(Object(s.scalar)(0));for(Tr=0;Tr<dr.length;++Tr){var Hr=dr[Tr];en[Tr]=Object(s.add)(en[Tr],Object(s.mul)(Jn-zn,Hr))}}for(Tr=0;Tr<en.length;++Tr)en[Tr]=Object(s.div)(en[Tr],qt);return en})},ne.prototype.getDedupedMetricsNames=function(){for(var B=this.metricsNames,H=[],ue=0;ue<B.length;
3849++ue){var Le=B[ue],Qe=Le;re(B,Le)>1&&(Qe+="_"+re(B.slice(0,ue),Le)),H.push(Qe)}return H},ne.prototype.makeTrainFunction=function(){var B=this;return function(H){var ue=[],Le=H.slice(0,B.inputs.length),Qe=H.slice(B.inputs.length,B.inputs.length+B.outputs.length),wt=H.slice(B.inputs.length+B.outputs.length,B.inputs.length+2*B.outputs.length),qt=[],en=B.collectedTrainableWeights.map(function(gt){return gt.read()});return[B.optimizer_.minimize(function(){for(var gt=[],Tn=0;Tn<B.inputs.length;++Tn)gt.push({key:B.inputs[Tn],value:Le[Tn]});var Pn,zn=new ca(gt),Jn=sh(B.outputs,zn,{training:!0});for(Tn=0;Tn<B.lossFunctions.length;++Tn){var Vn=(0,B.lossFunctions[Tn])(Qe[Tn],Jn[Tn]);wt[Tn]!=null&&(Vn=Pg(Vn,wt[Tn]));var lr=Object(s.mean)(Vn);ue.push(lr),Pn=Tn===0?Vn:Object(s.add)(Pn,Vn)}for(Tn=0;Tn<B.metricsTensors.length;++Tn){var dr=void 0;if(B.outputs.length>1&&Tn<B.outputs.length)dr=ue[Tn];else{var Tr=B.metricsTensors[Tn][0],Hr=B.metricsTensors[Tn][1];dr=Object(s.mean)(Tr(Qe[Hr],Jn[Hr]))}Object(s.keep)(dr),qt.push(dr)}return Pn=Object(s.mean)(Pn),B.calculateLosses().forEach(function(oi){Pn=Object(s.add)(Pn,oi)}),Pn},!0,en)].concat(qt)}},ne.prototype.makeTestFunction=function(){var B=this;this.testFunction=function(H){return Object(s.tidy)(function(){for(var ue,Le=[],Qe=H.slice(0,B.inputs.length),wt=H.slice(B.inputs.length,B.inputs.length+B.outputs.length),qt=[],en=0;en<B.inputs.length;++en)qt.push({key:B.inputs[en],value:Qe[en]});var gt=new ca(qt),Tn=sh(B.outputs,gt);for(en=0;en<B.lossFunctions.length;++en){var Pn=B.lossFunctions[en],zn=Object(s.mean)(Pn(wt[en],Tn[en]));ue=en===0?zn:Object(s.add)(ue,zn),Le.push(ue)}for(en=0;en<B.metricsTensors.length;++en){var Jn=B.metricsTensors[en][0],Vn=B.metricsTensors[en][1],lr=Object(s.mean)(Jn(wt[Vn],Tn[Vn]));Le.push(lr)}return Le})}},ne.prototype.fit=function(B,H,ue){return ue===void 0&&(ue={}),A(this,void 0,void 0,function(){return S(this,function(Le){return[2,Im(this,B,H,ue)]})})},ne.prototype.fitDataset=function(B,H){return A(this,void 0,void 0,function(){return S(this,function(ue){return[2,yf(this,B,H)]})})},ne.prototype.trainOnBatch=function(B,H){return A(this,void 0,void 0,function(){var ue,Le,Qe,wt,qt,en,gt,Tn,Pn;return S(this,function(zn){switch(zn.label){case 0:return[4,this.standardizeUserData(B,H)];case 1:ue=zn.sent(),Le=ue[0],Qe=ue[1],wt=this.makeTrainFunction(),qt=wt(Le.concat(Qe)),en=[],gt=0,Tn=qt,zn.label=2;case 2:return gt<Tn.length?[4,Tn[gt].data()]:[3,5];case 3:Pn=zn.sent(),en.push(Pn[0]),zn.label=4;case 4:return gt++,[3,2];case 5:return Object(s.dispose)(qt),[2,ce(en)]}})})},ne.prototype.getNamedWeights=function(B){for(var H=[],ue=B!=null&&B.trainableOnly,Le=ue?this.trainableWeights:this.weights,Qe=this.getWeights(ue),wt=0;wt<Le.length;++wt)ue&&!Le[wt].trainable||H.push({name:Le[wt].originalName,tensor:Qe[wt]});return H},Object.defineProperty(ne.prototype,"stopTraining",{get:function(){return this.stopTraining_},set:function(B){this.stopTraining_=B},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"optimizer",{get:function(){return this.optimizer_},set:function(B){this.optimizer_!==B&&(this.optimizer_=B,this.isOptimizerOwned=!1)},enumerable:!0,configurable:!0}),ne.prototype.dispose=function(){var B=ae.prototype.dispose.call(this);if(B.refCountAfterDispose===0&&this.optimizer!=null&&this.isOptimizerOwned){var H=Object(s.memory)().numTensors;this.optimizer_.dispose(),B.numDisposedVariables+=H-Object(s.memory)().numTensors}return B},ne.prototype.getLossIdentifiers=function(){var B;if(typeof this.loss=="string")B=ke(this.loss);else if(Array.isArray(this.loss)){for(var H=0,ue=this.loss;H<ue.length;H++)if(typeof ue[H]!="string")throw new Error("Serialization of non-string loss is not supported.");B=this.loss.map(function(gt){return ke(gt)})}else{var Le=Object.keys(this.loss);B={};for(var Qe=this.loss,wt=0,qt=Le;wt<qt.length;wt++){var en=qt[wt];if(typeof Qe[en]!="string")throw new Error("Serialization of non-string loss is not supported.");B[en]=ke(Qe[en])}}return B},ne.prototype.getMetricIdentifiers=function(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[ke(Nc(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(function(ue){return ke(Nc(ue))});var B={};for(var H in this.metrics)B[H]=ke(Nc(this.metrics[H]));return B},ne.prototype.getTrainingConfig=function(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}},ne.prototype.loadTrainingConfig=function(B){if(B.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(B.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(B.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");var H,ue,Le=ys(eo(B.optimizer_config));if(typeof B.loss=="string")H=Ce(B.loss);else if(Array.isArray(B.loss))H=B.loss.map(function(wt){return Ce(wt)});else if(B.loss!=null)for(var Qe in H={},B.loss)H[Qe]=Ce(B.loss[Qe]);if(Array.isArray(B.metrics))ue=B.metrics.map(function(wt){return Ce(wt)});else if(B.metrics!=null)for(var Qe in ue={},B.metrics)ue[Qe]=Ce(B.metrics[Qe]);this.compile({loss:H,metrics:ue,optimizer:Le})},ne.prototype.save=function(B,H){return A(this,void 0,void 0,function(){var ue,Le,Qe,wt,qt,en,gt,Tn,Pn,zn,Jn,Vn,lr,dr;return S(this,function(Tr){switch(Tr.label){case 0:if(typeof B=="str
3849ing"){if((ue=s.io.getSaveHandlers(B)).length===0)throw new V("Cannot find any save handlers for URL '"+B+"'");if(ue.length>1)throw new V("Found more than one ("+ue.length+") save handlers for URL '"+B+"'");B=ue[0]}if(B.save==null)throw new V("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return[4,s.io.encodeWeights(this.getNamedWeights(H))];case 1:return Le=Tr.sent(),Qe=!1,wt=null,qt=this.toJSON(wt,Qe),en={modelTopology:qt,format:"layers-model",generatedBy:"TensorFlow.js tfjs-layers v1.7.4",convertedBy:null},H!=null&&H.includeOptimizer&&this.optimizer!=null?(en.trainingConfig=this.getTrainingConfig(),gt="optimizer",Vn=(Jn=s.io).encodeWeights,[4,this.optimizer.getWeights()]):[3,4];case 2:return[4,Vn.apply(Jn,[Tr.sent(),gt])];case 3:Tn=Tr.sent(),Pn=Tn.data,zn=Tn.specs,(dr=Le.specs).push.apply(dr,zn),Le.data=s.io.concatenateArrayBuffers([Le.data,Pn]),Tr.label=4;case 4:return this.userDefinedMetadata!=null&&(lr=!0,Bg(this.userDefinedMetadata,this.name,lr),en.userDefinedMetadata=this.userDefinedMetadata),en.weightData=Le.data,en.weightSpecs=Le.specs,[2,B.save(en)]}})})},ne.prototype.setUserDefinedMetadata=function(B){Bg(B,this.name),this.userDefinedMetadata=B},ne.prototype.getUserDefinedMetadata=function(){return this.userDefinedMetadata},ne.className="Model",ne}(function(ae){function ne(B){var H=ae.call(this,{})||this;if(H.containerNodes=new Set,H.name=B.name,H.name==null){var ue=H.getClassName().toLowerCase();H.name=ko(ue)}if(H.supportsMasking=!1,H.trainable_=!0,Array.isArray(B.inputs)?H.inputs=B.inputs.slice():H.inputs=[B.inputs],Array.isArray(B.outputs)?H.outputs=B.outputs.slice():H.outputs=[B.outputs],Ut(H.inputs).length!==H.inputs.length)throw new V("The list of inputs passed to the model is redundant. All inputs should only appear once. Found: "+H.inputs.map(function(Do){return Do.name}));Ut(H.outputs).length!==H.outputs.length&&console.warn("The list of outputs passed to the model is redundant. All outputs should only appear once. Found: "+H.outputs.map(function(Do){return Do.name})),H.inputLayers=[],H.inputLayersNodeIndices=[],H.inputLayersTensorIndices=[],H.outputLayers=[],H.outputLayersNodeIndices=[],H.outputLayersTensorIndices=[],H.layers=[],H.internalContainerRefs=[];for(var Le=0,Qe=H.outputs;Le<Qe.length;Le++){var wt=(si=Qe[Le]).sourceLayer,qt=si.nodeIndex,en=si.tensorIndex;H.outputLayers.push(wt),H.outputLayersNodeIndices.push(qt),H.outputLayersTensorIndices.push(en)}for(var gt=0,Tn=H.inputs;gt<Tn.length;gt++)wt=(si=Tn[gt]).sourceLayer,qt=si.nodeIndex,en=si.tensorIndex,K(qt===0,"input layer has >1 nodes"),K(en===0,"input layer has >1 tensors"),H.inputLayers.push(wt),H.inputLayersNodeIndices.push(qt),H.inputLayersTensorIndices.push(en);H.inputNames=[],H.outputNames=[],H.feedInputShapes=[],H.feedInputNames=[],H.feedOutputNames=[];for(var Pn=0;Pn<H.inputLayers.length;Pn++){if(!((wt=H.inputLayers[Pn])instanceof Tc))throw new TypeError("Input layers to a LayersModel must be InputLayer objects. Received inputs: "+B.inputs+". Input "+Pn+" (0-based) originates from layer type "+wt.getClassName()+".");H.inputNames.push(wt.name),H.feedInputShapes.push(wt.batchInputShape),H.feedInputNames.push(wt.name)}for(var zn=0,Jn=H.outputLayers;zn<Jn.length;zn++)wt=Jn[zn],H.outputNames.push(wt.name);H.internalInputShapes=H.inputs.map(function(Do){return Do.shape}),H.internalOutputShapes=H.outputs.map(function(Do){return Do.shape});for(var Vn={},lr={},dr={},Tr={},Hr={},oi=[],Br=function(Do,Su,Ls,Ju,Xl,xa){Ju!=null&&Xl!=null&&xa!=null||(Ju=Do.sourceLayer,Xl=Do.nodeIndex,xa=Do.tensorIndex);var qs=Ju.inboundNodes[Xl];if(Ls.indexOf(qs)!==-1)throw new L("The tensor "+Do.name+' at layer "'+Ju.name+'" is part of a cycle.');if(Su.indexOf(qs)===-1){H.containerNodes.add(ne.nodeKey(Ju,Xl)),Ju.id in Hr||(Hr[Ju.id]=Object.keys(Hr).length),Ls.indexOf(qs)===-1&&Ls.push(qs);for(var _s=qs.inboundLayers.length,Ol=0;Ol<_s;Ol++){var Of=qs.inputTensors[Ol],Oi=qs.inboundLayers[Ol],qm=qs.nodeIndices[Ol],Df=qs.tensorIndices[Ol];Br(Of,Su,Ls,Oi,qm,Df)}for(Su.push(qs);Ls.indexOf(qs)>=0;)Ls.splice(Ls.indexOf(qs),1);oi.push(qs)}},ui=[],ii=[],Ci=0,Di=H.outputs;Ci<Di.length;Ci++){var si=Di[Ci];Br(si,ui,ii)}for(var wi=0,Co=oi.slice().reverse();wi<Co.length;wi++){lr[(la=Co[wi]).id]=la,la.id in Vn||(Vn[la.id]=0);var _o=Vn[la.id],ba=dr[la.outboundLayer.id]==null?0:dr[la.outboundLayer.id];for(_o=Math.max(_o,ba),dr[la.outboundLayer.id]=_o,Tr[la.outboundLayer.id]=la.outboundLayer,Vn[la.id]=_o,Pn=0;Pn<la.inboundLayers.length;Pn++){var ro=la.inboundLayers[Pn],So=(qt=la.nodeIndices[Pn],ro.inboundNodes[qt]),ja=Vn[So.id]==null?0:Vn[So.id];Vn[So.id]=Math.max(_o+1,ja),lr[So.id]=So}}var pa={};for(var Ta in Vn)(_o=Vn[Ta])in pa||(pa[_o]=[]),pa[_o].push(lr[Ta]);var Zi={};for(var Xi in dr)(_o=dr[Xi])in Zi||(Zi[_o]=[]),Zi[_o].push(Tr[Xi]);var Ho=Object.keys(Zi).map(function(Do){return parseInt(Do,10)}).sort(Dt);H.layers=[];for(var Ga=0,Qa=Ho;Ga<Qa.length;Ga++){var Ua=Zi[_o=Qa[Ga]];Ua.sort(function(Do,Su){var Ls=Hr[Do.id],Ju=Hr[Su.id];return Ls<Ju?-1:Ls>Ju?1:0});for(var Na=0,Hs=Ua;Na<Hs.length;Na++)(wt=Hs[Na])instanceof ne&&H.internalContainerRefs.push(wt),H.layers.push(wt)}H.layersByDepth=Zi,Ho=Object.keys(pa).map(function(Do){return parseInt(Do,10)}).sort(Dt);for(var Za=H.inputs.slice(),qo=[],ss=0,jc=Ho;ss<jc.length;ss++)for(var ru=0,ws=pa[_o=jc[ss]];ru<ws.length;ru++){var la;if((wt=(la=ws[ru]).outboundLayer)!=null){for(var Al=0,Xu=la.inputTensors;Al<Xu.length;Al++)if(si=Xu[Al],Za.indexOf(si)===-1)throw new L("Graph disconnected: cannot obtain value for tensor "+si+' at layer "'+wt.name+'". The following previous layers were accessed without issue: '+qo);for(var Mu=0,Ia=la.outputTensors;Mu<Ia.length;Mu++)si=Ia[Mu],Za.push(si);qo.push(wt.name)}}H.nodesByDepth=pa;for(var Fu=H.layers.map(function(Do){return Do.name}),fa=function(Do){var Su=Fu.filter(function(Ls){return Ls===Do}).length;if(Su!==1)throw new L('The name "'+Do+'" is used '+Su+" times in the model. All layer names should be unique. Layer names: "+JSON.stringify(Fu))},Cu=0,iu=Fu;Cu<iu.length;Cu++)fa(iu[Cu]);return H.outboundNodes=[],H.inboundNodes=[],new gu({outboundLayer:H,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:H.inputs,outputTensors:H.outputs,inputMasks:H.inputs.map(function(Do){return null}),outputMasks:H.outputs.map(function(Do){return null}),inputShapes:H.inputs.map(function(Do){return Do.shape}),outputShapes:H.outputs.map(function(Do){return Do.shape})}),H.built=!0,H._refCount=1,H}return v(ne,ae),ne.prototype.assertNotDisposed=function(){if(this._refCount===0)throw new Error("Container '"+this.name+"' is already disposed.")},ne.prototype.dispose=function(){this.assertNotDisposed();var B={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount==0){for(var H=0,ue=this.layers;H<ue.length;H++){var Le=ue[H];B.numDisposedVariables+=Le.dispose().numDisposedVariables}for(var Qe=0,wt=this.internalContainerRefs;Qe<wt.length;Qe++){var qt=wt[Qe];B.numDisposedVariables+=qt.dispose().numDisposedVariables}}return B.refCountAfterDispose=this._refCount,B},Object.defineProperty(ne.prototype,"trainable",{get:function(){return this.trainable_}
3849,set:function(B){this.layers.forEach(function(H){H._trainableWeights.forEach(function(ue){return ue.trainable=B})}),this.trainable_=B},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"trainableWeights",{get:function(){if(this._trainableWeights.length>0)throw new V("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];for(var B=[],H=0,ue=this.layers;H<ue.length;H++){var Le=ue[H];B=B.concat(Le.trainableWeights)}return B},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"nonTrainableWeights",{get:function(){for(var B=[],H=0,ue=this.layers;H<ue.length;H++){var Le=ue[H];B.push.apply(B,Le.nonTrainableWeights)}if(!this.trainable){for(var Qe=[],wt=0,qt=this.layers;wt<qt.length;wt++)Le=qt[wt],Qe.push.apply(Qe,Le.trainableWeights);return Qe.concat(B)}return B},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),ne.prototype.loadWeights=function(B,H){H===void 0&&(H=!0);for(var ue={},Le=0,Qe=0,wt=this.layers;Qe<wt.length;Qe++)for(var qt=0,en=wt[Qe].weights;qt<en.length;qt++){var gt=en[qt];if(ue[gt.originalName]!=null)throw new V("Duplicate weight name: "+gt.originalName);ue[gt.originalName]=gt,Le++}var Tn=[];for(var Pn in B){if(ue[Pn]!=null)Tn.push([ue[Pn],B[Pn]]);else if(H)throw new V("Provided weight data has no target variable: "+Pn);delete ue[Pn]}if(H){var zn=[];for(var Jn in ue)zn.push(Jn);if(zn.length>0)throw new V(zn.length+" of "+Le+" weights are not set: "+zn)}Ko(Tn)},ne.prototype.updatedConfig=function(){var B=this.getConfig(),H={};return H.className=this.getClassName(),H.config=B,H.kerasVersion="tfjs-layers 1.7.4",H.backend="TensorFlow.js",H},ne.prototype.toJSON=function(B,H){H===void 0&&(H=!0);var ue=function Le(Qe,wt){if(Qe==null)return null;if(typeof Qe=="string")return ke(Qe);if(typeof Qe=="number"||typeof Qe=="boolean")return Qe;if(Qe instanceof Array){for(var qt=[],en=Qe.length,gt=0;gt<en;++gt){var Tn=Qe[gt];bp(wt,gt,Tn)?qt.push(Tn):qt.push(Le(Tn,wt))}return qt}for(var Pn={},zn=0,Jn=Object.keys(Qe);zn<Jn.length;zn++){var Vn=Jn[zn],lr=Qe[Vn];Pn[ke(Vn)]=Vn!=="name"&&Vn!=="className"||typeof lr!="string"?Le(lr,Vn):lr}return Pn}(this.updatedConfig());return H?JSON.stringify(ue):ue},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){B=pe(B);for(var Le=new ca,Qe=0;Qe<ue.inputs.length;++Qe)Le.add(ue.inputs[Qe],B[Qe]);return sh(ue.outputs,Le,H)})},ne.prototype.computeMask=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le;return B=pe(B),Le=H==null?J(null,B.length):pe(H),ue.runInternalGraph(B,Le)[1]})},ne.prototype.computeOutputShape=function(B){var H=ai(B);if(H.length!==this.inputLayers.length)throw new V("Invalid inputShape argument "+B+": model has "+this.inputLayers.length+" tensor inputs.");for(var ue={},Le=0;Le<H.length;Le++){var Qe=this.inputLayers[Le],wt=H[Le];ue[Di=Qe.name+"_0_0"]=wt}var qt=Object.keys(this.nodesByDepth).map(function(wi){return parseInt(wi,10)}).sort(Dt);if(qt.length>1)for(var en=0,gt=qt;en<gt.length;en++)for(var Tn=gt[en],Pn=0,zn=this.nodesByDepth[Tn];Pn<zn.length;Pn++){var Jn=zn[Pn];if(Qe=Jn.outboundLayer,this.inputLayers.map(function(wi){return wi.id}).indexOf(Qe.id)===-1){for(var Vn=[],lr=0;lr<Jn.inboundLayers.length;lr++){var dr=Jn.inboundLayers[lr],Tr=Jn.nodeIndices[lr],Hr=Jn.tensorIndices[lr],oi=ue[Di=dr.name+"_"+Tr+"_"+Hr];Vn.push(oi)}var Br=ai(Qe.computeOutputShape(ce(Vn))),ui=Qe.inboundNodes.indexOf(Jn);for(lr=0;lr<Br.length;lr++)ue[Di=Qe.name+"_"+ui+"_"+lr]=Br[lr]}}var ii=[],Ci=[];for(Le=0;Le<this.outputLayers.length;Le++){Qe=this.outputLayers[Le],ui=this.outputLayersNodeIndices[Le],Hr=this.outputLayersTensorIndices[Le];var Di=Qe.name+"_"+ui+"_"+Hr;Ci.push(Di)}for(Le=0;Le<Ci.length;Le++){var si=Ci[Le];K(si in ue),ii.push(ue[si])}return ce(ii)},ne.prototype.runInternalGraph=function(B,H){H==null&&(H=J(null,B.length));for(var ue={},Le=0;Le<this.inputs.length;++Le){var Qe=this.inputs[Le],wt=B[Le],qt=H[Le];ue[Qe.id]=[wt,qt]}for(var en=0,gt=Object.keys(this.nodesByDepth).map(function(Zi){return parseInt(Zi,10)}).sort(Dt);en<gt.length;en++)for(var Tn=gt[en],Pn=0,zn=this.nodesByDepth[Tn];Pn<zn.length;Pn++){for(var Jn=zn[Pn],Vn=Jn.outboundLayer,lr=Jn.inputTensors,dr=Jn.outputTensors,Tr=new Array,Hr=0,oi=lr;Hr<oi.length;Hr++)(Qe=oi[Hr]).id in ue&&Tr.push(ue[Qe.id]);if(Tr.length===lr.length){var Br={},ui=void 0,ii=void 0,Ci=void 0,Di=void 0;if(Jn.callArgs!=null&&(Br=Jn.callArgs),Tr.length===1){var si=Tr[0],wi=si[0],Co=si[1];Br.mask==null&&(Br.mask=Co),Ci=pe(Vn.call(wi,Br)),Di=pe(Vn.computeMask(wi,Co)),ui=[wi],ii=[Co]}else ui=Tr.map(function(Zi){return Zi[0]}),ii=Tr.map(function(Zi){return Zi[1]}),Br.mask==null&&(Br.mask=ii),Ci=pe(Vn.call(ui,Br)),Di=pe(Vn.computeMask(ui,ii));if(Vn.activityRegularizer)throw new N("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(Le=0;Le<dr.length;++Le)Qe=dr[Le],wt=Ci[Le],qt=Di[Le],ue[Qe.id]=[wt,qt]}}for(var _o=[],ba=[],ro=[],So=0,ja=this.outputs;So<ja.length;So++){K((Qe=ja[So]).id in ue,"Could not compute output "+Qe.name+" : "+Qe.id);
3849var pa=ue[Qe.id],Ta=pa[0];qt=pa[1],ro.push(Ta.shape),_o.push(Ta),ba.push(qt)}return[_o,ba,ro]},ne.prototype.buildNodeConversionMap=function(B){for(var H,ue={},Le=0,Qe=this.layers;Le<Qe.length;Le++){var wt=Qe[Le];H=wt instanceof ne?1:0;for(var qt=0;qt<wt.inboundNodes.length;qt++){var en=ne.nodeKey(wt,qt);this.containerNodes.has(en)&&(ue[en]=H,H+=1)}}return ue},ne.prototype.getLayer=function(B,H){if(H!=null){if(this.layers.length<=H)throw new V("Was asked to retrieve layer at index "+H+", but model only has "+this.layers.length+" layer(s).");return this.layers[H]}if(B==null)throw new V("Provide either a layer name or layer index");for(var ue=0,Le=this.layers;ue<Le.length;ue++){var Qe=Le[ue];if(Qe.name===B)return Qe}throw new V("No such layer: "+B)},ne.prototype.calculateLosses=function(){var B=this;return Object(s.tidy)(function(){for(var H=[],ue=0,Le=B.layers;ue<Le.length;ue++)for(var Qe=Le[ue],wt=0;wt<Qe.inboundNodes.length;++wt){var qt=ne.nodeKey(Qe,wt);B.containerNodes.has(qt)&&H.push.apply(H,Qe.calculateLosses())}return H})},ne.prototype.getConfig=function(){for(var B={name:this.name},H=this.buildNodeConversionMap(this.layers),ue=[],Le=0,Qe=this.layers;Le<Qe.length;Le++){for(var wt=(Br=Qe[Le]).getClassName(),qt=Br.getConfig(),en=[],gt=0;gt<Br.inboundNodes.length;gt++){var Tn=Br.inboundNodes[gt],Pn=ne.nodeKey(Br,gt),zn={};if(this.containerNodes.has(Pn)){if(Tn.callArgs)try{JSON.stringify(Tn.callArgs),zn=Tn.callArgs}catch{console.warn("Layer "+Br.name+" was passed non-serializable keyword arguments: "+Tn.callArgs+". They will not be included in the serialized model (and thus will be missing at deserialization time)."),zn={}}if(Tn.inboundLayers.length>0){for(var Jn=[],Vn=0;Vn<Tn.inboundLayers.length;Vn++){var lr=Tn.inboundLayers[Vn],dr=Tn.nodeIndices[Vn],Tr=Tn.tensorIndices[Vn];(ii=H[ne.nodeKey(lr,dr)])==null&&(ii=0),Jn.push([lr.name,ii,Tr,zn])}en.push(Jn)}}}var Hr={};Hr.name=Br.name,Hr.className=wt,Hr.config=qt,Hr.inboundNodes=en,ue.push(Hr)}B.layers=ue;var oi=[];for(Vn=0;Vn<this.inputLayers.length;Vn++){var Br=this.inputLayers[Vn];dr=this.inputLayersNodeIndices[Vn],Pn=ne.nodeKey(Br,dr),this.containerNodes.has(Pn)&&((ii=H[Pn])!==null&&ii!==void 0||(ii=0),Tr=this.inputLayersTensorIndices[Vn],oi.push([Br.name,ii,Tr]))}B.inputLayers=oi;var ui=[];for(Vn=0;Vn<this.outputLayers.length;Vn++){var ii;Br=this.outputLayers[Vn],dr=this.outputLayersNodeIndices[Vn],Pn=ne.nodeKey(Br,dr),this.containerNodes.has(Pn)&&((ii=H[Pn])!==null&&ii!==void 0||(ii=0),Tr=this.outputLayersTensorIndices[Vn],ui.push([Br.name,ii,Tr]))}return B.outputLayers=ui,B},ne.fromConfig=function(B,H,ue,Le){Le===void 0&&(Le=!1);var Qe={},wt={};function qt(So,ja){So.name in wt?wt[So.name].push(ja):wt[So.name]=[ja]}function en(So,ja){for(var pa,Ta=[],Zi=0,Xi=ja;Zi<Xi.length;Zi++){var Ho=Xi[Zi],Ga=Ho[0],Qa=Ho[1],Ua=Ho[2];if(pa=Ho[3]==null?{}:Ho[3],!(Ga in Qe))return void qt(So,ja);var Na=Qe[Ga];if(Na.inboundNodes.length<=Qa)return void qt(So,ja);var Hs=Na.inboundNodes[Qa];Ta.push(Hs.outputTensors[Ua])}Ta.length>0&&So.apply(ce(Ta),pa)}function gt(So){var ja=So.name,pa=ys(So,H.customObjects!=null?H.customObjects:{});pa.setFastWeightInitDuringBuild(Le),Qe[ja]=pa,So.inboundNodes.forEach(function(Ta){if(!(Ta instanceof Array))throw new V("Corrupted configuration, expected array for nodeData: "+Ta);qt(pa,Ta)})}for(var Tn=H.name,Pn=H.layers,zn=0,Jn=Pn;zn<Jn.length;zn++)gt(dr=Jn[zn]);for(;!Ee(wt);)for(var Vn=0,lr=Pn;Vn<lr.length;Vn++){var dr=lr[Vn];if((ro=Qe[dr.name]).name in wt){var Tr=wt[ro.name];delete wt[ro.name];for(var Hr=0,oi=Tr;Hr<oi.length;Hr++)en(ro,oi[Hr])}}for(var Br=[],ui=[],ii=0,Ci=H.inputLayers;ii<Ci.length;ii++){var Di=(dr=Ci[ii])[0],si=dr[1],wi=dr[2];K(Di in Qe);var Co=(ro=Qe[Di]).inboundNodes[si].outputTensors;Br.push(Co[wi])}for(var _o=0,ba=H.outputLayers;_o<ba.length;_o++){var ro;Di=(dr=ba[_o])[0],si=dr[1],wi=dr[2],K(Di in Qe),Co=(ro=Qe[Di]).inboundNodes[si].outputTensors,ui.push(Co[wi])}return new B({inputs:Br,outputs:ui,name:Tn})},Object.defineProperty(ne.prototype,"stateful",{get:function(){if(this._stateful)throw new V("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(var B=0,H=this.layers;B<H.length;B++)if(H[B].stateful)return!0;return!1},enumerable:!0,configurable:!0}),ne.prototype.resetStates=function(){var B=this;
3849Object(s.tidy)(function(){B.layers.forEach(function(H){H.stateful&&H.resetStates()})})},ne}(fo));function sc(ae,ne){return A(this,void 0,void 0,function(){var B;return S(this,function(H){if(ne==null&&(ne={}),typeof ae=="string"){if((B=s.io.getLoadHandlers(ae,ne.onProgress)).length===0)B.push(s.io.browserHTTPRequest(ae,ne));else if(B.length>1)throw new V("Found more than one ("+B.length+") load handlers for URL '"+ae+"'");ae=B[0]}return[2,function(ue,Le,Qe){return A(this,void 0,void 0,function(){var wt,qt,en,gt,Tn,Pn,zn,Jn,Vn;return S(this,function(lr){switch(lr.label){case 0:if(Qe==null&&(Qe={}),ue.load==null)throw new V("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,ue.load()];case 1:if(wt=lr.sent(),(qt=wt.modelTopology).model_config!=null&&(qt=qt.model_config),en=Qe.strict==null||Qe.strict,gt=wt.weightData!=null&&wt.weightSpecs!=null&&en,Tn=ys(eo(qt),Le,gt),(Pn=wt.trainingConfig)!=null&&Tn.loadTrainingConfig(Pn),wt.userDefinedMetadata!=null&&Tn.setUserDefinedMetadata(wt.userDefinedMetadata),wt.weightData==null)return[3,4];if(wt.weightSpecs==null)throw new V("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");return zn=function(dr,Tr){var Hr=s.io.decodeWeights(dr,Tr),oi={},Br=[];return Tr.forEach(function(ui){ui.group==="optimizer"?Br.push({name:ui.name,tensor:Hr[ui.name]}):oi[ui.name]=Hr[ui.name]}),{modelWeights:oi,optimizerWeights:Br}}(wt.weightData,wt.weightSpecs),Jn=zn.modelWeights,Vn=zn.optimizerWeights,Tn.loadWeights(Jn,en),Tn.optimizer!=null&&Vn.length>0?[4,Tn.optimizer.setWeights(Vn)]:[3,3];case 2:lr.sent(),lr.label=3;case 3:Object(s.dispose)(Jn),Object(s.dispose)(Vn.map(function(dr){return dr.tensor})),lr.label=4;case 4:return[2,Tn]}})})}(ae,void 0,ne)]})})}s.serialization.registerClass(Hl);var Bt=function(ae){function ne(B){var H=ae.call(this,{inputs:[],outputs:[]})||this;if(B=B||{},H.trainable=!0,H.built=!1,H.name=B.name!=null?B.name:ko("sequential_"),B.layers!=null)for(var ue=0,Le=B.layers;ue<Le.length;ue++){var Qe=Le[ue];H.add(Qe)}return H}return v(ne,ae),ne.prototype.checkShape=function(B){if(B.inboundNodes[0].outputTensors[0].shape.some(function(H){return H<0}))throw new V("Negative dimension size caused by adding layer "+B.name+" with input shape ["+B.inboundNodes[0].inputTensors[0].shape+"]")},ne.prototype.add=function(B){var H,ue=B instanceof ne||B instanceof Hl;if(ue){if((H=B).outputs.length!==1)throw new V("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(H.inputs.length!==1)throw new V("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(this.outputs.length===0){if(B.inboundNodes.length===0){if(B.batchInputShape==null)throw new V("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");var Le=Wl({batchShape:B.batchInputShape,dtype:B.dtype,name:B.name+"_input"});B.apply(Le)}if(ue)this.outputs=H.outputs,this.inputs=H.inputs;else{if(B.inboundNodes.length!==1)throw new V("A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer "+B.name+" which has "+B.inboundNodes.length+" pre-existing inbound connections.");if(B.inboundNodes[0].outputTensors.length!==1)throw new V("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(B),this.outputs=[B.inboundNodes[0].outputTensors[0]],this.inputs=function wt(qt,en,gt){if((en==null||gt!=null&>>0)&&(en=qt.sourceLayer,gt=qt.nodeIndex),en.inboundNodes.length===0)return[qt];var Tn=en.inboundNodes[gt];if(Tn.inboundLayers.length===0)return Tn.inputTensors;for(var Pn=[],zn=0;zn<Tn.inboundLayers.length;zn++)for(var Jn=0,Vn=wt(Tn.inputTensors[zn],Tn.inboundLayers[zn],Tn.nodeIndices[zn]);Jn<Vn.length;Jn++){var lr=Vn[Jn];Pn.indexOf(lr)===-1&&Pn.push(lr)}return Pn}(this.outputs[0])}this.inboundNodes=[],new gu({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:J(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(function(wt){return wt.shape}),outputShapes:this.outputs[0].shape})}else{var Qe=B.apply(this.outputs[0]);if(Array.isArray(Qe))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(B),this.outputs=[Qe],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(B),this.built=!1},ne.prototype.pop=function(){if(this.layers.length===0)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),this.layers.length===0)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{var B=this.layers.length-1;this.layers[B].outboundNodes=[],this.outputs=[this.layers[B].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}},ne.prototype.call=function(B,H){return this.model==null&&this.build(),this.model.call(B,H)},ne.prototype.build=function(B){if(Hn(B),this.inputs.length===0||this.outputs.length===0)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new Hl({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supp
3849ortsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0},ne.prototype.countParams=function(){return this.built||this.build(),ae.prototype.countParams.call(this)},ne.prototype.summary=function(B,H,ue){ue===void 0&&(ue=console.log),this.built||this.build(),ae.prototype.summary.call(this,B,H,ue)},ne.prototype.setWeights=function(B){this.model==null&&this.build(),this.model.setWeights(B)},ne.prototype.evaluate=function(B,H,ue){if(ue===void 0&&(ue={}),!this.built)throw new L("The model needs to be compiled before being used.");return this.model.evaluate(B,H,ue)},ne.prototype.evaluateDataset=function(B,H){return A(this,void 0,void 0,function(){return S(this,function(ue){if(!this.built)throw new L("The model needs to be compiled before being used.");return[2,this.model.evaluateDataset(B,H)]})})},ne.prototype.predict=function(B,H){return H===void 0&&(H={}),this.model==null&&this.build(),this.model.predict(B,H)},ne.prototype.predictOnBatch=function(B){return this.model==null&&this.build(),this.model.predictOnBatch(B)},ne.prototype.compile=function(B){this.build(),this.model.compile(B),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames},Object.defineProperty(ne.prototype,"optimizer",{get:function(){return this.model==null?void 0:this.model.optimizer},set:function(B){this.model.optimizer=B},enumerable:!0,configurable:!0}),ne.prototype.fit=function(B,H,ue){return ue===void 0&&(ue={}),A(this,void 0,void 0,function(){return S(this,function(Le){if(!this.built)throw new L("The model needs to be compiled before being used.");return[2,this.model.fit(B,H,ue)]})})},ne.prototype.fitDataset=function(B,H){return A(this,void 0,void 0,function(){return S(this,function(ue){if(!this.built)throw new L("The model needs to be compiled before being used.");return[2,this.model.fitDataset(B,H)]})})},ne.prototype.trainOnBatch=function(B,H){return A(this,void 0,void 0,function(){return S(this,function(ue){return[2,this.model.trainOnBatch(B,H)]})})},ne.fromConfig=function(B,H,ue,Le){var Qe;Le===void 0&&(Le=!1);var wt={};if(H instanceof Array){if(H[0].className==null||H[0].className==="Merge")throw new V("Legacy serialization format not supported yet.");Qe=H}else s.util.assert(H.layers!=null,function(){return"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."}),Qe=H.layers,delete H.layers,wt=H;var qt=new B(wt);if(!(qt instanceof ne))throw new N("Sequential.fromConfig called on non-Sequential input: "+qt);for(var en=0,gt=Qe;en<gt.length;en++){var Tn=ys(gt[en],void 0,Le);Le&&Tn.setFastWeightInitDuringBuild(!0),qt.add(Tn)}return qt},Object.defineProperty(ne.prototype,"stopTraining",{get:function(){if(this.model==null)throw new V("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining},set:function(B){if(this.model==null)throw new V("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=B},enumerable:!0,configurable:!0}),ne.prototype.getConfig=function(){for(var B=[],H=0,ue=this.layers;H<ue.length;H++){var Le=ue[H],Qe={};Qe.className=Le.getClassName(),Qe.config=Le.getConfig(),B.push(Qe)}return{name:this.name,layers:B}},ne.className="Sequential",ne}(Hl);function zo(ae){return new Hl(ae)}function qa(ae){return new Bt(ae)}function Os(ae,ne){return ne==null&&(ne={}),sc(ae,ne)}function Qo(ae){return Wl(ae)}function bu(ae,ne){$l.registerCallbackConstructor(ae,ne)}
3849s.serialization.registerClass(Bt);var Or=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.getConfig=function(){return{}},ne}(s.serialization.Serializable),Vu=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B,H){return H===void 0&&(H=1),function(ue,Le){if(Le===void 0&&(Le=1),Le!==1)throw new N("Support for alpha values other than 1 ("+Le+") is not implemented yet.");return Object(s.elu)(ue)}(B,H)},ne.className="elu",ne}(Or);s.serialization.registerClass(Vu);var uc=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return Object(s.selu)(B)},ne.className="selu",ne}(Or);s.serialization.registerClass(uc);var bf=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return Object(s.relu)(B)},ne.className="relu",ne}(Or);s.serialization.registerClass(bf);var $u=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return Object(s.tidy)(function(){return Object(s.minimum)(6,Object(s.relu)(B))})},ne.className="relu6",ne}(Or);s.serialization.registerClass($u);var _p=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return B},ne.className="linear",ne}(Or);s.serialization.registerClass(_p);var Mm=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return Object(s.sigmoid)(B)},ne.className="sigmoid",ne}(Or);s.serialization.registerClass(Mm);var Fm=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return function(H){return Object(s.tidy)(function(){var ue=Object(s.add)(.5,Object(s.mul)(.2,H));return Object(s.clipByValue)(ue,0,1)})}(B)},ne.className="hardSigmoid",ne}(Or);s.serialization.registerClass(Fm);var yc=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return Object(s.softplus)(B)},ne.className="softplus",ne}(Or);s.serialization.registerClass(yc);var go=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return function(H){return Object(s.tidy)(function(){return Object(s.div)(H,Object(s.abs)(H).add(1))})}(B)},ne.className="softsign",ne}(Or);s.serialization.registerClass(go);var xu=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B){return Object(s.tanh)(B)},ne.className="tanh",ne}(Or);s.serialization.registerClass(xu);var kp=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B,H){return H===void 0&&(H=-1),Object(s.softmax)(B,H)},ne.className="softmax",ne}(Or);s.serialization.registerClass(kp);var kl=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.apply=function(B,H){return H===void 0&&(H=-1),Object(s.logSoftmax)(B,H)},ne.className="logSoftmax",ne}(Or);function eu(ae){return ae.getClassName()}function Ei(ae,ne){return ne===void 0&&(ne={}),ht(ae,s.serialization.SerializationMap.getMap().classNameMap,ne,"activation")}function va(ae){var ne;return ae==null?Ei(ne={className:"linear",config:{}}):typeof ae=="string"?((ne={}).className=ae,ne.config={},Ei(ne)):ae instanceof Or?ae:Ei(ae)}function Ep(ae){if(ae!=null&&typeof ae!="object")throw new Error("Argument to L1L2 regularizer's constructor is expected to be an object, but received: "+ae)}s.serialization.registerClass(kl);var Rm=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne}(s.serialization.Serializable),od=function(ae){function ne(B){var H=ae.call(this)||this;return Ep(B),H.l1=B==null||B.l1==null?.01:B.l1,H.l2=B==null||B.l2==null?.01:B.l2,H.hasL1=H.l1!==0,H.hasL2=H.l2!==0,H}return v(ne,ae),ne.prototype.apply=function(B){var H=this;return Object(s.tidy)(function(){var ue=Object(s.zeros)([1]);return H.hasL1&&(ue=Object(s.add)(ue,Object(s.sum)(Object(s.mul)(H.l1,Object(s.abs)(B))))),H.hasL2&&(ue=Object(s.add)(ue,Object(s.sum)(Object(s.mul)(H.l2,co(B))))),ue.asScalar()})},ne.prototype.getConfig=function(){return{l1:this.l1,l2:this.l2}},ne.fromConfig=function(B,H){return new B({l1:H.l1,l2:H.l2})},ne.className="L1L2",ne}(Rm);s.serialization.registerClass(od);var Cp={l1l2:"L1L2"};function to(ae){return $e(ae)}function Li(ae,ne){return ne===void 0&&(ne={}),ht(ae,s.serialization.SerializationMap.getMap().classNameMap,ne,"regularizer")}function za(ae){return ae==null?null:typeof ae=="string"?Li({className:ae in Cp?Cp[ae]:ae,config:{}}):ae instanceof Rm?ae:Li(ae)}var Bm=function(ae){function ne(B){var H=ae.call(this,B??{})||this;return H.supportsMasking=!0,B!=null&&(H.maxValue=B.maxValue),H}return v(ne,ae),ne.prototype.call=function(B,H){B=Yr(B);var ue=Object(s.relu)(B);return this.maxValue!=null&&(ue=Object(s.clipByValue)(ue,0,this.maxValue)),ue},ne.prototype.computeOutputShape=function(B){return B},ne.prototype.getConfig=function(){var B={maxValue:this.maxValue},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B}
3849,ne.className="ReLU",ne}(fo);s.serialization.registerClass(Bm);var Pm=function(ae){function ne(B){var H=ae.call(this,B??{})||this;return H.DEFAULT_ALPHA=.3,B==null&&(B={}),H.alpha=B.alpha==null?H.DEFAULT_ALPHA:B.alpha,H}return v(ne,ae),ne.prototype.call=function(B,H){var ue=Yr(B);return Object(s.leakyRelu)(ue,this.alpha)},ne.prototype.computeOutputShape=function(B){return B},ne.prototype.getConfig=function(){var B={alpha:this.alpha},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="LeakyReLU",ne}(fo);s.serialization.registerClass(Pm);var jm=function(ae){function ne(B){var H=ae.call(this,B??{})||this;if(H.DEFAULT_ALPHA_INITIALIZER="zeros",B==null&&(B={}),H.supportsMasking=!0,H.alphaInitializer=Zr(B.alphaInitializer||H.DEFAULT_ALPHA_INITIALIZER),H.alphaRegularizer=za(B.alphaRegularizer),H.alphaConstraint=yn(B.alphaConstraint),B.sharedAxes==null)H.sharedAxes=null;else if(Array.isArray(B.sharedAxes))H.sharedAxes=B.sharedAxes;else{if(typeof B.sharedAxes!="number")throw new V("Expected sharedAxes to be a number or an array of numbers, but got "+B.sharedAxes);H.sharedAxes=[B.sharedAxes]}return H}return v(ne,ae),ne.prototype.build=function(B){var H=(B=Hn(B)).slice(1);if(this.sharedAxes!=null)for(var ue=0,Le=this.sharedAxes;ue<Le.length;ue++)H[(wt=Le[ue])-1]=1;this.alpha=this.addWeight("alpha",H,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);var Qe={};if(this.sharedAxes!=null)for(var wt=1;wt<B.length;++wt)Qe[wt]=B[wt];this.inputSpec=[new Eo({ndim:B.length,axes:Qe})],this.built=!0},ne.prototype.call=function(B,H){return B=Yr(B),Object(s.prelu)(B,this.alpha.read())},ne.prototype.getConfig=function(){var B={alphaInitializer:pr(this.alphaInitializer),alphaRegularizer:to(this.alphaRegularizer),alphaConstraint:Vt(this.alphaConstraint),sharedAxes:this.sharedAxes},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="PReLU",ne}(fo);s.serialization.registerClass(jm);var Lg=function(ae){function ne(B){var H=ae.call(this,B??{})||this;if(H.DEFAULT_ALPHA=1,B==null&&(B={}),B.alpha!=null&&B.alpha!==H.DEFAULT_ALPHA)throw new N("Non-default alpha value ("+B.alph
3849a+") is not supported by the ELU layer yet.");return H.alpha=B.alpha==null?H.DEFAULT_ALPHA:B.alpha,H}return v(ne,ae),ne.prototype.call=function(B,H){var ue=Yr(B);return Object(s.elu)(ue)},ne.prototype.computeOutputShape=function(B){return B},ne.prototype.getConfig=function(){var B={alpha:this.alpha},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="ELU",ne}(fo);s.serialization.registerClass(Lg);var el=function(ae){function ne(B){var H=ae.call(this,B??{})||this;return H.DEFAULT_THETA=1,B==null&&(B={}),H.theta=B.theta==null?H.DEFAULT_THETA:B.theta,H}return v(ne,ae),ne.prototype.call=function(B,H){var ue=Yr(B);return ue.mul(Dr(ue.greater(this.theta),"float32"))},ne.prototype.computeOutputShape=function(B){return B},ne.prototype.getConfig=function(){var B={theta:this.theta},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="ThresholdedReLU",ne}(fo);s.serialization.registerClass(el);var wu=function(ae){function ne(B){var H=ae.call(this,B??{})||this;return H.DEFAULT_AXIS=1,B==null&&(B={}),H.softmax=new kp().apply,H.axis=B.axis==null?H.DEFAULT_AXIS:B.axis,H}return v(ne,ae),ne.prototype.call=function(B,H){var ue=Yr(B);return this.softmax(ue,this.axis)},ne.prototype.computeOutputShape=function(B){return B},ne.prototype.getConfig=function(){var B={axis:this.axis},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Softmax",ne}(fo);function xf(ae,ne,B){if(typeof ae=="number")return J(ae,ne);if(ae.length!==ne)throw new V("The "+B+" argument must be an integer or tuple of "+ne+" integers. Received: "+ae.length+" elements.");for(var H=0;H<ne;++H){var ue=ae[H];if(!hn(ue))throw new V("The "+B+" argument must be an integer or tuple of "+ne+" integers. Received: "+JSON.stringify(ae)+" including a non-integer number "+ue)}return ae}function Iu(ae,ne,B,H,ue){return ue===void 0&&(ue=1),ae==null?ae:(Le=B==="same"?ae:ae-(ne+(ne-1)*(ue-1))+1,Math.floor((Le+H-1)/H));var Le}function cc(ae,ne,B,H){if(ae==null)return null;if(H==="valid")ae=ae*ne+Fn([B-ne,0]);else{if(H!=="same")throw new V("Unsupport padding mode: "+H+".");ae*=ne}return ae}function Sp(ae,ne){return Object(s.tidy)(function(){return ct(ne),ne==="channelsFirst"?Object(s.transpose)(ae,[0,2,3,1]):ae})}function Qi(ae,ne){return Object(s.tidy)(function(){return ct(ne),ne==="channelsFirst"?Object(s.transpose)(ae,[0,2,3,4,1]):ae})}function ch(ae,ne,B,H,ue,Le,Qe,wt){return H===void 0&&(H=[1,1]),ue===void 0&&(ue="valid"),wt===void 0&&(wt=null),Object(s.tidy)(function(){if(Le==null&&(Le="channelsLast"),ct(Le),ae.rank!==3&&ae.rank!==4)throw new V("conv2dWithBiasActivation expects input to be of rank 3 or 4, but received "+ae.rank+".");if(ne.rank!==3&&ne.rank!==4)throw new V("conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received "+ae.rank+".");var qt=Sp(ae,Le);if(ue==="causal")throw new N("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return qt=s.fused.conv2d({x:qt,filter:ne,strides:H,pad:ue==="same"?"same":"valid",dilations:Qe,dataFormat:"NHWC",bias:B,activation:wt}),Le==="channelsFirst"&&(qt=Object(s.transpose)(qt,[0,3,1,2])),qt})}s.serialization.registerClass(wu);var wf=function(ae){function ne(B,H){var ue=ae.call(this,H)||this;if(ue.bias=null,ue.DEFAULT_KERNEL_INITIALIZER="glorotNormal",ue.DEFAULT_BIAS_INITIALIZER="zeros",ne.verifyArgs(H),ue.rank=B,Mt(ue.rank,"rank"),ue.rank!==1&&ue.rank!==2&&ue.rank!==3)throw new N("Convolution layer for rank other than 1, 2, or 3 ("+ue.rank+") is not implemented yet.");if(ue.kernelSize=xf(H.kernelSize,B,"kernelSize"),ue.strides=xf(H.strides==null?1:H.strides,B,"strides"),ue.padding=H.padding==null?"valid":H.padding,on(ue.padding),ue.dataFormat=H.dataFormat==null?"channelsLast":H.dataFormat,ct(ue.dataFormat),ue.activation=va(H.activation),ue.useBias=H.useBias==null||H.useBias,ue.biasInitializer=Zr(H.biasInitializer||ue.DEFAULT_BIAS_INITIALIZER),ue.biasConstraint=yn(H.biasConstraint),ue.biasRegularizer=za(H.biasRegularizer),ue.activityRegularizer=za(H.activityRegularizer),ue.dilationRate=xf(H.dilationRate==null?1:H.dilationRate,B,"dilationRate"),ue.rank===1&&Array.isArray(ue.dilationRate)&&ue.dilationRate.length!==1)throw new V("dilationRate must be a number or an array of a single number for 1D convolution, but received "+JSON.stringify(ue.dilationRate));if(ue.rank===2){if(typeof ue.dilationRate=="number")ue.dilationRate=[ue.dilationRate,ue.dilationRate];else if(ue.dilationRate.length!==2)throw new V("dilationRate must be a number or array of two numbers for 2D convolution, but received "+JSON.stringify(ue.dilationRate))}else if(ue.rank===3){if(typeof ue.dilationRate=="number")ue.dilationRate=[ue.dilationRate,ue.dilationRate,ue.dilationRate];else if(ue.dilationRate.length!==3)throw new V("dilationRate must be a number or array of three numbers for 3D convolution, but received "+JSON.stringify(ue.dilationRate))}return ue}return v(ne,ae),ne.verifyArgs=function(B){if(K("kernelSize"in B,"required key 'kernelSize' not in config"),typeof B.kernelSize!="number"&&!zt(B.kernelSize,"number",1,3))throw new V("BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received "+JSON.stringify(B.kernelSize)+".")},ne.prototype.getConfig=function(){var B={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:eu(this.activation),useBias:this.useBias,biasInitializer:pr(this.biasInitializer),biasRegularizer:to(this.biasRegularizer),activityRegularizer:to(this.activityRegularizer),biasConstraint:Vt(this.biasConstraint)},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne}(fo),ad=function(ae){function ne(B,H){var ue=ae.call(this,B,H)||this;return ue.kernel=null,ne.verifyArgs(H),ue.filters=H.filters,Mt(ue.filters,"filters"),ue.kernelInitializer=Zr(H.kernelInitializer||ue.DEFAULT_KERNEL_INITIALIZER),ue.kernelConstraint=yn(H.kernelConstraint),ue.kernelRegularizer=za(H.kernelRegularizer),ue}return v(ne,ae),ne.prototype.build=function(B){var H;B=Hn(B);var ue=this.dataFormat==="channelsFirst"?1:B.length-1;if(B[ue]==null)throw new V("The channel dimension of the input should be defined. Found "+B[ue]);
3849var Le=B[ue],Qe=this.kernelSize.concat([Le,this.filters]);this.kernel=this.addWeight("kernel",Qe,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:(H={},H[ue]=Le,H)}],this.built=!0},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le;B=Yr(B);var Qe=ue.bias==null?null:ue.bias.read(),wt=Ke(ue.activation.getClassName());if(wt!=null&&ue.rank===2)Le=ch(B,ue.kernel.read(),Qe,ue.strides,ue.padding,ue.dataFormat,ue.dilationRate,wt);else{if(ue.rank===1)Le=function(qt,en,gt,Tn,Pn,zn,Jn){return Tn===void 0&&(Tn=1),Pn===void 0&&(Pn="valid"),Jn===void 0&&(Jn=1),Object(s.tidy)(function(){if(zn==null&&(zn="channelsLast"),ct(zn),qt.shape.length!==3)throw new V("The input of a conv1dWithBias operation should be 3, but is "+qt.shape.length+" instead.");if(en.shape.length!==3)throw new V("The kernel for a conv1dWithBias operation should be 3, but is "+en.shape.length+" instead");if(gt!=null&>.shape.length!==1)throw new V("The bias for a conv1dWithBias operation should be 1, but is "+en.shape.length+" instead");if(zn==="channelsFirst"&&(qt=Object(s.transpose)(qt,[0,2,1])),Pn==="causal")throw new N("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");var Vn=Object(s.conv1d)(qt,en,Tn,Pn==="same"?"same":"valid","NWC",Jn);return gt!=null&&(Vn=Ft(Vn,gt)),Vn})}(B,ue.kernel.read(),Qe,ue.strides[0],ue.padding,ue.dataFormat,ue.dilationRate[0]);else if(ue.rank===2)Le=ch(B,ue.kernel.read(),Qe,ue.strides,ue.padding,ue.dataFormat,ue.dilationRate);else{if(ue.rank!==3)throw new N("convolutions greater than 3D are not implemented yet.");Le=function(qt,en,gt,Tn,Pn,zn,Jn){return Tn===void 0&&(Tn=[1,1,1]),Pn===void 0&&(Pn="valid"),Object(s.tidy)(function(){if(zn==null&&(zn="channelsLast"),ct(zn),qt.rank!==4&&qt.rank!==5)throw new V("conv3dWithBias expects input to be of rank 4 or 5, but received "+qt.rank+".");if(en.rank!==4&&en.rank!==5)throw new V("conv3dWithBias expects kernel to be of rank 4 or 5, but received "+qt.rank+".");var Vn=Qi(qt,zn);if(Pn==="causal")throw new N("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return Vn=Object(s.conv3d)(Vn,en,Tn,Pn==="same"?"same":"valid","NDHWC",Jn),gt!=null&&(Vn=Ft(Vn,gt)),zn==="channelsFirst"&&(Vn=Object(s.transpose)(Vn,[0,4,1,2,3])),Vn})}(B,ue.kernel.read(),Qe,ue.strides,ue.padding,ue.dataFormat,ue.dilationRate)}ue.activation!=null&&(Le=ue.activation.apply(Le))}return Le})},ne.prototype.computeOutputShape=function(B){B=Hn(B);for(var H=[],ue=this.dataFormat==="channelsLast"?B.slice(1,B.length-1):B.slice(2),Le=0;Le<ue.length;++Le){var Qe=Iu(ue[Le],this.kernelSize[Le],this.padding,this.strides[Le],typeof this.dilationRate=="number"?this.dilationRate:this.dilationRate[Le]);H.push(Qe)}var wt=[B[0]];return this.dataFormat==="channelsLast"?(wt=wt.concat(H)).push(this.filters):(wt.push(this.filters),wt=wt.concat(H)),wt},ne.prototype.getConfig=function(){var B={filters:this.filters,kernelInitializer:pr(this.kernelInitializer),kernelRegularizer:to(this.kernelRegularizer),kernelConstraint:Vt(this.kernelConstraint)},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.verifyArgs=function(B){if(!("filters"in B)||typeof B.filters!="number"||B.filters<1)throw new V("Convolution layer expected config.filters to be a 'number' > 0 but got "+JSON.stringify(B.filters))},ne}(wf),Lm=function(ae){function ne(B){var H=ae.call(this,2,B)||this;return ne.verifyArgs(B),H}return v(ne,ae),ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this);return delete B.rank,B},ne.verifyArgs=function(B){if(typeof B.kernelSize!="number"&&!zt(B.kernelSize,"number",1,2))throw new V("Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received "+JSON.stringify(B.kernelSize)+".")},ne.className="Conv2D",ne}(ad);s.serialization.registerClass(Lm);var zg=function(ae){function ne(B){var H=ae.call(this,3,B)||this;return ne.verifyArgs(B),H}return v(ne,ae),ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this);return delete B.rank,B},ne.verifyArgs=function(B){if(typeof B.kernelSize!="number"&&(!Array.isArray(B.kernelSize)||B.kernelSize.length!==1&&B.kernelSize.length!==3))throw new V("Conv3D expects config.kernelSize to be number or [number, number, number], but received "+JSON.stringify(B.kernelSize)+".")},ne.className="Conv3D",ne}(ad);s.serialization.registerClass(zg);var sd=function(ae){function ne(B){var H=ae.call(this,B)||this;if(H.inputSpec=[new Eo({ndim:4})],H.padding!=="same"&&H.padding!=="valid")throw new V("Conv2DTranspose currently supports only padding modes '
3849same' and 'valid', but received padding mode "+H.padding);return H}return v(ne,ae),ne.prototype.build=function(B){var H;if((B=Hn(B)).length!==4)throw new V("Input should have rank 4; Received input shape: "+JSON.stringify(B));var ue=this.dataFormat==="channelsFirst"?1:B.length-1;if(B[ue]==null)throw new V("The channel dimension of the inputs should be defined. Found `None`.");var Le=B[ue],Qe=this.kernelSize.concat([this.filters,Le]);this.kernel=this.addWeight("kernel",Qe,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new Eo({ndim:4,axes:(H={},H[ue]=Le,H)})],this.built=!0},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le=Yr(B);if(Le.shape.length!==4)throw new V("Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-"+Le.shape.length);var Qe,wt,qt=Le.shape,en=qt[0];ue.dataFormat==="channelsFirst"?(Qe=2,wt=3):(Qe=1,wt=2);var gt=qt[Qe],Tn=qt[wt],Pn=ue.kernelSize[0],zn=ue.kernelSize[1],Jn=ue.strides[0],Vn=ue.strides[1],lr=[en,cc(gt,Jn,Pn,ue.padding),cc(Tn,Vn,zn,ue.padding),ue.filters];ue.dataFormat!=="channelsLast"&&(Le=Object(s.transpose)(Le,[0,2,3,1]));var dr=Object(s.conv2dTranspose)(Le,ue.kernel.read(),lr,ue.strides,ue.padding);return ue.dataFormat!=="channelsLast"&&(dr=Object(s.transpose)(dr,[0,3,1,2])),ue.bias!=null&&(dr=Ft(dr,ue.bias.read(),ue.dataFormat)),ue.activation!=null&&(dr=ue.activation.apply(dr)),dr})},ne.prototype.computeOutputShape=function(B){var H,ue,Le,Qe=(B=Hn(B)).slice();this.dataFormat==="channelsFirst"?(H=1,ue=2,Le=3):(H=3,ue=1,Le=2);var wt=this.kernelSize[0],qt=this.kernelSize[1],en=this.strides[0],gt=this.strides[1];return Qe[H]=this.filters,Qe[ue]=cc(Qe[ue],en,wt,this.padding),Qe[Le]=cc(Qe[Le],gt,qt,this.padding),Qe},ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this);return delete B.dilationRate,B},ne.className="Conv2DTranspose",ne}(Lm);s.serialization.registerClass(sd);var Ap=function(ae){function ne(B){return ae.call(this,2,B)||this}return v(ne,ae),ne.className="SeparableConv2D",ne}(function(ae){function ne(B,H){var ue=ae.call(this,B,H)||this;if(ue.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",ue.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",ue.depthwiseKernel=null,ue.pointwiseKernel=null,H.filters==null)throw new V("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(H.kernelInitializer!=null||H.kernelRegularizer!=null||H.kernelConstraint!=null)throw new V("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(H.padding!=null&&H.padding!=="same"&&H.padding!=="valid")throw new V("SeparableConv"+ue.rank+"D supports only padding modes: 'same' and 'valid', but received "+JSON.stringify(H.padding));return ue.depthMultiplier=H.depthMultiplier==null?1:H.depthMultiplier,ue.depthwiseInitializer=Zr(H.depthwiseInitializer||ue.DEFAULT_DEPTHWISE_INITIALIZER),ue.depthwiseRegularizer=za(H.depthwiseRegularizer),ue.depthwiseConstraint=yn(H.depthwiseConstraint),ue.pointwiseInitializer=Zr(H.depthwiseInitializer||ue.DEFAULT_POINTWISE_INITIALIZER),ue.pointwiseRegularizer=za(H.pointwiseRegularizer),ue.pointwiseConstraint=yn(H.pointwiseConstraint),ue}return v(ne,ae),ne.prototype.build=function(B){var H;if((B=Hn(B)).length<this.rank+2)throw new V("Inputs to SeparableConv"+this.rank+"D should have rank "+(this.rank+2)+", but received input shape: "+JSON.stringify(B));var ue=this.dataFormat==="channelsFirst"?1:B.length-1;if(B[ue]==null||B[ue]<0)throw new V("The channel dimension of the inputs should be defined, but found "+JSON.stringify(B[ue]));for(var Le=B[ue],Qe=this.kernelSize.concat([Le,this.depthMultiplier]),wt=[],qt=0;qt<this.rank;++qt)wt.push(1);wt.push(Le*this.depthMultiplier,this.filters),this.depthwiseKernel=this.addWeight("depthwise_kernel",Qe,"float32",this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.pointwiseKernel=this.addWeight("pointwise_kernel",wt,"float32",this.pointwiseInitializer,this.pointwiseRegularizer,!0,this.pointwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.inputSpec=[new Eo({ndim:this.rank+2,axes:(H={},H[ue]=Le,H)})],this.built=!0},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le;if(B=Yr(B),ue.rank===1)throw new N("1D separable convolution is not implemented yet.");return ue.rank===2&&(ue.dataFormat==="channelsFirst"&&(B=Object(s.transpose)(B,[0,2,3,1])),Le=Object(s.separableConv2d)(B,ue.depthwiseKernel.read(),ue.pointwiseKernel.read(),ue.strides,ue.padding,ue.dilationRate,"NHWC")),ue.useBias&&(Le=Ft(Le,ue.bias.read(),ue.dataFormat)),ue.activation!=null&&(Le=ue.activation.apply(Le)),ue.dataFormat==="channelsFirst"&&(Le=Object(s.transpose)(Le,[0,3,1,2])),Le})},ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this);return delete B.rank,delete B.kernelInitializer,delete B.kernelRegularizer,delete B.kernelConstraint,B.depthwiseInitializer=pr(this.depthwiseInitializer),B.pointwiseInitializer=pr(this.pointwiseInitializer),B.depthwiseRegularizer=to(this.depthwiseRegularizer),B.pointwiseRegularizer=to(this.pointwiseRegularizer),B.depthwiseConstraint=Vt(this.depthwiseConstraint),B.pointwiseConstraint=Vt(this.pointwiseConstraint),B},ne.className="SeparableConv",ne}(ad));s.serialization.registerClass(Ap);var ya=function(ae){function ne(B){var H=ae.call(this,1,B)||this;return ne.verifyArgs(B),H.inputSpec=[{ndim:3}],H}return v(ne,ae),ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this);return delete B.rank,delete B.dataFormat,B},ne.verifyArgs=function(B){if(typeof B.kernelSize!="number"&&!zt(B.kernelSize,"number",1,1))throw new V("Conv1D expects config.kernelSize to be number or number[] with length 1, but received "+JSON.stringify(B.kernelSize)+".")},ne.className="Conv1D",ne}(ad);s.serialization.registerClass(ya);var Op=function(ae){function ne(B){var H=ae.call(this,B)||this;return typeof B.cropping=="number"?H.cropping=[[B.cropping,B.cropping],[B.cropping,B.cropping]]:typeof B.cropping[0]=="number"?H.cropping=[[B.cropping[0],B.cropping[0]],[B.cropping[1],B.cropping[1]]]:H.cropping=B.cropping,H.dataFormat=B.dataFormat===void 0?"channelsLast":B.dataFormat,H.inputSpec=[{ndim:4}],H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){return this.dataFormat==="channelsFirst"?[B[0],B[1],B[2]-this.cropping[0][0]-this.cropping[0][1],B[3]-this.cropping[1][0]-this.cropping[1][1]]:[B[0],B[1]-this.cropping[0][0]-this.cropping[0][1],B[2]-this.cropping[1][0]-this.cropping[1][1],B[3]]},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){return B=Yr(B),ue.dataFormat==="channelsLast"?qr(qr(B,ue.cropping[0][0],B.shape[1]-ue.cropping[0][0]-ue.cropping[0][1],2),ue.cropping[1][0],B.shape[2]-ue.cropping[1][1]-ue.cropping[1][0],3):qr(qr(B,ue.cropping[0][0],B.shape[2]-ue.cropping[0][0]-ue.cropping[0][1],3),ue.cropping[1][0],B.shape[3]-ue.cropping[1][1]-ue.cropping[1][0],4)})},ne.prototype.getConfig=function(){var B={cropping:this.cropping,dataFormat:this.dataFormat},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Cropping2D",ne}(fo);s.serialization.registerClass(Op);var ud=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.DEFAULT_SIZE=[2,2],H.inputSpec=[{ndim:4}],H.size=B.size==null?H.DEFAULT_SIZE:B.size,H.dataFormat=B.dataFormat==null?"channelsLast":B.dataFormat,H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){if(this.dataFormat==="channelsFirst"){var H=B[2]==null?null:this.size[0]*B[2],ue=B[3]==null?null:this.size[1]*B[3];return[B[0],B[1],H,ue]}return H=B[1]==null?null:this.size[0]*B[1],ue=B[2]==null?null:this.size[1]*B[2],[B[0],H,ue,B[3]]},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le=Yr(B),Qe=Le.shape;if(ue.dataFormat==="channelsFirst"){Le=Object(s.transpose)(Le,[0,2,3,1]);var wt=ue.size[0]*Qe[2],qt=ue.size[1]*Qe[3],en=Le.resizeNearestNeighbor([wt,qt]);return Object(s.transpose)(en,[0,3,1,2])}return wt=ue.size[0]*Qe[1],qt=ue.size[1]*Qe[2],Le.resizeNearestNeighbor([wt,qt])})},ne.prototype.getConfig=function(){var B={size:this.size,dataFormat:this.dataFormat},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="UpSampling2D",ne}(fo);s.serialization.registerClass(ud);var Dp=function(ae){function ne(B){var H=ae.call(this,2,B)||this;return H.depthwiseKernel=null,H.depthMultiplier=B.depthMultiplier==null?1:B.depthMultiplier,H.depthwiseInitializer=Zr(B.depthwiseInitializer||H.DEFAULT_KERNEL_INITIALIZER),H.depthwiseConstraint=yn(B.depthwiseConstraint),H.depthwiseRegularizer=za(B.depthwiseRegularizer),H}return v(ne,ae),ne.prototype.build=function(B){if((B=Hn(B)).length<4)throw new V("Inputs to DepthwiseConv2D should have rank 4. Received input shape: "+JSON.stringify(B)+".");var H=this.dataFormat==="channelsFirst"?1:3;if(B[H]==null||B[H]<0)throw new V("The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not ("+B[H]+").");var ue=B[H],Le=[this.kernelSize[0],this.kernelSize[1],ue,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",Le,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[ue*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le=function(Qe,wt,qt,en,gt,Tn){return qt===void 0&&(qt=[1,1]),en===void 0&&(en="valid"),Object(s.tidy)(function(){gt==null&&(gt="channelsLast"),ct(gt);var Pn=Sp(Qe,gt);if(Qe.rank!==4)throw new V("Input for depthwiseConv2d is required to be 4-D, but is instead "+Qe.rank+"-D");if(wt.rank!==4)throw new V("depthwiseKernel is required to be 4-D, but is instead "+wt.rank+"-D");return Pn=Object(s.depthwiseConv2d)(Pn,wt,qt,en==="same"?"same":"valid","NHWC",Tn),gt==="channelsFirst"&&(Pn=Object(s.transpose)(Pn,[0,3,1,2])),Pn})}(B=Yr(B),ue.depthwiseKernel.read(),ue.strides,ue.padding,ue.dataFormat,null);return ue.useBias&&(Le=Ft(Le,ue.bias.read(),ue.dataFormat)),ue.activation!=null&&(Le=ue.activation.apply(Le)),Le})},ne.prototype.computeOutputShape=function(B){B=Hn(B);var H=this.dataFormat==="channelsFirst"?B[2]:B[1],ue=this.dataFormat==="channelsFirst"?B[3]:B[2],Le=this.dataFormat==="channelsFirst"?B[1]*this.depthMultiplier:B[3]*this.depthMultiplier,Qe=Iu(H,this.kernelSize[0],this.padding,this.strides[0]),wt=Iu(ue,this.kernelSize[1],this.padding,this.strides[1]);return this.dataFormat==="channelsFirst"?[B[0],Le,Qe,wt]:[B[0],Qe,wt,Le]},ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this);return B.depthMultiplier=this.depthMultiplier,B.depthwiseInitializer=pr(this.depthwiseInitializer),B.depthwiseRegularizer=to(this.depthwiseRegularizer),B.depthwiseConstraint=Vt(this.depthwiseRegularizer),B},ne.className="DepthwiseConv2D",ne}(wf);s.serialization.registerClass(Dp);var cd=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.rate=Math.max(Math.min(B.rate,1),0),H.noiseShape=B.noiseShape,H.seed=B.seed,H.supportsMasking=!0,H}return v(ne,ae),ne.prototype.getNoiseShape=function(B){if(this.noiseShape==null)return this.noiseShape;for(var H=B.shape,ue=[],Le=0;Le<this.noiseShape.length;++Le)ue.push(this.noiseShape[Le]==null?H[Le]:this.noiseShape[Le]);return ue},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H);var Le=Yr(B);if(0<ue.rate&&ue.rate<1){var Qe=H.training!=null&&H.training,wt=ue.getNoiseShape(Le);return Zt(function(){return Qr(Le,ue.rate,wt,ue.seed)},function(){return Le},Qe)}return B})},ne.prototype.getConfig=function(){var B={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.prototype.dispose=function(){return ae.prototype.dispose.call(this)},ne.className="Dropout",ne}(fo);s.serialization.registerClass(cd);var _f=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.inputSpec=[{ndim:3}],H}return v(ne,ae),ne.prototype.getNoiseShape=function(B){var H=B.shape;return[H[0],1,H[2]]},ne.className="SpatialDropout1D",ne}(cd);s.serialization.registerClass(_f);var ql=function(ae){function ne(B){var H=ae.call(this,B)||this;if(H.activation=null,H.useBias=!0,H.kernel=null,H.bias=null,H.DEFAULT_KERNEL_INITIALIZER="glorotNormal",H.DEFAULT_BIAS_INITIALIZER="zeros",B.batchInputShape==null&&B.inputShape==null&&B.inputDim!=null){var ue=null;B.batchSize!=null&&(ue=B.batchSize),H.batchInputShape=[ue,B.inputDim]}return H.units=B.units,Mt(H.units,"units"),H.activation=va(B.activation),B.useBias!=null&&(H.useBias=B.useBias),H.kernelInitializer=Zr(B.
3849kernelInitializer||H.DEFAULT_KERNEL_INITIALIZER),H.biasInitializer=Zr(B.biasInitializer||H.DEFAULT_BIAS_INITIALIZER),H.kernelConstraint=yn(B.kernelConstraint),H.biasConstraint=yn(B.biasConstraint),H.kernelRegularizer=za(B.kernelRegularizer),H.biasRegularizer=za(B.biasRegularizer),H.activityRegularizer=za(B.activityRegularizer),H.supportsMasking=!0,H.inputSpec=[{minNDim:2}],H}return v(ne,ae),ne.prototype.build=function(B){var H,ue=(B=Hn(B))[B.length-1];this.kernel==null&&(this.kernel=this.addWeight("kernel",[ue,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:(H={},H[-1]=ue,H)}],this.built=!0},ne.prototype.computeOutputShape=function(B){var H=(B=Hn(B)).slice();return H[H.length-1]=this.units,H},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H);var Le,Qe=Yr(B),wt=Ke(ue.activation.getClassName());return wt!=null?Le=yi(Qe,ue.kernel.read(),wt,ue.bias?ue.bias.read():null):(Le=yi(Qe,ue.kernel.read()),ue.bias!=null&&(Le=Ft(Le,ue.bias.read())),ue.activation!=null&&(Le=ue.activation.apply(Le))),Le})},ne.prototype.getConfig=function(){var B={units:this.units,activation:eu(this.activation),useBias:this.useBias,kernelInitializer:pr(this.kernelInitializer),biasInitializer:pr(this.biasInitializer),kernelRegularizer:to(this.kernelRegularizer),biasRegularizer:to(this.biasRegularizer),activityRegularizer:to(this.activityRegularizer),kernelConstraint:Vt(this.kernelConstraint),biasConstraint:Vt(this.biasConstraint)},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Dense",ne}(fo);s.serialization.registerClass(ql);var Tp=function(ae){function ne(B){var H=this;return B=B||{},(H=ae.call(this,B)||this).inputSpec=[{minNDim:3}],H.dataFormat=B.dataFormat,H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){for(var H=0,ue=(B=Hn(B)).slice(1);H<ue.length;H++)if(ue[H]==null)throw new V('The shape of the input to "Flatten" is not fully defined (got '+B.slice(1)+'). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.');return[B[0],rn(B,1)]},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H);var Le=Yr(B);if(ue.dataFormat==="channelsFirst"&&Le.rank>1){for(var Qe=[0],wt=2;wt<Le.rank;++wt)Qe.push(wt);Qe.push(1),Le=Le.transpose(Qe)}return function(qt){if(qt.rank<=1)throw new V("batchFlatten requires a minimum rank of 2. Got rank: "+qt.rank+".");var en=[qt.shape[0],rn(qt.shape,1)];return qt.reshape(en)}(Le)})},ne.prototype.getConfig=function(){var B={};this.dataFormat!=null&&(B.dataFormat=this.dataFormat);var H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Flatten",ne}(fo);s.serialization.registerClass(Tp);var lh=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.supportsMasking=!0,H.activation=va(B.activation),H}return v(ne,ae),ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H);var Le=Yr(B);return ue.activation.apply(Le)})},ne.prototype.getConfig=function(){var B={activation:eu(this.activation)},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Activation",ne}(fo);s.serialization.registerClass(lh);var ld=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.n=B.n,H.inputSpec=[{ndim:2}],H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){return[B[0],this.n,B[1]]},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){return function(Le,Qe){return Object(s.tidy)(function(){if(Le.shape.length!==2)throw new V("repeat() expects a rank-2 tensor, but received a rank-"+Le.shape.length+" tensor.");return ti(xr(Le,1),[1,Qe,1])})}(B=Yr(B),ue.n)})},ne.prototype.getConfig=function(){var B={n:this.n},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="RepeatVector",ne}(fo);s.serialization.registerClass(ld);var Gl=function(ae){function ne(B){var H=ae.call(this,B)||this;H.targetShape=B.targetShape;for(var ue=0;ue<H.targetShape.length;++ue)H.isUnknown(H.targetShape[ue])&&(H.targetShape[ue]=null);return H}return v(ne,ae),ne.prototype.isUnknown=function(B){return B<0||B==null},ne.prototype.fixUnknownDimension=function(B,H){for(var ue="Total size of new array must be unchanged.",Le=H.slice(),Qe=1,wt=null,qt=0;qt<Le.length;++qt){var en=Le[qt];if(this.isUnknown(en)){if(wt!==null)throw new V("Can only specifiy one unknown dimension.");wt=qt}else Qe*=en}var gt=rn(B);if(wt!==null){if(Qe===0||gt%Qe!=0)throw new V(ue);Le[wt]=gt/Qe}else if(gt!==Qe)throw new V(ue);return Le},ne.prototype.computeOutputShape=function(B){for(var H=!1,ue=0;ue<B.length;++ue)if(this.isUnknown(B[ue])){H=!0;break}return H?B.slice(0,1).concat(this.targetShape):B.slice(0,1).concat(this.fixUnknownDimension(B.slice(1),this.targetShape))},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H);var Le=Yr(B),Qe=Le.shape,wt=Qe.slice(0,1).concat(ue.fixUnknownDimension(Qe.slice(1),ue.targetShape));return Le.reshape(wt)})},ne.prototype.getConfig=function(){var B={targetShape:this.targetShape},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Reshape",ne}(fo);s.serialization.registerClass(Gl);var F0=function(ae){function ne(B){var H=ae.call(this,B)||this;if(B.dims==null)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(B.dims))throw new Error("Permute constructor requires `dims` to be an Array, but received "+B.dims+" instead.");var ue=Ar(1,B.dims.length+1);if(!s.util.arraysEqual(B.dims.slice().sort(),ue))throw new Error("Invalid permutation `dims`: "+JSON.stringify(B.dims)+" `dims` must contain consecutive integers starting from 1.");return H.dims=B.dims,H.dimsIncludingBatch=[0].concat(H.dims),H.inputSpec=[new Eo({ndim:H.dims.length+1})],H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){var H=(B=Hn(B)).slice();
3849return this.dims.forEach(function(ue,Le){H[Le+1]=B[ue]}),H},ne.prototype.call=function(B,H){return Object(s.transpose)(Yr(B),this.dimsIncludingBatch)},ne.prototype.getConfig=function(){var B={dims:this.dims},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Permute",ne}(fo);s.serialization.registerClass(F0);var fd=function(ae){function ne(B){var H=ae.call(this,B??{})||this;return H.supportsMasking=!0,H.maskValue=B!=null?B.maskValue==null?0:B.maskValue:0,H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){return B},ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this),H={maskValue:this.maskValue};return Object.assign(H,B),H},ne.prototype.computeMask=function(B,H){var ue=Yr(B);return Object(s.any)(Object(s.notEqual)(ue,this.maskValue),-1)},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H);var Le=Yr(B),Qe=Object(s.any)(Object(s.notEqual)(Le,ue.maskValue),-1,!0);return Le.mul(Qe.asType(Le.dtype))})},ne.className="Masking",ne}(fo);s.serialization.registerClass(fd);var Pa=function(ae){function ne(B){var H=ae.call(this,B)||this;if(H.embeddings=null,H.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",B.batchInputShape==null&&B.inputShape==null){var ue=null;B.batchSize!=null&&(ue=B.batchSize),B.inputLength==null?H.batchInputShape=[ue,null]:H.batchInputShape=[ue].concat(pe(B.inputLength))}return H.inputDim=B.inputDim,Mt(H.inputDim,"inputDim"),H.outputDim=B.outputDim,Mt(H.outputDim,"outputDim"),H.embeddingsInitializer=Zr(B.embeddingsInitializer||H.DEFAULT_EMBEDDINGS_INITIALIZER),H.embeddingsRegularizer=za(B.embeddingsRegularizer),H.activityRegularizer=za(B.activityRegularizer),H.embeddingsConstraint=yn(B.embeddingsConstraint),H.maskZero=B.maskZero,H.supportsMasking=B.maskZero,H.inputLength=B.inputLength,H}return v(ne,ae),ne.prototype.build=function(B){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0},ne.prototype.warnOnIncompatibleInputShape=function(B){},ne.prototype.computeMask=function(B,H){var ue=this;return Object(s.tidy)(function(){return ue.maskZero?(B=Yr(B),Object(s.notEqual)(B,Object(s.zerosLike)(B))):null})},ne.prototype.computeOutputShape=function(B){if(B=Hn(B),this.inputLength==null)return B.concat([this.outputDim]);
3849var H=pe(this.inputLength);if(H.length!==B.length-1)throw new V('"inputLength" is '+this.inputLength+", but received input shape has shape "+B);for(var ue=0,Le=0;Le<H.length;++Le){var Qe=H[Le],wt=B[Le+1];if(Qe!=null&&wt!=null&&Qe!==wt)throw new V('"inputLength" is '+this.inputLength+", but received input shape has shape "+B);Qe==null&&(H[ue]=wt),ue++}return[B[0]].concat(H,[this.outputDim])},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H);var Le=Yr(B);return Le.dtype!=="int32"&&(Le=Dr(Le,"int32")),na(ue.embeddings.read(),Le.as1D()).reshape(Hn(ue.computeOutputShape(Le.shape)))})},ne.prototype.getConfig=function(){var B={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:pr(this.embeddingsInitializer),embeddingsRegularizer:to(this.embeddingsRegularizer),activityRegularizer:to(this.activityRegularizer),embeddingsConstraint:Vt(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Embedding",ne}(fo);s.serialization.registerClass(Pa);var hs=function(ae){function ne(B){var H=ae.call(this,B||{})||this;return H.supportsMasking=!0,H}return v(ne,ae),ne.prototype.mergeFunction=function(B){throw new N},ne.prototype.computeElementwiseOpOutputShape=function(B,H){if(B==null||H==null)return null;if(B.length<H.length)return this.computeElementwiseOpOutputShape(H,B);if(H.length===0)return B;for(var ue=B.slice(0,B.length-H.length),Le=0;Le<H.length;++Le){var Qe=B[B.length-H.length+Le],wt=H[Le];if(Qe==null||wt==null||Qe<0||wt<0)ue.push(null);else if(Qe===1)ue.push(wt);else if(wt===1)ue.push(Qe);else{if(Qe!==wt)throw new V("Operands could not be broadcast together with shapes "+JSON.stringify(B)+" "+JSON.stringify(H));ue.push(Qe)}}return ue},ne.prototype.build=function(B){if(Array.isArray(B)&&!Array.isArray(B[0])&&(B=[Hn(B)]),(B=B).length<2)throw new V("A merge layer should be called on an Array of at least 2 inputs. Got "+B.length+" input(s).");for(var H=[],ue=0,Le=B;ue<Le.length;ue++)(qt=Le[ue])!=null&&qt[0]!==null&&H.push(qt[0]);if((H=Ut(H)).length>1)throw new V("Can not merge tensors with different batch sizes. Got tensors with shapes: "+JSON.stringify(B)+".");for(var Qe=B[0]==null?null:B[0].slice(1),wt=1;wt<B.length;++wt){var qt=B[wt]==null?null:B[wt].slice(1);Qe=this.computeElementwiseOpOutputShape(Qe,qt)}var en=B.map(function(gt){return gt.length});B.indexOf(null)===-1&&Ut(en).length===1?this.reshapeRequired=!1:this.reshapeRequired=!0},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){if(B=B,ue.reshapeRequired){var Le=[],Qe=B.map(function(Ci){return Ci.rank});if(Qe.indexOf(null)===-1){for(var wt=Fn(Qe),qt=0,en=B;qt<en.length;qt++){for(var gt=(Vn=en[qt]).rank,Tn=0;Tn<wt-gt;++Tn)Vn=xr(Vn,1);Le.push(Vn)}return ue.mergeFunction(Le)}for(var Pn=!1,zn=0,Jn=B;zn<Jn.length;zn++){var Vn;if((gt=(Vn=Jn[zn]).rank)==null){var lr=Vn.shape,dr=lr[0],Tr=lr.slice(1).concat([dr]),Hr=Vn.reshape([dr].concat(rn(lr.slice(1))));Hr=(Hr=Object(s.transpose)(Hr,[1,0])).reshape(Tr),Le.push(Hr),Pn=!0}else if(gt>1){var oi=Ar(1,gt).concat([0]);Le.push(Object(s.transpose)(Vn,oi)),Pn=!0}else Le.push(Vn)}var Br=ue.mergeFunction(Le),ui=Br.rank;if(Pn)if(ui==null){var ii=Br.shape;Tr=[dr=ii[ii.length-1]].concat(ii.slice(0,ii.length-1)),Br=Object(s.transpose)(Br.reshape([-1,dr]),[1,0]).reshape(Tr)}else ui>1&&(oi=[ui-1].concat(Ar(0,ui-1)),Br=Object(s.transpose)(Br,oi));return Br}return ue.mergeFunction(B)})},ne.prototype.computeOutputShape=function(B){var H;H=(B=B)[0]==null?null:B[0].slice(1);for(var ue=1;ue<B.length;++ue){var Le=B[ue]==null?null:B[ue].slice(1);H=this.computeElementwiseOpOutputShape(H,Le)}for(var Qe=[],wt=0,qt=B;wt<qt.length;wt++)(Le=qt[wt])!=null&&Le[0]!==null&&Qe.push(Le[0]);return(Qe=Ut(Qe)).length===1?Qe.concat(H):[null].concat(H)},ne.prototype.computeMask=function(B,H){return Object(s.tidy)(function(){if(H==null)return null;if(!Array.isArray(H))throw new V("`mask` should be an Array");if(!Array.isArray(B))throw new V("`inputs` should be an Array");if(H.length!==B.length)throw new V("The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths ("+B.length+" vs "+H.length+")");if(H.every(function(Qe){return Qe==null}))return null;for(var ue=(H=H.map(function(Qe){return Qe==null?Qe:Object(s.expandDims)(Qe,0)}))[0],Le=1;Le<H.length-1;++Le)ue=Object(s.logicalAnd)(ue,H[Le]);return ue})},ne}(fo),bs=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.mergeFunction=function(B){return Object(s.tidy)(function(){for(var H=B[0].clone(),ue=1;ue<B.length;++ue)H=Object(s.add)(H,B[ue]);return H})},ne.className="Add",ne}(hs);s.serialization.registerClass(bs);var no=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.mergeFunction=function(B){return Object(s.tidy)(function(){for(var H=B[0].clone(),ue=1;ue<B.length;++ue)H=Object(s.mul)(H,B[ue]);return H})},ne.className="Multiply",ne}(hs);s.serialization.registerClass(no);var _u=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.mergeFunction=function(B){return Object(s.tidy)(function(){for(var H=B[0].clone(),ue=1;ue<B.length;++ue)H=Object(s.add)(H,B[ue]);return Object(s.mul)(1/B.length,H)})},ne.className="Average",ne}(hs);s.serialization.registerClass(_u);var Kl=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.mergeFunction=function(B){return Object(s.tidy)(function(){for(var H=B[0],ue=1;ue<B.length;++ue)H=Object(s.maximum)(H,B[ue]);return H})},ne.className="Maximum",ne}(hs);s.serialization.registerClass(Kl);var xs=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.mergeFunction=function(B){return Object(s.tidy)(function(){for(var H=B[0],ue=1;ue<B.length;++ue)H=Object(s.minimum)(H,B[ue]);return H})},ne.className="Minimum",ne}(hs);s.serialization.registerClass(xs);var Yl=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.DEFAULT_AXIS=-1,B==null&&(B={}),H.axis=B.axis==null?H.DEFAULT_AXIS:B.axis,H.supportsMasking=!0,H.reshapeRequired=!1,H}return v(ne,ae),ne.prototype.build=function(B){if(!Array.isArray(B)||!Array.isArray(B[0])||B.length===1)throw new V("A `Concatenate` layer should be called on a list of at least 2 inputs");for(var H=!0,ue=0,Le=B=B;ue<Le.length;ue++)if((Pn=Le[ue])!=null){H=!1;break}if(!H){for(var Qe=[],wt=0;wt<B.length;++wt){var qt=B[wt].slice();qt.splice(this.axis,1);for(var en=!1,gt=0,Tn=Qe;gt<Tn.length;gt++){var Pn=Tn[gt];if(s.util.arraysEqual(Pn,qt)){en=!0;break}}en||Qe.push(qt)}if(Qe.length>1)throw new V("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(B))}},ne.prototype.mergeFunction=function(B){var H=this;return Object(s.tidy)(function(){return mi(B,H.axis)})},ne.prototype.computeOutputShape=function(B){if(!Array.isArray(B)||!Array.isArray(B[0]))throw new V("A `Concatenate` layer should be called on a list of inputs.");for(var H=B,ue=H[0].slice(),Le=this.axis<0?ue.length+this.axis:this.axis,Qe=0,wt=H.slice(1);Qe<wt.length;Qe++){var qt=wt[Qe];if(ue[Le]==null||qt[Le]==null){ue[Le]=null;break}ue[Le]+=qt[Le]}return ue},ne.prototype.computeMask=function(B,H){var ue=this;if(H==null)return null;if(!Array.isArray(H))throw new V("`mask` should be an array for Concatenate");if(!Array.isArray(B))throw new V("`inputs` should be an array for Concatenate");if(H.length!==B.length)throw new V("Mismatch in the length of mask ("+H.length+") and the legnth of inputs ("+B.length+")");return Object(s.tidy)(function(){var Le=!0;
3849if(H.forEach(function(en){en==null||(Le=!1)}),Le)return null;for(var Qe=[],wt=0;wt<B.length;++wt)H[wt]==null?Qe.push(Object(s.onesLike)(B[wt]).asType("bool")):H[wt].rank<B[wt].rank?Qe.push(Object(s.expandDims)(H[wt],-1)):Qe.push(H[wt]);var qt=Object(s.concat)(Qe,ue.axis);return Object(s.all)(qt,-1,!1)})},ne.prototype.getConfig=function(){var B={axis:this.axis},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Concatenate",ne}(hs);function tl(ae,ne){for(;ae<0;)ae+=ne;return ae}s.serialization.registerClass(Yl);var fh=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.axes=B.axes,H.normalize=B.normalize!=null&&B.normalize,H.supportsMasking=!0,H.reshapeRequired=!1,H}return v(ne,ae),ne.prototype.build=function(B){s.util.assert(Array.isArray(B)&&B.length===2&&Array.isArray(B[0])&&Array.isArray(B[1]),function(){return"A `Dot` layer should be called on a list of exactly 2 inputs."});var H=B[0],ue=B[1];if(H.length>3||ue.length>3)throw new N("Dot layer does not support tensors of 4D or higher rank yet.");var Le=this.interpretAxes(H,ue);if(H[Le[0]]!==ue[Le[1]])throw new V("Dimension incompatibility: "+H[Le[0]]+" !== "+ue[Le[1]])},ne.prototype.mergeFunction=function(B){if(B.length!==2)throw new V("A `Dot` layer must be called on exactly 2 inputs, but received "+B.length+" input(s).");var H,ue=B[0],Le=B[1];return H=Array.isArray(this.axes)?this.axes.map(function(Qe,wt){return tl(Qe,B[wt].shape.length)}):[tl(this.axes,ue.shape.length),tl(this.axes,Le.shape.length)],this.normalize&&(ue=vf(ue,H[0]),Le=vf(Le,H[1])),function(Qe,wt,qt){if(Qe.shape.length>3||wt.shape.length>3)throw new N("batchDot is not implemented for tensors of 4D or higher rank yet");if(s.util.assert(Qe.shape.length>=2,function(){return"batchDot requires the rank of x to be >= 2, but got "+Qe.shape.length}),s.util.assert(Qe.shape.length>=2,function(){return"batchDot requires the rank of y to be >= 2, but got "+wt.shape.length}),typeof qt=="number"&&(qt=[qt,qt]),Qe.dtype==="complex64"||wt.dtype==="complex64")throw new N("batchDot is not implemented for complex64-type Tensors yet.");var en=Qe.shape.length,gt=wt.shape.length;qt==null&&(qt=[en-1,gt-2]);var Tn=qt;return Object(s.tidy)(function(){var Pn,zn;if(en>gt){Pn=en-gt;for(var Jn=[],Vn=0;Vn<Pn;++Vn)Jn.push(1);wt=wt.reshape(wt.shape.concat(Jn))}else if(gt>en){for(Pn=gt-en,Jn=[],Vn=0;Vn<Pn;++Vn)Jn.push(1);Qe=Qe.reshape(Qe.shape.concat(Jn))}else Pn=0;if(Qe.shape.length===2&&wt.shape.length===2)zn=Tn[0]===Tn[1]?Qe.mulStrict(wt).sum(Tn[0]):Qe.transpose([1,0]).mulStrict(wt).sum(Tn[1]);else{var lr=Tn[0]!==Qe.shape.length-1,dr=Tn[1]===wt.shape.length-1;zn=Qe.matMul(wt,lr,dr)}if(Pn>0){var Tr,Hr=[];for(Vn=Tr=en>gt?en+gt-3:en-1;Vn<Tr+Pn;++Vn)Hr.push(Vn);zn=zn.squeeze(Hr)}return zn.shape.length===1&&(zn=zn.expandDims(1)),zn})}(ue,Le,H)},ne.prototype.interpretAxes=function(B,H){return Array.isArray(this.axes)?this.axes:[tl(this.axes,B.length),tl(this.axes,H.length)]},ne.prototype.computeOutputShape=function(B){s.util.assert(Array.isArray(B)&&B.length===2&&Array.isArray(B[0])&&Array.isArray(B[1]),function(){return"A `Dot` layer should be called on a list of exactly 2 inputs."});var H=B[0].slice(),ue=B[1].slice();if(H.length>3||ue.length>3)throw new N("Dot layer does not support tensors of 4D or higher rank yet.");var Le=this.interpretAxes(H,ue);H.splice(Le[0],1),ue.splice(Le[1],1),ue.splice(0,1);var Qe=H.concat(ue);return Qe.length===1&&Qe.push(1),Qe},ne.prototype.computeMask=function(B,H){return null},ne.prototype.getConfig=function(){var B={axes:this.axes,normalize:this.normalize},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="Dot",ne}(hs);s.serialization.registerClass(fh);var dh=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.supportsMasking=!0,H.stddev=B.stddev,H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){return B},ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this),H={stddev:this.stddev};return Object.assign(H,B),H},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H);var Le=Yr(B);return Zt(function(){return ri(Le.shape,0,ue.stddev).add(Le)},function(){return Le},H.training||!1)})},ne.className="GaussianNoise",ne}(fo);s.serialization.registerClass(dh);var kf=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.supportsMasking=!0,H.rate=B.rate,H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){return B},ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this),H={rate:this.rate};return Object.assign(H,B),H},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H);var Le=Yr(B);return ue.rate>0&&ue.rate<1?Zt(function(){var Qe=Math.sqrt(ue.rate/(1-ue.rate));return Le.mul(ri(Le.shape,1,Qe))},function(){return Le},H.training||!1):Le})},ne.className="GaussianDropout",ne}(fo);s.serialization.registerClass(kf);var zm=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.supportsMasking=!0,H.rate=B.rate,H.noiseShape=B.noiseShape,H}return v(ne,ae),ne.prototype._getNoiseShape=function(B){return this.noiseShape||Yr(B).shape},ne.prototype.computeOutputShape=function(B){return B},ne.prototype.getConfig=function(){var B=ae.prototype.getConfig.call(this),H={rate:this.rate};return Object.assign(H,B),H},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){if(ue.rate<1&&ue.rate>0){var Le=ue._getNoiseShape(B);return Zt(function(){var Qe=Yr(B),wt=-1.7580993408473766,qt=Object(s.greaterEqual)(Object(s.randomUniform)(Le),ue.rate);qt=Dr(qt,"float32");var en=Math.pow((1-ue.rate)*(1+ue.rate*Math.pow(wt,2)),-.5),gt=-en*wt*ue.rate;return Qe.mul(qt).add(qt.add(-1).mul(wt)).mul(en).add(gt)},function(){return Yr(B)},H.training||!1)}return B})},ne.className="AlphaDropout",ne}(fo);function nl(ae,ne,B,H,ue,Le){var Qe;if(Le===void 0&&(Le=.001),ae.rank===2)Qe=Object(s.batchNorm2d)(ae,ne,B,H,ue,Le);else if(ae.rank===3)Qe=Object(s.batchNorm3d)(ae,ne,B,H,ue,Le);else{if(ae.rank!==4)throw new N("batchNormalization is not implemented for array of rank "+ae.rank+" yet");Qe=Object(s.batchNorm4d)(ae,ne,B,H,ue,Le)}return Qe}function R0(ae,ne,B,H,ue){return ue===void 0&&(ue=.001),s.util.arraysEqual(H.slice().sort(),Ar(0,ae.rank-1))?function(Le,Qe,wt,qt,en){return en===void 0&&(en=.001),Object(s.tidy)(function(){var gt=Object(s.moments)(Le,qt),Tn=gt.mean,Pn=gt.variance;return[nl(Le,Tn,Pn,wt,Qe,en),Tn,Pn]})}(ae,ne,B,H,ue):function(Le,Qe,wt,qt,en){return en===void 0&&(en=.001),Object(s.tidy)(function(){for(var gt=Object(s.moments)(Le,qt),Tn=gt.mean,Pn=gt.variance,zn=[],Jn=0,Vn=Ar(0,Le.rank);Jn<Vn.length;Jn++){var lr=Vn[Jn];qt.indexOf(lr)!==-1?zn.push(1):zn.push(Le.shape[lr])}var dr=Tn.reshape(zn),Tr=Pn.reshape(zn),Hr=Qe==null?null:Qe.reshape(zn),oi=wt==null?null:wt.reshape(zn);return[nl(Le,dr,Tr,oi,Hr,en),Tn,Pn]})}(ae,ne,B,H,ue)}
3849s.serialization.registerClass(zm);var Um=function(ae){function ne(B){var H=this;return B==null&&(B={}),(H=ae.call(this,B)||this).supportsMasking=!0,H.axis=B.axis==null?-1:B.axis,H.momentum=B.momentum==null?.99:B.momentum,H.epsilon=B.epsilon==null?.001:B.epsilon,H.center=B.center==null||B.center,H.scale=B.scale==null||B.scale,H.betaInitializer=Zr(B.betaInitializer||"zeros"),H.gammaInitializer=Zr(B.gammaInitializer||"ones"),H.movingMeanInitializer=Zr(B.movingMeanInitializer||"zeros"),H.movingVarianceInitializer=Zr(B.movingVarianceInitializer||"ones"),H.betaConstraint=yn(B.betaConstraint),H.gammaConstraint=yn(B.gammaConstraint),H.betaRegularizer=za(B.betaRegularizer),H.gammaRegularizer=za(B.gammaRegularizer),H}return v(ne,ae),ne.prototype.build=function(B){var H;B=Hn(B);var ue=this.axis>=0?this.axis:this.axis+B.length,Le=B[ue];if(Le==null)throw new V("Axis "+ue+" of input tensor should have a defined dimension but the layer received an input with shape "+JSON.stringify(B)+".");this.inputSpec=[new Eo({ndim:B.length,axes:(H={},H[ue]=Le,H)})];var Qe=[Le];this.scale&&(this.gamma=this.addWeight("gamma",Qe,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",Qe,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",Qe,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",Qe,null,this.movingVarianceInitializer,null,!1),this.built=!0},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le=H.training!=null&&H.training,Qe=Yr(B),wt=Qe.shape,qt=wt.length,en=Ar(0,qt),gt=ue.axis>=0?ue.axis:ue.axis+qt;en.splice(gt,1);var Tn=J(1,qt);Tn[gt]=wt[gt];var Pn=en.slice();Pn.sort();var zn=!s.util.arraysEqual(Pn,Ar(0,qt).slice(0,qt-1));if(!Le)return function(){if(zn){var Hr=ue.movingMean.read().reshape(Tn),oi=ue.movingVariance.read().reshape(Tn),Br=ue.center?ue.beta.read().reshape(Tn):null,ui=ue.scale?ue.gamma.read().reshape(Tn):null;return nl(Qe,Hr,oi,Br,ui,ue.epsilon)}return nl(Qe,ue.movingMean.read(),ue.movingVariance.read(),ue.beta==null?null:ue.beta.read(),ue.gamma==null?null:ue.gamma.read(),ue.epsilon)}();var Jn=R0(Qe,ue.gamma.read(),ue.beta.read(),en,ue.epsilon),Vn=Jn[0],lr=Jn[1],dr=Jn[2],Tr=function(Hr,oi,Br){Object(s.tidy)(function(){var ui=1-Br,ii=Hr.read(),Ci=ii.sub(oi).mul(ui);Hr.write(ii.sub(Ci))})};return Tr(ue.movingMean,lr,ue.momentum),Tr(ue.movingVariance,dr,ue.momentum),Vn})},ne.prototype.getConfig=function(){var B={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:pr(this.betaInitializer),gammaInitializer:pr(this.gammaInitializer),movingMeanInitializer:pr(this.movingMeanInitializer),movingVarianceInitializer:pr(this.movingVarianceInitializer),betaRegularizer:to(this.betaRegularizer),gammaRegularizer:to(this.gammaRegularizer),betaConstraint:Vt(this.betaConstraint),gammaConstraint:Vt(this.gammaConstraint)},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="BatchNormalization",ne}(fo);s.serialization.registerClass(Um);var dd=function(ae){function ne(B){var H=this;if(B==null&&(B={}),(H=ae.call(this,B)||this).axis=B.axis==null?-1:B.axis,typeof H.axis=="number"){if(!Number.isInteger(H.axis))throw new Error("Expected axis to be an integer, but received "+H.axis)}else{if(!Array.isArray(H.axis))throw new Error("Expected axis to be an integer or an array of integers, but received "+JSON.stringify(H.axis));for(var ue=0,Le=H.axis;ue<Le.length;ue++){var Qe=Le[ue];if(!Number.isInteger(Qe))throw new Error("Expected axis to be an array of integers, but received "+JSON.stringify(H.axis))}}return H.epsilon=B.epsilon==null?.001:B.epsilon,H.center=B.center==null||B.center,H.scale=B.scale==null||B.scale,H.betaInitializer=Zr(B.betaInitializer||"zeros"),H.gammaInitializer=Zr(B.gammaInitializer||"ones"),H.betaRegularizer=za(B.betaRegularizer),H.gammaRegularizer=za(B.gammaRegularizer),H.supportsMasking=!0,H}return v(ne,ae),ne.prototype.build=function(B){var H=(B=Hn(B)).length;typeof this.axis=="number"&&(this.axis=[this.axis]);for(var ue=0;ue<this.axis.length;++ue)this.axis[ue]<0&&(this.axis[ue]+=H);for(var Le=0,Qe=this.axis;Le<Qe.length;Le++){var wt=Qe[Le];if(wt<0||wt>=H)throw new Error("Invalid axis: "+wt)}if(this.axis.length!==Ut(this.axis).length)throw new Error("Found duplicate axes in: "+this.axis);var qt=this.axis.map(function(en){return B[en]});this.scale?this.gamma=this.addWeight("gamma",qt,"float32",this.gammaInitializer,this.gammaRegularizer,!0):this.gamma=null,this.center?this.beta=this.addWeight("beta",qt,"float32",this.betaInitializer,this.betaRegularizer,!0):this.beta=null,this.built=!0},ne.prototype.call=function(B,H){var ue=this,Le=Yr(B),Qe=Le.shape,wt=Qe.length;return Object(s.tidy)(function(){for(var qt=Object(s.moments)(Le,ue.axis,!0),en=qt.mean,gt=qt.variance,Tn=J(1,wt),Pn=0,zn=ue.axis;Pn<zn.length;Pn++){var Jn=zn[Pn];Tn[Jn]=Qe[Jn]}for(var Vn=function(Br){return Br!=null&&Br.shape.length!==wt&&ue.axis!==[wt-1]?Br.reshape(Tn):Br},lr=Vn(ue.gamma.read()),dr=Vn(ue.beta.read()),Tr=[],Hr=[],oi=0;oi<wt;++oi)ue.axis.indexOf(oi)!==-1?(Tr.push(Qe[oi]),Hr.push(1)):(Tr.push(1),Hr.push(Qe[oi]));
3849return en=en.tile(Tr),gt=gt.tile(Tr),lr=lr.tile(Hr),dr=dr.tile(Hr),nl(Le,en,gt,dr,lr,ue.epsilon)})},ne.prototype.getConfig=function(){var B={axis:this.axis,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:pr(this.betaInitializer),gammaInitializer:pr(this.gammaInitializer),betaRegularizer:to(this.betaRegularizer),gammaRegularizer:to(this.gammaRegularizer)},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="LayerNormalization",ne}(fo);s.serialization.registerClass(dd);var Ug=function(ae){function ne(B){var H=this;if(B==null&&(B={}),(H=ae.call(this,B)||this).dataFormat=B.dataFormat==null?"channelsLast":B.dataFormat,B.padding==null)H.padding=[[1,1],[1,1]];else if(typeof B.padding=="number")H.padding=[[B.padding,B.padding],[B.padding,B.padding]];else{if(B.padding=B.padding,B.padding.length!==2)throw new V("ZeroPadding2D expects padding to be a length-2 array, but received a length-"+B.padding.length+" array.");var ue=void 0,Le=void 0;if(typeof B.padding[0]=="number")ue=[B.padding[0],B.padding[0]],Le=[B.padding[1],B.padding[1]];else{if(B.padding=B.padding,B.padding[0].length!==2)throw new V("ZeroPadding2D expects height padding to be a length-2 array, but received a length-"+B.padding[0].length+" array.");if(ue=B.padding[0],B.padding[1].length!==2)throw new V("ZeroPadding2D expects width padding to be a length-2 array, but received a length-"+B.padding[1].length+" array.");Le=B.padding[1]}H.padding=[ue,Le]}return H.inputSpec=[new Eo({ndim:4})],H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){var H,ue;return B=Hn(B),this.dataFormat==="channelsFirst"?(H=B[2]!=null&&B[2]>=0?B[2]+this.padding[0][0]+this.padding[0][1]:null,ue=B[3]!=null&&B[3]>=0?B[3]+this.padding[1][0]+this.padding[1][1]:null,[B[0],B[1],H,ue]):(H=B[1]!=null&&B[1]>=0?B[1]+this.padding[0][0]+this.padding[0][1]:null,ue=B[2]!=null&&B[2]>=0?B[2]+this.padding[1][0]+this.padding[1][1]:null,[B[0],H,ue,B[3]])},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){return function(Le,Qe,wt){return Object(s.tidy)(function(){if(Le.rank!==4)throw new V("temporalPadding expects input tensor to be 4-D, but received a "+Le.rank+"-D tensor.");if(Qe==null&&(Qe=[[1,1],[1,1]]),Qe.length!==2||Qe[0].length!==2||Qe[1].length!==2)throw new V("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(wt==null&&(wt="channelsLast"),wt!=="channelsLast"&&wt!=="channelsFirst")throw new V("Unknown data format: "+wt+". Supported data formats are 'channelsLast' and 'channelsFirst.");var qt;return qt=wt==="channelsFirst"?[[0,0],[0,0],Qe[0],Qe[1]]:[[0,0],Qe[0],Qe[1],[0,0]],Object(s.pad)(Le,qt)})}(Yr(B),ue.padding,ue.dataFormat)})},ne.prototype.getConfig=function(){var B={padding:this.padding,dataFormat:this.dataFormat},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="ZeroPadding2D",ne}(fo);function hh(ae,ne,B,H,ue,Le){return Object(s.tidy)(function(){var Qe;ct(ue),Xt(Le),on(H),B==null&&(B=[1,1]),H==null&&(H="valid"),ue==null&&(ue="channelsLast"),Le==null&&(Le="max"),ae=Sp(ae,ue);var wt=H==="same"?"same":"valid";return Qe=Le==="max"?Object(s.maxPool)(ae,ne,B,wt):Object(s.avgPool)(ae,ne,B,wt),ue==="channelsFirst"&&(Qe=Object(s.transpose)(Qe,[0,3,1,2])),Qe})}function Ef(ae,ne,B,H,ue,Le){return Object(s.tidy)(function(){var Qe;ct(ue),Xt(Le),on(H),B==null&&(B=[1,1,1]),H==null&&(H="valid"),ue==null&&(ue="channelsLast"),Le==null&&(Le="max"),ae=Qi(ae,ue);var wt=H==="same"?"same":"valid";return Qe=Le==="max"?Object(s.maxPool3d)(ae,ne,B,wt):Object(s.avgPool3d)(ae,ne,B,wt),ue==="channelsFirst"&&(Qe=Object(s.transpose)(Qe,[0,4,1,2,3])),Qe})}s.serialization.registerClass(Ug);var Wm=function(ae){function ne(B){var H=this;if(B.poolSize==null&&(B.poolSize=2),H=ae.call(this,B)||this,typeof B.poolSize=="number")H.poolSize=[B.poolSize];else{if(!Array.isArray(B.poolSize)||B.poolSize.length!==1||typeof B.poolSize[0]!="number")throw new V("poolSize for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(B.poolSize));H.poolSize=B.poolSize}if(Mt(H.poolSize,"poolSize"),B.strides==null)H.strides=H.poolSize;else if(typeof B.strides=="number")H.strides=[B.strides];else{if(!Array.isArray(B.strides)||B.strides.length!==1||typeof B.strides[0]!="number")throw new V("strides for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(B.strides));H.strides=B.strides}return Mt(H.strides,"strides"),H.padding=B.padding==null?"valid":B.padding,on(H.padding),H.inputSpec=[new Eo({ndim:3})],H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){var H=Iu((B=Hn(B))[1],this.poolSize[0],this.padding,this.strides[0]);return[B[0],H,B[2]]},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.invokeCallHook(B,H),B=xr(Yr(B),2);var Le=ue.poolingFunction(Yr(B),[ue.poolSize[0],1],[ue.strides[0],1],ue.padding,"channelsLast");return Object(s.squeeze)(Le,[2])})},ne.prototype.getConfig=function(){var B={poolSize:this.poolSize,padding:this.padding,strides:this.strides},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne}(fo),Np=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.poolingFunction=function(B,H,ue,Le,Qe){return ct(Qe),on(Le),hh(B,H,ue,Le,Qe,"max")},ne.className="MaxPooling1D",ne}(Wm);s.serialization.registerClass(Np);var os=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.poolingFunction=function(B,H,ue,Le,Qe){return ct(Qe),on(Le),hh(B,H,ue,Le,Qe,"avg")},ne.className="AveragePooling1D",ne}(Wm);s.serialization.registerClass(os);var hd=function(ae){function ne(B){var H=this;if(B.poolSize==null&&(B.poolSize=[2,2]),(H=ae.call(this,B)||this).poolSize=Array.isArray(B.poolSize)?B.poolSize:[B.poolSize,B.poolSize],B.strides==null)H.strides=H.poolSize;else if(Array.isArray(B.strides)){if(B.strides.length!==2)throw new V("If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length "+B.strides.length+".");H.strides=B.strides}else H.strides=[B.strides,B.strides];return Mt(H.poolSize,"poolSize"),Mt(H.strides,"strides"),H.padding=B.padding==null?"valid":B.padding,H.dataFormat=B.dataFormat==null?"channelsLast":B.dataFormat,ct(H.dataFormat),on(H.padding),H.inputSpec=[new Eo({ndim:4})],H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){B=Hn(B);var H=this.dataFormat==="channelsFirst"?B[2]:B[1],ue=this.dataFormat==="channelsFirst"?B[3]:B[2];return H=Iu(H,this.poolSize[0],this.padding,this.strides[0]),ue=Iu(ue,this.poolSize[1],this.padding,this.strides[1]),this.dataFormat==="channelsFirst"?[B[0],B[1],H,ue]:[B[0],H,ue,B[3]]},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){return ue.invokeCallHook(B,H),ue.poolingFunction(Yr(B),ue.poolSize,ue.strides,ue.padding,ue.dataFormat)})},ne.prototype.getConfig=function(){var B={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne}(fo),ku=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.poolingFunction=function(B,H,ue,Le,Qe){return ct(Qe),on(Le),hh(B,H,ue,Le,Qe,"max")},ne.className="MaxPooling2D",ne}(hd);s.serialization.registerClass(ku);var pd=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.poolingFunction=function(B,H,ue,Le,Qe){return ct(Qe),on(Le),hh(B,H,ue,Le,Qe,"avg")},ne.className="AveragePooling2D",ne}(hd);s.serialization.registerClass(pd);var ph=function(ae){function ne(B){var H=this;if(B.poolSize==null&&(B.poolSize=[2,2,2]),(H=ae.call(this,B)||this).poolSize=Array.isArray(B.poolSize)?B.poolSize:[B.poolSize,B.poolSize,B.poolSize],B.strides==null)H.strides=H.poolSize;else if(Array.isArray(B.strides)){if(B.strides.length!==3)throw new V("If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length "+B.strides.length+".");H.strides=B.strides}else H.strides=[B.strides,B.strides,B.strides];return Mt(H.poolSize,"poolSize"),Mt(H.strides,"strides"),H.padding=B.padding==null?"valid":B.padding,H.dataFormat=B.dataFormat==null?"channelsLast":B.dataFormat,ct(H.dataFormat),on(H.padding),H.inputSpec=[new Eo({ndim:5})],H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){B=Hn(B);var H=this.dataFormat==="channelsFirst"?B[2]:B[1],ue=this.dataFormat==="channelsFirst"?B[3]:B[2],Le=this.dataFormat==="channelsFirst"?B[4]:B[3];return H=Iu(H,this.poolSize[0],this.padding,this.strides[0]),ue=Iu(ue,this.poolSize[1],this.padding,this.strides[1]),Le=Iu(Le,this.poolSize[2],this.padding,this.strides[2]),this.dataFormat==="channelsFirst"?[B[0],B[1],H,ue,Le]:[B[0],H,ue,Le,B[4]]},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){return ue.invokeCallHook(B,H),ue.poolingFunction(Yr(B),ue.poolSize,ue.strides,ue.padding,ue.dataFormat)})},ne.prototype.getConfig=function(){var B={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne}(fo),Ip=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.poolingFunction=function(B,H,ue,Le,Qe){return ct(Qe),on(Le),Ef(B,H,ue,Le,Qe,"max")},ne.className="MaxPooling3D",ne}(ph);s.serialization.registerClass(Ip);var Vm=function(ae){function ne(B){return ae.call(this,B)||this}return v(ne,ae),ne.prototype.poolingFunction=function(B,H,ue,Le,Qe){return ct(Qe),on(Le),Ef(B,H,ue,Le,Qe,"avg")},ne.className="AveragePooling3D",ne}(ph);s.serialization.registerClass(Vm);var mh=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.inputSpec=[new Eo({ndim:3})],H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){return[B[0],B[2]]},ne.prototype.call=function(B,H){throw new N},ne}(fo),md=function(ae){function ne(B){return ae.call(this,B||{})||this}return v(ne,ae),ne.prototype.call=function(B,H){return Object(s.tidy)(function(){var ue=Yr(B);return Object(s.mean)(ue,1)})},ne.className="GlobalAveragePooling1D",ne}(mh);s.serialization.registerClass(md);var $m=function(ae){function ne(B){return ae.call(this,B||{})||this}return v(ne,ae),ne.prototype.call=function(B,H){return Object(s.tidy)(function(){var ue=Yr(B);return Object(s.max)(ue,1)})},ne.className="GlobalMaxPooling1D",ne}(mh);s.serialization.registerClass($m);var Hm=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.dataFormat=B.dataFormat==null?"channelsLast":B.dataFormat,ct(H.dataFormat),H.inputSpec=[new Eo({ndim:4})],H}return v(ne,ae),ne.prototype.computeOutputShape=function(B){return B=B,this.dataFormat==="channelsLast"?[B[0],B[3]]:[B[0],B[1]]},ne.prototype.call=function(B,H){throw new N},ne.prototype.getConfig=function(){var B={dataFormat:this.dataFormat},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne}(fo),gn=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le=Yr(B);return ue.dataFormat==="channelsLast"?Object(s.mean)(Le,[1,2]):Object(s.mean)(Le,[2,3])})},ne.className="GlobalAveragePooling2D",ne}(Hm);s.serialization.registerClass(gn);var Hu=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le=Yr(B);return ue.dataFormat==="channelsLast"?Object(s.max)(Le,[1,2]):Object(s.max)(Le,[2,3])})},ne.className="GlobalMaxPooling2D",ne}(Hm);function Yn(ae,ne,B,H){if(Array.isArray(ae)){if(ne!=null||B!=null)throw new V("When input
3849s is an array, neither initialState or constants should be provided");H!=null&&(B=ae.slice(ae.length-H,ae.length),ae=ae.slice(0,ae.length-H)),ae.length>1&&(ne=ae.slice(1,ae.length)),ae=ae[0]}function ue(Le){return Le==null||Array.isArray(Le)?Le:[Le]}return{inputs:ae,initialState:ne=ue(ne),constants:B=ue(B)}}function Eu(ae,ne,B,H,ue,Le,Qe,wt){return H===void 0&&(H=!1),Qe===void 0&&(Qe=!1),wt===void 0&&(wt=!1),Object(s.tidy)(function(){var qt=ne.shape.length;if(qt<3)throw new V("Input should be at least 3D, but is "+qt+"D.");var en=[1,0].concat(Ar(2,qt));if(ne=Object(s.transpose)(ne,en),Le!=null)throw new N("The rnn() functoin of the deeplearn.js backend does not support constants yet.");Qe&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),ue!=null&&((ue=ue.asType("bool").asType("float32")).rank===qt-1&&(ue=Object(s.expandDims)(ue,-1)),ue=Object(s.transpose)(ue,en)),H&&(ne=Object(s.reverse)(ne,0),ue!=null&&(ue=Object(s.reverse)(ue,0)));var gt,Tn,Pn=[],zn=B,Jn=ne.shape[0],Vn=Object(s.unstack)(ne);ue!=null&&(Tn=Object(s.unstack)(ue));for(var lr,dr=function(Hr){var oi=Vn[Hr],Br=Object(s.tidy)(function(){return ae(oi,zn)});if(ue==null)gt=Br[0],zn=Br[1];else{var ui=Object(s.tidy)(function(){var ii=Tn[Hr],Ci=Object(s.onesLike)(ii).sub(ii);return{output:Br[0].mul(ii).addStrict(zn[0].mul(Ci)),newStates:zn.map(function(Di,si){return Br[1][si].mul(ii).addStrict(Di.mul(Ci))})}});gt=ui.output,zn=ui.newStates}wt&&Pn.push(gt)},Tr=0;Tr<Jn;++Tr)dr(Tr);return wt&&(lr=Object(s.stack)(Pn,1)),[gt,lr,zn]})}s.serialization.registerClass(Hu);var Oo=function(ae){function ne(B){var H,ue=ae.call(this,B)||this;if(B.cell==null)throw new V("cell property is missing for the constructor of RNN.");if((H=Array.isArray(B.cell)?new El({cells:B.cell}):B.cell).stateSize==null)throw new V("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");return ue.cell=H,ue.returnSequences=B.returnSequences!=null&&B.returnSequences,ue.returnState=B.returnState!=null&&B.returnState,ue.goBackwards=B.goBackwards!=null&&B.goBackwards,ue._stateful=B.stateful!=null&&B.stateful,ue.unroll=B.unroll!=null&&B.unroll,ue.supportsMasking=!0,ue.inputSpec=[new Eo({ndim:3})],ue.stateSpec=null,ue.states_=null,ue.numConstants=null,ue.keptStates=[],ue}return v(ne,ae),ne.prototype.getStates=function(){return this.states_==null?Ar(0,Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1).map(function(B){return null}):this.states_},ne.prototype.setStates=function(B){this.states_=B},ne.prototype.computeOutputShape=function(B){Ji(B)&&(B=B[0]),B=B;var H=this.cell.stateSize;Array.isArray(H)||(H=[H]);var ue,Le=H[0];if(ue=this.returnSequences?[B[0],B[1],Le]:[B[0],Le],this.returnState){for(var Qe=[],wt=0,qt=H;wt<qt.length;wt++){var en=qt[wt];Qe.push([B[0],en])}return[ue].concat(Qe)}return ue},ne.prototype.computeMask=function(B,H){var ue=this;return Object(s.tidy)(function(){Array.isArray(H)&&(H=H[0]);var Le=ue.returnSequences?H:null;if(ue.returnState){var Qe=ue.states.map(function(wt){return null});return[Le].concat(Qe)}return Le})},Object.defineProperty(ne.prototype,"states",{get:function(){if(this.states_==null){for(var B=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,H=[],ue=0;ue<B;++ue)H.push(null);return H}return this.states_},set:function(B){this.states_=B},enumerable:!0,configurable:!0}),ne.prototype.build=function(B){if(this.numConstants!=null)throw new N("Constants support is not implemented in RNN yet.");Ji(B)&&(B=B[0]),B=B;var H=this.stateful?B[0]:null,ue=B[B.length-1];this.inputSpec[0]=new Eo({shape:[H,null,ue]});var Le,Qe=[B[0]].concat(B.slice(2));if(this.cell.build(Qe),Le=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],this.stateSpec!=null){if(!s.util.arraysEqual(this.stateSpec.map(function(wt){return wt.shape[wt.shape.length-1]}),Le))throw new V("An initialState was passed that is not compatible with cell.stateSize. Received stateSpec="+this.stateSpec+"; However cell.stateSize is "+this.cell.stateSize)}else this.stateSpec=Le.map(function(wt){return new Eo({shape:[null,wt]})});this.stateful&&this.resetStates()},ne.prototype.resetStates=function(B,H){var ue=this;H===void 0&&(H=!1),Object(s.tidy)(function(){if(!ue.stateful)throw new P("Cannot call resetStates() on an RNN Layer that is not stateful.");var Le=ue.inputSpec[0].shape[0];if(Le==null)throw new V("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(ue.states_==null)Array.isArray(ue.cell.stateSize)?ue.states_=ue.cell.stateSize.map(function(gt){return Object(s.zeros)([Le,gt])}):ue.states_=[Object(s.zeros)([Le,ue.cell.stateSize])];else if(B==null)Object(s.dispose)(ue.states_),ue.keptStates!=null&&(Object(s.dispose)(ue.keptStates),ue.keptStates=[]),Array.isArray(ue.cell.stateSize)?ue.states_=ue.cell.stateSize.map(function(gt){return Object(s.zeros)([Le,gt])}):ue.states_[0]=Object(s.zeros)([Le,ue.cell.stateSize]);else{if(Array.isArray(B)||(B=[B]),B.length!==ue.states_.length)throw new V("Layer "+ue.name+" expects "+ue.states_.length+" state(s), but it received "+B.length+" state value(s). Input received: "+B);H===!0?ue.keptStates.push(ue.states_.slice()):Object(s.dispose)(ue.states_);for(var Qe=0;Qe<ue.states_.length;++Qe){var wt=B[Qe],qt=Array.isArray(ue.cell.stateSize)?ue.cell.stateSize[Qe]:ue.cell.stateSize,en=[Le,qt];if(!s.util.arraysEqual(wt.shape,en))throw new V("State "+Qe+" is incompatible with layer "+ue.name+": expected shape="+en+", received shape="+wt.shape);ue.states_[Qe]=wt}}ue.states_=ue.states_.map(function(gt){return Object(s.keep)(gt.clone())})})},ne.prototype.apply=function(B,H){var ue=H==null?null:H.initialState,Le=H==null?null:H.constants;H==null&&(H={});var Qe=Yn(B,ue,Le,this.numConstants);
3849B=Qe.inputs,ue=Qe.initialState,Le=Qe.constants;var wt=[],qt=[];if(ue!=null){H.initialState=ue,wt=wt.concat(ue),this.stateSpec=[];for(var en=0,gt=ue;en<gt.length;en++){var Tn=gt[en];this.stateSpec.push(new Eo({shape:Tn.shape}))}qt=qt.concat(this.stateSpec)}if(Le!=null&&(H.constants=Le,wt=wt.concat(Le),this.numConstants=Le.length),wt[0]instanceof Yo){var Pn=[B].concat(wt),zn=this.inputSpec.concat(qt),Jn=this.inputSpec;this.inputSpec=zn;var Vn=ae.prototype.apply.call(this,Pn,H);return this.inputSpec=Jn,Vn}return ae.prototype.apply.call(this,B,H)},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le=H==null?null:H.mask,Qe=H==null?null:H.training,wt=H==null?null:H.initialState;B=Yr(B),wt==null&&(wt=ue.stateful?ue.states_:ue.getInitialState(B));var qt=Array.isArray(ue.cell.stateSize)?ue.cell.stateSize.length:1;if(wt.length!==qt)throw new V("RNN Layer has "+qt+" state(s) but was passed "+wt.length+" initial state(s).");ue.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");var en={training:Qe},gt=Eu(function(Vn,lr){var dr=ue.cell.call([Vn].concat(lr),en);return[dr[0],dr.slice(1)]},B,wt,ue.goBackwards,Le,null,ue.unroll,ue.returnSequences),Tn=gt[0],Pn=gt[1],zn=gt[2];ue.stateful&&ue.resetStates(zn,Qe);var Jn=ue.returnSequences?Pn:Tn;return ue.returnState?[Jn].concat(zn):Jn})},ne.prototype.getInitialState=function(B){var H=this;return Object(s.tidy)(function(){var ue=Object(s.zeros)(B.shape);return ue=xr(ue=Object(s.sum)(ue,[1,2])),Array.isArray(H.cell.stateSize)?H.cell.stateSize.map(function(Le){return Le>1?ti(ue,[1,Le]):ue}):H.cell.stateSize>1?[ti(ue,[1,H.cell.stateSize])]:[ue]})},Object.defineProperty(ne.prototype,"trainableWeights",{get:function(){return this.trainable?this.cell.trainableWeights:[]},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights},enumerable:!0,configurable:!0}),ne.prototype.setFastWeightInitDuringBuild=function(B){ae.prototype.setFastWeightInitDuringBuild.call(this,B),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(B)},ne.prototype.getConfig=function(){var B={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(B.numConstants=this.numConstants);var H=this.cell.getConfig();B.cell={className:this.cell.getClassName(),config:H};var ue=ae.prototype.getConfig.call(this);return Object.assign(B,ue),B},ne.fromConfig=function(B,H,ue){ue===void 0&&(ue={});var Le=ys(H.cell,ue);return new B(Object.assign(H,{cell:Le}))},ne.className="RNN",ne}(fo);s.serialization.registerClass(Oo);var gd=function(ae){function ne(){return ae!==null&&ae.apply(this,arguments)||this}return v(ne,ae),ne}(fo),gh=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.DEFAULT_ACTIVATION="tanh",H.DEFAULT_KERNEL_INITIALIZER="glorotNormal",H.DEFAULT_RECURRENT_INITIALIZER="orthogonal",H.DEFAULT_BIAS_INITIALIZER="zeros",H.units=B.units,Mt(H.units,"units"),H.activation=va(B.activation==null?H.DEFAULT_ACTIVATION:B.activation),H.useBias=B.useBias==null||B.useBias,H.kernelInitializer=Zr(B.kernelInitializer||H.DEFAULT_KERNEL_INITIALIZER),H.recurrentInitializer=Zr(B.recurrentInitializer||H.DEFAULT_RECURRENT_INITIALIZER),H.biasInitializer=Zr(B.biasInitializer||H.DEFAULT_BIAS_INITIALIZER),H.kernelRegularizer=za(B.kernelRegularizer),H.recurrentRegularizer=za(B.recurrentRegularizer),H.biasRegularizer=za(B.biasRegularizer),H.kernelConstraint=yn(B.kernelConstraint),H.recurrentConstraint=yn(B.recurrentConstraint),H.biasConstraint=yn(B.biasConstraint),H.dropout=Xn([1,Fn([0,B.dropout==null?0:B.dropout])]),H.recurrentDropout=Xn([1,Fn([0,B.recurrentDropout==null?0:B.recurrentDropout])]),H.stateSize=H.units,H.dropoutMask=null,H.recurrentDropoutMask=null,H}return v(ne,ae),ne.prototype.build=function(B){B=Hn(B),this.kernel=this.addWeight("kernel",[B[B.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){if((B=B).length!==2)throw new V("SimpleRNNCell expects 2 input Tensors, got "+B.length+".");var Le=B[1];B=B[0];var Qe,wt=H.training!=null&&H.training;0<ue.dropout&&ue.dropout<1&&ue.dropoutMask==null&&(ue.dropoutMask=qu(function(){return Object(s.onesLike)(B)},ue.dropout,wt)),0<ue.recurrentDropout&&ue.recurrentDropout<1&&ue.recurrentDropoutMask==null&&(ue.recurrentDropoutMask=qu(function(){return Object(s.onesLike)(Le)},ue.recurrentDropout,wt));var qt=ue.dropoutMask,en=ue.recurrentDropoutMask;
3849Qe=yi(qt!=null?Object(s.mul)(B,qt):B,ue.kernel.read()),ue.bias!=null&&(Qe=Ft(Qe,ue.bias.read())),en!=null&&(Le=Object(s.mul)(Le,en));var gt=Object(s.add)(Qe,yi(Le,ue.recurrentKernel.read()));return ue.activation!=null&&(gt=ue.activation.apply(gt)),[gt,gt]})},ne.prototype.getConfig=function(){var B={units:this.units,activation:eu(this.activation),useBias:this.useBias,kernelInitializer:pr(this.kernelInitializer),recurrentInitializer:pr(this.recurrentInitializer),biasInitializer:pr(this.biasInitializer),kernelRegularizer:to(this.kernelRegularizer),recurrentRegularizer:to(this.recurrentRegularizer),biasRegularizer:to(this.biasRegularizer),activityRegularizer:to(this.activityRegularizer),kernelConstraint:Vt(this.kernelConstraint),recurrentConstraint:Vt(this.recurrentConstraint),biasConstraint:Vt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="SimpleRNNCell",ne}(gd);s.serialization.registerClass(gh);var fr=function(ae){function ne(B){return B.cell=new gh(B),ae.call(this,B)||this}return v(ne,ae),ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.cell.dropoutMask!=null&&(Object(s.dispose)(ue.cell.dropoutMask),ue.cell.dropoutMask=null),ue.cell.recurrentDropoutMask!=null&&(Object(s.dispose)(ue.cell.recurrentDropoutMask),ue.cell.recurrentDropoutMask=null);var Le=H==null?null:H.mask,Qe=H==null?null:H.training,wt=H==null?null:H.initialState;return ae.prototype.call.call(ue,B,{mask:Le,training:Qe,initialState:wt})})},Object.defineProperty(ne.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),ne.prototype.getConfig=function(){var B={units:this.units,activation:eu(this.activation),useBias:this.useBias,kernelInitializer:pr(this.kernelInitializer),recurrentInitializer:pr(this.recurrentInitializer),biasInitializer:pr(this.biasInitializer),kernelRegularizer:to(this.kernelRegularizer),recurrentRegularizer:to(this.recurrentRegularizer),biasRegularizer:to(this.biasRegularizer),activityRegularizer:to(this.activityRegularizer),kernelConstraint:Vt(this.kernelConstraint),recurrentConstraint:Vt(this.recurrentConstraint),biasConstraint:Vt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},H=ae.prototype.getConfig.call(this);return delete H.cell,Object.assign(B,H),B},ne.fromConfig=function(B,H){return new B(H)},ne.className="SimpleRNN",ne}(Oo);s.serialization.registerClass(fr);var js=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.DEFAULT_ACTIVATION="tanh",H.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",H.DEFAULT_KERNEL_INITIALIZER="glorotNormal",H.DEFAULT_RECURRENT_INITIALIZER="orthogonal",H.DEFAULT_BIAS_INITIALIZER="zeros",H.units=B.units,Mt(H.units,"units"),H.activation=va(B.activation===void 0?H.DEFAULT_ACTIVATION:B.activation),H.recurrentActivation=va(B.recurrentActivation===void 0?H.DEFAULT_RECURRENT_ACTIVATION:B.recurrentActivation),H.useBias=B.useBias==null||B.useBias,H.kernelInitializer=Zr(B.
3849kernelInitializer||H.DEFAULT_KERNEL_INITIALIZER),H.recurrentInitializer=Zr(B.recurrentInitializer||H.DEFAULT_RECURRENT_INITIALIZER),H.biasInitializer=Zr(B.biasInitializer||H.DEFAULT_BIAS_INITIALIZER),H.kernelRegularizer=za(B.kernelRegularizer),H.recurrentRegularizer=za(B.recurrentRegularizer),H.biasRegularizer=za(B.biasRegularizer),H.kernelConstraint=yn(B.kernelConstraint),H.recurrentConstraint=yn(B.recurrentConstraint),H.biasConstraint=yn(B.biasConstraint),H.dropout=Xn([1,Fn([0,B.dropout==null?0:B.dropout])]),H.recurrentDropout=Xn([1,Fn([0,B.recurrentDropout==null?0:B.recurrentDropout])]),H.implementation=B.implementation,H.stateSize=H.units,H.dropoutMask=null,H.recurrentDropoutMask=null,H}return v(ne,ae),ne.prototype.build=function(B){var H=(B=Hn(B))[B.length-1];this.kernel=this.addWeight("kernel",[H,3*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,3*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[3*this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){if((B=B).length!==2)throw new V("GRUCell expects 2 input Tensors (inputs, h, c), got "+B.length+".");var Le=H.training!=null&&H.training,Qe=B[1];B=B[0],0<ue.dropout&&ue.dropout<1&&ue.dropoutMask==null&&(ue.dropoutMask=qu(function(){return Object(s.onesLike)(B)},ue.dropout,Le,3)),0<ue.recurrentDropout&&ue.recurrentDropout<1&&ue.recurrentDropoutMask==null&&(ue.recurrentDropoutMask=qu(function(){return Object(s.onesLike)(Qe)},ue.recurrentDropout,Le,3));var wt,qt,en,gt=ue.dropoutMask,Tn=ue.recurrentDropoutMask;0<ue.dropout&&ue.dropout<1&&(B=Object(s.mul)(B,gt[0]));var Pn=yi(B,ue.kernel.read());ue.useBias&&(Pn=Ft(Pn,ue.bias.read())),0<ue.recurrentDropout&&ue.recurrentDropout<1&&(Qe=Object(s.mul)(Qe,Tn[0]));var zn=ue.recurrentKernel.read(),Jn=Object(s.split)(zn,[2*ue.units,ue.units],zn.rank-1),Vn=Jn[0],lr=Jn[1],dr=yi(Qe,Vn),Tr=Object(s.split)(Pn,3,Pn.rank-1),Hr=Tr[0],oi=Tr[1],Br=Tr[2],ui=Object(s.split)(dr,2,dr.rank-1),ii=ui[0],Ci=ui[1];wt=ue.recurrentActivation.apply(Object(s.add)(Hr,ii)),qt=ue.recurrentActivation.apply(Object(s.add)(oi,Ci));var Di=yi(Object(s.mul)(qt,Qe),lr);en=ue.activation.apply(Object(s.add)(Br,Di));var si=Object(s.add)(Object(s.mul)(wt,Qe),Object(s.mul)(Object(s.add)(1,Object(s.neg)(wt)),en));return[si,si]})},ne.prototype.getConfig=function(){var B={units:this.units,activation:eu(this.activation),recurrentActivation:eu(this.recurrentActivation),useBias:this.useBias,kernelInitializer:pr(this.kernelInitializer),recurrentInitializer:pr(this.recurrentInitializer),biasInitializer:pr(this.biasInitializer),kernelRegularizer:to(this.kernelRegularizer),recurrentRegularizer:to(this.recurrentRegularizer),biasRegularizer:to(this.biasRegularizer),activityRegularizer:to(this.activityRegularizer),kernelConstraint:Vt(this.kernelConstraint),recurrentConstraint:Vt(this.recurrentConstraint),biasConstraint:Vt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="GRUCell",ne}(gd);s.serialization.registerClass(js);var as=function(ae){function ne(B){return B.implementation===0&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),B.cell=new js(B),ae.call(this,B)||this}return v(ne,ae),ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.cell.dropoutMask!=null&&(Object(s.dispose)(ue.cell.dropoutMask),ue.cell.dropoutMask=null),ue.cell.recurrentDropoutMask!=null&&(Object(s.dispose)(ue.cell.recurrentDropoutMask),ue.cell.recurrentDropoutMask=null);var Le=H==null?null:H.mask,Qe=H==null?null:H.training,wt=H==null?null:H.initialState;return ae.prototype.call.call(ue,B,{mask:Le,training:Qe,initialState:wt})})},Object.defineProperty(ne.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),ne.prototype.getConfig=function(){var B={units:this.units,activation:eu(this.activation),recurrentActivation:eu(this.recurrentActivation),useBias:this.useBias,kernelInitializer:pr(this.kernelInitializer),recurrentInitializer:pr(this.recurrentInitializer),biasInitializer:pr(this.biasInitializer),kernelRegularizer:to(this.kernelRegularizer),recurrentRegularizer:to(this.recurrentRegularizer),biasRegularizer:to(this.biasRegularizer),activityRegularizer:to(this.activityRegularizer),kernelConstraint:Vt(this.kernelConstraint),recurrentConstraint:Vt(this.recurrentConstraint),biasConstraint:Vt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},H=ae.prototype.getConfig.call(this);return delete H.cell,Object.assign(B,H),B},ne.fromConfig=function(B,H){return H.implmentation===0&&(H.implementation=1),new B(H)},ne.className="GRU",ne}(Oo);s.serialization.registerClass(as);var ho=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.DEFAULT_ACTIVATION="tanh",H.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",H.DEFAULT_KERNEL_INITIALIZER="glorotNormal",H.DEFAULT_RECURRENT_INITIALIZER="orthogonal",H.DEFAULT_BIAS_INITIALIZER="zeros",H.units=B.units,Mt(H.units,"units"),H.activation=va(B.activation===void 0?H.DEFAULT_ACTIVATION:B.activation),H.recurrentActivation=va(B.recurrentActivation===void 0?H.DEFAULT_RECURRENT_ACTIVATION:B.recurrentActivation),H.useBias=B.useBias==null||B.useBias,H.kernelInitializer=Zr(B.
3849kernelInitializer||H.DEFAULT_KERNEL_INITIALIZER),H.recurrentInitializer=Zr(B.recurrentInitializer||H.DEFAULT_RECURRENT_INITIALIZER),H.biasInitializer=Zr(B.biasInitializer||H.DEFAULT_BIAS_INITIALIZER),H.unitForgetBias=B.unitForgetBias,H.kernelRegularizer=za(B.kernelRegularizer),H.recurrentRegularizer=za(B.recurrentRegularizer),H.biasRegularizer=za(B.biasRegularizer),H.kernelConstraint=yn(B.kernelConstraint),H.recurrentConstraint=yn(B.recurrentConstraint),H.biasConstraint=yn(B.biasConstraint),H.dropout=Xn([1,Fn([0,B.dropout==null?0:B.dropout])]),H.recurrentDropout=Xn([1,Fn([0,B.recurrentDropout==null?0:B.recurrentDropout])]),H.implementation=B.implementation,H.stateSize=[H.units,H.units],H.dropoutMask=null,H.recurrentDropoutMask=null,H}return v(ne,ae),ne.prototype.build=function(B){var H,ue,Le=(B=Hn(B))[B.length-1];if(this.kernel=this.addWeight("kernel",[Le,4*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,4*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){if(this.unitForgetBias){var Qe=this.biasInitializer,wt=this.units;ue=new((H=function(qt){function en(){return qt!==null&&qt.apply(this,arguments)||this}return v(en,qt),en.prototype.apply=function(gt,Tn){var Pn=Qe.apply([wt]),zn=new it().apply([wt]),Jn=Qe.apply([2*wt]);return Ir(Ir(Pn,zn),Jn)},en}(Ae)).className="CustomInit",H)}else ue=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,ue,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le=H.training!=null&&H.training;if((B=B).length!==3)throw new V("LSTMCell expects 3 input Tensors (inputs, h, c), got "+B.length+".");var Qe=B[1],wt=B[2];B=B[0],0<ue.dropout&&ue.dropout<1&&ue.dropoutMask==null&&(ue.dropoutMask=qu(function(){return Object(s.onesLike)(B)},ue.dropout,Le,4)),0<ue.recurrentDropout&&ue.recurrentDropout<1&&ue.recurrentDropoutMask==null&&(ue.recurrentDropoutMask=qu(function(){return Object(s.onesLike)(Qe)},ue.recurrentDropout,Le,4));var qt,en,gt,Tn,Pn=ue.dropoutMask,zn=ue.recurrentDropoutMask;0<ue.dropout&&ue.dropout<1&&(B=Object(s.mul)(B,Pn[0]));var Jn=yi(B,ue.kernel.read());0<ue.recurrentDropout&&ue.recurrentDropout<1&&(Qe=Object(s.mul)(Qe,zn[0])),Jn=Object(s.add)(Jn,yi(Qe,ue.recurrentKernel.read())),ue.useBias&&(Jn=Ft(Jn,ue.bias.read()));var Vn=Object(s.split)(Jn,4,Jn.rank-1),lr=Vn[0],dr=Vn[1],Tr=Vn[2],Hr=Vn[3];qt=ue.recurrentActivation.apply(lr),en=ue.recurrentActivation.apply(dr),gt=Object(s.add)(Object(s.mul)(en,wt),Object(s.mul)(qt,ue.activation.apply(Tr))),Tn=ue.recurrentActivation.apply(Hr);var oi=Object(s.mul)(Tn,ue.activation.apply(gt));return[oi,oi,gt]})},ne.prototype.getConfig=function(){var B={units:this.units,activation:eu(this.activation),recurrentActivation:eu(this.recurrentActivation),useBias:this.useBias,kernelInitializer:pr(this.kernelInitializer),recurrentInitializer:pr(this.recurrentInitializer),biasInitializer:pr(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:to(this.kernelRegularizer),recurrentRegularizer:to(this.recurrentRegularizer),biasRegularizer:to(this.biasRegularizer),activityRegularizer:to(this.activityRegularizer),kernelConstraint:Vt(this.kernelConstraint),recurrentConstraint:Vt(this.recurrentConstraint),biasConstraint:Vt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.className="LSTMCell",ne}(gd);s.serialization.registerClass(ho);var Mc=function(ae){function ne(B){return B.implementation===0&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),B.cell=new ho(B),ae.call(this,B)||this}return v(ne,ae),ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){ue.cell.dropoutMask!=null&&(Object(s.dispose)(ue.cell.dropoutMask),ue.cell.dropoutMask=null),ue.cell.recurrentDropoutMask!=null&&(Object(s.dispose)(ue.cell.recurrentDropoutMask),ue.cell.recurrentDropoutMask=null);var Le=H==null?null:H.mask,Qe=H==null?null:H.training,wt=H==null?null:H.initialState;return ae.prototype.call.call(ue,B,{mask:Le,training:Qe,initialState:wt})})}
vendor: 4,217 bytes, line 3849
3849,Object.defineProperty(ne.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"unitForgetBias",{get:function(){return this.cell.unitForgetBias},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),ne.prototype.getConfig=function(){var B={units:this.units,activation:eu(this.activation),recurrentActivation:eu(this.recurrentActivation),useBias:this.useBias,kernelInitializer:pr(this.kernelInitializer),recurrentInitializer:pr(this.recurrentInitializer),biasInitializer:pr(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:to(this.kernelRegularizer),recurrentRegularizer:to(this.recurrentRegularizer),biasRegularizer:to(this.biasRegularizer),activityRegularizer:to(this.activityRegularizer),kernelConstraint:Vt(this.kernelConstraint),recurrentConstraint:Vt(this.recurrentConstraint),biasConstraint:Vt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},H=ae.prototype.getConfig.call(this);return delete H.cell,Object.assign(B,H),B},ne.fromConfig=function(B,H){return H.implmentation===0&&(H.implementation=1),new B(H)},ne.className="LSTM",ne}(Oo);s.serialization.registerClass(Mc);var El=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.cells=B.cells,H}return v(ne,ae),Object.defineProperty(ne.prototype,"stateSize",{get:function(){for(var B=[],H=0,ue=this.cells.slice().reverse();H<ue.length;H++){var Le=ue[H];Array.isArray(Le.stateSize)?B.push.apply(B,Le.stateSize):B.push(Le.stateSize)}return B},enumerable:!0,configurable:!0}),ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){for(var Le=(B=B).slice(1),Qe=[],wt=0,qt=ue.cells.slice().reverse();wt<qt.length;wt++){var en=qt[wt];Array.isArray(en.stateSize)?Qe.push(Le.splice(0,en.stateSize.length)):Qe.push(Le.splice(0,1))}Qe.reverse();for(var gt,Tn=[],Pn=0;Pn<ue.cells.length;++Pn)en=ue.cells[Pn],Le=Qe[Pn],gt=Pn===0?[B[0]].concat(Le):[gt[0]].concat(Le),gt=en.call(gt,H),Tn.push(gt.slice(1));Le=[];for(var zn=0,Jn=Tn.slice().reverse();zn<Jn.length;zn++){var Vn=Jn[zn];Le.push.apply(Le,Vn)}return[gt[0]].concat(Le)})},ne.prototype.build=function(B){var H;
3849Ji(B)&&(B=B[0]),B=B,this.cells.forEach(function(ue,Le){jn("RNNCell_"+Le,function(){ue.build(B),H=Array.isArray(ue.stateSize)?ue.stateSize[0]:ue.stateSize,B=[B[0],H]})}),this.built=!0},ne.prototype.getConfig=function(){for(var B=[],H=0,ue=this.cells;H<ue.length;H++){var Le=ue[H];B.push({className:Le.getClassName(),config:Le.getConfig()})}var Qe={cells:B},wt=ae.prototype.getConfig.call(this);return Object.assign(Qe,wt),Qe},ne.fromConfig=function(B,H,ue){ue===void 0&&(ue={});for(var Le=[],Qe=0,wt=H.cells;Qe<wt.length;Qe++){var qt=wt[Qe];Le.push(ys(qt,ue))}return new B({cells:Le})},Object.defineProperty(ne.prototype,"trainableWeights",{get:function(){if(!this.trainable)return[];for(var B=[],H=0,ue=this.cells;H<ue.length;H++){var Le=ue[H];B.push.apply(B,Le.trainableWeights)}return B},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"nonTrainableWeights",{get:function(){for(var B=[],H=0,ue=this.cells;H<ue.length;H++){var Le=ue[H];B.push.apply(B,Le.nonTrainableWeights)}if(!this.trainable){for(var Qe=[],wt=0,qt=this.cells;wt<qt.length;wt++)Le=qt[wt],Qe.push.apply(Qe,Le.trainableWeights);return Qe.concat(B)}return B},enumerable:!0,configurable:!0}),ne.prototype.getWeights=function(){for(var B=[],H=0,ue=this.cells;H<ue.length;H++){var Le=ue[H];B.push.apply(B,Le.weights)}return Io(B)},ne.prototype.setWeights=function(B){for(var H=[],ue=0,Le=this.cells;ue<Le.length;ue++)for(var Qe=Le[ue],wt=Qe.weights.length,qt=B.splice(wt),en=0;en<Qe.weights.length;++en)H.push([Qe.weights[en],qt[en]]);Ko(H)},ne.className="StackedRNNCells",ne}(gd);function qu(ae,ne,B,H){function ue(){return Qr(ae(),ne)}if(B===void 0&&(B=null),H===void 0&&(H=1),H>1){for(var Le=[],Qe=0;Qe<H;Qe++)Le.push(Zt(ue,ae,B));return Le.map(function(wt){return Object(s.keep)(wt.clone())})}return Object(s.keep)(Zt(ue,ae,B).clone())}s.serialization.registerClass(El);var Cl=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.layer=B.layer,H}return v(ne,ae),ne.prototype.build=function(B){this.built=!0},Object.defineProperty(ne.prototype,"trainable",{get:function(){return this.layer!=null&&this.layer.trainable},set:function(B){this.layer!=null&&(this.layer.trainable=B)},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"trainableWeights",{get:function(){return this.layer.trainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"nonTrainableWeights",{get:function(){return this.layer.nonTrainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"updates",{get:function(){return this.layer._updates},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"losses",{get:function(){return this.layer.losses},enumerable:!0,configurable:!0}),ne.prototype.getWeights=function(){return this.layer.getWeights()},ne.prototype.setWeights=function(B){this.layer.setWeights(B)},ne.prototype.getConfig=function(){var B={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.prototype.setFastWeightInitDuringBuild=function(B){ae.prototype.setFastWeightInitDuringBuild.call(this,B),this.layer!=null&&this.layer.setFastWeightInitDuringBuild(B)},ne.fromConfig=function(B,H,ue){ue===void 0&&(ue={});var Le=ys(H.layer,ue);delete H.layer;var Qe={layer:Le};return Object.assign(Qe,H),new B(Qe)},ne}(fo),Oa=function(ae){function ne(B){var H=ae.call(this,B)||this;return H.supportsMasking=!0,H}return v(ne,ae),ne.prototype.build=function(B){if((B=Hn(B)).length<3)throw new V("TimeDistributed layer expects an input shape >= 3D, but received input shape "+JSON.stringify(B));this.inputSpec=[{shape:B}];var H=[B[0]].concat(B.slice(2));this.layer.built||(this.layer.build(H),this.layer.built=!0),ae.prototype.build.call(this,B)},ne.prototype.computeOutputShape=function(B){var H=[(B=Hn(B))[0]].concat(B.slice(2)),ue=this.layer.computeOutputShape(H),Le=B[1];return[ue[0],Le].concat(ue.slice(1))},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){return Eu(function(Le,Qe){return[Yr(ue.layer.call(Le,H)),[]]},B=Yr(B),[],!1,null,null,!1,!0)[1]})},ne.className="TimeDistributed",ne}(Cl);s.serialization.registerClass(Oa);var rl="concat",Gu=function(ae){function ne(B){var H=ae.call(this,B)||this,ue=B.layer.getConfig(),Le={};Le.className=B.layer.getClassName(),Le.config=ue,H.forwardLayer=ys(Le),ue.goBackwards=ue.goBackwards!==!0;var Qe={};if(Qe.className=B.layer.getClassName(),Qe.config=ue,H.backwardLayer=ys(Qe),H.forwardLayer.name="forward_"+H.forwardLayer.name,H.backwardLayer.name="backward_"+H.backwardLayer.name,H.mergeMode=B.mergeMode===void 0?rl:B.mergeMode,function(wt){Ot(dt,"BidirectionalMergeMode",wt)}(H.mergeMode),B.weights)throw new N("weights support is not implemented for Bidirectional layer yet.");return H._stateful=B.layer.stateful,H.returnSequences=B.layer.returnSequences,H.returnState=B.layer.returnState,H.supportsMasking=!0,H._trainable=!0,H.inputSpec=B.layer.inputSpec,H.numConstants=null,H}return v(ne,ae),Object.defineProperty(ne.prototype,"trainable",{get:function(){return this._trainable},set:function(B){this._trainable=B,this.forwardLayer!=null&&(this.forwardLayer.trainable=B),this.backwardLayer!=null&&(this.backwardLayer.trainable=B)},enumerable:!0,configurable:!0}),ne.prototype.getWeights=function(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())},ne.prototype.setWeights=function(B){var H=B.length,ue=Math.floor(H/2);this.forwardLayer.setWeights(B.slice(0,ue)),this.backwardLayer.setWeights(B.slice(ue))},ne.prototype.computeOutputShape=function(B){var H,ue,Le,Qe=this.forwardLayer.computeOutputShape(B);return Array.isArray(Qe)&&Array.isArray(Qe[0])||(Qe=[Qe]),Qe=Qe,this.returnState&&(Le=Qe.slice(1)),H=Qe[0],H=H,this.mergeMode==="concat"?(H[H.length-1]*=2,ue=[H]):ue=this.mergeMode==null?[H,H.slice()]:[H],this.returnState?this.mergeMode==null?ue.concat(Le).concat(Le.slice()):[H].concat(Le).concat(Le.slice()):ce(ue)},ne.prototype.apply=function(B,H){var ue=H==null?null:H.initialState,Le=H==null?null:H.constants;H==null&&(H={});var Qe=Yn(B,ue,Le,this.numConstants);
3849if(B=Qe.inputs,ue=Qe.initialState,Le=Qe.constants,Array.isArray(B)&&(ue=B.slice(1),B=B[0]),(ue==null||ue.length===0)&&Le==null)return ae.prototype.apply.call(this,B,H);var wt=[],qt=[];if(ue!=null){var en=ue.length;if(en%2>0)throw new V("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");H.initialState=ue,wt.push.apply(wt,ue);var gt=ue.map(function(Tr){return new Eo({shape:Tr.shape})});this.forwardLayer.stateSpec=gt.slice(0,en/2),this.backwardLayer.stateSpec=gt.slice(en/2),qt.push.apply(qt,gt)}if(Le!=null)throw new N("Support for constants in Bidirectional layers is not implemented yet.");for(var Tn=wt[0]instanceof Yo,Pn=0,zn=wt;Pn<zn.length;Pn++)if(zn[Pn]instanceof Yo!==Tn)throw new V("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(Tn){var Jn=[B].concat(wt),Vn=this.inputSpec.concat(qt),lr=this.inputSpec;this.inputSpec=Vn;var dr=ae.prototype.apply.call(this,Jn,H);return this.inputSpec=lr,dr}return ae.prototype.apply.call(this,B,H)},ne.prototype.call=function(B,H){var ue=this;return Object(s.tidy)(function(){var Le,Qe,wt,qt,en=H.initialState;if(en==null)Le=ue.forwardLayer.call(B,H),Qe=ue.backwardLayer.call(B,H);else{var gt=en.slice(0,en.length/2),Tn=en.slice(en.length/2);Le=ue.forwardLayer.call(B,Object.assign(H,{initialState:gt})),Qe=ue.backwardLayer.call(B,Object.assign(H,{initialState:Tn}))}return ue.returnState&&(Array.isArray(Le)&&(wt=Le.slice(1).concat(Qe.slice(1))),Le=Le[0],Qe=Qe[0]),ue.returnSequences&&(Qe=Object(s.reverse)(Qe,1)),ue.mergeMode==="concat"?qt=mi([Le,Qe]):ue.mergeMode==="sum"?qt=Object(s.add)(Le,Qe):ue.mergeMode==="ave"?qt=Object(s.mul)(.5,Object(s.add)(Le,Qe)):ue.mergeMode==="mul"?qt=Object(s.mul)(Le,Qe):ue.mergeMode==null&&(qt=[Le,Qe]),ue.returnState?ue.mergeMode==null?qt.concat(wt):[qt].concat(wt):qt})},ne.prototype.resetStates=function(B){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()},ne.prototype.build=function(B){var H=this;jn(this.forwardLayer.name,function(){H.forwardLayer.build(B)}),jn(this.backwardLayer.name,function(){H.backwardLayer.build(B)}),this.built=!0},ne.prototype.computeMask=function(B,H){var ue;if(Array.isArray(H)&&(H=H[0]),ue=this.returnSequences?this.mergeMode==null?[H,H]:H:this.mergeMode==null?[null,null]:null,this.returnState){var Le=this.forwardLayer.states.map(function(Qe){return null});return Array.isArray(ue)?ue.concat(Le).concat(Le):[ue].concat(Le).concat(Le)}return ue},Object.defineProperty(ne.prototype,"trainableWeights",{get:function(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(ne.prototype,"nonTrainableWeights",{get:function(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)},enumerable:!0,configurable:!0}),ne.prototype.setFastWeightInitDuringBuild=function(B){ae.prototype.setFastWeightInitDuringBuild.call(this,B),this.forwardLayer!=null&&this.forwardLayer.setFastWeightInitDuringBuild(B),this.backwardLayer!=null&&this.backwardLayer.setFastWeightInitDuringBuild(B)},ne.prototype.getConfig=function(){var B={mergeMode:this.mergeMode},H=ae.prototype.getConfig.call(this);return Object.assign(B,H),B},ne.fromConfig=function(B,H){var ue=ys(H.layer);if(delete H.layer,H.numConstants!=null)throw new N("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");var Le=H;return Le.layer=ue,new B(Le)},ne.className="Bidirectional",ne}(Cl);function Mo(ae){return new os(ae)}function tu(ae){return new pd(ae)}function ps(ae){return new Vm(ae)}function nu(ae){return new $m(ae)}function Da(ae){return new Hu(ae)}function Ku(ae){return new Np(ae)}function Fc(ae){return new ku(ae)}s.serialization.registerClass(Gu);var il=nu,Sl=Da,Rc=Ku,Cf=Fc,Sf=Object.freeze({inputLayer:function(ae){return new Tc(ae)},elu:function(ae){return new Lg(ae)},reLU:function(ae){return new Bm(ae)},leakyReLU:function(ae){return new Pm(ae)},prelu:function(ae){return new jm(ae)},softmax:function(ae){return new wu(ae)},thresholdedReLU:function(ae){return new el(ae)},conv1d:function(ae){return new ya(ae)},conv2d:function(ae){return new Lm(ae)}
3849,conv2dTranspose:function(ae){return new sd(ae)},conv3d:function(ae){return new zg(ae)},separableConv2d:function(ae){return new Ap(ae)},cropping2D:function(ae){return new Op(ae)},upSampling2d:function(ae){return new ud(ae)},depthwiseConv2d:function(ae){return new Dp(ae)},activation:function(ae){return new lh(ae)},dense:function(ae){return new ql(ae)},dropout:function(ae){return new cd(ae)},spatialDropout1d:function(ae){return new _f(ae)},flatten:function(ae){return new Tp(ae)},repeatVector:function(ae){return new ld(ae)},reshape:function(ae){return new Gl(ae)},permute:function(ae){return new F0(ae)},embedding:function(ae){return new Pa(ae)},add:function(ae){return new bs(ae)},average:function(ae){return new _u(ae)},concatenate:function(ae){return new Yl(ae)},maximum:function(ae){return new Kl(ae)},minimum:function(ae){return new xs(ae)},multiply:function(ae){return new no(ae)},dot:function(ae){return new fh(ae)},batchNormalization:function(ae){return new Um(ae)},layerNormalization:function(ae){return new dd(ae)},zeroPadding2d:function(ae){return new Ug(ae)},averagePooling1d:Mo,avgPool1d:function(ae){return Mo(ae)},avgPooling1d:function(ae){return Mo(ae)},averagePooling2d:tu,avgPool2d:function(ae){return tu(ae)},avgPooling2d:function(ae){return tu(ae)},averagePooling3d:ps,avgPool3d:function(ae){return ps(ae)},avgPooling3d:function(ae){return ps(ae)},globalAveragePooling1d:function(ae){return new md(ae)},globalAveragePooling2d:function(ae){return new gn(ae)},globalMaxPooling1d:nu,globalMaxPooling2d:Da,maxPooling1d:Ku,maxPooling2d:Fc,maxPooling3d:function(ae){return new Ip(ae)},gru:function(ae){return new as(ae)},gruCell:function(ae){return new js(ae)},lstm:function(ae){return new Mc(ae)},lstmCell:function(ae){return new ho(ae)},simpleRNN:function(ae){return new fr(ae)},simpleRNNCell:function(ae){return new gh(ae)},rnn:function(ae){return new Oo(ae)},stackedRNNCells:function(ae){return new El(ae)},bidirectional:function(ae){return new Gu(ae)},timeDistributed:function(ae){return new Oa(ae)},globalMaxPool1d:il,globalMaxPool2d:Sl,maxPool1d:Rc,maxPool2d:Cf,
3849Layer:fo,RNN:Oo,RNNCell:gd,input:Qo,gaussianNoise:function(ae){return new dh(ae)},gaussianDropout:function(ae){return new kf(ae)},alphaDropout:function(ae){return new zm(ae)},masking:function(ae){return new fd(ae)}}),Mp=Object.freeze({binaryAccuracy:function(ae,ne){return th(ae,ne)},binaryCrossentropy:function(ae,ne){return rh(ae,ne)},sparseCategoricalAccuracy:function(ae,ne){return ih(ae,ne)},categoricalAccuracy:function(ae,ne){return nh(ae,ne)},categoricalCrossentropy:function(ae,ne){return vu(ae,ne)},precision:function(ae,ne){return vp(ae,ne)},recall:function(ae,ne){return Om(ae,ne)},cosineProximity:function(ae,ne){return wl(ae,ne)},meanAbsoluteError:function(ae,ne){return bl(ae,ne)},meanAbsolutePercentageError:function(ae,ne){return Zs(ae,ne)},MAPE:function(ae,ne){return Zs(ae,ne)},mape:function(ae,ne){return Zs(ae,ne)},meanSquaredError:function(ae,ne){return Ha(ae,ne)},MSE:function(ae,ne){return Ha(ae,ne)},mse:function(ae,ne){return Ha(ae,ne)}}),Af=Object.freeze({modelFromJSON:function(ae,ne){return A(this,void 0,void 0,function(){var B,H,ue,Le,Qe,wt,qt,en;return S(this,function(gt){switch(gt.label){case 0:return"modelTopology"in ae||(ae={modelTopology:ae}),(B=(ae=ae).modelTopology).model_config!=null&&(B=B.model_config),H=eo(B),ue=ys(H,ne),ae.weightsManifest==null?[3,2]:[4,s.io.loadWeights(ae.weightsManifest,ae.pathPrefix,ue.weights.map(function(Tn){return Tn.originalName}))];case 1:for(Le=gt.sent(),Qe={},wt=0,qt=ue.weights;wt<qt.length;wt++)en=qt[wt],Qe[en.originalName]=Le[en.originalName];ue.loadWeights(Qe),Object(s.dispose)(Le),gt.label=2;case 2:return[2,ue]}})})}}),Yu=Object.freeze({l1l2:function(ae){return new od(ae)},l1:function(ae){return function(ne){return Ep(ne),new od({l1:ne!=null?ne.l1:null,l2:0})}(ae)},l2:function(ae){return function(ne){return Ep(ne),new od({l2:ne!=null?ne.l2:null,l1:0})}(ae)}}),Bc=function(ae){function ne(){var B=ae!==null&&ae.apply(this,arguments)||this;return B.model=null,B}return v(ne,ae),ne.prototype.setModel=function(B){if(!(B instanceof Hl))throw new Error("model must be a LayersModel, not some other Container");this.model=B},ne}(Qs);function Pc(ae,ne){return ae<ne}function lc(ae,ne){return ae>ne}var Fp=function(ae){function ne(B){var H=ae.call(this)||this;if(B==null&&(B={}),B.restoreBestWeights)throw new N("restoreBestWeights = True is not implemented in EarlyStopping yet.");return H.monitor=B.monitor||"val_loss",H.minDelta=Math.abs(B.minDelta||0),H.patience=B.patience||0,H.verbose=B.verbose||0,H.mode=B.mode||"auto",H.baseline=B.baseline,["auto","min","max"].indexOf(H.mode)===-1&&(console.warn("EarlyStopping mode '"+H.mode+"' is invalid. Falling back to mode 'auto'."),H.mode="auto"),H.mode==="min"?H.monitorFunc=Pc:H.mode==="max"||H.monitor.indexOf("acc")!==-1?H.monitorFunc=lc:H.monitorFunc=Pc,H.monitorFunc===Pc&&(H.minDelta*=-1),H}return v(ne,ae),ne.prototype.onTrainBegin=function(B){return A(this,void 0,void 0,function(){return S(this,function(H){return this.wait=0,this.stoppedEpoch=0,this.baseline!=null?this.best=this.baseline:this.best=this.monitorFunc===Pc?1/0:-1/0,[2]})})},ne.prototype.onEpochEnd=function(B,H){return A(this,void 0,void 0,function(){var ue;return S(this,function(Le){switch(Le.label){case 0:return[4,Jc(H)];case 1:return Le.sent(),(ue=this.getMonitorValue(H))==null?[2]:(this.monitorFunc(ue-this.minDelta,this.best)?(this.best=ue,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=B,this.model.stopTraining=!0)),[2])}})})},ne.prototype.onTrainEnd=function(B){return A(this,void 0,void 0,function(){return S(this,function(H){return this.stoppedEpoch>0&&this.verbose&&console.log("Epoch "+this.stoppedEpoch+": early stopping."),[2]})})},ne.prototype.getMonitorValue=function(B){B==null&&(B={});var H=B[this.monitor];return H==null&&console.warn("Metric for EarlyStopping "+this.monitor+" is not available. Available metrics are: "+Object.keys(B)),H},ne}(Bc),vh={earlyStopping:function(ae){return new Fp(ae)}},yh=n(20),vd=n(130);n.d(i,"version",function(){return bh}),n.d(i,"AdadeltaOptimizer",function(){return s.AdadeltaOptimizer}),n.d(i,"AdagradOptimizer",function(){return s.AdagradOptimizer}),n.d(i,"AdamOptimizer",function(){return s.AdamOptimizer}),n.d(i,"AdamaxOptimizer",function(){return s.AdamaxOptimizer}),n.d(i,"Add",function(){return s.Add}),n.d(i,"AddN",function(){return s.AddN}),n.d(i,"BroadcastTo",function(){return s.BroadcastTo}),n.d(i,"DataStorage",function(){return s.DataStorage}),n.d(i,"Div",function(){return s.Div}),n.d(i,"ENV",function(){return s.ENV}),n.d(i,"Environment",function(){return s.Environment}),n.d(i,"FromPixels",function(){return s.FromPixels}),n.d(i,"FusedBatchNorm",function(){return s.FusedBatchNorm}),n.d(i,"Identity",function(){return s.Identity}),n.d(i,"KernelBackend",function(){return s.KernelBackend}),n.d(i,"MaxPoolWithArgmax",function(){return s.MaxPoolWithArgmax}),n.d(i,"MomentumOptimizer",function(){return s.MomentumOptimizer}),n.d(i,"NonMaxSuppressionV5",function(){return s.NonMaxSuppressionV5}),n.d(i,"OneHot",function(){return s.OneHot}),n.d(i,"Optimizer",function(){return s.Optimizer}),n.d(i,"PadV2",function(){return s.PadV2}),n.d(i,"RMSPropOptimizer",function(){return s.RMSPropOptimizer}),n.d(i,"Rank",function(){return s.Rank}),n.d(i,"Reduction",function(){return s.Reduction}),n.d(i,"SGDOptimizer",function(){return s.SGDOptimizer}),n.d(i,"Square",function(){return s.Square}),n.d(i,"SquaredDifference",function(){return s.SquaredDifference}),n.d(i,"Tensor",function(){return s.Tensor}),n.d(i,"TensorBuffer",function(){return s.TensorBuffer}),n.d(i,"Tile",function(){return s.Tile}),n.d(i,"Transpose",function(){return s.Transpose}),n.d(i,"Variable",function(){return s.Variable}),n.d(i,"abs",function(){return s.abs}),n.d(i,"acos",function(){return s.acos}),n.d(i,"acosh",function(){return s.acosh}),n.d(i,"add",function(){return s.add}),n.d(i,"addN",function(){return s.addN}),n.d(i,"addStrict",function(){return s.addStrict}),n.d(i,"all",function(){return s.all}),n.d(i,"any",function(){return s.any}),n.d(i,"argMax",function(){return s.argMax}),n.d(i,"argMin",function(){return s.argMin}),n.d(i,"asin",function(){return s.asin}),n.d(i,"asinh",function(){return s.asinh}),n.d(i,"atan",function(){return s.atan}),n.d(i,"atan2",function(){return s.atan2}),n.d(i,"atanh",function(){return s.atanh}),n.d(i,"avgPool",function(){return s.avgPool}),n.d(i,"avgPool3d",function(){return s.avgPool3d}),n.d(i,"backend",function(){return s.backend}),n.d(i,"backend_util",function(){return s.backend_util}),n.d(i,"basicLSTMCell",function(){return s.basicLSTMCell}),n.d(i,"batchNorm",function(){return s.batchNorm}),n.d(i,"batchNorm2d",function(){return s.batchNorm2d}),n.d(i,"batchNorm3d",function(){return s.batchNorm3d}),n.d(i,"batchNorm4d",function(){return s.batchNorm4d}),n.d(i,"batchNormalization",function(){return s.batchNormalization}),n.d(i,"batchNormalization2d",function(){return s.batchNormalization2d}),n.d(i,"batchNormalization3d",function(){return s.batchNormalization3d}),n.d(i,"batchNormalization4d",function(){return s.batchNormalization4d}),n.d(i,"batchToSpaceND",function(){return s.batchToSpaceND}),n.d(i,"booleanMaskAsync",function(){return s.booleanMaskAsync}),n.d(i,"broadcastTo",function(){return s.broadcastTo}),n.d(i,"browser",function(){return s.browser}),n.d(i,"buffer",function(){return s.buffer}),n.d(i,"cast",function(){return s.cast}),n.d(i,"ceil",function(){return s.ceil}),n.d(i,"clipByValue",function(){return s.clipByValue}),n.d(i,"clone",function(){return s.clone}),n.d(i,"complex",function(){return s.complex}),n.d(i,"concat",function(){return s.concat}),n.d(i,"concat1d",function(){return s.concat1d}),n.d(i,"concat2d",function(){return s.concat2d}),n.d(i,"concat3d",function(){return s.concat3d}),n.d(i,"concat4d",function(){return s.concat4d}),n.d(i,"conv1d",function(){return s.conv1d}),n.d(i,"conv2d",function(){return s.conv2d}),n.d(i,"conv2dTranspose",function(){return s.conv2dTranspose}),n.d(i,"conv3d",function(){return s.conv3d}),n.d(i,"conv3dTranspose",function(){return s.conv3dTranspose}),n.d(i,"cos",function(){return s.cos}),n.d(i,"cosh",function(){return s.cosh}),n.d(i,"cumsum",function(){return s.cumsum}),n.d(i,"customGrad",function(){return s.customGrad}),n.d(i,"deprecationWarn",function(){return s.deprecationWarn}),n.d(i,"depthToSpace",function(){return s.depthToSpace}),n.d(i,"depthwiseConv2d",function(){return s.depthwiseConv2d}),n.d(i,"diag",function(){return s.diag}),n.d(i,"disableDeprecationWarnings",function(){return s.disableDeprecationWarnings}
3849),n.d(i,"dispose",function(){return s.dispose}),n.d(i,"disposeVariables",function(){return s.disposeVariables}),n.d(i,"div",function(){return s.div}),n.d(i,"divNoNan",function(){return s.divNoNan}),n.d(i,"divStrict",function(){return s.divStrict}),n.d(i,"dot",function(){return s.dot}),n.d(i,"dropout",function(){return s.dropout}),n.d(i,"elu",function(){return s.elu}),n.d(i,"enableDebugMode",function(){return s.enableDebugMode}),n.d(i,"enableProdMode",function(){return s.enableProdMode}),n.d(i,"engine",function(){return s.engine}),n.d(i,"env",function(){return s.env}),n.d(i,"equal",function(){return s.equal}),n.d(i,"equalStrict",function(){return s.equalStrict}),n.d(i,"erf",function(){return s.erf}),n.d(i,"exp",function(){return s.exp}),n.d(i,"expandDims",function(){return s.expandDims}),n.d(i,"expm1",function(){return s.expm1}),n.d(i,"eye",function(){return s.eye}),n.d(i,"fft",function(){return s.fft}),n.d(i,"fill",function(){return s.fill}),n.d(i,"findBackend",function(){return s.findBackend}),n.d(i,"findBackendFactory",function(){return s.findBackendFactory}),n.d(i,"floor",function(){return s.floor}),n.d(i,"floorDiv",function(){return s.floorDiv}),n.d(i,"frame",function(){return s.frame}),n.d(i,"fused",function(){return s.fused}),n.d(i,"gather",function(){return s.gather}),n.d(i,"gatherND",function(){return s.gatherND}),n.d(i,"gather_util",function(){return s.gather_util}),n.d(i,"getBackend",function(){return s.getBackend}),n.d(i,"getGradient",function(){return s.getGradient}),n.d(i,"getKernel",function(){return s.getKernel}),n.d(i,"getKernelsForBackend",function(){return s.getKernelsForBackend}),n.d(i,"grad",function(){return s.grad}),n.d(i,"grads",function(){return s.grads}),n.d(i,"greater",function(){return s.greater}),n.d(i,"greaterEqual",function(){return s.greaterEqual}),n.d(i,"greaterEqualStrict",function(){return s.greaterEqualStrict}),n.d(i,"greaterStrict",function(){return s.greaterStrict}),n.d(i,"hammingWindow",function(){return s.hammingWindow}),n.d(i,"hannWindow",function(){return s.hannWindow}),n.d(i,"ifft",function(){return s.ifft}),n.d(i,"imag",function(){return s.imag}),n.d(i,"image",function(){return s.image}),n.d(i,"inTopKAsync",function(){return s.inTopKAsync}),n.d(i,"io",function(){return s.io}),n.d(i,"irfft",function(){return s.irfft}),n.d(i,"isFinite",function(){return s.isFinite}),n.d(i,"isInf",function(){return s.isInf}),n.d(i,"isNaN",function(){return s.isNaN}),n.d(i,"keep",function(){return s.keep}),n.d(i,"leakyRelu",function(){return s.leakyRelu}),n.d(i,"less",function(){return s.less}),n.d(i,"lessEqual",function(){return s.lessEqual}),n.d(i,"lessEqualStrict",function(){return s.lessEqualStrict}),n.d(i,"lessStrict",function(){return s.lessStrict}),n.d(i,"linalg",function(){return s.linalg}),n.d(i,"linspace",function(){return s.linspace}),n.d(i,"localResponseNormalization",function(){return s.localResponseNormalization}),n.d(i,"log",function(){return s.log}),n.d(i,"log1p",function(){return s.log1p}),n.d(i,"logSigmoid",function(){return s.logSigmoid}),n.d(i,"logSoftmax",function(){return s.logSoftmax}),n.d(i,"logSumExp",function(){return s.logSumExp}),n.d(i,"logicalAnd",function(){return s.logicalAnd}),n.d(i,"logicalNot",function(){return s.logicalNot}),n.d(i,"logicalOr",function(){return s.logicalOr}),n.d(i,"logicalXor",function(){return s.logicalXor}),n.d(i,"losses",function(){return s.losses}),n.d(i,"matMul",function(){return s.matMul}),n.d(i,"math",function(){return s.math}),n.d(i,"max",function(){return s.max}),n.d(i,"maxPool",function(){return s.maxPool}),n.d(i,"maxPool3d",function(){return s.maxPool3d}),n.d(i,"maxPoolWithArgmax",function(){return s.maxPoolWithArgmax}),n.d(i,"maximum",function(){return s.maximum}),n.d(i,"maximumStrict",function(){return s.maximumStrict}),n.d(i,"mean",function(){return s.mean}),n.d(i,"memory",function(){return s.memory}),n.d(i,"min",function(){return s.min}),n.d(i,"minimum",function(){return s.minimum}),n.d(i,"minimumStrict",function(){return s.minimumStrict}),n.d(i,"mod",function(){return s.mod}),n.d(i,"modStrict",function(){return s.modStrict}),n.d(i,"moments",function(){return s.moments}),n.d(i,"movingAverage",function(){return s.movingAverage}),n.d(i,"mul",function(){return s.mul}),n.d(i,"mulStrict",function(){return s.mulStrict}),n.d(i,"multiRNNCell",function(){return s.multiRNNCell}),n.d(i,"multinomial",function(){return s.multinomial}),n.d(i,"neg",function(){return s.neg}),n.d(i,"nextFrame",function(){return s.nextFrame}),n.d(i,"norm",function(){return s.norm}),n.d(i,"notEqual",function(){return s.notEqual}),n.d(i,"notEqualStrict",function(){return s.notEqualStrict}),n.d(i,"oneHot",function(){return s.oneHot}),n.d(i,"ones",function(){return s.ones}),n.d(i,"onesLike",function(){return s.onesLike}),n.d(i,"op",function(){return s.op}),n.d(i,"outerProduct",function(){return s.outerProduct}),n.d(i,"pad",function(){return s.pad}),n.d(i,"pad1d",function(){return s.pad1d}),n.d(i,"pad2d",function(){return s.pad2d}),n.d(i,"pad3d",function(){return s.pad3d}),n.d(i,"pad4d",function(){return s.pad4d}),n.d(i,"pool",function(){return s.pool}),n.d(i,"pow",function(){return s.pow}),n.d(i,"powStrict",function(){return s.powStrict}),n.d(i,"prelu",function(){return s.prelu}),n.d(i,"print",function(){return s.print}),n.d(i,"prod",function(){return s.prod}),n.d(i,"profile",function(){return s.profile}),n.d(i,"rand",function(){return s.rand}),n.d(i,"randomGamma",function(){return s.randomGamma}),n.d(i,"randomNormal",function(){return s.randomNormal}),n.d(i,"randomUniform",function(){return s.randomUniform}),n.d(i,"range",function(){return s.range}),n.d(i,"ready",function(){return s.ready}),n.d(i,"real",function(){return s.real}),n.d(i,"reciprocal",function(){return s.reciprocal}),n.d(i,"registerBackend",function(){return s.registerBackend}),n.d(i,"registerGradient",function(){return s.registerGradient}),n.d(i,"registerKernel",function(){return s.registerKernel}),n.d(i,"relu",function(){return s.relu}),n.d(i,"relu6",function(){return s.relu6}),n.d(i,"removeBackend",function(){return s.removeBackend}),n.d(i,"reshape",function(){return s.reshape}),n.d(i,"reverse",function(){return s.reverse}),n.d(i,"reverse1d",function(){return s.reverse1d}),n.d(i,"reverse2d",function(){return s.reverse2d}),n.d(i,"reverse3d",function(){return s.reverse3d}),n.d(i,"reverse4d",function(){return s.reverse4d}),n.d(i,"rfft",function(){return s.rfft}),n.d(i,"round",function(){return s.round}),n.d(i,"rsqrt",function(){return s.rsqrt}),n.d(i,"scalar",function(){return s.scalar}),n.d(i,"scatterND",function(){return s.scatterND}),n.d(i,"scatter_util",function(){return s.scatter_util}),n.d(i,"selu",function(){return s.selu}),n.d(i,"separableConv2d",function(){return s.separableConv2d}),n.d(i,"serialization",function(){return s.serialization}),n.d(i,"setBackend",function(){return s.setBackend}),n.d(i,"setPlatform",function(){return s.setPlatform}),n.d(i,"setdiff1dAsync",function(){return s.setdiff1dAsync}),n.d(i,"sigmoid",function(){return s.sigmoid}),n.d(i,"sign",function(){return s.sign}),n.d(i,"signal",function(){return s.signal}),n.d(i,"sin",function(){return s.sin}),n.d(i,"sinh",function(){return s.sinh}),n.d(i,"slice",function(){return s.slice}),n.d(i,"slice1d",function(){return s.slice1d}),n.d(i,"slice2d",function(){return s.slice2d}),n.d(i,"slice3d",function(){return s.slice3d}),n.d(i,"slice4d",function(){return s.slice4d}),n.d(i,"slice_util",function(){return s.slice_util}),n.d(i,"softmax",function(){return s.softmax}),n.d(i,"softplus",function(){return s.softplus}),n.d(i,"spaceToBatchND",function(){return s.spaceToBatchND}),n.d(i,"sparseToDense",function(){return s.sparseToDense}),n.d(i,"spectral",function(){return s.spectral}),n.d(i,"split",function(){return s.split}),n.d(i,"sqrt",function(){return s.sqrt}),n.d(i,"square",function(){return s.square}),n.d(i,"squaredDifference",function(){return s.squaredDifference}),n.d(i,"squaredDifferenceStrict",function(){return s.squaredDifferenceStrict}),n.d(i,"squeeze",function(){return s.squeeze}),n.d(i,"stack",function(){return s.stack}),n.d(i,"step",function(){return s.step}),n.d(i,"stft",function(){return s.stft}),n.d(i,"stridedSlice",function(){return s.stridedSlice}),n.d(i,"sub",function(){return s.sub}),n.d(i,"subStrict",function(){return s.subStrict}),n.d(i,"sum",function(){return s.sum}),n.d(i,"sumOutType",function(){return s.sumOutType}),n.d(i,"tan",function(){return s.tan}
3849),n.d(i,"tanh",function(){return s.tanh}),n.d(i,"tensor",function(){return s.tensor}),n.d(i,"tensor1d",function(){return s.tensor1d}),n.d(i,"tensor2d",function(){return s.tensor2d}),n.d(i,"tensor3d",function(){return s.tensor3d}),n.d(i,"tensor4d",function(){return s.tensor4d}),n.d(i,"tensor5d",function(){return s.tensor5d}),n.d(i,"tensor6d",function(){return s.tensor6d}),n.d(i,"tensor_util",function(){return s.tensor_util}),n.d(i,"test_util",function(){return s.test_util}),n.d(i,"tidy",function(){return s.tidy}),n.d(i,"tile",function(){return s.tile}),n.d(i,"time",function(){return s.time}),n.d(i,"topk",function(){return s.topk}),n.d(i,"train",function(){return s.train}),n.d(i,"transpose",function(){return s.transpose}),n.d(i,"truncatedNormal",function(){return s.truncatedNormal}),n.d(i,"unregisterGradient",function(){return s.unregisterGradient}),n.d(i,"unregisterKernel",function(){return s.unregisterKernel}),n.d(i,"unsortedSegmentSum",function(){return s.unsortedSegmentSum}),n.d(i,"unstack",function(){return s.unstack}),n.d(i,"util",function(){return s.util}),n.d(i,"valueAndGrad",function(){return s.valueAndGrad}),n.d(i,"valueAndGrads",function(){return s.valueAndGrads}),n.d(i,"variable",function(){return s.variable}),n.d(i,"variableGrads",function(){return s.variableGrads}),n.d(i,"version_core",function(){return s.version_core}),n.d(i,"webgl",function(){return s.webgl}),n.d(i,"where",function(){return s.where}),n.d(i,"whereAsync",function(){return s.whereAsync}),n.d(i,"zeros",function(){return s.zeros}),n.d(i,"zerosLike",function(){return s.zerosLike}),n.d(i,"constraints",function(){return Yt}),n.d(i,"initializers",function(){return Mr}),n.d(i,"layers",function(){return Sf}),n.d(i,"metrics",function(){return Mp}),n.d(i,"models",function(){return Af}),n.d(i,"regularizers",function(){return Yu}),n.d(i,"CallbackList",function(){return Zd}),n.d(i,"CustomCallback",function(){return eh}),n.d(i,"History",function(){return Qc}),n.d(i,"Callback",function(){return Bc}),n.d(i,"callbacks",function(){return vh}),n.d(i,"EarlyStopping",function(){return Fp}),n.d(i,"InputSpec",function(){return Eo}),n.d(i,"SymbolicTensor",function(){return Yo}),n.d(i,"LayersModel",function(){return Hl}),n.d(i,"input",function(){return Qo}),n.d(i,"loadLayersModel",function(){return Os}),n.d(i,"model",function(){return zo}),n.d(i,"registerCallbackConstructor",function(){return bu}),n.d(i,"sequential",function(){return qa}),n.d(i,"RNN",function(){return Oo}),n.d(i,"Sequential",function(){return Bt}),n.d(i,"LayerVariable",function(){return Kr}),n.d(i,"version_layers",function(){return"1.7.4"}),n.d(i,"GraphModel",function(){return yh.GraphModel}),n.d(i,"loadGraphModel",function(){return yh.loadGraphModel}),n.d(i,"deregisterOp",function(){return yh.deregisterOp}),n.d(i,"registerOp",function(){return yh.registerOp}),n.d(i,"version_converter",function(){return yh.version_converter}),n.d(i,"data",function(){return vd});var bh={"tfjs-core":s.version_core,"tfjs-data":vd.version_data,"tfjs-layers":"1.7.4","tfjs-converter":yh.version_converter,tfjs:"1.7.4"}},function(a,i,n){n.r(i),function(s,h,v,g){n.d(i,"AdadeltaOptimizer",function(){return Rb}),n.d(i,"AdagradOptimizer",function(){return Bb}),n.d(i,"AdamOptimizer",function(){return Pb}),n.d(i,"AdamaxOptimizer",function(){return Oy}),n.d(i,"DataStorage",function(){return gd}),n.d(i,"ENV",function(){return V}),n.d(i,"Environment",function(){return P}),n.d(i,"KernelBackend",function(){return gh}),n.d(i,"MomentumOptimizer",function(){return Dy}),n.d(i,"Optimizer",function(){return nm}),n.d(i,"RMSPropOptimizer",function(){return O1}),n.d(i,"Rank",function(){return _e}),n.d(i,"Reduction",function(){return Ys}),n.d(i,"SGDOptimizer",function(){return A1}),n.d(i,"Tensor",function(){return Zt}),n.d(i,"TensorBuffer",function(){return co}),n.d(i,"Variable",function(){return St}),n.d(i,"abs",function(){return Ql}),n.d(i,"acos",function(){return W0}),n.d(i,"acosh",function(){return V0}),n.d(i,"add",function(){return zp}),n.d(i,"addN",function(){return b1}),n.d(i,"addStrict",function(){return x1}),n.d(i,"all",function(){return tv}),n.d(i,"any",function(){return Nl}),n.d(i,"argMax",function(){return nv}),n.d(i,"argMin",function(){return gy}),n.d(i,"asin",function(){return Lc}),n.d(i,"asinh",function(){return $0}),n.d(i,"atan",function(){return Bp}),n.d(i,"atan2",function(){return Hg}),n.d(i,"atanh",function(){return Ym}),n.d(i,"avgPool",function(){return hy}),n.d(i,"avgPool3d",function(){return py}),n.d(i,"backend",function(){return I0}),n.d(i,"backend_util",function(){return Sl}),n.d(i,"basicLSTMCell",function(){return xy}),n.d(i,"batchNorm",function(){return y1}),n.d(i,"batchNorm2d",function(){return _d}),n.d(i,"batchNorm3d",function(){return Lp}),n.d(i,"batchNorm4d",function(){return Eh}),n.d(i,"batchNormalization",function(){return Ib}),n.d(i,"batchNormalization2d",function(){return ry}),n.d(i,"batchNormalization3d",function(){return Zm}),n.d(i,"batchNormalization4d",function(){return q0}),n.d(i,"batchToSpaceND",function(){return wf}),n.d(i,"booleanMaskAsync",function(){return Xg}),n.d(i,"broadcastTo",function(){return ad}),n.d(i,"browser",function(){return ul}),n.d(i,"buffer",function(){return Qi}),n.d(i,"cast",function(){return Lm}),n.d(i,"ceil",function(){return v1}),n.d(i,"clipByValue",function(){return Xm}),n.d(i,"clone",function(){return zg}),n.d(i,"complex",function(){return zo}),n.d(i,"concat",function(){return va}),n.d(i,"concat1d",function(){return Ep}),n.d(i,"concat2d",function(){return Rm}),n.d(i,"concat3d",function(){return od}),n.d(i,"concat4d",function(){return Cp}),n.d(i,"conv1d",function(){return Qg}),n.d(i,"conv2d",function(){return $p}),n.d(i,"conv2dTranspose",function(){return Rf}),n.d(i,"conv3d",function(){return Zg}),n.d(i,"conv3dTranspose",function(){return w1}),n.d(i,"cos",function(){return Zl}),n.d(i,"cosh",function(){return Jm}),n.d(i,"cumsum",function(){return sd}),n.d(i,"customGrad",function(){return Hu}),n.d(i,"deprecationWarn",function(){return ah}),n.d(i,"depthToSpace",function(){return Ap}),n.d(i,"depthwiseConv2d",function(){return ig}),n.d(i,"diag",function(){return cg}),n.d(i,"disableDeprecationWarnings",function(){return Bg}
3849),n.d(i,"dispose",function(){return ca}),n.d(i,"disposeVariables",function(){return id}),n.d(i,"div",function(){return Ed}),n.d(i,"divNoNan",function(){return Mf}),n.d(i,"divStrict",function(){return eg}),n.d(i,"dot",function(){return og}),n.d(i,"dropout",function(){return Bh}),n.d(i,"elu",function(){return Il}),n.d(i,"enableDebugMode",function(){return Rg}),n.d(i,"enableProdMode",function(){return Nc}),n.d(i,"engine",function(){return Dm}),n.d(i,"env",function(){return L}),n.d(i,"equal",function(){return Dl}),n.d(i,"equalStrict",function(){return Vc}),n.d(i,"erf",function(){return Yv}),n.d(i,"exp",function(){return Xv}),n.d(i,"expandDims",function(){return ya}),n.d(i,"expm1",function(){return H0}),n.d(i,"eye",function(){return Op}),n.d(i,"fft",function(){return o0}),n.d(i,"fill",function(){return xu}),n.d(i,"findBackend",function(){return Nm}),n.d(i,"findBackendFactory",function(){return Pg}),n.d(i,"floor",function(){return Db}),n.d(i,"floorDiv",function(){return Up}),n.d(i,"frame",function(){return fg}),n.d(i,"fused",function(){return cv}),n.d(i,"gather",function(){return Kg}),n.d(i,"gatherND",function(){return Lf}),n.d(i,"gather_util",function(){return R0}),n.d(i,"getBackend",function(){return yu}),n.d(i,"getGradient",function(){return K}),n.d(i,"getKernel",function(){return J}),n.d(i,"getKernelsForBackend",function(){return re}),n.d(i,"grad",function(){return mh}),n.d(i,"grads",function(){return md}),n.d(i,"greater",function(){return bc}),n.d(i,"greaterEqual",function(){return Vp}),n.d(i,"greaterEqualStrict",function(){return Gg}),n.d(i,"greaterStrict",function(){return K0}),n.d(i,"hammingWindow",function(){return ov}),n.d(i,"hannWindow",function(){return u0}),n.d(i,"ifft",function(){return a0}),n.d(i,"imag",function(){return Os}),n.d(i,"image",function(){return uv}),n.d(i,"inTopKAsync",function(){return ky}),n.d(i,"io",function(){return Zp}),n.d(i,"irfft",function(){return nf}),n.d(i,"isFinite",function(){return Pp}),n.d(i,"isInf",function(){return ty}),n.d(i,"isNaN",function(){return ey}),n.d(i,"keep",function(){return xp}),n.d(i,"leakyRelu",function(){return Gp}),n.d(i,"less",function(){return Y0}),n.d(i,"lessEqual",function(){return tg}),n.d(i,"lessEqualStrict",function(){return da}),n.d(i,"lessStrict",function(){return ng}),n.d(i,"linalg",function(){return f0}),n.d(i,"linspace",function(){return kp}),n.d(i,"localResponseNormalization",function(){return by}),n.d(i,"log",function(){return Tb}),n.d(i,"log1p",function(){return Fo}),n.d(i,"logSigmoid",function(){return Jv}),n.d(i,"logSoftmax",function(){return Oo}),n.d(i,"logSumExp",function(){return Dd}),n.d(i,"logicalAnd",function(){return Ch}),n.d(i,"logicalNot",function(){return iy}),n.d(i,"logicalOr",function(){return G0}),n.d(i,"logicalXor",function(){return Sh}),n.d(i,"losses",function(){return c0}),n.d(i,"matMul",function(){return sy}),n.d(i,"math",function(){return af}),n.d(i,"max",function(){return k1}),n.d(i,"maxPool",function(){return dy}),n.d(i,"maxPool3d",function(){return _1}),n.d(i,"maximum",function(){return Ah}),n.d(i,"maximumStrict",function(){return Cd}),n.d(i,"mean",function(){return Hp}),n.d(i,"memory",function(){return yp}),n.d(i,"min",function(){return qp}),n.d(i,"minimum",function(){return Sd}),n.d(i,"minimumStrict",function(){return Wc}),n.d(i,"mod",function(){return Wp}),n.d(i,"modStrict",function(){return Oh}),n.d(i,"moments",function(){return Td}),n.d(i,"movingAverage",function(){return Nd}),n.d(i,"mul",function(){return Ff}),n.d(i,"mulStrict",function(){return ef}),n.d(i,"multiRNNCell",function(){return i0}),n.d(i,"multinomial",function(){return ud}),n.d(i,"neg",function(){return Qv}),n.d(i,"nextFrame",function(){return Pd}),n.d(i,"norm",function(){return Kp}),n.d(i,"notEqual",function(){return Tl}),n.d(i,"notEqualStrict",function(){return Nh}),n.d(i,"oneHot",function(){return Dp}),n.d(i,"ones",function(){return yc}),n.d(i,"onesLike",function(){return eu}),n.d(i,"op",function(){return Bt}),n.d(i,"outerProduct",function(){return uy}),n.d(i,"pad",function(){return cd}),n.d(i,"pad1d",function(){return _f}),n.d(i,"pad2d",function(){return ql}),n.d(i,"pad3d",function(){return Tp}),n.d(i,"pad4d",function(){return lh}
3849),n.d(i,"pool",function(){return Mh}),n.d(i,"pow",function(){return Dh}),n.d(i,"powStrict",function(){return qg}),n.d(i,"prelu",function(){return sg}),n.d(i,"print",function(){return ch}),n.d(i,"prod",function(){return Rh}),n.d(i,"profile",function(){return bp}),n.d(i,"rand",function(){return ld}),n.d(i,"randomGamma",function(){return F0}),n.d(i,"randomNormal",function(){return Gl}),n.d(i,"randomUniform",function(){return fd}),n.d(i,"range",function(){return kl}),n.d(i,"ready",function(){return Tm}),n.d(i,"real",function(){return qa}),n.d(i,"reciprocal",function(){return Wg}),n.d(i,"registerBackend",function(){return jg}),n.d(i,"registerGradient",function(){return pe}),n.d(i,"registerKernel",function(){return ce}),n.d(i,"relu",function(){return r0}),n.d(i,"relu6",function(){return rv}),n.d(i,"removeBackend",function(){return _l}),n.d(i,"reshape",function(){return Pa}),n.d(i,"reverse",function(){return Od}),n.d(i,"reverse1d",function(){return cy}),n.d(i,"reverse2d",function(){return ag}),n.d(i,"reverse3d",function(){return t0}),n.d(i,"reverse4d",function(){return ly}),n.d(i,"rfft",function(){return iv}),n.d(i,"round",function(){return Zv}),n.d(i,"rsqrt",function(){return Qm}),n.d(i,"scalar",function(){return Or}),n.d(i,"scatterND",function(){return wy}),n.d(i,"scatter_util",function(){return Wm}),n.d(i,"selu",function(){return yy}),n.d(i,"separableConv2d",function(){return ay}),n.d(i,"serialization",function(){return Wf}),n.d(i,"setBackend",function(){return sh}),n.d(i,"setPlatform",function(){return M0}),n.d(i,"setdiff1dAsync",function(){return Yl}),n.d(i,"sigmoid",function(){return Tf}),n.d(i,"sign",function(){return Nf}),n.d(i,"signal",function(){return av}),n.d(i,"sin",function(){return kh}),n.d(i,"sinh",function(){return jp}),n.d(i,"slice",function(){return Bf}),n.d(i,"slice1d",function(){return ev}),n.d(i,"slice2d",function(){return my}),n.d(i,"slice3d",function(){return Fh}),n.d(i,"slice4d",function(){return Pf}),n.d(i,"slice_util",function(){return Vm}),n.d(i,"softmax",function(){return Eu}),n.d(i,"softplus",function(){return Nb}),n.d(i,"spaceToBatchND",function(){return hs}),n.d(i,"sparseToDense",function(){return _y}),n.d(i,"spectral",function(){return s0}),n.d(i,"split",function(){return to}),n.d(i,"sqrt",function(){return Vg}),n.d(i,"square",function(){return U0}),n.d(i,"squaredDifference",function(){return _h}),n.d(i,"squaredDifferenceStrict",function(){return Th}),n.d(i,"squeeze",function(){return bs}),n.d(i,"stack",function(){return no}),n.d(i,"step",function(){return If}),n.d(i,"stft",function(){return dg}),n.d(i,"stridedSlice",function(){return ug}),n.d(i,"sub",function(){return tf}),n.d(i,"subStrict",function(){return Gs}),n.d(i,"sum",function(){return vy}),n.d(i,"sumOutType",function(){return rr}),n.d(i,"tan",function(){return zc}),n.d(i,"tanh",function(){return bd}),n.d(i,"tensor",function(){return Qo}),n.d(i,"tensor1d",function(){return Vu}),n.d(i,"tensor2d",function(){return uc}),n.d(i,"tensor3d",function(){return bf}),n.d(i,"tensor4d",function(){return $u}),n.d(i,"tensor5d",function(){return _p}),n.d(i,"tensor6d",function(){return Mm}),n.d(i,"tensor_util",function(){return Wt}),n.d(i,"test_util",function(){return fc}),n.d(i,"tidy",function(){return eo}),n.d(i,"tile",function(){return _u}),n.d(i,"time",function(){return N0}),n.d(i,"topk",function(){return jf}),n.d(i,"train",function(){return jb}),n.d(i,"transpose",function(){return Ks}),n.d(i,"truncatedNormal",function(){return Kl}),n.d(i,"unregisterGradient",function(){return Ce}),n.d(i,"unregisterKernel",function(){return ke}),n.d(i,"unsortedSegmentSum",function(){return Yg}),n.d(i,"unstack",function(){return xs}),n.d(i,"util",function(){return fi}),n.d(i,"valueAndGrad",function(){return $m}),n.d(i,"valueAndGrads",function(){return Hm}),n.d(i,"variable",function(){return Fm}),n.d(i,"variableGrads",function(){return gn}),n.d(i,"version_core",function(){return Fb}),n.d(i,"webgl",function(){return $f}),n.d(i,"where",function(){return Ao}),n.d(i,"whereAsync",function(){return kd}),n.d(i,"zeros",function(){return go}),n.d(i,"zerosLike",function(){return Ei});/** 3850 * @license 3851 * Copyright 2020 Google LLC. All Rights Reserved. 3852 * Licensed under the Apache License, Version 2.0 (the "License");
3853 * you may not use this file except in compliance with the License. 3854 * You may obtain a copy of the License at 3855 * 3856 * http://www.apache.org/licenses/LICENSE-2.0 3857 * 3858 * Unless required by applicable law or agreed to in writing, software 3859 * distributed under the License is distributed on an "AS IS" BASIS, 3860 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3861 * See the License for the specific language governing permissions and 3862 * limitations under the License. 3863 * ============================================================================= 3864 */var O=function(C,x){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,w){p.__proto__=w}||function(p,w){for(var D in w)w.hasOwnProperty(D)&&(p[D]=w[D])})(C,x)};function A(C,x){function p(){this.constructor=C}O(C,x),C.prototype=x===null?Object.create(x):(p.prototype=x.prototype,new p)}function S(C,x,p,w){return new(p||(p=Promise))(function(D,W){function Q(ye){try{fe(w.next(ye))}catch(Oe){W(Oe)}}function ie(ye){try{fe(w.throw(ye))}catch(Oe){W(Oe)}}function fe(ye){ye.done?D(ye.value):new p(function(Oe){Oe(ye.value)}).then(Q,ie)}fe((w=w.apply(C,x||[])).next())})}function M(C,x){var p,w,D,W,Q={label:0,sent:function(){if(1&D[0])throw D[1];return D[1]},trys:[],ops:[]};return W={next:ie(0),throw:ie(1),return:ie(2)},typeof Symbol=="function"&&(W[Symbol.iterator]=function(){return this}),W;function ie(fe){return function(ye){return function(Oe){if(p)throw new TypeError("Generator is already executing.");for(;Q;)try{if(p=1,w&&(D=2&Oe[0]?w.return:Oe[0]?w.throw||((D=w.return)&&D.call(w),0):w.next)&&!(D=D.call(w,Oe[1])).done)return D;switch(w=0,D&&(Oe=[2&Oe[0],D.value]),Oe[0]){case 0:case 1:D=Oe;break;case 4:return Q.label++,{value:Oe[1],done:!1};case 5:Q.label++,w=Oe[1],Oe=[0];continue;case 7:Oe=Q.ops.pop(),Q.trys.pop();continue;default:if(!(D=(D=Q.trys).length>0&&D[D.length-1])&&(Oe[0]===6||Oe[0]===2)){Q=0;continue}if(Oe[0]===3&&(!D||Oe[1]>D[0]&&Oe[1]<D[3])){Q.label=Oe[1];break}if(Oe[0]===6&&Q.label<D[1]){Q.label=D[1],D=Oe;break}if(D&&Q.label<D[2]){Q.label=D[2],Q.ops.push(Oe);break}D[2]&&Q.ops.pop(),Q.trys.pop();continue}Oe=x.call(C,Q)}catch(Re){Oe=[6,Re],w=0}finally{p=D=0}if(5&Oe[0])throw Oe[1];return{value:Oe[0]?Oe[1]:void 0,done:!0}}([fe,ye])}}}var P=function(){function C(x){this.global=x,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return C.prototype.setPlatform=function(x,p){this.platform!=null&&console.warn("Platform "+this.platformName+" has already been set. Overwriting the platform with "+p+"."),this.platformName=x,this.platform=p},C.prototype.registerFlag=function(x,p,w){if(this.flagRegistry[x]={evaluationFn:p,setHook:w},this.urlFlags[x]!=null){var D=this.urlFlags[x];console.warn("Setting feature override from URL "+x+": "+D+"."),this.set(x,D)}},C.prototype.get=function(x){return x in this.flags?this.flags[x]:(this.flags[x]=this.evaluateFlag(x),this.flags[x])},C.prototype.getNumber=function(x){return this.get(x)},C.prototype.getBool=function(x){return this.get(x)},C.prototype.getFlags=function(){return this.flags},Object.defineProperty(C.prototype,"features",{get:function(){return this.flags},enumerable:!0,configurable:!0}),C.prototype.set=function(x,p){if(this.flagRegistry[x]==null)throw new Error("Cannot set flag "+x+" as it has not been registered.");this.flags[x]=p,this.flagRegistry[x].setHook!=null&&this.flagRegistry[x].setHook(p)},C.prototype.evaluateFlag=function(x){if(this.flagRegistry[x]==null)throw new Error("Cannot evaluate flag '"+x+"': no evaluation function found.");return this.flagRegistry[x].evaluationFn()},C.prototype.setFlags=function(x){this.flags=Object.assign({},x)},C.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},C.prototype.populateURLFlags=function(){var x=this;if(this.global!==void 0&&this.global.location!==void 0&&this.global.location.search!==void 0){var p,w,D=(p=this.global.location.search,w={},p.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(W){for(var Q=[],ie=1;ie<arguments.length;ie++)Q[ie-1]=arguments[ie];return function(fe,ye,Oe){fe[decodeURIComponent(ye)]=decodeURIComponent(Oe||"")}(w,Q[0],Q[1]),Q.join("=")}),w);"tfjsflags"in D&&D.tfjsflags.split(",").forEach(function(W){var Q=W.split(":"),ie=Q[0],fe=Q[1];x.urlFlags[ie]=function(ye,Oe){if((Oe=Oe.toLowerCase())==="true"||Oe==="false")return Oe==="true";if(""+ +Oe===Oe)return+Oe;throw new Error("Could not parse value flag value "+Oe+" for flag "+ye+".")}(ie,fe)})}},C}();function L(){return V}var V=null,N=new Map,ee=new Map;function J(C,x){var p=be(C,x);return N.get(p)}function K(C){return ee.get(C)}function re(C){for(var x=N.entries(),p=[];;){var w=x.next(),D=w.done,W=w.value;if(D)break;var Q=W[0],ie=W[1];Q.split("_")[0]===C&&p.push(ie)}return p}function ce(C){var x=C.kernelName,p=C.backendName,w=be(x,p);if(N.has(w))throw new Error("The kernel '"+x+"' for backend '"+p+"' is already registered");N.set(w,C)}function pe(C){var x=C.kernelName;ee.has(x)&&console.warn("Overriding the gradient for '"+x+"'"),ee.set(x,C)}function ke(C,x){var p=be(C,x);if(!N.has(p))throw new Error("The kernel '"+C+"' for backend '"+x+"' is not registered");N.delete(p)}
vendor: 2,940 bytes, line 3864
3864function Ce(C){if(!ee.has(C))throw new Error("The gradient '"+C+"' for backend is not registered");ee.delete(C)}function be(C,x){return x+"_"+C}function $e(C){for(var x=C.length,p=0,w=0;x>0;)w=Math.random()*x|0,p=C[--x],C[x]=C[w],C[w]=p}function ht(C,x,p){return Math.max(C,Math.min(x,p))}function Dt(C){return C%2==0?C:C+1}function Ut(C){for(var x=0,p=0;p<C.length;p++)x+=C[p];return x}function Ee(C,x){if(!C)throw new Error(typeof x=="string"?x:x())}function Ot(C,x,p){p===void 0&&(p=""),Ee(Tt(C,x),function(){return p+" Shapes "+C+" and "+x+" must match"})}function zt(C){Ee(C!=null,function(){return"The input to the tensor constructor must be a non-null value."})}function Mt(C,x,p){if(x===void 0&&(x=[]),p===void 0&&(p=!1),x==null&&(x=[]),Array.isArray(C)||dt(C)&&!p)for(var w=0;w<C.length;++w)Mt(C[w],x,p);else x.push(C);return x}function Ke(C){if(C.length===0)return 1;for(var x=C[0],p=1;p<C.length;p++)x*=C[p];return x}function Tt(C,x){if(C===x)return!0;if(C==null||x==null||C.length!==x.length)return!1;for(var p=0;p<C.length;p++)if(C[p]!==x[p])return!1;return!0}function vt(C){return C%1==0}function yt(C){if(Math.tanh!=null)return Math.tanh(C);if(C===1/0)return 1;if(C===-1/0)return-1;var x=Math.exp(2*C);return(x-1)/(x+1)}function bt(C){var x=Math.ceil(Math.sqrt(C));return[x,Math.ceil(C/x)]}function Ht(C,x){return x<=C.length?C:C+" ".repeat(x-C.length)}function _t(C,x,p){return x===void 0&&(x=function(w){return 0}),new Promise(function(w,D){var W=0,Q=function(){if(C())w();else{var ie=x(++W);p!=null&&W>=p?D():setTimeout(Q,ie)}};Q()})}function Ze(C,x){for(var p=1,w=-1,D=0;D<C.length;++D)if(C[D]>=0)p*=C[D];else if(C[D]===-1){if(w!==-1)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+w+" and dim "+D);w=D}else if(C[D]<0)throw Error("Shapes can not be < 0. Found "+C[D]+" at dim "+D);if(w===-1){if(x>0&&x!==p)throw Error("Size("+x+") must match the product of shape "+C);return C}if(p===0)throw Error("Cannot infer the missing size in ["+C+"] when there are 0 elements");if(x%p!=0)throw Error("The implicit shape can't be a fractional number. Got "+x+" / "+p);var W=C.slice();return W[w]=x/p,W}function Vt(C,x){var p=x.length;return Ee((C=C==null?x.map(function(w,D){return D}):[].concat(C)).every(function(w){return w>=-p&&w<p}),function(){return"All values in axis param must be in range [-"+p+", "+p+") but got axis "+C}),Ee(C.every(function(w){return vt(w)}),function(){return"All values in axis param must be integers but got axis "+C}),C.map(function(w){return w<0?p+w:w})}function sn(C,x){for(var p=[],w=[],D=x!=null&&Array.isArray(x)&&x.length===0,W=x==null||D?null:Vt(x,C).sort(),Q=0,ie=0;ie<C.length;++ie){if(W!=null){if(W[Q]===ie&&C[ie]!==1)throw new Error("Can't squeeze axis "+ie+" since its dim '"+C[ie]+"' is not 1");(W[Q]==null||W[Q]>ie)&&C[ie]===1&&(p.push(C[ie]),w.push(ie)),W[Q]<=ie&&Q++}C[ie]!==1&&(p.push(C[ie]),w.push(ie))}return{newShape:p,keptDims:w}}function yn(C,x){var p=null;
3864if(C==null||C==="float32")p=new Float32Array(x);else if(C==="int32")p=new Int32Array(x);else{if(C!=="bool")throw new Error("Unknown data type "+C);p=new Uint8Array(x)}return p}function Yt(C,x){var p=null;if(C==null||C==="float32")p=new Float32Array(x);else if(C==="int32")p=new Int32Array(x);else if(C==="bool")p=new Uint8Array(x);else{if(C!=="string")throw new Error("Unknown data type "+C);p=new Array(x)}return p}function We(C,x){for(var p=0;p<C.length;p++){var w=C[p];if(isNaN(w)||!isFinite(w))throw Error("A tensor of type "+x+" being uploaded contains "+w+".")}}function Ye(C){return C==="bool"||C==="complex64"||C==="float32"||C==="int32"||C==="string"}function He(C,x){return!(x==="complex64"||x==="float32"&&C!=="complex64"||x==="int32"&&C!=="float32"&&C!=="complex64"||x==="bool"&&C==="bool")}function dt(C){return C instanceof Float32Array||C instanceof Int32Array||C instanceof Uint8Array}function It(C){if(C==="float32"||C==="int32")return 4;if(C==="complex64")return 8;if(C==="bool")return 1;throw new Error("Unknown dtype "+C)}function ct(C){if(C==null)return 0;var x=0;
vendor: 55,825 bytes, lines 3864-3872
3864return C.forEach(function(p){return x+=p.length}),x}function on(C){return typeof C=="string"||C instanceof String}function Xt(C){return typeof C=="boolean"}function En(C){return typeof C=="number"}function xe(C){return Array.isArray(C)?xe(C[0]):C instanceof Float32Array?"float32":C instanceof Int32Array||C instanceof Uint8Array?"int32":En(C)?"float32":on(C)?"string":Xt(C)?"bool":"float32"}function jn(C){return!!(C&&C.constructor&&C.call&&C.apply)}function nr(C,x){for(var p=x;p<C;++p)if(C%p==0)return p;return C}function ar(C){var x=C.length;if(x<2)return[];var p=new Array(x-1);p[x-2]=C[x-1];for(var w=x-3;w>=0;--w)p[w]=p[w+1]*C[w+1];return p}function cr(C,x,p){if(x==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(C)&&(C=Mt(C)),p&&We(C,x),function(W,Q){return W instanceof Float32Array&&Q==="float32"||W instanceof Int32Array&&Q==="int32"||W instanceof Uint8Array&&Q==="bool"}(C,x))return C;if(x==null||x==="float32"||x==="complex64")return new Float32Array(C);if(x==="int32")return new Int32Array(C);if(x==="bool"){for(var w=new Uint8Array(C.length),D=0;D<w.length;++D)Math.round(C[D])!==0&&(w[D]=1);return w}throw new Error("Unknown data type "+x)}function Er(C,x){if(C.length===0)return x[0];var p=C.reduce(function(w,D){return w*D});if(p===0)return[];if(p!==x.length)throw new Error("["+C+"] does not match the input size.");return function w(D,W,Q){var ie=new Array;if(W.length===1)for(var fe=W[0],ye=0;ye<fe;ye++)ie[ye]=Q[D+ye];else{fe=W[0];var Oe=W.slice(1),Re=Oe.reduce(function(Pe,je){return Pe*je});for(ye=0;ye<fe;ye++)ie[ye]=w(D+ye*Re,Oe,Q)}return ie}(0,C,x)}function hn(C,x){for(var p=rn(C,x),w=0;w<p.length;w++)p[w]=1;return p}function rn(C,x){if(x==null||x==="float32"||x==="complex64")return new Float32Array(C);if(x==="int32")return new Int32Array(C);if(x==="bool")return new Uint8Array(C);throw new Error("Unknown data type "+x)}function fn(){return L().platform.now()}function Xn(C){C.forEach(function(x){Ee(Number.isInteger(x)&&x>=0,function(){return"Tensor must have a shape comprised of positive integers but got shape ["+C+"]."})})}function Fn(C,x){return x===void 0&&(x="utf-8"),x=x||"utf-8",L().platform.encode(C,x)}function Ar(C,x){return x===void 0&&(x="utf-8"),x=x||"utf-8",L().platform.decode(C,x)}function Dr(C,x,p){if(x===0)return 0;if(x===1)return C[0];for(var w=C[C.length-1],D=0;D<C.length-1;++D)w+=p[D]*C[D];return w}function xr(C,x,p){if(x===0)return[];if(x===1)return[C];for(var w=new Array(x),D=0;D<w.length-1;++D)w[D]=Math.floor(C/p[D]),C-=w[D]*p[D];return w[w.length-1]=C,w}var fi=Object.freeze({shuffle:$e,clamp:ht,nearestLargerEven:Dt,sum:Ut,randUniform:function(C,x){var p=Math.random();return x*p+(1-p)*C},distSquared:function(C,x){for(var p=0,w=0;w<C.length;w++){var D=Number(C[w])-Number(x[w]);p+=D*D}return p},assert:Ee,assertShapesMatch:Ot,assertNonNull:zt,flatten:Mt,sizeFromShape:Ke,isScalarShape:function(C){return C.length===0},arraysEqual:Tt,isInt:vt,tanh:yt,sizeToSquarishShape:bt,createShuffledIndices:function(C){for(var x=new Uint32Array(C),p=0;p<C;++p)x[p]=p;return $e(x),x},rightPad:Ht,repeatedTry:_t,inferFromImplicitShape:Ze,parseAxisParam:Vt,squeezeShape:sn,getTypedArrayFromDType:yn,getArrayFromDType:Yt,checkConversionForErrors:We,isValidDtype:Ye,hasEncodingLoss:He,isTypedArray:dt,bytesPerElement:It,bytesFromStringArray:ct,isString:on,isBoolean:Xt,isNumber:En,inferDtype:xe,isFunction:jn,nearestDivisor:nr,computeStrides:ar,toTypedArray:cr,toNestedArray:Er,makeOnesTypedArray:hn,makeZerosTypedArray:rn,now:fn,assertNonNegativeIntegerDimensions:Xn,fetch:function(C,x){return L().platform.fetch(C,x)},encodeString:Fn,decodeString:Ar,locToIndex:Dr,indexToLoc:xr}),ci=function(){function C(x,p){this.backendTimer=x,this.logger=p,p==null&&(this.logger=new qr)}return C.prototype.profileKernel=function(x,p,w){var D,W=this,Q=this.backendTimer.time(function(){D=w()});return D.forEach(function(ie){ie.data().then(function(fe){(function(ye,Oe,Re){if(Oe!=="float32")return!1;for(var Pe=0;Pe<ye.length;Pe++){var je=ye[Pe];if(isNaN(je)||!isFinite(je))return console.warn("Found "+je+" in the result of '"+Re+"'"),!0}})(fe,ie.dtype,x),Q.then(function(ye){var Oe="";ye.getExtraProfileInfo!=null&&(Oe=ye.getExtraProfileInfo()),W.logger.logKernelProfile(x,ie,fe,ye.kernelMs,p,Oe)})})}),D},C}(),qr=function(){function C(){}return C.prototype.logKernelProfile=function(x,p,w,D,W,Q){var ie=typeof D=="number"?Ht(D+"ms",9):D.error,fe=Ht(x,25),ye=p.rank,Oe=p.size,Re=Ht(p.shape.toString(),14),Pe="";for(var je in W){var Ge=W[je].shape||p.shape,rt=Ge.length;Pe+=je+": "+rt+"D "+(rt>0?Ge:"")+" "}console.log("%c"+fe+" %c"+ie+" %c"+ye+"D "+Re+" %c"+Oe+" %c"+Pe+" %c"+Q,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},C}(),mi=20,Ir=3,ti=7;function ri(C,x,p){return Ht(Array.isArray(C)?parseFloat(C[0].toFixed(ti))+" + "+parseFloat(C[1].toFixed(ti))+"j":on(C)?"'"+C+"'":p==="bool"?yi(C):parseFloat(C.toFixed(ti)).toString(),x)}function yi(C){return C===0?"false":"true"}function na(C){for(var x=[],p=0;p<C.length;p+=2)x.push([C[p],C[p+1]]);return x}var co=function(){function C(x,p,w){var D=this;if(this.dtype=p,this.shape=x.slice(),this.size=Ke(x),w!=null){var W=w.length;Ee(W===this.size,function(){return"Length of values '"+W+"' does not match the size inferred by the shape '"+D.size+"'."})}if(p==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=w||Yt(p,this.size),this.strides=ar(x)}return C.prototype.set=function(x){for(var p=this,w=[],D=1;D<arguments.length;D++)w[D-1]=arguments[D];w.length===0&&(w=[0]),Ee(w.length===this.rank,function(){return"The number of provided coordinates ("+w.length+") must match the rank ("+p.rank+")"});var W=this.locToIndex(w);this.values[W]=x},C.prototype.get=function(){for(var x=[],p=0;p<arguments.length;p++)x[p]=arguments[p];x.length===0&&(x=[0]);for(var w=0,D=0,W=x;D<W.length;D++){var Q=W[D];if(Q<0||Q>=this.shape[w]){var ie="Requested out of range element at "+x+". Buffer shape="+this.shape;throw new Error(ie)}w++}for(var fe=x[x.length-1],ye=0;ye<x.length-1;++ye)fe+=this.strides[ye]*x[ye];return this.values[fe]},C.prototype.locToIndex=function(x){if(this.rank===0)return 0;if(this.rank===1)return x[0];for(var p=x[x.length-1],w=0;w<x.length-1;++w)p+=this.strides[w]*x[w];return p},C.prototype.indexToLoc=function(x){if(this.rank===0)return[];if(this.rank===1)return[x];for(var p=new Array(this.shape.length),w=0;w<p.length-1;++w)p[w]=Math.floor(x/this.strides[w]),x-=p[w]*this.strides[w];return p[p.length-1]=x,p},Object.defineProperty(C.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),C.prototype.toTensor=function(){return $i().makeTensor(this.values,this.shape,this.dtype)},C}(),$i=null,Ft=null,Qr=null,Zt=function(){function C(x,p,w,D){this.kept=!1,this.isDisposedInternal=!1,this.shape=x.slice(),this.dtype=p||"float32",this.size=Ke(x),this.strides=ar(x),this.dataId=w,this.id=D,this.rankType=this.rank<5?this.rank.toString():"higher"}return C.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},C.prototype.asScalar=function(){return this.throwIfDisposed(),Ee(this.size===1,function(){return"The array must have only 1 element."}),this.reshape([])},C.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},C.prototype.as2D=function(x,p){return this.throwIfDisposed(),this.reshape([x,p])},C.prototype.as3D=function(x,p,w){return this.throwIfDisposed(),this.reshape([x,p,w])},C.prototype.as4D=function(x,p,w,D){return this.throwIfDisposed(),this.reshape([x,p,w,D])},C.prototype.as5D=function(x,p,w,D,W){return this.throwIfDisposed(),this.reshape([x,p,w,D,W])},C.prototype.asType=function(x){return this.throwIfDisposed(),Ft.cast(this,x)},Object.defineProperty(C.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),C.prototype.buffer=function(){return S(this,void 0,void 0,function(){var x;return M(this,function(p){switch(p.label){case 0:return[4,this.data()];case 1:return x=p.sent(),[2,Ft.buffer(this.shape,this.dtype,x)]}})})},C.prototype.bufferSync=function(){return Ft.buffer(this.shape,this.dtype,this.dataSync())},C.prototype.array=function(){return S(this,void 0,void 0,function(){var x;return M(this,function(p){switch(p.label){case 0:return[4,this.data()];case 1:return x=p.sent(),[2,Er(this.shape,x)]}})})},C.prototype.arraySync=function(){return Er(this.shape,this.dataSync())},C.prototype.data=function(){return S(this,void 0,void 0,function(){var x,p;return M(this,function(w){switch(w.label){case 0:return this.throwIfDisposed(),x=$i().read(this.dataId),this.dtype!=="string"?[3,2]:[4,x];case 1:p=w.sent();try{return[2,p.map(function(D){return Ar(D)})]}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}w.label=2;case 2:return[2,x]}})})},C.prototype.dataSync=function(){this.throwIfDisposed();var x=$i().readSync(this.dataId);if(this.dtype==="string")try{return x.map(function(p){return Ar(p)})}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return x},C.prototype.bytes=function(){return S(this,void 0,void 0,function(){var x;return M(this,function(p){switch(p.label){case 0:return this.throwIfDisposed(),[4,$i().read(this.dataId)];case 1:return x=p.sent(),this.dtype==="string"?[2,x]:[2,new Uint8Array(x.buffer)]}})})},C.prototype.dispose=function(){this.isDisposed||($i().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(C.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),C.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},C.prototype.toFloat=function(){return this.asType("float32")},C.prototype.toInt=function(){return this.asType("int32")},C.prototype.toBool=function(){return this.asType("bool")},C.prototype.print=function(x){return x===void 0&&(x=!1),Ft.print(this,x)},C.prototype.reshape=function(x){return this.throwIfDisposed(),Ft.reshape(this,x)},C.prototype.reshapeAs=function(x){return this.throwIfDisposed(),this.reshape(x.shape)},C.prototype.expandDims=function(x){return x===void 0&&(x=0),Ft.expandDims(this,x)},C.prototype.cumsum=function(x,p,w){return x===void 0&&(x=0),p===void 0&&(p=!1),w===void 0&&(w=!1),Ft.cumsum(this,x,p,w)},C.prototype.squeeze=function(x){return this.throwIfDisposed(),Ft.squeeze(this,x)},C.prototype.clone=function(){return this.throwIfDisposed(),Ft.clone(this)},C.prototype.oneHot=function(x,p,w){return this.throwIfDisposed(),Ft.oneHot(this,x,p,w)},C.prototype.toString=function(x){return x===void 0&&(x=!1),function(p,w,D,W){var Q=ar(w),ie=function(Re,Pe,je,Ge){var rt=Ke(Pe),nt=Ge[Ge.length-1],lt=new Array(nt).fill(0),Nt=Pe.length,Rt=je==="complex64"?na(Re):Re;if(Nt>1)for(var Pt=0;Pt<rt/nt;Pt++)for(var Kt=Pt*nt,dn=0;dn<nt;dn++)lt[dn]=Math.max(lt[dn],ri(Rt[Kt+dn],0,je).length);return lt}(p,w,D,Q),fe=w.length,ye=function Re(Pe,je,Ge,rt,nt,lt){lt===void 0&&(lt=!0);var Nt=Ge==="complex64"?2:1,Rt=je[0],Pt=je.length;if(Pt===0)return Ge==="complex64"?[ri(na(Pe)[0],0,Ge)]:Ge==="bool"?[yi(Pe[0])]:[Pe[0].toString()];if(Pt===1){if(Rt>mi){var Kt=Ir*Nt,dn=Array.from(Pe.slice(0,Kt)),bn=Array.from(Pe.slice((Rt-Ir)*Nt,Rt*Nt));return Ge==="complex64"&&(dn=na(dn),bn=na(bn)),["["+dn.map(function(Y,Z){return ri(Y,nt[Z],Ge)}).join(", ")+", ..., "+bn.map(function(Y,Z){return ri(Y,nt[Rt-Ir+Z],Ge)}).join(", ")+"]"]}return["["+(Ge==="complex64"?na(Pe):Array.from(Pe)).map(function(Y,Z){return ri(Y,nt[Z],Ge)}).join(", ")+"]"]}var pn=je.slice(1),_n=rt.slice(1),On=rt[0]*Nt,_=[];if(Rt>mi){for(var m=0;m<Ir;m++){var f=(y=m*On)+On;_.push.apply(_,Re(Pe.slice(y,f),pn,Ge,_n,nt,!1))}for(_.push("..."),m=Rt-Ir;m<Rt;m++)f=(y=m*On)+On,_.push.apply(_,Re(Pe.slice(y,f),pn,Ge,_n,nt,m===Rt-1))}else for(m=0;m<Rt;m++){var y;f=(y=m*On)+On,_.push.apply(_,Re(Pe.slice(y,f),pn,Ge,_n,nt,m===Rt-1))}var E=Pt===2?",":"";for(_[0]="["+_[0]+E,m=1;m<_.length-1;m++)_[m]=" "+_[m]+E;var z=`, 3865`;for(m=2;m<Pt;m++)z+=` 3866`;return _[_.length-1]=" "+_[_.length-1]+"]"+(lt?"":z),_}(p,w,D,Q,ie),Oe=["Tensor"];return W&&(Oe.push(" dtype: "+D),Oe.push(" rank: "+fe),Oe.push(" shape: ["+w+"]"),Oe.push(" values:")),Oe.push(ye.map(function(Re){return" "+Re}).join(` 3867`)),Oe.join(` 3868`)}(this.dataSync(),this.shape,this.dtype,x)},C.prototype.tile=function(x){return this.throwIfDisposed(),Ft.tile(this,x)},C.prototype.gather=function(x,p){return p===void 0&&(p=0),this.throwIfDisposed(),Ft.gather(this,x,p)},C.prototype.matMul=function(x,p,w){return p===void 0&&(p=!1),w===void 0&&(w=!1),this.throwIfDisposed(),Ft.matMul(this,x,p,w)},C.prototype.dot=function(x){return this.throwIfDisposed(),Ft.dot(this,x)},C.prototype.norm=function(x,p,w){return x===void 0&&(x="euclidean"),p===void 0&&(p=null),w===void 0&&(w=!1),this.throwIfDisposed(),Ft.norm(this,x,p,w)},C.prototype.slice=function(x,p){return this.throwIfDisposed(),Ft.slice(this,x,p)},C.prototype.reverse=function(x){return this.throwIfDisposed(),Ft.reverse(this,x)},C.prototype.concat=function(x,p){return p===void 0&&(p=0),this.throwIfDisposed(),x instanceof C&&(x=[x]),Ft.concat([this].concat(x),p)},C.prototype.split=function(x,p){return p===void 0&&(p=0),this.throwIfDisposed(),Ft.split(this,x,p)},C.prototype.stack=function(x,p){return p===void 0&&(p=0),Ft.stack([this,x],p)},C.prototype.unstack=function(x){return x===void 0&&(x=0),Ft.unstack(this,x)},C.prototype.pad=function(x,p){return p===void 0&&(p=0),Ft.pad(this,x,p)},C.prototype.batchNormalization=function(x,p,w,D,W){return w===void 0&&(w=.001),Qr("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(x,p,W,D,w)},C.prototype.batchNorm=function(x,p,w,D,W){return W===void 0&&(W=.001),this.throwIfDisposed(),Ft.batchNorm(this,x,p,w,D,W)},C.prototype.all=function(x,p){return x===void 0&&(x=null),p===void 0&&(p=!1),this.throwIfDisposed(),Ft.all(this,x,p)},C.prototype.any=function(x,p){return x===void 0&&(x=null),p===void 0&&(p=!1),this.throwIfDisposed(),Ft.any(this,x,p)},C.prototype.logSumExp=function(x,p){return x===void 0&&(x=null),p===void 0&&(p=!1),this.throwIfDisposed(),Ft.logSumExp(this,x,p)},C.prototype.sum=function(x,p){return x===void 0&&(x=null),p===void 0&&(p=!1),this.throwIfDisposed(),Ft.sum(this,x,p)},C.prototype.prod=function(x,p){return x===void 0&&(x=null),p===void 0&&(p=!1),this.throwIfDisposed(),Ft.prod(this,x,p)},C.prototype.mean=function(x,p){return x===void 0&&(x=null),p===void 0&&(p=!1),this.throwIfDisposed(),Ft.mean(this,x,p)},C.prototype.min=function(x,p){return x===void 0&&(x=null),p===void 0&&(p=!1),this.throwIfDisposed(),Ft.min(this,x,p)},C.prototype.max=function(x,p){return x===void 0&&(x=null),p===void 0&&(p=!1),this.throwIfDisposed(),Ft.max(this,x,p)},C.prototype.argMin=function(x){return x===void 0&&(x=null),this.throwIfDisposed(),Ft.argMin(this,x)},C.prototype.argMax=function(x){return x===void 0&&(x=null),this.throwIfDisposed(),Ft.argMax(this,x)},C.prototype.cast=function(x){return this.throwIfDisposed(),Ft.cast(this,x)},C.prototype.add=function(x){return this.throwIfDisposed(),Ft.add(this,x)},C.prototype.addStrict=function(x){return this.throwIfDisposed(),Ft.addStrict(this,x)},C.prototype.atan2=function(x){return this.throwIfDisposed(),Ft.atan2(this,x)},C.prototype.sub=function(x){return this.throwIfDisposed(),Ft.sub(this,x)},C.prototype.subStrict=function(x){return this.throwIfDisposed(),Ft.subStrict(this,x)},C.prototype.pow=function(x){return this.throwIfDisposed(),Ft.pow(this,x)},C.prototype.powStrict=function(x){return this.throwIfDisposed(),Ft.powStrict(this,x)},C.prototype.mul=function(x){return this.throwIfDisposed(),Ft.mul(this,x)},C.prototype.mulStrict=function(x){return this.throwIfDisposed(),Ft.mulStrict(this,x)},C.prototype.div=function(x){return this.throwIfDisposed(),Ft.div(this,x)},C.prototype.divNoNan=function(x){return this.throwIfDisposed(),Ft.divNoNan(this,x)},C.prototype.floorDiv=function(x){return this.throwIfDisposed(),Ft.floorDiv(this,x)},C.prototype.divStrict=function(x){return this.throwIfDisposed(),Ft.divStrict(this,x)},C.prototype.minimum=function(x){return this.throwIfDisposed(),Ft.minimum(this,x)},C.prototype.minimumStrict=function(x){return this.throwIfDisposed(),Ft.minimumStrict(this,x)},C.prototype.maximum=function(x){return this.throwIfDisposed(),Ft.maximum(this,x)},C.prototype.maximumStrict=function(x){return this.throwIfDisposed(),Ft.maximumStrict(this,x)},C.prototype.mod=function(x){return this.throwIfDisposed(),Ft.mod(this,x)},C.prototype.modStrict=function(x){return this.throwIfDisposed(),Ft.modStrict(this,x)},C.prototype.squaredDifferenceStrict=function(x){return this.throwIfDisposed(),Ft.squaredDifferenceStrict(this,x)},C.prototype.transpose=function(x){return this.throwIfDisposed(),Ft.transpose(this,x)},C.prototype.notEqual=function(x){return this.throwIfDisposed(),Ft.notEqual(this,x)},C.prototype.notEqualStrict=function(x){return this.throwIfDisposed(),Ft.notEqualStrict(this,x)},C.prototype.less=function(x){return this.throwIfDisposed(),Ft.less(this,x)},C.prototype.lessStrict=function(x){return this.throwIfDisposed(),Ft.lessStrict(this,x)},C.prototype.equal=function(x){return this.throwIfDisposed(),Ft.equal(this,x)},C.prototype.equalStrict=function(x){return this.throwIfDisposed(),Ft.equalStrict(this,x)},C.prototype.lessEqual=function(x){return this.throwIfDisposed(),Ft.lessEqual(this,x)},C.prototype.lessEqualStrict=function(x){return this.throwIfDisposed(),Ft.lessEqualStrict(this,x)},C.prototype.greater=function(x){return this.throwIfDisposed(),Ft.greater(this,x)},C.prototype.greaterStrict=function(x){return this.throwIfDisposed(),Ft.greaterStrict(this,x)},C.prototype.greaterEqual=function(x){return this.throwIfDisposed(),Ft.greaterEqual(this,x)},C.prototype.greaterEqualStrict=function(x){return this.throwIfDisposed(),Ft.greaterEqualStrict(this,x)},C.prototype.logicalAnd=function(x){return this.throwIfDisposed(),Ft.logicalAnd(this,x)},C.prototype.logicalOr=function(x){return this.throwIfDisposed(),Ft.logicalOr(this,x)},C.prototype.logicalNot=function(){return this.throwIfDisposed(),Ft.logicalNot(this)},C.prototype.logicalXor=function(x){return this.throwIfDisposed(),Ft.logicalXor(this,x)},C.prototype.where=function(x,p){return this.throwIfDisposed(),Ft.where(x,this,p)},C.prototype.neg=function(){return this.throwIfDisposed(),Ft.neg(this)},C.prototype.ceil=function(){return this.throwIfDisposed(),Ft.ceil(this)},C.prototype.floor=function(){return this.throwIfDisposed(),Ft.floor(this)},C.prototype.sign=function(){return this.throwIfDisposed(),Ft.sign(this)},C.prototype.isNaN=function(){return this.throwIfDisposed(),Ft.isNaN(this)},C.prototype.isInf=function(){return this.throwIfDisposed(),Ft.isInf(this)},C.prototype.isFinite=function(){return this.throwIfDisposed(),Ft.isFinite(this)},C.prototype.exp=function(){return this.throwIfDisposed(),Ft.exp(this)},C.prototype.expm1=function(){return this.throwIfDisposed(),Ft.expm1(this)},C.prototype.log=function(){return this.throwIfDisposed(),Ft.log(this)},C.prototype.log1p=function(){return this.throwIfDisposed(),Ft.log1p(this)},C.prototype.sqrt=function(){return this.throwIfDisposed(),Ft.sqrt(this)},C.prototype.rsqrt=function(){return this.throwIfDisposed(),Ft.rsqrt(this)},C.prototype.square=function(){return this.throwIfDisposed(),Ft.square(this)},C.prototype.reciprocal=function(){return this.throwIfDisposed(),Ft.reciprocal(this)},C.prototype.abs=function(){return this.throwIfDisposed(),Ft.abs(this)},C.prototype.clipByValue=function(x,p){return this.throwIfDisposed(),Ft.clipByValue(this,x,p)},C.prototype.relu=function(){return this.throwIfDisposed(),Ft.relu(this)},C.prototype.relu6=function(){return this.throwIfDisposed(),Ft.relu6(this)},C.prototype.elu=function(){return this.throwIfDisposed(),Ft.elu(this)},C.prototype.selu=function(){return this.throwIfDisposed(),Ft.selu(this)},C.prototype.leakyRelu=function(x){return x===void 0&&(x=.2),this.throwIfDisposed(),Ft.leakyRelu(this,x)},C.prototype.prelu=function(x){return this.throwIfDisposed(),Ft.prelu(this,x)},C.prototype.sigmoid=function(){return this.throwIfDisposed(),Ft.sigmoid(this)},C.prototype.logSigmoid=function(){return this.throwIfDisposed(),Ft.logSigmoid(this)},C.prototype.softplus=function(){return this.throwIfDisposed(),Ft.softplus(this)},C.prototype.zerosLike=function(){return this.throwIfDisposed(),Ft.zerosLike(this)},C.prototype.onesLike=function(){return this.throwIfDisposed(),Ft.onesLike(this)},C.prototype.sin=function(){return this.throwIfDisposed(),Ft.sin(this)},C.prototype.cos=function(){return this.throwIfDisposed(),Ft.cos(this)},C.prototype.tan=function(){return this.throwIfDisposed(),Ft.tan(this)},C.prototype.asin=function(){return this.throwIfDisposed(),Ft.asin(this)},C.prototype.acos=function(){return this.throwIfDisposed(),Ft.acos(this)},C.prototype.atan=function(){return this.throwIfDisposed(),Ft.atan(this)},C.prototype.sinh=function(){return this.throwIfDisposed(),Ft.sinh(this)},C.prototype.cosh=function(){return this.throwIfDisposed(),Ft.cosh(this)},C.prototype.tanh=function(){return this.throwIfDisposed(),Ft.tanh(this)},C.prototype.asinh=function(){return this.throwIfDisposed(),Ft.asinh(this)},C.prototype.acosh=function(){return this.throwIfDisposed(),Ft.acosh(this)},C.prototype.atanh=function(){return this.throwIfDisposed(),Ft.atanh(this)},C.prototype.erf=function(){return this.throwIfDisposed(),Ft.erf(this)},C.prototype.round=function(){return this.throwIfDisposed(),Ft.round(this)},C.prototype.step=function(x){return x===void 0&&(x=0),this.throwIfDisposed(),Ft.step(this,x)},C.prototype.softmax=function(x){return x===void 0&&(x=-1),this.throwIfDisposed(),Ft.softmax(this,x)},C.prototype.logSoftmax=function(x){return x===void 0&&(x=-1),this.throwIfDisposed(),Ft.logSoftmax(this,x)},C.prototype.resizeBilinear=function(x,p){return p===void 0&&(p=!1),this.throwIfDisposed(),Ft.image.resizeBilinear(this,x,p)},C.prototype.resizeNearestNeighbor=function(x,p){return p===void 0&&(p=!1),this.throwIfDisposed(),Ft.image.resizeNearestNeighbor(this,x,p)},C.prototype.conv1d=function(x,p,w,D,W,Q){return D===void 0&&(D="NWC"),W===void 0&&(W=1),this.throwIfDisposed(),Ft.conv1d(this,x,p,w,D,W,Q)},C.prototype.conv2d=function(x,p,w,D,W,Q){return D===void 0&&(D="NHWC"),W===void 0&&(W=[1,1]),this.throwIfDisposed(),Ft.conv2d(this,x,p,w,D,W,Q)},C.prototype.conv2dTranspose=function(x,p,w,D,W){return this.throwIfDisposed(),Ft.conv2dTranspose(this,x,p,w,D,W)},C.prototype.depthwiseConv2D=function(x,p,w,D,W,Q){return D===void 0&&(D="NHWC"),W===void 0&&(W=[1,1]),this.throwIfDisposed(),Ft.depthwiseConv2d(this,x,p,w,D,W,Q)},C.prototype.separableConv2d=function(x,p,w,D,W,Q){return W===void 0&&(W=[1,1]),Q===void 0&&(Q="NHWC"),this.throwIfDisposed(),Ft.separableConv2d(this,x,p,w,D,W,Q)},C.prototype.avgPool=function(x,p,w,D){return this.throwIfDisposed(),Ft.avgPool(this,x,p,w,D)},C.prototype.maxPool=function(x,p,w,D){return this.throwIfDisposed(),Ft.maxPool(this,x,p,w,D)},C.prototype.localResponseNormalization=function(x,p,w,D){return x===void 0&&(x=5),p===void 0&&(p=1),w===void 0&&(w=1),D===void 0&&(D=.5),Ft.localResponseNormalization(this,x,p,w,D)},C.prototype.pool=function(x,p,w,D,W){return this.throwIfDisposed(),Ft.pool(this,x,p,w,D,W)},C.prototype.variable=function(x,p,w){return x===void 0&&(x=!0),this.throwIfDisposed(),$i().makeVariable(this,x,p,w)},C.prototype.unsortedSegmentSum=function(x,p){return this.throwIfDisposed(),Ft.unsortedSegmentSum(this,x,p)},C.prototype.batchToSpaceND=function(x,p){return this.throwIfDisposed(),Ft.batchToSpaceND(this,x,p)},C.prototype.spaceToBatchND=function(x,p){return this.throwIfDisposed(),Ft.spaceToBatchND(this,x,p)},C.prototype.topk=function(x,p){return x===void 0&&(x=1),p===void 0&&(p=!0),this.throwIfDisposed(),Ft.topk(this,x,p)},C.prototype.stridedSlice=function(x,p,w,D,W,Q,ie,fe){return D===void 0&&(D=0),W===void 0&&(W=0),Q===void 0&&(Q=0),ie===void 0&&(ie=0),fe===void 0&&(fe=0),this.throwIfDisposed(),Ft.stridedSlice(this,x,p,w,D,W,Q,ie,fe)},C.prototype.depthToSpace=function(x,p){return this.throwIfDisposed(),Ft.depthToSpace(this,x,p)},C.prototype.fft=function(){return this.throwIfDisposed(),Ft.spectral.fft(this)},C.prototype.ifft=function(){return this.throwIfDisposed(),Ft.spectral.ifft(this)},C.prototype.rfft=function(){return this.throwIfDisposed(),Ft.spectral.rfft(this)},C.prototype.irfft=function(){return this.throwIfDisposed(),Ft.spectral.irfft(this)},C}();Object.defineProperty(Zt,Symbol.hasInstance,{value:function(C){return!!C&&C.dataId!=null&&C.shape!=null&&C.dtype!=null}});var _e,ge,Ae,Ie,it,St=function(C){function x(p,w,D,W){var Q=C.call(this,p.shape,p.dtype,p.dataId,W)||this;return Q.trainable=w,Q.name=D,Q}return A(x,C),x.prototype.assign=function(p){if(p.dtype!==this.dtype)throw new Error("dtype of the new value ("+p.dtype+") and previous value ("+this.dtype+") must match");if(!Tt(p.shape,this.shape))throw new Error("shape of the new value ("+p.shape+") and previous value ("+this.shape+") must match");$i().disposeTensor(this),this.dataId=p.dataId,$i().incRef(this,null)},x.prototype.dispose=function(){$i().disposeVariable(this),this.isDisposedInternal=!0},x}(Zt);Object.defineProperty(St,Symbol.hasInstance,{value:function(C){return C instanceof Zt&&C.assign!=null&&C.assign instanceof Function}}),function(C){C.R0="R0",C.R1="R1",C.R2="R2",C.R3="R3",C.R4="R4",C.R5="R5",C.R6="R6"}(_e||(_e={})),function(C){C.float32="float32",C.int32="int32",C.bool="int32",C.complex64="complex64"}(ge||(ge={})),function(C){C.float32="float32",C.int32="int32",C.bool="bool",C.complex64="complex64"}(Ae||(Ae={})),function(C){C.float32="float32",C.int32="float32",C.bool="float32",C.complex64="complex64"}(Ie||(Ie={})),function(C){C.float32="complex64",C.int32="complex64",C.bool="complex64",C.complex64="complex64"}(it||(it={}));var Jt={float32:Ie,int32:ge,bool:Ae,complex64:it};function kn(C,x){if(C==="string"||x==="string"){if(C==="string"&&x==="string")return"string";throw new Error("Can not upcast "+C+" with "+x)}return Jt[C][x]}function rr(C){return kn(C,"int32")}function Bn(C,x){if(C.dtype===x.dtype)return[C,x];var p=kn(C.dtype,x.dtype);return[C.cast(p),x.cast(p)]}function Gn(C,x){Ee(C.dtype===x.dtype,function(){return"The dtypes of the first("+C.dtype+") and second("+x.dtype+") input must match"})}function Zn(C){var x=[];return function p(w,D,W){if(w!=null){if(w instanceof Zt)D.push(w);else if(Q=w,Array.isArray(Q)||typeof Q=="object"){var Q,ie=w;for(var fe in ie){var ye=ie[fe];W.has(ye)||(W.add(ye),p(ye,D,W))}}}}(C,x,new Set),x}var Gt,Wt=Object.freeze({makeTypesMatch:Bn,assertTypesMatch:Gn,isTensorInList:function(C,x){return x.some(function(p){return p.id===C.id})},getTensorsInContainer:Zn}),Sn=function(){function C(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null}}return C.prototype.dispose=function(){for(var x in this.registeredVariables)this.registeredVariables[x].dispose()},C}(),un=function(){function C(x){this.ENV=x,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Sn}return C.prototype.ready=function(){return S(this,void 0,void 0,function(){var x,p,w;return M(this,function(D){switch(D.label){case 0:if(this.pendingBackendInit!=null)return[2,this.pendingBackendInit.then(function(){})];if(this.backendInstance!=null)return[2];x=this.getSortedBackends(),p=0,D.label=1;case 1:return p<x.length?(w=x[p],[4,this.initializeBackend(w).success]):[3,5];case 2:return D.sent()?[4,this.setBackend(w)]:[3,4];case 3:return D.sent(),[2];case 4:return p++,[3,1];case 5:throw new Error("Could not initialize any backends, all backend initializations failed.")}})})},Object.defineProperty(C.prototype,"backend",{get:function(){if(this.pendingBackendInit!=null)throw new Error("Backend '"+this.backendName+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");if(this.backendInstance==null){var x=this.initializeBackendsAndReturnBest(),p=x.name;if(x.asyncInit)throw new Error("The highest priority backend '"+p+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(p)}return this.backendInstance},enumerable:!0,configurable:!0}),C.prototype.backendNames=function(){return Object.keys(this.registryFactory)},C.prototype.findBackend=function(x){return!(x in this.registry)&&(!(x in this.registryFactory)||this.initializeBackend(x).asyncInit)?null:this.registry[x]},C.prototype.findBackendFactory=function(x){return x in this.registryFactory?this.registryFactory[x].factory:null},C.prototype.registerBackend=function(x,p,w){return w===void 0&&(w=1),x in this.registryFactory?(console.warn(x+" backend was already registered. Reusing existing backend factory."),!1):(this.registryFactory[x]={factory:p,priority:w},!0)},C.prototype.setBackend=function(x){return S(this,void 0,void 0,function(){var p,w,D;return M(this,function(W){switch(W.label){case 0:if(this.registryFactory[x]==null)throw new Error("Backend name '"+x+"' not found in registry");return this.backendName=x,this.registry[x]!=null?[3,4]:(this.backendInstance=null,p=this.initializeBackend(x),w=p.success,p.asyncInit?[4,w]:[3,2]);case 1:return D=W.sent(),[3,3];case 2:D=w,W.label=3;case 3:if(!D)return[2,!1];W.label=4;case 4:return this.backendInstance=this.registry[x],this.setupRegisteredKernels(),this.profiler=new ci(this.backendInstance),[2,!0]}})})},C.prototype.setupRegisteredKernels=function(){var x=this;re(this.backendName).forEach(function(p){p.setupFunc!=null&&p.setupFunc(x.backendInstance)})},C.prototype.disposeRegisteredKernels=function(x){var p=this;re(x).forEach(function(w){w.disposeFunc!=null&&w.disposeFunc(p.registry[x])})},C.prototype.initializeBackend=function(x){var p=this,w=this.registryFactory[x];if(w==null)throw new Error("Cannot initialize backend "+x+", no registration found.");try{var D=w.factory();if(Promise.resolve(D)===D){var W=++this.pendingBackendInitId,Q=D.then(function(ie){return!(W<p.pendingBackendInitId||(p.registry[x]=ie,p.pendingBackendInit=null,0))}).catch(function(ie){return!(W<p.pendingBackendInitId||(p.pendingBackendInit=null,console.warn("Initialization of backend "+x+" failed"),console.warn(ie.stack||ie.message),1))});return this.pendingBackendInit=Q,{success:Q,asyncInit:!0}}return this.registry[x]=D,{success:!0,asyncInit:!1}}catch(ie){return console.warn("Initialization of backend "+x+" failed"),console.warn(ie.stack||ie.message),{success:!1,asyncInit:!1}}},C.prototype.removeBackend=function(x){if(!(x in this.registryFactory))throw new Error(x+" backend not found in registry");this.backendName===x&&this.pendingBackendInit!=null&&this.pendingBackendInitId++,x in this.registry&&(this.disposeRegisteredKernels(x),this.registry[x].dispose(),delete this.registry[x]),delete this.registryFactory[x],this.backendName===x&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)},C.prototype.getSortedBackends=function(){var x=this;if(Object.keys(this.registryFactory).length===0)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(function(p,w){return x.registryFactory[w].priority-x.registryFactory[p].priority})},C.prototype.initializeBackendsAndReturnBest=function(){for(var x=this.getSortedBackends(),p=0;p<x.length;p++){var w=x[p],D=this.initializeBackend(w),W=D.success,Q=D.asyncInit;if(Q||W)return{name:w,asyncInit:Q}}throw new Error("Could not initialize any backends, all backend initializations failed.")},C.prototype.moveData=function(x,p){var w=this.state.tensorInfo.get(p),D=w.backend,W=this.readSync(p);D.disposeData(p),w.backend=x,x.move(p,W,w.shape,w.dtype),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++},C.prototype.tidy=function(x,p){var w,D=this,W=null;if(p==null){if(typeof x!="function")throw new Error("Please provide a function to tidy()");p=x}else{if(typeof x!="string"&&!(x instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if(typeof p!="function")throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");W=x}return this.scopedRun(function(){return D.startScope(W)},function(){return D.endScope(w)},function(){return(w=p())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),w})},C.prototype.scopedRun=function(x,p,w){x();try{var D=w();return p(),D}catch(W){throw p(),W}},C.prototype.nextTensorId=function(){return C.nextTensorId++},C.prototype.nextVariableId=function(){return C.nextVariableId++},C.prototype.clone=function(x){var p=this.makeTensorFromDataId(x.dataId,x.shape,x.dtype),w={x};return this.addTapeNode(this.state.activeScope.name,w,[p],function(D){return{x:function(){return D.toFloat()}}},[]),p},C.prototype.runKernel=function(x,p,w,D,W){return this.runKernelFunc(null,p,null,x,w,D,W)},C.prototype.shouldCheckForMemLeaks=function(){return this.ENV.getBool("IS_TEST")},C.prototype.checkKernelForMemLeak=function(x,p,w){var D=this.backend.numDataIds(),W=0;w.forEach(function(fe){W+=fe.dtype==="complex64"?3:1});var Q=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],ie=D-p-W-Q;if(ie>0)throw new Error("Backend '"+this.backendName+"' has an internal memory leak ("+ie+" data ids) after running '"+x+"'")},C.prototype.runKernelFunc=function(x,p,w,D,W,Q,ie){var fe,ye=this;Q===void 0&&(Q=[]),ie===void 0&&(ie=[]);var Oe=[],Re=this.isTapeOn();D==null&&(D=this.state.activeScope!=null?this.state.activeScope.name:"");var Pe,je=function(Nt){Re&&(Oe=Nt.map(function(Rt){return ye.keep(ye.clone(Rt))}))},Ge=this.state.numBytes,rt=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);var nt,lt=J(D,this.backendName);return Pe=lt!=null?function(){var Nt=ye.backend.numDataIds();nt=lt.kernelFunc({inputs:p,attrs:W,backend:ye.backend});var Rt=Array.isArray(nt)?nt:[nt];ye.shouldCheckForMemLeaks()&&ye.checkKernelForMemLeak(D,Nt,Rt);var Pt=Rt.map(function(dn){var bn=dn.dataId,pn=dn.shape,_n=dn.dtype;return ye.makeTensorFromDataId(bn,pn,_n)}),Kt=Pt.filter(function(dn,bn){return ie[bn]});return je((Q||[]).slice().concat(Kt)),Pt}:function(){var Nt=ye.backend.numDataIds();nt=ye.tidy(function(){return x(ye.backend,je)});var Rt=Array.isArray(nt)?nt:[nt];return ye.shouldCheckForMemLeaks()&&ye.checkKernelForMemLeak(D,Nt,Rt),Rt},this.scopedRun(function(){return ye.state.kernelDepth++},function(){return ye.state.kernelDepth--},function(){fe=ye.ENV.getBool("DEBUG")?ye.profiler.profileKernel(D,p,function(){return Pe()}):Pe()}),Re&&this.addTapeNode(D,p,fe,w,Oe),this.state.profiling&&this.state.activeProfile.kernels.push({name:D,bytesAdded:this.state.numBytes-Ge,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-rt,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(p).map(function(Nt){return p[Nt].shape}),outputShapes:fe.map(function(Nt){return Nt.shape})}),Array.isArray(nt)?fe:fe[0]},C.prototype.makeTensor=function(x,p,w,D){if(x==null)throw new Error("Values passed to engine.makeTensor() are null");w=w||"float32",D=D||this.backend;var W=x;w==="string"&&on(x[0])&&(W=x.map(function(Oe){return Fn(Oe)}));var Q=D.write(W,p,w),ie=new Zt(p,w,Q,this.nextTensorId());if(this.incRef(ie,D),w==="string"){var fe=this.state.tensorInfo.get(Q),ye=ct(W);this.state.numBytes+=ye-fe.bytes,fe.bytes=ye}return ie},C.prototype.makeTensorFromDataId=function(x,p,w,D){var W=new Zt(p,w=w||"float32",x,this.nextTensorId());return this.incRef(W,D),W},C.prototype.makeVariable=function(x,p,w,D){p===void 0&&(p=!0),w=w||this.nextVariableId().toString(),D!=null&&D!==x.dtype&&(x=x.asType(D));var W=new St(x,p,w,this.nextTensorId());if(this.state.registeredVariables[W.name]!=null)throw new Error("Variable with name "+W.name+" was already registered");return this.state.registeredVariables[W.name]=W,this.incRef(W,this.backend),W},C.prototype.incRef=function(x,p){var w=this.state.tensorInfo.has(x.dataId)?this.state.tensorInfo.get(x.dataId).refCount:0;if(this.state.numTensors++,x.dtype==="string"&&this.state.numStringTensors++,w===0){this.state.numDataBuffers++;var D=0;x.dtype!=="complex64"&&x.dtype!=="string"&&(D=x.size*It(x.dtype)),this.state.tensorInfo.set(x.dataId,{backend:p||this.backend,dtype:x.dtype,shape:x.shape,bytes:D,refCount:0}),this.state.numBytes+=D}this.state.tensorInfo.get(x.dataId).refCount++,x instanceof St||this.track(x)},C.prototype.disposeTensor=function(x){if(this.state.tensorInfo.has(x.dataId)){this.state.numTensors--,x.dtype==="string"&&this.state.numStringTensors--;var p=this.state.tensorInfo.get(x.dataId);p.refCount<=1?(x.dtype!=="complex64"&&(this.state.numBytes-=p.bytes),this.state.numDataBuffers--,p.backend.disposeData(x.dataId),this.state.tensorInfo.delete(x.dataId)):this.state.tensorInfo.get(x.dataId).refCount--}},C.prototype.disposeVariables=function(){for(var x in this.state.registeredVariables){var p=this.state.registeredVariables[x];this.disposeVariable(p)}},C.prototype.disposeVariable=function(x){this.disposeTensor(x),this.state.registeredVariables[x.name]!=null&&delete this.state.registeredVariables[x.name]},C.prototype.memory=function(){var x=this.backend.memory();return x.numTensors=this.state.numTensors,x.numDataBuffers=this.state.numDataBuffers,x.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(x.unreliable=!0,x.reasons==null&&(x.reasons=[]),x.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),x},C.prototype.profile=function(x){return S(this,void 0,void 0,function(){var p,w;return M(this,function(D){return this.state.profiling=!0,p=this.state.numBytes,w=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=x(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map(function(W){return W.totalBytesSnapshot})),this.state.activeProfile.newBytes=this.state.numBytes-p,this.state.activeProfile.newTensors=this.state.numTensors-w,[2,this.state.activeProfile]})})},C.prototype.isTapeOn=function(){return this.state.gradientDepth>0&&this.state.kernelDepth===0},C.prototype.addTapeNode=function(x,p,w,D,W){var Q=this,ie={id:this.state.nextTapeNodeId++,kernelName:x,inputs:p,outputs:w,saved:W},fe=K(x);fe!=null&&(D=fe.gradFunc),D!=null&&(ie.gradient=function(ye){return ye=ye.map(function(Oe,Re){if(Oe==null){var Pe=w[Re],je=rn(Pe.size,Pe.dtype);return Q.makeTensor(je,Pe.shape,Pe.dtype)}return Oe}),D(ye.length>1?ye:ye[0],W)}),this.state.activeTape.push(ie)},C.prototype.keep=function(x){return x.kept=!0,x},C.prototype.startTape=function(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++},C.prototype.endTape=function(){this.state.gradientDepth--},C.prototype.startScope=function(x){var p={track:[],name:"unnamed scope",id:this.state.nextScopeId++};x&&(p.name=x),this.state.scopeStack.push(p),this.state.activeScope=p},C.prototype.endScope=function(x){for(var p=this,w=Zn(x),D=new Set(w.map(function(fe){return fe.id})),W=0;W<this.state.activeScope.track.length;W++){var Q=this.state.activeScope.track[W];Q.kept||D.has(Q.id)||Q.dispose()}var ie=this.state.scopeStack.pop();this.state.activeScope=this.state.scopeStack.length===0?null:this.state.scopeStack[this.state.scopeStack.length-1],w.forEach(function(fe){fe.kept||fe.scopeId!==ie.id||p.track(fe)})},C.prototype.gradients=function(x,p,w,D){var W=this;if(D===void 0&&(D=!1),Ee(p.length>0,function(){return"gradients() received an empty list of xs."}),w!=null&&w.dtype!=="float32")throw new Error("dy must have 'float32' dtype, but has '"+w.dtype+"'");var Q=this.scopedRun(function(){return W.startTape()},function(){return W.endTape()},function(){return W.tidy("forward",x)});Ee(Q instanceof Zt,function(){return"The result y returned by f() must be a tensor."});var ie=function(fe,ye,Oe){for(var Re={},Pe={},je=0;je<ye.length;je++)Re[ye[je].id]=!0;for(je=0;je<fe.length;je++){var Ge=(dn=fe[je]).inputs;for(var rt in Ge){for(var nt=Ge[rt],lt=!1,Nt=0;Nt<ye.length;Nt++)if(Re[nt.id]){dn.outputs.forEach(function(On){return Re[On.id]=!0}),lt=!0,Pe[dn.id]=!0;break}if(lt)break}}var Rt={};Rt[Oe.id]=!0;var Pt={};for(je=fe.length-1;je>=0;je--)for(Ge=(dn=fe[je]).inputs,Nt=0;Nt<dn.outputs.length;Nt++)if(Rt[dn.outputs[Nt].id]){for(var rt in Ge)Rt[Ge[rt].id]=!0,Pt[dn.id]=!0;break}var Kt=[];for(je=0;je<fe.length;je++){var dn;if(Pe[(dn=fe[je]).id]&&Pt[dn.id]){var bn={};for(var rt in dn.inputs){var pn=dn.inputs[rt];Re[pn.id]&&(bn[rt]=pn)}var _n=Object.assign({},dn);_n.inputs=bn,_n.outputs=dn.outputs,Kt.push(_n)}}return Kt}(this.state.activeTape,p,Q);if(!D&&ie.length===0&&p.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",function(){var fe,ye,Oe={};Oe[Q.id]=w??(ye=hn(Ke(fe=Q.shape),"float32"),qe.makeTensor(ye,fe,"float32")),function(Pe,je,Ge){for(var rt=function(lt){var Nt=je[lt],Rt=[];if(Nt.outputs.forEach(function(bn){var pn=Pe[bn.id];pn!=null?Rt.push(pn):Rt.push(null)}),Nt.gradient==null)throw new Error("Cannot compute gradient: gradient function not found for "+Nt.kernelName+".");var Pt=Nt.gradient(Rt),Kt=function(bn){if(!(bn in Pt))throw new Error("Cannot backprop through input "+bn+". Available gradients found: "+Object.keys(Pt)+".");var pn=Ge(function(){return Pt[bn]()});if(pn.dtype!=="float32")throw new Error("Error in gradient for op "+Nt.kernelName+". The gradient of input "+bn+" must have 'float32' dtype, but has '"+pn.dtype+"'");var _n=Nt.inputs[bn];if(!Tt(pn.shape,_n.shape))throw new Error("Error in gradient for op "+Nt.kernelName+". The gradient of input '"+bn+"' has shape '"+pn.shape+"', which does not match the shape of the input '"+_n.shape+"'");if(Pe[_n.id]==null)Pe[_n.id]=pn;else{var On=Pe[_n.id];Pe[_n.id]=On.add(pn),On.dispose()}};for(var dn in Nt.inputs)Kt(dn)},nt=je.length-1;nt>=0;nt--)rt(nt)}(Oe,ie,function(Pe){return W.tidy(Pe)});var Re=p.map(function(Pe){return Oe[Pe.id]});return W.state.gradientDepth===0&&(W.state.activeTape.forEach(function(Pe){for(var je=0,Ge=Pe.saved;je<Ge.length;je++)Ge[je].dispose()}),W.state.activeTape=null),{value:Q,grads:Re}})},C.prototype.customGrad=function(x){var p=this;return Ee(jn(x),function(){return"The f passed in customGrad(f) must be a function."}),function(){for(var w,D=[],W=0;W<arguments.length;W++)D[W]=arguments[W];Ee(D.every(function(ie){return ie instanceof Zt}),function(){return"The args passed in customGrad(f)(x1, x2,...) must all be tensors"});var Q={};return D.forEach(function(ie,fe){Q[fe]=ie}),p.runKernelFunc(function(ie,fe){return Ee((w=x.apply(void 0,D.concat([fe]))).value instanceof Zt,function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"}),Ee(jn(w.gradFunc),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."}),w.value},Q,function(ie,fe){var ye=w.gradFunc(ie,fe),Oe=Array.isArray(ye)?ye:[ye];Ee(Oe.length===D.length,function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."}),Ee(Oe.every(function(Pe){return Pe instanceof Zt}),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."});var Re={};return Oe.forEach(function(Pe,je){Re[je]=function(){return Pe}}),Re})}},C.prototype.readSync=function(x){return this.state.tensorInfo.get(x).backend.readSync(x)},C.prototype.read=function(x){return this.state.tensorInfo.get(x).backend.read(x)},C.prototype.time=function(x){return S(this,void 0,void 0,function(){var p,w;return M(this,function(D){switch(D.label){case 0:return p=fn(),[4,this.backend.time(x)];case 1:return(w=D.sent()).wallMs=fn()-p,[2,w]}})})},C.prototype.track=function(x){return this.state.activeScope!=null&&(x.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(x)),x},Object.defineProperty(C.prototype,"registeredVariables",{get:function(){return this.state.registeredVariables},enumerable:!0,configurable:!0}),C.prototype.reset=function(){for(var x in this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Sn,this.registry)this.disposeRegisteredKernels(x),this.registry[x].dispose(),delete this.registry[x];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null},C.nextTensorId=0,C.nextVariableId=0,C}(),qe=function(){var C=function(){if(Gt==null){var p=void 0;if(typeof window<"u")p=window;else if(s!==void 0)p=s;else if(h!==void 0)p=h;else{if(typeof self>"u")throw new Error("Could not find a global object");p=self}Gt=p}return Gt}();if(C._tfengine==null){var x=new P(C);C._tfengine=new un(x)}return function(p){V=p}(C._tfengine.ENV),$i=function(){return C._tfengine},C._tfengine}();function $n(){return typeof window<"u"&&window.document!=null||typeof WorkerGlobalScope<"u"}var er=L();er.registerFlag("DEBUG",function(){return!1},function(C){C&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")}),er.registerFlag("IS_BROWSER",function(){return $n()}),er.registerFlag("IS_NODE",function(){return h!==void 0&&h.versions!==void 0&&h.versions.node!==void 0}),er.registerFlag("IS_CHROME",function(){return typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}),er.registerFlag("PROD",function(){return!1}),er.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",function(){return er.getBool("DEBUG")}),er.registerFlag("DEPRECATION_WARNINGS_ENABLED",function(){return!0}),er.registerFlag("IS_TEST",function(){return!1});var sr,pr,Zr,Mr={},Ii={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function Lo(C,x){Mr[C]=x}function Ai(C){C in Mr||(Mr[C]=function(p){if(p!==1&&p!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var w=function(D){if(typeof OffscreenCanvas<"u"&&D===2)return new OffscreenCanvas(300,150);if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}(p);return w.addEventListener("webglcontextlost",function(D){D.preventDefault(),delete Mr[p]},!1),p===1?w.getContext("webgl",Ii)||w.getContext("experimental-webgl",Ii):w.getContext("webgl2",Ii)}(C));var x=Mr[C];return x.isContextLost()?(delete Mr[C],Ai(C)):(x.disable(x.DEPTH_TEST),x.disable(x.STENCIL_TEST),x.disable(x.BLEND),x.disable(x.DITHER),x.disable(x.POLYGON_OFFSET_FILL),x.disable(x.SAMPLE_COVERAGE),x.enable(x.SCISSOR_TEST),x.enable(x.CULL_FACE),x.cullFace(x.BACK),Mr[C])}function ko(C,x){return[x,C]}function Ji(C){var x=Ke(C);return bt(Math.ceil(x/4))}function ai(C,x){return[Math.max(1,Math.ceil(x/2)),Math.max(1,Math.ceil(C/2))]}function Yr(C,x){var p,w,D,W,Q,ie,fe,ye,Oe,Re=C;return L().getNumber("WEBGL_VERSION")===2?(p=Re.R32F,w=Re.R16F,D=Re.RGBA16F,W=Re.RGBA32F,Q=Re.RED,ie=4,fe=1,ye=Re.HALF_FLOAT,Oe=Re.FLOAT):(p=C.RGBA,w=C.RGBA,D=C.RGBA,W=Re.RGBA,Q=C.RGBA,ie=4,fe=4,ye=x!=null?x.HALF_FLOAT_OES:null,Oe=C.FLOAT),{internalFormatFloat:p,internalFormatHalfFloat:w,internalFormatPackedHalfFloat:D,internalFormatPackedFloat:W,textureFormatFloat:Q,downloadTextureFormat:C.RGBA,downloadUnpackNumChannels:ie,defaultNumChannels:fe,textureTypeHalfFloat:ye,textureTypeFloat:Oe}}function Hn(C,x,p){var w=p();return x&&function(D){var W=D.getError();if(W!==D.NO_ERROR)throw new Error("WebGL Error: "+Io(D,W))}(C),w}(function(C){C[C.DENSE=0]="DENSE",C[C.SHARED_BATCH=1]="SHARED_BATCH"})(sr||(sr={})),function(C){C[C.RENDER=0]="RENDER",C[C.UPLOAD=1]="UPLOAD",C[C.PIXELS=2]="PIXELS",C[C.DOWNLOAD=3]="DOWNLOAD"}(pr||(pr={})),function(C){C[C.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",C[C.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",C[C.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",C[C.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",C[C.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}(Zr||(Zr={}));var ki=596e-10,lo=65504;function Kr(C){return!!(L().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||C===0||ki<Math.abs(C)&&Math.abs(C)<lo)}function Io(C,x){switch(x){case C.NO_ERROR:return"NO_ERROR";case C.INVALID_ENUM:return"INVALID_ENUM";case C.INVALID_VALUE:return"INVALID_VALUE";case C.INVALID_OPERATION:return"INVALID_OPERATION";case C.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case C.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case C.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code "+x}}function Ko(C,x,p){return Ha(C,x,function(){return C.getExtension(p)},'Extension "'+p+'" not supported on this browser.')}function Eo(C,x,p){var w=Ha(C,x,function(){return C.createShader(C.VERTEX_SHADER)},"Unable to create vertex WebGLShader.");if(Hn(C,x,function(){return C.shaderSource(w,p)}),Hn(C,x,function(){return C.compileShader(w)}),C.getShaderParameter(w,C.COMPILE_STATUS)===!1)throw console.log(C.getShaderInfoLog(w)),new Error("Failed to compile vertex shader.");return w}function Yo(C,x,p){var w=Ha(C,x,function(){return C.createShader(C.FRAGMENT_SHADER)},"Unable to create fragment WebGLShader.");if(Hn(C,x,function(){return C.shaderSource(w,p)}),Hn(C,x,function(){return C.compileShader(w)}),C.getShaderParameter(w,C.COMPILE_STATUS)===!1)throw function(D,W){var Q=pp.exec(W);if(Q==null)return console.log("Couldn't parse line number in error: "+W),void console.log(D);for(var ie=+Q[1],fe=D.split(` 3869`),ye=fe.length.toString().length+2,Oe=fe.map(function(nt,lt){return Ht((lt+1).toString(),ye)+nt}),Re=0,Pe=0;Pe<Oe.length;Pe++)Re=Math.max(Oe[Pe].length,Re);var je=Oe.slice(0,ie-1),Ge=Oe.slice(ie-1,ie),rt=Oe.slice(ie);console.log(je.join(` 3870`)),console.log(W.split(` 3871`)[0]),console.log("%c "+Ht(Ge[0],Re),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(rt.join(` 3872`))}(p,C.getShaderInfoLog(w)),new Error("Failed to compile fragment shader.");return w}var vs,gu,pp=/ERROR: [0-9]+:([0-9]+):/g;function fo(C,x){return Ha(C,x,function(){return C.createProgram()},"Unable to create WebGLProgram.")}function yl(C,x,p){if(Hn(C,x,function(){return C.linkProgram(p)}),C.getProgramParameter(p,C.LINK_STATUS)===!1)throw console.log(C.getProgramInfoLog(p)),new Error("Failed to link vertex and fragment shaders.")}function Tc(C,x,p){if(Hn(C,x,function(){return C.validateProgram(p)}),C.getProgramParameter(p,C.VALIDATE_STATUS)===!1)throw console.log(C.getProgramInfoLog(p)),new Error("Shader program validation failed.")}function Wl(C,x,p){var w=Ha(C,x,function(){return C.createBuffer()},"Unable to create WebGLBuffer");return Hn(C,x,function(){return C.bindBuffer(C.ARRAY_BUFFER,w)}),Hn(C,x,function(){return C.bufferData(C.ARRAY_BUFFER,p,C.STATIC_DRAW)}),w}function Jc(C,x,p){var w=Ha(C,x,function(){return C.createBuffer()},"Unable to create WebGLBuffer");return Hn(C,x,function(){return C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,w)}),Hn(C,x,function(){return C.bufferData(C.ELEMENT_ARRAY_BUFFER,p,C.STATIC_DRAW)}),w}function Vl(C,x){return Ha(C,x,function(){return C.createTexture()},"Unable to create WebGLTexture.")}function Sm(C,x){var p=L().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(C<=0||x<=0){var w="["+C+"x"+x+"]";throw new Error("Requested texture size "+w+" is invalid.")}if(C>p||x>p)throw w="["+C+"x"+x+"]",new Error("Requested texture size "+w+" greater than WebGL maximum on this browser / GPU ["+p+"x"+p+"].")}function Qs(C,x){return Ha(C,x,function(){return C.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function Zd(C,x,p,w,D,W,Q,ie){var fe=C.getAttribLocation(p,w);return fe!==-1&&(Hn(C,x,function(){return C.bindBuffer(C.ARRAY_BUFFER,D)}),Hn(C,x,function(){return C.vertexAttribPointer(fe,W,C.FLOAT,!1,Q,ie)}),Hn(C,x,function(){return C.enableVertexAttribArray(fe)}),!0)}function Am(C,x,p,w){bl(C,w),Hn(C,x,function(){return C.activeTexture(C.TEXTURE0+w)}),Hn(C,x,function(){return C.bindTexture(C.TEXTURE_2D,p)})}function Qc(C,x,p,w){return Ha(C,x,function(){return C.getUniformLocation(p,w)},'uniform "'+w+'" not present in program.')}function eh(C,x,p){return C.getUniformLocation(x,p)}function mp(C,x,p,w,D,W){Hn(C,x,function(){return Am(C,x,w,W)}),Hn(C,x,function(){return C.uniform1i(D,W)})}function $l(C,x,p,w){Hn(C,x,function(){return C.bindFramebuffer(C.FRAMEBUFFER,w)}),Hn(C,x,function(){return C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,p,0)})}function nd(C,x,p){Hn(C,x,function(){return C.bindFramebuffer(C.FRAMEBUFFER,p)}),Hn(C,x,function(){return C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,null,0)})}function ys(C){var x=C.checkFramebufferStatus(C.FRAMEBUFFER);if(x!==C.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+vf(C,x))}function vf(C,x){switch(x){case C.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case C.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case C.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case C.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+x}}function Ha(C,x,p,w){var D=Hn(C,x,function(){return p()});if(D==null)throw new Error(w);return D}function bl(C,x){var p=C.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,w=x+C.TEXTURE0;if(w<C.TEXTURE0||w>p)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+p+"].")}function Zs(C,x){return x===void 0&&(x=2),Ke(C.slice(0,C.length-x))}function ls(C){if(C.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[C.length>1?C[C.length-2]:1,C[C.length-1]]}function xl(C){var x=[1,1,1];return C.length===0||C.length===1&&C[0]===1||(x=[Zs(C)].concat(ls(C))),x}function rd(C,x){var p;x===void 0&&(x=!1);var w=L().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(x&&(w*=2,(C=C.map(function(ye,Oe){return Oe>=C.length-2?Dt(C[Oe]):C[Oe]})).length===1&&(C=[2,C[0]])),C.length!==2){var D=sn(C);C=D.newShape}var W=Ke(C);if(C.length<=1&&W<=w)return[1,W];if(C.length===2&&C[0]<=w&&C[1]<=w)return C;if(C.length===3&&C[0]*C[1]<=w&&C[2]<=w)return[C[0]*C[1],C[2]];if(C.length===3&&C[0]<=w&&C[1]*C[2]<=w)return[C[0],C[1]*C[2]];if(C.length===4&&C[0]*C[1]*C[2]<=w&&C[3]<=w)return[C[0]*C[1]*C[2],C[3]];if(C.length===4&&C[0]<=w&&C[1]*C[2]*C[3]<=w)return[C[0],C[1]*C[2]*C[3]];if(x){var Q=Zs(C),ie=2,fe=2;return C.length&&(ie=(p=ls(C))[0],fe=p[1]),bt(W=Q*(ie/2)*(fe/2)).map(function(ye){return 2*ye})}return bt(W)}function wl(C){return C%2==0}function vc(C,x){if(Tt(C=C.slice(-2),x=x.slice(-2))||!C.length||!x.length||C[0]===0||C[1]===0||x[0]===0||x[1]===0)return!0;if(C.length!==x.length){var p=C.slice(-1)[0],w=x.slice(-1)[0];if(p===w||wl(p)&&wl(w)&&(C[0]===1||x[0]===1))return!0}return C[1]===x[1]&&wl(C[0])&&wl(x[0])}function gp(C){if(vs==null){var x=Ai(C);vs=x.getParameter(x.MAX_TEXTURE_SIZE)}return vs}function th(C){if(gu==null){var x=Ai(C);gu=x.getParameter(x.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,gu)}function nh(C){if(C===0)return 0;var x=Ai(C);return Ja(x,"EXT_disjoint_timer_query_webgl2")&&C===2?2:Ja(x,"EXT_disjoint_timer_query")?1:0}function Ja(C,x){return C.getExtension(x)!=null}function vp(C){try{if(Ai(C)!=null)return!0}catch{return!1}return!1}
3872function Om(C){if(C===0)return!1;var x=Ai(C);if(C===1){if(!Ja(x,"OES_texture_float"))return!1}else if(!Ja(x,"EXT_color_buffer_float"))return!1;return ih(x)}function rh(C){if(C===0)return!1;var x=Ai(C);return C!==1?Ja(x,"EXT_color_buffer_float")?ih(x):!!Ja(x,"EXT_color_buffer_half_float")&&function(p,w){var D=Yr(p,w),W=p.createTexture();p.bindTexture(p.TEXTURE_2D,W),p.texImage2D(p.TEXTURE_2D,0,D.internalFormatHalfFloat,1,1,0,D.textureFormatFloat,D.textureTypeHalfFloat,null);var Q=p.createFramebuffer();p.bindFramebuffer(p.FRAMEBUFFER,Q),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,W,0);var ie=p.checkFramebufferStatus(p.FRAMEBUFFER)===p.FRAMEBUFFER_COMPLETE;return p.bindTexture(p.TEXTURE_2D,null),p.bindFramebuffer(p.FRAMEBUFFER,null),p.deleteTexture(W),p.deleteFramebuffer(Q),ie}(x,x.getExtension("EXT_color_buffer_half_float")):!!Ja(x,"OES_texture_float")&&!!Ja(x,"WEBGL_color_buffer_float")&&ih(x)}function ih(C){var x=Yr(C),p=C.createTexture();C.bindTexture(C.TEXTURE_2D,p),C.texImage2D(C.TEXTURE_2D,0,x.internalFormatFloat,1,1,0,x.textureFormatFloat,x.textureTypeFloat,null);var w=C.createFramebuffer();C.bindFramebuffer(C.FRAMEBUFFER,w),C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,p,0);var D=C.checkFramebufferStatus(C.FRAMEBUFFER)===C.FRAMEBUFFER_COMPLETE;return C.bindTexture(C.TEXTURE_2D,null),C.bindFramebuffer(C.FRAMEBUFFER,null),C.deleteTexture(p),C.deleteFramebuffer(w),D}function vu(C){return C===2&&Ai(C).fenceSync!=null}var oh=Object.freeze({callAndCheck:Hn,canBeRepresented:Kr,getWebGLErrorMessage:Io,getExtensionOrThrow:Ko,createVertexShader:Eo,createFragmentShader:Yo,createProgram:fo,linkProgram:yl,validateProgram:Tc,createStaticVertexBuffer:Wl,createStaticIndexBuffer:Jc,getNumChannels:function(){return L().getNumber("WEBGL_VERSION")===2?1:4},createTexture:Vl,validateTextureSize:Sm,createFramebuffer:Qs,bindVertexBufferToProgramAttribute:Zd,bindTextureUnit:Am,unbindTextureUnit:function(C,x,p){bl(C,p),Hn(C,x,function(){return C.activeTexture(C.TEXTURE0+p)}),Hn(C,x,function(){return C.bindTexture(C.TEXTURE_2D,null)})},getProgramUniformLocationOrThrow:Qc,getProgramUniformLocation:eh,bindTextureToProgramUniformSampler:mp,bindCanvasToFramebuffer:function(C,x){Hn(C,x,function(){return C.bindFramebuffer(C.FRAMEBUFFER,null)}),Hn(C,x,function(){return C.viewport(0,0,C.canvas.width,C.canvas.height)}),Hn(C,x,function(){return C.scissor(0,0,C.canvas.width,C.canvas.height)})},bindColorTextureToFramebuffer:$l,unbindColorTextureFromFramebuffer:nd,validateFramebuffer:ys,getFramebufferErrorMessage:vf,getBatchDim:Zs,getRowsCols:ls,getShapeAs3D:xl,getTextureShapeFromLogicalShape:rd,isReshapeFree:vc,getWebGLMaxTextureSize:gp,resetMaxTextureSize:function(){vs=null},resetMaxTexturesInShader:function(){gu=null},getMaxTexturesInShader:th,getWebGLDisjointQueryTimerVersion:nh,hasExtension:Ja,isWebGLVersionEnabled:vp,isCapableOfRenderingToFloatTexture:Om,isDownloadFloatTextureEnabled:rh,isWebGLFenceEnabled:vu}),gr=L();function Nc(){L().set("PROD",!0)}function Rg(){L().set("DEBUG",!0)}function Bg(){L().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function ah(C){L().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(C+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function id(){qe.disposeVariables()}function Dm(){return qe}function yp(){return qe.memory()}function bp(C){return qe.profile(C)}function eo(C,x){return qe.tidy(C,x)}function ca(C){Zn(C).forEach(function(x){return x.dispose()})}function xp(C){return qe.keep(C)}function N0(C){return qe.time(C)}function sh(C){return qe.setBackend(C)}function Tm(){return qe.ready()}function yu(){return qe.backendName}function _l(C){qe.removeBackend(C)}function Nm(C){return qe.findBackend(C)}function Pg(C){return qe.findBackendFactory(C)}function jg(C,x,p){return p===void 0&&(p=1),qe.registerBackend(C,x,p)}function I0(){return qe.backend}function M0(C,x){L().setPlatform(C,x)}function yf(){for(var C=[],x=0;x<arguments.length;x++)C[x]=arguments[x];L().getBool("IS_TEST")||console.warn.apply(console,C)}function As(C,x){var p=C;if(dt(C))return x==="string"?[]:[C.length];if(!Array.isArray(C))return[];for(var w=[];
vendor: 2,273 bytes, line 3872
3872Array.isArray(p)||dt(p)&&x!=="string";)w.push(p.length),p=p[0];return Array.isArray(C)&&L().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function D(W,Q,ie){if(ie=ie||[],Array.isArray(W)||dt(W)){Ee(Q.length>0,function(){return"Element arr["+ie.join("][")+"] should be a primitive, but is an array of "+W.length+" elements"}),Ee(W.length===Q[0],function(){return"Element arr["+ie.join("][")+"] should have "+Q[0]+" elements, but has "+W.length+" elements"});for(var fe=Q.slice(1),ye=0;ye<W.length;++ye)D(W[ye],fe,ie.concat(ye))}else Ee(Q.length===0,function(){return"Element arr["+ie.join("][")+"] is a primitive, but should be an array/TypedArray of "+Q[0]+" elements"})}(C,w,[]),w}function wp(C,x,p,w){if(C!=null&&(C!=="numeric"&&C!==x||C==="numeric"&&x==="string"))throw new Error("Argument '"+p+"' passed to '"+w+"' must be "+C+" tensor, but got "+x+" tensor")}function et(C,x,p,w){if(w===void 0&&(w="numeric"),C instanceof Zt)return wp(w,C.dtype,x,p),C;var D=xe(C);if(D!=="string"&&["bool","int32","float32"].indexOf(w)>=0&&(D=w),wp(w,D,x,p),C==null||!dt(C)&&!Array.isArray(C)&&typeof C!="number"&&typeof C!="boolean"&&typeof C!="string"){var W=C==null?"null":C.constructor.name;throw new Error("Argument '"+x+"' passed to '"+p+"' must be a Tensor or TensorLike, but got '"+W+"'")}var Q=As(C,D);dt(C)||Array.isArray(C)||(C=[C]);var ie=D!=="string"?cr(C,D,L().getBool("DEBUG")):Mt(C,[],!0);return qe.makeTensor(ie,Q,D)}function Zc(C,x,p,w){if(w===void 0&&(w="numeric"),!Array.isArray(C))throw new Error("Argument "+x+" passed to "+p+" must be a `Tensor[]` or `TensorLike[]`");return C.map(function(D,W){return et(D,x+"["+W+"]",p)},w)}function uh(C,x){for(var p=0;p<C.length;++p)if(C[C.length-p-1]!==x-1-p)return!1;return!0}function Im(C,x,p){for(var w=C.length+x.length,D=[],W=0,Q=0,ie=0;ie<w;ie++)p.indexOf(ie)===-1?D.push(C[W++]):D.push(x[Q++]);return D}function ra(C,x){for(var p=[],w=C.length,D=0;D<w;D++)x.indexOf(D)===-1&&p.push(C[D]);return[p,x.map(function(W){return C[W]})]}function ia(C,x){return Im(C,x.map(function(p){return 1}),x)}function Aa(C,x,p){Ee(uh(x,p),function(){return C+" supports only inner-most axes for now. Got axes "+x+" and rank-"+p+" input."})}function fs(C,x){if(uh(C,x))return null;for(var p=[],w=0;w<x;++w)C.indexOf(w)===-1&&p.push(w);
3872return C.forEach(function(D){return p.push(D)}),p}function Ic(C){return C.map(function(x,p){return[p,x]}).sort(function(x,p){return x[1]-p[1]}).map(function(x){return x[0]})}function ds(C,x){for(var p=[],w=x-C;w<x;++w)p.push(w);return p}function Hl(C,x){var p=C[0].length;C.forEach(function(D,W){Ee(D.length===p,function(){return"Error in concat"+p+"D: rank of tensors["+W+"] must be the same as the rank of the rest ("+p+")"})}),Ee(x>=0&&x<p,function(){return"Error in concat"+p+"D: axis must be between 0 and "+(p-1)+"."});var w=C[0];C.forEach(function(D,W){for(var Q=0;Q<p;Q++)Ee(Q===x||D[Q]===w[Q],function(){return"Error in concat"+p+"D: Shape of tensors["+W+"] ("+D+") does not match the shape of the rest ("+w+") along the non-concatenated axis "+W+"."})})}function sc(C,x){for(var p=C[0].slice(),w=1;w<C.length;w++)p[x]+=C[w][x];return p}function Bt(C){var x=Object.keys(C);if(x.length!==1)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+x.length+" keys.");var p=x[0],w=C[p];p.endsWith("_")&&(p=p.substring(0,p.length-1));var D=function(){for(var W=[],Q=0;Q<arguments.length;Q++)W[Q]=arguments[Q];qe.startScope(p);try{var ie=w.apply(void 0,W);return ie instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),qe.endScope(ie),ie}catch(fe){throw qe.endScope(null),fe}};return Object.defineProperty(D,"name",{value:p,configurable:!0}),D}gr.registerFlag("HAS_WEBGL",function(){return gr.getNumber("WEBGL_VERSION")>0}),gr.registerFlag("WEBGL_VERSION",function(){return vp(2)?2:vp(1)?1:0}),gr.registerFlag("WEBGL_BUFFER_SUPPORTED",function(){return gr.get("WEBGL_VERSION")===2}),gr.registerFlag("WEBGL_CPU_FORWARD",function(){return!0}),gr.registerFlag("WEBGL_FORCE_F16_TEXTURES",function(){return!1}),gr.registerFlag("WEBGL_PACK",function(){return gr.getBool("HAS_WEBGL")}),gr.registerFlag("WEBGL_PACK_NORMALIZATION",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_CLIP",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_DEPTHWISECONV",function(){return!1}),gr.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_PACK_REDUCE",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_LAZILY_UNPACK",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_CONV_IM2COL",function(){return gr.getBool("WEBGL_PACK")}),gr.registerFlag("WEBGL_MAX_TEXTURE_SIZE",function(){return gp(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",function(){return th(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",function(){var C=gr.getNumber("WEBGL_VERSION");return C===0?0:nh(C)}),gr.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",function(){return gr.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&(C=navigator.userAgent||navigator.vendor||window.opera,!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(C)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
3872sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(C.substr(0,4))));var C}),gr.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",function(){return Om(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",function(){return!gr.getBool("WEBGL_FORCE_F16_TEXTURES")&&gr.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")}),gr.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",function(){return rh(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_FENCE_API_ENABLED",function(){return vu(gr.getNumber("WEBGL_VERSION"))}),gr.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",function(){return gr.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0}),Qr=ah;var zo=Bt({complex_:function(C,x){var p=et(C,"real","complex"),w=et(x,"imag","complex");return Ot(p.shape,w.shape,"real and imag shapes, "+p.shape+" and "+w.shape+", must match in call to tf.complex()."),qe.runKernelFunc(function(D){return D.complex(p,w)},{$real:p,$imag:w})}}),qa=Bt({real_:function(C){var x=et(C,"input","real");return qe.runKernelFunc(function(p){return p.real(x)},{$input:x})}}),Os=Bt({imag_:function(C){var x=et(C,"input","imag");return qe.runKernelFunc(function(p){return p.imag(x)},{$input:x})}});function Qo(C,x,p){return bu(C,x,As(C,p),p)}function bu(C,x,p,w){if(w==null&&(w=xe(C)),w==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!dt(C)&&!Array.isArray(C)&&typeof C!="number"&&typeof C!="boolean"&&typeof C!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(x!=null){Xn(x);var D=Ke(x),W=Ke(p);Ee(D===W,function(){return"Based on the provided shape, ["+x+"], the tensor should have "+D+" values but has "+W});for(var Q=0;Q<p.length;++Q){var ie=p[Q],fe=Q!==p.length-1||ie!==Ke(x.slice(Q));Ee(p[Q]===x[Q]||!fe,function(){return"Error creating a new Tensor. Inferred shape ("+p+") does not match the provided shape ("+x+"). "})}}return dt(C)||Array.isArray(C)||(C=[C]),x=x||p,C=w!=="string"?cr(C,w,L().getBool("DEBUG")):Mt(C,[],!0),qe.makeTensor(C,x,w)}function Or(C,x){if((dt(C)&&x!=="string"||Array.isArray(C))&&x!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(x==="string"&&dt(C)&&!(C instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return bu(C,[],[],x)}function Vu(C,x){zt(C);var p=As(C,x);if(p.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return bu(C,null,p,x)}function uc(C,x,p){if(zt(C),x!=null&&x.length!==2)throw new Error("tensor2d() requires shape to have two numbers");var w=As(C,p);if(w.length!==2&&w.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(w.length===1&&x==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return bu(C,x,w,p)}function bf(C,x,p){if(zt(C),x!=null&&x.length!==3)throw new Error("tensor3d() requires shape to have three numbers");var w=As(C,p);if(w.length!==3&&w.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(w.length===1&&x==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return bu(C,x,w,p)}function $u(C,x,p){if(zt(C),x!=null&&x.length!==4)throw new Error("tensor4d() requires shape to have four numbers");var w=As(C,p);if(w.length!==4&&w.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(w.length===1&&x==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return bu(C,x,w,p)}function _p(C,x,p){if(zt(C),x!=null&&x.length!==5)throw new Error("tensor5d() requires shape to have five numbers");var w=As(C,p);if(w.length!==5&&w.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(w.length===1&&x==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return bu(C,x,w,p)}function Mm(C,x,p){if(zt(C),x!=null&&x.length!==6)throw new Error("tensor6d() requires shape to have six numbers");var w=As(C,p);if(w.length!==6&&w.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(w.length===1&&x==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return bu(C,x=x||w,w,p)}function Fm(C,x,p,w){return x===void 0&&(x=!0),qe.makeVariable(C,x,p,w)}function yc(C,x){if(x===void 0&&(x="float32"),x==="complex64"){var p=yc(C,"float32"),w=go(C,"float32");return zo(p,w)}var D=hn(Ke(C),x);return qe.makeTensor(D,C,x)}function go(C,x){if(x===void 0&&(x="float32"),x==="complex64"){var p=go(C,"float32"),w=go(C,"float32");return zo(p,w)}var D=rn(Ke(C),x);return qe.makeTensor(D,C,x)}function xu(C,x,p){return qe.runKernelFunc(function(w){return w.fill(C,x,p)},{})}function kp(C,x,p){if(p<=0)throw new Error("The number of values should be positive.");return qe.runKernelFunc(function(w){return w.linspace(C,x,p)},{})}
vendor: 26,596 bytes, lines 3872-3877
3872function kl(C,x,p,w){if(p===void 0&&(p=1),w===void 0&&(w="float32"),p===0)throw new Error("Cannot have a step of zero");if(C===x||C<x&&p<0||x<C&&p>1)return go([0],w);var D=rn(Math.abs(Math.ceil((x-C)/p)),w);x<C&&p===1&&(p=-1),D[0]=C;for(var W=1;W<D.length;W++)D[W]=D[W-1]+p;return Vu(D,w)}var eu=Bt({onesLike_:function(C){var x=et(C,"x","onesLike");if(x.dtype==="complex64"){var p=eu(qa(x)),w=Ei(Os(x));return zo(p,w)}return qe.runKernelFunc(function(D){return D.onesLike(x)},{$x:x},function(D,W){return{$x:function(){return Ei(D)}}})}}),Ei=Bt({zerosLike_:function(C){var x=et(C,"x","zerosLike");return qe.runKernelFunc(function(p){return p.zerosLike(x)},{$x:x},function(p,w){return{$x:function(){return Ei(p)}}})}}),va=Bt({concat_:function(C,x){x===void 0&&(x=0),Ee(C.length>=1,function(){return"Pass at least one tensor to concat"});var p=Zc(C,"tensors","concat");p[0].dtype==="complex64"&&p.forEach(function(ie){if(ie.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor 3873 with dtype `+ie.dtype+". ")}),x=Vt(x,p[0].shape)[0];var w=sc(p.map(function(ie){return ie.shape}),x);if(Ke(w)===0)return Qo([],w);if((p=p.filter(function(ie){return ie.size>0})).length===1)return p[0];var D=p.map(function(ie){return ie.shape});Hl(D,x);var W=p,Q={axis:x};return qe.runKernelFunc(function(ie){return ie.concat(p,x)},W,function(ie){var fe=D.map(function(ye){return ye[x]});return to(ie,fe,x).map(function(ye){return function(){return ye}})},"Concat",Q)}}),Ep=Bt({concat1d_:function(C){return va(C,0)}}),Rm=Bt({concat2d_:function(C,x){return va(C,x)}}),od=Bt({concat3d_:function(C,x){return va(C,x)}}),Cp=Bt({concat4d_:function(C,x){return va(C,x)}}),to=Bt({split_:function(C,x,p){p===void 0&&(p=0);var w,D=et(C,"x","split");return p=Vt(p,D.shape)[0],typeof x=="number"?(Ee(D.shape[p]%x==0,function(){return"Number of splits must evenly divide the axis."}),w=new Array(x).fill(D.shape[p]/x)):(Ee(D.shape[p]===x.reduce(function(W,Q){return W+Q}),function(){return"The sum of sizes must match the size of the axis dimension."}),w=x),qe.runKernelFunc(function(W){return W.split(D,w,p)},{$x:D},function(W){return{$x:function(){return va(W,p)}}})}});function Li(C,x){return C(x={exports:{}},x.exports),x.exports}var za=Li(function(C){(function(x,p,w){function D(Q,ie){return ie.c=Q.c,ie.s0=Q.s0,ie.s1=Q.s1,ie.s2=Q.s2,ie}function W(Q,ie){var fe=new function(Re){var Pe,je=this,Ge=(Pe=4022871197,function(rt){rt=rt.toString();for(var nt=0;nt<rt.length;nt++){var lt=.02519603282416938*(Pe+=rt.charCodeAt(nt));lt-=Pe=lt>>>0,Pe=(lt*=Pe)>>>0,Pe+=4294967296*(lt-=Pe)}return 23283064365386963e-26*(Pe>>>0)});je.next=function(){var rt=2091639*je.s0+23283064365386963e-26*je.c;return je.s0=je.s1,je.s1=je.s2,je.s2=rt-(je.c=0|rt)},je.c=1,je.s0=Ge(" "),je.s1=Ge(" "),je.s2=Ge(" "),je.s0-=Ge(Re),je.s0<0&&(je.s0+=1),je.s1-=Ge(Re),je.s1<0&&(je.s1+=1),je.s2-=Ge(Re),je.s2<0&&(je.s2+=1),Ge=null}(Q),ye=ie&&ie.state,Oe=fe.next;return Oe.int32=function(){return 4294967296*fe.next()|0},Oe.double=function(){return Oe()+11102230246251565e-32*(2097152*Oe()|0)},Oe.quick=Oe,ye&&(typeof ye=="object"&&D(ye,fe),Oe.state=function(){return D(fe,{})}),Oe}p&&p.exports?p.exports=W:this.alea=W})(0,C)}),Bm=Li(function(C){(function(x,p,w){function D(Q,ie){return ie.x=Q.x,ie.y=Q.y,ie.z=Q.z,ie.w=Q.w,ie}function W(Q,ie){var fe=new function(Re){var Pe=this,je="";Pe.x=0,Pe.y=0,Pe.z=0,Pe.w=0,Pe.next=function(){var rt=Pe.x^Pe.x<<11;return Pe.x=Pe.y,Pe.y=Pe.z,Pe.z=Pe.w,Pe.w^=Pe.w>>>19^rt^rt>>>8},Re===(0|Re)?Pe.x=Re:je+=Re;for(var Ge=0;Ge<je.length+64;Ge++)Pe.x^=0|je.charCodeAt(Ge),Pe.next()}(Q),ye=ie&&ie.state,Oe=function(){return(fe.next()>>>0)/4294967296};return Oe.double=function(){do var Re=((fe.next()>>>11)+(fe.next()>>>0)/4294967296)/2097152;while(Re===0);return Re},Oe.int32=fe.next,Oe.quick=Oe,ye&&(typeof ye=="object"&&D(ye,fe),Oe.state=function(){return D(fe,{})}),Oe}p&&p.exports?p.exports=W:this.xor128=W})(0,C)}),Pm=Li(function(C){(function(x,p,w){function D(Q,ie){return ie.x=Q.x,ie.y=Q.y,ie.z=Q.z,ie.w=Q.w,ie.v=Q.v,ie.d=Q.d,ie}function W(Q,ie){var fe=new function(Re){var Pe=this,je="";Pe.next=function(){var rt=Pe.x^Pe.x>>>2;return Pe.x=Pe.y,Pe.y=Pe.z,Pe.z=Pe.w,Pe.w=Pe.v,(Pe.d=Pe.d+362437|0)+(Pe.v=Pe.v^Pe.v<<4^rt^rt<<1)|0},Pe.x=0,Pe.y=0,Pe.z=0,Pe.w=0,Pe.v=0,Re===(0|Re)?Pe.x=Re:je+=Re;for(var Ge=0;Ge<je.length+64;Ge++)Pe.x^=0|je.charCodeAt(Ge),Ge==je.length&&(Pe.d=Pe.x<<10^Pe.x>>>4),Pe.next()}(Q),ye=ie&&ie.state,Oe=function(){return(fe.next()>>>0)/4294967296};return Oe.double=function(){do var Re=((fe.next()>>>11)+(fe.next()>>>0)/4294967296)/2097152;while(Re===0);return Re},Oe.int32=fe.next,Oe.quick=Oe,ye&&(typeof ye=="object"&&D(ye,fe),Oe.state=function(){return D(fe,{})}),Oe}p&&p.exports?p.exports=W:this.xorwow=W})(0,C)}),jm=Li(function(C){(function(x,p,w){function D(Q,ie){return ie.x=Q.x.slice(),ie.i=Q.i,ie}function W(Q,ie){Q==null&&(Q=+new Date);var fe=new function(Re){var Pe=this;Pe.next=function(){var je,Ge,rt=Pe.x,nt=Pe.i;return je=rt[nt],Ge=(je^=je>>>7)^je<<24,Ge^=(je=rt[nt+1&7])^je>>>10,Ge^=(je=rt[nt+3&7])^je>>>3,Ge^=(je=rt[nt+4&7])^je<<7,je=rt[nt+7&7],Ge^=(je^=je<<13)^je<<9,rt[nt]=Ge,Pe.i=nt+1&7,Ge},function(je,Ge){var rt,nt=[];if(Ge===(0|Ge))nt[0]=Ge;else for(Ge=""+Ge,rt=0;rt<Ge.length;++rt)nt[7&rt]=nt[7&rt]<<15^Ge.charCodeAt(rt)+nt[rt+1&7]<<13;for(;nt.length<8;)nt.push(0);for(rt=0;rt<8&&nt[rt]===0;++rt);for(rt==8?nt[7]=-1:nt[rt],je.x=nt,je.i=0,rt=256;rt>0;--rt)je.next()}(Pe,Re)}(Q),ye=ie&&ie.state,Oe=function(){return(fe.next()>>>0)/4294967296};return Oe.double=function(){do var Re=((fe.next()>>>11)+(fe.next()>>>0)/4294967296)/2097152;while(Re===0);return Re},Oe.int32=fe.next,Oe.quick=Oe,ye&&(ye.x&&D(ye,fe),Oe.state=function(){return D(fe,{})}),Oe}p&&p.exports?p.exports=W:this.xorshift7=W})(0,C)}),Lg=Li(function(C){(function(x,p,w){function D(Q,ie){return ie.i=Q.i,ie.w=Q.w,ie.X=Q.X.slice(),ie}function W(Q,ie){Q==null&&(Q=+new Date);var fe=new function(Re){var Pe=this;Pe.next=function(){var je,Ge,rt=Pe.w,nt=Pe.X,lt=Pe.i;return Pe.w=rt=rt+1640531527|0,Ge=nt[lt+34&127],je=nt[lt=lt+1&127],Ge^=Ge<<13,je^=je<<17,Ge^=Ge>>>15,je^=je>>>12,Ge=nt[lt]=Ge^je,Pe.i=lt,Ge+(rt^rt>>>16)|0},function(je,Ge){var rt,nt,lt,Nt,Rt,Pt=[],Kt=128;for(Ge===(0|Ge)?(nt=Ge,Ge=null):(Ge+="\0",nt=0,Kt=Math.max(Kt,Ge.length)),lt=0,Nt=-32;Nt<Kt;++Nt)Ge&&(nt^=Ge.charCodeAt((Nt+32)%Ge.length)),Nt===0&&(Rt=nt),nt^=nt<<10,nt^=nt>>>15,nt^=nt<<4,nt^=nt>>>13,Nt>=0&&(Rt=Rt+1640531527|0,lt=(rt=Pt[127&Nt]^=nt+Rt)==0?lt+1:0);for(lt>=128&&(Pt[127&(Ge&&Ge.length||0)]=-1),lt=127,Nt=512;Nt>0;--Nt)nt=Pt[lt+34&127],rt=Pt[lt=lt+1&127],nt^=nt<<13,rt^=rt<<17,nt^=nt>>>15,rt^=rt>>>12,Pt[lt]=nt^rt;je.w=Rt,je.X=Pt,je.i=lt}(Pe,Re)}(Q),ye=ie&&ie.state,Oe=function(){return(fe.next()>>>0)/4294967296};return Oe.double=function(){do var Re=((fe.next()>>>11)+(fe.next()>>>0)/4294967296)/2097152;while(Re===0);return Re},Oe.int32=fe.next,Oe.quick=Oe,ye&&(ye.X&&D(ye,fe),Oe.state=function(){return D(fe,{})}),Oe}p&&p.exports?p.exports=W:this.xor4096=W})(0,C)}),el=Li(function(C){(function(x,p,w){function D(Q,ie){return ie.a=Q.a,ie.b=Q.b,ie.c=Q.c,ie.d=Q.d,ie}function W(Q,ie){var fe=new function(Re){var Pe=this,je="";Pe.next=function(){var rt=Pe.b,nt=Pe.c,lt=Pe.d,Nt=Pe.a;return rt=rt<<25^rt>>>7^nt,nt=nt-lt|0,lt=lt<<24^lt>>>8^Nt,Nt=Nt-rt|0,Pe.b=rt=rt<<20^rt>>>12^nt,Pe.c=nt=nt-lt|0,Pe.d=lt<<16^nt>>>16^Nt,Pe.a=Nt-rt|0},Pe.a=0,Pe.b=0,Pe.c=-1640531527,Pe.d=1367130551,Re===Math.floor(Re)?(Pe.a=Re/4294967296|0,Pe.b=0|Re):je+=Re;for(var Ge=0;Ge<je.length+20;Ge++)Pe.b^=0|je.charCodeAt(Ge),Pe.next()}(Q),ye=ie&&ie.state,Oe=function(){return(fe.next()>>>0)/4294967296};return Oe.double=function(){do var Re=((fe.next()>>>11)+(fe.next()>>>0)/4294967296)/2097152;while(Re===0);return Re},Oe.int32=fe.next,Oe.quick=Oe,ye&&(typeof ye=="object"&&D(ye,fe),Oe.state=function(){return D(fe,{})}),Oe}p&&p.exports?p.exports=W:this.tychei=W})(0,C)}),wu=Li(function(C){(function(x,p){var w,D=this,W=256,Q=6,ie="random",fe=p.pow(W,Q),ye=p.pow(2,52),Oe=2*ye,Re=W-1;function Pe(lt,Nt,Rt){var Pt=[],Kt=rt(function pn(_n,On){var _,m=[],f=typeof _n;if(On&&f=="object")for(_ in _n)try{m.push(pn(_n[_],On-1))}catch{}return m.length?m:f=="string"?_n:_n+"\0"}((Nt=Nt==1?{entropy:!0}:Nt||{}).entropy?[lt,nt(x)]:lt??function(){try{var pn;return w&&(pn=w.randomBytes)?pn=pn(W):(pn=new Uint8Array(W),(D.crypto||D.msCrypto).getRandomValues(pn)),nt(pn)}catch{var _n=D.navigator,On=_n&&_n.plugins;return[+new Date,D,On,D.screen,nt(x)]}}(),3),Pt),dn=new je(Pt),bn=function(){for(var pn=dn.g(Q),_n=fe,On=0;pn<ye;)pn=(pn+On)*W,_n*=W,On=dn.g(1);for(;pn>=Oe;)pn/=2,_n/=2,On>>>=1;return(pn+On)/_n};return bn.int32=function(){return 0|dn.g(4)},bn.quick=function(){return dn.g(4)/4294967296},bn.double=bn,rt(nt(dn.S),x),(Nt.pass||Rt||function(pn,_n,On,_){return _&&(_.S&&Ge(_,dn),pn.state=function(){return Ge(dn,{})}),On?(p[ie]=pn,_n):pn})(bn,Kt,"global"in Nt?Nt.global:this==p,Nt.state)}function je(lt){var Nt,Rt=lt.length,Pt=this,Kt=0,dn=Pt.i=Pt.j=0,bn=Pt.S=[];for(Rt||(lt=[Rt++]);Kt<W;)bn[Kt]=Kt++;for(Kt=0;Kt<W;Kt++)bn[Kt]=bn[dn=Re&dn+lt[Kt%Rt]+(Nt=bn[Kt])],bn[dn]=Nt;(Pt.g=function(pn){for(var _n,On=0,_=Pt.i,m=Pt.j,f=Pt.S;pn--;)_n=f[_=Re&_+1],On=On*W+f[Re&(f[_]=f[m=Re&m+_n])+(f[m]=_n)];return Pt.i=_,Pt.j=m,On})(W)}function Ge(lt,Nt){return Nt.i=lt.i,Nt.j=lt.j,Nt.S=lt.S.slice(),Nt}function rt(lt,Nt){for(var Rt,Pt=lt+"",Kt=0;Kt<Pt.length;)Nt[Re&Kt]=Re&(Rt^=19*Nt[Re&Kt])+Pt.charCodeAt(Kt++);return nt(Nt)}function nt(lt){return String.fromCharCode.apply(0,lt)}if(p["seed"+ie]=Pe,rt(p.random(),x),C.exports){C.exports=Pe;try{w=n(251)}catch{}}})([],Math)});wu.alea=za,wu.xor128=Bm,wu.xorwow=Pm,wu.xorshift7=jm,wu.xor4096=Lg,wu.tychei=el;var xf=wu.alea,Iu=function(){function C(x,p,w,D,W){this.mean=x,this.stdDev=p,this.dtype=w,this.nextVal=NaN,this.truncated=D,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var Q=W||Math.random();this.random=xf(Q.toString())}return C.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var x=this.nextVal;return this.nextVal=NaN,x}for(var p,w,D=!1;!D;){var W=void 0,Q=void 0,ie=void 0;do ie=(W=2*this.random()-1)*W+(Q=2*this.random()-1)*Q;while(ie>=1||ie===0);var fe=Math.sqrt(-2*Math.log(ie)/ie);p=this.mean+this.stdDev*W*fe,w=this.mean+this.stdDev*Q*fe,this.truncated&&!this.isValidTruncated(p)||(D=!0)}return this.truncated&&!this.isValidTruncated(w)||(this.nextVal=this.convertValue(w)),this.convertValue(p)},C.prototype.convertValue=function(x){return this.dtype==null||this.dtype==="float32"?x:Math.round(x)},C.prototype.isValidTruncated=function(x){return x<=this.upper&&x>=this.lower},C}(),cc=function(){function C(x,p,w,D){this.alpha=x,this.beta=1/p,this.dtype=w;var W=D||Math.random();this.randu=xf(W.toString()),this.randn=new Iu(0,1,w,!1,this.randu()),this.d=x<1?x+2/3:x-1/3,this.c=1/Math.sqrt(9*this.d)}return C.prototype.nextValue=function(){for(var x,p,w,D,W,Q;;){do D=this.randn.nextValue(),Q=1+this.c*D;while(Q<=0);if(Q*=Q*Q,p=1-.331*(x=D*D)*x,w=.5*x+this.d*(1-Q+Math.log(Q)),(W=this.randu())<p||Math.log(W)<w)break}return Q=1/this.beta*this.d*Q,this.alpha<1&&(Q*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(Q)},C.prototype.convertValue=function(x){return this.dtype==="float32"?x:Math.round(x)},C}(),Sp=function(){function C(x,p,w,D){var W=this;if(x===void 0&&(x=0),p===void 0&&(p=1),this.canReturnFloat=function(){return W.dtype==null||W.dtype==="float32"},this.min=x,this.range=p-x,this.dtype=w,D==null&&(D=Math.random()),typeof D=="number"&&(D=D.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error("The difference between "+x+" - "+p+" <= 1 and dtype is not float");this.random=xf(D)}return C.prototype.convertValue=function(x){return this.canReturnFloat()?x:Math.round(x)},C.prototype.nextValue=function(){return this.convertValue(this.min+this.range*this.random())},C}();function Qi(C,x,p){return x===void 0&&(x="float32"),x=x||"float32",Xn(C),new co(C,x,p)}function ch(C,x){x===void 0&&(x=!1),console.log(C.toString(x))}var wf=Bt({batchToSpaceND_:function(C,x,p){var w=et(C,"x","batchToSpaceND"),D=x.reduce(function(W,Q){return W*Q});return Ee(w.rank>=1+x.length,function(){return"input rank is "+w.rank+" but should be > than blockShape.length "+x.length}),Ee(p.length===x.length,function(){return"crops.length is "+p.length+" but should be equal to blockShape.length "+x.length}),Ee(w.shape[0]%D==0,function(){return"input tensor batch is "+w.shape[0]+" but is not divisible by the product of the elements of blockShape "+x.join(" * ")+" === "+D}),qe.runKernelFunc(function(W){return W.batchToSpaceND(w,x,p)},{$x:w},function(W){return{$x:function(){return W.spaceToBatchND(x,p)}}})}}),ad=Bt({broadcastTo_:function(C,x){var p=et(C,"broadcastTo","x"),w=p.shape;if(x.some(function(fe){return!(fe>0)||fe%1!=0}))throw new Error("broadcastTo(): Invalid broadcast shape ["+x+"].");if(x.length<p.rank)throw new Error("broadcastTo(): shape.length="+x.length+" < input.rank="+p.rank+".");if(x.length>p.rank){for(var D=p.shape.slice();D.length<x.length;)D.unshift(1);p=p.reshape(D)}for(var W=Array.from(x),Q=x.length-1;Q>=0;Q--)if(p.shape[Q]===x[Q])W[Q]=1;else if(p.shape[Q]!==1)throw new Error("broadcastTo(): ["+w+"] cannot be broadcast to ["+x+"].");var ie=W.map(function(fe,ye){return fe>1?ye:-1}).filter(function(fe){return fe>=0});return ie.length===0?p.clone():qe.runKernelFunc(function(fe){return fe.tile(p,W)},{input:p},function(fe){return{input:function(){return fe.sum(ie,!0)}}})}}),Lm=Bt({cast_:function(C,x){var p=et(C,"x","cast");if(!Ye(x))throw new Error("Failed to cast to unknown dtype "+x);if(x==="string"&&p.dtype!=="string"||x!=="string"&&p.dtype==="string")throw new Error("Only strings can be casted to strings");var w={dtype:x};return qe.runKernelFunc(function(D){return D.cast(p,x)},{x:p},function(D){return{x:function(){return D.clone()}}},"Cast",w)}}),zg=Bt({clone_:function(C){var x=et(C,"x","clone",null);return qe.runKernelFunc(function(){return qe.makeTensorFromDataId(x.dataId,x.shape,x.dtype)},{$x:x},function(p){return{$x:function(){return p.toFloat()}}})}}),sd=Bt({cumsum_:function(C,x,p,w){x===void 0&&(x=0),p===void 0&&(p=!1),w===void 0&&(w=!1);var D=et(C,"x","cumsum"),W=fs([x|=0],D.rank),Q=D;W!=null&&(Q=D.transpose(W));var ie=ds(1,D.rank)[0],fe=qe.runKernelFunc(function(ye){return ye.cumsum(Q,ie,p,w)},{permutedX:Q},function(ye){return{permutedX:function(){return ye.cumsum(x,p,!w)}}});return W!=null&&(fe=fe.transpose(W)),fe}}),Ap=Bt({depthToSpace_:function(C,x,p){p===void 0&&(p="NHWC");var w=et(C,"x","depthToSpace"),D=p==="NHWC"?w.shape[1]:w.shape[2],W=p==="NHWC"?w.shape[2]:w.shape[3],Q=p==="NHWC"?w.shape[3]:w.shape[1];return Ee(D*x>=0,function(){return`Negative dimension size caused by overflow when multiplying 3874 `+D+" and "+x+` for depthToSpace with input shape 3875 `+w.shape}),Ee(W*x>=0,function(){return`Negative dimension size caused by overflow when multiplying 3876 `+W+" and "+x+` for depthToSpace with input shape 3877 `+w.shape}),Ee(Q%(x*x)==0,function(){return"Dimension size must be evenly divisible by "+x*x+" but is "+Q+" for depthToSpace with input shape "+w.shape}),qe.runKernelFunc(function(ie){return ie.depthToSpace(w,x,p)},{$x:w})}}),ya=Bt({expandDims_:function(C,x){x===void 0&&(x=0);var p=et(C,"x","expandDims",null);Ee(x<=p.rank,function(){return"Axis must be <= rank of the tensor"});var w=p.shape.slice();return x<0&&(Ee(-(p.rank+1)<=x,function(){return"Axis must be in the interval ["+-(p.rank+1)+", "+p.rank+"]"}),x=p.rank+x+1),w.splice(x,0,1),Pa(p,w)}}),Op=Bt({eye_:function(C,x,p,w){w===void 0&&(w="float32"),x==null&&(x=C);for(var D=Qi([C,x],w),W=C<=x?C:x,Q=0;Q<W;++Q)D.set(1,Q,Q);var ie=D.toTensor().as2D(C,x);if(p==null)return ie;if(p.length===1)return _u(ya(ie,0),[p[0],1,1]);if(p.length===2)return _u(ya(ya(ie,0),0),[p[0],p[1],1,1]);if(p.length===3)return _u(ya(ya(ya(ie,0),0),0),[p[0],p[1],p[2],1,1]);throw new Error("eye() currently supports only 1D and 2D batchShapes, but received "+p.length+"D.")}}),ud=Bt({multinomial_:function(C,x,p,w){w===void 0&&(w=!1);var D=et(C,"logits","multinomial"),W=D.size,Q=D.rank;if(W<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+W+".");if(Q>2)throw new Error("Rank of probabilities must be 1 or 2, but is "+Q);p=p||Math.random();var ie=Q===1?D.as2D(1,-1):D,fe=qe.runKernelFunc(function(ye){return ye.multinomial(ie,w,x,p)},{logits2D:ie});return Q===1?fe.as1D():fe}}),Dp=Bt({oneHot_:function(C,x,p,w){if(p===void 0&&(p=1),w===void 0&&(w=0),x<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+x);var D=et(C,"indices","oneHot","int32"),W=D.shape.concat([x]);return D=D.flatten(),qe.runKernelFunc(function(Q){return Q.oneHot(D,x,p,w)},{$indices:D},function(Q){return{$indices:function(){return go(D.shape,"float32")}}}).reshape(W)}}),cd=Bt({pad_:function(C,x,p){p===void 0&&(p=0);var w=et(C,"x","pad");if(w.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var D={paddings:x,constantValue:p};return qe.runKernelFunc(function(W){return W.pad(w,x,p)},{x:w},function(W){var Q=x.map(function(ie){return ie[0]});return{x:function(){return W.slice(Q,w.shape)}}},"PadV2",D)}}),_f=Bt({pad1d_:function(C,x,p){return p===void 0&&(p=0),Ee(x.length===2,function(){return"Invalid number of paddings. Must be length of 2."}),cd(C,[x],p)}}),ql=Bt({pad2d_:function(C,x,p){return p===void 0&&(p=0),Ee(x.length===2&&x[0].length===2&&x[1].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),cd(C,x,p)}}),Tp=Bt({pad3d_:function(C,x,p){return p===void 0&&(p=0),Ee(x.length===3&&x[0].length===2&&x[1].length===2&&x[2].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),cd(C,x,p)}}),lh=Bt({pad4d_:function(C,x,p){return p===void 0&&(p=0),Ee(x.length===4&&x[0].length===2&&x[1].length===2&&x[2].length===2&&x[3].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),cd(C,x,p)}}),ld=Bt({rand_:function(C,x,p){var w=Ke(C),D=null;if(p==null||p==="float32")D=new Float32Array(w);else if(p==="int32")D=new Int32Array(w);else{if(p!=="bool")throw new Error("Unknown data type "+p);D=new Uint8Array(w)}for(var W=0;W<w;W++)D[W]=x();return qe.makeTensor(D,C,p)}}),Gl=Bt({randomNormal_:function(C,x,p,w,D){if(x===void 0&&(x=0),p===void 0&&(p=1),w!=null&&w==="bool")throw new Error("Unsupported data type "+w);for(var W=new Iu(x,p,w,!1,D),Q=Qi(C,w),ie=0;ie<Q.values.length;ie++)Q.values[ie]=W.nextValue();return Q.toTensor()}}),F0=Bt({randomGamma_:function(C,x,p,w,D){if(p===void 0&&(p=1),w===void 0&&(w="float32"),p==null&&(p=1),w==null&&(w="float32"),w!=="float32"&&w!=="int32")throw new Error("Unsupported data type "+w);for(var W=new cc(x,p,w,D),Q=Qi(C,w),ie=0;ie<Q.values.length;ie++)Q.values[ie]=W.nextValue();return Q.toTensor()}}),fd=Bt({randomUniform_:function(C,x,p,w,D){x===void 0&&(x=0),p===void 0&&(p=1),w===void 0&&(w="float32");for(var W=Qi(C,w),Q=new Sp(x,p,null,D),ie=0;ie<W.values.length;ie++)W.values[ie]=Q.nextValue();return W.toTensor()}}),Pa=Bt({reshape_:function(C,x){var p=et(C,"x","reshape",null);x=Ze(x,p.size),Ee(p.size===Ke(x),function(){return"new shape and old shape must have the same number of elements."});var w={shape:x};return qe.runKernelFunc(function(D){return D.reshape(p,x)},{x:p},function(D){return{x:function(){return D.reshape(p.shape)}}},"Reshape",w)}}),hs=Bt({spaceToBatchND_:function(C,x,p){var w=et(C,"x","spaceToBatchND");return Ee(w.rank>=1+x.length,function(){return"input rank "+w.rank+" should be > than [blockShape] "+x.length}),Ee(p.length===x.length,function(){return"paddings.shape[0] "+p.length+" must be equal to [blockShape] "+x.length}),Ee(w.shape.reduce(function(D,W,Q){return Q>0&&Q<=x.length?D&&(W+p[Q-1][0]+p[Q-1][1])%x[Q-1]==0:D},!0),function(){return"input spatial dimensions "+w.shape.slice(1)+" with paddings "+p.toString()+" must be divisible by blockShapes "+x.toString()}),qe.runKernelFunc(function(D){return D.spaceToBatchND(w,x,p)},{$x:w},function(D){return{$x:function(){return D.batchToSpaceND(x,p)}}})}}),bs=Bt({squeeze_:function(C,x){var p=et(C,"x","squeeze");return Pa(p,sn(p.shape,x).newShape)}}),no=Bt({stack_:function(C,x){x===void 0&&(x=0);var p=Zc(C,"tensors","stack");if(Ee(p.length>=1,function(){return"Pass at least one tensor to tf.stack"}),p.length===1)return p[0].expandDims(x);var w=p[0].rank,D=p[0].shape,W=p[0].dtype;Ee(x<=w,function(){return"Axis must be <= rank of the tensor"}),p.forEach(function(ie){Ot(D,ie.shape,"All tensors passed to stack must have matching shapes")}),p.forEach(function(ie){Ee(W===ie.dtype,function(){return"All tensors passed to stack must have matching dtypes"})});var Q=p.map(function(ie){return ie.expandDims(x)});return va(Q,x)}}),_u=Bt({tile_:function(C,x){var p=et(C,"x","tile",null);Ee(p.rank===x.length,function(){return"Error in transpose: rank of input "+p.rank+" must match length of reps "+x+"."});var w=[p],D={reps:x};return qe.runKernelFunc(function(W,Q){var ie=W.tile(p,x);return Q([p]),ie},{x:p},function(W,Q){var ie=Q[0];return{x:function(){var fe=Ei(ie);if(ie.rank===1)for(var ye=0;ye<x[0];++ye)fe=fe.add(W.slice([ye*ie.shape[0]],[ie.shape[0]]));else if(ie.rank===2)for(ye=0;ye<x[0];++ye)for(var Oe=0;Oe<x[1];++Oe)fe=fe.add(W.slice([ye*ie.shape[0],Oe*ie.shape[1]],[ie.shape[0],ie.shape[1]]));else if(ie.rank===3)for(ye=0;ye<x[0];++ye)for(Oe=0;Oe<x[1];++Oe)for(var Re=0;Re<x[2];++Re)fe=fe.add(W.slice([ye*ie.shape[0],Oe*ie.shape[1],Re*ie.shape[2]],[ie.shape[0],ie.shape[1],ie.shape[2]]));else{if(ie.rank!==4)throw new Error("Gradient for tile operation is not implemented for rank-"+ie.rank+" tensors yet.");for(ye=0;ye<x[0];++ye)for(Oe=0;Oe<x[1];++Oe)for(Re=0;Re<x[2];++Re)for(var Pe=0;Pe<x[3];++Pe)fe=fe.add(W.slice([ye*ie.shape[0],Oe*ie.shape[1],Re*ie.shape[2],Pe*ie.shape[3]],[ie.shape[0],ie.shape[1],ie.shape[2],ie.shape[3]]))}return fe}}},"Tile",D,w)}}),Kl=Bt({truncatedNormal_:function(C,x,p,w,D){if(x===void 0&&(x=0),p===void 0&&(p=1),w!=null&&w==="bool")throw new Error("Unsupported data type "+w);for(var W=new Iu(x,p,w,!0,D),Q=Qi(C,w),ie=0;ie<Q.values.length;ie++)Q.values[ie]=W.nextValue();return Q.toTensor()}}),xs=Bt({unstack_:function(C,x){x===void 0&&(x=0),x=x||0;var p=et(C,"x","unstack");Ee(x>=-p.shape.length&&x<p.shape.length,function(){return"Axis = "+x+" is not in [-"+p.shape.length+", "+p.shape.length+")"}),x<0&&(x+=p.shape.length);var w={axis:x};return qe.runKernelFunc(function(D){return D.unstack(p,x)},{x:p},function(D){return{x:function(){return no(D,x)}}},"Unpack",w)}}),Yl=function(C,x){return S(this,void 0,void 0,function(){var p,w,D,W,Q,ie,fe,ye,Oe,Re;return M(this,function(Pe){switch(Pe.label){case 0:return p=et(C,"x","setdiff1d"),w=et(x,"y","setdiff1d"),Ee(p.dtype===w.dtype,function(){return"x and y should have the same dtype, but got x ("+p.dtype+") and y ("+w.dtype+")."}),Ee(p.rank===1,function(){return"x should be 1D tensor, but got x ("+p.shape+")."}),Ee(w.rank===1,function(){return"y should be 1D tensor, but got y ("+w.shape+")."}),[4,p.data()];case 1:return D=Pe.sent(),[4,w.data()];case 2:for(W=Pe.sent(),Q=new Set(W),ie=0,Oe=0;Oe<D.length;Oe++)Q.has(D[Oe])||ie++;for(fe=new co([ie],p.dtype),ye=new co([ie],"int32"),Oe=0,Re=0;Oe<D.length;Oe++)Q.has(D[Oe])||(fe.values[Re]=D[Oe],ye.values[Re]=Oe,Re++);return[2,[fe.toTensor(),ye.toTensor()]]}})})};function tl(C,x,p,w){w===void 0&&(w=!0);var D=[];if(w)(D=D.concat(x.slice(0))).push(C[0]/p),D=D.concat(C.slice(1));else{D=D.concat(C[0]);for(var W=x.length,Q=0;Q<W;++Q)D=D.concat([C[Q+1]/x[Q],x[Q]]);D=D.concat(C.slice(W+1))}return D}function fh(C,x,p){p===void 0&&(p=!0);var w=[];if(p){w.push(x);for(var D=x+1;D<C;++D)D<=2*x?(w.push(D),w.push(D-(x+1))):w.push(D)}else{var W=[],Q=[];for(D=1;D<C;++D)D>=2*x+1||D%2==1?Q.push(D):W.push(D);w.push.apply(w,W),w.push(0),w.push.apply(w,Q)}return w}function dh(C,x,p,w){w===void 0&&(w=!0);var D=[];w?D.push(C[0]/p):D.push(C[0]*p);for(var W=1;W<C.length;++W)W<=x.length?w?D.push(x[W-1]*C[W]):D.push(C[W]/x[W-1]):D.push(C[W]);return D}function kf(C,x){for(var p=[0],w=0;w<x;++w)p.push(C[w][0]);return p}function zm(C,x,p){for(var w=C.slice(0,1),D=0;D<p;++D)w.push(C[D+1]-x[D][0]-x[D][1]);return w}function nl(C,x){if(C.rank<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher, but the rank was "+C.rank+".");if(x.rank<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher, but the rank was "+x.rank+".");if(x.dtype!=="int32")throw new Error("tf.gatherND() expects the indices to be int32 type, but the dtype was "+x.dtype+".");if(x.shape[x.rank-1]>C.rank)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+x.shape[x.rank-1]+" vs. "+C.rank);if(C.size===0)throw new Error("Requested more than 0 entries, but input is empty. Input shape: "+C.shape+".");for(var p=x.shape,w=p[p.length-1],D=1,W=0;W<p.length-1;++W)D*=p[W];var Q=C.shape,ie=p.slice();ie.pop();var fe=1;for(W=w;W<C.rank;++W)fe*=Q[W],ie.push(Q[W]);var ye=ar(C.shape).map(function(Oe){return Oe/fe}).concat([1]).slice(0,w);return[ie,D,fe,ye]}var R0=Object.freeze({prepareAndValidate:nl}),Um=30;function dd(C){return C<=Um?C:nr(C,Math.floor(Math.sqrt(C)))}function Ug(C,x,p){var w=x.rank>1?x.shape[x.rank-1]:1,D=x.rank>1?x.rank-1:1,W="Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: "+p.shape+", indices.shape: "+x.shape+", shape: "+C+", sliceDim: "+w+", and batchDim: "+D+".";if(p.rank<D)throw new Error(W+" update.rank < "+D+". ");if(C.length<w+(p.rank-D))throw new Error(W+" Output shape length < "+(w+(p.rank-D)));if(p.rank!==D+C.length-w)throw new Error(W+" update.rank != "+(D+C.length-w));for(var Q=0;Q<D;++Q)if(p.shape[Q]!==x.shape[Q])throw new Error(W+" updates.shape["+Q+"] ("+p.shape[Q]+") != indices.shape["+Q+"] ("+x.shape[Q]+").");for(Q=0;Q<p.rank-D;++Q)if(p.shape[Q+D]!==C[Q+w])throw new Error(W+" updates.shape["+(Q+D)+"] ("+p.shape[Q+D]+") != shape["+(Q+D)+"] ("+C[Q+D]+")")}function hh(C,x,p){if(x.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher, but the rank was "+x.rank+".");if(C.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher, but the rank was "+C.rank+".");if(x.dtype!=="int32")throw new Error("The dtype of 'indices' should be int32, but got dtype: "+x.dtype);if(p.length<1)throw new Error("Output rank must be greater or equal to 1, but got shape: "+p);if(p.length===0){if(x.size===0)throw new Error("Indices specified for empty output. indices shape: "+x.shape);if(C.size===0)throw new Error("Updates specified for empty output. updates shape: "+C.shape)}Ug(p,x,C)}function Ef(C,x,p){for(var w=x.shape.length,D=w>1?x.shape[w-1]:1,W=p.length,Q=1,ie=D;ie<W;++ie)Q*=p[ie];var fe=D<1?1:D;
3877return{sliceRank:D,numUpdates:Ke(x.shape)/fe,sliceSize:Q,strides:ar(p.slice(0,D)).concat([1]),outputSize:Ke(p)}}var Wm=Object.freeze({validateUpdateShape:Ug,validateInput:hh,calculateShapes:Ef});function Np(C,x,p){Ee(C.rank===x.length,function(){return"Error in slice"+C.rank+"D: Length of begin "+x+" must match the rank of the array ("+C.rank+")."}),Ee(C.rank===p.length,function(){return"Error in slice"+C.rank+"D: Length of size "+p+" must match the rank of the array ("+C.rank+")."});for(var w=function(W){Ee(x[W]+p[W]<=C.shape[W],function(){return"Error in slice"+C.rank+"D: begin["+W+"] + size["+W+"] ("+(x[W]+p[W])+") would overflow input.shape["+W+"] ("+C.shape[W]+")"})},D=0;D<C.rank;++D)w(D)}function os(C){for(var x=[],p=0;C>0;)1&C&&x.push(p),C/=2,p++;return x}function hd(C,x,p){for(var w=[],D=0;D<C.length;D++)w[D]=Math.ceil((x[D]-C[D])/p[D]);return w}function ku(C,x,p,w,D){var W=x[D],Q=p[D]||1;(C&1<<D||W==null)&&(W=Q>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var ie=w[D];return W<0&&(W+=ie),ht(0,W,ie-1)}function pd(C,x,p,w,D){var W=x[D],Q=p[D]||1;(C&1<<D||W==null)&&(W=Q>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var ie=w[D];return W<0&&(W+=ie),Q>0?ht(0,W,ie):ht(-1,W,ie-1)}function ph(C,x,p){for(var w=p.length,D=0;D<p.length;D++)if(p[D]>1){w=D;break}for(D=w+1;D<p.length;D++)if(x[D]>0||p[D]!==C[D])return!1;return!0}function Ip(C,x){for(var p=C.length>0?C[C.length-1]:1,w=0;w<C.length-1;w++)p+=C[w]*x[w];return p}var Vm=Object.freeze({assertParamsValid:Np,maskToAxes:os,computeOutShape:hd,startForAxis:ku,stopForAxis:pd,isSliceContinous:ph,computeFlatOffset:Ip});function mh(C){return Ee(jn(C),function(){return"The f passed in grad(f) must be a function"}),function(x,p){var w=et(x,"x","tf.grad",null),D=p!=null?et(p,"dy","tf.grad"):null;return qe.tidy(function(){var W=qe.gradients(function(){return C(w)},[w],D),Q=W.value,ie=W.grads;return D!=null&&Ot(Q.shape,D.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Yn(ie),ie[0]})}}function md(C){return Ee(jn(C),function(){return"The f passed in grads(f) must be a function"}),function(x,p){Ee(Array.isArray(x),function(){return"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"});var w=Zc(x,"args","tf.grads",null),D=p!=null?et(p,"dy","tf.grads"):null;return qe.tidy(function(){var W=qe.gradients(function(){return C.apply(void 0,w)},w,D),Q=W.value,ie=W.grads;return D!=null&&Ot(Q.shape,D.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Yn(ie),ie})}}function $m(C){return Ee(jn(C),function(){return"The f passed in valueAndGrad(f) must be a function"}),function(x,p){Ee(x instanceof Zt,function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"}),Ee(p==null||p instanceof Zt,function(){return"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"});var w=qe.gradients(function(){return C(x)},[x],p),D=w.grads,W=w.value;return Yn(D),{grad:D[0],value:W}}}function Hm(C){return Ee(jn(C),function(){return"The f passed in valueAndGrads(f) must be a function"}),function(x,p){Ee(Array.isArray(x)&&x.every(function(D){return D instanceof Zt}),function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"}),Ee(p==null||p instanceof Zt,function(){return"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"});var w=qe.gradients(function(){return C.apply(void 0,x)},x,p);return p!=null&&Ot(w.value.shape,p.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Yn(w.grads),w}}function gn(C,x){Ee(jn(C),function(){return"The f passed in variableGrads(f) must be a function"}),Ee(x==null||Array.isArray(x)&&x.every(function(Oe){return Oe instanceof St}),function(){return"The varList passed in variableGrads(f, varList) must be an array of variables"});var p=x!=null;if(!p)for(var w in x=[],qe.registeredVariables)x.push(qe.registeredVariables[w]);var D=p?x.filter(function(Oe){return!Oe.trainable}):null,W=x.length;Ee((x=x.filter(function(Oe){return Oe.trainable})).length>0,function(){return"variableGrads() expects at least one of the input variables to be trainable, but none of the "+W+" variables is trainable."});var Q=qe.gradients(C,x,null,!0),ie=Q.value,fe=Q.grads;Ee(fe.some(function(Oe){return Oe!=null}),function(){return"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."}),Ee(ie.rank===0,function(){return"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+ie.rank+" tensor"});var ye={};return x.forEach(function(Oe,Re){fe[Re]!=null&&(ye[Oe.name]=fe[Re])}),D!=null&&D.forEach(function(Oe){return ye[Oe.name]=null}),{value:ie,grads:ye}}function Hu(C){return qe.customGrad(C)}function Yn(C){if(C.filter(function(x){return x==null}).length>0)throw new Error(`Cannot compute gradient of y=f(x) with respect to x. Make sure that 3878 the f you passed encloses all operations that lead from x to y.`)}var Eu=Bt({softmax_:function(C,x){x===void 0&&(x=-1);var p=et(C,"logits","softmax","float32");if(x===-1&&(x=p.rank-1),x!==p.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. Logits was rank "+p.rank+" and dim was "+x);return qe.runKernelFunc(function(w,D){var W=w.softmax(p,x);return D([W]),W},{logits:p},function(w,D){var W=D[0],Q=w.mul(W);return{logits:function(){return Q.sub(Q.sum([x],!0).mul(W))}}},"Softmax",{dim:x},[],[!0])}}),Oo=Bt({logSoftmax_:function(C,x){x===void 0&&(x=-1);var p=et(C,"logits","logSoftmax");if(x===-1&&(x=p.rank-1),x!==p.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. Logits was rank "+p.rank+" and axis was "+x);return Hu(function(w,D){var W=w.max(x,!0),Q=w.sub(W),ie=Q.toFloat
vendor: 26,662 bytes, lines 3878-4008
3878().sub(Q.exp().sum(x,!0).log());return D([ie]),{value:ie,gradFunc:function(fe,ye){var Oe=ye[0].exp();return fe.sub(fe.sum(x,!0).mul(Oe))}}})(p)}}),gd=function(){function C(x,p){this.backend=x,this.dataMover=p,this.data=new WeakMap,this.dataIdsCount=0}return C.prototype.get=function(x){return this.data.has(x)||this.dataMover.moveData(this.backend,x),this.data.get(x)},C.prototype.set=function(x,p){this.dataIdsCount++,this.data.set(x,p)},C.prototype.has=function(x){return this.data.has(x)},C.prototype.delete=function(x){return this.dataIdsCount--,this.data.delete(x)},C.prototype.numDataIds=function(){return this.dataIdsCount},C}(),gh=function(){function C(){}return C.prototype.time=function(x){return fr("time")},C.prototype.read=function(x){return fr("read")},C.prototype.readSync=function(x){return fr("readSync")},C.prototype.numDataIds=function(){return fr("numDataIds")},C.prototype.disposeData=function(x){return fr("disposeData")},C.prototype.write=function(x,p,w){return fr("write")},C.prototype.move=function(x,p,w,D){return fr("move")},C.prototype.memory=function(){return fr("memory")},C.prototype.floatPrecision=function(){return fr("floatPrecision")},C.prototype.epsilon=function(){return this.floatPrecision()===32?1e-7:1e-4},C.prototype.batchMatMul=function(x,p,w,D){return fr("batchMatMul")},C.prototype.fusedBatchMatMul=function(x){return x.a,x.b,x.transposeA,x.transposeB,x.bias,x.activation,x.preluActivationWeights,fr("fusedBatchMatMul")},C.prototype.slice=function(x,p,w){return fr("slice")},C.prototype.stridedSlice=function(x,p,w,D){return fr("stridedSlice")},C.prototype.unstack=function(x,p){return fr("unstack")},C.prototype.reverse=function(x,p){return fr("reverse")},C.prototype.concat=function(x,p){return fr("concat")},C.prototype.neg=function(x){return fr("neg")},C.prototype.add=function(x,p){return fr("add")},C.prototype.addN=function(x){return fr("addN")},C.prototype.subtract=function(x,p){return fr("subtract")},C.prototype.multiply=function(x,p){return fr("multiply")},C.prototype.realDivide=function(x,p){return fr("realDivide")},C.prototype.floorDiv=function(x,p){return fr("floorDiv")},C.prototype.sum=function(x,p){return fr("sum")},C.prototype.prod=function(x,p){return fr("prod")},C.prototype.unsortedSegmentSum=function(x,p,w){return fr("unsortedSegmentSum")},C.prototype.argMin=function(x,p){return fr("argMin")},C.prototype.argMax=function(x,p){return fr("argMax")},C.prototype.equal=function(x,p){return fr("equal")},C.prototype.notEqual=function(x,p){return fr("notEqual")},C.prototype.less=function(x,p){return fr("less")},C.prototype.lessEqual=function(x,p){return fr("lessEqual")},C.prototype.greater=function(x,p){return fr("greater")},C.prototype.greaterEqual=function(x,p){return fr("greaterEqual")},C.prototype.logicalNot=function(x){return fr("logicalNot")},C.prototype.logicalAnd=function(x,p){return fr("logicalAnd")},C.prototype.logicalOr=function(x,p){return fr("logicalOr")},C.prototype.where=function(x){return fr("where")},C.prototype.select=function(x,p,w){return fr("select")},C.prototype.topk=function(x,p,w){return fr("topk")},C.prototype.min=function(x,p){return fr("min")},C.prototype.minimum=function(x,p){return fr("minimum")},C.prototype.mod=function(x,p){return fr("mod")},C.prototype.max=function(x,p){return fr("max")},C.prototype.maximum=function(x,p){return fr("maximum")},C.prototype.all=function(x,p){return fr("all")},C.prototype.any=function(x,p){return fr("any")},C.prototype.squaredDifference=function(x,p){return fr("squaredDifference")},C.prototype.ceil=function(x){return fr("ceil")},C.prototype.floor=function(x){return fr("floor")},C.prototype.round=function(x){return fr("round")},C.prototype.sign=function(x){return fr("sign")},C.prototype.isNaN=function(x){return fr("isNaN")},C.prototype.isInf=function(x){return fr("isInf")},C.prototype.isFinite=function(x){return fr("isFinite")},C.prototype.pow=function(x,p){return fr("pow")},C.prototype.exp=function(x){return fr("exp")},C.prototype.expm1=function(x){return fr("expm1")},C.prototype.softmax=function(x,p){return fr("softmax")},C.prototype.log=function(x){return fr("log")},C.prototype.log1p=function(x){return fr("log1p")},C.prototype.sqrt=function(x){return fr("sqrt")},C.prototype.rsqrt=function(x){return fr("rsqrt")},C.prototype.square=function(x){return fr("square")},C.prototype.reciprocal=function(x){return fr("reciprocal")},C.prototype.relu=function(x){return fr("relu")},C.prototype.relu6=function(x){return fr("relu6")},C.prototype.prelu=function(x,p){return fr("prelu")},C.prototype.elu=function(x){return fr("elu")},C.prototype.eluDer=function(x,p){return fr("eluDer")},C.prototype.selu=function(x){return fr("selu")},C.prototype.int=function(x){return fr("int")},C.prototype.clip=function(x,p,w){return fr("clip")},C.prototype.abs=function(x){return fr("abs")},C.prototype.complexAbs=function(x){return fr("complexAbs")},C.prototype.sigmoid=function(x){return fr("sigmoid")},C.prototype.softplus=function(x){return fr("softplus")},C.prototype.sin=function(x){return fr("sin")},C.prototype.cos=function(x){return fr("cos")},C.prototype.tan=function(x){return fr("tan")},C.prototype.asin=function(x){return fr("asin")},C.prototype.acos=function(x){return fr("acos")},C.prototype.atan=function(x){return fr("atan")},C.prototype.atan2=function(x,p){return fr("atan2")},C.prototype.sinh=function(x){return fr("sinh")},C.prototype.cosh=function(x){return fr("cosh")},C.prototype.tanh=function(x){return fr("tanh")},C.prototype.asinh=function(x){return fr("asinh")},C.prototype.acosh=function(x){return fr("acosh")},C.prototype.atanh=function(x){return fr("atanh")},C.prototype.erf=function(x){return fr("erf")},C.prototype.step=function(x,p){return fr("step")},C.prototype.fusedConv2d=function(x){return x.input,x.filter,x.convInfo,x.bias,x.activation,x.preluActivationWeights,fr("fusedConv2d")},C.prototype.conv2d=function(x,p,w){return fr("conv2d")},C.prototype.conv2dDerInput=function(x,p,w){return fr("conv2dDerInput")},C.prototype.conv2dDerFilter=function(x,p,w){return fr("conv2dDerFilter")},C.prototype.fusedDepthwiseConv2D=function(x){return x.input,x.filter,x.convInfo,x.bias,x.activation,x.preluActivationWeights,fr("fusedDepthwiseConv2D")},C.prototype.depthwiseConv2D=function(x,p,w){return fr("depthwiseConv2D")},C.prototype.depthwiseConv2DDerInput=function(x,p,w){return fr("depthwiseConv2DDerInput")},C.prototype.depthwiseConv2DDerFilter=function(x,p,w){return fr("depthwiseConv2DDerFilter")},C.prototype.conv3d=function(x,p,w){return fr("conv3d")},C.prototype.conv3dDerInput=function(x,p,w){return fr("conv3dDerInput")},C.prototype.conv3dDerFilter=function(x,p,w){return fr("conv3dDerFilter")},C.prototype.maxPool=function(x,p){return fr("maxPool")},C.prototype.maxPoolBackprop=function(x,p,w,D){return fr("maxPoolBackprop")},C.prototype.avgPool=function(x,p){return fr("avgPool")},C.prototype.avgPoolBackprop=function(x,p,w){return fr("avgPoolBackprop")},C.prototype.avgPool3d=function(x,p){return fr("avgPool3d")},C.prototype.avgPool3dBackprop=function(x,p,w){return fr("avgPool3dBackprop")},C.prototype.maxPool3d=function(x,p){return fr("maxPool3d")},C.prototype.maxPool3dBackprop=function(x,p,w,D){return fr("maxPool3dBackprop")},C.prototype.reshape=function(x,p){return fr("reshape")},C.prototype.cast=function(x,p){return fr("cast")},C.prototype.tile=function(x,p){return fr("tile")},C.prototype.pad=function(x,p,w){return fr("pad")},C.prototype.transpose=function(x,p){return fr("transpose")},C.prototype.gather=function(x,p,w){return fr("gather")},C.prototype.gatherND=function(x,p){return fr("gatherND")},C.prototype.scatterND=function(x,p,w){return fr("scatterND")},C.prototype.batchToSpaceND=function(x,p,w){return fr("batchToSpaceND")},C.prototype.spaceToBatchND=function(x,p,w){return fr("spaceToBatchND")},C.prototype.resizeBilinear=function(x,p,w,D){return fr("resizeBilinear")},C.prototype.resizeBilinearBackprop=function(x,p,w){return fr("resizeBilinearBackprop")},C.prototype.resizeNearestNeighbor=function(x,p,w,D){return fr("resizeNearestNeighbor")},C.prototype.resizeNearestNeighborBackprop=function(x,p,w){return fr("resizeNearestNeighborBackprop")},C.prototype.batchNormalization=function(x,p,w,D,W,Q){return fr("batchNormalization")},C.prototype.localResponseNormalization4D=function(x,p,w,D,W){return fr("localResponseNormalization4D")},C.prototype.LRNGrad=function(x,p,w,D,W,Q,ie){return fr("LRNGrad")},C.prototype.multinomial=function(x,p,w,D){return fr("multinomial")},C.prototype.oneHot=function(x,p,w,D){return fr("oneHot")},C.prototype.cumsum=function(x,p,w,D){return fr("cumsum")},C.prototype.nonMaxSuppression=function(x,p,w,D,W){return fr("nonMaxSuppression")},C.prototype.fft=function(x){return fr("fft")},C.prototype.ifft=function(x){return fr("ifft")},C.prototype.complex=function(x,p){return fr("complex")},C.prototype.real=function(x){return fr("real")},C.prototype.imag=function(x){return fr("imag")},C.prototype.cropAndResize=function(x,p,w,D,W,Q){return fr("cropAndResize")},C.prototype.depthToSpace=function(x,p,w){return fr("depthToSpace")},C.prototype.split=function(x,p,w){return fr("split")},C.prototype.sparseToDense=function(x,p,w,D){return fr("sparseToDense")},C.prototype.diag=function(x){return fr("diag")},C.prototype.fill=function(x,p,w){return fr("fill")},C.prototype.onesLike=function(x){return fr("onesLike")},C.prototype.zerosLike=function(x){return fr("zerosLike")},C.prototype.linspace=function(x,p,w){return fr("linspace")},C.prototype.dispose=function(){return fr("dispose")},C}();function fr(C){throw new Error("'"+C+"' not yet implemented or not found in the registry. Did you forget to import the kernel?")}function js(C,x){for(var p=C.length,w=[],D=0;D<p;D++){var W=p-1-D,Q=C[W]||1;(x[x.length-1-D]||1)>1&&Q===1&&w.unshift(W)}return w}function as(C,x){for(var p=[],w=0;w<x.length;w++){var D=C[C.length-w-1],W=x.length-w-1,Q=x[W];(D==null||D===1&&Q>1)&&p.unshift(W)}return p}function ho(C,x){for(var p=[],w=Math.max(C.length,x.length),D=0;D<w;D++){var W=C[C.length-D-1];W==null&&(W=1);var Q=x[x.length-D-1];if(Q==null&&(Q=1),W===1)p.unshift(Q);else if(Q===1)p.unshift(W);else{if(W!==Q)throw Error("Operands could not be broadcast together with shapes "+C+" and "+x+".");p.unshift(W)}}return p}function Mc(C,x,p,w,D,W,Q){Q===void 0&&(Q="channelsLast");var ie,fe=rl(x),ye=fe[0],Oe=fe[1];if(Q==="channelsLast")ie=[ye,Oe,C[3],C[3]];else{if(Q!=="channelsFirst")throw new Error("Unknown dataFormat "+Q);ie=[ye,Oe,C[1],C[1]]}return qu(C,ie,p,w,D,W,!1,Q)}function El(C,x,p,w,D,W,Q){Q===void 0&&(Q="NDHWC");var ie,fe,ye=Gu(x),Oe=ye[0],Re=ye[1],Pe=ye[2];if(Q==="NDHWC")fe="channelsLast",ie=[Oe,Re,Pe,C[4],C[4]];else{if(Q!=="NCDHW")throw new Error("Unknown dataFormat "+Q);fe="channelsFirst",ie=[Oe,Re,Pe,C[1],C[1]]}return Cl(C,ie,p,w,D,!1,fe,W)}function qu(C,x,p,w,D,W,Q,ie){Q===void 0&&(Q=!1),ie===void 0&&(ie="channelsLast");var fe=[-1,-1,-1,-1],ye=fe[0],Oe=fe[1],Re=fe[2],Pe=fe[3];if(ie==="channelsLast")ye=C[0],Oe=C[1],Re=C[2],Pe=C[3];else{if(ie!=="channelsFirst")throw new Error("Unknown dataFormat "+ie);ye=C[0],Pe=C[1],Oe=C[2],Re=C[3]}var je,Ge=x[0],rt=x[1],nt=x[3],lt=rl(p),Nt=lt[0],Rt=lt[1],Pt=rl(w),Kt=Pt[0],dn=Pt[1],bn=Mo(Ge,Kt),pn=Mo(rt,dn),_n=function(y,E,z,Y,Z,le,de,we){var De,Ne,Fe;if(typeof y=="number"){De={top:y,bottom:y,left:y,right:y,type:y===0?"VALID":"NUMBER"};var Ve=function(At,Lt,tn,ln,nn){ln==null&&(ln=Oa(At,Lt,tn));var cn=At[1],Dn=tu((At[0]-Lt+2*ln)/tn+1,nn);Ee(vt(Dn),function(){return"The output # of rows ("+Dn+") must be an integer. Change the stride and/or zero pad parameters"});var Rn=tu((cn-Lt+2*ln)/tn+1,nn);return Ee(vt(Rn),function(){return"The output # of columns ("+Rn+") must be an integer. Change the stride and/or zero pad parameters"}),[Dn,Rn]}([E,z],le,Y,y,we);Ne=Ve[0],Fe=Ve[1]}else if(y==="same"){Ne=Math.ceil(E/Y),Fe=Math.ceil(z/Z);var Je=Math.max(0,(Ne-1)*Y+le-E),Xe=Math.max(0,(Fe-1)*Z+de-z),ot=Math.floor(Je/2),xt=Je-ot,kt=Math.floor(Xe/2);De={top:ot,bottom:xt,left:kt,right:Xe-kt,type:"SAME"}}else{if(y!=="valid")throw Error("Unknown padding parameter: "+y);De={top:0,bottom:0,left:0,right:0,type:"VALID"},Ne=Math.ceil((E-le+1)/Y),Fe=Math.ceil((z-de+1)/Z)}return{padInfo:De,outHeight:Ne,outWidth:Fe}}(D,Oe,Re,Nt,Rt,bn,pn,W),On=_n.padInfo,_=_n.outHeight,m=_n.outWidth,f=Q?nt*Pe:nt;return ie==="channelsFirst"?je=[ye,f,_,m]:ie==="channelsLast"&&(je=[ye,_,m,f]),{batchSize:ye,dataFormat:ie,inHeight:Oe,inWidth:Re,inChannels:Pe,outHeight:_,outWidth:m,outChannels:f,padInfo:On,strideHeight:Nt,strideWidth:Rt,filterHeight:Ge,filterWidth:rt,effectiveFilterHeight:bn,effectiveFilterWidth:pn,dilationHeight:Kt,dilationWidth:dn,inShape:C,outShape:je,filterShape:x}}function Cl(C,x,p,w,D,W,Q,ie){W===void 0&&(W=!1),Q===void 0&&(Q="channelsLast");var fe=[-1,-1,-1,-1,-1],ye=fe[0],Oe=fe[1],Re=fe[2],Pe=fe[3],je=fe[4];if(Q==="channelsLast")ye=C[0],Oe=C[1],Re=C[2],Pe=C[3],je=C[4];else{if(Q!=="channelsFirst")throw new Error("Unknown dataFormat "+Q);ye=C[0],je=C[1],Oe=C[2],Re=C[3],Pe=C[4]}var Ge,rt=x[0],nt=x[1],lt=x[2],Nt=x[4],Rt=Gu(p),Pt=Rt[0],Kt=Rt[1],dn=Rt[2],bn=Gu(w),pn=bn[0],_n=bn[1],On=bn[2],_=Mo(rt,pn),m=Mo(nt,_n),f=Mo(lt,On),y=function(de,we,De,Ne,Fe,Ve,Je,Xe,ot,xt,kt){var At,Lt,tn,ln;if(typeof de=="number"){At={top:de,bottom:de,left:de,right:de,front:de,back:de,type:de===0?"VALID":"NUMBER"};var nn=function(yr,mr,jr,Pr,ei,pi){ei==null&&(ei=Oa(yr,mr,Pr));var Mi=yr[1],Ro=yr[2],Bo=tu((yr[0]-mr+2*ei)/Pr+1,pi);Ee(vt(Bo),function(){return"The output # of depths ("+Bo+") must be an integer. Change the stride and/or zero pad parameters"});var Zo=tu((Mi-mr+2*ei)/Pr+1,pi);Ee(vt(Zo),function(){return"The output # of rows ("+Zo+") must be an integer. Change the stride and/or zero pad parameters"});var Jo=tu((Ro-mr+2*ei)/Pr+1,pi);return Ee(vt(Jo),function(){return"The output # of columns ("+Jo+") must be an integer. Change the stride and/or zero pad parameters"}),[Bo,Zo,Jo,1]}([we,De,Ne,1],Xe,0,Fe,de,kt);Lt=nn[0],tn=nn[1],ln=nn[2]}else if(de==="same"){var cn=((Lt=Math.ceil(we/Fe))-1)*Fe+Xe-we,Dn=((tn=Math.ceil(De/Ve))-1)*Ve+ot-De,Rn=((ln=Math.ceil(Ne/Je))-1)*Je+xt-Ne,Mn=Math.floor(cn/2),tr=cn-Mn,ur=Math.floor(Dn/2),vr=Dn-ur,kr=Math.floor(Rn/2);At={top:ur,bottom:vr,left:kr,right:Rn-kr,front:Mn,back:tr,type:"SAME"}}else{if(de!=="valid")throw Error("Unknown padding parameter: "+de);At={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},Lt=Math.ceil((we-Xe+1)/Fe),tn=Math.ceil((De-ot+1)/Ve),ln=Math.ceil((Ne-xt+1)/Je)}return{padInfo:At,outDepth:Lt,outHeight:tn,outWidth:ln}}(D,Oe,Re,Pe,Pt,Kt,dn,_,m,f,ie),E=y.padInfo,z=y.outDepth,Y=y.outHeight,Z=y.outWidth,le=W?Nt*je:Nt;return Q==="channelsFirst"?Ge=[ye,le,z,Y,Z]:Q==="channelsLast"&&(Ge=[ye,z,Y,Z,le]),{batchSize:ye,dataFormat:Q,inDepth:Oe,inHeight:Re,inWidth:Pe,inChannels:je,outDepth:z,outHeight:Y,outWidth:Z,outChannels:le,padInfo:E,strideDepth:Pt,strideHeight:Kt,strideWidth:dn,filterDepth:rt,filterHeight:nt,filterWidth:lt,effectiveFilterDepth:_,effectiveFilterHeight:m,effectiveFilterWidth:f,dilationDepth:pn,dilationHeight:_n,dilationWidth:On,inShape:C,outShape:Ge,filterShape:x}}function Oa(C,x,p,w){w===void 0&&(w=1);var D=Mo(x,w);return Math.floor((C[0]*(p-1)-p+D)/2)}function rl(C){return typeof C=="number"?[C,C,C]:C.length===2?[C[0],C[1],1]:C}function Gu(C){return typeof C=="number"?[C,C,C]:C}function Mo(C,x){return x<=1?C:C+(C-1)*(x-1)}function tu(C,x){if(!x)return C;switch(x){case"round":return Math.round(C);case"ceil":return Math.ceil(C);case"floor":return Math.floor(C);default:throw new Error("Unknown roundingMode "+x)}}function ps(C){var x=rl(C),p=x[0],w=x[1],D=x[2];return p===1&&w===1&&D===1}function nu(C,x){return ps(C)||ps(x)}function Da(C){if(C==="NHWC")return"channelsLast";if(C==="NCHW")return"channelsFirst";throw new Error("Unknown dataFormat "+C)}function Ku(C,x,p){if(x==="complex64"){if(C.dtype==="complex64")return C.clone();var w=go(C.shape),D=C.toFloat(),W=p.complex(D,w);return w.dispose(),D.dispose(),W}if(!He(C.dtype,x))return qe.makeTensorFromDataId(C.dataId,C.shape,x);if(C.dtype==="complex64"){var Q=p.real(C);return W=Q.cast(x),Q.dispose(),W}if(x==="int32")return p.int(C);if(x==="bool"){var ie=Or(0,C.dtype);return W=p.notEqual(C,ie),ie.dispose(),W}throw new Error("Error in Cast: failed to cast "+C.dtype+" to "+x)}function Fc(C,x){return qe.makeTensorFromDataId(C.dataId,x,C.dtype)}function il(C,x,p){var w=(x-C)/(p-1),D=rn(p,"float32");D[0]=C;for(var W=1;W<D.length;W++)D[W]=D[W-1]+w;return Vu(D,"float32")}var Sl=Object.freeze({castTensor:Ku,reshapeTensor:Fc,linspaceImpl:il,upcastType:kn,axesAreInnerMostDims:uh,combineLocations:Im,computeOutAndReduceShapes:ra,expandShapeToKeepDim:ia,assertAxesAreInnerMostDims:Aa,getAxesPermutation:fs,getUndoAxesPermutation:Ic,getInnerMostAxes:ds,getBroadcastDims:js,getReductionAxes:as,assertAndGetBroadcastShape:ho,assertParamsConsistent:Hl,computeOutShape:sc,computePool2DInfo:Mc,computePool3DInfo:El,computeConv2DInfo:qu,computeConv3DInfo:Cl,computeDefaultPad:Oa,tupleValuesAreOne:ps,eitherStridesOrDilationsAreOne:nu,convertConv2DDataFormat:Da,PARALLELIZE_THRESHOLD:Um,computeOptimalWindowSize:dd});function Rc(C,x){if(C.length!==x.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+C.length+", imag: "+x.length+".");for(var p=new Float32Array(2*C.length),w=0;w<p.length;w+=2)p[w]=C[w/2],p[w+1]=x[w/2];return p}function Cf(C,x){return{real:C[2*x],imag:C[2*x+1]}}function Sf(C,x,p,w){C[2*w]=x,C[2*w+1]=p}function Mp(C,x,p){var w=(p?2:-2)*Math.PI*(C/x);return{real:Math.cos(w),imag:Math.sin(w)}}function Af(C,x,p){var w=function(W,Q,ie){return function(fe,ye,Oe){for(var Re=0,Pe=fe.length,je=0,Ge=!1;Re<Pe;){var rt=Oe(ye,fe[je=Re+(Pe-Re>>>1)]);rt>0?Re=je+1:(Pe=je,Ge=!rt)}return Ge?Re:-Re-1}(W,Q,ie||Yu)}(C,x,p),D=w<0?-(w+1):w;C.splice(D,0,x)}function Yu(C,x){return C>x?1:C<x?-1:0}function Bc(C,x,p,w,D){return lc(C,x,p,w,D,0).selectedIndices}function Pc(C,x,p,w,D,W){var Q=lc(C,x,p,w,D,W);return Q.numValidOutputs.dispose(),{selectedIndices:Q.selectedIndices,selectedScores:Q.selectedScores}}function lc(C,x,p,w,D,W,Q,ie){ie===void 0&&(ie=!1);for(var fe=Array.from(x).map(function(Pt,Kt){return{score:Pt,boxIndex:Kt,suppressBeginIndex:0}}).filter(function(Pt){return Pt.score>D}).sort(yh),ye=W>0?-.5/W:0,Oe=[],Re=[];Oe.length<p&&fe.length>0;){var Pe=fe.pop(),je=Pe.score,Ge=Pe.boxIndex,rt=Pe.suppressBeginIndex;if(je<D)break;for(var nt=!1,lt=Oe.length-1;lt>=rt;--lt){var Nt=Fp(C,Ge,Oe[lt]);if(Nt>=w){nt=!0;break}if(Pe.score=Pe.score*vh(w,ye,Nt),Pe.score<=D)break}Pe.suppressBeginIndex=Oe.length,nt||(Pe.score===je?(Oe.push(Ge),Re.push(Pe.score)):Pe.score>D&&Af(fe,Pe,yh))}var Rt=Oe.length;return ie&&(Oe.fill(0,Rt),Re.fill(0,Rt)),{selectedIndices:Vu(Oe,"int32"),selectedScores:Vu(Re,"float32"),numValidOutputs:Or(Rt,"int32")}}function Fp(C,x,p){var w=C.subarray(4*x,4*x+4),D=C.subarray(4*p,4*p+4),W=Math.min(w[0],w[2]),Q=Math.min(w[1],w[3]),ie=Math.max(w[0],w[2]),fe=Math.max(w[1],w[3]),ye=Math.min(D[0],D[2]),Oe=Math.min(D[1],D[3]),Re=Math.max(D[0],D[2]),Pe=Math.max(D[1],D[3]),je=(ie-W)*(fe-Q),Ge=(Re-ye)*(Pe-Oe);if(je<=0||Ge<=0)return 0;var rt=Math.max(W,ye),nt=Math.max(Q,Oe),lt=Math.min(ie,Re),Nt=Math.min(fe,Pe),Rt=Math.max(lt-rt,0)*Math.max(Nt-nt,0);return Rt/(je+Ge-Rt)}function vh(C,x,p){var w=Math.exp(x*p*p);return p<=C?w:0}function yh(C,x){return C.score-x.score||C.score===x.score&&x.boxIndex-C.boxIndex}function vd(C,x,p){var w=new Array(C.rank).fill(0),D=C.shape.slice();return x.map(function(W){D[p]=W;var Q=C.slice(w,D);return w[p]+=W,Q})}function bh(C,x){for(var p=new Array(C.rank),w=0;w<p.length;w++)p[w]=C.shape[w]*x[w];var D=Qi(p,C.dtype);for(w=0;w<D.values.length;++w){for(var W=D.indexToLoc(w),Q=new Array(C.rank),ie=0;ie<Q.length;ie++)Q[ie]=W[ie]%C.shape[ie];var fe=C.locToIndex(Q);D.values[w]=C.values[fe]}return D.toTensor()}function ae(C,x,p,w,D){for(var W=x[x.length-1],Q=[C.length/W,W],ie=Q[0],fe=Q[1],ye=yn(p,ie*w),Oe=yn("int32",ie*w),Re=0;Re<ie;Re++){for(var Pe=Re*fe,je=C.subarray(Pe,Pe+fe),Ge=[],rt=0;rt<je.length;rt++)Ge.push({value:je[rt],index:rt});Ge.sort(function(Pt,Kt){return Kt.value-Pt.value});var nt=Re*w,lt=ye.subarray(nt,nt+w),Nt=Oe.subarray(nt,nt+w);for(rt=0;rt<w;rt++)lt[rt]=Ge[rt].value,Nt[rt]=Ge[rt].index}var Rt=x.slice();return Rt[Rt.length-1]=w,[Qo(ye,Rt,p),Qo(Oe,Rt,"int32")]}function ne(C,x){for(var p=[],w=0;w<x.length;w++)x[w]&&p.push(w);var D=Qi(C,"int32"),W=Qi([p.length,C.length],"int32");for(w=0;w<p.length;w++){var Q=D.indexToLoc(p[w]),ie=w*C.length;W.values.set(Q,ie)}return W.toTensor()}function B(C,x){return["x","y","z","w","u","v"].slice(0,x).map(function(p){return C+"."+p})}function H(C,x){return x===1?[C]:B(C,x)}function ue(){var C,x,p,w,D,W,Q,ie,fe,ye;return L().getNumber("WEBGL_VERSION")===2?(C="#version 300 es",x="in",p="out",w="in",D="texture",W="outputColor",Q="out vec4 outputColor;",ie=` 3879 bool isnan_custom(float val) { 3880 return (val > 0.0 || val < 0.0) ? false : val != 0.0; 3881 } 3882 3883 bvec4 isnan_custom(vec4 val) { 3884 return bvec4(isnan_custom(val.x), 3885 isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w)); 3886 } 3887 3888 #define isnan(value) isnan_custom(value) 3889 `,fe="",ye=` 3890 #define round(value) newRound(value) 3891 int newRound(float value) { 3892 return int(floor(value + 0.5)); 3893 } 3894 3895 ivec4 newRound(vec4 value) { 3896 return ivec4(floor(value + vec4(0.5))); 3897 } 3898 `):(C="",x="attribute",p="varying",w="varying",D="texture2D",W="gl_FragColor",Q="",ie=` 3899 #define isnan(value) isnan_custom(value) 3900 bool isnan_custom(float val) { 3901 return (val > 0. || val < 1. || val == 0.) ? false : true; 3902 } 3903 bvec4 isnan_custom(vec4 val) { 3904 return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w)); 3905 } 3906 `,fe=` 3907 uniform float INFINITY; 3908 3909 bool isinf(float val) { 3910 return abs(val) == INFINITY; 3911 } 3912 bvec4 isinf(vec4 val) { 3913 return equal(abs(val), vec4(INFINITY)); 3914 } 3915 `,ye=` 3916 int round(float value) { 3917 return int(floor(value + 0.5)); 3918 } 3919 3920 ivec4 round(vec4 value) { 3921 return ivec4(floor(value + vec4(0.5))); 3922 } 3923 `),{version:C,attribute:x,varyingVs:p,varyingFs:w,texture2D:D,output:W,defineOutput:Q,defineSpecialNaN:ie,defineSpecialInf:fe,defineRound:ye}}function Le(C,x,p){p===void 0&&(p="index");var w=ar(x);return w.map(function(D,W){return"int "+C[W]+" = "+p+" / "+D+"; "+(W===w.length-1?"int "+C[W+1]+" = "+p+" - "+C[W]+" * "+D:"index -= "+C[W]+" * "+D)+";"}).join("")}function Qe(C){var x=ar(C).map(function(p){return p.toString()});return` 3924 int getFlatIndex(ivec3 coords) { 3925 return coords.x * `+x[0]+" + coords.y * "+x[1]+` + coords.z; 3926 } 3927`}var wt=` 3928 const float FLOAT_MAX = 1.70141184e38; 3929 const float FLOAT_MIN = 1.17549435e-38; 3930 3931 lowp vec4 encode_float(highp float v) { 3932 if (isnan(v)) { 3933 return vec4(255, 255, 255, 255); 3934 } 3935 3936 highp float av = abs(v); 3937 3938 if(av < FLOAT_MIN) { 3939 return vec4(0.0, 0.0, 0.0, 0.0); 3940 } else if(v > FLOAT_MAX) { 3941 return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; 3942 } else if(v < -FLOAT_MAX) { 3943 return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; 3944 } 3945 3946 highp vec4 c = vec4(0,0,0,0); 3947 3948 highp float e = floor(log2(av)); 3949 highp float m = exp2(fract(log2(av))) - 1.0; 3950 3951 c[2] = floor(128.0 * m); 3952 m -= c[2] / 128.0; 3953 c[1] = floor(32768.0 * m); 3954 m -= c[1] / 32768.0; 3955 c[0] = floor(8388608.0 * m); 3956 3957 highp float ebias = e + 127.0; 3958 c[3] = floor(ebias / 2.0); 3959 ebias -= c[3] * 2.0; 3960 c[2] += floor(ebias) * 128.0; 3961 3962 c[3] += 128.0 * step(0.0, -v); 3963 3964 return c / 255.0; 3965 } 3966`;function qt(C,x,p,w){var D=[];C.forEach(function(je){var Ge=Ke(je.shapeInfo.logicalShape);je.shapeInfo.isUniform?D.push("uniform float "+je.name+(Ge>1?"["+Ge+"]":"")+";"):(D.push("uniform sampler2D "+je.name+";"),D.push("uniform int offset"+je.name+";"))});var W,Q,ie=D.join(` 3967`),fe=C.map(function(je){return function(Ge,rt,nt){nt===void 0&&(nt=!1);var lt="";lt+=nt?function Pt(Kt){var dn,bn,pn;switch(Kt.shapeInfo.logicalShape.length){case 0:return dn=Kt.name,bn="get"+dn.charAt(0).toUpperCase()+dn.slice(1),pn=ue(),` 3968 vec4 `+bn+`() { 3969 return `+pn.texture2D+"("+dn+`, halfCR); 3970 } 3971 `;case 1:return function(_n){var On=_n.name,_="get"+On.charAt(0).toUpperCase()+On.slice(1),m=_n.shapeInfo.texShape,f=[Math.ceil(m[0]/2),Math.ceil(m[1]/2)],y=ue();return` 3972 vec4 `+_+`(int index) { 3973 vec2 uv = packedUVfrom1D( 3974 `+f[0]+", "+f[1]+`, index); 3975 return `+y.texture2D+"("+On+`, uv); 3976 } 3977 `}(Kt);case 2:return function(_n){var On=_n.shapeInfo.logicalShape,_=_n.name,m="get"+_.charAt(0).toUpperCase()+_.slice(1),f=_n.shapeInfo.texShape,y=f[0],E=f[1],z=ue();if(f!=null&&Tt(On,f))return` 3978 vec4 `+m+`(int row, int col) { 3979 vec2 uv = (vec2(col, row) + halfCR) / vec2(`+E+".0, "+y+`.0); 3980 3981 return `+z.texture2D+"("+_+`, uv); 3982 } 3983 `;var Y=[Math.ceil(f[0]/2),Math.ceil(f[1]/2)],Z=Math.ceil(On[1]/2);return` 3984 vec4 `+m+`(int row, int col) { 3985 vec2 uv = packedUVfrom2D(`+Z+", "+Y[0]+", "+Y[1]+`, row, col); 3986 return `+z.texture2D+"("+_+`, uv); 3987 } 3988 `}(Kt);case 3:return function(_n){var On=_n.shapeInfo.logicalShape,_=_n.name,m="get"+_.charAt(0).toUpperCase()+_.slice(1),f=_n.shapeInfo.texShape,y=[Math.ceil(f[0]/2),Math.ceil(f[1]/2)];if(On[0]===1){var E=On.slice(1),z=lr(_n,E);return` 3989 `+Pt(z)+` 3990 vec4 `+m+`(int b, int row, int col) { 3991 return `+m+"("+dr(["b","row","col"],[1,2])+`); 3992 } 3993 `}var Y=y[0],Z=y[1],le=Math.ceil(On[2]/2),de=le*Math.ceil(On[1]/2),we=ue();return` 3994 vec4 `+m+`(int b, int row, int col) { 3995 vec2 uv = packedUVfrom3D( 3996 `+Y+", "+Z+", "+de+", "+le+`, b, row, col); 3997 return `+we.texture2D+"("+_+`, uv); 3998 } 3999 `}(Kt);default:return function(_n){for(var On=_n.shapeInfo.logicalShape,_=On.length,m=_n.name,f="get"+m.charAt(0).toUpperCase()+m.slice(1),y=_n.shapeInfo.texShape,E=[Math.ceil(y[0]/2),Math.ceil(y[1]/2)],z=E[0],Y=E[1],Z=Math.ceil(On[_-1]/2),le=Z*Math.ceil(On[_-2]/2),de="int b, int row, int col",we="b * "+le+" + (row / 2) * "+Z+" + (col / 2)",De=2;De<_-1;De++)de="int b"+De+", "+de,le*=On[_-De-1],we="b"+De+" * "+le+" + "+we;var Ne=ue();return` 4000 vec4 `+f+"("+de+`) { 4001 int index = `+we+`; 4002 int texR = index / `+Y+`; 4003 int texC = index - texR * `+Y+`; 4004 vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+Y+", "+z+`); 4005 return `+Ne.texture2D+"("+m+`, uv); 4006 } 4007 `}(Kt)}}(Ge):function Pt(Kt){var dn=Kt.shapeInfo.logicalShape;switch(dn.length){case 0:return function(bn){var pn=bn.name,_n="get"+pn.charAt(0).toUpperCase()+pn.slice(1);if(bn.shapeInfo.isUniform)return"float "+_n+"() {return "+pn+";}";var On=bn.shapeInfo.texShape,_=On[0],m=On[1];if(_===1&&m===1)return` 4008 float `+_n+`() {
4009 return sampleTexture(`+pn+`, halfCR); 4010 } 4011 `;var f=bn.shapeInfo.texShape,y=f[0],E=f[1],z=zn(pn);return` 4012 float `+_n+`() { 4013 vec2 uv = uvFromFlat(`+y+", "+E+", "+z+`); 4014 return sampleTexture(`+pn+`, uv); 4015 } 4016 `}(Kt);case 1:return function(bn){var pn=bn.name,_n="get"+pn.charAt(0).toUpperCase()+pn.slice(1);if(bn.shapeInfo.isUniform)return` 4017 float `+_n+`(int index) { 4018 `+Jn(bn)+` 4019 } 4020 `;var On=bn.shapeInfo.texShape,_=On[0],m=On[1];if(m===1&&_===1)return` 4021 float `+_n+`(int index) { 4022 return sampleTexture(`+pn+`, halfCR); 4023 } 4024 `;var f=zn(pn);return m===1?` 4025 float `+_n+`(int index) { 4026 vec2 uv = vec2(0.5, (float(index + `+f+") + 0.5) / "+_+`.0); 4027 return sampleTexture(`+pn+`, uv); 4028 } 4029 `:_===1?` 4030 float `+_n+`(int index) { 4031 vec2 uv = vec2((float(index + `+f+") + 0.5) / "+m+`.0, 0.5); 4032 return sampleTexture(`+pn+`, uv); 4033 } 4034 `:` 4035 float `+_n+`(int index) { 4036 vec2 uv = uvFromFlat(`+_+", "+m+", index + "+f+`); 4037 return sampleTexture(`+pn+`, uv); 4038 } 4039 `}(Kt);case 2:return function(bn){var pn=bn.shapeInfo.logicalShape,_n=bn.name,On="get"+_n.charAt(0).toUpperCase()+_n.slice(1),_=bn.shapeInfo.texShape;if(_!=null&&Tt(pn,_)){var m=_[0],f=_[1];return` 4040 float `+On+`(int row, int col) { 4041 vec2 uv = (vec2(col, row) + halfCR) / vec2(`+f+".0, "+m+`.0); 4042 return sampleTexture(`+_n+`, uv); 4043 } 4044 `}var y=sn(pn),E=y.newShape,z=y.keptDims,Y=E;if(Y.length<pn.length){var Z=lr(bn,Y);return` 4045 `+Pt(Z)+` 4046 float `+On+`(int row, int col) { 4047 return `+On+"("+dr(["row","col"],z)+`); 4048 } 4049 `}if(bn.shapeInfo.isUniform)return` 4050 float `+On+`(int row, int col) { 4051 int index = round(dot(vec2(row, col), vec2(`+pn[1]+`, 1))); 4052 `+Jn(bn)+` 4053 } 4054 `;var le=_[0],de=_[1],we=zn(_n);return de===1?` 4055 float `+On+`(int row, int col) { 4056 float index = dot(vec3(row, col, `+we+"), vec3("+pn[1]+`, 1, 1)); 4057 vec2 uv = vec2(0.5, (index + 0.5) / `+le+`.0); 4058 return sampleTexture(`+_n+`, uv); 4059 } 4060 `:le===1?` 4061 float `+On+`(int row, int col) { 4062 float index = dot(vec3(row, col, `+we+"), vec3("+pn[1]+`, 1, 1)); 4063 vec2 uv = vec2((index + 0.5) / `+de+`.0, 0.5); 4064 return sampleTexture(`+_n+`, uv); 4065 } 4066 `:` 4067 float `+On+`(int row, int col) { 4068 // Explicitly use integer operations as dot() only works on floats. 4069 int index = row * `+pn[1]+" + col + "+we+`; 4070 vec2 uv = uvFromFlat(`+le+", "+de+`, index); 4071 return sampleTexture(`+_n+`, uv); 4072 } 4073`}(Kt);case 3:return function(bn){var pn=bn.shapeInfo.logicalShape,_n=bn.name,On="get"+_n.charAt(0).toUpperCase()+_n.slice(1),_=pn[1]*pn[2],m=pn[2],f=sn(pn),y=f.newShape,E=f.keptDims,z=y;if(z.length<pn.length){var Y=lr(bn,z);return` 4074 `+Pt(Y)+` 4075 float `+On+`(int row, int col, int depth) { 4076 return `+On+"("+dr(["row","col","depth"],E)+`); 4077 } 4078 `}if(bn.shapeInfo.isUniform)return` 4079 float `+On+`(int row, int col, int depth) { 4080 int index = round(dot(vec3(row, col, depth), 4081 vec3(`+_+", "+m+`, 1))); 4082 `+Jn(bn)+` 4083 } 4084 `;var Z=bn.shapeInfo.texShape,le=Z[0],de=Z[1],we=bn.shapeInfo.flatOffset;if(de===_&&we==null)return` 4085 float `+On+`(int row, int col, int depth) { 4086 float texR = float(row); 4087 float texC = dot(vec2(col, depth), vec2(`+m+`, 1)); 4088 vec2 uv = (vec2(texC, texR) + halfCR) / 4089 vec2(`+de+".0, "+le+`.0); 4090 return sampleTexture(`+_n+`, uv); 4091 } 4092 `;if(de===m&&we==null)return` 4093 float `+On+`(int row, int col, int depth) { 4094 float texR = dot(vec2(row, col), vec2(`+pn[1]+`, 1)); 4095 float texC = float(depth); 4096 vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+de+".0, "+le+`.0); 4097 return sampleTexture(`+_n+`, uv); 4098 } 4099 `;var De=zn(_n);return` 4100 float `+On+`(int row, int col, int depth) { 4101 // Explicitly use integer operations as dot() only works on floats. 4102 int index = row * `+_+" + col * "+m+" + depth + "+De+`; 4103 vec2 uv = uvFromFlat(`+le+", "+de+`, index); 4104 return sampleTexture(`+_n+`, uv); 4105 } 4106 `}(Kt);case 4:return function(bn){var pn=bn.shapeInfo.logicalShape,_n=bn.name,On="get"+_n.charAt(0).toUpperCase()+_n.slice(1),_=pn[3],m=pn[2]*_,f=pn[1]*m,y=sn(pn),E=y.newShape,z=y.keptDims;if(E.length<pn.length){var Y=lr(bn,E);return` 4107 `+Pt(Y)+` 4108 float `+On+`(int row, int col, int depth, int depth2) { 4109 return `+On+"("+dr(["row","col","depth","depth2"],z)+`); 4110 } 4111 `}if(bn.shapeInfo.isUniform)return` 4112 float `+On+`(int row, int col, int depth, int depth2) { 4113 int index = round(dot(vec4(row, col, depth, depth2), 4114 vec4(`+f+", "+m+", "+_+`, 1))); 4115 `+Jn(bn)+` 4116 } 4117 `;var Z=bn.shapeInfo.flatOffset,le=bn.shapeInfo.texShape,de=le[0],we=le[1];if(we===f&&Z==null)return` 4118 float `+On+`(int row, int col, int depth, int depth2) { 4119 float texR = float(row); 4120 float texC = 4121 dot(vec3(col, depth, depth2), 4122 vec3(`+m+", "+_+`, 1)); 4123 vec2 uv = (vec2(texC, texR) + halfCR) / 4124 vec2(`+we+".0, "+de+`.0); 4125 return sampleTexture(`+_n+`, uv); 4126 } 4127 `;if(we===_&&Z==null)return` 4128 float `+On+`(int row, int col, int depth, int depth2) {
4129 float texR = dot(vec3(row, col, depth), 4130 vec3(`+pn[1]*pn[2]+", "+pn[2]+`, 1)); 4131 float texC = float(depth2); 4132 vec2 uv = (vec2(texC, texR) + halfCR) / 4133 vec2(`+we+".0, "+de+`.0); 4134 return sampleTexture(`+_n+`, uv); 4135 } 4136 `;var De=zn(_n);return` 4137 float `+On+`(int row, int col, int depth, int depth2) { 4138 // Explicitly use integer operations as dot() only works on floats. 4139 int index = row * `+f+" + col * "+m+` + 4140 depth * `+_+` + depth2; 4141 vec2 uv = uvFromFlat(`+de+", "+we+", index + "+De+`); 4142 return sampleTexture(`+_n+`, uv); 4143 } 4144 `}(Kt);case 5:return function(bn){var pn=bn.shapeInfo.logicalShape,_n=bn.name,On="get"+_n.charAt(0).toUpperCase()+_n.slice(1),_=pn[4],m=pn[3]*_,f=pn[2]*m,y=pn[1]*f,E=sn(pn),z=E.newShape,Y=E.keptDims;if(z.length<pn.length){var Z=lr(bn,z);return` 4145 `+Pt(Z)+` 4146 float `+On+`(int row, int col, int depth, int depth2, int depth3) { 4147 return `+On+"("+dr(["row","col","depth","depth2","depth3"],Y)+`); 4148 } 4149 `}if(bn.shapeInfo.isUniform)return` 4150 float `+On+`(int row, int col, int depth, int depth2, int depth3) { 4151 float index = dot( 4152 vec4(row, col, depth, depth2), 4153 vec4(`+y+", "+f+", "+m+", "+_+`)) + 4154 depth3; 4155 `+Jn(bn)+` 4156 } 4157 `;var le=bn.shapeInfo.flatOffset,de=bn.shapeInfo.texShape,we=de[0],De=de[1];if(De===y&&le==null)return` 4158 float `+On+`(int row, int col, int depth, int depth2, int depth3) { 4159 int texR = row; 4160 float texC = dot(vec4(col, depth, depth2, depth3), 4161 vec4(`+f+", "+m+", "+_+`, 1)); 4162 vec2 uv = (vec2(texC, texR) + halfCR) / 4163 vec2(`+De+".0, "+we+`.0); 4164 return sampleTexture(`+_n+`, uv); 4165 } 4166 `;if(De===_&&le==null)return` 4167 float `+On+`(int row, int col, int depth, int depth2, int depth3) { 4168 float texR = dot( 4169 vec4(row, col, depth, depth2), 4170 vec4(`+pn[1]*pn[2]*pn[3]+`, 4171 `+pn[2]*pn[3]+", "+pn[3]+`, 1)); 4172 int texC = depth3; 4173 vec2 uv = (vec2(texC, texR) + halfCR) / 4174 vec2(`+De+".0, "+we+`.0); 4175 return sampleTexture(`+_n+`, uv); 4176 } 4177 `;var Ne=zn(_n);return` 4178 float `+On+`(int row, int col, int depth, int depth2, int depth3) { 4179 // Explicitly use integer operations as dot() only works on floats. 4180 int index = row * `+y+" + col * "+f+" + depth * "+m+` + 4181 depth2 * `+_+" + depth3 + "+Ne+`; 4182 vec2 uv = uvFromFlat(`+we+", "+De+`, index); 4183 return sampleTexture(`+_n+`, uv); 4184 } 4185 `}(Kt);case 6:return function(bn){var pn=bn.shapeInfo.logicalShape,_n=bn.name,On="get"+_n.charAt(0).toUpperCase()+_n.slice(1),_=sn(pn),m=_.newShape,f=_.keptDims;if(m.length<pn.length){var y=lr(bn,m);return` 4186 `+Pt(y)+` 4187 float `+On+`(int row, int col, int depth, 4188 int depth2, int depth3, int depth4) { 4189 return `+On+"("+dr(["row","col","depth","depth2","depth3","depth4"],f)+`); 4190 } 4191 `}var E=pn[5],z=pn[4]*E,Y=pn[3]*z,Z=pn[2]*Y,le=pn[1]*Z;if(bn.shapeInfo.isUniform)return` 4192 float `+On+`(int row, int col, int depth, 4193 int depth2, int depth3, int depth4) { 4194 int index = round(dot( 4195 vec4(row, col, depth, depth2), 4196 vec4(`+le+", "+Z+", "+Y+", "+z+`)) + 4197 dot( 4198 vec2(depth3, depth4), 4199 vec2(`+E+`, 1))); 4200 `+Jn(bn)+` 4201 } 4202 `;var de=bn.shapeInfo.flatOffset,we=bn.shapeInfo.texShape,De=we[0],Ne=we[1];if(Ne===le&&de==null)return` 4203 float `+On+`(int row, int col, int depth, 4204 int depth2, int depth3, int depth4) { 4205 int texR = row; 4206 float texC = dot(vec4(col, depth, depth2, depth3), 4207 vec4(`+Z+", "+Y+", "+z+", "+E+`)) + 4208 float(depth4); 4209 vec2 uv = (vec2(texC, texR) + halfCR) / 4210 vec2(`+Ne+".0, "+De+`.0); 4211 return sampleTexture(`+_n+`, uv); 4212 } 4213 `;if(Ne===E&&de==null)return` 4214 float `+On+`(int row, int col, int depth, 4215 int depth2, int depth3, int depth4) {
4216 float texR = dot(vec4(row, col, depth, depth2), 4217 vec4(`+pn[1]*pn[2]*pn[3]*pn[4]+`, 4218 `+pn[2]*pn[3]*pn[4]+`, 4219 `+pn[3]*pn[4]+`, 4220 `+pn[4]+`)) + float(depth3); 4221 int texC = depth4; 4222 vec2 uv = (vec2(texC, texR) + halfCR) / 4223 vec2(`+Ne+".0, "+De+`.0); 4224 return sampleTexture(`+_n+`, uv); 4225 } 4226 `;var Fe=zn(_n);return` 4227 float `+On+`(int row, int col, int depth, 4228 int depth2, int depth3, int depth4) { 4229 // Explicitly use integer operations as dot() only works on floats. 4230 int index = row * `+le+" + col * "+Z+" + depth * "+Y+` + 4231 depth2 * `+z+" + depth3 * "+E+" + depth4 + "+Fe+`; 4232 vec2 uv = uvFromFlat(`+De+", "+Ne+`, index); 4233 return sampleTexture(`+_n+`, uv); 4234 } 4235 `}(Kt);default:throw new Error(dn.length+"-D input sampling is not yet supported")}}(Ge);var Nt=Ge.shapeInfo.logicalShape,Rt=rt.logicalShape;return Nt.length<=Rt.length&&(lt+=nt?function(Pt,Kt){var dn,bn=Pt.name,pn=bn.charAt(0).toUpperCase()+bn.slice(1),_n="get"+pn+"AtOutCoords",On=Pt.shapeInfo.logicalShape.length,_=Kt.logicalShape.length,m=js(Pt.shapeInfo.logicalShape,Kt.logicalShape),f=Vn(_),y=_-On,E=["x","y","z","w","u","v"];dn=On===0?"":_<2&&m.length>=1?"coords = 0;":m.map(function(De){return"coords."+E[De+y]+" = 0;"}).join(` 4236`);var z;z=_<2&&On>0?"coords":Pt.shapeInfo.logicalShape.map(function(De,Ne){return"coords."+E[Ne+y]}).join(", ");var Y="return outputValue;",Z=Ke(Pt.shapeInfo.logicalShape)===1,le=Ke(Kt.logicalShape)===1;if(On!==1||Z||le){if(Z&&!le)Y=_===1?` 4237 return vec4(outputValue.x, outputValue.x, 0., 0.); 4238 `:` 4239 return vec4(outputValue.x); 4240 `;else if(m.length){var de=On-2,we=On-1;m.indexOf(de)>-1&&m.indexOf(we)>-1?Y="return vec4(outputValue.x);":m.indexOf(de)>-1?Y="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":m.indexOf(we)>-1&&(Y="return vec4(outputValue.xx, outputValue.zz);")}}else Y=` 4241 return vec4(outputValue.xy, outputValue.xy); 4242 `;return` 4243 vec4 `+_n+`() { 4244 `+f+` coords = getOutputCoords(); 4245 `+dn+` 4246 vec4 outputValue = get`+pn+"("+z+`); 4247 `+Y+` 4248 } 4249 `}(Ge,rt):function(Pt,Kt){var dn=Pt.name,bn=dn.charAt(0).toUpperCase()+dn.slice(1),pn="get"+bn+"AtOutCoords",_n=Kt.texShape,On=Pt.shapeInfo.texShape,_=Pt.shapeInfo.logicalShape.length,m=Kt.logicalShape.length;if(!Pt.shapeInfo.isUniform&&_===m&&Pt.shapeInfo.flatOffset==null&&Tt(On,_n))return` 4250 float `+pn+`() { 4251 return sampleTexture(`+dn+`, resultUV); 4252 } 4253 `;var f=Vn(m),y=js(Pt.shapeInfo.logicalShape,Kt.logicalShape),E=m-_,z=["x","y","z","w","u","v"];return` 4254 float `+pn+`() { 4255 `+f+` coords = getOutputCoords(); 4256 `+(_===0?"":m<2&&y.length>=1?"coords = 0;":y.map(function(Y){return"coords."+z[Y+E]+" = 0;"}).join(` 4257`))+` 4258 return get`+bn+"("+(m<2&&_>0?"coords":Pt.shapeInfo.logicalShape.map(function(Y,Z){return"coords."+z[Z+E]}).join(", "))+`); 4259 } 4260 `}(Ge,rt)),lt}(je,x,w)}).join(` 4261`),ye=x.texShape,Oe=ue(),Re=` 4262 float sampleTexture(sampler2D textureSampler, vec2 uv) { 4263 return `+Oe.texture2D+`(textureSampler, uv).r; 4264 } 4265 `,Pe=function(je){return je.version+` 4266 precision highp float; 4267 precision highp int; 4268 precision highp sampler2D; 4269 `+je.varyingFs+` vec2 resultUV; 4270 `+je.defineOutput+` 4271 const vec2 halfCR = vec2(0.5, 0.5); 4272 4273 struct ivec5 4274 { 4275 int x; 4276 int y; 4277 int z; 4278 int w; 4279 int u; 4280 }; 4281 4282 struct ivec6 4283 { 4284 int x; 4285 int y; 4286 int z; 4287 int w; 4288 int u; 4289 int v; 4290 }; 4291 4292 uniform float NAN; 4293 `+je.defineSpecialNaN+` 4294 `+je.defineSpecialInf+` 4295 `+je.defineRound+` 4296 4297 int imod(int x, int y) { 4298 return x - y * (x / y); 4299 } 4300 4301 int idiv(int a, int b, float sign) { 4302 int res = a / b; 4303 int mod = imod(a, b); 4304 if (sign < 0. && mod != 0) { 4305 res -= 1; 4306 } 4307 return res; 4308 } 4309 4310 //Based on the work of Dave Hoskins 4311 //https://www.shadertoy.com/view/4djSRW 4312 #define HASHSCALE1 443.8975 4313 float random(float seed){ 4314 vec2 p = resultUV * seed; 4315 vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1); 4316 p3 += dot(p3, p3.yzx + 19.19); 4317 return fract((p3.x + p3.y) * p3.z); 4318 } 4319 4320 `+en+` 4321 `+gt+` 4322 `+Tn+` 4323 `}(Oe);return x.isPacked?(W=function(je,Ge){switch(je.length){case 0:return` 4324 int getOutputCoords() { 4325 return 0; 4326 } 4327 `;case 1:return function(Pt,Kt){var dn=[Math.ceil(Kt[0]/2),Math.ceil(Kt[1]/2)];return dn[0]===1?` 4328 int getOutputCoords() { 4329 return 2 * int(resultUV.x * `+dn[1]+`.0); 4330 } 4331 `:dn[1]===1?` 4332 int getOutputCoords() { 4333 return 2 * int(resultUV.y * `+dn[0]+`.0); 4334 } 4335 `:` 4336 int getOutputCoords() {
4337 ivec2 resTexRC = ivec2(resultUV.yx * 4338 vec2(`+dn[0]+", "+dn[1]+`)); 4339 return 2 * (resTexRC.x * `+dn[1]+` + resTexRC.y); 4340 } 4341 `}(0,Ge);case 2:return function(Pt,Kt){var dn=[Math.ceil(Kt[0]/2),Math.ceil(Kt[1]/2)];if(Tt(Pt,Kt))return` 4342 ivec2 getOutputCoords() { 4343 return 2 * ivec2(resultUV.yx * vec2(`+dn[0]+", "+dn[1]+`)); 4344 } 4345 `;var bn=Math.ceil(Pt[1]/2);return` 4346 ivec2 getOutputCoords() { 4347 ivec2 resTexRC = ivec2(resultUV.yx * 4348 vec2(`+dn[0]+", "+dn[1]+`)); 4349 4350 int index = resTexRC.x * `+dn[1]+` + resTexRC.y; 4351 int r = 2 * (index / `+bn+`); 4352 int c = imod(index, `+bn+`) * 2; 4353 4354 return ivec2(r, c); 4355 } 4356 `}(je,Ge);case 3:return rt=je,nt=Ge,lt=[Math.ceil(nt[0]/2),Math.ceil(nt[1]/2)],Rt=(Nt=Math.ceil(rt[2]/2))*Math.ceil(rt[1]/2),` 4357 ivec3 getOutputCoords() { 4358 ivec2 resTexRC = ivec2(resultUV.yx * 4359 vec2(`+lt[0]+", "+lt[1]+`)); 4360 int index = resTexRC.x * `+lt[1]+` + resTexRC.y; 4361 4362 int b = index / `+Rt+`; 4363 index -= b * `+Rt+`; 4364 4365 int r = 2 * (index / `+Nt+`); 4366 int c = imod(index, `+Nt+`) * 2; 4367 4368 return ivec3(b, r, c); 4369 } 4370 `;default:return function(Pt,Kt){for(var dn=[Math.ceil(Kt[0]/2),Math.ceil(Kt[1]/2)],bn=Math.ceil(Pt[Pt.length-1]/2),pn=bn*Math.ceil(Pt[Pt.length-2]/2),_n=pn,On="",_="b, r, c",m=2;m<Pt.length-1;m++)On=` 4371 int b`+m+" = index / "+(_n*=Pt[Pt.length-m-1])+`; 4372 index -= b`+m+" * "+_n+`; 4373 `+On,_="b"+m+", "+_;return` 4374 ivec`+Pt.length+` getOutputCoords() { 4375 ivec2 resTexRC = ivec2(resultUV.yx * 4376 vec2(`+dn[0]+", "+dn[1]+`)); 4377 int index = resTexRC.x * `+dn[1]+` + resTexRC.y; 4378 4379 `+On+` 4380 4381 int b = index / `+pn+`; 4382 index -= b * `+pn+`; 4383 4384 int r = 2 * (index / `+bn+`); 4385 int c = imod(index, `+bn+`) * 2; 4386 4387 return ivec`+Pt.length+"("+_+`); 4388 } 4389 `}(je,Ge)}var rt,nt,lt,Nt,Rt}(x.logicalShape,ye),Q=` 4390 void setOutput(vec4 val) { 4391 `+Oe.output+` = val; 4392 } 4393 `):(W=function(je,Ge){switch(je.length){case 0:return` 4394 int getOutputCoords() { 4395 return 0; 4396 } 4397 `;case 1:return function(lt,Nt){return Nt[0]===1?` 4398 int getOutputCoords() { 4399 return int(resultUV.x * `+Nt[1]+`.0); 4400 } 4401 `:Nt[1]===1?` 4402 int getOutputCoords() { 4403 return int(resultUV.y * `+Nt[0]+`.0); 4404 } 4405 `:` 4406 int getOutputCoords() { 4407 ivec2 resTexRC = ivec2(resultUV.yx * 4408 vec2(`+Nt[0]+", "+Nt[1]+`)); 4409 return resTexRC.x * `+Nt[1]+` + resTexRC.y; 4410 } 4411 `}(0,Ge);case 2:return function(lt,Nt){return Tt(lt,Nt)?` 4412 ivec2 getOutputCoords() { 4413 return ivec2(resultUV.yx * vec2(`+Nt[0]+", "+Nt[1]+`)); 4414 } 4415 `:lt[1]===1?` 4416 ivec2 getOutputCoords() { 4417 ivec2 resTexRC = ivec2(resultUV.yx * 4418 vec2(`+Nt[0]+", "+Nt[1]+`)); 4419 int index = resTexRC.x * `+Nt[1]+` + resTexRC.y; 4420 return ivec2(index, 0); 4421 } 4422 `:lt[0]===1?` 4423 ivec2 getOutputCoords() { 4424 ivec2 resTexRC = ivec2(resultUV.yx * 4425 vec2(`+Nt[0]+", "+Nt[1]+`)); 4426 int index = resTexRC.x * `+Nt[1]+` + resTexRC.y; 4427 return ivec2(0, index); 4428 } 4429 `:` 4430 ivec2 getOutputCoords() { 4431 ivec2 resTexRC = ivec2(resultUV.yx * 4432 vec2(`+Nt[0]+", "+Nt[1]+`)); 4433 int index = resTexRC.x * `+Nt[1]+` + resTexRC.y; 4434 int r = index / `+lt[1]+`; 4435 int c = index - r * `+lt[1]+`; 4436 return ivec2(r, c); 4437 } 4438 `}(je,Ge);case 3:return rt=Ge,nt=Le(["r","c","d"],je),` 4439 ivec3 getOutputCoords() { 4440 ivec2 resTexRC = ivec2(resultUV.yx * 4441 vec2(`+rt[0]+", "+rt[1]+`)); 4442 int index = resTexRC.x * `+rt[1]+` + resTexRC.y; 4443 `+nt+` 4444 return ivec3(r, c, d); 4445 } 4446 `;case 4:return function(lt,Nt){var Rt=Le(["r","c","d","d2"],lt);return` 4447 ivec4 getOutputCoords() { 4448 ivec2 resTexRC = ivec2(resultUV.yx * 4449 vec2(`+Nt[0]+", "+Nt[1]+`)); 4450 int index = resTexRC.x * `+Nt[1]+` + resTexRC.y; 4451 `+Rt+` 4452 return ivec4(r, c, d, d2); 4453 } 4454 `}(je,Ge);case 5:return function(lt,Nt){var Rt=Le(["r","c","d","d2","d3"],lt);return` 4455 ivec5 getOutputCoords() {
4456 ivec2 resTexRC = ivec2(resultUV.yx * vec2(`+Nt[0]+`, 4457 `+Nt[1]+`)); 4458 4459 int index = resTexRC.x * `+Nt[1]+` + resTexRC.y; 4460 4461 `+Rt+` 4462 4463 ivec5 outShape = ivec5(r, c, d, d2, d3); 4464 return outShape; 4465 } 4466 `}(je,Ge);case 6:return function(lt,Nt){var Rt=Le(["r","c","d","d2","d3","d4"],lt);return` 4467 ivec6 getOutputCoords() { 4468 ivec2 resTexRC = ivec2(resultUV.yx * 4469 vec2(`+Nt[0]+", "+Nt[1]+`)); 4470 int index = resTexRC.x * `+Nt[1]+` + resTexRC.y; 4471 4472 `+Rt+` 4473 4474 ivec6 result = ivec6(r, c, d, d2, d3, d4); 4475 return result; 4476 } 4477 `}(je,Ge);default:throw new Error(je.length+"-D output sampling is not yet supported")}var rt,nt}(x.logicalShape,ye),Q=` 4478 void setOutput(float val) { 4479 `+Oe.output+` = vec4(val, 0, 0, 0); 4480 } 4481 `),w&&(Pe+=Pn),[Pe,Re,Q,ie,W,fe,p].join(` 4482`)}var en=` 4483vec2 uvFromFlat(int texNumR, int texNumC, int index) { 4484 int texR = index / texNumC; 4485 int texC = index - texR * texNumC; 4486 return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); 4487} 4488vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { 4489 int texelIndex = index / 2; 4490 int texR = texelIndex / texNumC; 4491 int texC = texelIndex - texR * texNumC; 4492 return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); 4493} 4494`,gt=` 4495vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR, 4496 int texNumC, int row, int col) { 4497 int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); 4498 int texR = texelIndex / texNumC; 4499 int texC = texelIndex - texR * texNumC; 4500 return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); 4501} 4502`,Tn=` 4503vec2 packedUVfrom3D(int texNumR, int texNumC, 4504 int texelsInBatch, int texelsInLogicalRow, int b, 4505 int row, int col) { 4506 int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2); 4507 int texR = index / texNumC; 4508 int texC = index - texR * texNumC; 4509 return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); 4510} 4511`,Pn=` 4512 float getChannel(vec4 frag, vec2 innerDims) { 4513 vec2 modCoord = mod(innerDims, 2.); 4514 return modCoord.x == 0. ? 4515 (modCoord.y == 0. ? frag.r : frag.g) : 4516 (modCoord.y == 0. ? frag.b : frag.a); 4517 } 4518 float getChannel(vec4 frag, int dim) { 4519 float modCoord = mod(float(dim), 2.); 4520 return modCoord == 0. ? frag.r : frag.g; 4521 } 4522`;function zn(C){return"offset"+C}function Jn(C){var x=C.name,p=Ke(C.shapeInfo.logicalShape);return p<2?"return "+x+";":` 4523 for (int i = 0; i < `+p+`; i++) { 4524 if (i == index) { 4525 return `+x+`[i]; 4526 } 4527 } 4528 `}function Vn(C){if(C<=1)return"int";if(C===2)return"ivec2";if(C===3)return"ivec3";if(C===4)return"ivec4";if(C===5)return"ivec5";if(C===6)return"ivec6";throw Error("GPU for rank "+C+" is not yet supported")}function lr(C,x){var p=JSON.parse(JSON.stringify(C));return p.shapeInfo.logicalShape=x,p}function dr(C,x){return x.map(function(p){return C[p]}).join(", ")}var Tr=function(C,x,p){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=ho(x,p),this.userCode=` 4529 float binaryOpComplex( 4530 float areal, float aimag, float breal, float bimag) { 4531 `+C+` 4532 } 4533 4534 void main() { 4535 float areal = getARealAtOutCoords(); 4536 float aimag = getAImagAtOutCoords(); 4537 float breal = getBRealAtOutCoords(); 4538 float bimag = getBImagAtOutCoords(); 4539 setOutput(binaryOpComplex(areal, aimag, breal, bimag)); 4540 } 4541 `},Hr="return a + b;",oi="return a - b;",Br="return a * b;",ui="return (a < 0.) ? b * a : a;",ii=function(C,x,p){this.variableNames=["A","B"],this.outputShape=ho(x,p),this.userCode=` 4542 float binaryOperation(float a, float b) { 4543 `+C+` 4544 } 4545 4546 void main() { 4547 float a = getAAtOutCoords(); 4548 float b = getBAtOutCoords(); 4549 setOutput(binaryOperation(a, b)); 4550 } 4551 `},Ci=` 4552 vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
4553 return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a); 4554`,Di=function(C,x,p,w){w===void 0&&(w=!1),this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=ho(x,p);var D=this.outputShape.length,W="";if(w)if(D===0||Ke(this.outputShape)===1)W=` 4555 result.y = 0.; 4556 result.z = 0.; 4557 result.w = 0.; 4558 `;else if(W=` 4559 `+Vn(D)+` coords = getOutputCoords(); 4560 `,D===1)W+=` 4561 result.y = (coords + 1) >= `+this.outputShape[0]+` ? 0. : result.y; 4562 result.z = 0.; 4563 result.w = 0.; 4564 `;else{var Q=H("coords",D);W+=` 4565 bool nextRowOutOfBounds = 4566 (`+Q[D-2]+" + 1) >= "+this.outputShape[D-2]+`; 4567 bool nextColOutOfBounds = 4568 (`+Q[D-1]+" + 1) >= "+this.outputShape[D-1]+`; 4569 result.y = nextColOutOfBounds ? 0. : result.y; 4570 result.z = nextRowOutOfBounds ? 0. : result.z; 4571 result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w; 4572 `}this.userCode=` 4573 vec4 binaryOperation(vec4 a, vec4 b) { 4574 `+C+` 4575 } 4576 4577 void main() { 4578 vec4 a = getAAtOutCoords(); 4579 vec4 b = getBAtOutCoords(); 4580 4581 vec4 result = binaryOperation(a, b); 4582 `+W+` 4583 4584 setOutput(result); 4585 } 4586 `},si=function(){function C(x){this.variableNames=["A"],this.outputShape=x,this.userCode=` 4587 uniform float minVal; 4588 uniform float maxVal; 4589 4590 void main() { 4591 float value = getAAtOutCoords(); 4592 if (isnan(value)) { 4593 setOutput(value); 4594 return; 4595 } 4596 4597 setOutput(clamp(value, minVal, maxVal)); 4598 } 4599 `}return C.prototype.getCustomSetupFunc=function(x,p){var w=this;return function(D,W){w.minLoc==null&&(w.minLoc=D.getUniformLocationNoThrow(W,"minVal"),w.maxLoc=D.getUniformLocationNoThrow(W,"maxVal")),D.gl.uniform1f(w.minLoc,x),D.gl.uniform1f(w.maxLoc,p)}},C}(),wi=function(){function C(x){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=x,this.userCode=` 4600 uniform float minVal; 4601 uniform float maxVal; 4602 4603 void main() { 4604 vec4 value = getAAtOutCoords(); 4605 4606 if (any(isnan(value))) { 4607 setOutput(value); 4608 return; 4609 } 4610 4611 setOutput(clamp(value, vec4(minVal), vec4(maxVal))); 4612 } 4613 `}return C.prototype.getCustomSetupFunc=function(x,p){var w=this;return function(D,W){w.minLoc==null&&(w.minLoc=D.getUniformLocationNoThrow(W,"minVal"),w.maxLoc=D.getUniformLocationNoThrow(W,"maxVal")),D.gl.uniform1f(w.minLoc,x),D.gl.uniform1f(w.maxLoc,p)}},C}();function Co(C,x,p){var w=C.indexOf(x);return C.map(function(D,W){return W===w?D+" - "+p:D}).join()}var _o=function(C,x,p,w){x===void 0&&(x=!1),p===void 0&&(p=null),w===void 0&&(w=!1),this.variableNames=["x","W"],this.outputShape=C.outShape;var D=C.padInfo.top,W=C.padInfo.left,Q=C.strideHeight,ie=C.strideWidth,fe=C.dilationHeight,ye=C.dilationWidth,Oe=C.filterHeight,Re=C.filterWidth,Pe=4*Math.floor(C.inChannels/4),je=C.inChannels%4,Ge=C.dataFormat==="channelsLast",rt=Ge?1:2,nt=Ge?2:3,lt=Ge?3:1,Nt="",Rt="";p&&(Nt=w?`float activation(float a) { 4614 float b = getPreluActivationWeightsAtOutCoords(); 4615 `+p+` 4616 }`:` 4617 float activation(float x) { 4618 `+p+` 4619 } 4620 `,Rt="result = activation(result);");var Pt=x?"result += getBiasAtOutCoords();":"";x&&this.variableNames.push("bias"),w&&this.variableNames.push("preluActivationWeights"),this.userCode=` 4621 `+Nt+` 4622 4623 const ivec2 strides = ivec2(`+Q+", "+ie+`); 4624 const ivec2 pads = ivec2(`+D+", "+W+`); 4625 4626 void main() { 4627 ivec4 coords = getOutputCoords(); 4628 int batch = coords[0]; 4629 int d2 = coords[`+lt+`]; 4630 4631 ivec2 xRCCorner = 4632 ivec2(coords[`+rt+"], coords["+nt+`]) * strides - pads; 4633 int xRCorner = xRCCorner.x; 4634 int xCCorner = xRCCorner.y; 4635 4636 // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2). 4637 // ? = to be determined. : = across all values in that axis. 4638 float dotProd = 0.0; 4639 for (int wR = 0; wR < `+Oe+`; wR++) { 4640 int xR = xRCorner + wR * `+fe+`; 4641 4642 if (xR < 0 || xR >= `+C.inHeight+`) { 4643 continue; 4644 } 4645 4646 for (int wC = 0; wC < `+Re+`; wC++) { 4647 int xC = xCCorner + wC * `+ye+`; 4648 4649 if (xC < 0 || xC >= `+C.inWidth+`) { 4650 continue; 4651 } 4652 4653 for (int d1 = 0; d1 < `+Pe+`; d1 += 4) { 4654 vec4 wValues = vec4( 4655 getW(wR, wC, d1, d2), 4656 getW(wR, wC, d1 + 1, d2), 4657 getW(wR, wC, d1 + 2, d2), 4658 getW(wR, wC, d1 + 3, d2) 4659 ); 4660 4661 if (`+Ge+`) { 4662 vec4 xValues = vec4( 4663 getX(batch, xR, xC, d1), 4664 getX(batch, xR, xC, d1 + 1), 4665 getX(batch, xR, xC, d1 + 2), 4666 getX(batch, xR, xC, d1 + 3) 4667 ); 4668 dotProd += dot(xValues, wValues); 4669 } else { 4670 vec4 xValues = vec4( 4671 getX(batch, d1, xR, xC), 4672 getX(batch, d1 + 1, xR, xC), 4673 getX(batch, d1 + 2, xR, xC), 4674 getX(batch, d1 + 3, xR, xC) 4675 ); 4676 dotProd += dot(xValues, wValues); 4677 } 4678 } 4679 4680 if (`+(je===1)+`) { 4681 4682 if (`+Ge+`) { 4683 dotProd += 4684 getX(batch, xR, xC, `+Pe+`) * 4685 getW(wR, wC, `+Pe+`, d2); 4686 } else { 4687 dotProd += 4688 getX(batch, `+Pe+`, xR, xC) * 4689 getW(wR, wC, `+Pe+`, d2); 4690 } 4691 4692 } else if (`+(je===2)+`) { 4693 vec2 wValues = vec2( 4694 getW(wR, wC, `+Pe+`, d2), 4695 getW(wR, wC, `+Pe+` + 1, d2) 4696 ); 4697 4698 if (`+Ge+`) { 4699 vec2 xValues = vec2( 4700 getX(batch, xR, xC, `+Pe+`), 4701 getX(batch, xR, xC, `+Pe+` + 1) 4702 ); 4703 dotProd += dot(xValues, wValues); 4704 } else { 4705 vec2 xValues = vec2( 4706 getX(batch, `+Pe+`, xR, xC), 4707 getX(batch, `+Pe+` + 1, xR, xC) 4708 ); 4709 dotProd += dot(xValues, wValues); 4710 } 4711 4712 } else if (`+(je===3)+`) { 4713 vec3 wValues = vec3( 4714 getW(wR, wC, `+Pe+`, d2), 4715 getW(wR, wC, `+Pe+` + 1, d2), 4716 getW(wR, wC, `+Pe+` + 2, d2) 4717 ); 4718 4719 if (`+Ge+`) { 4720 vec3 xValues = vec3( 4721 getX(batch, xR, xC, `+Pe+`), 4722 getX(batch, xR, xC, `+Pe+` + 1), 4723 getX(batch, xR, xC, `+Pe+` + 2) 4724 ); 4725 dotProd += dot(xValues, wValues); 4726 } else { 4727 vec3 xValues = vec3( 4728 getX(batch, `+Pe+`, xR, xC), 4729 getX(batch, `+Pe+` + 1, xR, xC), 4730 getX(batch, `+Pe+` + 2, xR, xC) 4731 ); 4732 dotProd += dot(xValues, wValues); 4733 } 4734 4735 } 4736 } 4737 } 4738 4739 float result = dotProd; 4740 `+Pt+` 4741 `+Rt+` 4742 setOutput(result); 4743 } 4744 `},ba=function(C,x,p,w){x===void 0&&(x=!1),p===void 0&&(p=null),w===void 0&&(w=!1),this.variableNames=["x","W"],this.outputShape=C.outShape;var D=C.inHeight,W=C.inWidth,Q=C.padInfo.top,ie=C.padInfo.left,fe=C.strideHeight,ye=C.strideWidth,Oe=C.dilationHeight,Re=C.dilationWidth,Pe=C.filterHeight,je=C.filterWidth,Ge=C.outChannels/C.inChannels,rt="",nt="";p&&(rt=w?`float activation(float a) { 4745 float b = getPreluActivationWeightsAtOutCoords(); 4746 `+p+` 4747 }`:` 4748 float activation(float x) { 4749 `+p+` 4750 } 4751 `,nt="result = activation(result);");var lt=x?"result += getBiasAtOutCoords();":"";x&&this.variableNames.push("bias"),w&&this.variableNames.push("preluActivationWeights"),this.userCode=` 4752 `+rt+` 4753 4754 const ivec2 strides = ivec2(`+fe+", "+ye+`); 4755 const ivec2 pads = ivec2(`+Q+", "+ie+`); 4756 4757 void main() { 4758 ivec4 coords = getOutputCoords(); 4759 int batch = coords.x; 4760 ivec2 xRCCorner = coords.yz * strides - pads; 4761 int d2 = coords.w; 4762 int d1 = d2 / `+Ge+`; 4763 int q = d2 - d1 * `+Ge+`; 4764 4765 int xRCorner = xRCCorner.x; 4766 int xCCorner = xRCCorner.y; 4767 4768 // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2). 4769 // ? = to be determined. : = across all values in that axis. 4770 float dotProd = 0.0; 4771 // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations. 4772 for (int wR = 0; wR < `+Pe+`; wR++) { 4773 int xR = xRCorner + wR * `+Oe+`; 4774 4775 if (xR < 0 || xR >= `+D+`) { 4776 continue; 4777 } 4778 4779 for (int wC = 0; wC < `+je+`; wC++) { 4780 int xC = xCCorner + wC * `+Re+`; 4781 4782 if (xC < 0 || xC >= `+W+`) { 4783 continue; 4784 } 4785 4786 float xVal = getX(batch, xR, xC, d1); 4787 float wVal = getW(wR, wC, d1, q); 4788 dotProd += xVal * wVal; 4789 } 4790 } 4791 4792 float result = dotProd; 4793 `+lt+` 4794 `+nt+` 4795 setOutput(result); 4796 } 4797 `},ro=function(C,x,p,w){x===void 0&&(x=!1),p===void 0&&(p=null),w===void 0&&(w=!1),this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=C.outShape;for(var D=C.inHeight,W=C.inWidth,Q=C.padInfo.top,ie=C.padInfo.left,fe=C.strideHeight,ye=C.strideWidth,Oe=C.dilationHeight,Re=C.dilationWidth,Pe=C.filterHeight,je=C.filterWidth,Ge=je,rt="int xR; int xC; int xCOffset;",nt=0;nt<Pe;nt++)for(var lt=0;lt<je;lt++)rt+=` 4798 vec4 xTexelR`+nt+"C"+2*lt+` = vec4(0.); 4799 vec4 wR`+nt+"C"+lt+` = vec4(0.); 4800 vec4 xR`+nt+"C"+lt+" = vec4(0.);";for(nt=0;nt<Pe;nt++)for(var Nt=0;Nt<Ge;Nt++){if(rt+=` 4801 xR = xRCorner + `+nt*Oe+`; 4802 xC = xCCorner + `+(lt=2*Nt)*Re+`; 4803 `,ye===1){if(lt<je&&(rt+=ie%2==1?` 4804 xCOffset = xC + 1; 4805 if(xR >= 0 && xR < `+D+" && xCOffset >= 0 && xCOffset < "+W+`) { 4806 xTexelR`+nt+"C"+lt+` = getX(batch, xR, xCOffset, d1); 4807 4808 // Need to manually clear unused channels in case 4809 // we're reading from recycled texture. 4810 if(xCOffset + 1 >= `+W+`) { 4811 xTexelR`+nt+"C"+lt+`.zw = vec2(0.); 4812 } 4813 } else { 4814 xTexelR`+nt+"C"+lt+` = vec4(0.); 4815 } 4816 4817 xCOffset = xC + 1 - 2; 4818 if(xR >= 0 && xR < `+D+" && xCOffset >= 0 && xCOffset < "+W+`) { 4819 vec4 previous = getX(batch, xR, xCOffset, d1); 4820 4821 // Need to manually clear unused channels in case 4822 // we're reading from recycled texture. 4823 if(xCOffset + 1 >= `+W+`) { 4824 previous.zw = vec2(0.); 4825 } 4826 4827 xR`+nt+"C"+lt+" = vec4(previous.zw, xTexelR"+nt+"C"+lt+`.xy); 4828 } else { 4829 xR`+nt+"C"+lt+" = vec4(0, 0, xTexelR"+nt+"C"+lt+`.xy); 4830 } 4831 `:` 4832 if(xR >= 0 && xR < `+D+" && xC >= 0 && xC < "+W+`) { 4833 xTexelR`+nt+"C"+lt+` = getX(batch, xR, xC, d1); 4834 } else { 4835 xTexelR`+nt+"C"+lt+` = vec4(0.); 4836 } 4837 4838 xR`+nt+"C"+lt+" = xTexelR"+nt+"C"+lt+`; 4839 `,lt+1<je)){var Rt=ie%2==0?Dt(Re):Re;Re%2==0&&ie%2==1||Re%2!=0&&ie%2!=1?(rt+=` 4840 xCOffset = xC + `+ie%2+" + "+Rt+`; 4841 4842 if(xR >= 0 && xR < `+D+` && 4843 xCOffset >= 0 && xCOffset < `+W+`) { 4844 xTexelR`+nt+"C"+(lt+2)+` = getX(batch, xR, xCOffset, d1); 4845 } 4846 `,Re>1&&(rt+=` 4847 xCOffset -= 2; 4848 if(xR >= 0 && xR < `+D+` && 4849 xCOffset >= 0 && xCOffset < `+W+`) { 4850 xTexelR`+nt+"C"+lt+` = getX(batch, xR, xCOffset, d1); 4851 } else { 4852 xTexelR`+nt+"C"+lt+` = vec4(0.); 4853 } 4854 `),rt+=` 4855 xR`+nt+"C"+(lt+1)+` = vec4( 4856 xTexelR`+nt+"C"+lt+".zw, xTexelR"+nt+"C"+(lt+2)+`.xy); 4857 `):rt+=` 4858 xCOffset = xC + `+Rt+`; 4859 4860 if(xR >= 0 && xR < `+D+` && 4861 xCOffset >= 0 && xCOffset < `+W+`) { 4862 xTexelR`+nt+"C"+(lt+2)+` = getX(batch, xR, xCOffset, d1); 4863 } 4864 4865 xR`+nt+"C"+(lt+1)+" = xTexelR"+nt+"C"+(lt+2)+`; 4866 `}}else lt<je&&(rt+=` 4867 if(xR >= 0 && xR < `+D+`) { 4868 `,ie%2==1?(rt+=` 4869 xCOffset = xC + 1 - `+ye+`; 4870 if(xCOffset >= 0 && xCOffset < `+W+`) { 4871 xTexelR`+nt+"C"+lt+` = getX(batch, xR, xCOffset, d1); 4872 } else { 4873 xTexelR`+nt+"C"+lt+` = vec4(0.); 4874 } 4875 4876 if(xC + 1 >= 0 && xC + 1 < `+W+`) { 4877 xTexelR`+nt+"C"+(lt+2)+` = getX(batch, xR, xC + 1, d1); 4878 } else { 4879 xTexelR`+nt+"C"+(lt+2)+` = vec4(0.); 4880 } 4881 4882 xR`+nt+"C"+lt+` = vec4( 4883 xTexelR`+nt+"C"+lt+".zw, xTexelR"+nt+"C"+(lt+2)+`.zw); 4884 `,lt+1<je&&(rt+=` 4885 vec4 final = vec4(0.); 4886 xCOffset = xC + 1 + `+ye+`; 4887 if(xCOffset >= 0 && xCOffset < `+W+`) { 4888 final = getX(batch, xR, xCOffset, d1); 4889 } 4890 xR`+nt+"C"+(lt+1)+" = vec4(xTexelR"+nt+"C"+(lt+2)+`.xy, final.xy); 4891 `)):(rt+=` 4892 if(xC >= 0 && xC < `+W+`) { 4893 xTexelR`+nt+"C"+lt+` = getX(batch, xR, xC, d1); 4894 } else { 4895 xTexelR`+nt+"C"+lt+` = vec4(0.); 4896 } 4897 4898 xCOffset = xC + `+ye+`; 4899 if(xCOffset >= 0 && xCOffset < `+W+`) { 4900 xTexelR`+nt+"C"+(lt+2)+` = getX(batch, xR, xCOffset, d1); 4901 } else { 4902 xTexelR`+nt+"C"+(lt+2)+` = vec4(0.); 4903 } 4904 4905 xR`+nt+"C"+lt+` = vec4( 4906 xTexelR`+nt+"C"+lt+".xy, xTexelR"+nt+"C"+(lt+2)+`.xy); 4907 `,lt+1<je&&(rt+=` 4908 xR`+nt+"C"+(lt+1)+` = vec4( 4909 xTexelR`+nt+"C"+lt+".zw, xTexelR"+nt+"C"+(lt+2)+`.zw); 4910 `)),rt+="}");lt<je&&(rt+=` 4911 vec4 wTexelR`+nt+"C"+lt+" = getW("+nt+", "+lt+`, d1, q); 4912 wR`+nt+"C"+lt+" = vec4(wTexelR"+nt+"C"+lt+".xz, wTexelR"+nt+"C"+lt+`.xz); 4913 `,lt+1<je&&(rt+=` 4914 vec4 wTexelR`+nt+"C"+(lt+1)+" = getW("+nt+", "+(lt+1)+`, d1, q); 4915 wR`+nt+"C"+(lt+1)+` = 4916 vec4(wTexelR`+nt+"C"+(lt+1)+".xz, wTexelR"+nt+"C"+(lt+1)+".xz);"))}for(nt=0;nt<Pe;nt++)for(lt=0;lt<je;lt++)rt+="dotProd += xR"+nt+"C"+lt+" * wR"+nt+"C"+lt+";";var Pt="",Kt="";p&&(Pt=w?`vec4 activation(vec4 a) { 4917 vec4 b = getPreluActivationWeightsAtOutCoords(); 4918 `+p+` 4919 }`:`vec4 activation(vec4 x) { 4920 `+p+` 4921 }`,Kt="result = activation(result);");var dn=x?"result += getBiasAtOutCoords();":"";x&&this.variableNames.push("bias"),w&&this.variableNames.push("preluActivationWeights"),this.userCode=` 4922 `+Pt+` 4923 4924 const ivec2 strides = ivec2(`+fe+", "+ye+`); 4925 const ivec2 pads = ivec2(`+Q+", "+ie+`); 4926 4927 void main() { 4928 4929 ivec4 coords = getOutputCoords(); 4930 int batch = coords.x; 4931 ivec2 xRCCorner = coords.yz * strides - pads; 4932 int d2 = coords.w; 4933 int d1 = d2; 4934 int q = 0; 4935 int xRCorner = xRCCorner.x; 4936 int xCCorner = xRCCorner.y; 4937 4938 vec4 dotProd = vec4(0.); 4939 4940 `+rt+` 4941 4942 vec4 result = dotProd; 4943 `+dn+` 4944 `+Kt+` 4945 setOutput(result); 4946 } 4947 `};function So(C,x){if(C===1)return""+x;if(C===2)return x+".y";if(C===3)return x+".z";if(C===4)return x+".w";throw Error("Cumulative sum for rank "+C+" is not yet supported")}var ja=function(){function C(x,p,w){this.variableNames=["x"],this.outputShape=[],this.outputShape=x,this.blockSize=p,this.dataFormat=w,this.userCode=` 4948 void main() { 4949 ivec4 coords =
4949 getOutputCoords(); 4950 int b = coords[0]; 4951 int h = `+this.getHeightCoordString()+`; 4952 int w = `+this.getWidthCoordString()+`; 4953 int d = `+this.getDepthCoordString()+`; 4954 4955 int in_h = h / `+p+`; 4956 int offset_h = imod(h, `+p+`); 4957 int in_w = w / `+p+`; 4958 int offset_w = imod(w, `+p+`); 4959 int offset_d = (offset_h * `+p+` + offset_w) * 4960 `+this.getOutputDepthSize()+`; 4961 int in_d = d + offset_d; 4962 4963 float result = `+this.getInputSamplingString()+`; 4964 setOutput(result); 4965 } 4966 `}return C.prototype.getHeightCoordString=function(){return this.dataFormat==="NHWC"?"coords[1]":"coords[2]"},C.prototype.getWidthCoordString=function(){return this.dataFormat==="NHWC"?"coords[2]":"coords[3]"},C.prototype.getDepthCoordString=function(){return this.dataFormat==="NHWC"?"coords[3]":"coords[1]"},C.prototype.getOutputDepthSize=function(){return this.dataFormat==="NHWC"?this.outputShape[3]:this.outputShape[1]},C.prototype.getInputSamplingString=function(){return this.dataFormat==="NHWC"?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},C}(),pa=function(C,x,p){this.variableNames=["real","imag"];var w=x[1];this.outputShape=x;var D=p?"2.0 * "+Math.PI:"-2.0 * "+Math.PI,W=p?w+".0":"1.0";this.userCode=` 4967 const float exponentMultiplier = `+D+`; 4968 4969 float unaryOpComplex(float real, float expR, float imag, float expI) { 4970 `+C+` 4971 } 4972 4973 float mulMatDFT(int batch, int index) { 4974 float indexRatio = float(index) / float(`+w+`); 4975 float exponentMultiplierTimesIndexRatio = 4976 exponentMultiplier * indexRatio; 4977 4978 float result = 0.0; 4979 4980 for (int i = 0; i < `+w+`; i++) { 4981 // x = (-2|2 * PI / N) * index * i; 4982 float x = exponentMultiplierTimesIndexRatio * float(i); 4983 float expR = cos(x); 4984 float expI = sin(x); 4985 float real = getReal(batch, i); 4986 float imag = getImag(batch, i); 4987 4988 result += 4989 unaryOpComplex(real, expR, imag, expI) / `+W+`; 4990 } 4991 4992 return result; 4993 } 4994 4995 void main() { 4996 ivec2 coords = getOutputCoords(); 4997 setOutput(mulMatDFT(coords[0], coords[1])); 4998 } 4999 `},Ta=function(){function C(x,p){this.outputShape=[],this.variableNames=["x"],this.outputShape=x,this.userCode=` 5000 uniform float value; 5001 void main() { 5002 // Input can be obtained from uniform value. 5003 setOutput(value); 5004 } 5005 `}return C.prototype.getCustomSetupFunc=function(x){var p=this;return function(w,D){p.valueLoc==null&&(p.valueLoc=w.getUniformLocationNoThrow(D,"value")),w.gl.uniform1f(p.valueLoc,x)}},C}();function Zi(C,x){var p=ue();return Eo(C,x,p.version+` 5006 precision highp float; 5007 `+p.attribute+` vec3 clipSpacePos; 5008 `+p.attribute+` vec2 uv; 5009 `+p.varyingVs+` vec2 resultUV; 5010 5011 void main() { 5012 gl_Position = vec4(clipSpacePos, 1); 5013 resultUV = uv; 5014 }`)}function Xi(C,x){return Wl(C,x,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function Ho(C,x){return Jc(C,x,new Uint16Array([0,1,2,2,1,3]))}function Ga(C,x,p,w,D,W,Q){Sm(p,w);var ie=Vl(C,x),fe=C.TEXTURE_2D;return Hn(C,x,function(){return C.bindTexture(fe,ie)}),Hn(C,x,function(){return C.texParameteri(fe,C.TEXTURE_WRAP_S,C.CLAMP_TO_EDGE)}),Hn(C,x,function(){return C.texParameteri(fe,C.TEXTURE_WRAP_T,C.CLAMP_TO_EDGE)}),Hn(C,x,function(){return C.texParameteri(fe,C.TEXTURE_MIN_FILTER,C.NEAREST)}),Hn(C,x,function(){return C.texParameteri(fe,C.TEXTURE_MAG_FILTER,C.NEAREST)}),Hn(C,x,function(){return C.texImage2D(fe,0,D,p,w,0,W,Q,null)}),Hn(C,x,function(){return C.bindTexture(C.TEXTURE_2D,null)}),ie}function Qa(C,x,p,w,D){var W=ko(p,w);return Ga(C,x,W[0],W[1],D.internalFormatFloat,D.textureFormatFloat,C.FLOAT)}function Ua(C,x,p,w,D){var W=ko(p,w);return Ga(C,x,W[0],W[1],D.internalFormatHalfFloat,D.textureFormatFloat,D.textureTypeHalfFloat)}function Na(C,x,p,w,D){var W=ko(p,w);return Ga(C,x,W[0],W[1],C.RGBA,C.RGBA,C.UNSIGNED_BYTE)}function Hs(C,x,p,w,D){var W=ai(p,w);return Ga(C,x,W[0],W[1],D.internalFormatPackedFloat,C.RGBA,C.FLOAT)}function Za(C,x,p,w,D){var W=ai(p,w);return Ga(C,x,W[0],W[1],D.internalFormatPackedHalfFloat,C.RGBA,D.textureTypeHalfFloat)}function qo(C,x,p,w){return Hn(C,x,function(){return C.bindBuffer(C.ARRAY_BUFFER,w)}),Zd(C,x,p,"clipSpacePos",w,3,20,0)&&Zd(C,x,p,"uv",w,2,20,12)}function ss(C,x,p,w,D,W,Q){var ie,fe,ye;Hn(C,x,function(){return C.bindTexture(C.TEXTURE_2D,p)}),W instanceof Uint8Array?(ie=new Uint8Array(w*D*4),fe=C.UNSIGNED_BYTE,ye=C.RGBA):(ie=new Float32Array(w*D*4),fe=C.FLOAT,ye=Q.internalFormatPackedFloat),ie.set(W),Hn(C,x,function(){return C.texImage2D(C.TEXTURE_2D,0,ye,w,D,0,C.RGBA,fe,ie)}),Hn(C,x,function(){return C.bindTexture(C.TEXTURE_2D,null)})}function jc(C,x,p,w){Hn(C,x,function(){return C.bindTexture(C.TEXTURE_2D,p)}),w.data instanceof Uint8Array?Hn(C,x,function(){return C.texImage2D(C.TEXTURE_2D,0,C.RGBA,w.width,w.height,0,C.RGBA,C.UNSIGNED_BYTE,w.data)}):Hn(C,x,function(){return C.texImage2D(C.TEXTURE_2D,0,C.RGBA,C.RGBA,C.UNSIGNED_BYTE,w)}),Hn(C,x,function(){return C.bindTexture(C.TEXTURE_2D,null)})}
vendor: 14,644 bytes, lines 5014-5030
5014function ru(C,x,p,w,D){var W=C.createBuffer();Hn(C,x,function(){return C.bindBuffer(C.PIXEL_PACK_BUFFER,W)});var Q=16*p*w;return Hn(C,x,function(){return C.bufferData(C.PIXEL_PACK_BUFFER,Q,C.STREAM_READ)}),Hn(C,x,function(){return C.readPixels(0,0,w,p,C.RGBA,C.FLOAT,0)}),Hn(C,x,function(){return C.bindBuffer(C.PIXEL_PACK_BUFFER,null)}),W}function ws(C,x,p){var w=C,D=new Float32Array(p);return w.bindBuffer(w.PIXEL_PACK_BUFFER,x),w.getBufferSubData(w.PIXEL_PACK_BUFFER,0,D),w.bindBuffer(w.PIXEL_PACK_BUFFER,null),D}function la(C,x,p,w,D){var W=ko(p,w),Q=W[0],ie=W[1],fe=new Uint8Array(p*w*4);return Hn(C,x,function(){return C.readPixels(0,0,Q,ie,D.downloadTextureFormat,C.UNSIGNED_BYTE,fe)}),new Float32Array(fe.buffer)}function Al(C,x,p,w,D,W,Q,ie){var fe=C,ye=new Float32Array(function(Oe,Re){var Pe=ai(W,Q);return Pe[0]*Pe[1]*4}());return fe.bindBuffer(fe.PIXEL_PACK_BUFFER,x),fe.getBufferSubData(fe.PIXEL_PACK_BUFFER,0,ye),fe.bindBuffer(fe.PIXEL_PACK_BUFFER,null),ye}function Xu(C,x,p,w){var D=new Float32Array(p*w*4);return Hn(C,x,function(){return C.readPixels(0,0,w,p,C.RGBA,C.FLOAT,D)}),D}var Mu=Object.freeze({createVertexShader:Zi,createVertexBuffer:Xi,createIndexBuffer:Ho,createFloat32MatrixTexture:Qa,createFloat16MatrixTexture:Ua,createUnsignedBytesMatrixTexture:Na,createPackedMatrixTexture:Hs,createFloat16PackedMatrixTexture:Za,bindVertexProgramAttributeStreams:qo,uploadDenseMatrixToTexture:ss,uploadPixelDataToTexture:jc,createBufferFromOutputTexture:ru,downloadFloat32MatrixFromBuffer:ws,downloadByteEncodedFloatMatrixFromOutputTexture:la,downloadPackedMatrixFromBuffer:Al,downloadMatrixFromPackedOutputTexture:Xu}),Ia=function(){function C(x){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];var p=L().getNumber("WEBGL_VERSION");x!=null?(this.gl=x,Lo(p,x)):this.gl=Ai(p);var w="WEBGL_color_buffer_float";if(L().getNumber("WEBGL_VERSION")===1){if(this.textureFloatExtension=Ko(this.gl,this.debug,"OES_texture_float"),Ja(this.gl,"OES_texture_half_float"))this.textureHalfFloatExtension=Ko(this.gl,this.debug,"OES_texture_half_float");else if(L().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(w),Ja(this.gl,"EXT_color_buffer_half_float"))this.colorBufferHalfFloatExtension=Ko(this.gl,this.debug,"EXT_color_buffer_half_float");else if(L().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(w="EXT_color_buffer_float",Ja(this.gl,w))this.colorBufferFloatExtension=this.gl.getExtension(w);else{if(!Ja(this.gl,"EXT_color_buffer_half_float"))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float")}this.vertexBuffer=Xi(this.gl,this.debug),this.indexBuffer=Ho(this.gl,this.debug),this.framebuffer=Qs(this.gl,this.debug),this.textureConfig=Yr(this.gl,this.textureHalfFloatExtension)}return Object.defineProperty(C.prototype,"debug",{get:function(){return L().getBool("DEBUG")},enumerable:!0,configurable:!0}),C.prototype.dispose=function(){var x=this;if(!this.disposed){this.program!=null&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),this.outputTexture!=null&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");var p=this.gl;Hn(p,this.debug,function(){return p.finish()}),Hn(p,this.debug,function(){return p.bindFramebuffer(p.FRAMEBUFFER,null)}),Hn(p,this.debug,function(){return p.deleteFramebuffer(x.framebuffer)}),Hn(p,this.debug,function(){return p.bindBuffer(p.ARRAY_BUFFER,null)}),Hn(p,this.debug,function(){return p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,null)}),Hn(p,this.debug,function(){return p.deleteBuffer(x.indexBuffer)}),this.disposed=!0}},C.prototype.createFloat32MatrixTexture=function(x,p){return this.throwIfDisposed(),Qa(this.gl,this.debug,x,p,this.textureConfig)},C.prototype.createFloat16MatrixTexture=function(x,p){return this.throwIfDisposed(),Ua(this.gl,this.debug,x,p,this.textureConfig)},C.prototype.createUnsignedBytesMatrixTexture=function(x,p){return this.throwIfDisposed(),Na(this.gl,this.debug,x,p,this.textureConfig)},C.prototype.uploadPixelDataToTexture=function(x,p){this.throwIfDisposed(),jc(this.gl,this.debug,x,p)},C.prototype.uploadDenseMatrixToTexture=function(x,p,w,D){this.throwIfDisposed(),ss(this.gl,this.debug,x,p,w,D,this.textureConfig)},C.prototype.createFloat16PackedMatrixTexture=function(x,p){return this.throwIfDisposed(),Za(this.gl,this.debug,x,p,this.textureConfig)},C.prototype.createPackedMatrixTexture=function(x,p){return this.throwIfDisposed(),Hs(this.gl,this.debug,x,p,this.textureConfig)},C.prototype.deleteMatrixTexture=function(x){var p=this;this.throwIfDisposed(),this.outputTexture===x&&(nd(this.gl,this.debug,this.framebuffer),this.outputTexture=null),Hn(this.gl,this.debug,function(){return p.gl.deleteTexture(x)})},C.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(x,p,w){var D=this;return this.downloadMatrixDriver(x,function(){return la(D.gl,D.debug,p,w,D.textureConfig)})},C.prototype.downloadPackedMatrixFromBuffer=function(x,p,w,D,W,Q){return Al(this.gl,x,0,0,0,W,Q,this.textureConfig)},C.prototype.downloadFloat32MatrixFromBuffer=function(x,p){return ws(this.gl,x,p)},C.prototype.createBufferFromTexture=function(x,p,w){this.bindTextureToFrameBuffer(x);var D=ru(this.gl,this.debug,p,w,this.textureConfig);return this.unbindTextureToFrameBuffer(),D},C.prototype.createAndWaitForFence=function(){var x=this.createFence(this.gl);return this.pollFence(x)},C.prototype.createFence=function(x){var p,w,D=this;if(L().getBool("WEBGL_FENCE_API_ENABLED")){var W=x,Q=W.fenceSync(W.SYNC_GPU_COMMANDS_COMPLETE,0);x.flush(),w=function(){var ie=W.clientWaitSync(Q,0,0);return ie===W.ALREADY_SIGNALED||ie===W.CONDITION_SATISFIED},p=Q}else L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(p=this.beginQuery(),this.endQuery(),w=function(){return D.isQueryAvailable(p,L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):w=function(){return!0};return{query:p,isFencePassed:w}},C.prototype.downloadMatrixFromPackedTexture=function(x,p,w){var D=this;return this.downloadMatrixDriver(x,function(){return Xu(D.gl,D.debug,p,w)})},C.prototype.createProgram=function(x){this.throwIfDisposed();var p=this.gl,w=Yo(p,this.debug,x),D=Zi(p,this.debug),W=fo(p,this.debug);return Hn(p,this.debug,function(){return p.attachShader(W,D)}),Hn(p,this.debug,function(){return p.attachShader(W,w)}),yl(p,this.debug,W),this.debug&&Tc(p,this.debug,W),this.vertexAttrsAreBound||(this.setProgram(W),this.vertexAttrsAreBound=qo(p,this.debug,this.program,this.vertexBuffer)),W},C.prototype.deleteProgram=function(x){var p=this;this.throwIfDisposed(),x===this.program&&(this.program=null),x!=null&&Hn(this.gl,this.debug,function(){return p.gl.deleteProgram(x)})},C.prototype.setProgram=function(x){var p=this;this.throwIfDisposed(),this.program=x,this.program!=null&&this.debug&&Tc(this.gl,this.debug,this.program),Hn(this.gl,this.debug,function(){return p.gl.useProgram(x)})},C.prototype.getUniformLocation=function(x,p,w){return w===void 0&&(w=!0),this.throwIfDisposed(),w?Qc(this.gl,this.debug,x,p):eh(this.gl,x,p)},C.prototype.getAttributeLocation=function(x,p){var w=this;return this.throwIfDisposed(),Hn(this.gl,this.debug,function(){return w.gl.getAttribLocation(x,p)})},C.prototype.getUniformLocationNoThrow=function(x,p){return this.throwIfDisposed(),this.gl.getUniformLocation(x,p)},C.prototype.setInputMatrixTexture=function(x,p,w){this.throwIfDisposed(),this.throwIfNoProgram(),mp(this.gl,this.debug,this.program,x,p,w)},C.prototype.setOutputMatrixTexture=function(x,p,w){this.setOutputMatrixTextureDriver(x,w,p)},C.prototype.setOutputPackedMatrixTexture=function(x,p,w){this.throwIfDisposed();var D=ai(p,w),W=D[0],Q=D[1];this.setOutputMatrixTextureDriver(x,W,Q)},C.prototype.setOutputMatrixWriteRegion=function(x,p,w,D){this.setOutputMatrixWriteRegionDriver(w,x,D,p)},C.prototype.setOutputPackedMatrixWriteRegion=function(x,p,w,D){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},C.prototype.debugValidate=function(){this.program!=null&&Tc(this.gl,this.debug,this.program),ys(this.gl)},C.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var x=this.gl;this.debug&&this.debugValidate(),Hn(x,this.debug,function(){return x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)})},C.prototype.blockUntilAllProgramsCompleted=function(){var x=this;this.throwIfDisposed(),Hn(this.gl,this.debug,function(){return x.gl.finish()})},C.prototype.getQueryTimerExtension=function(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=Ko(this.gl,this.debug,L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},C.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},C.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},C.prototype.beginQuery=function(){if(L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){var x=this.gl,p=this.getQueryTimerExtensionWebGL2(),w=x.createQuery();return x.beginQuery(p.TIME_ELAPSED_EXT,w),w}var D=this.getQueryTimerExtensionWebGL1(),W=D.createQueryEXT();return D.beginQueryEXT(D.TIME_ELAPSED_EXT,W),W},C.prototype.endQuery=function(){if(L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")!==2){var x=this.getQueryTimerExtensionWebGL1();x.endQueryEXT(x.TIME_ELAPSED_EXT)}else{var p=this.gl,w=this.getQueryTimerExtensionWebGL2();p.endQuery(w.TIME_ELAPSED_EXT)}},C.prototype.waitForQueryAndGetTime=function(x){return S(this,void 0,void 0,function(){var p=this;return M(this,function(w){switch(w.label){case 0:return[4,_t(function(){return p.disposed||p.isQueryAvailable(x,L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return w.sent(),[2,this.getQueryTime(x,L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}})})},C.prototype.getQueryTime=function(x,p){if(p===0)return null;if(p===2){var w=this.gl;return w.getQueryParameter(x,w.QUERY_RESULT)/1e6}var D=this.getQueryTimerExtensionWebGL1();return D.getQueryObjectEXT(x,D.QUERY_RESULT_EXT)/1e6},C.prototype.isQueryAvailable=function(x,p){if(p===0)return!0;if(p===2){var w=this.gl,D=this.getQueryTimerExtensionWebGL2(),W=w.getQueryParameter(x,w.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(D.GPU_DISJOINT_EXT)),W&&!this.disjoint}return W=(D=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(x,D.QUERY_RESULT_AVAILABLE_EXT),this.disjoint==null&&(this.disjoint=this.gl.getParameter(D.GPU_DISJOINT_EXT)),W&&!this.disjoint},C.prototype.pollFence=function(x){var p=this;return new Promise(function(w){p.addItemToPoll(function(){return x.isFencePassed()},function(){return w()})})},C.prototype.pollItems=function(){for(var x=function(w){for(var D=0;D<w.length&&w[D]();++D);return D-1}(this.itemsToPoll.map(function(w){return w.isDoneFn})),p=0;p<=x;++p)(0,this.itemsToPoll[p].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(x+1)},C.prototype.addItemToPoll=function(x,p){var w=this;this.itemsToPoll.push({isDoneFn:x,resolveFn:p}),this.itemsToPoll.length>1||_t(function(){return w.pollItems(),w.itemsToPoll.length===0})},C.prototype.bindTextureToFrameBuffer=function(x){this.throwIfDisposed(),$l(this.gl,this.debug,x,this.framebuffer),this.debug&&ys(this.gl)},C.prototype.unbindTextureToFrameBuffer=function(){this.outputTexture!=null?($l(this.gl,this.debug,this.outputTexture,this.framebuffer),this.debug&&ys(this.gl)):nd(this.gl,this.debug,this.framebuffer)},C.prototype.downloadMatrixDriver=function(x,p){this.bindTextureToFrameBuffer(x);var w=p();return this.unbindTextureToFrameBuffer(),w},C.prototype.setOutputMatrixTextureDriver=function(x,p,w){this.throwIfDisposed();var D=this.gl;$l(D,this.debug,x,this.framebuffer),this.debug&&ys(D),this.outputTexture=x,Hn(D,this.debug,function(){return D.viewport(0,0,p,w)}),Hn(D,this.debug,function(){return D.scissor(0,0,p,w)})},C.prototype.setOutputMatrixWriteRegionDriver=function(x,p,w,D){var W=this;this.throwIfDisposed(),Hn(this.gl,this.debug,function(){return W.gl.scissor(x,p,w,D)})},C.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},C.prototype.throwIfNoProgram=function(){if(this.program==null)throw new Error("No GPU program is currently set.")},C}();function Fu(C,x){if(C.length!==x.length)throw Error("Binary was compiled with "+C.length+" inputs, but was executed with "+x.length+" inputs");C.forEach(function(p,w){var D=p.logicalShape,W=x[w],Q=W.shape;if(!Tt(D,Q))throw Error("Binary was compiled with different shapes than the current args. Shapes "+D+" and "+Q+" must match");if(!p.isUniform||!W.isUniform){var ie=p.texShape,fe=W.isUniform?null:W.texData.texShape;if(!Tt(ie,fe))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+ie+" and "+fe+" must match")}})}var fa=function(C,x,p,w,D,W,Q){p===void 0&&(p=!1),w===void 0&&(w=!1),D===void 0&&(D=!1),W===void 0&&(W=null),Q===void 0&&(Q=!1),this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=x;var ie=p?C[1]:C[2],fe=Math.ceil(ie/2),ye=p?"i * 2, rc.y":"rc.y, i * 2",Oe=w?"rc.z, i * 2":"i * 2, rc.z",Re=p?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],Pe=w?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],je="",Ge="";W&&(je=Q?`vec4 activation(vec4 a) { 5015 vec4 b = getPreluActivationWeightsAtOutCoords(); 5016 `+W+` 5017 }`:`vec4 activation(vec4 x) { 5018 `+W+` 5019 }`,Ge="result = activation(result);");var rt=D?"result += getBiasAtOutCoords();":"";D&&this.variableNames.push("bias"),Q&&this.variableNames.push("preluActivationWeights"),this.userCode=` 5020 `+je+` 5021 5022 const float sharedDimension = `+fe+`.0; 5023 5024 vec4 dot2x2ARowBCol(ivec3 rc) { 5025 vec4 result = vec4(0); 5026 for (int i = 0; i < `+fe+`; i++) { 5027 vec4 a = getMatrixA(rc.x, `+ye+`); 5028 vec4 b = getMatrixB(rc.x, `+Oe+`); 5029 5030 // These swizzled products need to be separately added.
5031 // See: https://github.com/tensorflow/tfjs/issues/1735 5032 result += (`+Re[0]+" * "+Pe[0]+`); 5033 result += (`+Re[1]+" * "+Pe[1]+`); 5034 } 5035 return result; 5036 } 5037 5038 void main() { 5039 ivec3 rc = getOutputCoords(); 5040 vec4 result = dot2x2ARowBCol(rc); 5041 5042 `+rt+` 5043 5044 `+Ge+` 5045 5046 setOutput(result); 5047 } 5048 `},Cu=function(){function C(x,p,w){this.variableNames=["probs"],this.outputShape=[x,w],this.userCode=` 5049 uniform float seed; 5050 5051 void main() { 5052 ivec2 coords = getOutputCoords(); 5053 int batch = coords[0]; 5054 5055 float r = random(seed); 5056 float cdf = 0.0; 5057 5058 for (int i = 0; i < `+(p-1)+`; i++) { 5059 cdf += getProbs(batch, i); 5060 5061 if (r < cdf) { 5062 setOutput(float(i)); 5063 return; 5064 } 5065 } 5066 5067 // If no other event happened, last event happened. 5068 setOutput(float(`+(p-1)+`)); 5069 } 5070 `}return C.prototype.getCustomSetupFunc=function(x){var p=this;return function(w,D){p.seedLoc==null&&(p.seedLoc=w.getUniformLocation(D,"seed")),w.gl.uniform1f(p.seedLoc,x)}},C}(),iu=function(C,x,p){if(this.variableNames=["x"],x==="avg"&&p)throw new Error("Cannot compute positions for average pool.");var w=C.filterWidth,D=C.strideHeight,W=C.strideWidth,Q=C.dilationHeight,ie=C.dilationWidth,fe=C.effectiveFilterHeight,ye=C.effectiveFilterWidth,Oe=C.padInfo.top,Re=C.padInfo.left;this.outputShape=C.outShape;var Pe=x==="avg",je="0.0";if(Pe||(je="-1.0 / 1e-20"),p)this.userCode=` 5071 const ivec2 strides = ivec2(`+D+", "+W+`); 5072 const ivec2 pads = ivec2(`+Oe+", "+Re+`); 5073 5074 void main() { 5075 ivec4 coords = getOutputCoords(); 5076 int batch = coords[0]; 5077 int d = coords[3]; 5078 5079 ivec2 xRCCorner = coords.yz * strides - pads; 5080 int xRCorner = xRCCorner.x; 5081 int xCCorner = xRCCorner.y; 5082 5083 // max/min x(?, ?, d) to get y(yR, yC, d). 5084 // ? = to be determined 5085 float minMaxValue = 0.0; 5086 float minMaxValueFound = 0.0; 5087 int minMaxPosition = 0; 5088 float avgValue = 0.0; 5089 5090 for (int wR = 0; wR < `+fe+`; 5091 wR += `+Q+`) { 5092 int xR = xRCorner + wR; 5093 5094 if (xR < 0 || xR >= `+C.inHeight+`) { 5095 continue; 5096 } 5097 5098 for (int wC = 0; wC < `+ye+`; 5099 wC += `+ie+`) { 5100 int xC = xCCorner + wC; 5101 5102 if (xC < 0 || xC >= `+C.inWidth+`) { 5103 continue; 5104 } 5105 5106 float value = getX(batch, xR, xC, d); 5107 5108 // If a min / max value has already been found, use it. If not, 5109 // use the current value. 5110 float currMinMaxValue = mix( 5111 value, minMaxValue, minMaxValueFound); 5112 if (value >= currMinMaxValue) { 5113 minMaxValue = value; 5114 minMaxValueFound = 1.0; 5115 minMaxPosition = wR * `+ye+` + wC; 5116 } 5117 } 5118 } 5119 setOutput(float(minMaxPosition)); 5120 } 5121 `;else{var Ge=x+"("+x+"("+x+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";x==="avg"&&(Ge="avgValue / count");var rt=4*Math.floor(w/4),nt=w%4,lt=` 5122 if (`+Pe+`) { 5123 avgValue += dot(values, ones); 5124 } else { 5125 minMaxValue = max(values, minMaxValue); 5126 } 5127 `;this.userCode=` 5128 const ivec2 strides = ivec2(`+D+", "+W+`); 5129 const ivec2 pads = ivec2(`+Oe+", "+Re+`); 5130 const float initializationValue = `+je+`; 5131 const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0); 5132 5133 float count = 0.0; 5134 5135 float getValue(int batch, int xR, int xC, int d) { 5136 if (xC < 0 || xC >= `+C.inWidth+`) { 5137 return initializationValue; 5138 } 5139 count += 1.0; 5140 return getX(batch, xR, xC, d); 5141 } 5142 5143 void main() { 5144 ivec4 coords = getOutputCoords(); 5145 int batch = coords[0]; 5146 int d = coords[3]; 5147 5148 ivec2 xRCCorner = coords.yz * strides - pads; 5149 int xRCorner = xRCCorner.x; 5150 int xCCorner = xRCCorner.y; 5151 5152 // max/min x(?, ?, d) to get y(yR, yC, d). 5153 // ? = to be determined 5154 vec4 minMaxValue = vec4(`+je+`); 5155 float avgValue = 0.0; 5156 count = 0.0; 5157 5158 for (int wR = 0; wR < `+fe+`; 5159 wR += `+Q+`) { 5160 int xR = xRCorner + wR; 5161 5162 if (xR < 0 || xR >= `+C.inHeight+`) { 5163 continue; 5164 } 5165 5166 for (int wC = 0; wC < `+rt+`; wC += 4) { 5167 int xC = xCCorner + wC * `+ie+`; 5168 5169 vec4 values = vec4( 5170 getValue(batch, xR, xC, d), 5171 getValue(batch, xR, xC + `+ie+`, d), 5172 getValue(batch, xR, xC + 2 * `+ie+`, d), 5173 getValue(batch, xR, xC + 3 * `+ie+`, d) 5174 ); 5175 5176 `+lt+` 5177 } 5178 5179 int xC = xCCorner + `+rt+`; 5180 if (`+(nt===1)+`) { 5181 vec4 values = vec4( 5182 getValue(batch, xR, xC, d), 5183 initializationValue, 5184 initializationValue, 5185 initializationValue 5186 ); 5187 5188 `+lt+` 5189 } else if (`+(nt===2)+`) { 5190 vec4 values = vec4( 5191 getValue(batch, xR, xC, d), 5192 getValue(batch, xR, xC + `+ie+`, d), 5193 initializationValue, 5194 initializationValue 5195 ); 5196 5197 `+lt+` 5198 } else if (`+(nt===3)+`) { 5199 vec4 values = vec4( 5200 getValue(batch, xR, xC, d), 5201 getValue(batch, xR, xC + `+ie+`, d), 5202 getValue(batch, xR, xC + 2 * `+ie+`, d), 5203 initializationValue 5204 ); 5205 5206 `+lt+` 5207 } 5208 } 5209 setOutput(`+Ge+`); 5210 } 5211 `}},Do=function(C,x,p){if(this.variableNames=["x"],x==="avg"&&p)throw new Error("Cannot compute positions for average pool.");var w=C.filterWidth,D=C.strideDepth,W=C.strideHeight,Q=C.strideWidth,ie=C.dilationDepth,fe=C.dilationHeight,ye=C.dilationWidth,Oe=C.effectiveFilterDepth,Re=C.effectiveFilterHeight,Pe=C.effectiveFilterWidth,je=C.padInfo.front,Ge=C.padInfo.top,rt=C.padInfo.left;this.outputShape=C.outShape;var nt=x==="avg",lt="0.0";if(nt||(lt="-1.0 / 1e-20"),p)this.userCode=` 5212 const ivec3 strides = 5213 ivec3(`+D+", "+W+", "+Q+`); 5214 const ivec3 pads = ivec3(`+je+", "+Ge+", "+rt+`); 5215 5216 void main() { 5217 ivec5 coords = getOutputCoords(); 5218 int batch = coords.x; 5219 int ch = coords.u; 5220 5221 ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads; 5222 int xDCorner = xCorner.x; 5223 int xRCorner = xCorner.y; 5224 int xCCorner = xCorner.z; 5225 5226 // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch). 5227 // ? = to be determined 5228 float minMaxValue = 0.0; 5229 float minMaxValueFound = 0.0; 5230 int minMaxPosition = 0; 5231 5232 for (int wD = 0; wD < `+Oe+`; 5233 wD += `+ie+`) { 5234 int xD = xDCorner + wD; 5235 5236 if (xD < 0 || xD >= `+C.inDepth+`) { 5237 continue; 5238 } 5239 5240 for (int wR = 0; wR < `+Re+`; 5241 wR += `+fe+`) { 5242 int xR = xRCorner + wR; 5243 5244 if (xR < 0 || xR >= `+C.inHeight+`) { 5245 continue; 5246 } 5247 5248 for (int wC = 0; wC < `+Pe+`; 5249 wC += `+ye+`) { 5250 int xC = xCCorner + wC; 5251 5252 if (xC < 0 || xC >= `+C.inWidth+`) { 5253 continue; 5254 } 5255 5256 float value = getX(batch, xD, xR, xC, ch); 5257 5258 // If a min / max value has already been found, use it. If not, 5259 // use the current value. 5260 float currMinMaxValue = mix( 5261 value, minMaxValue, minMaxValueFound); 5262 if (value >= currMinMaxValue) { 5263 minMaxValue = value; 5264 minMaxValueFound = 1.0; 5265 minMaxPosition = 5266 wD * `+Re+" * "+Pe+` + 5267 wR * `+Pe+` + wC;; 5268 } 5269 } 5270 } 5271 } 5272 setOutput(float(minMaxPosition)); 5273 } 5274 `;else{var Nt=x+"("+x+"("+x+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";x==="avg"&&(Nt="avgValue / count");var Rt=4*Math.floor(w/4),Pt=w%4,Kt=` 5275 if (`+nt+`) { 5276 avgValue += dot(values, ones); 5277 } else { 5278 minMaxValue = max(values, minMaxValue); 5279 } 5280 `;this.userCode=` 5281 const ivec3 strides = 5282 ivec3(`+D+", "+W+", "+Q+`); 5283 const ivec3 pads = ivec3(`+je+", "+Ge+", "+rt+`); 5284 const float initializationValue = `+lt+`; 5285 const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0); 5286 5287 float count = 0.0; 5288 5289 float getValue(int batch, int xD, int xR, int xC, int ch) { 5290 if (xC < 0 || xC >= `+C.inWidth+`) { 5291 return initializationValue; 5292 } 5293 count += 1.0; 5294 return getX(batch, xD, xR, xC, ch); 5295 } 5296 5297 void main() { 5298 ivec5 coords = getOutputCoords(); 5299 int batch = coords.x; 5300 int ch = coords.u; 5301 5302 ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads; 5303 int xDCorner = xCorner.x; 5304 int xRCorner = xCorner.y; 5305 int xCCorner = xCorner.z; 5306 5307 // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch). 5308 // ? = to be determined 5309 vec4 minMaxValue = vec4(`+lt+`); 5310 float avgValue = 0.0; 5311 count = 0.0; 5312 5313 for (int wD = 0; wD < `+Oe+`; 5314 wD += `+ie+`) { 5315 int xD = xDCorner + wD; 5316 5317 if (xD < 0 || xD >= `+C.inDepth+`) { 5318 continue; 5319 } 5320 5321 for (int wR = 0; wR < `+Re+`; 5322 wR += `+fe+`) { 5323 int xR = xRCorner + wR; 5324 5325 if (xR < 0 || xR >= `+C.inHeight+`) { 5326 continue; 5327 } 5328 5329 for (int wC = 0; wC < `+Rt+`; wC += 4) { 5330 int xC = xCCorner + wC * `+ye+`; 5331 5332 vec4 values = vec4( 5333 getValue(batch, xD, xR, xC, ch), 5334 getValue(batch, xD, xR, xC + `+ye+`, ch), 5335 getValue(batch, xD, xR, xC + 2 * `+ye+`, ch), 5336 getValue(batch, xD, xR, xC + 3 * `+ye+`, ch) 5337 ); 5338 5339 `+Kt+` 5340 } 5341 5342 int xC = xCCorner + `+Rt+`; 5343 if (`+(Pt===1)+`) { 5344 vec4 values = vec4( 5345 getValue(batch, xD, xR, xC, ch), 5346 initializationValue, 5347 initializationValue, 5348 initializationValue 5349 ); 5350 5351 `+Kt+` 5352 } else if (`+(Pt===2)+`) { 5353 vec4 values = vec4( 5354 getValue(batch, xD, xR, xC, ch), 5355 getValue(batch, xD, xR, xC + `+ye+`, ch), 5356 initializationValue, 5357 initializationValue 5358 ); 5359 5360 `+Kt+` 5361 } else if (`+(Pt===3)+`) { 5362 vec4 values = vec4( 5363 getValue(batch, xD, xR, xC, ch), 5364 getValue(batch, xD, xR, xC + `+ye+`, ch), 5365 getValue(batch, xD, xR, xC + 2 * `+ye+`, ch), 5366 initializationValue 5367 ); 5368 5369 `+Kt+` 5370 } 5371 } 5372 setOutput(`+Nt+`); 5373 } 5374 } 5375 `}},Su=function(C,x,p,w,D,W,Q){this.variableNames=["updates","indices","defaultValue"],this.outputShape=W;var ie=Vn(D.length),fe=Vn(W.length),ye="";p===1?ye="i":p===2&&(ye="i, j");var Oe="getIndices("+ye+")",Re="";w===1?Re="i":w===2&&(Re="i, coords[1]");var Pe="getUpdates("+Re+")",je=x>1?"strides[j]":"strides";this.userCode=` 5376 `+ie+" strides = "+ie+"("+D+`); 5377 5378 void main() { 5379 `+fe+` coords = getOutputCoords(); 5380 float sum = 0.0; 5381 bool found = false;
5382 for (int i = 0; i < `+C+`; i++) { 5383 int flattenedIndex = 0; 5384 for (int j = 0; j < `+x+`; j++) { 5385 int index = round(`+Oe+`); 5386 flattenedIndex += index * `+je+`; 5387 } 5388 if (flattenedIndex == coords[0]) { 5389 sum += `+Pe+`; 5390 found = true; 5391 } 5392 } 5393 setOutput(mix(getDefaultValue(), sum, float(found))); 5394 } 5395 `},Ls=function(){function C(x){this.variableNames=["source"],this.outputShape=x,this.rank=x.length;var p,w=Vn(this.rank),D="uniform int start["+this.rank+"];",W=function(Q){if(Q===1)return"sourceLoc";if(Q<=6)return Ju.slice(0,Q).map(function(ie){return"sourceLoc."+ie}).join(",");throw Error("Slicing for rank "+Q+" is not yet supported")}(this.rank);p=` 5396 `+w+` sourceLoc; 5397 `+w+` coords = getOutputCoords(); 5398 `+x.map(function(Q,ie){return"sourceLoc."+Ju[ie]+" = start["+ie+"] + coords."+Ju[ie]+";"}).join(` 5399`)+` 5400 `,this.userCode=` 5401 `+D+` 5402 void main() { 5403 `+p+` 5404 setOutput(getSource(`+W+`)); 5405 } 5406 `}return C.prototype.getCustomSetupFunc=function(x){var p=this;if(x.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+x.length+")");return function(w,D){p.startLoc==null&&(p.startLoc=w.getUniformLocationNoThrow(D,"start"),p.startLoc==null)||w.gl.uniform1iv(p.startLoc,x)}},C}(),Ju=["x","y","z","w","u","v"],Xl=function(){function C(x){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=x,this.rank=x.length;var p=Vn(this.rank),w=H("coords",this.rank),D=H("sourceLoc",this.rank),W=this.rank===1?"sourceLoc":"vec2("+D.slice(-2).join()+")",Q="getChannel(getSource("+D.join()+"), "+W+")",ie=` 5407 result.x = `+Q+`; 5408 if (++`+w[this.rank-1]+" < "+x[this.rank-1]+`) { 5409 ++`+D[this.rank-1]+`; 5410 result.y = `+Q+`; 5411 --`+D[this.rank-1]+`; 5412 } 5413 `,fe=this.rank===1?"":` 5414 --`+w[this.rank-1]+`; 5415 if (++`+w[this.rank-2]+" < "+x[this.rank-2]+`) { 5416 ++`+D[this.rank-2]+`; 5417 result.z = `+Q+`; 5418 if (++`+w[this.rank-1]+" < "+x[this.rank-1]+`) { 5419 ++`+D[this.rank-1]+`; 5420 result.w = `+Q+`; 5421 } 5422 } 5423 `,ye=this.rank<=4?`sourceLoc = coords + 5424 `+p+"("+x.map(function(Oe,Re){return"start["+Re+"]"}).join()+");":x.map(function(Oe,Re){return D[Re]+" = "+w[Re]+" + start["+Re+"];"}).join(` 5425`);this.userCode=` 5426 uniform int start[`+this.rank+`]; 5427 void main() { 5428 `+p+` coords = getOutputCoords(); 5429 `+p+` sourceLoc; 5430 `+ye+` 5431 vec4 result = vec4(0.); 5432 `+ie+` 5433 `+fe+` 5434 setOutput(result); 5435 } 5436 `}return C.prototype.getCustomSetupFunc=function(x){var p=this;if(x.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+x.length+")");return function(w,D){p.startLoc==null&&(p.startLoc=w.getUniformLocationNoThrow(D,"start"),p.startLoc==null)||w.gl.uniform1iv(p.startLoc,x)}},C}(),xa=function(){function C(x){this.gpgpu=x,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return C.prototype.acquireTexture=function(x,p,w){var D,W=qs(p,w),Q=_s(x,W,w);if(Q in this.freeTextures||(this.freeTextures[Q]=[]),Q in this.usedTextures||(this.usedTextures[Q]=[]),this.freeTextures[Q].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var ie=this.freeTextures[Q].shift();return this.usedTextures[Q].push(ie),ie}return this.numUsedTextures++,this.log(),W===Zr.PACKED_2X2_FLOAT32?D=this.gpgpu.createPackedMatrixTexture(x[0],x[1]):W===Zr.PACKED_2X2_FLOAT16?D=this.gpgpu.createFloat16PackedMatrixTexture(x[0],x[1]):W===Zr.UNPACKED_FLOAT32?D=this.gpgpu.createFloat32MatrixTexture(x[0],x[1]):W===Zr.UNPACKED_FLOAT16?D=this.gpgpu.createFloat16MatrixTexture(x[0],x[1]):W===Zr.PACKED_4X1_UNSIGNED_BYTE&&(D=this.gpgpu.createUnsignedBytesMatrixTexture(x[0],x[1])),this.usedTextures[Q].push(D),D},C.prototype.releaseTexture=function(x,p,w,D){if(this.freeTextures!=null){var W=_s(p,qs(w,D),D);W in this.freeTextures||(this.freeTextures[W]=[]),this.freeTextures[W].push(x),this.numFreeTextures++,this.numUsedTextures--;var Q=this.usedTextures[W],ie=Q.indexOf(x);if(ie<0)throw new Error("Cannot release a texture that was never provided by this texture manager");
vendor: 26,004 bytes, lines 5436-5691
5436Q.splice(ie,1),this.log()}},C.prototype.log=function(){if(this.logEnabled){var x=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+x+")")}},C.prototype.getNumUsedTextures=function(){return this.numUsedTextures},C.prototype.getNumFreeTextures=function(){return this.numFreeTextures},C.prototype.dispose=function(){var x=this;if(this.freeTextures!=null){for(var p in this.freeTextures)this.freeTextures[p].forEach(function(w){x.gpgpu.deleteMatrixTexture(w)});for(var p in this.usedTextures)this.usedTextures[p].forEach(function(D){x.gpgpu.deleteMatrixTexture(D)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},C}();function qs(C,x){if(C===pr.UPLOAD)return Zr.PACKED_2X2_FLOAT32;if(C===pr.RENDER||C==null)return function(p){return L().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?p?Zr.PACKED_2X2_FLOAT32:Zr.UNPACKED_FLOAT32:p?Zr.PACKED_2X2_FLOAT16:Zr.UNPACKED_FLOAT16}(x);if(C===pr.DOWNLOAD||C===pr.PIXELS)return Zr.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type "+C)}function _s(C,x,p){return C[0]+"_"+C[1]+"_"+x+"_"+p}var Ol=1.7580993408473768,Of=1.0507009873554805,Oi=function(C,x){this.variableNames=["A"],this.outputShape=C,this.userCode=` 5437 float unaryOperation(float x) { 5438 `+x+` 5439 } 5440 5441 void main() { 5442 float x = getAAtOutCoords(); 5443 float y = unaryOperation(x); 5444 5445 setOutput(y); 5446 } 5447 `},qm="if (isnan(x)) return x;",Df="return x;",yd="return abs(x);",Wv=qm+` 5448 return (x < 0.0) ? 0.0 : x; 5449`,Vv=qm+` 5450 return (x < 0.0) ? 0.0 : min(6.0, x); 5451`,B0="return (x >= 0.0) ? x : (exp(x) - 1.0);",P0="return -x;",$v="return ceil(x);",j0="return floor(x);",Hv="return exp(x);",xh="return exp(x) - 1.0;",Gm="return x;",qv="return x;",Gv=` 5452 vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0))); 5453 bvec4 isNaN = isnan(x); 5454 5455 result.r = isNaN.r ? x.r : result.r; 5456 result.g = isNaN.g ? x.g : result.g; 5457 result.b = isNaN.b ? x.b : result.b; 5458 result.a = isNaN.a ? x.a : result.a; 5459 5460 return result; 5461`,Kv=` 5462 vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0))); 5463 bvec4 isNaN = isnan(x); 5464 5465 result.r = isNaN.r ? x.r : result.r; 5466 result.g = isNaN.g ? x.g : result.g; 5467 result.b = isNaN.b ? x.b : result.b; 5468 result.a = isNaN.a ? x.a : result.a; 5469 5470 return result; 5471`,Jl=` 5472 vec4 result; 5473 5474 result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0); 5475 result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0); 5476 result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0); 5477 result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0); 5478 5479 return result; 5480`,wh=function(C,x){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=C,this.userCode=` 5481 vec4 unaryOperation(vec4 x) { 5482 `+x+` 5483 } 5484 5485 void main() { 5486 vec4 x = getAAtOutCoords(); 5487 vec4 y = unaryOperation(x); 5488 5489 setOutput(y); 5490 } 5491 `},Km={};function L0(C,x){if(x===void 0&&(x=!1),C==="linear")return x?qv:Df;if(C==="relu")return x?Gv:Wv;if(C==="elu")return x?Jl:B0;if(C==="relu6")return x?Kv:Vv;if(C==="prelu")return x?Ci:ui;throw new Error("Activation "+C+" has not been implemented for the WebGL backend.")}var z0=600,g1=function(C){function x(p){var w,D=C.call(this)||this;if(D.pendingRead=new WeakMap,D.pendingDisposal=new WeakSet,D.dataRefCount=new WeakMap,D.numBytesInGPU=0,D.uploadWaitMs=0,D.downloadWaitMs=0,D.warnedAboutMemory=!1,D.pendingDeletes=0,D.disposed=!1,!L().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(p==null){var W=Ai(L().getNumber("WEBGL_VERSION"));D.binaryCache=((w=L().getNumber("WEBGL_VERSION"))in Km||(Km[w]={}),Km[w]),D.gpgpu=new Ia(W),D.canvas=W.canvas,D.gpgpuCreatedLocally=!0}else D.gpgpu=p,D.binaryCache={},D.gpgpuCreatedLocally=!1,D.canvas=p.gl.canvas;return D.textureManager=new xa(D.gpgpu),D.numMBBeforeWarning=L().global.screen==null?1024:L().global.screen.height*L().global.screen.width*window.devicePixelRatio*z0/1024/1024,D.texData=new gd(D,qe),D}return A(x,C),x.prototype.numDataIds=function(){return this.texData.numDataIds()+(this.cpuBackend?this.cpuBackend.numDataIds():0)-this.pendingDeletes},x.prototype.write=function(p,w,D){if(L().getBool("DEBUG")&&this.checkNumericalProblems(p),D==="complex64"&&p!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");var W={};return this.texData.set(W,{shape:w,dtype:D,values:p,usage:pr.UPLOAD}),W},x.prototype.move=function(p,w,D,W){if(L().getBool("DEBUG")&&this.checkNumericalProblems(w),W==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(p,{shape:D,dtype:W,values:w,usage:pr.UPLOAD})},x.prototype.readSync=function(p){var w=this.texData.get(p),D=w.values,W=w.dtype,Q=w.complexTensors,ie=w.slice,fe=w.shape,ye=w.isPacked;if(ie!=null){var Oe;Oe=ye?new wh(fe,Gm):new Oi(fe,Gm);var Re=this.runWebGLProgram(Oe,[{dataId:p,shape:fe,dtype:W}],W),Pe=this.readSync(Re.dataId);return this.disposeData(Re.dataId),Pe}if(D!=null)return this.convertAndCacheOnCPU(p);if(W==="string")return D;var je,Ge,rt=this.activeTimers!=null;return rt&&(je=fn()),Ge=W==="complex64"?Rc(Q.real.dataSync(),Q.imag.dataSync()):this.getValuesFromTexture(p),rt&&(this.downloadWaitMs+=fn()-je),this.convertAndCacheOnCPU(p,Ge)},x.prototype.read=function(p){return S(this,void 0,void 0,function(){var w,D,W,Q,ie,fe,ye,Oe,Re,Pe,je,Ge,rt,nt,lt,Nt,Rt,Pt,Kt,dn,bn,pn;return M(this,function(_n){switch(_n.label){case 0:if(this.pendingRead.has(p))return w=this.pendingRead.get(p),[2,new Promise(function(On){return w.push(On)})];if(D=this.texData.get(p),W=D.values,Q=D.shape,ie=D.slice,fe=D.dtype,ye=D.complexTensors,Oe=D.isPacked,ie!=null)return Re=void 0,Re=Oe?new wh(Q,Gm):new Oi(Q,Gm),Pe=this.runWebGLProgram(Re,[{dataId:p,shape:Q,dtype:fe}],fe),je=this.read(Pe.dataId),this.disposeData(Pe.dataId),[2,je];if(W!=null)return[2,this.convertAndCacheOnCPU(p)];if(!L().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&L().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return Ge=null,fe!=="complex64"&&L().get("WEBGL_BUFFER_SUPPORTED")&&(rt=this.decode(p),nt=this.texData.get(rt.dataId),Ge=(pn=this.gpgpu).createBufferFromTexture.apply(pn,[nt.texture].concat(Ji(Q)))),this.pendingRead.set(p,[]),fe==="complex64"?[3,2]:[4,this.gpgpu.createAndWaitForFence()];case 1:_n.sent(),_n.label=2;case 2:return fe!=="complex64"?[3,4]:[4,Promise.all([ye.real.data(),ye.imag.data()])];case 3:return Nt=_n.sent(),Rt=Nt[0],Pt=Nt[1],lt=Rc(Rt,Pt),[3,5];case 4:Ge==null?lt=this.getValuesFromTexture(p):(Kt=Ke(Q),lt=this.gpgpu.downloadFloat32MatrixFromBuffer(Ge,Kt)),_n.label=5;case 5:return rt!=null&&this.disposeData(rt.dataId),dn=this.convertAndCacheOnCPU(p,lt),bn=this.pendingRead.get(p),this.pendingRead.delete(p),bn.forEach(function(On){return On(dn)}),this.pendingDisposal.has(p)&&(this.pendingDisposal.delete(p),this.disposeData(p),this.pendingDeletes--),[2,dn]}})})},x.prototype.checkNumericalProblems=function(p){if(p!=null)for(var w=0;w<p.length;w++){var D=p[w];if(!Kr(D))throw L().getBool("WEBGL_RENDER_FLOAT32_CAPABLE")?Error("The value "+D+" cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'"):Error("The value "+D+" cannot be represented on this device.")}},x.prototype.getValuesFromTexture=function(p){var w,D=this.texData.get(p),W=D.shape,Q=D.dtype,ie=D.isPacked,fe=Ke(W);if(L().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){var ye=this.decode(p),Oe=this.texData.get(ye.dataId),Re=(w=this.gpgpu).downloadMatrixFromPackedTexture.apply(w,[Oe.texture].concat(Ji(W))).subarray(0,fe);return this.disposeData(ye.dataId),Re}var Pe=L().getBool("WEBGL_PACK")&&ie===!0,je=Pe?xl(W):W,Ge=Pe?new function(Nt){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=pr.DOWNLOAD;var Rt=ue();this.outputShape=Nt,this.userCode=` 5492 `+wt+` 5493 5494 void main() { 5495 ivec3 coords = getOutputCoords(); 5496 float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z)); 5497 `+Rt.output+` = encode_float(x); 5498 } 5499 `}(je):new function(Nt){this.variableNames=["A"],this.outTexUsage=pr.DOWNLOAD;var Rt=ue();this.outputShape=Nt,this.userCode=` 5500 `+wt+` 5501 5502 void main() { 5503 float x = getAAtOutCoords(); 5504 `+Rt.output+` = encode_float(x); 5505 } 5506 `}(je),rt=this.runWebGLProgram(Ge,[{shape:je,dtype:Q,dataId:p}],"float32"),nt=this.texData.get(rt.dataId),lt=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(nt.texture,nt.texShape[0],nt.texShape[1]).subarray(0,fe);return this.disposeData(rt.dataId),lt},x.prototype.time=function(p){return S(this,void 0,void 0,function(){var w,D,W,Q,ie,fe,ye;return M(this,function(Oe){switch(Oe.label){case 0:return w=this.activeTimers,D=[],W=!1,this.programTimersStack==null?(this.programTimersStack=D,W=!0):this.activeTimers.push(D),this.activeTimers=D,p(),Q=Mt(this.activeTimers.map(function(Re){return Re.query})).filter(function(Re){return Re!=null}),ie=Mt(this.activeTimers.map(function(Re){return Re.name})).filter(function(Re){return Re!=null}),this.activeTimers=w,W&&(this.programTimersStack=null),fe={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null},L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[4,Promise.all(Q)]:[3,2];case 1:return ye=Oe.sent(),fe.kernelMs=Ut(ye),fe.getExtraProfileInfo=function(){return ye.map(function(Re,Pe){return{name:ie[Pe],ms:Re}}).map(function(Re){return Re.name+": "+Re.ms}).join(", ")},[3,3];case 2:fe.kernelMs={error:"WebGL query timers are not supported in this environment."},Oe.label=3;case 3:return this.uploadWaitMs=0,this.downloadWaitMs=0,[2,fe]}})})},x.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},x.prototype.startTimer=function(){return L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:fn(),endMs:null}},x.prototype.endTimer=function(p){return L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),p):(p.endMs=fn(),p)},x.prototype.getQueryTime=function(p){return S(this,void 0,void 0,function(){var w;return M(this,function(D){return L().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[2,this.gpgpu.waitForQueryAndGetTime(p)]:[2,(w=p).endMs-w.startMs]})})},x.prototype.disposeData=function(p){if(!this.pendingDisposal.has(p)){if(this.pendingRead.has(p))return this.pendingDisposal.add(p),void this.pendingDeletes++;if(this.texData.has(p)){this.releaseGPUData(p);var w=this.texData.get(p).complexTensors;w!=null&&(w.real.dispose(),w.imag.dispose()),this.texData.delete(p)}}},x.prototype.releaseGPUData=function(p){var w=this.texData.get(p),D=w.texture,W=w.dtype,Q=w.texShape,ie=w.usage,fe=w.isPacked,ye=w.slice,Oe=ye&&ye.origDataId||p,Re=this.dataRefCount.get(Oe);Re>1?this.dataRefCount.set(Oe,Re-1):(this.dataRefCount.delete(Oe),D!=null&&(this.numBytesInGPU-=this.computeBytes(Q,W),this.textureManager.releaseTexture(D,Q,ie,fe)));var Pe=this.texData.get(p);Pe.texture=null,Pe.texShape=null,Pe.isPacked=!1,Pe.slice=null},x.prototype.getTexture=function(p){return this.uploadToGPU(p),this.texData.get(p).texture},x.prototype.getDataInfo=function(p){return this.texData.get(p)},x.prototype.getCPUBackend=function(){return L().getBool("WEBGL_CPU_FORWARD")?(this.cpuBackend==null&&(this.cpuBackend=qe.findBackend("cpu")),this.cpuBackend):null},x.prototype.shouldExecuteOnCPU=function(p,w){var D=this;return w===void 0&&(w=128),this.getCPUBackend()!=null&&p.every(function(W){return D.texData.get(W.dataId).texture==null&&W.size<w})},x.prototype.getGPGPUContext=function(){return this.gpgpu},x.prototype.complex=function(p,w){var D=this.makeOutput(p.shape,"complex64");return this.texData.get(D.dataId).complexTensors={real:qe.keep(p.clone()),imag:qe.keep(w.clone())},D},x.prototype.real=function(p){return this.texData.get(p.dataId).complexTensors.real.clone()},x.prototype.imag=function(p){return this.texData.get(p.dataId).complexTensors.imag.clone()},x.prototype.slice=function(p,w,D){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.slice(p,w,D);if(Ke(D)===0)return Qo([],D,p.dtype);var W=this.texData.get(p.dataId).isPacked,Q=ph(p.shape,w,D);if(W||!Q){var ie=L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Xl(D):new Ls(D),fe=ie.getCustomSetupFunc(w);return this.compileAndRun(ie,[p],null,fe)}return this.uploadToGPU(p.dataId),this.shallowSlice(p,w,D)},x.prototype.shallowSlice=function(p,w,D){var W=this.texData.get(p.dataId),Q=this.makeOutput(D,p.dtype),ie=this.texData.get(Q.dataId);Object.assign(ie,W),ie.shape=D,ie.dtype=p.dtype;var fe=Ip(w,p.strides);W.slice&&(fe+=W.slice.flatOffset),ie.slice={flatOffset:fe,origDataId:W.slice&&W.slice.origDataId||p.dataId};var ye=this.dataRefCount.get(ie.slice.origDataId)||1;return this.dataRefCount.set(ie.slice.origDataId,ye+1),Q},x.prototype.stridedSlice=function(p,w,D,W){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.stridedSlice(p,w,D,W);var Q=hd(w,D,W);if(Q.some(function(fe){return fe===0}))return Qo([],Q);var ie=new function(fe,ye,Oe){this.variableNames=["x"],this.outputShape=Oe;var Re=Oe.length,Pe=Vn(Oe.length),je=Vn(Oe.length),Ge="";if(Re===1)Ge="coords * strides + begin";else{var rt=0;Ge=Oe.map(function(nt,lt){return rt++,Oe.length===1?"coords * strides["+lt+"] + begin["+lt+"]":"coords["+(rt-1)+"] * strides["+lt+"] + begin["+lt+"]"}).join(",")}this.userCode=` 5507 `+Pe+" begin = "+Pe+"("+fe+`); 5508 `+Pe+" strides = "+Pe+"("+ye+`); 5509 5510 void main() { 5511 `+je+` coords = getOutputCoords(); 5512 setOutput(getX(`+Ge+`)); 5513 } 5514 `}(w,W,Q);return this.compileAndRun(ie,[p])},x.prototype.reverse=function(p,w){var D=L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(W,Q){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;var ie=W.length;if(ie>4)throw new Error("WebGL backend: Reverse of rank-"+ie+" tensor is not yet supported");this.outputShape=W;var fe=H("rc",ie),ye=fe[ie-1]+" + 1 < "+this.outputShape[ie-1],Oe=fe[ie-2]+" + 1 < "+this.outputShape[ie-2],Re=Vn(ie);function Pe(je){var Ge=W.map(function(rt,nt){return function(lt,Nt){return Q.indexOf(lt)!==-1&&W[lt]!==1?W[lt]+" - "+Nt[lt]+" - 1":""+Nt[lt]}(nt,je)});return"getChannel(getX("+Ge.join(",")+"), vec2("+Ge.slice(-2).join(",")+"))"}this.userCode=ie===1?` 5515 void main(){ 5516 int rc = getOutputCoords(); 5517 vec4 result = vec4(0.); 5518 result.r = getChannel(getX(`+W[0]+` - rc - 1), 5519 `+W[0]+` - rc - 1); 5520 if(`+ye+`){ 5521 result.g = getChannel(getX(`+W[0]+` - (rc + 1) - 1), 5522 `+W[0]+` - (rc + 1) - 1); 5523 } 5524 setOutput(result); 5525 } 5526 `:` 5527 void main() { 5528 `+Re+` rc = getOutputCoords(); 5529 vec4 result = vec4(0.); 5530 result.r = `+Pe(fe.slice())+`; 5531 if(`+ye+`){ 5532 result.g = `+function(je){return je[ie-1]="("+je[ie-1]+" + 1)",Pe(je)}(fe.slice())+`; 5533 } 5534 if(`+Oe+`) { 5535 result.b = `+function(je){return je[ie-2]="("+je[ie-2]+" + 1)",Pe(je)}(fe.slice())+`; 5536 if(`+ye+`) { 5537 result.a = `+function(je){return je[ie-1]="("+je[ie-1]+" + 1)",je[ie-2]="("+je[ie-2]+" + 1)",Pe(je)}(fe.slice())+`; 5538 } 5539 } 5540 setOutput(result); 5541 } 5542 `}(p.shape,w):new function(W,Q){this.variableNames=["x"];var ie=W.length;if(ie>4)throw new Error("WebGL backend: Reverse of rank-"+ie+" tensor is not yet supported");if(this.outputShape=W,ie!==1){var fe=W.map(function(Oe,Re){return function(Pe){return Q.indexOf(Pe)!==-1&&W[Pe]!==1?W[Pe]+" - coords["+Pe+"] - 1":"coords["+Pe+"]"}(Re)}).join(","),ye=Vn(ie);this.userCode=` 5543 void main() { 5544 `+ye+` coords = getOutputCoords(); 5545 setOutput(getX(`+fe+`)); 5546 } 5547 `}else this.userCode=` 5548 void main() { 5549 int coord = getOutputCoords(); 5550 setOutput(getX(`+W[0]+` - coord - 1)); 5551 } 5552 `}(p.shape,w);return this.compileAndRun(D,[p])},x.prototype.concat=function(p,w){if(p[0].dtype==="complex64"){var D=p.map(function(je){return qa(je)}),W=p.map(function(je){return Os(je)});return zo(this.concat(D,w),this.concat(W,w))}if(this.shouldExecuteOnCPU(p))return this.cpuBackend.concat(p,w);if(p.length===1)return p[0];if(p.length>L().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){var Q=Math.floor(p.length/2),ie=this.concat(p.slice(0,Q),w),fe=this.concat(p.slice(Q),w);return this.concat([ie,fe],w)}if(L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&p[0].rank>1){var ye=new function(je,Ge){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=sc(je,Ge);var rt=this.outputShape,nt=rt.length,lt=Vn(nt),Nt=H("coords",nt),Rt=["x","y","z","w","u","v"].slice(0,nt);this.variableNames=je.map(function(f,y){return"T"+y});var Pt=new Array(je.length-1);Pt[0]=je[0][Ge];for(var Kt=1;Kt<Pt.length;Kt++)Pt[Kt]=Pt[Kt-1]+je[Kt][Ge];var dn=Rt[Ge],bn=Rt.slice(-2),pn=Rt.join(),_n="if ("+dn+" < "+Pt[0]+`) { 5553 return getChannel( 5554 getT0(`+pn+"), vec2("+bn.join()+`)); 5555 }`;for(Kt=1;Kt<Pt.length;Kt++){var On=Pt[Kt-1];_n+=` 5556 if (`+dn+" < "+Pt[Kt]+" && "+dn+" >= "+Pt[Kt-1]+`) { 5557 return getChannel( 5558 getT`+Kt+"("+Co(Rt,dn,On)+`), 5559 vec2(`+Co(bn,dn,On)+`)); 5560 }`}var _=Pt.length,m=Pt[Pt.length-1];_n+=` 5561 return getChannel( 5562 getT`+_+"("+Co(Rt,dn,m)+`), 5563 vec2(`+Co(bn,dn,m)+"));",this.userCode=` 5564 float getValue(`+Rt.map(function(f){return"int "+f})+`) { 5565 `+_n+` 5566 } 5567 5568 void main() { 5569 `+lt+` coords = getOutputCoords(); 5570 vec4 result = vec4(getValue(`+Nt+`), 0., 0., 0.); 5571 5572 `+Nt[nt-1]+" = "+Nt[nt-1]+` + 1; 5573 if (`+Nt[nt-1]+" < "+rt[nt-1]+`) { 5574 result.g = getValue(`+Nt+`); 5575 } 5576 5577 `+Nt[nt-2]+" = "+Nt[nt-2]+` + 1; 5578 if (`+Nt[nt-2]+" < "+rt[nt-2]+`) { 5579 result.a = getValue(`+Nt+`); 5580 } 5581 5582 `+Nt[nt-1]+" = "+Nt[nt-1]+` - 1; 5583 if (`+Nt[nt-2]+" < "+rt[nt-2]+` && 5584 `+Nt[nt-1]+" < "+rt[nt-1]+`) { 5585 result.b = getValue(`+Nt+`); 5586 } 5587 setOutput(result); 5588 } 5589 `}(p.map(function(je){return je.shape}),w);return this.compileAndRun(ye,p)}var Oe=sc(p.map(function(je){return je.shape}),w),Re=p.map(function(je){return je.as2D(-1,Ke(je.shape.slice(w)))}),Pe=new function(je){this.outputShape=[],this.outputShape=sc(je,1),this.variableNames=je.map(function(Pt,Kt){return"T"+Kt});var Ge=new Array(je.length-1);Ge[0]=je[0][1];for(var rt=1;rt<Ge.length;rt++)Ge[rt]=Ge[rt-1]+je[rt][1];var nt=["if (yC < "+Ge[0]+") setOutput(getT0(yR, yC));"];for(rt=1;rt<Ge.length;rt++){var lt=Ge[rt-1];nt.push("else if (yC < "+Ge[rt]+") setOutput(getT"+rt+"(yR, yC-"+lt+"));")}var Nt=Ge.length,Rt=Ge[Ge.length-1];nt.push("else setOutput(getT"+Nt+"(yR, yC-"+Rt+"));"),this.userCode=` 5590 void main() { 5591 ivec2 coords = getOutputCoords(); 5592 int yR = coords.x; 5593 int yC = coords.y; 5594 5595 `+nt.join(` 5596 `)+` 5597 } 5598 `}(Re.map(function(je){return je.shape}));return this.compileAndRun(Pe,Re).reshape(Oe)},x.prototype.neg=function(p){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.neg(p);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(p,P0,p.dtype);var w=new Oi(p.shape,P0);return this.compileAndRun(w,[p])},x.prototype.batchMatMul=function(p,w,D,W){var Q=D?p.shape[2]:p.shape[1],ie=W?w.shape[1]:w.shape[2],fe=D?p.shape[1]:p.shape[2],ye=p.shape[0];if((Q===1||ie===1)&&fe>1e3){D&&(p=p.transpose([0,2,1])),W&&(w=w.transpose([0,2,1]));var Oe=ie===1?p:p.as3D(ye,fe,1),Re=ie===1?2:1,Pe=ie===1?w.as3D(ye,1,fe):w;return this.multiply(Oe,Pe).sum(Re,!0)}var je=kn(p.dtype,w.dtype),Ge=new fa(p.shape,[ye,Q,ie],D,W);return this.compileAndRun(Ge,[p,w],je)},x.prototype.fusedBatchMatMul=function(p){var w=p.a,D=p.b,W=p.transposeA,Q=p.transposeB,ie=p.bias,fe=p.activation,ye=p.preluActivationWeights,Oe=W?w.shape[2]:w.shape[1],Re=Q?D.shape[1]:D.shape[2],Pe=w.shape[0],je=kn(w.dtype,D.dtype),Ge=ie!=null,rt=ye!=null,nt=fe?L0(fe,!0):null,lt=new fa(w.shape,[Pe,Oe,Re],W,Q,Ge,nt,rt),Nt=[w,D];return ie&&Nt.push(ie),ye&&Nt.push(ye),this.compileAndRun(lt,Nt,je)},x.prototype.multiply=function(p,w){if(p.dtype==="complex64"){var D=this.texData.get(p.dataId),W=this.texData.get(w.dataId),Q=new Tr("return areal * breal - aimag * bimag;",p.shape,w.shape),ie=new Tr("return areal * bimag + aimag * breal;",p.shape,w.shape),fe=[this.makeComplexComponentTensorInfo(p,D.complexTensors.real),this.makeComplexComponentTensorInfo(p,D.complexTensors.imag),this.makeComplexComponentTensorInfo(w,W.complexTensors.real),this.makeComplexComponentTensorInfo(w,W.complexTensors.imag)],ye=this.compileAndRun(Q,fe),Oe=this.compileAndRun(ie,fe),Re=this.complex(ye,Oe);return ye.dispose(),Oe.dispose(),Re}if(this.shouldExecuteOnCPU([p,w]))return this.cpuBackend.multiply(p,w);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,Br,p.dtype);var Pe=new ii(Br,p.shape,w.shape);return this.compileAndRun(Pe,[p,w],p.dtype)},x.prototype.batchNormalization=function(p,w,D,W,Q,ie){var fe=[p,w,D],ye=null;ie!=null&&(ye=ie.shape,fe.push(ie));var Oe=null;if(Q!=null&&(Oe=Q.shape,fe.push(Q)),L().getBool("WEBGL_PACK_NORMALIZATION")){var Re=new function(je,Ge,rt,nt,lt,Nt){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],ho(je,Ge),ho(je,rt);var Rt="vec4(0.0)";nt!=null&&(ho(je,nt),this.variableNames.push("offset"),Rt="getOffsetAtOutCoords()");var Pt="vec4(1.0)";lt!=null&&(ho(je,lt),this.variableNames.push("scale"),Pt="getScaleAtOutCoords()"),this.outputShape=je,this.userCode=` 5599 void main() { 5600 vec4 offset = `+Rt+`; 5601 vec4 scale = `+Pt+`; 5602 5603 vec4 x = getXAtOutCoords(); 5604 vec4 mean = getMeanAtOutCoords(); 5605 vec4 variance = getVarianceAtOutCoords(); 5606 5607 vec4 inv = scale * inversesqrt(variance + vec4(`+Nt+`)); 5608 5609 setOutput((x - mean) * inv + offset); 5610 } 5611 `}(p.shape,w.shape,D.shape,ye,Oe,W);return this.compileAndRun(Re,fe)}var Pe=new function(je,Ge,rt,nt,lt,Nt){this.outputShape=[],this.variableNames=["x","mean","variance"],ho(je,Ge),ho(je,rt);var Rt="0.0";nt!=null&&(ho(je,nt),this.variableNames.push("offset"),Rt="getOffsetAtOutCoords()");var Pt="1.0";lt!=null&&(ho(je,lt),this.variableNames.push("scale"),Pt="getScaleAtOutCoords()"),this.outputShape=je,this.userCode=` 5612 void main() { 5613 float x = getXAtOutCoords(); 5614 float mean = getMeanAtOutCoords(); 5615 float variance = getVarianceAtOutCoords(); 5616 float offset = `+Rt+`; 5617 float scale = `+Pt+`; 5618 float inv = scale * inversesqrt(variance + float(`+Nt+`)); 5619 setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1))); 5620 } 5621 `}(p.shape,w.shape,D.shape,ye,Oe,W);return this.compileAndRun(Pe,fe)},x.prototype.localResponseNormalization4D=function(p,w,D,W,Q){var ie=L().getBool("WEBGL_PACK_NORMALIZATION")?new function(fe,ye,Oe,Re,Pe){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;var je,Ge=ye,rt=fe[3]-1;this.outputShape=fe;var nt="float("+Oe+") + float("+Re+") * sum";je=Pe===.5?"inversesqrt("+nt+")":Pe===1?"1.0/("+nt+")":"exp(log("+nt+") * float(-"+Pe+"));",this.userCode=` 5622 void main() { 5623 ivec4 coords = getOutputCoords(); 5624 int b = coords.x; 5625 int r = coords.y; 5626 int c = coords.z; 5627 int d = coords.w; 5628 5629 bool hasNextCol = d < `+this.outputShape[3]+`; 5630 bool hasNextRow = c < `+this.outputShape[2]+`; 5631 5632 vec4 sum = vec4(0.); 5633 vec4 xFragAtOutputCoords = getX(b, r, c, d); 5634 5635 vec4 xAtOutputCoords = vec4( 5636 getChannel(xFragAtOutputCoords, vec2(c, d)), 5637 hasNextCol ? 5638 getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0, 5639 hasNextRow ? 5640 getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0, 5641 (hasNextRow && hasNextCol) ? 5642 getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0 5643 ); 5644 5645 int firstChannel = d - `+Ge+`; 5646 vec2 cache = vec2(0.); 5647 if(firstChannel >= 0){ 5648 vec4 firstChannelFrag = getX(b, r, c, firstChannel); 5649 cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel)); 5650 if(hasNextRow){ 5651 cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel)); 5652 } 5653 } 5654 5655 ivec2 depth = ivec2(d, d + 1); 5656 for (int j = - `+Ge+"; j <= "+Ge+`; j++) { 5657 ivec2 idx = depth + j; 5658 bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0)); 5659 bvec2 belowUpperBound = lessThanEqual(idx, ivec2(`+rt+`)); 5660 5661 bool depthInRange = aboveLowerBound.x && belowUpperBound.x; 5662 bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y; 5663 5664 if(depthInRange || depthPlusOneInRange){ 5665 vec4 z = vec4(0.); 5666 vec4 xFragAtCurrentDepth; 5667 z.xz = cache.xy; 5668 if(depthPlusOneInRange && hasNextCol){ 5669 xFragAtCurrentDepth = idx.y != d ? 5670 getX(b, r, c, idx.y) : xFragAtOutputCoords; 5671 z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y)); 5672 if(hasNextRow){ 5673 z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y)); 5674 } 5675 } 5676 cache.xy = z.yw; 5677 sum += z * z; 5678 } 5679 } 5680 vec4 result = xAtOutputCoords * `+je+`; 5681 setOutput(result); 5682 } 5683 `}(p.shape,w,D,W,Q):new function(fe,ye,Oe,Re,Pe){this.variableNames=["x"],this.outputShape=[];var je,Ge=ye,rt=fe[3]-1;this.outputShape=fe;var nt="float("+Oe+") + float("+Re+") * sum";je=Pe===.5?"inversesqrt("+nt+")":Pe===1?"1.0/("+nt+")":"exp(log("+nt+") * float(-"+Pe+"));",this.userCode=` 5684 void main() { 5685 ivec4 coords = getOutputCoords(); 5686 int b = coords[0]; 5687 int r = coords[1]; 5688 int c = coords[2]; 5689 int d = coords[3]; 5690 float x = getX(b, r, c, d); 5691 float sum = 0.0;
5692 for (int j = -`+Ge+"; j <= "+Ge+`; j++) { 5693 int idx = d + j; 5694 if (idx >= 0 && idx <= `+rt+`) { 5695 float z = getX(b, r, c, idx); 5696 sum += z * z; 5697 } 5698 } 5699 float val = x * `+je+`; 5700 setOutput(val); 5701 } 5702 `}(p.shape,w,D,W,Q);return this.compileAndRun(ie,[p])},x.prototype.LRNGrad=function(p,w,D,W,Q,ie,fe){var ye=new function(Oe,Re,Pe,je,Ge){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=Oe,this.depth=Oe[3],this.depthRadius=Re,this.bias=Pe,this.alpha=je,this.beta=Ge,this.userCode=` 5703 void main() { 5704 ivec4 coords = getOutputCoords(); 5705 int b = coords[0]; 5706 int r = coords[1]; 5707 int c = coords[2]; 5708 5709 float result = 0.0; 5710 for (int d = 0; d < `+this.depth+`; ++d) { 5711 int depthBegin = int(max(0.0, float(d - `+Re+`))); 5712 int depthEnd = int(min(float(`+this.depth+`), 5713 float(d + `+Re+` + 1))); 5714 5715 const int MIN_DEPTH_BEGIN = 0; 5716 const int MAX_DEPTH_END = `+this.depth+`; 5717 5718 float norm = 0.0; 5719 for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) { 5720 if (k < depthBegin){ 5721 continue; 5722 } 5723 else if (k >= depthBegin && k < depthEnd) { 5724 norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k); 5725 } 5726 else { 5727 break; 5728 } 5729 } 5730 5731 norm = float(`+je+") * norm + float("+Pe+`); 5732 5733 for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){ 5734 if (k < depthBegin){ 5735 continue; 5736 } 5737 else if (k >= depthBegin && k < depthEnd){ 5738 float dyi = -2.0 * float(`+je+`) 5739 * float(`+Ge+`) 5740 * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d) 5741 / norm; 5742 if (k == d) { 5743 dyi += pow(norm, -1.0 * `+Ge+`); 5744 } 5745 if (k == coords[3]) { 5746 dyi *= getDy(b, r, c, d); 5747 result += dyi; 5748 } 5749 } 5750 else { 5751 break; 5752 } 5753 } 5754 } 5755 setOutput(result); 5756 } 5757 `}(w.shape,W,Q,ie,fe);return this.compileAndRun(ye,[w,D,p])},x.prototype.tile=function(p,w){if(p.dtype==="string"){var D=this.readSync(p.dataId).map(function(Q){return Ar(Q)});return bh(Qi(p.shape,p.dtype,D),w)}var W=new function(Q,ie){this.variableNames=["A"];for(var fe=new Array(Q.length),ye=0;ye<fe.length;ye++)fe[ye]=Q[ye]*ie[ye];this.outputShape=fe,this.rank=fe.length;var Oe=Vn(this.rank),Re=function(Pe){var je=Pe.length;if(je>5)throw Error("Tile for rank "+je+" is not yet supported");if(je===1)return"imod(resRC, "+Pe[0]+")";for(var Ge=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],rt=[],nt=0;nt<Pe.length;nt++)rt.push("imod("+Ge[nt]+", "+Pe[nt]+")");return rt.join()}(Q);this.userCode=` 5758 void main() { 5759 `+Oe+` resRC = getOutputCoords(); 5760 setOutput(getA(`+Re+`)); 5761 } 5762 `}(p.shape,w);return this.compileAndRun(W,[p])},x.prototype.pad=function(p,w,D){var W=L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(Q,ie,fe){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=ie.map(function(dn,bn){return dn[0]+Q[bn]+dn[1]});for(var ye=Q.length,Oe=Vn(ye),Re=ie.map(function(dn){return dn[0]}).join(","),Pe=ie.map(function(dn,bn){return dn[0]+Q[bn]}).join(","),je=H("rc",ye),Ge=H("source",ye),rt=je[ye-1]+" < "+this.outputShape[ye-1],nt=ye===1?"source":"vec2("+Ge.slice(-2).join()+")",lt=[Oe+" rc = outputLoc;",je[ye-1]+` += 1; 5763 if(`+rt+`) { 5764 `,ye===1?"":`} 5765 rc = outputLoc; 5766 `+je[ye-2]+` += 1; 5767 if(`+je[ye-2]+" < "+this.outputShape[ye-2]+") {",ye===1?"":" "+je[ye-1]+` += 1; 5768 if(`+rt+") {"],Nt=ye===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",Rt="",Pt=0,Kt=ye===1?2:4;Pt<Kt;Pt++)Rt+=` 5769 `+lt[Pt]+` 5770 if (`+Nt+`) { 5771 result[`+Pt+"] = float("+fe+`); 5772 } else { 5773 `+Oe+` source = rc - start; 5774 result[`+Pt+"] = getChannel(getX("+Ge.join()+"), "+nt+`); 5775 } 5776 `;Rt+=ye===1?"} ":"}}",this.userCode=` 5777 const `+Oe+" start = "+Oe+"("+Re+`);
5778 const `+Oe+" end = "+Oe+"("+Pe+`); 5779 5780 void main() { 5781 `+Oe+` outputLoc = getOutputCoords(); 5782 vec4 result = vec4(0.); 5783 `+Rt+` 5784 setOutput(result); 5785 } 5786 `}(p.shape,w,D):new function(Q,ie,fe){this.variableNames=["x"],this.outputShape=ie.map(function(Ge,rt){return Ge[0]+Q[rt]+Ge[1]});var ye=Q.length,Oe=Vn(ye),Re=ie.map(function(Ge){return Ge[0]}).join(","),Pe=ie.map(function(Ge,rt){return Ge[0]+Q[rt]}).join(","),je=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,ye);this.userCode=ye!==1?` 5787 `+Oe+" start = "+Oe+"("+Re+`); 5788 `+Oe+" end = "+Oe+"("+Pe+`); 5789 5790 void main() { 5791 `+Oe+` outC = getOutputCoords(); 5792 if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) { 5793 setOutput(float(`+fe+`)); 5794 } else { 5795 `+Oe+` coords = outC - start; 5796 setOutput(getX(`+je+`)); 5797 } 5798 } 5799 `:` 5800 int start = `+Re+`; 5801 int end = `+Pe+`; 5802 5803 void main() { 5804 int outC = getOutputCoords(); 5805 if (outC < start || outC >= end) { 5806 setOutput(float(`+fe+`)); 5807 } else { 5808 setOutput(getX(outC - start)); 5809 } 5810 } 5811 `}(p.shape,w,D);return this.compileAndRun(W,[p])},x.prototype.transpose=function(p,w){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.transpose(p,w);var D=L().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(W,Q){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;for(var ie=new Array(W.length),fe=0;fe<ie.length;fe++)ie[fe]=W[Q[fe]];if(this.outputShape=ie,this.rank=ie.length,this.rank>6)throw Error("Packed transpose for rank "+this.rank+" is not yet supported.");var ye=Vn(this.rank),Oe=B("rc",this.rank),Re=new Array(this.rank);for(fe=0;fe<Q.length;fe++)Re[Q[fe]]=Oe[fe];var Pe="vec2("+Re.slice(-2).join()+")",je="++"+Oe[this.rank-1]+" < "+ie[this.rank-1],Ge="getChannel(getA("+Re.join()+"), "+Pe+")";this.userCode=` 5812 void main() { 5813 `+ye+` rc = getOutputCoords(); 5814 vec4 result = vec4(0.); 5815 result[0] = `+Ge+`; 5816 if(`+je+`) { 5817 result[1] = `+Ge+`; 5818 } 5819 --`+Oe[this.rank-1]+`; 5820 if(++`+Oe[this.rank-2]+" < "+ie[this.rank-2]+`) { 5821 result[2] = `+Ge+`; 5822 if(`+je+`) { 5823 result[3] = `+Ge+`; 5824 } 5825 } 5826 setOutput(result); 5827 } 5828 `}(p.shape,w):new function(W,Q){this.variableNames=["A"];for(var ie=new Array(W.length),fe=0;fe<ie.length;fe++)ie[fe]=W[Q[fe]];this.outputShape=ie,this.rank=ie.length;var ye=Vn(this.rank),Oe=function(Re){var Pe=Re.length;if(Pe>6)throw Error("Transpose for rank "+Pe+" is not yet supported");for(var je=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],Ge=new Array(Pe),rt=0;rt<Re.length;rt++)Ge[Re[rt]]=je[rt];return Ge.join()}(Q);this.userCode=` 5829 void main() { 5830 `+ye+` resRC = getOutputCoords(); 5831 setOutput(getA(`+Oe+`)); 5832 } 5833 `}(p.shape,w);return this.compileAndRun(D,[p])},x.prototype.gather=function(p,w,D){if(this.shouldExecuteOnCPU([p,w]))return this.cpuBackend.gather(p,w,D);var W=new function(Q,ie,fe){this.variableNames=["A","indices"];var ye=Q.slice();ye[fe]=ie,this.outputShape=ye,this.rank=ye.length;var Oe=Vn(this.rank),Re=function(Pe,je){var Ge=Pe.length;if(Ge>4)throw Error("Gather for rank "+Ge+" is not yet supported");if(Ge===1)return"int(getIndices(resRC))";for(var rt=["resRC.x","resRC.y","resRC.z","resRC.w"],nt=[],lt=0;lt<Pe.length;lt++)lt===je?nt.push("int(getIndices("+rt[lt]+"))"):nt.push(""+rt[lt]);return nt.join()}(Q,fe);this.userCode=` 5834 void main() { 5835 `+Oe+` resRC = getOutputCoords(); 5836 setOutput(getA(`+Re+`)); 5837 } 5838 `}(p.shape,w.size,D);return this.compileAndRun(W,[p,w])},x.prototype.batchToSpaceND=function(p,w,D){Ee(p.rank<=4,function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"});var W=w.reduce(function(Re,Pe){return Re*Pe}),Q=tl(p.shape,w,W),ie=fh(Q.length,w.length),fe=dh(p.shape,w,W),ye=kf(D,w.length),Oe=zm(fe,D,w.length);return p.reshape(Q).transpose(ie).reshape(fe).slice(ye,Oe)},x.prototype.spaceToBatchND=function(p,w,D){Ee(p.rank<=4,function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"});var W=w.reduce(function(Pe,je){return Pe*je}),Q=[[0,0]];Q.push.apply(Q,D);for(var ie=1+w.length;ie<p.shape.length;++ie)Q.push([0,0]);var fe=p.pad(Q),ye=tl(fe.shape,w,W,!1),Oe=fh(ye.length,w.length,!1),Re=dh(fe.shape,w,W,!1);return fe.reshape(ye).transpose(Oe).reshape(Re)},x.prototype.reduce=function(p,w,D){var W=p.shape[0],Q=p.shape[1],ie=new function(ye,Oe){this.variableNames=["x"];var Re=ye.windowSize,Pe=ye.batchSize,je=ye.inSize,Ge=Math.ceil(je/Re);this.outputShape=[Pe,Ge];var rt="0.0",nt="";Oe==="prod"?rt="1.0":Oe==="min"?(rt="1.0 / 1e-20",nt="min"):Oe==="max"&&(rt="-1.0 / 1e-20",nt="max");
vendor: 4,376 bytes, lines 5838-5943
5838var lt=Oe+"("+Oe+"("+Oe+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";Oe==="sum"?lt="sumValue":Oe==="prod"?lt="prodValue":Oe==="all"?lt="allValue":Oe==="any"&&(lt="anyValue");var Nt=4*Math.floor(Re/4),Rt=Re%4,Pt=` 5839 if (`+(Oe==="sum")+`) { 5840 sumValue += dot(values, ones); 5841 } else if (`+(Oe==="prod")+`) { 5842 vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]); 5843 prodValue *= tmp[0] * tmp[1]; 5844 } else { 5845 minMaxValue = `+nt+`(values, minMaxValue); 5846 } 5847 `,Kt="vec4";Oe==="all"?(rt="1.0",Pt=` 5848 bool reducedAllValue = all(values); 5849 float floatedReducedAllValue = float(reducedAllValue); 5850 allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0); 5851 `,Kt="bvec4"):Oe==="any"&&(rt="0.0",Pt=` 5852 bool reducedAnyValue = any(values); 5853 float floatedReducedAnyValue = float(reducedAnyValue); 5854 anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0); 5855 `,Kt="bvec4");var dn="";je%Re>0&&(dn=` 5856 if (inIdx < 0 || inIdx >= `+je+`) { 5857 return initializationValue; 5858 } 5859 `),this.userCode=` 5860 const float initializationValue = `+rt+`; 5861 const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0); 5862 5863 float getValue(int batch, int inIdx) { 5864 `+dn+` 5865 return getX(batch, inIdx); 5866 } 5867 5868 void main() { 5869 ivec2 coords = getOutputCoords(); 5870 int batch = coords[0]; 5871 int outIdx = coords[1]; 5872 int inOffset = outIdx * `+Re+`; 5873 5874 vec4 minMaxValue = vec4(`+rt+`); 5875 float prodValue = 1.0; 5876 float sumValue = 0.0; 5877 float allValue = 1.0; 5878 float anyValue = 0.0; 5879 5880 for (int i = 0; i < `+Nt+`; i += 4) { 5881 int inIdx = inOffset + i; 5882 `+Kt+" values = "+Kt+`( 5883 getValue(batch, inIdx), 5884 getValue(batch, inIdx + 1), 5885 getValue(batch, inIdx + 2), 5886 getValue(batch, inIdx + 3) 5887 ); 5888 5889 `+Pt+` 5890 } 5891 5892 int inIdx = inOffset + `+Nt+`; 5893 if (`+(Rt===1)+`) { 5894 `+Kt+" values = "+Kt+`( 5895 getValue(batch, inIdx), 5896 initializationValue, 5897 initializationValue, 5898 initializationValue 5899 ); 5900 5901 `+Pt+` 5902 } else if (`+(Rt===2)+`) { 5903 `+Kt+" values = "+Kt+`( 5904 getValue(batch, inIdx), 5905 getValue(batch, inIdx + 1), 5906 initializationValue, 5907 initializationValue 5908 ); 5909 5910 `+Pt+` 5911 } else if (`+(Rt===3)+`) { 5912 `+Kt+" values = "+Kt+`( 5913 getValue(batch, inIdx), 5914 getValue(batch, inIdx + 1), 5915 getValue(batch, inIdx + 2), 5916 initializationValue 5917 ); 5918 5919 `+Pt+` 5920 } 5921 setOutput(`+lt+`); 5922 } 5923 `}({windowSize:dd(Q),inSize:Q,batchSize:W},w),fe=this.compileAndRun(ie,[p],D);return fe.shape[1]===1?fe:this.reduce(fe,w,D)},x.prototype.argReduce=function(p,w,D){D===void 0&&(D=null);var W=p.shape[0],Q=p.shape[1];D!=null&&(W=D.shape[0],Q=D.shape[1]);var ie=new function(Oe,Re,Pe){this.variableNames=["A"];var je=Oe.windowSize,Ge=Oe.batchSize,rt=Oe.inSize,nt=Math.ceil(rt/je);Pe||this.variableNames.push("bestIndicesA"),this.outputShape=[Ge,nt];var lt=Re==="max"?">":"<",Nt=Pe?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=` 5924 void main() { 5925 ivec2 coords = getOutputCoords(); 5926 int batch = coords[0]; 5927 int outIdx = coords[1]; 5928 int inOffset = outIdx * `+je+`; 5929 5930 int bestIndex = inOffset; 5931 float bestValue = getA(batch, bestIndex); 5932 5933 for (int i = 0; i < `+je+`; i++) { 5934 int inIdx = `+Nt+`; 5935 float candidate = getA(batch, inIdx); 5936 if (candidate `+lt+` bestValue) { 5937 bestValue = candidate; 5938 bestIndex = inIdx; 5939 } 5940 } 5941 setOutput(float(bestIndex)); 5942 } 5943 `}({windowSize:dd(Q),inSize:Q,batchSize:W},w,D==null),fe=[p];D!=null&&fe.push(D);var ye=this.compileAndRun(ie,fe,"int32");return ye.shape[1]===1?ye:this.argReduce(p,w,ye)},x.prototype.argReducePacked=function(p,w,D){D===void 0&&(D=null);var W=D!=null?D.shape:p.shape,Q=new function(ye,Oe,Re,Pe){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,Ee(ye.length>2,function(){return"Packed arg"+(Re.charAt(0).toUpperCase()+Re.slice(1))+" supports only input
5943s with rank above 2."});var je=ye[ye.length-1],Ge=Math.ceil(je/Oe);this.outputShape=ye.slice(0,-1),Ge>1&&this.outputShape.push(Ge),Pe||this.variableNames.push("bestIndicesA");var rt,nt,lt=this.outputShape,Nt=lt.length,Rt=Vn(Nt),Pt=H("coords",Nt);if(Ge===1){var Kt=Vn(nt=Nt+1);rt=` 5944 `+Kt+" sourceLocR = "+Kt+"("+Pt.join()+`, 0); 5945 ++`+Pt[Nt-1]+`; 5946 `+Kt+" sourceLocG = "+Kt+"("+Pt.join()+`, 0); 5947 ++`+Pt[Nt-2]+`; 5948 `+Kt+" sourceLocA = "+Kt+"("+Pt.join()+`, 0); 5949 --`+Pt[Nt-1]+`; 5950 `+Kt+" sourceLocB = "+Kt+"("+Pt.join()+`, 0); 5951 --`+Pt[Nt-2]+";"}else nt=Nt,rt=` 5952 `+Rt+` sourceLocR = coords; 5953 ++`+Pt[Nt-1]+`; 5954 `+Rt+` sourceLocG = coords; 5955 ++`+Pt[Nt-2]+`; 5956 `+Rt+` sourceLocA = coords; 5957 --`+Pt[Nt-1]+`; 5958 `+Rt+` sourceLocB = coords; 5959 --`+Pt[Nt-2]+";";var dn=["x","y","z","w","u","v"].slice(0,nt),bn="."+dn[nt-1],pn=dn.map(function(Y){return"int "+Y}),_n=H("sourceLocR",nt-1).concat("inIdx.r"),On=H("sourceLocG",nt-1).concat("inIdx.g"),_=H("sourceLocB",nt-1).concat("inIdx.b"),m=H("sourceLocA",nt-1).concat("inIdx.a"),f=Re==="max"?"greaterThan":"lessThan",y=Pe?"":` 5960 inIdx = round(vec4(getBestIndicesAChannel(`+_n.join()+`), 5961 getBestIndicesAChannel(`+On.join()+`), 5962 getBestIndicesAChannel(`+_.join()+`), 5963 getBestIndicesAChannel(`+m.join()+")));",E=`vec4( 5964 getAChannel(`+_n.join()+`), 5965 hasNextCol ? getAChannel(`+On.join()+`) : 0., 5966 hasNextRow ? getAChannel(`+_.join()+`) : 0., 5967 hasNextRow && hasNextCol ? getAChannel(`+m.join()+") : 0.)",z=Pe?"":` 5968 float getBestIndicesAChannel(`+pn.join()+`) { 5969 return getChannel(getBestIndicesA(`+dn.join()+`), 5970 vec2(`+dn.slice(-2).join()+`)); 5971 }`;this.userCode=` 5972 float getAChannel(`+pn.join()+`) { 5973 return getChannel(getA(`+dn.join()+`), 5974 vec2(`+dn.slice(-2).join()+`)); 5975 } 5976 `+z+` 5977 void main() { 5978 `+Rt+` coords = getOutputCoords(); 5979 bool hasNextCol = `+Pt[Nt-1]+" < "+(lt[Nt-1]-1)+`; 5980 bool hasNextRow = `+Pt[Nt-2]+" < "+(lt[Nt-2]-1)+`; 5981 `+rt+` 5982 ivec4 srcIdx = ivec4(sourceLocR`+bn+", sourceLocG"+bn+`, 5983 sourceLocB`+bn+", sourceLocA"+bn+") * "+Oe+`; 5984 ivec4 inIdx = srcIdx; 5985 vec4 bestIndex = vec4(inIdx); 5986 vec4 bestValue = `+E+`; 5987 5988 for (int i = 0; i < `+Oe+`; i++) { 5989 inIdx = srcIdx; 5990 `+y+` 5991 vec4 candidate = `+E+`; 5992 bvec4 nan = isnan(candidate); 5993 bvec4 replace = bvec4( 5994 vec4(`+f+`(candidate, bestValue)) * (vec4(1.0) - vec4(nan))); 5995 5996 bestValue = vec4(replace.x ? candidate.x : bestValue.x, 5997 replace.y ? candidate.y : bestValue.y, 5998 replace.z ? candidate.z : bestValue.z, 5999 replace.w ? candidate.w : bestValue.w); 6000 bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace)); 6001 srcIdx++; 6002 } 6003 setOutput(bestIndex); 6004 } 6005 `}(W,dd(W[W.length-1]),w,D==null),ie=D==null?[p]:[p,D],fe=this.compileAndRun(Q,ie,"int32");return fe.rank===p.rank?this.argReducePacked(p,w,fe):fe},x.prototype.sum=function(p,w){Aa("sum",w,p.rank);var D=ra(p.shape,w),W=D[0],Q=Ke(D[1]),ie=p.as2D(-1,Q),fe=rr(p.dtype);return this.reduce(ie,"sum",fe).reshape(W)},x.prototype.prod=function(p,w){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.prod(p,w);var D=ra(p.shape,w),W=D[0],Q=Ke(D[1]),ie=p.as2D(-1,Q),fe=rr(p.dtype);return this.reduce(ie,"prod",fe).reshape(W)},x.prototype.unsortedSegmentSum=function(p,w,D){var W=0,Q=fs([W],p.rank),ie=p;Q!=null&&(ie=p.transpose(Q),W=ds(1,p.rank)[0]);var fe=function(je,Ge,rt){for(var nt=[],lt=je.length,Nt=0;Nt<lt;Nt++)Nt!==Ge?nt.push(je[Nt]):nt.push(rt);return nt}(ie.shape,W,D),ye=Ke([ie.shape[W]]),Oe=ie.as2D(-1,ye),Re=rr(p.dtype),Pe=this.segOpCompute(Oe,"unsortedSegmentSum",w,Re,D).reshape(fe);return Q!=null&&(Pe=Pe.transpose(Ic(Q))),Pe},x.prototype.segOpCompute=function(p,w,D,W,Q){var ie=p.shape[0],fe=p.shape[1],ye=function(Pe,je){var Ge,rt=!1;for(Pe<=Um?(Ge=Pe,rt=!0):Ge=nr(Pe,Math.floor(Math.sqrt(Pe)));!rt;)Ge>je||Ge===Pe?rt=!0:Ge=nr(Pe,Ge+1);return Ge}(fe,Q),Oe=new function(Pe,je){this.variableNames=["x","segmentIds"];var Ge=Pe.windowSize,rt=Pe.batchSize,nt=Pe.inSize,lt=Pe.numSegments,Nt=lt*Math.ceil(nt/Ge);this.outputShape=[rt,Nt];var Rt=4*Math.floor(Ge/4),Pt=Ge%4,Kt=` 6006 sumValue += dot(values, segFilter); 6007 `,dn="";nt%Ge>0&&(dn=` 6008 if (inIdx < 0 || inIdx >= `+nt+`) { 6009 return initializationValue; 6010 } 6011 `);var bn="";nt%Ge>0&&(bn=` 6012 if (inIdx < 0 || inIdx >= `+nt+`) { 6013 return -1.0; 6014 } 6015 `),this.userCode=` 6016 const float initializationValue = 0.0; 6017 6018 float getValue(int batch, int inIdx) { 6019 `+dn+` 6020 return getX(batch, inIdx); 6021 } 6022 6023 float getSegmentIdAtIndex(int inIdx) { 6024 `+bn+` 6025 return getSegmentIds(inIdx); 6026 } 6027 6028 void main() { 6029 ivec2 coords = getOutputCoords(); 6030 int batch = coords[0]; 6031 int outIdx = coords[1]; 6032 int inOffset = int(floor(float(outIdx) / float( 6033 `+lt+")) * float("+Ge+`)); 6034 int currentSeg = int(mod(float(outIdx), float(`+lt+`))); 6035 6036 float sumValue = 0.0; 6037 6038 for (int i = 0; i < `+Rt+`; i += 4) { 6039 int inIdx = inOffset + i; 6040 vec4 values = vec4( 6041 getValue(batch, inIdx), 6042 getValue(batch, inIdx + 1), 6043 getValue(batch, inIdx + 2), 6044 getValue(batch, inIdx + 3) 6045 ); 6046 6047 vec4 segFilter = vec4( 6048 int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0, 6049 int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0, 6050 int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0, 6051 int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0 6052 ); 6053 6054 `+Kt+` 6055 } 6056 6057 int inIdx = inOffset + `+Rt+`; 6058 if (`+(Pt===1)+`) { 6059 vec4 values = vec4( 6060 getValue(batch, inIdx), 6061 initializationValue, 6062 initializationValue, 6063 initializationValue 6064 ); 6065 6066 int inIdxSeg = int(getSegmentIdAtIndex(inIdx)); 6067 6068 vec4 segFilter = vec4( 6069 int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0, 6070 0, 6071 0, 6072 0 6073 ); 6074 6075 `+Kt+` 6076 } else if (`+(Pt===2)+`) { 6077 vec4 values = vec4( 6078 getValue(batch, inIdx), 6079 getValue(batch, inIdx + 1), 6080 initializationValue, 6081 initializationValue 6082 ); 6083 6084 vec4 segFilter = vec4( 6085 int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0, 6086 int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0, 6087 0, 6088 0 6089 ); 6090 6091 `+Kt+` 6092 } else if (`+(Pt===3)+`) { 6093 vec4 values = vec4( 6094 getValue(batch, inIdx), 6095 getValue(batch, inIdx + 1), 6096 getValue(batch, inIdx + 2), 6097 initializationValue 6098 ); 6099 6100 vec4 segFilter = vec4( 6101 int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0, 6102 int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0, 6103 int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0, 6104 0 6105 ); 6106 6107 `+Kt+` 6108 } 6109 setOutput(sumValue); 6110 } 6111 `}({windowSize:ye,inSize:fe,batchSize:ie,numSegments:Q}),Re=this.compileAndRun(Oe,[p,D],W);return Re.shape[1]===Q?Re:(D=kl(0,Q).tile([fe/ye]),this.segOpCompute(Re,w,D,W,Q))},x.prototype.argMinMaxReduce=function(p,w,D){var W=[w];if(Aa("arg"+D.charAt(0).toUpperCase()+D.slice(1),W,p.rank),!L().getBool("WEBGL_PACK_REDUCE")||p.rank<=2){var Q=ra(p.shape,W),ie=Q[0],fe=Ke(Q[1]),ye=p.as2D(-1,fe);return this.argReduce(ye,D).reshape(ie)}return this.argReducePacked(p,D)},x.prototype.argMin=function(p,w){return this.argMinMaxReduce(p,w,"min")},x.prototype.argMax=function(p,w){return this.argMinMaxReduce(p,w,"max")},x.prototype.cumsum=function(p,w,D,W){if(w!==p.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(p.rank-1)+" but got axis="+w);var Q=new function(ie,fe,ye){this.variableNames=["x"],this.outputShape=ie;var Oe=ie.length,Re=ie[ie.length-1],Pe=ye?"<":">";this.userCode=` 6112 int getIndex(int i) { 6113 `+(ye?"return "+Re+" -i - 1;":"return i;")+` 6114 } 6115 6116 void main() { 6117 `+Vn(Oe)+` coords = getOutputCoords(); 6118 int end = `+So(Oe,"coords")+`; 6119 float val = 0.0; 6120 for (int i = `+Re+` - 1; i >= 0; i -= 1) { 6121 int idx = getIndex(i); 6122 if (idx `+Pe+` end) { 6123 continue; 6124 } 6125 if (idx == end && `+fe+`) { 6126 continue; 6127 } 6128 `+So(Oe,"coords")+` = idx; 6129 val += getX(`+function(je,Ge){if(je===1)return""+Ge;if(je===2)return Ge+".x, "+Ge+".y";if(je===3)return Ge+".x, "+Ge+".y, "+Ge+".z";if(je===4)return Ge+".x, "+Ge+".y, "+Ge+".z, "+Ge+".w";throw Error("Cumulative sum for rank "+je+" is not yet supported")}(Oe,"coords")+`); 6130 } 6131 setOutput(val); 6132 } 6133 `}(p.shape,D,W);return this.compileAndRun(Q,[p])},x.prototype.equal=function(p,w){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6134 return vec4(equal(a, b)); 6135`,"bool");var D=new ii("return float(a == b);",p.shape,w.shape);return this.compileAndRun(D,[p,w],"bool")},x.prototype.notEqual=function(p,w){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6136 return vec4(notEqual(a, b)); 6137`,"bool");var D=new ii("return float(a != b);",p.shape,w.shape);return this.compileAndRun(D,[p,w],"bool")},x.prototype.less=function(p,w){if(this.shouldExecuteOnCPU([p,w]))return this.cpuBackend.less(p,w);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6138 return vec4(lessThan(a, b)); 6139`,"bool");var D=new ii("return float(a < b);",p.shape,w.shape);return this.compileAndRun(D,[p,w],"bool")},x.prototype.lessEqual=function(p,w){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6140 return vec4(lessThanEqual(a, b)); 6141`,"bool");var D=new ii("return float(a <= b);",p.shape,w.shape);return this.compileAndRun(D,[p,w],"bool")},x.prototype.greater=function(p,w){if(this.shouldExecuteOnCPU([p,w]))return this.cpuBackend.greater(p,w);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6142 return vec4(greaterThan(a, b)); 6143`,"bool");var D=new ii("return float(a > b);",p.shape,w.shape);return this.compileAndRun(D,[p,w],"bool")},x.prototype.greaterEqual=function(p,w){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6144 return vec4(greaterThanEqual(a, b)); 6145`,"bool");var D=new ii("return float(a >= b);",p.shape,w.shape);return this.compileAndRun(D,[p,w],"bool")},x.prototype.logicalNot=function(p){var w=new Oi(p.shape,"return float(!(x >= 1.0));");return this.compileAndRun(w,[p])},x.prototype.logicalAnd=function(p,w){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6146 return vec4( 6147 vec4(greaterThanEqual(a, vec4(1.0))) * 6148 vec4(greaterThanEqual(b, vec4(1.0)))); 6149`,"bool");var D=new ii("return float(a >= 1.0 && b >= 1.0);",p.shape,w.shape);return this.compileAndRun(D,[p,w],"bool")},x.prototype.logicalOr=function(p,w){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6150 return min( 6151 vec4(greaterThanEqual(a, vec4(1.0))) + 6152 vec4(greaterThanEqual(b, vec4(1.0))), 6153 vec4(1.0)); 6154`,"bool");var D=new ii("return float(a >= 1.0 || b >= 1.0);",p.shape,w.shape);return this.compileAndRun(D,[p,w],"bool")},x.prototype.select=function(p,w,D){var W=new function(Q,ie,fe){var ye,Oe;if(this.variableNames=["c","a","b"],this.outputShape=ie,fe>4)throw Error("Where for rank "+fe+" is not yet supported");if(fe===1)Oe="resRC",ye="resRC";else{for(var Re=["resRC.x","resRC.y","resRC.z","resRC.w"],Pe=[],je=[],Ge=0;Ge<ie.length;Ge++)je.push(""+Re[Ge]),Ge<Q&&Pe.push(""+Re[Ge]);ye=Pe.join(),Oe=je.join()}var rt=Vn(fe);this.userCode=` 6155 void main() { 6156 `+rt+` resRC = getOutputCoords(); 6157 float cVal = getC(`+ye+`); 6158 if (cVal >= 1.0) { 6159 setOutput(getA(`+Oe+`)); 6160 } else {
6161 setOutput(getB(`+Oe+`)); 6162 } 6163 } 6164 `}(p.rank,w.shape,w.rank);return this.compileAndRun(W,[p,w,D],kn(w.dtype,D.dtype))},x.prototype.where=function(p){yf("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var w=p.dataSync();return ne(p.shape,w)},x.prototype.topk=function(p,w,D){return ae(p.dataSync(),p.shape,p.dtype,w)},x.prototype.min=function(p,w){Aa("min",w,p.rank);var D=ra(p.shape,w),W=D[0],Q=Ke(D[1]),ie=p.as2D(-1,Q);return this.reduce(ie,"min",ie.dtype).reshape(W)},x.prototype.minimum=function(p,w){if(this.shouldExecuteOnCPU([p,w]))return this.cpuBackend.minimum(p,w);var D=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Di(` 6165 vec4 result = vec4(min(a, b)); 6166 vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); 6167 6168 result.r = isNaN.r > 0. ? NAN : result.r; 6169 result.g = isNaN.g > 0. ? NAN : result.g; 6170 result.b = isNaN.b > 0. ? NAN : result.b; 6171 result.a = isNaN.a > 0. ? NAN : result.a; 6172 6173 return result; 6174`,p.shape,w.shape):new ii(` 6175 if (isnan(a)) return a; 6176 if (isnan(b)) return b; 6177 6178 return min(a, b); 6179`,p.shape,w.shape);return this.compileAndRun(D,[p,w])},x.prototype.mod=function(p,w){var D=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Di(` 6180 vec4 result = mod(a, b); 6181 vec4 isNaN = vec4(equal(b, vec4(0.0))); 6182 6183 result.r = isNaN.r > 0. ? NAN : result.r; 6184 result.g = isNaN.g > 0. ? NAN : result.g; 6185 result.b = isNaN.b > 0. ? NAN : result.b; 6186 result.a = isNaN.a > 0. ? NAN : result.a; 6187 6188 return result; 6189`,p.shape,w.shape):new ii(`if (b == 0.0) return NAN; 6190 return mod(a, b);`,p.shape,w.shape);return this.compileAndRun(D,[p,w])},x.prototype.max=function(p,w){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.max(p,w);Aa("max",w,p.rank);var D=ra(p.shape,w),W=D[0],Q=Ke(D[1]),ie=p.as2D(-1,Q);return this.reduce(ie,"max",ie.dtype).reshape(W)},x.prototype.maximum=function(p,w){if(this.shouldExecuteOnCPU([p,w]))return this.cpuBackend.maximum(p,w);var D=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Di(` 6191 vec4 result = vec4(max(a, b)); 6192 vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); 6193 6194 result.r = isNaN.r > 0. ? NAN : result.r; 6195 result.g = isNaN.g > 0. ? NAN : result.g; 6196 result.b = isNaN.b > 0. ? NAN : result.b; 6197 result.a = isNaN.a > 0. ? NAN : result.a; 6198 6199 return result; 6200`,p.shape,w.shape):new ii(` 6201 if (isnan(a)) return a; 6202 if (isnan(b)) return b; 6203 6204 return max(a, b); 6205`,p.shape,w.shape);return this.compileAndRun(D,[p,w])},x.prototype.all=function(p,w){Aa("all",w,p.rank);var D=ra(p.shape,w),W=D[0],Q=Ke(D[1]),ie=p.as2D(-1,Q);return this.reduce(ie,"all",ie.dtype).reshape(W)},x.prototype.any=function(p,w){Aa("any",w,p.rank);var D=ra(p.shape,w),W=D[0],Q=Ke(D[1]),ie=p.as2D(-1,Q);return this.reduce(ie,"any",ie.dtype).reshape(W)},x.prototype.realDivide=function(p,w){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6206 // vec4 one = vec4(equal(a, b)); 6207 // return one + (vec4(1.0) - one) * a / b; 6208 vec4 result = a / b; 6209 if(a.x == b.x) { 6210 result.x = 1.; 6211 } 6212 if(a.y == b.y) { 6213 result.y = 1.; 6214 } 6215 if(a.z == b.z) { 6216 result.z = 1.; 6217 } 6218 if(a.w == b.w) { 6219 result.w = 1.; 6220 } 6221 6222 return result; 6223`,"float32",!0);var D=new ii(` 6224if (a == b) { 6225 return 1.0; 6226}; 6227return a / b;`,p.shape,w.shape);return this.compileAndRun(D,[p,w],"float32")},x.prototype.floorDiv=function(p,w){if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,` 6228 ivec4 ia = round(a); 6229 ivec4 ib = round(b); 6230 bvec4 cond = notEqual(ib, ivec4(0)); 6231 ivec4 result = ivec4(0); 6232 vec4 s = sign(a) * sign(b); 6233 6234 // Windows (D3D) wants guaranteed non-zero int division at compile-time. 6235 if (cond[0]) { 6236 result[0] = idiv(ia[0], ib[0], s[0]); 6237 } 6238 if (cond[1]) { 6239 result[1] = idiv(ia[1], ib[1], s[1]); 6240 } 6241 if (cond[2]) { 6242 result[2] = idiv(ia[2], ib[2], s[2]); 6243 } 6244 if (cond[3]) { 6245 result[3] = idiv(ia[3], ib[3], s[3]); 6246 } 6247 return vec4(result); 6248`,"int32");var D=new ii(` 6249 float s = sign(a) * sign(b); 6250 int ia = round(a); 6251 int ib = round(b); 6252 if (ib != 0) { 6253 // Windows (D3D) wants guaranteed non-zero int division at compile-time. 6254 return float(idiv(ia, ib, s)); 6255 } else { 6256 return NAN; 6257 } 6258`,p.shape,w.shape);return this.compileAndRun(D,[p,w],"int32")},x.prototype.add=function(p,w){if(p.dtype==="complex64"&&w.dtype==="complex64")return this.complexSeparableBinaryOp(p,w,Hr);if(this.shouldExecuteOnCPU([p,w]))return this.cpuBackend.add(p,w);var D=kn(p.dtype,w.dtype);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,Hr,D);var W=new ii(Hr,p.shape,w.shape);return this.compileAndRun(W,[p,w],D)},x.prototype.packedUnaryOp=function(p,w,D){var W=new wh(p.shape,w);return this.compileAndRun(W,[p],D)},x.prototype.packedBinaryOp=function(p,w,D,W,Q){Q===void 0&&(Q=!1);var ie=new Di(D,p.shape,w.shape,Q);return this.compileAndRun(ie,[p,w],W)},x.prototype.complexSeparableBinaryOp=function(p,w,D){var W=this,Q=this.texData.get(p.dataId),ie=this.texData.get(w.dataId),fe=[[Q.complexTensors.real,ie.complexTensors.real],[Q.complexTensors.imag,ie.complexTensors.imag]].map(function(Pe){var je=Pe[0],Ge=Pe[1],rt=W.makeComplexComponentTensorInfo(p,je),nt=W.makeComplexComponentTensorInfo(w,Ge),lt=new ii(D,p.shape,w.shape);return W.compileAndRun(lt,[rt,nt],kn(je.dtype,Ge.dtype))}),ye=fe[0],Oe=fe[1],Re=this.complex(ye,Oe);return ye.dispose(),Oe.dispose(),Re},x.prototype.makeComplexComponentTensorInfo=function(p,w){return{dataId:w.dataId,dtype:w.dtype,shape:p.shape}},x.prototype.addN=function(p){if(p.length===1)return p[0];if(p.length>L().get("WEBGL_MAX_TEXTURES_IN_SHADER")){var w=Math.floor(p.length/2),D=this.addN(p.slice(0,w)),W=this.addN(p.slice(w));return this.addN([D,W])}var Q=p.map(function(ye){return ye.dtype}).reduce(function(ye,Oe){return kn(ye,Oe)}),ie=p.map(function(ye){return ye.shape}),fe=L().getBool("WEBGL_PACK")?new function(ye,Oe){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=ye,this.variableNames=Oe.map(function(je,Ge){return"T"+Ge});var Re=[];
vendor: 2,241 bytes, lines 6258-6302
6258this.variableNames.forEach(function(je){Re.push("vec4 v"+je+" = get"+je+"AtOutCoords();")});var Pe=this.variableNames.map(function(je){return"v"+je}).join(" + ");this.userCode=` 6259 void main() { 6260 `+Re.join(` 6261 `)+` 6262 6263 vec4 result = `+Pe+`; 6264 setOutput(result); 6265 } 6266 `}(p[0].shape,ie):new function(ye,Oe){this.outputShape=[],this.outputShape=ye,this.variableNames=Oe.map(function(je,Ge){return"T"+Ge});var Re=[];this.variableNames.forEach(function(je){Re.push("float v"+je+" = get"+je+"AtOutCoords();")});var Pe=this.variableNames.map(function(je){return"v"+je}).join(" + ");this.userCode=` 6267 void main() { 6268 `+Re.join(` 6269 `)+` 6270 6271 float result = `+Pe+`; 6272 setOutput(result); 6273 } 6274 `}(p[0].shape,ie);return this.compileAndRun(fe,p,Q)},x.prototype.subtract=function(p,w){if(p.dtype==="complex64"&&w.dtype==="complex64")return this.complexSeparableBinaryOp(p,w,oi);if(this.shouldExecuteOnCPU([p,w]))return this.cpuBackend.subtract(p,w);var D=kn(p.dtype,w.dtype);if(L().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(p,w,oi,p.dtype);var W=new ii(oi,p.shape,w.shape);return this.compileAndRun(W,[p,w],D)},x.prototype.pow=function(p,w){var D=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Di(` 6275 // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise. 6276 vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1))); 6277 vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1); 6278 vec4 result = multiplier * pow(abs(a), b); 6279 6280 // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS 6281 bvec4 isExpZero = equal(b, vec4(0.0)); 6282 result.r = isExpZero.r ? 1.0 : result.r; 6283 result.g = isExpZero.g ? 1.0 : result.g; 6284 result.b = isExpZero.b ? 1.0 : result.b; 6285 result.a = isExpZero.a ? 1.0 : result.a; 6286 6287 vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b)); 6288 6289 result.r = isNaN.r > 0. ? NAN : result.r; 6290 result.g = isNaN.g > 0. ? NAN : result.g; 6291 result.b = isNaN.b > 0. ? NAN : result.b; 6292 result.a = isNaN.a > 0. ? NAN : result.a; 6293 6294 return result; 6295`,p.shape,w.shape):new ii(` 6296if(a < 0.0 && floor(b) < b){ 6297 return NAN; 6298} 6299if (b == 0.0) { 6300 return 1.0; 6301} 6302return (round(mod(b, 2.0)) != 1) ?
6303 pow(abs(a), b) : sign(a) * pow(abs(a), b); 6304`,p.shape,w.shape),W=kn(p.dtype,w.dtype);return this.compileAndRun(D,[p,w],W)},x.prototype.ceil=function(p){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.ceil(p);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(p,$v,p.dtype);var w=new Oi(p.shape,$v);return this.compileAndRun(w,[p])},x.prototype.floor=function(p){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.floor(p);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(p,j0,p.dtype);var w=new Oi(p.shape,j0);return this.compileAndRun(w,[p])},x.prototype.sign=function(p){var w=new Oi(p.shape,` 6305 if (isnan(x)) { return 0.0; } 6306 return sign(x); 6307`);return this.compileAndRun(w,[p])},x.prototype.isNaN=function(p){var w=new Oi(p.shape,"return float(isnan(x));");return this.compileAndRun(w,[p],"bool")},x.prototype.isInf=function(p){var w=new Oi(p.shape,"return float(isinf(x));");return this.compileAndRun(w,[p],"bool")},x.prototype.isFinite=function(p){var w=new Oi(p.shape,"return float(!isnan(x) && !isinf(x));");return this.compileAndRun(w,[p],"bool")},x.prototype.round=function(p){var w=new Oi(p.shape,` 6308 // OpenGL ES does not support round function. 6309 // The algorithm is based on banker's rounding. 6310 float base = floor(x); 6311 if ((x - base) < 0.5) { 6312 return floor(x); 6313 } else if ((x - base) > 0.5) { 6314 return ceil(x); 6315 } else { 6316 if (mod(base, 2.0) == 0.0) { 6317 return base; 6318 } else { 6319 return base + 1.0; 6320 } 6321 } 6322`);return this.compileAndRun(w,[p])},x.prototype.exp=function(p){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.exp(p);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(p,Hv,p.dtype);var w=new Oi(p.shape,Hv);return this.compileAndRun(w,[p])},x.prototype.expm1=function(p){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.expm1(p);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(p,xh,p.dtype);var w=new Oi(p.shape,xh);return this.compileAndRun(w,[p])},x.prototype.softmax=function(p,w){var D=Vt([w],p.shape),W=this.max(p,D),Q=ia(W.shape,D),ie=this.subtract(p,W.reshape(Q)),fe=this.exp(ie),ye=this.sum(fe,D).reshape(Q);return this.realDivide(fe,ye)},x.prototype.log=function(p){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.log(p);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(p,` 6323 vec4 result = log(x); 6324 vec4 isNaN = vec4(lessThan(x, vec4(0.0))); 6325 result.r = isNaN.r == 1.0 ? NAN : result.r; 6326 result.g = isNaN.g == 1.0 ? NAN : result.g; 6327 result.b = isNaN.b == 1.0 ? NAN : result.b; 6328 result.a = isNaN.a == 1.0 ? NAN : result.a; 6329 6330 return result; 6331`,p.dtype);var w=new Oi(p.shape,`if (x < 0.0) return NAN; 6332 return log(x);`);return this.compileAndRun(w,[p])},x.prototype.log1p=function(p){var w=new Oi(p.shape,"return log(1.0 + x);");return this.compileAndRun(w,[p])},x.prototype.sqrt=function(p){var w=new Oi(p.shape,"return sqrt(x);");return this.compileAndRun(w,[p])},x.prototype.rsqrt=function(p){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.rsqrt(p);var w=new Oi(p.shape,"return inversesqrt(x);");return this.compileAndRun(w,[p])},x.prototype.reciprocal=function(p){var w=new Oi(p.shape,"return 1.0 / x;");return this.compileAndRun(w,[p])},x.prototype.relu=function(p){var w;return w=L().getBool("WEBGL_PACK")?new wh(p.shape,Gv):new Oi(p.shape,Wv),this.compileAndRun(w,[p])},x.prototype.relu6=function(p){var w;return w=L().getBool("WEBGL_PACK")?new wh(p.shape,Kv):new Oi(p.shape,Vv),this.compileAndRun(w,[p])},x.prototype.prelu=function(p,w){var D=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Di(Ci,p.shape,w.shape):new ii(ui,p.shape,w.shape);return this.compileAndRun(D,[p,w])},x.prototype.elu=function(p){if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(p,Jl,p.dtype);var w=new Oi(p.shape,B0);return this.compileAndRun(w,[p])},x.prototype.eluDer=function(p,w){var D=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Di(` 6333 vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));
6334 return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0)))); 6335`,p.shape,w.shape):new ii("return (b >= 1.0) ? a : a * (b + 1.0);",p.shape,w.shape);return this.compileAndRun(D,[p,w])},x.prototype.selu=function(p){var w=new Oi(p.shape,` 6336 // Stable and Attracting Fixed Point (0, 1) for Normalized Weights. 6337 // see: https://arxiv.org/abs/1706.02515 6338 float scaleAlpha = 1.7580993408473768; 6339 float scale = 1.0507009873554805; 6340 return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0); 6341`);return this.compileAndRun(w,[p])},x.prototype.int=function(p){var w=new Oi(p.shape,"return float(int(x));");return this.compileAndRun(w,[p],"int32")},x.prototype.clip=function(p,w,D){var W,Q=(W=L().getBool("WEBGL_PACK_CLIP")?new wi(p.shape):new si(p.shape)).getCustomSetupFunc(w,D);return this.compileAndRun(W,[p],null,Q)},x.prototype.abs=function(p){if(this.shouldExecuteOnCPU([p]))return this.cpuBackend.abs(p);if(L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(p,yd,p.dtype);var w=new Oi(p.shape,yd);return this.compileAndRun(w,[p])},x.prototype.complexAbs=function(p){var w=this.texData.get(p.dataId),D=new function(Q){this.variableNames=["real","imag"],this.outputShape=Q,this.userCode=` 6342 void main() { 6343 float re = abs(getRealAtOutCoords()); 6344 float im = abs(getImagAtOutCoords()); 6345 float mx = max(re, im); 6346 6347 // sadly the length function in glsl is not underflow-safe 6348 // (at least not on Intel GPUs). So the safe solution is 6349 // to ensure underflow-safety in all cases. 6350 setOutput( 6351 mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx)) 6352 ); 6353 } 6354 `}(p.shape),W=[this.makeComplexComponentTensorInfo(p,w.complexTensors.real),this.makeComplexComponentTensorInfo(p,w.complexTensors.imag)];return this.compileAndRun(D,W)},x.prototype.sigmoid=function(p){var w=new Oi(p.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(w,[p])},x.prototype.softplus=function(p){var w=new Oi(p.shape,` 6355 float epsilon = 1.1920928955078125e-7; 6356 float threshold = log(epsilon) + 2.0; 6357 6358 bool too_large = x > -threshold; 6359 bool too_small = x < threshold; 6360 6361 float result; 6362 float exp_x = exp(x); 6363 6364 if (too_large){ 6365 result = x; 6366 } 6367 else if (too_small){ 6368 result = exp_x; 6369 } 6370 else{ 6371 result = log(exp_x + 1.0); 6372 } 6373 return result; 6374`);return this.compileAndRun(w,[p])},x.prototype.sin=function(p){var w=new Oi(p.shape,`if (isnan(x)) return x; 6375 return sin(x); 6376`);return this.compileAndRun(w,[p])},x.prototype.cos=function(p){var w=new Oi(p.shape,`if (isnan(x)) return x; 6377 return cos(x); 6378`);return this.compileAndRun(w,[p])},x.prototype.tan=function(p){var w=new Oi(p.shape,"return tan(x);");return this.compileAndRun(w,[p])},x.prototype.asin=function(p){var w=new Oi(p.shape,`if (isnan(x)) return x; 6379 if (abs(x) > 1.) { 6380 return NAN; 6381 } 6382 return asin(x); 6383`);return this.compileAndRun(w,[p])},x.prototype.acos=function(p){var w=new Oi(p.shape,`if (isnan(x)) return x; 6384 if (abs(x) > 1.) { 6385 return NAN; 6386 } 6387 return acos(x); 6388`);return this.compileAndRun(w,[p])},x.prototype.atan=function(p){var w=new Oi(p.shape,`if (isnan(x)) return x; 6389 return atan(x); 6390`);return this.compileAndRun(w,[p])},x.prototype.atan2=function(p,w){var D=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Di(` 6391 vec4 result = atan(a, b); 6392 vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); 6393 6394 result.r = isNaN.r > 0. ? NAN : result.r; 6395 result.g = isNaN.g > 0. ? NAN : result.g; 6396 result.b = isNaN.b > 0. ? NAN : result.b; 6397 result.a = isNaN.a > 0. ? NAN : result.a; 6398 6399 return result; 6400`,p.shape,w.shape):new ii(` 6401 if (isnan(a)) return a; 6402 if (isnan(b)) return b; 6403 6404 return atan(a, b); 6405`,p.shape,w.shape);return this.compileAndRun(D,[p,w])},x.prototype.sinh=function(p){var w=new Oi(p.shape,` 6406 float e2x = exp(x); 6407 return (e2x - 1.0 / e2x) / 2.0; 6408`);return this.compileAndRun(w,[p])},x.prototype.cosh=function(p){var w=new Oi(p.shape,` 6409 float e2x = exp(-x); 6410 return (e2x + 1.0 / e2x) / 2.0; 6411`);return this.compileAndRun(w,[p])},x.prototype.tanh=function(p){var w=new Oi(p.shape,` 6412 float e2x = exp(-2.0 * abs(x)); 6413 return sign(x) * (1.0 - e2x) / (1.0 + e2x); 6414`);return this.compileAndRun(w,[p])},x.prototype.asinh=function(p){var w=new Oi(p.shape,"if (isnan(x)) return x;return log(x + sqrt(x * x + 1.0));");return this.compileAndRun(w,[p])},x.prototype.acosh=function(p){var w=new Oi(p.shape,`if (isnan(x)) return x; 6415 if (x < 1.0) return NAN; 6416 return log(x + sqrt(x * x - 1.0));`);return this.compileAndRun(w,[p])},x.prototype.atanh=function(p){var w=new Oi(p.shape,`if (isnan(x)) return x; 6417 if ((x < -1.0) || (x > 1.0)) return NAN;
6418 return (log(1.0 + x) - log(1.0 - x)) / 2.0;`);return this.compileAndRun(w,[p])},x.prototype.erf=function(p){var w=new Oi(p.shape,` 6419 // Error function is calculated approximately with elementary function. 6420 // See "Handbook of Mathematical Functions with Formulas, 6421 // Graphs, and Mathematical Tables", Abramowitz and Stegun. 6422 float p = 0.3275911; 6423 float a1 = 0.254829592; 6424 float a2 = -0.284496736; 6425 float a3 = 1.421413741; 6426 float a4 = -1.453152027; 6427 float a5 = 1.061405429; 6428 6429 float sign = sign(x); 6430 x = abs(x); 6431 float t = 1.0 / (1.0 + p * x); 6432 return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x)); 6433`);return this.compileAndRun(w,[p])},x.prototype.step=function(p,w){var D=new Oi(p.shape,function(W){return W===void 0&&(W=0),qm+` 6434 return x > 0.0 ? 1.0 : float(`+W+`); 6435 `}(w));return this.compileAndRun(D,[p])},x.prototype.conv2dByMatMul=function(p,w,D,W,Q,ie){var fe=p.shape,ye=this.texData.get(p.dataId),Oe=D.inChannels,Re=fe[0]*fe[1]*fe[2],Pe=D.outChannels,je=D.dataFormat==="channelsLast",Ge=(Re===1||Pe===1)&&Oe>1e3,rt=fe[2]%2!=0&&!!ye.isPacked;if(Ge||!L().getBool("WEBGL_LAZILY_UNPACK")||!L().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!rt){var nt=je?fe[0]*fe[1]*fe[2]:fe[0]*fe[2]*fe[3],lt=this.reshape(p,[1,nt,D.inChannels]),Nt=this.reshape(w,[1,D.inChannels,D.outChannels]);return this.reshape(this.fusedBatchMatMul({a:lt,b:Nt,transposeA:!1,transposeB:!1,bias:W,activation:Q,preluActivationWeights:ie}),D.outShape)}var Rt=je?fe[0]*fe[1]*(fe[2]+1):fe[0]*fe[2]*(fe[3]+1),Pt={dataId:p.dataId,shape:[1,Rt,D.inChannels],dtype:p.dtype},Kt=ye.shape;ye.shape=ye.shape.slice(),ye.shape[ye.shape.length-2]++,Ee(vc(ye.shape,Pt.shape),function(){return"packed reshape "+ye.shape+" to "+Pt.shape+" isn't free"});var dn=this.reshape(w,[1,D.inChannels,D.outChannels]),bn=this.fusedBatchMatMul({a:Pt,b:dn,transposeA:!1,transposeB:!1,bias:W,activation:Q,preluActivationWeights:ie}),pn=this.texData.get(bn.dataId);return Ee(pn.isPacked,function(){return"batchMatMul result is expected to be packed"}),ye.shape=Kt,pn.shape=D.outShape,qe.makeTensorFromDataId(bn.dataId,D.outShape,bn.dtype)},x.prototype.conv2dWithIm2Row=function(p,w,D,W,Q,ie){var fe=D.filterWidth,ye=D.filterHeight,Oe=D.inChannels,Re=D.outWidth,Pe=D.outHeight,je=D.dataFormat==="channelsLast",Ge=fe*ye*Oe,rt=Pe*Re,nt=[Ge,rt],lt=p.squeeze([0]),Nt=w.reshape([1,Ge,-1]),Rt=new function(_,m,f){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=_;for(var y=f.filterWidth,E=f.inChannels,z=f.strideWidth,Y=f.strideHeight,Z=f.padInfo,le=f.outWidth,de=f.dilationWidth,we=f.dilationHeight,De=f.dataFormat,Ne=Z.left,Fe=Z.top,Ve=E*y,Je=ue(),Xe=De==="channelsLast",ot=Xe?0:1,xt=Xe?1:2,kt="",At=0;At<=1;At++)for(var Lt=0;Lt<=1;Lt++)kt+=` 6436 blockIndex = rc.y + `+Lt+`; 6437 pos = rc.x + `+At+`; 6438 6439 if(blockIndex < `+_[1]+" && pos < "+_[0]+`) { 6440 offsetY = int(blockIndex / (`+le+")) * "+Y+" - "+Fe+`; 6441 d0 = offsetY + `+we+" * (pos / "+Ve+`); 6442 6443 if(d0 < `+m[ot]+` && d0 >= 0) { 6444 6445 offsetX = int(mod(float(blockIndex), `+le+".) * "+z+". - "+Ne+`.); 6446 d1 = offsetX + `+de+" * (int(mod(float(pos), "+Ve+".) / "+E+`.)); 6447 6448 if(d1 < `+m[xt]+` && d1 >= 0) { 6449 6450 ch = int(mod(float(pos), `+E+`.)); 6451 6452 if (`+Xe+`) { 6453 innerDims = vec2(d1, ch); 6454 result[`+(2*At+Lt)+`] = getChannel( 6455 getA(d0, int(innerDims.x), 6456 int(innerDims.y)), innerDims); 6457 } else { 6458 innerDims = vec2(d0, d1); 6459 result[`+(2*At+Lt)+`] = getChannel( 6460 getA(ch, int(innerDims.x), 6461 int(innerDims.y)), innerDims); 6462 } 6463 } 6464 } 6465 } 6466 `;this.userCode=` 6467 void main() { 6468 ivec2 rc = getOutputCoords(); 6469 6470 vec4 result = vec4(0); 6471 6472 int blockIndex, pos, offsetY, d0, offsetX, d1, ch; 6473 vec2 innerDims; 6474 6475 `+kt+` 6476 6477 `+Je.output+` = result; 6478 } 6479 `}(nt,lt.shape,D),Pt=this.compileAndRun(Rt,[lt]).reshape([1,nt[0],nt[1]]),Kt=W!=null,dn=ie!=null,bn=Q?L0(Q,!0):null,pn=new fa(Pt.shape,[1,rt,D.outChannels],!0,!1,Kt,bn,dn),_n=[Pt,Nt];W&&_n.push(W),dn&&_n.push(ie);var On=this.compileAndRun(pn,_n);return je?On.reshape([1,Pe,Re,D.outChannels]):On.reshape([1,D.outChannels,Pe,Re])},x.prototype.fusedConv2d=function(p){var w=p.input,D=p.filter,W=p.convInfo,Q=p.bias,ie=p.activation,fe=p.preluActivationWeights;if(W.filterHeight===1&&W.filterWidth===1&&W.dilationHeight===1&&W.dilationWidth===1&&W.strideHeight===1&&W.strideWidth===1&&(W.padInfo.type==="SAME"||W.padInfo.type==="VALID"))return this.conv2dByMatMul(w,D,W,Q,ie,fe);if(L().getBool("WEBGL_CONV_IM2COL")&&w.shape[0]===1)return this.conv2dWithIm2Row(w,D,W,Q,ie,fe);
vendor: 16,384 bytes, lines 6479-6882
6479var ye=Q!=null,Oe=fe!=null,Re=ie?L0(ie,!1):null,Pe=new _o(W,ye,Re,Oe),je=[w,D];return Q&&je.push(Q),fe&&je.push(fe),this.compileAndRun(Pe,je)},x.prototype.conv2d=function(p,w,D){if(D.filterHeight===1&&D.filterWidth===1&&D.dilationHeight===1&&D.dilationWidth===1&&D.strideHeight===1&&D.strideWidth===1&&(D.padInfo.type==="SAME"||D.padInfo.type==="VALID"))return this.conv2dByMatMul(p,w,D);if(L().getBool("WEBGL_CONV_IM2COL")&&p.shape[0]===1)return this.conv2dWithIm2Row(p,w,D);var W=new _o(D);return this.compileAndRun(W,[p,w])},x.prototype.conv2dDerInput=function(p,w,D){var W=new function(Q){this.variableNames=["dy","W"],this.outputShape=Q.inShape;var ie=Q.filterHeight,fe=Q.filterWidth,ye=Q.strideHeight,Oe=Q.strideWidth,Re=Q.dataFormat==="channelsLast",Pe=ie-1-Q.padInfo.top,je=fe-1-Q.padInfo.left,Ge=Re?1:2,rt=Re?2:3,nt=Re?3:1;this.userCode=` 6480 const ivec2 pads = ivec2(`+Pe+", "+je+`); 6481 6482 void main() { 6483 ivec4 coords = getOutputCoords(); 6484 int batch = coords[0]; 6485 int d1 = coords[`+nt+`]; 6486 6487 ivec2 dyCorner = ivec2(coords[`+Ge+"], coords["+rt+`]) - pads; 6488 int dyRCorner = dyCorner.x; 6489 int dyCCorner = dyCorner.y; 6490 6491 // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1). 6492 // ? = to be determined. : = across all values in that axis. 6493 float dotProd = 0.0; 6494 for (int wR = 0; wR < `+ie+`; wR++) { 6495 float dyR = float(dyRCorner + wR) / `+ye+`.0; 6496 6497 if (dyR < 0.0 || dyR >= `+Q.outHeight+`.0 || fract(dyR) > 0.0) { 6498 continue; 6499 } 6500 int idyR = int(dyR); 6501 6502 int wRPerm = `+ie+` - 1 - wR; 6503 6504 for (int wC = 0; wC < `+fe+`; wC++) { 6505 float dyC = float(dyCCorner + wC) / `+Oe+`.0; 6506 6507 if (dyC < 0.0 || dyC >= `+Q.outWidth+`.0 || 6508 fract(dyC) > 0.0) { 6509 continue; 6510 } 6511 int idyC = int(dyC); 6512 6513 int wCPerm = `+fe+` - 1 - wC; 6514 6515 for (int d2 = 0; d2 < `+Q.outChannels+`; d2++) { 6516 6517 if (`+Re+`) { 6518 float xValue = getDy(batch, idyR, idyC, d2); 6519 float wValue = getW(wRPerm, wCPerm, d1, d2); 6520 dotProd += xValue * wValue; 6521 } else { 6522 float xValue = getDy(batch, d2, idyR, idyC); 6523 float wValue = getW(wRPerm, wCPerm, d1, d2); 6524 dotProd += xValue * wValue; 6525 } 6526 6527 } 6528 } 6529 } 6530 setOutput(dotProd); 6531 } 6532 `}(D);return this.compileAndRun(W,[p,w])},x.prototype.conv2dDerFilter=function(p,w,D){var W=new function(Q){this.variableNames=["x","dy"],this.outputShape=Q.filterShape;var ie=Q.strideHeight,fe=Q.strideWidth,ye=Q.padInfo.top,Oe=Q.padInfo.left,Re=Q.dataFormat==="channelsLast";this.userCode=` 6533 void main() { 6534 ivec4 coords = getOutputCoords(); 6535 int wR = coords.x; 6536 int wC = coords.y; 6537 int d1 = coords.z; 6538 int d2 = coords.w; 6539 6540 // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2). 6541 // ? = to be determined. : = across all values in that axis. 6542 float dotProd = 0.0; 6543 6544 for (int b = 0; b < `+Q.batchSize+`; b++) { 6545 for (int yR = 0; yR < `+Q.outHeight+`; yR++) { 6546 int xR = wR + yR * `+ie+" - "+ye+`; 6547 6548 if (xR < 0 || xR >= `+Q.inHeight+`) { 6549 continue; 6550 } 6551 6552 for (int yC = 0; yC < `+Q.outWidth+`; yC++) { 6553 int xC = wC + yC * `+fe+" - "+Oe+`; 6554 6555 if (xC < 0 || xC >= `+Q.inWidth+`) { 6556 continue; 6557 } 6558 6559 if (`+Re+`) { 6560 float dyValue = getDy(b, yR, yC, d2); 6561 float xValue = getX(b, xR, xC, d1); 6562 dotProd += (xValue * dyValue); 6563 } else { 6564 float dyValue = getDy(b, d2, yR, yC); 6565 float xValue = getX(b, d1, xR, xC); 6566 dotProd += (xValue * dyValue); 6567 } 6568 6569 } 6570 } 6571 } 6572 setOutput(dotProd); 6573 } 6574 `}(D);return this.compileAndRun(W,[p,w])},x.prototype.fusedDepthwiseConv2D=function(p){var w,D=p.input,W=p.filter,Q=p.convInfo,ie=p.bias,fe=p.activation,ye=p.preluActivationWeights,Oe=L().getBool("WEBGL_PACK_DEPTHWISECONV")&&Q.strideWidth<=2&&Q.outChannels/Q.inChannels==1,Re=fe?L0(fe,Oe):null,Pe=[D,W],je=ie!=null,Ge=ye!=null;return je&&Pe.push(ie),Ge&&Pe.push(ye),Oe?(w=new ro(Q,je,Re,Ge),this.compileAndRun(w,Pe)):(w=new ba(Q,je,Re,Ge),this.compileAndRun(w,Pe))},x.prototype.depthwiseConv2D=function(p,w,D){var W;return L().getBool("WEBGL_PACK_DEPTHWISECONV")&&D.strideWidth<=2&&D.outChannels/D.inChannels==1?(W=new ro(D),this.compileAndRun(W,[p,w])):(W=new ba(D),this.compileAndRun(W,[p,w]))},x.prototype.depthwiseConv2DDerInput=function(p,w,D){var W=new function(Q){this.variableNames=["dy","W"],this.outputShape=Q.inShape;var ie=Q.filterHeight,fe=Q.filterWidth,ye=Q.strideHeight,Oe=Q.strideWidth,Re=ie-1-Q.padInfo.top,Pe=fe-1-Q.padInfo.left,je=Q.outChannels/Q.inChannels;this.userCode=` 6575 const ivec2 pads = ivec2(`+Re+", "+Pe+`); 6576 6577 void main() { 6578 ivec4 coords = getOutputCoords(); 6579 int batch = coords[0]; 6580 int d1 = coords[3]; 6581 ivec2 dyCorner = coords.yz - pads; 6582 int dyRCorner = dyCorner.x; 6583 int dyCCorner = dyCorner.y; 6584 6585 float dotProd = 0.0; 6586 6587 for (int wR = 0; wR < `+ie+`; wR++) { 6588 float dyR = float(dyRCorner + wR) / `+ye+`.0; 6589 6590 if (dyR < 0.0 || dyR >= `+Q.outHeight+`.0 || fract(dyR) > 0.0) { 6591 continue; 6592 } 6593 int idyR = int(dyR); 6594 6595 int wRPerm = `+ie+` - 1 - wR; 6596 6597 for (int wC = 0; wC < `+fe+`; wC++) { 6598 float dyC = float(dyCCorner + wC) / `+Oe+`.0; 6599 6600 if (dyC < 0.0 || dyC >= `+Q.outWidth+`.0 || 6601 fract(dyC) > 0.0) { 6602 continue; 6603 } 6604 int idyC = int(dyC); 6605 6606 int wCPerm = `+fe+` - 1 - wC; 6607 6608 // TO DO: Vec4 over the channelMul 6609 for (int dm = 0; dm < `+je+`; dm++) { 6610 int d2 = d1 * `+je+` + dm; 6611 float xValue = getDy(batch, idyR, idyC, d2); 6612 float wValue = getW(wRPerm, wCPerm, d1, dm); 6613 dotProd += xValue * wValue; 6614 } 6615 } 6616 } 6617 setOutput(dotProd); 6618 } 6619 `}(D);return this.compileAndRun(W,[p,w])},x.prototype.depthwiseConv2DDerFilter=function(p,w,D){var W=new function(Q){this.variableNames=["x","dy"],this.outputShape=Q.filterShape;var ie=Q.strideHeight,fe=Q.strideWidth,ye=Q.padInfo.top,Oe=Q.padInfo.left,Re=Q.outChannels/Q.inChannels;this.userCode=` 6620 void main() { 6621 ivec4 coords = getOutputCoords(); 6622 int wR = coords.x; 6623 int wC = coords.y; 6624 int d1 = coords.z; 6625 int dm = coords.w; 6626 int d2 = d1 * `+Re+` + dm; 6627 6628 float dotProd = 0.0; 6629 6630 // TO DO: Vec4 over the batch size 6631 for (int b = 0; b < `+Q.batchSize+`; b++) { 6632 for (int yR = 0; yR < `+Q.outHeight+`; yR++) { 6633 int xR = wR + yR * `+ie+" - "+ye+`; 6634 6635 if (xR < 0 || xR >= `+Q.inHeight+`) { 6636 continue; 6637 } 6638 6639 for (int yC = 0; yC < `+Q.outWidth+`; yC++) { 6640 int xC = wC + yC * `+fe+" - "+Oe+`; 6641 6642 if (xC < 0 || xC >= `+Q.inWidth+`) { 6643 continue; 6644 } 6645 6646 float dyValue = getDy(b, yR, yC, d2); 6647 float xValue = getX(b, xR, xC, d1); 6648 dotProd += (xValue * dyValue); 6649 } 6650 } 6651 } 6652 setOutput(dotProd); 6653 } 6654 `}(D);return this.compileAndRun(W,[p,w])},x.prototype.conv3d=function(p,w,D){var W=new function(Q){this.variableNames=["x","W"],this.outputShape=Q.outShape;var ie=Q.padInfo.front,fe=Q.padInfo.top,ye=Q.padInfo.left,Oe=Q.strideDepth,Re=Q.strideHeight,Pe=Q.strideWidth,je=Q.dilationDepth,Ge=Q.dilationHeight,rt=Q.dilationWidth,nt=Q.filterDepth,lt=Q.filterHeight,Nt=Q.filterWidth,Rt=4*Math.floor(Q.inChannels/4),Pt=Q.inChannels%4;this.userCode=` 6655 const ivec3 strides = ivec3(`+Oe+", "+Re+", "+Pe+`); 6656 const ivec3 pads = ivec3(`+ie+", "+fe+", "+ye+`); 6657 6658 void main() { 6659 ivec5 coords = getOutputCoords(); 6660 int batch = coords.x; 6661 int d2 = coords.u; 6662 6663 ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads; 6664 int xFCorner = xFRCCorner.x; 6665 int xRCorner = xFRCCorner.y; 6666 int xCCorner = xFRCCorner.z; 6667 6668 // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get 6669 // y(yF, yR, yC, d2). ? = to be determined. : = across all 6670 // values in that axis. 6671 float dotProd = 0.0; 6672 for (int wF = 0; wF < `+nt+`; wF++) { 6673 int xF = xFCorner + wF * `+je+`; 6674 6675 if (xF < 0 || xF >= `+Q.inDepth+`) { 6676 continue; 6677 } 6678 6679 for (int wR = 0; wR < `+lt+`; wR++) { 6680 int xR = xRCorner + wR * `+Ge+`; 6681 6682 if (xR < 0 || xR >= `+Q.inHeight+`) { 6683 continue; 6684 } 6685 6686 for (int wC = 0; wC < `+Nt+`; wC++) { 6687 int xC = xCCorner + wC * `+rt+`; 6688 6689 if (xC < 0 || xC >= `+Q.inWidth+`) { 6690 continue; 6691 } 6692 6693 for (int d1 = 0; d1 < `+Rt+`; d1 += 4) { 6694 vec4 xValues = vec4( 6695 getX(batch, xF, xR, xC, d1), 6696 getX(batch, xF, xR, xC, d1 + 1), 6697 getX(batch, xF, xR, xC, d1 + 2), 6698 getX(batch, xF, xR, xC, d1 + 3) 6699 ); 6700 vec4 wValues = vec4( 6701 getW(wF, wR, wC, d1, d2), 6702 getW(wF, wR, wC, d1 + 1, d2), 6703 getW(wF, wR, wC, d1 + 2, d2), 6704 getW(wF, wR, wC, d1 + 3, d2) 6705 ); 6706 6707 dotProd += dot(xValues, wValues); 6708 } 6709 6710 if (`+(Pt===1)+`) { 6711 dotProd += 6712 getX(batch, xF, xR, xC, `+Rt+`) * 6713 getW(wF, wR, wC, `+Rt+`, d2); 6714 } else if (`+(Pt===2)+`) { 6715 vec2 xValues = vec2( 6716 getX(batch, xF, xR, xC, `+Rt+`), 6717 getX(batch, xF, xR, xC, `+Rt+` + 1) 6718 ); 6719 vec2 wValues = vec2( 6720 getW(wF, wR, wC, `+Rt+`, d2), 6721 getW(wF, wR, wC, `+Rt+` + 1, d2) 6722 ); 6723 dotProd += dot(xValues, wValues); 6724 } else if (`+(Pt===3)+`) { 6725 vec3 xValues = vec3( 6726 getX(batch, xF, xR, xC, `+Rt+`), 6727 getX(batch, xF, xR, xC, `+Rt+` + 1), 6728 getX(batch, xF, xR, xC, `+Rt+` + 2) 6729 ); 6730 vec3 wValues = vec3( 6731 getW(wF, wR, wC, `+Rt+`, d2), 6732 getW(wF, wR, wC, `+Rt+` + 1, d2), 6733 getW(wF, wR, wC, `+Rt+` + 2, d2) 6734 ); 6735 dotProd += dot(xValues, wValues); 6736 } 6737 } 6738 } 6739 } 6740 setOutput(dotProd); 6741 } 6742 `}(D);return this.compileAndRun(W,[p,w])},x.prototype.conv3dDerInput=function(p,w,D){var W=new function(Q){this.variableNames=["dy","W"],this.outputShape=Q.inShape;var ie=Q.filterDepth,fe=Q.filterHeight,ye=Q.filterWidth,Oe=Q.strideDepth,Re=Q.strideHeight,Pe=Q.strideWidth,je=ie-1-Q.padInfo.front,Ge=fe-1-Q.padInfo.top,rt=ye-1-Q.padInfo.left;this.userCode=` 6743 const ivec3 pads = ivec3(`+je+", "+Ge+", "+rt+`); 6744 6745 void main() { 6746 ivec5 coords = getOutputCoords(); 6747 int batch = coords.x; 6748 int d1 = coords.u; 6749 6750 6751 ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads; 6752 int dyFCorner = dyCorner.x; 6753 int dyRCorner = dyCorner.y; 6754 int dyCCorner = dyCorner.z; 6755 6756 float dotProd = 0.0; 6757 for (int wF = 0; wF < `+ie+`; wF++) { 6758 float dyF = float(dyFCorner + wF) / `+Oe+`.0; 6759 6760 if (dyF < 0.0 || dyF >= `+Q.outDepth+`.0 || fract(dyF) > 0.0) { 6761 continue; 6762 } 6763 int idyF = int(dyF); 6764 6765 int wFPerm = `+ie+` - 1 - wF; 6766 6767 for (int wR = 0; wR < `+fe+`; wR++) { 6768 float dyR = float(dyRCorner + wR) / `+Re+`.0; 6769 6770 if (dyR < 0.0 || dyR >= `+Q.outHeight+`.0 || 6771 fract(dyR) > 0.0) { 6772 continue; 6773 } 6774 int idyR = int(dyR); 6775 6776 int wRPerm = `+fe+` - 1 - wR; 6777 6778 for (int wC = 0; wC < `+ye+`; wC++) { 6779 float dyC = float(dyCCorner + wC) / `+Pe+`.0; 6780 6781 if (dyC < 0.0 || dyC >= `+Q.outWidth+`.0 || 6782 fract(dyC) > 0.0) { 6783 continue; 6784 } 6785 int idyC = int(dyC); 6786 6787 int wCPerm = `+ye+` - 1 - wC; 6788 6789 for (int d2 = 0; d2 < `+Q.outChannels+`; d2++) { 6790 float xValue = getDy(batch, idyF, idyR, idyC, d2); 6791 float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2); 6792 dotProd += xValue * wValue; 6793 } 6794 } 6795 } 6796 } 6797 setOutput(dotProd); 6798 } 6799 `}(D);return this.compileAndRun(W,[p,w])},x.prototype.conv3dDerFilter=function(p,w,D){var W=new function(Q){this.variableNames=["x","dy"],this.outputShape=Q.filterShape;var ie=Q.strideDepth,fe=Q.strideHeight,ye=Q.strideWidth,Oe=Q.padInfo.front,Re=Q.padInfo.top,Pe=Q.padInfo.left;this.userCode=` 6800 void main() { 6801 ivec5 coords = getOutputCoords(); 6802 int wF = coords.x; 6803 int wR = coords.y; 6804 int wC = coords.z; 6805 int d1 = coords.w; 6806 int d2 = coords.u; 6807 6808 float dotProd = 0.0; 6809 6810 for (int b = 0; b < `+Q.batchSize+`; b++) { 6811 for (int yF = 0; yF < `+Q.outDepth+`; yF++) { 6812 int xF = wF + yF * `+ie+" - "+Oe+`; 6813 6814 if (xF < 0 || xF >= `+Q.inDepth+`) { 6815 continue; 6816 } 6817 6818 for (int yR = 0; yR < `+Q.outHeight+`; yR++) { 6819 int xR = wR + yR * `+fe+" - "+Re+`; 6820 6821 if (xR < 0 || xR >= `+Q.inHeight+`) { 6822 continue; 6823 } 6824 6825 for (int yC = 0; yC < `+Q.outWidth+`; yC++) { 6826 int xC = wC + yC * `+ye+" - "+Pe+`; 6827 6828 if (xC < 0 || xC >= `+Q.inWidth+`) { 6829 continue; 6830 } 6831 6832 float dyValue = getDy(b, yF, yR, yC, d2); 6833 float xValue = getX(b, xF, xR, xC, d1); 6834 dotProd += (xValue * dyValue); 6835 } 6836 } 6837 } 6838 } 6839 setOutput(dotProd); 6840 } 6841 `}(D);return this.compileAndRun(W,[p,w])},x.prototype.maxPool=function(p,w){var D=new iu(w,"max",!1);return this.compileAndRun(D,[p])},x.prototype.avgPool=function(p,w){var D=new iu(w,"avg",!1);return this.compileAndRun(D,[p],"float32")},x.prototype.maxPoolBackprop=function(p,w,D,W){var Q=new iu(W,"max",!0),ie=this.compileAndRun(Q,[w]),fe=new function(Oe){this.variableNames=["dy","maxPos"],this.outputShape=Oe.inShape;var Re=Oe.strideHeight,Pe=Oe.strideWidth,je=Oe.dilationHeight,Ge=Oe.effectiveFilterHeight,rt=Oe.effectiveFilterWidth,nt=Ge-1-Oe.padInfo.top,lt=rt-1-Oe.padInfo.left,Nt=Ge*rt-1;this.userCode=` 6842 const ivec2 pads = ivec2(`+nt+", "+lt+`); 6843 6844 void main() { 6845 ivec4 coords = getOutputCoords(); 6846 int b = coords[0]; 6847 int d = coords[3]; 6848 6849 ivec2 dyRCCorner = coords.yz - pads; 6850 int dyRCorner = dyRCCorner.x; 6851 int dyCCorner = dyRCCorner.y; 6852 6853 // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d). 6854 // ? = to be determined. : = across all values in that axis. 6855 float dotProd = 0.0; 6856 for (int wR = 0; wR < `+Ge+`; 6857 wR += `+je+`) { 6858 float dyR = float(dyRCorner + wR) / `+Re+`.0; 6859 6860 if (dyR < 0.0 || dyR >= `+Oe.outHeight+`.0 || fract(dyR) > 0.0) { 6861 continue; 6862 } 6863 int idyR = int(dyR); 6864 6865 for (int wC = 0; wC < `+rt+`; wC++) { 6866 float dyC = float(dyCCorner + wC) / `+Pe+`.0; 6867 6868 if (dyC < 0.0 || dyC >= `+Oe.outWidth+`.0 || 6869 fract(dyC) > 0.0) { 6870 continue; 6871 } 6872 int idyC = int(dyC); 6873 6874 float dyValue = getDy(b, idyR, idyC, d); 6875 int maxPosValue = `+Nt+` - int(getMaxPos(b, idyR, idyC, d)); 6876 6877 // Get the current value, check it against the value from the 6878 // position matrix. 6879 int curPosValue = wR * `+rt+` + wC; 6880 float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0); 6881 6882 dot
6882Prod += dyValue * mask; 6883 } 6884 } 6885 setOutput(dotProd); 6886 } 6887 `}(W),ye=this.compileAndRun(fe,[p,ie],w.dtype);return ie.dispose(),ye},x.prototype.avgPoolBackprop=function(p,w,D){var W=new function(Q){this.variableNames=["dy"],this.outputShape=Q.inShape;var ie=Q.filterHeight,fe=Q.filterWidth,ye=Q.strideHeight,Oe=Q.strideWidth,Re=Q.dilationHeight,Pe=Q.dilationWidth,je=Q.effectiveFilterHeight,Ge=Q.effectiveFilterWidth,rt=je-1-Q.padInfo.top,nt=Ge-1-Q.padInfo.left,lt=1/(ie*fe);this.userCode=` 6888 const ivec2 pads = ivec2(`+rt+", "+nt+`); 6889 const float avgMultiplier = float(`+lt+`); 6890 6891 void main() { 6892 ivec4 coords = getOutputCoords(); 6893 int b = coords[0]; 6894 int d = coords[3]; 6895 6896 ivec2 dyRCCorner = coords.yz - pads; 6897 int dyRCorner = dyRCCorner.x; 6898 int dyCCorner = dyRCCorner.y; 6899 6900 // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d). 6901 // ? = to be determined. : = across all values in that axis. 6902 float dotProd = 0.0; 6903 for (int wR = 0; wR < `+je+`; 6904 wR += `+Re+`) { 6905 float dyR = float(dyRCorner + wR) / `+ye+`.0; 6906 6907 if (dyR < 0.0 || dyR >= `+Q.outHeight+`.0 || fract(dyR) > 0.0) { 6908 continue; 6909 } 6910 int idyR = int(dyR); 6911 6912 for (int wC = 0; wC < `+Ge+`; 6913 wC+= `+Pe+`) { 6914 float dyC = float(dyCCorner + wC) / `+Oe+`.0; 6915 6916 if (dyC < 0.0 || dyC >= `+Q.outWidth+`.0 || 6917 fract(dyC) > 0.0) { 6918 continue; 6919 } 6920 int idyC = int(dyC); 6921 6922 float dyValue = getDy(b, idyR, idyC, d); 6923 6924 dotProd += dyValue * avgMultiplier; 6925 } 6926 } 6927 setOutput(dotProd); 6928 } 6929 `}(D);return this.compileAndRun(W,[p],w.dtype)},x.prototype.cast=function(p,w){return Ku(p,w,this)},x.prototype.unstack=function(p,w){for(var D=p.shape[w],W=new Array(p.rank-1),Q=0,ie=0;ie<p.rank;ie++)ie!==w&&(W[Q++]=p.shape[ie]);var fe=new Array(p.rank).fill(0),ye=p.shape.slice();ye[w]=1;var Oe=new Array(D);for(ie=0;ie<Oe.length;ie++)fe[w]=ie,Oe[ie]=this.slice(p,fe,ye).reshape(W);return Oe},x.prototype.avgPool3d=function(p,w){var D=new Do(w,"avg",!1);return this.compileAndRun(D,[p],"float32")},x.prototype.avgPool3dBackprop=function(p,w,D){var W=new function(Q){this.variableNames=["dy"],this.outputShape=Q.inShape;var ie=Q.filterDepth,fe=Q.filterHeight,ye=Q.filterWidth,Oe=Q.strideDepth,Re=Q.strideHeight,Pe=Q.strideWidth,je=Q.dilationDepth,Ge=Q.dilationHeight,rt=Q.dilationWidth,nt=Q.effectiveFilterDepth,lt=Q.effectiveFilterHeight,Nt=Q.effectiveFilterWidth,Rt=nt-1-Q.padInfo.front,Pt=lt-1-Q.padInfo.top,Kt=Nt-1-Q.padInfo.left,dn=1/(ie*fe*ye);this.userCode=` 6930 const ivec3 pads = ivec3(`+Rt+", "+Pt+", "+Kt+`); 6931 const float avgMultiplier = float(`+dn+`); 6932 6933 void main() { 6934 ivec5 coords = getOutputCoords(); 6935 int batch = coords.x; 6936 int ch = coords.u; 6937 6938 ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads; 6939 int dyDCorner = dyCorner.x; 6940 int dyRCorner = dyCorner.y; 6941 int dyCCorner = dyCorner.z; 6942 6943 // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get 6944 // dx(xD, xR, xC, ch). 6945 // ? = to be determined. : = across all values in that axis. 6946 float dotProd = 0.0; 6947 6948 for (int wD = 0; wD < `+nt+`; 6949 wD += `+je+`) { 6950 float dyD = float(dyDCorner + wD) / `+Oe+`.0; 6951 6952 if (dyD < 0.0 || dyD >= `+Q.outDepth+`.0 || fract(dyD) > 0.0) { 6953 continue; 6954 } 6955 int idyD = int(dyD); 6956 6957 for (int wR = 0; wR < `+lt+`; 6958 wR += `+Ge+`) { 6959 float dyR = float(dyRCorner + wR) / `+Re+`.0; 6960 6961 if (dyR < 0.0 || dyR >= `+Q.outHeight+`.0 || 6962 fract(dyR) > 0.0) { 6963 continue; 6964 } 6965 int idyR = int(dyR); 6966 6967 for (int wC = 0; wC < `+Nt+`; 6968 wC += `+rt+`) { 6969 float dyC = float(dyCCorner + wC) / `+Pe+`.0; 6970 6971 if (dyC < 0.0 || dyC >= `+Q.outWidth+`.0 || 6972 fract(dyC) > 0.0) { 6973 continue; 6974 } 6975 int idyC = int(dyC); 6976 6977 float dyValue = getDy(batch, idyD, idyR, idyC, ch); 6978 6979 dotProd += dyValue * avgMultiplier; 6980 } 6981 } 6982 } 6983 setOutput(dotProd); 6984 } 6985 `}(D);return this.compileAndRun(W,[p],w.dtype)},x.prototype.maxPool3d=function(p,w){var D=new Do(w,"max",!1);return this.compileAndRun(D,[p],"float32")},x.prototype.maxPool3dBackprop=function(p,w,D,W){var Q=new Do(W,"max",!0),ie=this.compileAndRun(Q,[w]),fe=new function(Oe){this.variableNames=["dy","maxPos"],this.outputShape=Oe.inShape;var Re=Oe.strideDepth,Pe=Oe.strideHeight,je=Oe.strideWidth,Ge=Oe.dilationDepth,rt=Oe.dilationHeight,nt=Oe.dilationWidth,lt=Oe.effectiveFilterDepth,Nt=Oe.effectiveFilterHeight,Rt=Oe.effectiveFilterWidth,Pt=lt-1-Oe.padInfo.front,Kt=Nt-1-Oe.padInfo.top,dn=Rt-1-Oe.padInfo.left,bn=lt*Nt*Rt-1;this.userCode=` 6986 const ivec3 pads = ivec3(`+Pt+", "+Kt+", "+dn+`); 6987 6988 void main() { 6989 ivec5 coords = getOutputCoords(); 6990 int batch = coords.x; 6991 int ch = coords.u; 6992 6993 ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads; 6994 int dyDCorner = dyCorner.x; 6995 int dyRCorner = dyCorner.y; 6996 int dyCCorner = dyCorner.z; 6997 6998 // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get
6999 // dx(xD, xR, xC, ch). 7000 // ? = to be determined. : = across all values in that axis. 7001 float dotProd = 0.0; 7002 7003 for (int wD = 0; wD < `+lt+`; 7004 wD += `+Ge+`) { 7005 float dyD = float(dyDCorner + wD) / `+Re+`.0; 7006 7007 if (dyD < 0.0 || dyD >= `+Oe.outDepth+`.0 || fract(dyD) > 0.0) { 7008 continue; 7009 } 7010 int idyD = int(dyD); 7011 7012 for (int wR = 0; wR < `+Nt+`; 7013 wR += `+rt+`) { 7014 float dyR = float(dyRCorner + wR) / `+Pe+`.0; 7015 7016 if (dyR < 0.0 || dyR >= `+Oe.outHeight+`.0 || 7017 fract(dyR) > 0.0) { 7018 continue; 7019 } 7020 int idyR = int(dyR); 7021 7022 for (int wC = 0; wC < `+Rt+`; 7023 wC += `+nt+`) { 7024 float dyC = float(dyCCorner + wC) / `+je+`.0; 7025 7026 if (dyC < 0.0 || dyC >= `+Oe.outWidth+`.0 || 7027 fract(dyC) > 0.0) { 7028 continue; 7029 } 7030 int idyC = int(dyC); 7031 7032 float dyValue = getDy(batch, idyD, idyR, idyC, ch); 7033 int maxPosValue = `+bn+` - 7034 int(getMaxPos(batch, idyD, idyR, idyC, ch)); 7035 7036 // Get the current value, check it against the value from the 7037 // position matrix. 7038 int curPosValue = 7039 wD * `+Nt+" * "+Rt+` + 7040 wR * `+Rt+` + wC; 7041 float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0); 7042 7043 dotProd += dyValue * mask; 7044 } 7045 } 7046 } 7047 setOutput(dotProd); 7048 } 7049 `}(W),ye=this.compileAndRun(fe,[p,ie],w.dtype);return ie.dispose(),ye},x.prototype.reshape=function(p,w){var D=this.texData.get(p.dataId);if(D.isPacked&&!vc(p.shape,w)&&(D.texture===null||!vc(D.shape,w))){var W=this.packedReshape(p,w);return qe.makeTensorFromDataId(W.dataId,W.shape,W.dtype)}return Fc(p,w)},x.prototype.resizeBilinear=function(p,w,D,W){var Q=L().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new function(ie,fe,ye,Oe){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];var Re=ie[0],Pe=ie[1],je=ie[2],Ge=ie[3];this.outputShape=[Re,fe,ye,Ge];var rt=[Oe&&fe>1?Pe-1:Pe,Oe&&ye>1?je-1:je],nt=[Oe&&fe>1?fe-1:fe,Oe&&ye>1?ye-1:ye];this.userCode=` 7050 const vec3 effectiveInputOverOutputRatioRC = vec3( 7051 `+rt[0]/nt[0]+`, 7052 `+rt[1]/nt[1]+`, 7053 `+rt[1]/nt[1]+`); 7054 const vec3 inputShapeRC = vec3(`+Pe+".0, "+je+`.0, 7055 `+je+`.0); 7056 7057 float getAValue(int b, int r, int c, int d) { 7058 return getChannel(getA(b, r, c, d), vec2(c, d)); 7059 } 7060 7061 void main() { 7062 ivec4 coords = getOutputCoords(); 7063 int b = coords[0]; 7064 int d = coords[3]; 7065 // Calculate values for next column in yRC.z. 7066 ivec3 yRC = coords.yzz + ivec3(0, 0, 1); 7067 7068 // Fractional source index. 7069 vec3 sourceFracIndexRC = vec3(yRC) * effectiveInputOverOutputRatioRC; 7070 7071 // Compute the four integer indices. 7072 ivec3 sourceFloorRC = ivec3(sourceFracIndexRC); 7073 ivec3 sourceCeilRC = ivec3( 7074 min(inputShapeRC - 1.0, ceil(sourceFracIndexRC))); 7075 7076 // Should we calculate next column and row elements in 2x2 packed cell. 7077 bool hasNextCol = d < `+(Ge-1)+`; 7078 bool hasNextRow = coords.z < `+(ye-1)+`; 7079 7080 // In parallel, construct four corners for all four components in 7081 // packed 2x2 cell. 7082 vec4 topLeft = vec4( 7083 getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d), 7084 hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1) 7085 : 0.0, 7086 hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d) 7087 : 0.0, 7088 (hasNextRow && hasNextCol) ? 7089 getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0); 7090 7091 vec4 bottomLeft = vec4( 7092 getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d), 7093 hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1) 7094 : 0.0, 7095 hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d) 7096 : 0.0, 7097 (hasNextRow && hasNextCol) ?
7098 getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0); 7099 7100 vec4 topRight = vec4( 7101 getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d), 7102 hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1) 7103 : 0.0, 7104 hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d) 7105 : 0.0, 7106 (hasNextRow && hasNextCol) ? 7107 getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0); 7108 7109 vec4 bottomRight = vec4( 7110 getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d), 7111 hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1) 7112 : 0.0, 7113 hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d) 7114 : 0.0, 7115 (hasNextRow && hasNextCol) ? 7116 getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0); 7117 7118 vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC); 7119 7120 vec4 top = mix(topLeft, topRight, fracRC.yyzz); 7121 vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz); 7122 vec4 newValue = mix(top, bottom, fracRC.x); 7123 7124 setOutput(newValue); 7125 } 7126 `}(p.shape,w,D,W):new function(ie,fe,ye,Oe){this.variableNames=["A"],this.outputShape=[];var Re=ie[0],Pe=ie[1],je=ie[2],Ge=ie[3];this.outputShape=[Re,fe,ye,Ge];var rt=[Oe&&fe>1?Pe-1:Pe,Oe&&ye>1?je-1:je],nt=[Oe&&fe>1?fe-1:fe,Oe&&ye>1?ye-1:ye];this.userCode=` 7127 const vec2 effectiveInputOverOutputRatioRC = vec2( 7128 `+rt[0]/nt[0]+`, 7129 `+rt[1]/nt[1]+`); 7130 const vec2 inputShapeRC = vec2(`+Pe+".0, "+je+`.0); 7131 7132 void main() { 7133 ivec4 coords = getOutputCoords(); 7134 int b = coords[0]; 7135 int d = coords[3]; 7136 ivec2 yRC = coords.yz; 7137 7138 // Fractional source index. 7139 vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC; 7140 7141 // Compute the four integer indices. 7142 ivec2 sourceFloorRC = ivec2(sourceFracIndexRC); 7143 ivec2 sourceCeilRC = ivec2( 7144 min(inputShapeRC - 1.0, ceil(sourceFracIndexRC))); 7145 7146 float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d); 7147 float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d); 7148 float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d); 7149 float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d); 7150 7151 vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC); 7152 7153 float top = topLeft + (topRight - topLeft) * fracRC.y; 7154 float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y; 7155 float newValue = top + (bottom - top) * fracRC.x; 7156 7157 setOutput(newValue); 7158 } 7159 `}(p.shape,w,D,W);return this.compileAndRun(Q,[p],"float32")},x.prototype.resizeBilinearBackprop=function(p,w,D){var W=new function(Q,ie,fe){this.variableNames=["dy"],this.outputShape=[],this.outputShape=ie.shape;var ye=ie.shape,Oe=ye[1],Re=ye[2],Pe=Q.shape,je=Pe[1],Ge=Pe[2],rt=[fe&&je>1?Oe-1:Oe,fe&&Ge>1?Re-1:Re],nt=[fe&&je>1?je-1:je,fe&&Ge>1?Ge-1:Ge],lt=rt[0]/nt[0],Nt=rt[1]/nt[1],Rt=1/lt,Pt=1/Nt,Kt=2*Math.ceil(Rt)+2,dn=2*Math.ceil(Pt)+2;this.userCode=` 7160 void main() { 7161 ivec4 coords = getOutputCoords(); 7162 int b = coords[0]; 7163 int d = coords[3]; 7164 int r = coords[1]; 7165 int c = coords[2]; 7166 7167 float accumulator = 0.0; 7168 7169 const float heightScale = float(`+lt+`); 7170 const float widthScale = float(`+Nt+`); 7171 7172 const float invHeightScale = float(`+Rt+`); 7173 const float invWidthScale = float(`+Pt+`); 7174 7175 const int winHeight = int(`+Kt+`); 7176 const int winWidth = int(`+dn+`); 7177 7178 // Compute bounds for where in dy we will look 7179 float startRLerp = floor(float(r) * invHeightScale); 7180 int startDyR = int(startRLerp - float(winHeight / 2)); 7181 7182 float startCLerp = floor(float(c) * invWidthScale); 7183 int startDyC = int(startCLerp - float(winWidth / 2)); 7184 7185 // Loop over dy 7186 for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) { 7187 int dyR = dyROffset + startDyR; 7188 7189 // Guard against the window exceeding the bounds of dy 7190 if (dyR < 0 || dyR >= `+je+`) { 7191 continue; 7192 } 7193 7194 for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) { 7195 int dyC = dyCOffset + startDyC; 7196 7197 // Guard against the window exceeding the bounds of dy 7198 if (dyC < 0 || dyC >= `+Ge+`) { 7199 continue; 7200 } 7201 7202 float dxR = float(dyR) * heightScale; 7203 int topDxRIndex = int(floor(dxR)); 7204 int bottomDxRIndex = int(min(ceil(dxR), `+(Oe-1)+`.0)); 7205 float dxRLerp = dxR - float(topDxRIndex); 7206 float inverseDxRLerp = 1.0 - dxRLerp; 7207 7208 float dxC = float(dyC) * widthScale; 7209 int leftDxCIndex = int(floor(dxC)); 7210 int rightDxCIndex = int(min(ceil(dxC), `+(Re-1)+`.0)); 7211 float dxCLerp = dxC - float(leftDxCIndex); 7212 float inverseDxCLerp = 1.0 - dxCLerp; 7213 7214 if (r == topDxRIndex && c == leftDxCIndex) { 7215 // topLeft 7216 accumulator += 7217 getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp; 7218 } 7219 7220 if (r == topDxRIndex && c == rightDxCIndex) { 7221 // topRight 7222 accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp; 7223 } 7224 7225 if (r == bottomDxRIndex && c == leftDxCIndex) { 7226 // bottomLeft 7227 accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp; 7228 } 7229 7230 if (r == bottomDxRIndex && c == rightDxCIndex) { 7231 // bottomRight 7232 accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp; 7233 } 7234 } 7235 } 7236 // End loop over dy 7237 7238 setOutput(accumulator); 7239 } 7240 `}(p,w,D);return this.compileAndRun(W,[p])},x.prototype.resizeNearestNeighbor=function(p,w,D,W){var Q=new function(ie,fe,ye,Oe){this.variableNames=["A"],this.outputShape=[];var Re=ie[0],Pe=ie[1],je=ie[2],Ge=ie[3];this.outputShape=[Re,fe,ye,Ge];var rt=[Oe&&fe>1?Pe-1:Pe,Oe&&ye>1?je-1:je],nt=[Oe&&fe>1?fe-1:fe,Oe&&ye>1?ye-1:ye],lt=Oe?"0.5":"0.0";this.userCode=` 7241 const vec2 effectiveInputOverOutputRatioRC = vec2( 7242 `+rt[0]/nt[0]+`, 7243 `+rt[1]/nt[1]+`); 7244 const vec2 inputShapeRC = vec2(`+Pe+".0, "+je+`.0); 7245 7246 void main() { 7247 ivec4 coords = getOutputCoords(); 7248 int b = coords[0]; 7249 int d = coords[3]; 7250 ivec2 yRC = coords.yz; 7251 7252 // Fractional source index. 7253 vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC; 7254 7255 // Compute the coordinators of nearest neighbor point. 7256 ivec2 sourceNearestRC = ivec2( 7257 min(inputShapeRC - 1.0, floor(sourceFracIndexRC + `+lt+`))); 7258 7259 float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d); 7260 7261 setOutput(newValue); 7262 } 7263 `}(p.shape,w,D,W);return this.compileAndRun(Q,[p])},x.prototype.resizeNearestNeighborBackprop=function(p,w,D){var W=new function(Q,ie,fe){this.variableNames=["dy"],this.outputShape=[],this.outputShape=ie.shape;var ye=ie.shape,Oe=ye[1],Re=ye[2],Pe=Q.shape,je=Pe[1],Ge=Pe[2],rt=[fe&&je>1?Oe-1:Oe,fe&&Ge>1?Re-1:Re],nt=[fe&&je>1?je-1:je,fe&&Ge>1?Ge-1:Ge],lt=rt[0]/nt[0],Nt=rt[1]/nt[1],Rt=1/lt,Pt=1/Nt,Kt=2*Math.ceil(Rt)+2,dn=2*Math.ceil(Pt)+2;this.userCode=` 7264 void main() { 7265 ivec4 coords = getOutputCoords(); 7266 int b = coords[0]; 7267 int d = coords[3]; 7268 int r = coords[1]; 7269 int c = coords[2]; 7270 7271 float accumulator = 0.0; 7272 7273 const float heightScale = float(`+lt+`); 7274 const float widthScale = float(`+Nt+`); 7275 7276 const float invHeightScale = float(`+Rt+`); 7277 const float invWidthScale = float(`+Pt+`); 7278 7279 const int winHeight = int(`+Kt+`); 7280 const int winWidth = int(`+dn+`); 7281 7282 // Compute bounds for where in dy we will look 7283 float startRLerp = floor(float(r) * invHeightScale); 7284 int startDyR = int(floor(startRLerp - float(winHeight / 2))); 7285 7286 float startCLerp = floor(float(c) * invWidthScale); 7287 int startDyC = int(floor(startCLerp - float(winWidth / 2))); 7288 7289 // Loop over dy 7290 for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) { 7291 int dyR = dyROffset + startDyR; 7292 7293 // Guard against the window exceeding the bounds of dy 7294 if (dyR < 0 || dyR >= `+je+`) { 7295 continue; 7296 } 7297 7298 for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) { 7299 int dyC = dyCOffset + startDyC; 7300 7301 // Guard against the window exceeding the bounds of dy 7302 if (dyC < 0 || dyC >= `+Ge+`) { 7303 continue; 7304 } 7305 7306 float sourceFracRow = 7307 float(`+rt[0]+`) * 7308 (float(dyR) / float(`+nt[0]+`)); 7309 7310 float sourceFracCol = 7311 float(`+rt[1]+`) * 7312 (float(dyC) / float(`+nt[1]+`)); 7313 7314 int sourceNearestRow = int(min( 7315 float(int(`+Oe+`) - 1), 7316 `+fe+` ? float(round(sourceFracRow)) : 7317 float(floor(sourceFracRow)))); 7318 7319 int sourceNearestCol = int(min( 7320 float(int(`+Re+`) - 1), 7321 `+fe+` ? float(round(sourceFracCol)) : 7322 float(floor(sourceFracCol)))); 7323 7324 if (r == sourceNearestRow && c == sourceNearestCol) { 7325 accumulator += getDy(b, dyR, dyC, d); 7326 } 7327 } 7328 } 7329 // End loop over dy 7330 7331 setOutput(accumulator); 7332 } 7333 `}(p,w,D);return this.compileAndRun(W,[p])},x.prototype.multinomial=function(p,w,D,W){var Q=w?p:Eu(p),ie=Q.shape[0],fe=Q.shape[1],ye=new Cu(ie,fe,D),Oe=ye.getCustomSetupFunc(W);return this.compileAndRun(ye,[Q],"int32",Oe)},x.prototype.oneHot=function(p,w,D,W){var Q=new function(ie,fe,ye,Oe){this.variableNames=["indices"],this.outputShape=[ie,fe],this.userCode=` 7334 void main() { 7335 ivec2 coords = getOutputCoords(); 7336 int index = round(getIndices(coords.x)); 7337 setOutput(mix(float(`+Oe+"), float("+ye+`), 7338 float(index == coords.y))); 7339 } 7340 `}(p.size,w,D,W);return this.compileAndRun(Q,[p])},x.prototype.diag=function(p){var w=new function(D){this.variableNames=["X"],this.outputShape=[D,D],this.userCode=` 7341 void main() { 7342 ivec2 coords = getOutputCoords(); 7343 float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0; 7344 setOutput(val); 7345 } 7346 `}(p.size);return this.compileAndRun(w,[p])},x.prototype.nonMaxSuppression=function(p,w,D,W,Q){return yf("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead"),Bc(p.dataSync(),w.dataSync(),D,W,Q)},x.prototype.cropAndResize=function(p,w,D,W,Q,ie){var fe=new function(ye,Oe,Re,Pe,je){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var Ge=ye[0],rt=ye[1],nt=ye[2],lt=ye[3],Nt=Oe[0],Rt=Re[0],Pt=Re[1];this.outputShape=[Nt,Rt,Pt,lt];var Kt=Pe==="bilinear"?1:0,dn=[rt-1+".0",nt-1+".0"],bn=dn[0],pn=dn[1],_n=Rt>1?[""+(rt-1)/(Rt-1),"(y2-y1) * height_ratio","y1*"+bn+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+bn],On=_n[0],_=_n[1],m=_n[2],f=Pt>1?[""+(nt-1)/(Pt-1),"(x2-x1) * width_ratio","x1*"+pn+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+pn],y=f[0],E=f[1],z=f[2];this.userCode=` 7347 const float height_ratio = float(`+On+`); 7348 const float width_ratio = float(`+y+`); 7349 void main() { 7350 ivec4 coords = getOutputCoords(); 7351 int b = coords[0]; 7352 int y = coords[1]; 7353 int x = coords[2]; 7354 int d = coords[3]; 7355 7356 // get box vals 7357 float y1 = getBoxes(b,0); 7358 float x1 = getBoxes(b,1); 7359 float y2 = getBoxes(b,2); 7360 float x2 = getBoxes(b,3); 7361 7362 // get image in batch index 7363 int bInd = round(getBoxInd(b)); 7364 if(bInd < 0 || bInd >= `+Ge+`) { 7365 return; 7366 } 7367 7368 float height_scale = `+_+`; 7369 float width_scale = `+E+`; 7370 7371 float in_y = `+m+`; 7372 if( in_y < 0.0 || in_y > `+bn+` ) { 7373 setOutput(float(`+je+`)); 7374 return; 7375 } 7376 float in_x = `+z+`; 7377 if( in_x < 0.0 || in_x > `+pn+` ) { 7378 setOutput(float(`+je+`)); 7379 return; 7380 } 7381 7382 vec2 sourceFracIndexCR = vec2(in_x,in_y); 7383 if(`+Kt+` == 1) { 7384 // Compute the four integer indices. 7385 ivec2 sourceFloorCR = ivec2(sourceFracIndexCR); 7386 ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR)); 7387 7388 float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d); 7389 float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d); 7390 float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d); 7391 float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d); 7392 7393 vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR); 7394 7395 float top = topLeft + (topRight - topLeft) * fracCR.x; 7396 float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x; 7397 float newValue = top + (bottom - top) * fracCR.y; 7398 setOutput(newValue); 7399 } else { 7400 // Compute the coordinators of nearest neighbor point. 7401 ivec2 sourceNearestCR = ivec2(floor( 7402 sourceFracIndexCR + vec2(0.5,0.5))); 7403 float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d); 7404 setOutput(newValue); 7405 } 7406 } 7407 `}(p.shape,w.shape,W,Q,ie);return this.compileAndRun(fe,[p,w,D],"float32")},x.prototype.depthToSpace=function(p,w,D){Ee(w>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+w});var W=p.shape[0],Q=D==="NHWC"?p.shape[1]:p.shape[2],ie=D==="NHWC"?p.shape[2]:p.shape[3],fe=D==="NHWC"?p.shape[3]:p.shape[1],ye=Q*w,Oe=ie*w,Re=fe/(w*w),Pe=new ja(D==="NHWC"?[W,ye,Oe,Re]:[W,Re,ye,Oe],w,D);return this.compileAndRun(Pe,[p])},x.prototype.split=function(p,w,D){return vd(p,w,D)},x.prototype.scatterND=function(p,w,D){var W=Ef(0,p,D),Q=W.sliceRank,ie=W.numUpdates,fe=W.sliceSize,ye=W.strides,Oe=W.outputSize,Re=[Oe/fe,fe],Pe=p.reshape([ie,Q]),je=w.reshape([ie,fe]);if(Oe===0)return Fc(Qo([]),D);var Ge=Or(0),rt=new Su(ie,Q,Pe.rank,je.rank,ye,Re);
7407return this.compileAndRun(rt,[je,Pe,Ge]).reshape(D)},x.prototype.sparseToDense=function(p,w,D,W){var Q=Ef(0,p,D),ie=Q.sliceRank,fe=Q.numUpdates,ye=Q.strides,Oe=Q.outputSize,Re=new Su(fe,ie,p.rank,w.rank,ye,[Oe,1]);return this.compileAndRun(Re,[w,p,W]).reshape(D)},x.prototype.fft=function(p){return this.fftImpl(p,!1)},x.prototype.ifft=function(p){return this.fftImpl(p,!0)},x.prototype.fftImpl=function(p,w){var D=this.texData.get(p.dataId),W=new pa("return real * expR - imag * expI;",p.shape,w),Q=new pa("return real * expI + imag * expR;",p.shape,w),ie=[this.makeComplexComponentTensorInfo(p,D.complexTensors.real),this.makeComplexComponentTensorInfo(p,D.complexTensors.imag)],fe=this.compileAndRun(W,ie),ye=this.compileAndRun(Q,ie),Oe=this.complex(fe,ye).as2D(p.shape[0],p.shape[1]);return fe.dispose(),ye.dispose(),Oe},x.prototype.gatherND=function(p,w){var D=w.shape,W=D[D.length-1],Q=nl(p,w),ie=Q[0],fe=Q[1],ye=Q[2],Oe=Q[3],Re=w.reshape([fe,W]),Pe=p.reshape([p.size/ye,ye]),je=new function(Ge,rt,nt){this.sliceDim=Ge,this.strides=rt,this.variableNames=["x","indices"],this.outputShape=nt;var lt=Vn(rt.length),Nt=Vn(nt.length),Rt=this.sliceDim>1?"strides[j]":"strides";this.userCode=` 7408 `+lt+" strides = "+lt+"("+this.strides+`); 7409 void main() { 7410 `+Nt+` coords = getOutputCoords(); 7411 int flattenIndex = 0; 7412 for (int j = 0; j < `+this.sliceDim+`; j++) { 7413 int index = round(getIndices(coords[0], j)); 7414 flattenIndex += index * `+Rt+`; 7415 } 7416 setOutput(getX(flattenIndex, coords[1])); 7417 } 7418 `}(W,Oe,[fe,ye]);return this.compileAndRun(je,[Pe,Re]).reshape(ie)},x.prototype.fill=function(p,w,D){if((D=D||xe(w))==="string"){var W=Yt(D,Ke(p));
vendor: 193,150 bytes, lines 7418-7664
7418return W.fill(w),qe.makeTensor(W,p,D,this)}var Q=new Ta(p,w),ie=Q.getCustomSetupFunc(w);return this.compileAndRun(Q,[],D,ie)},x.prototype.onesLike=function(p){if(p.dtype==="string")throw new Error("onesLike is not supported under string dtype");return this.fill(p.shape,1,p.dtype)},x.prototype.zerosLike=function(p){return this.fill(p.shape,p.dtype==="string"?"":0,p.dtype)},x.prototype.linspace=function(p,w,D){return il(p,w,D)},x.prototype.makeTensorInfo=function(p,w){var D=this.write(null,p,w);return this.texData.get(D).usage=null,{dataId:D,shape:p,dtype:w}},x.prototype.makeOutput=function(p,w){var D=this.makeTensorInfo(p,w).dataId;return qe.makeTensorFromDataId(D,p,w,this)},x.prototype.unpackTensor=function(p){var w=new function(D){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=D;var W=D.length,Q=H("rc",W),ie=Vn(W),fe=function(Re,Pe){if(Re===1)return"rc";for(var je="",Ge=0;Ge<Re;Ge++)je+=Pe[Ge],Ge<Re-1&&(je+=",");return je}(W,Q),ye=Q.slice(-2),Oe=W<=1?"rc":"vec2("+ye.join(",")+")";this.userCode=` 7419 void main() { 7420 `+ie+` rc = getOutputCoords(); 7421 vec4 packedInput = getA(`+fe+`); 7422 7423 setOutput(getChannel(packedInput, `+Oe+`)); 7424 } 7425 `}(p.shape);return this.runWebGLProgram(w,[p],p.dtype)},x.prototype.packTensor=function(p){var w=new function(D){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=D;var W=D.length;if(W===0)this.userCode=` 7426 void main() { 7427 setOutput(vec4(getA(), 0., 0., 0.)); 7428 } 7429 `;else{var Q=H("rc",W),ie=Vn(W),fe=function(Re,Pe,je){if(Re===1)return"rc > "+Pe[0];for(var Ge="",rt=Re-2;rt<Re;rt++)Ge+=je[rt]+" >= "+Pe[rt],rt<Re-1&&(Ge+="||");return Ge}(W,D,Q),ye=function(Re,Pe,je,Ge){if(Re===1)return"";var rt=Ge.slice(-2);return` 7430 int r = `+rt[0]+`; 7431 int c = `+rt[1]+`; 7432 int rp1 = r + 1; 7433 int cp1 = c + 1; 7434 7435 bool cEdge = cp1 >= `+Pe+`; 7436 bool rEdge = rp1 >= `+je+`; 7437 `}(W,D[D.length-1],D[D.length-2],Q),Oe=function(Re,Pe){var je=Re.length,Ge=function(rt,nt){for(var lt=[],Nt=0;Nt<=1;Nt++)for(var Rt=0;Rt<=1;Rt++){for(var Pt=(Nt===0?"r":"rp1")+", "+(Rt===0?"c":"cp1"),Kt=2;Kt<rt;Kt++)Pt=nt[nt.length-1-Kt]+","+Pt;lt.push(Pt)}return lt}(je,Pe);return je===1?`getA(rc), 7438 rc + 1 >= `+Re[0]+` ? 0. : getA(rc + 1), 7439 0, 0`:"getA("+Ge[0]+`), 7440 cEdge ? 0. : getA(`+Ge[1]+`), 7441 rEdge ? 0. : getA(`+Ge[2]+`), 7442 rEdge || cEdge ? 0. : getA(`+Ge[3]+")"}(D,Q);this.userCode=` 7443 void main() { 7444 `+ie+` rc = getOutputCoords(); 7445 7446 if(`+fe+`) { 7447 setOutput(vec4(0)); 7448 } else { 7449 `+ye+` 7450 7451 setOutput(vec4(`+Oe+`)); 7452 } 7453 } 7454 `}}(p.shape);return this.runWebGLProgram(w,[p],p.dtype,null,!0)},x.prototype.packedReshape=function(p,w){var D=[Zs(p.shape)].concat(ls(p.shape)),W={dtype:p.dtype,shape:D,dataId:p.dataId},Q=new function(fe,ye){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=fe;for(var Oe="",Re=0;Re<4;Re++){var Pe="thisRC = rc;";Re%2==1&&(Pe+="thisRC.z += 1;"),Re>1&&(Pe+="thisRC.y += 1;"),Oe+=` 7455 `+Pe+` 7456 `+(Re>0?"if(thisRC.y < rows && thisRC.z < cols){":"")+` 7457 int flatIndex = getFlatIndex(thisRC); 7458 7459 ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex); 7460 vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z)); 7461 7462 result[`+Re+`] = 7463 getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims); 7464 `+(Re>0?"}":"")+` 7465 `}this.userCode=` 7466 7467 ivec3 inputCoordsFromReshapedOutCoords(int index) { 7468 `+Le(["r","c","d"],ye)+` 7469 return ivec3(r, c, d); 7470 } 7471 7472 `+Qe(fe)+` 7473 7474 void main() { 7475 ivec3 rc = getOutputCoords(); 7476 7477 vec4 result = vec4(0.); 7478 7479 ivec3 thisRC; 7480 int rows = `+fe[1]+`; 7481 int cols = `+fe[2]+`; 7482 7483 `+Oe+` 7484 7485 setOutput(result); 7486 } 7487 `}([Zs(w)].concat(ls(w)),D),ie=this.runWebGLProgram(Q,[W],p.dtype,null,!0);return{dataId:ie.dataId,shape:w,dtype:ie.dtype}},x.prototype.decode=function(p){var w,D=this.texData.get(p),W=D.isPacked,Q=D.shape,ie=D.dtype,fe=xl(Q);return w=W?new function(ye){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=sr.DENSE;var Oe=Ji(ye),Re=ue();this.outputShape=ye,this.userCode=` 7488 ivec3 outCoordsFromFlatIndex(int index) { 7489 `+Le(["r","c","d"],ye)+` 7490 return ivec3(r, c, d); 7491 } 7492 7493 void main() { 7494 ivec2 resTexRC = ivec2(resultUV.yx * 7495 vec2(`+Oe[0]+", "+Oe[1]+`)); 7496 int index = 4 * (resTexRC.x * `+Oe[1]+` + resTexRC.y); 7497 7498 vec4 result = vec4(0.); 7499 7500 for (int i=0; i<4; i++) { 7501 int flatIndex = index + i; 7502 ivec3 rc = outCoordsFromFlatIndex(flatIndex); 7503 result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z)); 7504 } 7505 7506 `+Re.output+` = result; 7507 } 7508 `}(fe):new function(ye){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=sr.DENSE;var Oe=Ji(ye),Re=ue();this.outputShape=ye,this.userCode=` 7509 ivec3 outCoordsFromFlatIndex(int index) { 7510 `+Le(["r","c","d"],ye)+` 7511 return ivec3(r, c, d); 7512 } 7513 7514 void main() { 7515 ivec2 resTexRC = ivec2(resultUV.yx * 7516 vec2(`+Oe[0]+", "+Oe[1]+`)); 7517 int index = 4 * (resTexRC.x * `+Oe[1]+` + resTexRC.y); 7518 7519 vec4 result = vec4(0.); 7520 7521 for (int i=0; i<4; i++) { 7522 int flatIndex = index + i; 7523 ivec3 rc = outCoordsFromFlatIndex(flatIndex); 7524 result[i] = getA(rc.x, rc.y, rc.z); 7525 } 7526 7527 `+Re.output+` = result; 7528 } 7529 `}(fe),{dtype:ie,shape:Q,dataId:this.runWebGLProgram(w,[{shape:fe,dtype:ie,dataId:p}],ie,null,!0).dataId}},x.prototype.runWebGLProgram=function(p,w,D,W,Q){var ie=this;Q===void 0&&(Q=!1);var fe=this.makeTensorInfo(p.outputShape,D),ye=this.texData.get(fe.dataId);if(p.packedOutput&&(ye.isPacked=!0),p.outPackingScheme===sr.DENSE){var Oe=Ji(p.outputShape);ye.texShape=Oe.map(function(Rt){return 2*Rt})}if(p.outTexUsage!=null&&(ye.usage=p.outTexUsage),Ke(fe.shape)===0)return ye.values=yn(fe.dtype,0),fe;var Re=[],Pe=w.map(function(Rt){if(Rt.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var Pt=ie.texData.get(Rt.dataId);if(Pt.texture==null){if(!p.packedInputs&&Ke(Rt.shape)<=L().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:Rt.shape,texData:null,isUniform:!0,uniformValues:Pt.values};p.packedInputs&&(Pt.isPacked=!0,Pt.shape=Rt.shape)}else if(!!Pt.isPacked!=!!p.packedInputs)Rt=Pt.isPacked?ie.unpackTensor(Rt):ie.packTensor(Rt),Re.push(Rt),Pt=ie.texData.get(Rt.dataId);else if(Pt.isPacked&&!vc(Pt.shape,Rt.shape)){var Kt=Rt,dn=Rt.shape;Rt.shape=Pt.shape,Rt=ie.packedReshape(Rt,dn),Re.push(Rt),Pt=ie.texData.get(Rt.dataId),Kt.shape=dn}return ie.uploadToGPU(Rt.dataId),{shape:Rt.shape,texData:Pt,isUniform:!1}});this.uploadToGPU(fe.dataId);var je,Ge={shape:fe.shape,texData:ye,isUniform:!1},rt=function(Rt,Pt,Kt){var dn="";Pe.concat(Kt).forEach(function(pn){var _n=pn.texData!=null&&pn.texData.slice!=null&&pn.texData.slice.flatOffset>0,On=pn.isUniform?"uniform":pn.texData.texShape;dn+=pn.shape+"_"+On+"_"+_n});var bn=Rt.userCode;return Rt.constructor.name+"_"+dn+"_"+bn}(p,0,Ge),nt=this.getAndSaveBinary(rt,function(){return function(Rt,Pt,Kt,dn){var bn=Pt.userCode,pn=Kt.map(function(Z,le){var de={logicalShape:Z.shape,texShape:Z.isUniform?null:Z.texData.texShape,isUniform:Z.isUniform,isPacked:!Z.isUniform&&Z.texData.isPacked,flatOffset:null};return Z.texData!=null&&Z.texData.slice!=null&&Z.texData.slice.flatOffset>0&&(de.flatOffset=Z.texData.slice.flatOffset),{name:Pt.variableNames[le],shapeInfo:de}}),_n=pn.map(function(Z){return Z.shapeInfo}),On={logicalShape:dn.shape,texShape:dn.texData.texShape,isUniform:!1,isPacked:dn.texData.isPacked,flatOffset:null},_=qt(pn,On,bn,Pt.packedInputs),m=Rt.createProgram(_),f=null,y=Rt.getUniformLocation(m,"NAN",!1);L().getNumber("WEBGL_VERSION")===1&&(f=Rt.getUniformLocation(m,"INFINITY",!1));for(var E={},z=0;z<Pt.variableNames.length;z++){var Y=Pt.variableNames[z];E[Y]=Rt.getUniformLocation(m,Y,!1),E["offset"+Y]=Rt.getUniformLocation(m,"offset"+Y,!1)}return{program:Pt,source:_,webGLProgram:m,uniformLocations:E,inShapeInfos:_n,outShapeInfo:On,infLoc:f,nanLoc:y}}(ie.gpgpu,p,Pe,Ge)}),lt=this.activeTimers!=null;if(lt&&(je=this.startTimer()),function(Rt,Pt,Kt,dn,bn){Fu(Pt.inShapeInfos,Kt),Fu([Pt.outShapeInfo],[dn]);var pn=dn.texData.texture,_n=dn.texData.texShape;dn.texData.isPacked?Rt.setOutputPackedMatrixTexture(pn,_n[0],_n[1]):Rt.setOutputMatrixTexture(pn,_n[0],_n[1]),Rt.setProgram(Pt.webGLProgram),L().getNumber("WEBGL_VERSION")===1&&Pt.infLoc!==null&&Rt.gl.uniform1f(Pt.infLoc,1/0),Pt.nanLoc!==null&&Rt.gl.uniform1f(Pt.nanLoc,NaN),Kt.forEach(function(On,_){var m=Pt.program.variableNames[_],f=Pt.uniformLocations[m],y=Pt.uniformLocations["offset"+m];if(f!=null)if(On.isUniform)if(Ke(On.shape)<2)Rt.gl.uniform1f(f,On.uniformValues[0]);else{var E=On.uniformValues;E instanceof Float32Array||(E=new Float32Array(E)),Rt.gl.uniform1fv(f,E)}else On.texData.slice!=null&&y!=null&&Rt.gl.uniform1i(y,On.texData.slice.flatOffset),Rt.setInputMatrixTexture(On.texData.texture,f,_)}),bn!=null&&bn(Rt,Pt.webGLProgram),Rt.executeProgram()}(this.gpgpu,nt,Pe,Ge,W),Re.forEach(function(Rt){return ie.disposeData(Rt.dataId)}),lt&&(je=this.endTimer(je),this.activeTimers.push({name:p.constructor.name,query:this.getQueryTime(je)})),!L().getBool("WEBGL_LAZILY_UNPACK")&&ye.isPacked&&Q===!1){var Nt=this.unpackTensor(fe);return this.disposeData(fe.dataId),Nt}return fe},x.prototype.compileAndRun=function(p,w,D,W,Q){Q===void 0&&(Q=!1),D=D||w[0].dtype;var ie=this.runWebGLProgram(p,w,D,W,Q);return qe.makeTensorFromDataId(ie.dataId,ie.shape,ie.dtype)},x.prototype.getAndSaveBinary=function(p,w){return p in this.binaryCache||(this.binaryCache[p]=w()),this.binaryCache[p]},x.prototype.getTextureManager=function(){return this.textureManager},x.prototype.dispose=function(){var p=this;this.disposed||(L().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(function(w){p.gpgpu.deleteProgram(p.binaryCache[w].webGLProgram),delete p.binaryCache[w]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement<"u"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)},x.prototype.floatPrecision=function(){var p=this;return this.floatPrecisionValue==null&&(this.floatPrecisionValue=eo(function(){if(!L().get("WEBGL_RENDER_FLOAT32_ENABLED")){var w=L().getBool("DEBUG");L().set("DEBUG",!1);var D=p.abs(Or(1e-8)).dataSync()[0];if(L().set("DEBUG",w),D>0)return 32}return 16})),this.floatPrecisionValue},x.prototype.epsilon=function(){return this.floatPrecision()===32?1e-7:1e-4},x.prototype.uploadToGPU=function(p){var w,D=this.texData.get(p),W=D.shape,Q=D.dtype,ie=D.values,fe=D.texture,ye=D.usage,Oe=D.isPacked;if(fe==null){var Re,Pe=this.activeTimers!=null;Pe&&(Re=fn());var je=D.texShape;if(je==null&&(je=rd(W,Oe),D.texShape=je),ie!=null){var Ge=xl(W),rt=void 0,nt=je[1],lt=je[0],Nt=ie instanceof Uint8Array;Oe?(nt=(w=ai(je[0],je[1]))[0],rt=new function(bn,pn,_n){_n===void 0&&(_n=!1),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var On=ue(),_=pn[0],m=pn[1];this.outputShape=bn;var f="",y="result";_n&&(y="floor(result * 255. + 0.5)");for(var E=0;E<=1;E++)for(var z=0;z<=1;z++){var Y=2*E+z;f+=` 7530 localCoords = coords; 7531 if(localCoords[2] + `+z+" < "+bn[2]+`) { 7532 localCoords[2] += `+z+`; 7533 if(localCoords[1] + `+E+" < "+bn[1]+`) { 7534 localCoords[1] += `+E+`; 7535 7536 flatIndex = getFlatIndex(localCoords); 7537 offset = imod(flatIndex, 4); 7538 7539 flatIndex = idiv(flatIndex, 4, 1.); 7540 7541 r = flatIndex / `+m+`; 7542 c = imod(flatIndex, `+m+`); 7543 uv = (vec2(c, r) + halfCR) / vec2(`+m+".0, "+_+`.0); 7544 values = `+On.texture2D+`(A, uv); 7545 7546 if(offset == 0) { 7547 result[`+Y+`] = values[0]; 7548 } else if(offset == 1) { 7549 result[`+Y+`] = values[1]; 7550 } else if(offset == 2) { 7551 result[`+Y+`] = values[2]; 7552 } else { 7553 result[`+Y+`] = values[3]; 7554 } 7555 } 7556 } 7557 `}this.userCode=` 7558 `+Qe(bn)+` 7559 7560 void main() { 7561 ivec3 coords = getOutputCoords(); 7562 7563 vec4 result = vec4(0.); 7564 int flatIndex, r, c, offset; 7565 ivec3 localCoords; 7566 vec2 uv; 7567 vec4 values; 7568 7569 `+f+` 7570 7571 `+On.output+" = "+y+`; 7572 } 7573 `}(Ge,[lt=w[1],nt],Nt)):rt=new function(bn,pn,_n){_n===void 0&&(_n=!1),this.variableNames=["A"];var On=ue(),_=pn[0],m=pn[1];this.outputShape=bn;var f="result";_n&&(f="floor(result * 255. + 0.5)"),this.userCode=` 7574 `+Qe(bn)+` 7575 7576 void main() { 7577 ivec3 coords = getOutputCoords(); 7578 7579 int flatIndex = getFlatIndex(coords); 7580 int offset = imod(flatIndex, 4); 7581 7582 flatIndex = idiv(flatIndex, 4, 1.); 7583 7584 int r = flatIndex / `+m+`; 7585 int c = imod(flatIndex, `+m+`); 7586 vec2 uv = (vec2(c, r) + halfCR) / vec2(`+m+".0, "+_+`.0); 7587 vec4 values = `+On.texture2D+`(A, uv); 7588 7589 float result; 7590 7591 if(offset == 0) { 7592 result = values[0]; 7593 } else if(offset == 1) { 7594 result = values[1]; 7595 } else if(offset == 2) { 7596 result = values[2]; 7597 } else { 7598 result = values[3]; 7599 } 7600 7601 `+On.output+" = vec4("+f+`, 0., 0., 0.); 7602 } 7603 `}(Ge,[lt,nt],Nt);var Rt=this.makeTensorInfo([lt,nt],Q);this.texData.get(Rt.dataId).usage=Nt?pr.PIXELS:pr.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(Rt.dataId),nt,lt,ie);var Pt=this.runWebGLProgram(rt,[Rt],Q,null,!0),Kt=this.texData.get(Pt.dataId);D.texture=Kt.texture,D.texShape=Kt.texShape,D.isPacked=Kt.isPacked,D.usage=Kt.usage,this.disposeData(Rt.dataId),this.texData.delete(Pt.dataId),D.values=null,Pe&&(this.uploadWaitMs+=fn()-Re)}else{var dn=this.acquireTexture(je,ye,Q,Oe);D.texture=dn}}},x.prototype.convertAndCacheOnCPU=function(p,w){var D=this.texData.get(p),W=D.dtype;return this.releaseGPUData(p),w!=null&&(D.values=function(Q,ie){if(ie==="float32"||ie==="complex64")return Q;if(ie==="int32"||ie==="bool"){for(var fe=ie==="int32"?new Int32Array(Q.length):new Uint8Array(Q.length),ye=0;ye<fe.length;++ye)fe[ye]=Math.round(Q[ye]);return fe}throw new Error("Unknown dtype "+ie)}(w,W)),D.values},x.prototype.acquireTexture=function(p,w,D,W){if(this.numBytesInGPU+=this.computeBytes(p,D),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){var Q=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: "+Q+" MB, most likely due to a memory leak")}return this.textureManager.acquireTexture(p,w,W)},x.prototype.computeBytes=function(p,w){return p[0]*p[1]*It(w)},x}(gh);$n()&&qe.registerBackend("webgl",function(){return new g1},2);var U0=Bt({square_:function(C){var x=et(C,"x","square"),p=[x];return qe.runKernelFunc(function(w,D){return D([x]),w.square(x)},{x},null,"Square",{},p,[])}}),Rp="SquaredDifference",_h=Bt({squaredDifference_:function(C,x){var p,w=et(C,"a","squaredDifference"),D=et(x,"b","squaredDifference");p=Bn(w,D),w=p[0],D=p[1],ho(w.shape,D.shape);var W={a:w,b:D},Q=[w,D];return qe.runKernelFunc(function(ie,fe){var ye=ie.squaredDifference(w,D);return fe([w,D]),ye},W,function(ie,fe){var ye=fe[0],Oe=fe[1],Re=Or(2);return{a:function(){return ie.mul(ye.sub(Oe).mul(Re))},b:function(){return ie.mul(Oe.sub(ye).mul(Re))}}},Rp,{},Q,[])}}),Ql=Bt({abs_:function(C){var x=et(C,"x","abs");return x.dtype==="complex64"?qe.runKernelFunc(function(p){return p.complexAbs(x)},{$x:x}):qe.runKernelFunc(function(p,w){var D=p.abs(x);return w([x]),D},{x},function(p,w){var D=w[0];return{x:function(){return p.mul(D.toFloat().step(-1))}}},"Abs")}}),W0=Bt({acos_:function(C){var x=et(C,"x","acos");return qe.runKernelFunc(function(p,w){var D=p.acos(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.divStrict(Or(1).sub(D.toFloat().square()).sqrt()).neg()}}})}}),V0=Bt({acosh_:function(C){var x=et(C,"x","acosh");return qe.runKernelFunc(function(p,w){var D=p.acosh(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.divStrict(D.toFloat().square().sub(1).sqrt())}}})}}),Lc=Bt({asin_:function(C){var x=et(C,"x","asin");return qe.runKernelFunc(function(p,w){var D=p.asin(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.divStrict(Or(1).sub(D.toFloat().square()).sqrt())}}})}}),$0=Bt({asinh_:function(C){var x=et(C,"x","asinh");return qe.runKernelFunc(function(p,w){var D=p.asinh(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.divStrict(Or(1).add(D.toFloat().square()).sqrt())}}})}}),Bp=Bt({atan_:function(C){var x=et(C,"x","atan");return qe.runKernelFunc(function(p,w){var D=p.atan(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.div(D.toFloat().square().add(1))}}})}}),Ym=Bt({atanh_:function(C){var x=et(C,"x","atanh");return qe.runKernelFunc(function(p,w){var D=p.atanh(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.div(Or(1).sub(D.toFloat().square()))}}})}}),v1=Bt({ceil_:function(C){var x=et(C,"x","ceil");return qe.runKernelFunc(function(p){return p.ceil(x)},{$x:x},function(p){return{$x:function(){return Ei(p)}}})}}),Xm=Bt({clipByValue_:function(C,x,p){var w=et(C,"x","clipByValue");Ee(x<=p,function(){return"Error in clip: min ("+x+") must be less than or equal to max ("+p+")."});var D=[w],W={min:x,max:p};return qe.runKernelFunc(function(Q,ie){var fe=Q.clip(w,x,p);return ie([w]),fe},{x:w},function(Q,ie){var fe=ie[0];return{x:function(){return Q.where(fe.greaterEqual(x).logicalAnd(fe.lessEqual(p)),Ei(Q))}}},"ClipByValue",W,D)}}),Zl=Bt({cos_:function(C){var x=et(C,"x","cos"),p=[x];return qe.runKernelFunc(function(w,D){var W=w.cos(x);return D([x]),W},{x},function(w,D){var W=D[0];return{x:function(){return W.toFloat().sin().neg().mul(w)}}},"Cos",{},p)}}),Jm=Bt({cosh_:function(C){var x=et(C,"x","cosh");return qe.runKernelFunc(function(p,w){var D=p.cosh(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return D.toFloat().sinh().mulStrict(p)}}})}}),Yv=Bt({erf_:function(C){var x=et(C,"x","erf");return Ee(x.dtype==="int32"||x.dtype==="float32",function(){return"Input dtype must be `int32` or `float32`."}),x.dtype==="int32"&&(x=x.toFloat()),qe.runKernelFunc(function(p,w){var D=p.erf(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.mul(D.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}})}}),Xv=Bt({exp_:function(C){var x=et(C,"x","exp");return qe.runKernelFunc(function(p,w){var D=p.exp(x);return w([D]),D},{x},function(p,w){return{x:function(){return p.mulStrict(w[0])}}},"Exp",{},[],[!0])}}),H0=Bt({expm1_:function(C){var x=et(C,"x","expm1");return qe.runKernelFunc(function(p,w){var D=p.expm1(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.mul(D.exp())}}})}}),Db=Bt({floor_:function(C){var x=et(C,"x","floor");return qe.runKernelFunc(function(p){return p.floor(x)},{$x:x},function(p){return{$x:function(){return Ei(p)}}})}}),Tb=Bt({log_:function(C){var x=et(C,"x","log"),p=[x];return qe.runKernelFunc(function(w,D){var W=w.log(x);return D([x]),W},{x},function(w,D){var W=D[0];return{x:function(){return w.div(W.toFloat())}}},"Log",{},p)}}),Fo=Bt({log1p_:function(C){var x=et(C,"x","log1p");return qe.runKernelFunc(function(p,w){var D=p.log1p(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.div(D.add(1))}}})}}),Jv=Bt({logSigmoid_:function(C){var x=et(C,"x","logSigmoid");return qe.runKernelFunc(function(p,w){var D=p.softplus(x.neg()).neg();return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.mul(D.neg().sigmoid())}}})}}),Qv=Bt({neg_:function(C){var x=et(C,"x","neg"),p=[x];return qe.runKernelFunc(function(w){return w.neg(x)},{x},function(w){return{x:function(){return w.neg()}}},"Neg",{},p)}}),Wg=Bt({reciprocal_:function(C){var x=et(C,"x","reciprocal");return qe.runKernelFunc(function(p,w){var D=p.reciprocal(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.div(D.square().neg())}}})}}),Zv=Bt({round_:function(C){var x=et(C,"x","round");return qe.runKernelFunc(function(p){return p.round(x)},{$x:x},function(p){return{$x:function(){return Ei(p)}}})}}),Qm=Bt({rsqrt_:function(C){var x=et(C,"x","rsqrt"),p=[x];return qe.runKernelFunc(function(w,D){var W=w.rsqrt(x);return D([x]),W},{x},function(w,D){var W=D[0];return{x:function(){return w.div(W.pow(1.5).mul(2)).neg()}}},"Rsqrt",{},p)}}),Tf=Bt({sigmoid_:function(C){var x=et(C,"x","sigmoid");return qe.runKernelFunc(function(p,w){var D=p.sigmoid(x);return w([D]),D},{x},function(p,w){var D=w[0];return{x:function(){return p.mul(D.mul(Or(1).sub(D)))}}},"Sigmoid")}}),Nf=Bt({sign_:function(C){var x=et(C,"x","sign");return qe.runKernelFunc(function(p){return p.sign(x)},{$x:x},function(p){return{$x:function(){return Ei(p)}}})}}),ey=Bt({isNaN_:function(C){var x=et(C,"x","isNaN");return qe.runKernelFunc(function(p){return p.isNaN(x)},{$x:x},function(p){return{$x:function(){return Ei(p)}}})}}),ty=Bt({isInf_:function(C){var x=et(C,"x","isInf");return qe.runKernelFunc(function(p){return p.isInf(x)},{$x:x},function(p){return{$x:function(){return Ei(p)}}})}}),Pp=Bt({isFinite_:function(C){var x=et(C,"x","isFinite");return qe.runKernelFunc(function(p){return p.isFinite(x)},{$x:x},function(p){return{$x:function(){return Ei(p)}}})}}),kh=Bt({sin_:function(C){var x=et(C,"x","sin"),p=[x];return qe.runKernelFunc(function(w,D){var W=w.sin(x);return D([x]),W},{x},function(w,D){var W=D[0];return{x:function(){return W.toFloat().cos().mul(w)}}},"Sin",{},p)}}),jp=Bt({sinh_:function(C){var x=et(C,"x","sinh");return qe.runKernelFunc(function(p,w){var D=p.sinh(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return D.toFloat().cosh().mulStrict(p)}}})}}),Nb=Bt({softplus_:function(C){var x=et(C,"x","softplus");return qe.runKernelFunc(function(p,w){var D=p.softplus(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.mul(D.sigmoid())}}})}}),Vg=Bt({sqrt_:function(C){var x=et(C,"x","sqrt");return qe.runKernelFunc(function(p,w){var D=p.sqrt(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.div(D.toFloat().sqrt().mul(2))}}})}}),If=Bt({step_:function(C,x){x===void 0&&(x=0);var p=et(C,"x","step");return qe.runKernelFunc(function(w){return w.step(p,x)},{$x:p},function(w){return{$x:function(){return Ei(w)}}})}}),zc=Bt({tan_:function(C){var x=et(C,"x","tan");return qe.runKernelFunc(function(p,w){var D=p.tan(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return p.div(D.cos().square())}}})}}),bd=Bt({tanh_:function(C){var x=et(C,"x","tanh");return qe.runKernelFunc(function(p,w){var D=p.tanh(x);return w([D]),D},{x},function(p,w){var D=w[0];return{x:function(){return Or(1).sub(D.square()).mulStrict(p)}}},"Tanh",{},null,[!0])}});function xd(C,x,p,w,D,W){var Q,ie,fe=et(C,"x","batchNorm"),ye=et(x,"mean","batchNorm"),Oe=et(p,"variance","batchNorm");return D!=null&&(Q=et(D,"scale","batchNorm")),w!=null&&(ie=et(w,"offset","batchNorm")),Ee(fe.rank===2,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+fe.rank+"."}),Ee(ye.rank===2||ye.rank===1,function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+ye.rank+"."}),Ee(Oe.rank===2||Oe.rank===1,function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+Oe.rank+"."}),Q!=null&&Ee(Q.rank===2||Q.rank===1,function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank "+Q.rank+"."}),ie!=null&&Ee(ie.rank===2||ie.rank===1,function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank "+ie.rank+"."}),$g(fe,ye,Oe,ie,Q,W)}function wd(C,x,p,w,D,W){var Q,ie,fe=et(C,"x","batchNorm"),ye=et(x,"mean","batchNorm"),Oe=et(p,"variance","batchNorm");return D!=null&&(Q=et(D,"scale","batchNorm")),w!=null&&(ie=et(w,"offset","batchNorm")),Ee(fe.rank===3,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+fe.rank+"."}),Ee(ye.rank===3||ye.rank===1,function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+ye.rank+"."}),Ee(Oe.rank===3||Oe.rank===1,function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+Oe.rank+"."}),Q!=null&&Ee(Q.rank===3||Q.rank===1,function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank "+Q.rank+"."}),ie!=null&&Ee(ie.rank===3||ie.rank===1,function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank "+ie.rank+"."}),$g(fe,ye,Oe,ie,Q,W)}function ny(C,x,p,w,D,W){var Q,ie,fe=et(C,"x","batchNorm"),ye=et(x,"mean","batchNorm"),Oe=et(p,"variance","batchNorm");return D!=null&&(Q=et(D,"scale","batchNorm")),w!=null&&(ie=et(w,"offset","batchNorm")),Ee(fe.rank===4,function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+fe.rank+"."}),Ee(ye.rank===4||ye.rank===1,function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+ye.rank+"."}),Ee(Oe.rank===4||Oe.rank===1,function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+Oe.rank+"."}),Q!=null&&Ee(Q.rank===4||Q.rank===1,function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank "+Q.rank+"."}),ie!=null&&Ee(ie.rank===4||ie.rank===1,function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank "+ie.rank+"."}),$g(fe,ye,Oe,ie,Q,W)}function $g(C,x,p,w,D,W){W==null&&(W=.001);var Q,ie,fe,ye=et(C,"x","batchNorm"),Oe=et(x,"mean","batchNorm"),Re=et(p,"variance","batchNorm");D!=null&&(Q=et(D,"scale","batchNorm")),w!=null&&(ie=et(w,"offset","batchNorm")),Ee(Oe.rank===Re.rank,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),Ee(ie==null||Oe.rank===ie.rank,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),Ee(Q==null||Oe.rank===Q.rank,function(){return"Batch normalization gradient requires mean and scale to have equal ranks."}),fe=ye.rank===0||ye.rank===1?ye.as4D(1,1,1,ye.size):ye.rank===2?ye.as4D(1,1,ye.shape[0],ye.shape[1]):ye.rank===3?ye.as4D(1,ye.shape[0],ye.shape[1],ye.shape[2]):ye;var Pe=[ye,Oe,Re,Q];return qe.runKernelFunc(function(je,Ge){var rt=je.batchNormalization(fe,Uc(Oe),Uc(Re),W,Uc(Q),Uc(ie));return Ge([ye,Oe,Re,Q]),rt},{x:ye,mean:Oe,variance:Re,scale:Q,offset:ie},function(je,Ge){var rt=Ge,nt=rt[0],lt=rt[1],Nt=rt[2],Rt=rt[3],Pt=Rt??Or(1),Kt=as(lt.shape,fe.shape),dn=[];if(lt.rank===1){for(var bn=0;bn<fe.shape.length-1;++bn)dn.push(fe.shape[bn]);dn.push(1)}var pn=nt.sub(lt),_n=je.mul(Pt),On=Qm(Nt.add(Or(W))),_=On.mul(On).mul(On).mul(Or(-.5));return{x:function(){return lt.rank===1?je.mul(_u(On.as4D(1,1,1,lt.shape[0]),dn)).mul(Pt).reshape(nt.shape):je.mul(On).mul(Pt).reshape(nt.shape)},mean:function(){var m=On.mul(Or(-1)).mul(_n);return lt.rank===1&&(m=m.sum(Kt)),m.reshape(lt.shape)},variance:function(){var m=_.mul(pn).mul(_n);return lt.rank===1&&(m=m.sum(Kt)),m.reshape(lt.shape)},scale:function(){var m=pn.mul(On),f=je.mul(m);return lt.rank===1&&(f=f.sum(Kt)),f.reshape(lt.shape)},offset:function(){var m=je;return lt.rank===1&&(m=m.sum(Kt)),m.reshape(lt.shape)}}},"BatchNormalization",{varianceEpsilon:W},Pe).reshape(ye.shape)}function Uc(C){return C==null?null:C.rank===0?C.as1D():C.rank===1?C:C.rank===2?C.as4D(1,1,C.shape[0],C.shape[1]):C.rank===3?C.as4D(1,C.shape[0],C.shape[1],C.shape[2]):C}function ol(){ah("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")}var ry=Bt({batchNormalization2d_:function(C,x,p,w,D,W){return w===void 0&&(w=.001),ol(),xd(C,x,p,W,D,w)}}),Zm=Bt({batchNormalization3d_:function(C,x,p,w,D,W){return w===void 0&&(w=.001),ol(),wd(C,x,p,W,D,w)}}),q0=Bt({batchNormalization4d_:function(C,x,p,w,D,W){return w===void 0&&(w=.001),ol(),ny(C,x,p,W,D,w)}}),Ib=Bt({batchNormalization_:function(C,x,p,w,D,W){return w===void 0&&(w=.001),ol(),$g(C,x,p,W,D,w)}}),y1=Bt({batchNorm_:$g}),_d=Bt({batchNorm2d_:xd}),Lp=Bt({batchNorm3d_:wd}),Eh=Bt({batchNorm4d_:ny}),Ch=Bt({logicalAnd_:function(C,x){var p=et(C,"a","logicalAnd","bool"),w=et(x,"b","logicalAnd","bool");return ho(p.shape,w.shape),qe.runKernelFunc(function(D){return D.logicalAnd(p,w)},{a:p,b:w},null,"LogicalAnd")}}),iy=Bt({logicalNot_:function(C){var x=et(C,"x","logicalNot","bool");return qe.runKernelFunc(function(p){return p.logicalNot(x)},{$x:x})}}),G0=Bt({logicalOr_:function(C,x){var p=et(C,"a","logicalOr","bool"),w=et(x,"b","logicalOr","bool");return ho(p.shape,w.shape),qe.runKernelFunc(function(D){return D.logicalOr(p,w)},{$a:p,$b:w})}}),Sh=Bt({logicalXor_:function(C,x){var p=et(C,"a","logicalXor","bool"),w=et(x,"b","logicalXor","bool");return ho(p.shape,w.shape),G0(C,x).logicalAnd(Ch(C,x).logicalNot())}}),Ao=Bt({where_:function(C,x,p){var w=et(x,"a","where"),D=et(p,"b","where"),W=et(C,"condition","where","bool");return Ot(w.shape,D.shape,"Error in where: "),W.rank===1?Ee(W.shape[0]===w.shape[0],function(){return"The first dimension of `a` must match the size of `condition`."}):Ot(W.shape,D.shape,"Error in where: "),qe.runKernelFunc(function(Q,ie){var fe=Q.select(W,w,D);return ie([W]),fe},{$condition:W,$a:w,$b:D},function(Q,ie){var fe=ie[0];return{$condition:function(){return Ei(fe).toFloat()},$a:function(){return Q.mul(fe.cast(Q.dtype))},$b:function(){return Q.mul(fe.logicalNot().cast(Q.dtype))}}})}}),kd=function(C){return S(this,void 0,void 0,function(){var x,p,w;return M(this,function(D){switch(D.label){case 0:return[4,(x=et(C,"condition","whereAsync","bool")).data()];case 1:return p=D.sent(),w=ne(x.shape,p),C!==x&&x.dispose(),[2,w]}})})},zp=Bt({add_:function(C,x){var p,w=et(C,"a","add"),D=et(x,"b","add");p=Bn(w,D),w=p[0],D=p[1];var W=ho(w.shape,D.shape);return qe.runKernelFunc(function(Q){return Q.add(w,D)},{a:w,b:D},function(Q){return{a:function(){var ie=Q,fe=as(w.shape,W);return fe.length>0&&(ie=ie.sum(fe)),ie.reshape(w.shape)},b:function(){var ie=Q,fe=as(D.shape,W);return fe.length>0&&(ie=ie.sum(fe)),ie.reshape(D.shape)}}},"Add")}}),b1=Bt({addN_:function(C){Ee(Array.isArray(C),function(){return"The argument passed to tf.addN() must be a list of tensors"}),Ee(C.length>=1,function(){return"Must pass at least one tensor to tf.addN(), but got "+C.length});var x=C.map(function(D,W){return et(D,"tensors"+W,"addN")}),p=x[0];x.forEach(function(D){if(D.dtype!==p.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),x.forEach(function(D){if(!Tt(D.shape,p.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var w=x;return qe.runKernelFunc(function(D){return D.addN(x)},w,function(D){var W={};return x.forEach(function(Q,ie){W[ie]=function(){return D.clone()}}),W},"AddN")}}),x1=Bt({addStrict_:function(C,x){var p=et(C,"a","addStrict"),w=et(x,"b","addStrict");return Ot(p.shape,w.shape,"Error in addStrict: "),p.add(w)}}),Hg=Bt({atan2_:function(C,x){var p,w=et(C,"a","atan2"),D=et(x,"b","atan2");p=Bn(w,D),w=p[0],D=p[1];var W=ho(w.shape,D.shape);return qe.runKernelFunc(function(Q,ie){var fe=Q.atan2(w,D);return ie([w,D]),fe},{$a:w,$b:D},function(Q,ie){var fe=ie[0],ye=ie[1];return{$a:function(){var Oe=zp(fe.square(),ye.square()),Re=Q.mul(ye.div(Oe)),Pe=as(fe.shape,W);return Pe.length>0&&(Re=Re.sum(Pe)),Re.reshape(fe.shape)},$b:function(){var Oe=zp(fe.square(),ye.square()),Re=Qv(Q.mul(fe.div(Oe))),Pe=as(ye.shape,W);return Pe.length>0&&(Re=Re.sum(Pe)),Re.reshape(ye.shape)}}})}}),Ed=Bt({div_:function(C,x){var p,w=et(C,"a","div"),D=et(x,"b","div");if(p=Bn(w,D),w=p[0],D=p[1],w.dtype==="int32"&&D.dtype==="int32")return Up(w,D);var W=ho(w.shape,D.shape);return qe.runKernelFunc(function(Q,ie){var fe=Q.realDivide(w,D);return ie([w,D]),fe},{a:w,b:D},function(Q,ie){var fe=ie[0],ye=ie[1];return{a:function(){var Oe=Q.div(ye.toFloat()),Re=as(fe.shape,W);return Re.length>0?Oe.sum(Re).reshape(fe.shape):Oe},b:function(){var Oe=Q.mul(fe.toFloat()),Re=as(ye.shape,W);Re.length>0&&(Oe=Oe.sum(Re).reshape(ye.shape));var Pe=ye.square();return Oe.div(Pe.toFloat()).neg()}}},"Div")}}),Mf=Bt({divNoNan_:function(C,x){var p,w=et(C,"a","div"),D=et(x,"b","div");w=(p=Bn(w,D))[0],D=p[1];var W=Ed(w,D),Q=Ei(W),ie=D.equal(Q);return Ao(ie,Q,W)}}),eg=Bt({divStrict_:function(C,x){var p=et(C,"a","div"),w=et(x,"b","div");return Ot(p.shape,w.shape,"Error in divideStrict: "),p.div(w)}}),Up=Bt({floorDiv_:function(C,x){var p,w=et(C,"a","floorDiv"),D=et(x,"b","floorDiv");p=Bn(w,D),w=p[0],D=p[1];var W=ho(w.shape,D.shape);return qe.runKernelFunc(function(Q,ie){var fe=Q.floorDiv(w,D);return ie([w,D]),fe},{a:w,b:D},function(Q,ie){var fe=ie[0],ye=ie[1];return{a:function(){var Oe=Q.div(ye.toFloat()),Re=as(fe.shape,W);return Re.length>0?Oe.sum(Re).reshape(fe.shape):Oe},b:function(){var Oe=Q.mul(fe.toFloat()),Re=as(ye.shape,W);Re.length>0&&(Oe=Oe.sum(Re).reshape(ye.shape));var Pe=ye.square();return Oe.div(Pe.toFloat()).neg()}}},"FloorDiv")}}),Ah=Bt({maximum_:function(C,x){var p,w=et(C,"a","maximum"),D=et(x,"b","maximum");return p=Bn(w,D),w=p[0],D=p[1],w.dtype==="bool"&&(w=w.toInt(),D=D.toInt()),ho(w.shape,D.shape),qe.runKernelFunc(function(W,Q){var ie=W.maximum(w,D);return Q([w,D]),ie},{a:w,b:D},function(W,Q){var ie=Q[0],fe=Q[1];return{a:function(){return W.mul(ie.greaterEqual(fe).toFloat())},b:function(){return W.mul(ie.less(fe).toFloat())}}},"Maximum")}}),Cd=Bt({maximumStrict_:function(C,x){var p=et(C,"a","maximumStrict"),w=et(x,"b","maximumStrict");return Ot(p.shape,w.shape,"Error in maximumStrict: "),p.maximum(w)}}),Sd=Bt({minimum_:function(C,x){var p,w=et(C,"a","minimum"),D=et(x,"b","minimum");return p=Bn(w,D),w=p[0],D=p[1],w.dtype==="bool"&&(w=w.toInt(),D=D.toInt()),ho(w.shape,D.shape),qe.runKernelFunc(function(W,Q){var ie=W.minimum(w,D);return Q([w,D]),ie},{a:w,b:D},function(W,Q){var ie=Q[0],fe=Q[1];return{a:function(){return W.mul(ie.lessEqual(fe).toFloat())},b:function(){return W.mul(ie.greater(fe).toFloat())}}},"Minimum")}}),Wc=Bt({minimumStrict_:function(C,x){var p=et(C,"a","minimumStrict"),w=et(x,"b","minimumStrict");return Ot(p.shape,w.shape,"Error in minimumStrict: "),p.minimum(w)}}),Wp=Bt({mod_:function(C,x){var p,w=et(C,"a","mod"),D=et(x,"b","mod");p=Bn(w,D),w=p[0],D=p[1];var W=ho(w.shape,D.shape);return qe.runKernelFunc(function(Q,ie){var fe=Q.mod(w,D);return ie([w,D]),fe},{$a:w,$b:D},function(Q,ie){var fe=ie[0],ye=ie[1];return{$a:function(){var Oe=as(fe.shape,W);return Oe.length>0?Q.sum(Oe).reshape(fe.shape):Q},$b:function(){var Oe=Q.mul(fe.div(ye).floor().neg()),Re=as(ye.shape,W);return Re.length>0?Oe.sum(Re).reshape(ye.shape):Oe}}})}}),Oh=Bt({modStrict_:function(C,x){var p=et(C,"a","modStrict"),w=et(x,"b","modStrict");return Ot(p.shape,w.shape,"Error in modStrict: "),p.mod(w)}}),Ff=Bt({mul_:function(C,x){var p,w=et(C,"a","mul"),D=et(x,"b","mul");p=Bn(w,D),w=p[0],D=p[1];var W=ho(w.shape,D.shape);return qe.runKernelFunc(function(Q,ie){var fe=Q.multiply(w,D);return ie([w,D]),fe},{a:w,b:D},function(Q,ie){var fe=ie[0],ye=ie[1];return{a:function(){var Oe=Q.mul(ye.toFloat()),Re=as(fe.shape,W);return Re.length>0?Oe.sum(Re).reshape(fe.shape):Oe},b:function(){var Oe=Q.mul(fe.toFloat()),Re=as(ye.shape,W);return Re.length>0?Oe.sum(Re).reshape(ye.shape):Oe}}},"Mul")}}),ef=Bt({mulStrict_:function(C,x){var p=et(C,"a","mul"),w=et(x,"b","mul");return Ot(p.shape,w.shape,"Error in multiplyStrict: "),p.mul(w)}}),Dh=Bt({pow_:function(C,x){var p,w=et(C,"base","pow"),D=et(x,"exp","pow");p=Bn(w,D),w=p[0],D=p[1];var W=ho(w.shape,D.shape),Q=[w,D];return qe.runKernelFunc(function(ie,fe){var ye=ie.pow(w,D);return fe([w,D,ye]),ye},{a:w,b:D},function(ie,fe){var ye=fe[0],Oe=fe[1],Re=fe[2];return{a:function(){var Pe=Oe.toFloat(),je=ie.mul(Pe.mul(ye.pow(Pe.sub(Or(1))))),Ge=as(ye.shape,W);return Ge.length>0&&(je=je.sum(Ge)),je.reshape(ye.shape)},b:function(){var Pe=ye.greater(0),je=ye.log().where(Pe,Ei(ye)),Ge=ie.mul(Re.mul(je)),rt=as(Oe.shape,W);return rt.length>0&&(Ge=Ge.sum(rt)),Ge.reshape(Oe.shape)}}},"Pow",{},Q,[!0])}}),qg=Bt({powStrict_:function(C,x){return Ot(C.shape,x.shape,"Error in powStrict: "),C.pow(x)}}),Th=Bt({squaredDifferenceStrict_:function(C,x){var p=et(C,"a","squaredDifferenceStrict"),w=et(x,"b","squaredDifferenceStrict");return Ot(p.shape,w.shape,"Error in squaredDifferenceStrict: "),p.squaredDifference(w)}}),tf=Bt({sub_:function(C,x){var p,w=et(C,"a","sub"),D=et(x,"b","sub");p=Bn(w,D),w=p[0],D=p[1];var W=ho(w.shape,D.shape);return qe.runKernelFunc(function(Q){return Q.subtract(w,D)},{a:w,b:D},function(Q){return{a:function(){var ie=Q,fe=as(w.shape,W);return fe.length>0&&(ie=ie.sum(fe)),ie.reshape(w.shape)},b:function(){var ie=Q,fe=as(D.shape,W);return fe.length>0&&(ie=ie.sum(fe)),ie.neg().reshape(D.shape)}}},"Sub")}}),Gs=Bt({subStrict_:function(C,x){var p=et(C,"a","subStrict"),w=et(x,"b","subStrict");return Ot(p.shape,w.shape,"Error in subStrict: "),p.sub(w)}}),Dl=Bt({equal_:function(C,x){var p,w=et(C,"a","equal"),D=et(x,"b","equal");return p=Bn(w,D),w=p[0],D=p[1],ho(w.shape,D.shape),qe.runKernelFunc(function(W){return W.equal(w,D)},{$a:w,$b:D})}}),Vc=Bt({equalStrict_:function(C,x){var p=et(C,"a","equalStrict"),w=et(x,"b","equalStrict");return Ot(p.shape,w.shape,"Error in equalStrict: "),p.equal(w)}}),bc=Bt({greater_:function(C,x){var p,w=et(C,"a","greater"),D=et(x,"b","greater");return p=Bn(w,D),w=p[0],D=p[1],ho(w.shape,D.shape),qe.runKernelFunc(function(W){return W.greater(w,D)},{a:w,b:D},null,"Greater")}}),Vp=Bt({greaterEqual_:function(C,x){var p,w=et(C,"a","greaterEqual"),D=et(x,"b","greaterEqual");return p=Bn(w,D),w=p[0],D=p[1],ho(w.shape,D.shape),qe.runKernelFunc(function(W,Q){var ie=W.greaterEqual(w,D);return Q([w,D]),ie},{a:w,b:D},function(W,Q){var ie=Q[0],fe=Q[1];return{a:function(){return Ei(ie)},b:function(){return Ei(fe)}}},"GreaterEqual")}}),Gg=Bt({greaterEqualStrict_:function(C,x){var p=et(C,"a","greaterEqualStrict"),w=et(x,"b","greaterEqualStrict");return Ot(p.shape,w.shape,"Error in greaterEqualStrict: "),p.greaterEqual(w)}}),K0=Bt({greaterStrict_:function(C,x){var p=et(C,"a","greaterStrict"),w=et(x,"b","greaterStrict");return Ot(p.shape,w.shape,"Error in greaterStrict: "),p.greater(w)}}),Y0=Bt({less_:function(C,x){var p,w=et(C,"a","less"),D=et(x,"b","less");return p=Bn(w,D),w=p[0],D=p[1],ho(w.shape,D.shape),qe.runKernelFunc(function(W){return W.less(w,D)},{a:w,b:D},null,"Less")}}),tg=Bt({lessEqual_:function(C,x){var p,w=et(C,"a","lessEqual"),D=et(x,"b","lessEqual");return p=Bn(w,D),w=p[0],D=p[1],ho(w.shape,D.shape),qe.runKernelFunc(function(W,Q){var ie=W.lessEqual(w,D);return Q([w,D]),ie},{a:w,b:D},null,"LessEqual")}}),da=Bt({lessEqualStrict_:function(C,x){var p=et(C,"a","lessEqualStrict"),w=et(x,"b","lessEqualStrict");return Ot(p.shape,w.shape,"Error in lessEqualStrict: "),p.lessEqual(w)}}),ng=Bt({lessStrict_:function(C,x){var p=et(C,"a","lessStrict"),w=et(x,"b","lessStrict");return Ot(p.shape,w.shape,"Error in lessStrict: "),p.less(w)}}),Tl=Bt({notEqual_:function(C,x){var p,w=et(C,"a","notEqual"),D=et(x,"b","notEqual");return p=Bn(w,D),w=p[0],D=p[1],ho(w.shape,D.shape),qe.runKernelFunc(function(W){return W.notEqual(w,D)},{a:w,b:D},null,"NotEqual")}}),Nh=Bt({notEqualStrict_:function(C,x){var p=et(C,"a","notEqualStrict"),w=et(x,"b","notEqualStrict");return Ot(p.shape,w.shape,"Error in notEqualStrict: "),p.notEqual(w)}});function Ih(C,x){for(var p=[],w=C;w<x;++w)p.push(w);return p}function rg(C){for(var x=[],p=0;p<C.length;++p)for(var w=0;w<C[p].length;++w)x.push(C[p][w]);return x}var Kg=Bt({gather_:function(C,x,p){p===void 0&&(p=0);var w=et(C,"x","gather"),D=et(x,"indices","gather","int32");p=Vt(p,w.shape)[0];var W=function(Q,ie,fe){for(var ye=Q.shape[fe],Oe=[],Re=1,Pe=1,je=0;je<fe;je++)Oe.push(Q.shape[je]),Re*=Q.shape[je];for(je=0;je<ie.rank;je++)Oe.push(ie.shape[je]);for(je=fe+1;je<Q.rank;je++)Oe.push(Q.shape[je]),Pe*=Q.shape[je];return{batchSize:Re,sliceSize:Pe,dimSize:ye,outputShape:Oe}}(w,D,p);return qe.runKernelFunc(function(Q,ie){var fe=Q.gather(w,D.flatten(),p);return ie([D]),fe},{x:w,indices:D},function(Q,ie){var fe=ie[0];return{x:function(){var ye=w.shape,Oe=fe.size,Re=ye.slice(0,p),Pe=Re.length,je=ye.slice(p,ye.length).slice(1),Ge=je.length,rt=Ih(0,Pe),nt=Ih(Pe+1,Pe+1+Ge),lt=rg([Re,[Oe],je]),Nt=Q.reshape(lt),Rt=fe.reshape([Oe]),Pt=rg([[Pe],rt,nt]),Kt=Nt.transpose(Pt),dn=Yg(Kt,Rt,w.shape[p]),bn=Ic(Pt);return dn.transpose(bn)},indices:function(){return fe}}},"Gather",{axis:p}).reshape(W.outputShape)}}),Yg=Bt({unsortedSegmentSum_:function(C,x,p){var w=et(C,"x","unsortedSegmentSum"),D=et(x,"segmentIds","unsortedSegmentSum","int32");return Ee(vt(p),function(){return"numSegments must be of dtype int"}),qe.runKernelFunc(function(W,Q){var ie=W.unsortedSegmentSum(w,D,p);return Q([D]),ie},{$x:w},function(W,Q){var ie=Q[0];return{$x:function(){return function(fe,ye){for(var Oe=Ah(ye,Ei(ye)),Re=Kg(fe,Oe),Pe=Vp(ye,Or(0,"int32")),je=Re.rank-Pe.rank,Ge=0;Ge<je;++Ge)Pe=ya(Pe,Ge+1);Pe=Ch(Pe,yc(Re.shape,"bool"));var rt=Ei(Re);return Ao(Pe,Re,rt)}(W,ie)}}})}}),Xg=function(C,x,p){return S(this,void 0,void 0,function(){var w,D,W,Q,ie,fe,ye,Oe,Re,Pe,je,Ge,rt;return M(this,function(nt){switch(nt.label){case 0:for(w=et(C,"tensor","boolMask"),D=et(x,"mask","boolMask","bool"),W=p??0,Q=D.rank,ie=w.shape,Ee(Q>0,function(){return"mask cannot be scalar"}),Ot(ie.slice(W,W+Q),D.shape,"mask's shape must match the first K dimensions of tensor's shape,"),fe=1,ye=W;ye<W+Q;ye++)fe*=ie[ye];return Oe=ie.slice(0,W).concat([fe],ie.slice(W+Q)),Re=w.reshape(Oe),Pe=D.reshape([-1]),[4,kd(Pe)];case 1:return je=nt.sent(),Ge=je.squeeze([1]),rt=Kg(Re,Ge,W),C!==w&&w.dispose(),x!==D&&D.dispose(),Ge.dispose(),Re.dispose(),Pe.dispose(),je.dispose(),[2,rt]}})})};function oy(C,x,p,w,D,W,Q){W===void 0&&(W="NHWC"),Ee(C.length===x.rank,function(){return"Length of inShape ("+C.length+") and rank of dy ("+x.rank+") must match"});var ie=C,fe=x,ye=!1;x.rank===3&&(ye=!0,fe=x.as4D(1,x.shape[0],x.shape[1],x.shape[2]),ie=[1,C[0],C[1],C[2]]),Ee(ie.length===4,function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+ie.length+"."}),Ee(fe.rank===4,function(){return"Error in conv2dDerInput: dy must be rank 4, but got rank "+fe.rank}),Ee(p.rank===4,function(){return"Error in conv2dDerInput: filter must be rank 4, but got rank "+p.rank});var Oe=W==="NHWC"?ie[3]:ie[1],Re=W==="NHWC"?fe.shape[3]:fe.shape[1];Ee(Oe===p.shape[2],function(){return"Error in conv2dDerInput: depth of input ("+Oe+") must match input depth for filter "+p.shape[2]+"."}),Ee(Re===p.shape[3],function(){return"Error in conv2dDerInput: depth of output ("+Re+") must match output depth for filter "+p.shape[3]+"."}),Q!=null&&Ee(vt(D),function(){return"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+Q+" but got pad "+D+"."});var Pe=Da(W),je=qu(ie,p.shape,w,1,D,Q,!1,Pe),Ge=qe.runKernelFunc(function(rt,nt){var lt=rt.conv2dDerInput(fe,p,je);return nt([p,fe]),lt},{dy4D:fe,filter:p},function(rt,nt){var lt=nt[0],Nt=nt[1];return{dy4D:function(){return $p(rt,lt,w,D,W,1,Q)},filter:function(){return X0(rt,Nt,lt.shape,w,D,W,Q)}}});return ye?Ge.as3D(Ge.shape[1],Ge.shape[2],Ge.shape[3]):Ge}function Jg(C){var x=function(W){return typeof W=="number"?[W,W,W]:W.length===2?[W[0],W[1],1]:W}(C),p=x[0],w=x[1],D=x[2];return p===1&&w===1&&D===1}function Ad(C,x,p,w,D){Ee(C.length===x.rank,function(){return"Length of inShape ("+C.length+") and rank of dy ("+x.rank+") must match"});var W=C,Q=x,ie=!1;x.rank===4&&(ie=!0,Q=x.as5D(1,x.shape[0],x.shape[1],x.shape[2],x.shape[3]),W=[1,C[0],C[1],C[2],C[3]]);var fe=W[4],ye=Q.shape[4];Ee(W.length===5,function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+W.length+"."}),Ee(Q.rank===5,function(){return"Error in conv3dDerInput: dy must be rank 5, but got rank "+Q.rank}),Ee(p.rank===5,function(){return"Error in conv3dDerInput: filter must be rank 5, but got rank "+p.rank}),Ee(fe===p.shape[3],function(){return"Error in conv3dDerInput: depth of input ("+fe+") must match input depth for filter "+p.shape[3]+"."}),Ee(ye===p.shape[4],function(){return"Error in conv3dDerInput: depth of output ("+ye+") must match output depth for filter "+p.shape[4]+"."});var Oe=Cl(W,p.shape,w,1,D),Re=qe.runKernelFunc(function(Pe){return Pe.conv3dDerInput(Q,p,Oe)},{dy5D:Q});return ie?Re.as4D(Re.shape[1],Re.shape[2],Re.shape[3],Re.shape[4]):Re}var Qg=Bt({conv1d_:function(C,x,p,w,D,W,Q){D===void 0&&(D="NWC"),W===void 0&&(W=1);var ie=et(C,"x","conv1d"),fe=et(x,"filter","conv1d"),ye=ie,Oe=!1;ie.rank===2&&(Oe=!0,ye=ie.as3D(1,ie.shape[0],ie.shape[1])),Ee(ye.rank===3,function(){return"Error in conv1d: input must be rank 3, but got rank "+ye.rank+"."}),Ee(fe.rank===3,function(){return"Error in conv1d: filter must be rank 3, but got rank "+fe.rank+"."}),Q!=null&&Ee(vt(w),function(){return"Error in conv1d: pad must be an integer when using, dimRoundingMode "+Q+" but got pad "+w+"."}),Ee(ye.shape[2]===fe.shape[1],function(){return"Error in conv1d: depth of input ("+ye.shape[2]+") must match input depth for filter "+fe.shape[1]+"."}),Ee(nu(p,W),function(){return"Error in conv1D: Either stride or dilation must be 1. Got stride "+p+" and dilation '"+W+"'"}),Ee(D==="NWC",function(){return"Error in conv1d: got dataFormat of "+D+" but only NWC is currently supported."});var Re=fe.as4D(1,fe.shape[0],fe.shape[1],fe.shape[2]),Pe=ye.as4D(ye.shape[0],1,ye.shape[1],ye.shape[2]),je=$p(Pe,Re,[1,p],w,"NHWC",[1,W],Q);return Oe?je.as2D(je.shape[2],je.shape[3]):je.as3D(je.shape[0],je.shape[2],je.shape[3])}}),$p=Bt({conv2d_:function(C,x,p,w,D,W,Q){D===void 0&&(D="NHWC"),W===void 0&&(W=[1,1]);var ie=et(C,"x","conv2d"),fe=et(x,"filter","conv2d"),ye=ie,Oe=!1;ie.rank===3&&(Oe=!0,ye=ie.as4D(1,ie.shape[0],ie.shape[1],ie.shape[2])),Ee(ye.rank===4,function(){return"Error in conv2d: input must be rank 4, but got rank "+ye.rank+"."}),Ee(fe.rank===4,function(){return"Error in conv2d: filter must be rank 4, but got rank "+fe.rank+"."}),Q!=null&&Ee(vt(w),function(){return"Error in conv2d: pad must be an integer when using, dimRoundingMode "+Q+" but got pad "+w+"."});var Re=D==="NHWC"?ye.shape[3]:ye.shape[1];Ee(Re===fe.shape[2],function(){return"Error in conv2d: depth of input ("+Re+") must match input depth for filter "+fe.shape[2]+"."}),Ee(nu(p,W),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+p+" and dilations '"+W+"'"});var Pe=Da(D),je=qu(ye.shape,fe.shape,p,W,w,Q,!1,Pe),Ge=[fe,ye],rt=qe.runKernelFunc(function(nt,lt){var Nt=nt.conv2d(ye,fe,je);return lt([fe,ye]),Nt},{x:ye,filter:fe},function(nt,lt){var Nt=lt,Rt=Nt[0],Pt=Nt[1];return Ee(ps(W),function(){return"Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+W+"'"}),{x:function(){return J0(Pt.shape,nt,Rt,p,w,D)},filter:function(){return X0(Pt,nt,Rt.shape,p,w,D)}}},"Conv2D",je,Ge);return Oe?rt.as3D(rt.shape[1],rt.shape[2],rt.shape[3]):rt}}),Zg=Bt({conv3d_:function(C,x,p,w,D,W){D===void 0&&(D="NDHWC"),W===void 0&&(W=[1,1,1]);var Q=et(C,"x","conv3d"),ie=et(x,"filter","conv3d"),fe=Q,ye=!1;Q.rank===4&&(ye=!0,fe=Q.as5D(1,Q.shape[0],Q.shape[1],Q.shape[2],Q.shape[3])),Ee(fe.rank===5,function(){return"Error in conv3d: input must be rank 5, but got rank "+fe.rank+"."}),Ee(ie.rank===5,function(){return"Error in conv3d: filter must be rank 5, but got rank "+ie.rank+"."}),Ee(fe.shape[4]===ie.shape[3],function(){return"Error in conv3d: depth of input ("+fe.shape[4]+") must match input depth for filter "+ie.shape[3]+"."}),Ee(function(Pe,je){return Jg(p)||Jg(je)}(0,W),function(){return"Error in conv3D: Either strides or dilations must be 1. Got strides "+p+" and dilations '"+W+"'"}),Ee(D==="NDHWC",function(){return"Error in conv3d: got dataFormat of "+D+" but only NDHWC is currently supported."});var Oe=Cl(fe.shape,ie.shape,p,W,w),Re=qe.runKernelFunc(function(Pe,je){var Ge=Pe.conv3d(fe,ie,Oe);return je([fe,ie]),Ge},{x:fe,$filter:ie},function(Pe,je){Ee(Jg(W),function(){return"Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+W+"'"});var Ge=je[0],rt=je[1];return{x:function(){return Ad(Ge.shape,Pe,rt,p,w)},$filter:function(){return function(nt,lt,Nt,Rt,Pt){var Kt=nt;nt.rank===4&&(Kt=nt.as5D(1,nt.shape[0],nt.shape[1],nt.shape[2],nt.shape[3]));var dn=lt;dn.rank===4&&(dn=lt.as5D(1,lt.shape[0],lt.shape[1],lt.shape[2],lt.shape[3])),Ee(Kt.rank===5,function(){return"Error in conv3dDerFilter: input must be rank 5, but got shape "+Kt.shape+"."}),Ee(dn.rank===5,function(){return"Error in conv3dDerFilter: dy must be rank 5, but got shape "+dn.shape+"."}),Ee(Nt.length===5,function(){return"Error in conv3dDerFilter: filterShape must be length 5, but got "+Nt+"."}),Ee(Kt.shape[4]===Nt[3],function(){return"Error in conv3dDerFilter: depth of input "+Kt.shape[4]+") must match input depth in filter ("+Nt[3]+"."}),Ee(dn.shape[4]===Nt[4],function(){return"Error in conv3dDerFilter: depth of dy ("+dn.shape[4]+") must match output depth for filter ("+Nt[4]+")."});var bn=Cl(Kt.shape,Nt,Rt,1,Pt);return qe.runKernelFunc(function(pn){return pn.conv3dDerFilter(Kt,dn,bn)},{x5D:Kt,dy5D:dn})}(Ge,Pe,rt.shape,p,w)}}});return ye?Re.as4D(Re.shape[1],Re.shape[2],Re.shape[3],Re.shape[4]):Re}}),X0=Bt({conv2dDerFilter_:function(C,x,p,w,D,W,Q){W===void 0&&(W="NHWC");var ie=C;C.rank===3&&(ie=C.as4D(1,C.shape[0],C.shape[1],C.shape[2]));var fe=x;fe.rank===3&&(fe=x.as4D(1,x.shape[0],x.shape[1],x.shape[2])),Ee(ie.rank===4,function(){return"Error in conv2dDerFilter: input must be rank 4, but got shape "+ie.shape+"."}),Ee(fe.rank===4,function(){return"Error in conv2dDerFilter: dy must be rank 4, but got shape "+fe.shape+"."}),Ee(p.length===4,function(){return"Error in conv2dDerFilter: filterShape must be length 4, but got "+p+"."});var ye=W==="NHWC"?ie.shape[3]:ie.shape[1],Oe=W==="NHWC"?fe.shape[3]:fe.shape[1];Ee(ye===p[2],function(){return"Error in conv2dDerFilter: depth of input "+ye+") must match input depth in filter ("+p[2]+"."}),Ee(Oe===p[3],function(){return"Error in conv2dDerFilter: depth of dy ("+Oe+") must match output depth for filter ("+p[3]+")."}),Q!=null&&Ee(vt(D),function(){return"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+Q+" but got pad "+D+"."});var Re=Da(W),Pe=qu(ie.shape,p,w,1,D,Q,!1,Re);return qe.runKernelFunc(function(je){return je.conv2dDerFilter(ie,fe,Pe)},{x4D:ie,dy4D:fe})}}),J0=Bt({conv2dDerInput_:oy}),ig=Bt({depthwiseConv2d_:function(C,x,p,w,D,W,Q){W===void 0&&(W=[1,1]);var ie=et(C,"x","depthwiseConv2d"),fe=et(x,"filter","depthwiseConv2d"),ye=ie,Oe=!1;ie.rank===3&&(Oe=!0,ye=ie.as4D(1,ie.shape[0],ie.shape[1],ie.shape[2])),Ee(ye.rank===4,function(){return"Error in depthwiseConv2d: input must be rank 4, but got rank "+ye.rank+"."}),Ee(fe.rank===4,function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+fe.rank+"."}),Ee(ye.shape[3]===fe.shape[2],function(){return"Error in depthwiseConv2d: number of input channels ("+ye.shape[3]+") must match the inChannels dimension in filter "+fe.shape[2]+"."}),W==null&&(W=[1,1]),Ee(nu(p,W),function(){return"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+p+" and dilations '"+W+"'"}),Q!=null&&Ee(vt(w),function(){return"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+Q+" but got pad "+w+"."});var Re=qu(ye.shape,fe.shape,p,W,w,Q,!0),Pe=[ye,fe],je=qe.runKernelFunc(function(Ge,rt){var nt=Ge.depthwiseConv2D(ye,fe,Re);return rt([ye,fe]),nt},{x:ye,filter:fe},function(Ge,rt){Ee(ps(W),function(){return"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+W+"'"});var nt=rt[0],lt=rt[1];return{x:function(){return Q0(nt.shape,Ge,lt,Re)},filter:function(){return e0(nt,Ge,lt.shape,Re)}}},"DepthwiseConv2dNative",Re,Pe);return Oe?je.as3D(je.shape[1],je.shape[2],je.shape[3]):je}}),Q0=Bt({depthwiseConv2dDerInput_:function(C,x,p,w){var D=x,W=!1;x.rank===3&&(W=!0,D=x.as4D(1,x.shape[0],x.shape[1],x.shape[2]));var Q=qe.runKernelFunc(function(ie){return ie.depthwiseConv2DDerInput(D,p,w)},{dy4D:D});return W?Q.as3D(Q.shape[1],Q.shape[2],Q.shape[3]):Q}}),e0=Bt({depthwiseConv2dDerFilter_:function(C,x,p,w){var D=C;C.rank===3&&(D=C.as4D(1,C.shape[0],C.shape[1],C.shape[2]));var W=x;return W.rank===3&&(W=x.as4D(1,x.shape[0],x.shape[1],x.shape[2])),qe.runKernelFunc(function(Q){return Q.depthwiseConv2DDerFilter(D,W,w)},{x4D:D,dy4D:W})}}),ay=Bt({separableConv2d_:function(C,x,p,w,D,W,Q){W===void 0&&(W=[1,1]),Q===void 0&&(Q="NHWC");var ie=et(C,"x","separableConv2d"),fe=et(x,"depthwiseFilter","separableConv2d"),ye=et(p,"pointwiseFilter","separableConv2d"),Oe=ie,Re=!1;if(ie.rank===3&&(Re=!0,Oe=ie.as4D(1,ie.shape[0],ie.shape[1],ie.shape[2])),Q==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");Ee(Oe.rank===4,function(){return"Error in separableConv2d: input must be rank 4, but got rank "+Oe.rank+"."}),Ee(fe.rank===4,function(){return"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+fe.rank+"."}),Ee(ye.rank===4,function(){return"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+fe.rank+"."}),Ee(ye.shape[0]===1,function(){return"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+ye.shape[0]+"."}),Ee(ye.shape[1]===1,function(){return"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+ye.shape[1]+"."});var Pe=fe.shape[2],je=fe.shape[3];Ee(ye.shape[2]===Pe*je,function(){return"Error in separableConv2d: the third dimension of pointwise filter must be "+Pe*je+", but got "+ye.shape[2]+"."});var Ge=ig(Oe,fe,w,D,Q,W),rt=$p(Ge,ye,1,"valid",Q);return Re?rt.as3D(rt.shape[1],rt.shape[2],rt.shape[3]):rt}}),Rf=Bt({conv2dTranspose_:function(C,x,p,w,D,W){return oy(p,et(C,"x","conv2dTranspose"),et(x,"filter","conv2dTranspose"),w,D,"NHWC",W)}}),w1=Bt({conv3dTranspose_:function(C,x,p,w,D){return Ad(p,et(C,"x","conv3dTranspose"),et(x,"filter","conv3dTranspose"),w,D)}}),sy=Bt({matMul_:function(C,x,p,w){var D;p===void 0&&(p=!1),w===void 0&&(w=!1);var W=et(C,"a","matMul"),Q=et(x,"b","matMul");D=Bn(W,Q),W=D[0],Q=D[1];var ie=p?W.shape[W.rank-2]:W.shape[W.rank-1],fe=w?Q.shape[Q.rank-1]:Q.shape[Q.rank-2],ye=p?W.shape[W.rank-1]:W.shape[W.rank-2],Oe=w?Q.shape[Q.rank-2]:Q.shape[Q.rank-1],Re=W.shape.slice(0,-2),Pe=Q.shape.slice(0,-2),je=Ke(Re),Ge=Ke(Pe);Ee(W.rank>=2&&Q.rank>=2&&W.rank===Q.rank,function(){return"Error in matMul: inputs must have the same rank of at least 2, got ranks "+W.rank+" and "+Q.rank+"."}),Ee(Tt(Re,Pe),function(){return"Error in matMul: outer dimensions ("+Re+") and ("+Pe+") of Tensors with shapes "+W.shape+" and "+Q.shape+" must match."}),Ee(ie===fe,function(){return"Error in matMul: inner shapes ("+ie+") and ("+fe+") of Tensors with shapes "+W.shape+" and "+Q.shape+" and transposeA="+p+" and transposeB="+w+" must match."});var rt=W.shape.slice(0,-2).concat([ye,Oe]),nt=p?W.as3D(je,ie,ye):W.as3D(je,ye,ie),lt=w?Q.as3D(Ge,Oe,fe):Q.as3D(Ge,fe,Oe),Nt={transposeA:p,transposeB:w};return qe.runKernelFunc(function(Rt,Pt){var Kt=Rt.batchMatMul(nt,lt,p,w);return Pt([nt,lt]),Kt},{a:nt,b:lt},function(Rt,Pt){var Kt=Pt,dn=Kt[0],bn=Kt[1];return p||w?!p&&w?{a:function(){return Rt.matMul(bn,!1,!1)},b:function(){return Rt.matMul(dn,!0,!1)}}:p&&!w?{a:function(){return bn.matMul(Rt,!1,!0)},b:function(){return dn.matMul(Rt,!1,!1)}}:{a:function(){return bn.matMul(Rt,!0,!0)},b:function(){return Rt.matMul(dn,!0,!0)}}:{a:function(){return Rt.matMul(bn,!1,!0)},b:function(){return dn.matMul(Rt,!0,!1)}}},"BatchMatMul",Nt).reshape(rt)}}),og=Bt({dot_:function(C,x){var p=et(C,"t1","dot"),w=et(x,"t2","dot");Ee(!(p.rank!==1&&p.rank!==2||w.rank!==1&&w.rank!==2),function(){return"Error in dot: inputs must all be rank 1 or 2, but got ranks "+p.rank+" and "+w.rank+"."});var D=p.rank===1?p.size:p.shape[1],W=w.rank===1?w.size:w.shape[0];return Ee(D===W,function(){return"Error in dot: inner dimensions of inputs must match, but got "+D+" and "+W+"."}),p.rank===1&&w.rank===1?p.as2D(1,-1).matMul(w.as2D(-1,1)).asScalar():p.rank===1&&w.rank===2?p.as2D(1,-1).matMul(w.as2D(w.shape[0],w.shape[1])).as1D():p.rank===2&&w.rank===1?p.matMul(w.as2D(-1,1)).as1D():p.matMul(w.as2D(w.shape[0],w.shape[1]))}}),uy=Bt({outerProduct_:function(C,x){var p=et(C,"v1","outerProduct"),w=et(x,"v2","outerProduct");return Ee(p.rank===1&&w.rank===1,function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+p.rank+" and "+w.rank+"."}),p.as2D(-1,1).matMul(w.as2D(1,-1))}}),Od=Bt({reverse_:function(C,x){var p=et(C,"x","reverse");if(p.rank===0)return p.clone();var w=Vt(x,p.shape);return qe.runKernelFunc(function(D){return D.reverse(p,w)},{$x:p},function(D){return{$x:function(){return D.reverse(w)}}}).reshapeAs(p)}}),cy=Bt({reverse1d_:function(C){var x=et(C,"x","reverse");return Ee(x.rank===1,function(){return"Error in reverse1D: x must be rank 1 but got rank "+x.rank+"."}),Od(x,0)}}),ag=Bt({reverse2d_:function(C,x){var p=et(C,"x","reverse");return Ee(p.rank===2,function(){return"Error in reverse2D: x must be rank 2 but got rank "+p.rank+"."}),Od(p,x)}}),t0=Bt({reverse3d_:function(C,x){var p=et(C,"x","reverse");return Ee(p.rank===3,function(){return"Error in reverse3D: x must be rank 3 but got rank "+p.rank+"."}),Od(p,x)}}),ly=Bt({reverse4d_:function(C,x){var p=et(C,"x","reverse");return Ee(p.rank===4,function(){return"Error in reverse4D: x must be rank 4 but got rank "+p.rank+"."}),Od(p,x)}});function fy(C,x,p,w,D,W){var Q=et(C,"x","maxPool"),ie=Q,fe=!1;Q.rank===3&&(fe=!0,ie=Q.as4D(1,Q.shape[0],Q.shape[1],Q.shape[2])),w==null&&(w=[1,1]),Ee(ie.rank===4,function(){return"Error in maxPool: input must be rank 4 but got rank "+ie.rank+"."}),Ee(nu(p,w),function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+p+" and dilations '"+w+"'"}),W!=null&&Ee(vt(D),function(){return"Error in maxPool: pad must be an integer when using, dimRoundingMode "+W+" but got pad "+D+"."});var ye=Mc(ie.shape,x,p,w,D,W);if(ye.filterWidth===1&&ye.filterHeight===1&&Tt(ye.inShape,ye.outShape))return Q.clone();var Oe=[ie],Re=qe.runKernelFunc(function(Pe,je){var Ge=Pe.maxPool(ie,ye);return je([ie,Ge]),Ge},{x:ie},function(Pe,je){var Ge=je[0],rt=je[1];return{x:function(){return function(nt,lt,Nt,Rt,Pt,Kt,dn,bn){var pn=et(nt,"dy","maxPoolBackprop"),_n=et(lt,"input","maxPoolBackprop"),On=et(Nt,"output","maxPoolBackprop");Ee(_n.rank===pn.rank,function(){return"Rank of input ("+_n.rank+") does not match rank of dy ("+pn.rank+")"}),Kt==null&&(Kt=[1,1]),Ee(nu(Pt,Kt),function(){return"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+Pt+" and dilations '"+Kt+"'"}),Ee(pn.rank===4,function(){return"Error in maxPoolBackprop: dy must be rank 4 but got rank "+pn.rank+"."}),Ee(_n.rank===4,function(){return"Error in maxPoolBackprop: input must be rank 4 but got rank "+_n.rank+"."});var _=Mc(_n.shape,Rt,Pt,Kt,dn,bn);return qe.runKernelFunc(function(m){return m.maxPoolBackprop(pn,_n,On,_)},{$dy:pn,$input:_n})}(Pe,Ge,rt,x,p,w,D)}}},"MaxPool",ye,Oe);return fe?Re.as3D(Re.shape[1],Re.shape[2],Re.shape[3]):Re}function Z0(C,x,p,w,D,W){var Q=et(C,"x","avgPool","float32");w==null&&(w=[1,1]),Ee(nu(p,w),function(){return"Error in avgPool: Either strides or dilations must be 1. Got strides "+p+" and dilations '"+w+"'"});var ie=Q,fe=!1;Q.rank===3&&(fe=!0,ie=Q.as4D(1,Q.shape[0],Q.shape[1],Q.shape[2])),Ee(ie.rank===4,function(){return"Error in avgPool: x must be rank 4 but got rank "+ie.rank+"."}),W!=null&&Ee(vt(D),function(){return"Error in avgPool: pad must be an integer when using, dimRoundingMode "+W+" but got pad "+D+"."});var ye=Mc(ie.shape,x,p,w,D,W);if(ye.filterWidth===1&&ye.filterHeight===1&&Tt(ye.inShape,ye.outShape))return Q.clone();var Oe=qe.runKernelFunc(function(Re){return Re.avgPool(ie,ye)},{x:ie},function(Re){return{x:function(){return function(Pe,je,Ge,rt,nt,lt){var Nt=et(Pe,"dy","avgPoolBackprop"),Rt=et(je,"input","avgPoolBackprop");Ee(Rt.rank===Nt.rank,function(){return"Rank of input ("+Rt.rank+") does not match rank of dy ("+Nt.rank+")"}),nt==null&&(nt=[1,1]),Ee(nu(rt,nt),function(){return"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+rt+" and dilations '"+nt+"'"});var Pt=Rt,Kt=Nt,dn=!1;Rt.rank===3&&(dn=!0,Pt=Rt.as4D(1,Rt.shape[0],Rt.shape[1],Rt.shape[2]),Kt=Nt.as4D(1,Nt.shape[0],Nt.shape[1],Nt.shape[2])),Ee(Kt.rank===4,function(){return"Error in avgPoolBackprop: dy must be rank 4 but got rank "+Kt.rank+"."}),Ee(Pt.rank===4,function(){return"Error in avgPoolBackprop: input must be rank 4 but got rank "+Pt.rank+"."});var bn=Mc(Pt.shape,Ge,rt,nt,lt),pn=qe.runKernelFunc(function(_n){return _n.avgPoolBackprop(Kt,Pt,bn)},{dy4D:Kt,input4D:Pt});return dn?pn.as3D(pn.shape[1],pn.shape[2],pn.shape[3]):pn}(Re,ie,x,p,w,D)}}},"AvgPool",ye);return Oe=Oe.cast(Q.dtype),fe?Oe.as3D(Oe.shape[1],Oe.shape[2],Oe.shape[3]):Oe}var dy=Bt({maxPool_:function(C,x,p,w,D){return fy(C,x,p,1,w,D)}}),hy=Bt({avgPool_:function(C,x,p,w,D){return Z0(C,x,p,1,w,D)}}),Mh=Bt({pool_:function(C,x,p,w,D,W){D==null&&(D=[1,1]),W==null&&(W=1),w===0&&(w="valid");var Q=et(C,"x","maxPool"),ie=Q,fe=!1;Q.rank===3&&(fe=!0,ie=Q.as4D(1,Q.shape[0],Q.shape[1],Q.shape[2])),Ee(nu(W,D),function(){return"Error in pool: Either strides or dilations must be 1. Got strides "+W+" and dilations '"+D+"'"});var ye,Oe=Mc(ie.shape,x,W,D,w),Re=[Oe.dilationHeight,Oe.dilationWidth];ye=w==="same"?function(Pt,Kt){var dn=Pt.map(function(_n,On){return _n+(_n-1)*(Kt[On]-1)}).map(function(_n){return _n-1}),bn=dn.map(function(_n){return Math.floor(_n/2)}),pn=dn.map(function(_n,On){return _n-bn[On]});return dn.map(function(_n,On){return[bn[On],pn[On]]})}([Oe.filterHeight,Oe.filterWidth],Re):[[0,0],[0,0]];var Pe=Re[0]===1&&Re[1]===1,je=function(Pt,Kt,dn){var bn=dn.map(function(m){return m[0]}),pn=dn.map(function(m){return m[1]}),_n=Pt.concat(bn,pn),On=Kt.map(function(m,f){return(m-_n[f]%m)%m}),_=pn.map(function(m,f){return m+On[f]});return[Kt.map(function(m,f){return[bn[f],_[f]]}),Kt.map(function(m,f){return[0,On[f]]})]}([Oe.inHeight,Oe.inWidth],Re,ye),Ge=je[0],rt=je[1],nt=Pe?w:"valid",lt=Pe?ie:hs(ie,Re,Ge),Nt=(p==="avg"?function(){return Z0(lt,x,W,1,nt)}:function(){return fy(lt,x,W,1,nt)})(),Rt=Pe?Nt:wf(Nt,Re,rt);return fe?Rt.as3D(Rt.shape[1],Rt.shape[2],Rt.shape[3]):Rt}}),_1=Bt({maxPool3d_:function(C,x,p,w,D,W,Q){W===void 0&&(W="NDHWC");var ie=et(C,"x","maxPool3d"),fe=ie,ye=!1;ie.rank===4&&(ye=!0,fe=ie.as5D(1,ie.shape[0],ie.shape[1],ie.shape[2],ie.shape[3])),Q==null&&(Q=[1,1,1]),Ee(fe.rank===5,function(){return"Error in maxPool3d: x must be rank 5 but got rank "+fe.rank+"."}),Ee(W==="NDHWC",function(){return"Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of "+W}),Ee(nu(p,Q),function(){return"Error in maxPool3d: Either strides or dilations must be 1. Got strides "+p+" and dilations '"+Q+"'"}),D!=null&&Ee(vt(w),function(){return"Error in maxPool3d: pad must be an integer when using, dimRoundingMode "+D+" but got pad "+w+"."});var Oe=El(fe.shape,x,p,Q,w,D,W),Re=qe.runKernelFunc(function(Pe,je){var Ge=Pe.maxPool3d(fe,Oe);return je([fe,Ge]),Ge},{x:fe},function(Pe,je){var Ge=je[0],rt=je[1];return{x:function(){return function(nt,lt,Nt,Rt,Pt,Kt,dn,bn){var pn=et(nt,"dy","maxPool3dBackprop"),_n=et(lt,"input","maxPool3dBackprop"),On=et(Nt,"output","maxPool3dBackprop"),_=pn,m=_n,f=On,y=!1;_n.rank===4&&(y=!0,_=pn.as5D(1,pn.shape[0],pn.shape[1],pn.shape[2],pn.shape[3]),m=_n.as5D(1,_n.shape[0],_n.shape[1],_n.shape[2],_n.shape[3]),f=On.as5D(1,On.shape[0],On.shape[1],On.shape[2],On.shape[3])),Ee(_.rank===5,function(){return"Error in maxPool3dBackprop: dy must be rank 5 but got rank "+_.rank+"."}),Ee(m.rank===5,function(){return"Error in maxPool3dBackprop: input must be rank 5 but got rank "+m.rank+"."}),Ee(f.rank===5,function(){return"Error in maxPool3dBackprop: output must be rank 5 but got rank "+f.rank+"."}),Kt==null&&(Kt=[1,1,1]),Ee(nu(Pt,Kt),function(){return"Error in maxPool3dBackprop: Either strides or dilations must be 1. Got strides "+Pt+" and dilations '"+Kt+"'"}),bn!=null&&Ee(vt(dn),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+bn+" but got pad "+dn+"."});var E=El(m.shape,Rt,Pt,Kt,dn,bn),z=qe.runKernelFunc(function(Y){return Y.maxPool3dBackprop(_,m,f,E)},{dy5D:_,input5D:m});return y?z.as4D(z.shape[1],z.shape[2],z.shape[3],z.shape[4]):z}(Pe,Ge,rt,x,p,Q,w,D)}}});return ye?Re.as4D(Re.shape[1],Re.shape[2],Re.shape[3],Re.shape[4]):Re}}),py=Bt({avgPool3d_:function(C,x,p,w,D,W,Q){W===void 0&&(W="NDHWC");var ie=et(C,"x","avgPool3d","float32"),fe=ie,ye=!1;ie.rank===4&&(ye=!0,fe=ie.as5D(1,ie.shape[0],ie.shape[1],ie.shape[2],ie.shape[3])),Q==null&&(Q=[1,1,1]),Ee(fe.rank===5,function(){return"Error in avgPool3d: x must be rank 5 but got rank "+fe.rank+"."}),Ee(W==="NDHWC",function(){return"Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of "+W}),Ee(nu(p,Q),function(){return"Error in avgPool3d: Either strides or dilations must be 1. Got strides "+p+" and dilations '"+Q+"'"}),D!=null&&Ee(vt(w),function(){return"Error in avgPool3d: pad must be an integer when using, dimRoundingMode "+D+" but got pad "+w+"."});var Oe=El(fe.shape,x,p,Q,w,D,W),Re=qe.runKernelFunc(function(Pe){return Pe.avgPool3d(fe,Oe)},{x:fe},function(Pe){return{x:function(){return function(je,Ge,rt,nt,lt,Nt,Rt){var Pt=et(je,"dy","avgPool3dBackprop"),Kt=et(Ge,"input","avgPool3dBackprop"),dn=Pt,bn=Kt,pn=!1;Kt.rank===4&&(pn=!0,dn=Pt.as5D(1,Pt.shape[0],Pt.shape[1],Pt.shape[2],Pt.shape[3]),bn=Kt.as5D(1,Kt.shape[0],Kt.shape[1],Kt.shape[2],Kt.shape[3])),Ee(dn.rank===5,function(){return"Error in avgPool3dBackprop: dy must be rank 5 but got rank "+dn.rank+"."}),Ee(bn.rank===5,function(){return"Error in avgPool3dBackprop: input must be rank 5 but got rank "+bn.rank+"."}),lt==null&&(lt=[1,1,1]),Ee(nu(nt,lt),function(){return"Error in avgPool3dBackprop: Either strides or dilations must be 1. Got strides "+nt+" and dilations '"+lt+"'"}),Rt!=null&&Ee(vt(Nt),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+Rt+" but got pad "+Nt+"."});var _n=El(bn.shape,rt,nt,lt,Nt,Rt),On=qe.runKernelFunc(function(_){return _.avgPool3dBackprop(dn,bn,_n)},{dy5D:dn,input5D:bn});return pn?On.as4D(On.shape[1],On.shape[2],On.shape[3],On.shape[4]):On}(Pe,fe,x,p,Q,w,D)}}});return Re=Re.cast(fe.dtype),ye?Re.as4D(Re.shape[1],Re.shape[2],Re.shape[3],Re.shape[4]):Re}}),Bf=Bt({slice_:function(C,x,p){var w,D,W=et(C,"x","slice");if(W.rank===0)throw new Error("Slicing scalar is not possible");(w=typeof x=="number"?[x].concat(new Array(W.rank-1).fill(0)):x.length<W.rank?x.concat(new Array(W.rank-x.length).fill(0)):x.slice()).forEach(function(fe){Ee(fe!==-1,function(){return"slice() does not support negative begin indexing."})}),D=(D=p==null?new Array(W.rank).fill(-1):typeof p=="number"?[p].concat(new Array(W.rank-1).fill(-1)):p.length<W.rank?p.concat(new Array(W.rank-p.length).fill(-1)):p).map(function(fe,ye){return fe>=0?fe:(Ee(fe===-1,function(){return"Negative size values should be exactly -1 but got "+fe+" for the slice() size at index "+ye+"."}),W.shape[ye]-w[ye])}),Np(W,w,D);var Q=W.shape,ie={begin:w,size:D};return qe.runKernelFunc(function(fe){return fe.slice(W,w,D)},{x:W},function(fe){for(var ye=[],Oe=0;Oe<fe.rank;Oe++)ye.push([w[Oe],Q[Oe]-w[Oe]-D[Oe]]);return{x:function(){return fe.pad(ye)}}},"Slice",ie)}}),ev=Bt({slice1d_:function(C,x,p){var w=et(C,"x","slice1d");return Ee(w.rank===1,function(){return"slice1d expects a rank-1 tensor, but got a rank-"+w.rank+" tensor"}),Bf(w,[x],[p])}}),my=Bt({slice2d_:function(C,x,p){var w=et(C,"x","slice2d");return Ee(w.rank===2,function(){return"slice2d expects a rank-2 tensor, but got a rank-"+w.rank+" tensor"}),Bf(w,x,p)}}),Fh=Bt({slice3d_:function(C,x,p){var w=et(C,"x","slice3d");return Ee(w.rank===3,function(){return"slice3d expects a rank-3 tensor, but got a rank-"+w.rank+" tensor"}),Bf(w,x,p)}}),Pf=Bt({slice4d_:function(C,x,p){var w=et(C,"x","slice4d");return Ee(w.rank===4,function(){return"slice4d expects a rank-4 tensor, but got a rank-"+w.rank+" tensor"}),Bf(w,x,p)}});function n0(C,x,p,w,D){return x.rank<p.rank&&(x=x.reshape(ia(x.shape,w))),C.rank<p.rank&&(C=C.reshape(ia(C.shape,w))),{x:function(){var W=C.mul(p.equal(x).cast(C.dtype));return D==null?W:W.transpose(D)}}}var tv=Bt({all_:function(C,x,p){x===void 0&&(x=null),p===void 0&&(p=!1);var w=et(C,"x","all","bool"),D=Vt(x,w.shape),W=D,Q=fs(W,w.rank);Q!=null&&(w=w.transpose(Q),W=ds(W.length,w.rank));var ie=qe.runKernelFunc(function(ye){return ye.all(w,W)},{$x:w});if(p){var fe=ia(ie.shape,D);return ie.reshape(fe)}return ie}}),Nl=Bt({any_:function(C,x,p){x===void 0&&(x=null),p===void 0&&(p=!1);var w=et(C,"x","any","bool"),D=Vt(x,w.shape),W=D,Q=fs(W,w.rank);Q!=null&&(w=w.transpose(Q),W=ds(W.length,w.rank));var ie=qe.runKernelFunc(function(ye){return ye.any(w,W)},{$x:w});if(p){var fe=ia(ie.shape,D);return ie.reshape(fe)}return ie}}),nv=Bt({argMax_:function(C,x){x===void 0&&(x=0);var p=et(C,"x","argMax");x==null&&(x=0);var w=Vt(x,p.shape),D=fs(w,p.rank);D!=null&&(p=p.transpose(D),w=ds(w.length,p.rank));var W={axis:w[0]},Q=[p];return qe.runKernelFunc(function(ie,fe){var ye=ie.argMax(p,w[0]);return fe([p]),ye},{x:p},function(ie,fe){var ye=fe[0];return{x:function(){return Ei(ye)}}},"ArgMax",W,Q)}}),gy=Bt({argMin_:function(C,x){x===void 0&&(x=0);var p=et(C,"x","argMin");x==null&&(x=0);var w=Vt(x,p.shape),D=fs(w,p.rank);return D!=null&&(p=p.transpose(D),w=ds(w.length,p.rank)),qe.runKernelFunc(function(W,Q){var ie=W.argMin(p,w[0]);return Q([p]),ie},{$x:p},function(W,Q){var ie=Q[0];return{$x:function(){return Ei(ie)}}})}}),Dd=Bt({logSumExp_:function(C,x,p){x===void 0&&(x=null),p===void 0&&(p=!1);var w=et(C,"x","logSumExp"),D=Vt(x,w.shape),W=w.max(D,!0),Q=w.sub(W).exp().sum(D).log(),ie=W.reshape(Q.shape).add(Q);if(p){var fe=ia(ie.shape,D);return ie.reshape(fe)}return ie}}),k1=Bt({max_:function(C,x,p){x===void 0&&(x=null),p===void 0&&(p=!1);var w=et(C,"x","max"),D=w,W=Vt(x,w.shape),Q=W,ie=fs(Q,w.rank);ie!=null&&(w=w.transpose(ie),Q=ds(Q.length,w.rank));var fe=[w],ye=qe.runKernelFunc(function(Re,Pe){var je=Re.max(w,Q);return Pe([D,je]),je},{x:w},function(Re,Pe){return n0(Re,Pe[1],Pe[0],W,ie)},"Max",{axes:Q},fe,[!0]);if(p){var Oe=ia(ye.shape,W);ye=ye.reshape(Oe)}return ye}}),Hp=Bt({mean_:function(C,x,p){x===void 0&&(x=null),p===void 0&&(p=!1);var w=et(C,"x","mean"),D=Vt(x,w.shape),W=Ke(ra(w.shape,D)[1]);return Hu(function(Q){var ie=Or(W);return{value:(ie.dtype===Q.dtype?Q:Q.cast(ie.dtype)).div(ie).sum(x,p),gradFunc:function(fe){var ye=Q.shape.slice();return D.forEach(function(Oe){ye[Oe]=1}),fe.reshape(ye).mul(yc(Q.shape,"float32")).div(W)}}})(w)}}),qp=Bt({min_:function(C,x,p){x===void 0&&(x=null),p===void 0&&(p=!1);var w=et(C,"x","min"),D=w,W=Vt(x,w.shape),Q=W,ie=fs(Q,w.rank);ie!=null&&(w=w.transpose(ie),Q=ds(Q.length,w.rank));var fe=[w],ye=qe.runKernelFunc(function(Re,Pe){var je=Re.min(w,Q);return Pe([D,je]),je},{x:w},function(Re,Pe){return n0(Re,Pe[1],Pe[0],W,ie)},"Min",{axes:Q},fe,[!0]);if(p){var Oe=ia(ye.shape,W);ye=ye.reshape(Oe)}return ye}}),Td=Bt({moments_:function(C,x,p){x===void 0&&(x=null),p===void 0&&(p=!1);var w=Vt(x,(C=et(C,"x","moments")).shape),D=C.mean(w,p),W=D.shape;return p||(W=ia(D.shape,w)),{mean:D,variance:C.toFloat().sub(D.reshape(W)).square().mean(w,p)}}}),vy=Bt({sum_:function(C,x,p){x===void 0&&(x=null),p===void 0&&(p=!1);var w=et(C,"x","sum");w.dtype==="bool"&&(w=w.toInt());var D=Vt(x,w.shape);return Hu(function(W){var Q=fs(D,W.rank),ie=D,fe=W;Q!=null&&(fe=W.transpose(Q),ie=ds(ie.length,W.rank));var ye=function(je){var Ge=W.shape.slice();return D.forEach(function(rt){Ge[rt]=1}),je.reshape(Ge).mul(yc(W.shape,"float32"))},Oe={axes:ie},Re=qe.runKernelFunc(function(je){return je.sum(fe,ie)},{x:fe},function(je){return{x:function(){return ye(je)}}},"Sum",Oe);if(p){var Pe=ia(Re.shape,D);Re=Re.reshape(Pe)}return{value:Re,gradFunc:ye}})(w)}}),Rh=Bt({prod_:function(C,x,p){x===void 0&&(x=null),p===void 0&&(p=!1);var w=et(C,"x","prod");w.dtype==="bool"&&(w=w.toInt());var D=Vt(x,w.shape),W=fs(D,w.rank),Q=D,ie=w;W!=null&&(ie=w.transpose(W),Q=ds(Q.length,w.rank));var fe=qe.runKernelFunc(function(Oe){return Oe.prod(ie,Q)},{permutedX:ie});if(p){var ye=ia(fe.shape,D);fe=fe.reshape(ye)}return fe}}),Il=Bt({elu_:function(C){var x=et(C,"x","elu");return qe.runKernelFunc(function(p,w){var D=p.elu(x);return w([D]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){return qe.runKernelFunc(function(W){return W.eluDer(p,D)},{dy:p,y:D})}}})}}),Gp=Bt({leakyRelu_:function(C,x){x===void 0&&(x=.2);var p=et(C,"x","leakyRelu");return Ah(Or(x).mul(p),p)}}),sg=Bt({prelu_:function(C,x){var p=et(C,"x","prelu"),w=et(x,"alpha","prelu");return qe.runKernelFunc(function(D,W){var Q=D.prelu(p,w);return W([p,w]),Q},{x:p,alpha:w},function(D,W){var Q=W[0],ie=W[1],fe=Q.greater(0);return{x:function(){return Ao(fe,D,D.mul(ie))},alpha:function(){var ye=Ao(fe,Ei(D),D.mul(Q)),Oe=as(ie.shape,D.shape);return Oe.length>0&&(ye=ye.sum(Oe)),ye.reshape(ie.shape)}}},"Prelu")}}),r0=Bt({relu_:function(C){var x=et(C,"x","relu");return x.dtype==="bool"?x.toInt():qe.runKernelFunc(function(p,w){var D=p.relu(x);return w([x]),D},{x},function(p,w){var D=w[0];return{x:function(){return p.mulStrict(D.step().toFloat())}}},"Relu")}}),rv=Bt({relu6_:function(C){var x=et(C,"x","relu6");return x.dtype==="bool"?x.toInt():qe.runKernelFunc(function(p,w){var D=p.relu6(x);return w([x]),D},{x},function(p,w){var D=w[0],W=D.lessEqual(6).mul(D.step());return{x:function(){return p.mulStrict(W.toFloat())}}},"Relu6")}}),yy=Bt({selu_:function(C){var x=et(C,"x","selu");return qe.runKernelFunc(function(p,w){var D=p.selu(x);return w([x]),D},{$x:x},function(p,w){var D=w[0];return{$x:function(){var W=D.greater(Or(0)),Q=Or(Ol),ie=Or(Of),fe=p.mul(ie),ye=p.mul(Q).mul(D.toFloat().exp());return Ao(W,fe,ye)}}})}}),Ks=Bt({transpose_:function(C,x){var p=et(C,"x","transpose");if(x==null&&(x=p.shape.map(function(D,W){return W}).reverse()),Ee(p.rank===x.length,function(){return"Error in transpose: rank of input "+p.rank+" must match length of perm "+x+"."}),x.forEach(function(D){Ee(D>=0&&D<p.rank,function(){return"All entries in 'perm' must be between 0 and "+(p.rank-1)+" but got "+x})}),p.rank<=1)return p.clone();var w={perm:x};return qe.runKernelFunc(function(D){return D.transpose(p,x)},{x:p},function(D){var W=Ic(x);return{x:function(){return D.transpose(W)}}},"Transpose",w)}}),by=Bt({localResponseNormalization_:function(C,x,p,w,D){x===void 0&&(x=5),p===void 0&&(p=1),w===void 0&&(w=1),D===void 0&&(D=.5);var W=et(C,"x","localResponseNormalization");Ee(W.rank===4||W.rank===3,function(){return`Error in localResponseNormalization: x must be rank 3 or 4 but got 7604 rank `+W.rank+"."}),Ee(vt(x),function(){return"Error in localResponseNormalization: depthRadius must be an integer but got depthRadius "+x+"."});var Q=W,ie=!1;W.rank===3&&(ie=!0,Q=W.as4D(1,W.shape[0],W.shape[1],W.shape[2]));var fe=qe.runKernelFunc(function(ye,Oe){var Re=ye.localResponseNormalization4D(Q,x,p,w,D);return Oe([Q,Re]),Re},{x4D:Q},function(ye,Oe){var Re=Oe[0],Pe=Oe[1];return{x4D:function(){return qe.runKernelFunc(function(je){return je.LRNGrad(ye,Re,Pe,x,p,w,D)},{})}}});return ie?fe.as3D(fe.shape[1],fe.shape[2],fe.shape[3]):fe}}),Kp=Bt({norm_:function(C,x,p,w){x===void 0&&(x="euclidean"),p===void 0&&(p=null),w===void 0&&(w=!1);var D=function ie(fe,ye,Oe){if(Oe===void 0&&(Oe=null),fe.rank===0)return fe.abs();if(fe.rank!==1&&Oe===null)return ie(fe.reshape([-1]),ye,Oe);if(fe.rank===1||typeof Oe=="number"||Array.isArray(Oe)&&Oe.length===1){if(ye===1)return fe.abs().sum(Oe);if(ye===1/0)return fe.abs().max(Oe);if(ye===-1/0)return fe.abs().min(Oe);if(ye==="euclidean"||ye===2)return fe.abs().pow(Or(2,"int32")).sum(Oe).sqrt();throw new Error("Error in norm: invalid ord value: "+ye)}if(Array.isArray(Oe)&&Oe.length===2){if(ye===1)return fe.abs().sum(Oe[0]).max(Oe[1]-1);if(ye===1/0)return fe.abs().sum(Oe[1]).max(Oe[0]);if(ye===-1/0)return fe.abs().sum(Oe[1]).min(Oe[0]);if(ye==="fro"||ye==="euclidean")return fe.square().sum(Oe).sqrt();throw new Error("Error in norm: invalid ord value: "+ye)}throw new Error("Error in norm: invalid axis: "+Oe)}(C=et(C,"x","norm"),x,p),W=D.shape;if(w){var Q=Vt(p,C.shape);W=ia(D.shape,Q)}return D.reshape(W)}}),xy=Bt({basicLSTMCell_:function(C,x,p,w,D,W){var Q=et(C,"forgetBias","basicLSTMCell"),ie=et(x,"lstmKernel","basicLSTMCell"),fe=et(p,"lstmBias","basicLSTMCell"),ye=et(w,"data","basicLSTMCell"),Oe=et(D,"c","basicLSTMCell"),Re=et(W,"h","basicLSTMCell"),Pe=ye.concat(Re,1).matMul(ie).add(fe),je=Pe.shape[0],Ge=Pe.shape[1]/4,rt=[je,Ge],nt=Pe.slice([0,0],rt),lt=Pe.slice([0,Ge],rt),Nt=Pe.slice([0,2*Ge],rt),Rt=Pe.slice([0,3*Ge],rt),Pt=nt.sigmoid().mulStrict(lt.tanh()).addStrict(Oe.mulStrict(Q.add(Nt).sigmoid()));return[Pt,Pt.tanh().mulStrict(Rt.sigmoid())]}}),i0=Bt({multiRNNCell_:function(C,x,p,w){for(var D=et(x,"data","multiRNNCell"),W=Zc(p,"c","multiRNNCell"),Q=Zc(w,"h","multiRNNCell"),ie=D,fe=[],ye=0;ye<C.length;ye++){var Oe=C[ye](ie,W[ye],Q[ye]);fe.push(Oe[0]),fe.push(Oe[1]),ie=Oe[1]}var Re=[],Pe=[];for(ye=0;ye<fe.length;ye+=2)Re.push(fe[ye]),Pe.push(fe[ye+1]);return[Re,Pe]}}),Nd=Bt({movingAverage_:function(C,x,p,w,D){D===void 0&&(D=!0);var W=et(C,"v","movingAverage"),Q=et(x,"x","movingAverage"),ie=et(p,"decay","movingAverage");Gn(W,Q),Ee(Tt(W.shape,Q.shape),function(){return"Shape mismatch in v and x"});var fe=Or(1),ye=fe.sub(ie),Oe=Q.sub(W).mul(ye);if(D){Ee(w!=null,function(){return"When using zeroDebias: true, step is required."});var Re=et(w,"step","movingAverage");Oe=Oe.div(fe.sub(Dh(ie,Re)))}return W.add(Oe)}}),ug=Bt({stridedSlice_:function(C,x,p,w,D,W,Q,ie,fe){if(D===void 0&&(D=0),W===void 0&&(W=0),Q===void 0&&(Q=0),ie===void 0&&(ie=0),fe===void 0&&(fe=0),w==null&&(w=new Array(x.length)),Q!==0)throw new Error("ellipsis mask is not yet supported");var ye=et(C,"x","stridedSlice"),Oe=os(ie),Re=ye.shape.slice();Oe.forEach(function(nt){x[nt]=0,p[nt]=1,Re.splice(nt,0,1)}),ye=ye.reshape(Re);for(var Pe=0;Pe<ye.rank;Pe++)x[Pe]=ku(D,x,w,ye.shape,Pe),p[Pe]=pd(W,p,w,ye.shape,Pe),w[Pe]=w[Pe]||1;var je=os(fe);je.forEach(function(nt){p[nt]=x[nt]+1,w[nt]=1});var Ge=hd(x,p,w),rt=Ge.filter(function(nt,lt){return je.indexOf(lt)===-1});return w.every(function(nt){return nt===1})?Bf(ye,x,Ge).reshape(rt):qe.runKernelFunc(function(nt){return nt.stridedSlice(ye,x,p,w)},{$x:ye}).reshape(rt)}}),jf=Bt({topk_:function(C,x,p){x===void 0&&(x=1),p===void 0&&(p=!0);var w=et(C,"x","topk");if(w.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");var D=w.shape[w.shape.length-1];if(x>D)throw new Error("'k' passed to topk() must be <= the last dimension ("+D+") but got "+x);var W=qe.runKernelFunc(function(Q){return Q.topk(w,x,p)},{$x:w});return{values:W[0],indices:W[1]}}}),wy=Bt({scatterND_:function(C,x,p){var w=et(C,"indices","scatterND","int32"),D=et(x,"updates","scatterND");return hh(D,w,p),qe.runKernelFunc(function(W){return W.scatterND(w,D,p)},{indices:w,updates:D},null,"ScatterNd",{shape:p})}}),o0=Bt({fft_:function(C){Ee(C.dtype==="complex64",function(){return"The dtype for tf.spectral.fft() must be complex64 but got "+C.dtype+"."});var x=C.shape[C.shape.length-1],p=C.size/x,w=C.as2D(p,x);return qe.runKernelFunc(function(D){return D.fft(w)},{input:C}).reshape(C.shape)}}),a0=Bt({ifft_:function(C){Ee(C.dtype==="complex64",function(){return"The dtype for tf.spectral.ifft() must be complex64 but got "+C.dtype+"."});var x=C.shape[C.shape.length-1],p=C.size/x,w=C.as2D(p,x);return qe.runKernelFunc(function(D){return D.ifft(w)},{input:C}).reshape(C.shape)}}),iv=Bt({rfft_:function(C,x){Ee(C.dtype==="float32",function(){return"The dtype for rfft() must be real value but got "+C.dtype});var p,w=C.shape[C.shape.length-1],D=C.size/w;if(x!=null&&x<w){var W=C.shape.map(function(lt){return 0}),Q=C.shape.map(function(lt){return lt});Q[C.shape.length-1]=x,p=C.slice(W,Q),w=x}else if(x!=null&&x>w){var ie=C.shape.map(function(lt){return lt});ie[C.shape.length-1]=x-w,p=C.concat(go(ie),C.shape.length-1),w=x}else p=C;var fe=p.zerosLike(),ye=zo(p,fe).as2D(D,w),Oe=o0(ye),Re=Math.floor(w/2)+1,Pe=qa(Oe),je=Os(Oe),Ge=Pe.split([Re,w-Re],Pe.shape.length-1),rt=je.split([Re,w-Re],je.shape.length-1),nt=p.shape.slice();return nt[p.shape.length-1]=Re,zo(Ge[0],rt[0]).reshape(nt)}}),nf=Bt({irfft_:function(C){var x=C.shape[C.shape.length-1],p=C.size/x;if(x<=2){var w=C.as2D(p,x),D=a0(w);return qa(D)}var W=[p,2*(x-1)],Q=qa(C).as2D(p,x),ie=Os(C).as2D(p,x),fe=Q.slice([0,1],[p,x-2]).reverse(1),ye=ie.slice([0,1],[p,x-2]).reverse(1).mul(Or(-1)),Oe=Q.concat(fe,1),Re=ie.concat(ye,1);return w=zo(Oe,Re).as2D(W[0],W[1]),D=a0(w),qa(D)}}),s0=Object.freeze({fft:o0,ifft:a0,rfft:iv,irfft:nf}),_y=Bt({sparseToDense_:function(C,x,p,w){w===void 0&&(w=0);var D=et(C,"sparseIndices","sparseToDense","int32"),W=et(x,"sparseValues","sparseToDense"),Q=et(w,"defaultValue","sparseToDense",W.dtype);return function(ie,fe,ye,Oe){if(ie.dtype!=="int32")throw new Error("tf.sparseToDense() expects the indices to be int32 type, but the dtype was "+ie.dtype+".");if(ie.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix, but got shape "+ie.shape+".");var Re=ie.rank>0?ie.shape[0]:1,Pe=ie.rank>1?ie.shape[1]:1;if(ye.length!==Pe)throw new Error("outputShape has incorrect number of elements:, "+ye.length+", should be: "+Pe+".");var je=fe.size;if(fe.rank!==0&&(fe.rank!==1||je!==Re))throw new Error("sparseValues has incorrect shape "+fe.shape+", should be [] or ["+Re+"]");if(fe.dtype!==Oe.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(D,W,p,Q),qe.runKernelFunc(function(ie){return ie.sparseToDense(D,W,p,Q)},{$sparseIndices:D,$sparseValues:W,$defaultValue:Q})}}),Lf=Bt({gatherND_:function(C,x){var p=et(x,"indices","gatherND","int32"),w=et(C,"x","gatherND");return qe.runKernelFunc(function(D){return D.gatherND(w,p)},{x:w,indices:p},null,"GatherNd")}}),cg=Bt({diag_:function(C){var x=et(C,"x","diag").flatten(),p=C.shape.concat(C.shape);return qe.runKernelFunc(function(w){return w.diag(x)},{$x:x}).reshape(p)}}),Bh=Bt({dropout_:function(C,x,p,w){var D=et(C,"x","dropout");if(Ee(D.dtype==="float32",function(){return"x has to be a floating point tensor since it's going to be scaled, but got a "+D.dtype+" tensor instead."}),Ee(x>=0&&x<1,function(){return"rate must be a float in the range [0, 1), but got "+x+"."}),x===0)return C instanceof Zt?D.clone():D;var W=function(fe,ye){if(ye==null)return fe.shape.slice();if(Tt(fe.shape,ye))return ye;if(fe.shape.length===ye.length){for(var Oe=[],Re=0;Re<fe.shape.length;Re++)ye[Re]==null&&fe.shape[Re]!=null?Oe.push(fe.shape[Re]):Oe.push(ye[Re]);return Oe}return ye}(D,p),Q=1-x,ie=fd(W,0,1,"float32",w).add(Q).floor().div(Q);return D.mul(ie)}});function lg(C,x,p){for(var w=1-C%2,D=new Float32Array(C),W=0;W<C;++W){var Q=2*Math.PI*W/(C+w-1);D[W]=x-p*Math.cos(Q)}return Vu(D,"float32")}var Ys,u0=Bt({hannWindow_:function(C){return lg(C,.5,.5)}}),ov=Bt({hammingWindow_:function(C){return lg(C,.54,.46)}}),fg=Bt({frame_:function(C,x,p,w,D){w===void 0&&(w=!1),D===void 0&&(D=0);for(var W=0,Q=[];W+x<=C.size;)Q.push(Bf(C,W,x)),W+=p;if(w)for(;W<C.size;){var ie=W+x-C.size,fe=va([Bf(C,W,x-ie),xu([ie],D)]);Q.push(fe),W+=p}return Q.length===0?uc([],[0,x]):va(Q).as2D(Q.length,x)}}),dg=Bt({stft_:function(C,x,p,w,D){var W;D===void 0&&(D=u0),w==null&&(W=x,w=Math.floor(Math.pow(2,Math.ceil(Math.log(W)/Math.log(2)))));for(var Q=fg(C,x,p),ie=Ff(Q,D(x)),fe=[],ye=0;ye<Q.shape[0];ye++)fe.push(iv(ie.slice([ye,0],[1,x]),w));return va(fe)}}),av=Object.freeze({hannWindow:u0,hammingWindow:ov,frame:fg,stft:dg}),ky=function(C,x,p){return p===void 0&&(p=1),S(this,void 0,void 0,function(){var w,D,W,Q,ie,fe,ye,Oe,Re,Pe,je,Ge,rt,nt;return M(this,function(lt){switch(lt.label){case 0:return w=et(C,"predictions","inTopK"),D=et(x,"targets","inTopK"),Ee(w.rank>1,function(){return"inTopK() expects the predictions to be of rank 2 or higher, but got "+w.rank}),Ee(w.rank-1===D.rank,function(){return"predictions rank should be 1 larger than targets rank, but got predictions rank "+w.rank+" and targets rank "+D.rank}),Ot(w.shape.slice(0,w.shape.length-1),D.shape,"predictions's shape should be align with the targets' shape, except the last dimension."),W=w.shape[w.shape.length-1],Ee(p>0&&p<=W,function(){return"'k' passed to inTopK() must be > 0 && <= the predictions last dimension ("+W+"), but got "+p}),[4,w.data()];case 1:return Q=lt.sent(),[4,D.data()];case 2:for(ie=lt.sent(),fe=[Q.length/W,W],Oe=fe[1],Re=yn("bool",ye=fe[0]),Pe=0;Pe<ye;Pe++){for(je=Pe*Oe,Ge=Q.subarray(je,je+Oe),rt=[],nt=0;nt<Ge.length;nt++)rt.push({value:Ge[nt],index:nt});for(rt.sort(function(Nt,Rt){return Rt.value-Nt.value}),Re[Pe]=0,nt=0;nt<p;nt++)if(rt[nt].index===ie[Pe]){Re[Pe]=1;break}}return C!==w&&w.dispose(),x!==D&&D.dispose(),[2,Qo(Re,D.shape,"bool")]}})})};(function(C){C[C.NONE=0]="NONE",C[C.MEAN=1]="MEAN",C[C.SUM=2]="SUM",C[C.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(Ys||(Ys={}));var E1=Bt({absoluteDifference_:function(C,x,p,w){w===void 0&&(w=Ys.SUM_BY_NONZERO_WEIGHTS);var D=et(C,"labels","absoluteDifference"),W=et(x,"predictions","absoluteDifference"),Q=null;p!=null&&(Q=et(p,"weights","absoluteDifference")),Ot(D.shape,W.shape,"Error in absoluteDifference: ");var ie=D.sub(W).abs();return rf(ie,Q,w)}}),rf=Bt({computeWeightedLoss_:function(C,x,p){p===void 0&&(p=Ys.SUM_BY_NONZERO_WEIGHTS);var w=et(C,"losses","computeWeightedLoss"),D=null;x!=null&&(D=et(x,"weights","computeWeightedLoss"));var W=D==null?w:w.mul(D);if(p===Ys.NONE)return W;if(p===Ys.SUM)return W.sum();if(p===Ys.MEAN){if(D==null)return W.mean();var Q=w.size/D.size,ie=W.sum().div(D.sum());return Q>1?ie.div(Or(Q)):ie}if(p===Ys.SUM_BY_NONZERO_WEIGHTS){if(D==null)return W.sum().div(Or(w.size));var fe=D.mul(yc(w.shape)).notEqual(Or(0)).sum().toFloat();return W.sum().div(fe)}throw Error("Unknown reduction: "+p)}}),Ph=Bt({cosineDistance_:function(C,x,p,w,D){D===void 0&&(D=Ys.SUM_BY_NONZERO_WEIGHTS);var W=et(C,"labels","cosineDistance"),Q=et(x,"predictions","cosineDistance"),ie=null;w!=null&&(ie=et(w,"weights","cosineDistance")),Ot(W.shape,Q.shape,"Error in cosineDistance: ");var fe=Or(1).sub(W.mul(Q).sum(p,!0));return rf(fe,ie,D)}}),C1=Bt({hingeLoss_:function(C,x,p,w){w===void 0&&(w=Ys.SUM_BY_NONZERO_WEIGHTS);var D=et(C,"labels","hingeLoss"),W=et(x,"predictions","hingeLoss"),Q=null;p!=null&&(Q=et(p,"weights","hingeLoss")),Ot(D.shape,W.shape,"Error in hingeLoss: ");var ie=Or(1);D=Or(2).mul(D).sub(ie);var fe=ie.sub(D.mul(W)).relu();return rf(fe,Q,w)}}),Ey=Bt({huberLoss_:function(C,x,p,w,D){w===void 0&&(w=1),D===void 0&&(D=Ys.SUM_BY_NONZERO_WEIGHTS);var W=et(C,"labels","huberLoss"),Q=et(x,"predictions","huberLoss"),ie=null;p!=null&&(ie=et(p,"weights","huberLoss")),Ot(W.shape,Q.shape,"Error in huberLoss: ");var fe=Or(w),ye=Q.sub(W).abs(),Oe=Sd(ye,fe),Re=ye.sub(Oe),Pe=Or(.5).mul(Oe.square()).add(fe.mul(Re));return rf(Pe,ie,D)}}),of=Bt({logLoss_:function(C,x,p,w,D){w===void 0&&(w=1e-7),D===void 0&&(D=Ys.SUM_BY_NONZERO_WEIGHTS);var W=et(C,"labels","logLoss"),Q=et(x,"predictions","logLoss"),ie=null;p!=null&&(ie=et(p,"weights","logLoss")),Ot(W.shape,Q.shape,"Error in logLoss: ");var fe=Or(1),ye=Or(w),Oe=W.mul(Q.add(ye).log()).neg().sub(fe.sub(W).mul(fe.sub(Q).add(ye).log()));return rf(Oe,ie,D)}}),zs=Bt({meanSquaredError_:function(C,x,p,w){w===void 0&&(w=Ys.SUM_BY_NONZERO_WEIGHTS);var D=et(C,"labels","meanSquaredError"),W=et(x,"predictions","meanSquaredError"),Q=null;p!=null&&(Q=et(p,"weights","meanSquaredError")),Ot(D.shape,W.shape,"Error in meanSquaredError: ");var ie=D.squaredDifference(W);return rf(ie,Q,w)}}),Yp=Bt({sigmoidCrossEntropy_:function(C,x,p,w,D){w===void 0&&(w=0),D===void 0&&(D=Ys.SUM_BY_NONZERO_WEIGHTS);var W=et(C,"multiClassLabels","sigmoidCrossEntropy"),Q=et(x,"logits","sigmoidCrossEntropy"),ie=null;if(p!=null&&(ie=et(p,"weights","sigmoidCrossEntropy")),Ot(W.shape,Q.shape,"Error in sigmoidCrossEntropy: "),w>0){var fe=Or(w),ye=Or(1),Oe=Or(.5);W=W.mul(ye.sub(fe)).add(Oe.mul(fe))}var Re=function(Pe,je){var Ge=et(Pe,"labels","sigmoidCrossEntropyWithLogits"),rt=et(je,"logits","sigmoidCrossEntropyWithLogits");Ot(Ge.shape,rt.shape,"Error in sigmoidCrossEntropyWithLogits: ");var nt=rt.relu(),lt=rt.mul(Ge),Nt=rt.abs().neg().exp().log1p();return nt.sub(lt).add(Nt)}(W,Q);return rf(Re,ie,D)}}),hg=Bt({softmaxCrossEntropy_:function(C,x,p,w,D){w===void 0&&(w=0),D===void 0&&(D=Ys.SUM_BY_NONZERO_WEIGHTS);var W=et(C,"onehotLabels","softmaxCrossEntropy"),Q=et(x,"logits","softmaxCrossEntropy"),ie=null;if(p!=null&&(ie=et(p,"weights","softmaxCrossEntropy")),Ot(W.shape,Q.shape,"Error in softmaxCrossEntropy: "),w>0){var fe=Or(w),ye=Or(1),Oe=Or(W.shape[1]);W=W.mul(ye.sub(fe)).add(fe.div(Oe))}var Re=function(Pe,je,Ge){if(Ge===void 0&&(Ge=-1),Ge===-1&&(Ge=je.rank-1),Ge!==je.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+je.rank+" and dim was "+Ge);return Hu(function(rt,nt,lt){var Nt=nt.logSumExp([Ge],!0),Rt=nt.toFloat().sub(Nt);return lt([rt,Rt]),{value:Rt.mul(rt).neg().sum([Ge]),gradFunc:function(Pt,Kt){var dn=Kt[0],bn=Kt[1],pn=ia(Pt.shape,[Ge]);return[Pt.reshape(pn).mul(dn.toFloat().sub(bn.exp())),Pt.reshape(pn).mul(bn.exp().sub(dn.toFloat()))]}}})(Pe,je)}(W,Q);return rf(Re,ie,D)}}),c0=Object.freeze({get Reduction(){return Ys},absoluteDifference:E1,computeWeightedLoss:rf,cosineDistance:Ph,hingeLoss:C1,huberLoss:Ey,logLoss:of,meanSquaredError:zs,sigmoidCrossEntropy:Yp,softmaxCrossEntropy:hg});function Cy(C,x){return x===void 0&&(x=!1),qe.tidy(function(){if(C.shape.length!==2)throw new Error("qr2d() requires a 2D Tensor, but got a "+C.shape.length+"D Tensor.");for(var p=C.shape[0],w=C.shape[1],D=Op(p),W=C.clone(),Q=uc([[1]],[1,1]),ie=Q.clone(),fe=p>=w?w:p,ye=function(Re){var Pe,je=W,Ge=ie,rt=D;Pe=qe.tidy(function(){var nt=W.slice([Re,Re],[p-Re,1]),lt=nt.norm(),Nt=W.slice([Re,Re],[1,1]),Rt=uc([[-1]]).where(Nt.greater(0),uc([[1]])),Pt=Nt.sub(Rt.mul(lt)),Kt=nt.div(Pt);ie=Kt.shape[0]===1?Q.clone():Q.concat(Kt.slice([1,0],[Kt.shape[0]-1,Kt.shape[1]]),0);var dn=Rt.matMul(Pt).div(lt).neg(),bn=W.slice([Re,0],[p-Re,w]),pn=dn.mul(ie);if(Re===0)W=bn.sub(pn.matMul(ie.transpose().matMul(bn)));else{var _n=bn.sub(pn.matMul(ie.transpose().matMul(bn)));W=W.slice([0,0],[Re,w]).concat(_n,0)}var On=D.slice([0,Re],[p,D.shape[1]-Re]);if(Re===0)D=On.sub(On.matMul(ie).matMul(pn.transpose()));else{var _=On.sub(On.matMul(ie).matMul(pn.transpose()));D=D.slice([0,0],[p,Re]).concat(_,1)}return[ie,W,D]}),ie=Pe[0],W=Pe[1],D=Pe[2],ca([je,Ge,rt])},Oe=0;Oe<fe;++Oe)ye(Oe);return!x&&p>w&&(D=D.slice([0,0],[p,w]),W=W.slice([0,0],[w,w])),[D,W]})}var l0=Bt({bandPart_:function(C,x,p){if(x%1!=0)throw new Error("bandPart(): numLower must be an integer, got "+x+".");if(p%1!=0)throw new Error("bandPart(): numUpper must be an integer, got "+p+".");var w=et(C,"a","bandPart");if(w.rank<2)throw new Error("bandPart(): Rank must be at least 2, got "+w.rank+".");var D=w.shape,W=w.shape.slice(-2),Q=W[0],ie=W[1];if(!(x<=Q))throw new Error("bandPart(): numLower ("+x+") must not be greater than the number of rows ("+Q+").");if(!(p<=ie))throw new Error("bandPart(): numUpper ("+p+") must not be greater than the number of columns ("+ie+").");x<0&&(x=Q),p<0&&(p=ie);var fe=kl(0,Q,1,"int32").reshape([-1,1]),ye=kl(0,ie,1,"int32"),Oe=tf(fe,ye),Re=Ch(Oe.lessEqual(Or(+x,"int32")),Oe.greaterEqual(Or(-p,"int32"))),Pe=go([Q,ie],w.dtype);return no(xs(w.reshape([-1,Q,ie])).map(function(je){return Ao(Re,je,Pe)})).reshape(D)}}),Id=Bt({gramSchmidt_:function(C){var x;if(Array.isArray(C)){x=!1,Ee(C!=null&&C.length>0,function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"});for(var p=C[0].shape[0],w=function(fe){Ee(C[fe].shape[0]===p,function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+C[fe].shape[0]+" vs. "+p+")"})},D=1;D<C.length;++D)w(D)}else x=!0,C=to(C,C.shape[0],0).map(function(fe){return bs(fe,[0])});Ee(C.length<=C[0].shape[0],function(){return"Gram-Schmidt: Number of vectors ("+C.length+") exceeds number of dimensions ("+C[0].shape[0]+")."});var W=[],Q=C,ie=function(fe){W.push(qe.tidy(function(){var ye=Q[fe];if(fe>0)for(var Oe=0;Oe<fe;++Oe){var Re=vy(W[Oe].mulStrict(ye)).mul(W[Oe]);ye=ye.sub(Re)}return ye.div(Kp(ye,"euclidean"))}))};for(D=0;D<C.length;++D)ie(D);return x?no(W,0):W}}),Mb=Bt({qr_:function(C,x){if(x===void 0&&(x=!1),C.rank<2)throw new Error("qr() requires input tensor to have a rank >= 2, but got rank "+C.rank);if(C.rank===2)return Cy(C,x);var p=C.shape.slice(0,C.shape.length-2).reduce(function(W,Q){return W*Q}),w=[],D=[];return xs(C.reshape([p,C.shape[C.shape.length-2],C.shape[C.shape.length-1]]),0).forEach(function(W){var Q=Cy(W,x),ie=Q[0],fe=Q[1];w.push(ie),D.push(fe)}),[no(w,0).reshape(C.shape),no(D,0).reshape(C.shape)]}}),f0=Object.freeze({bandPart:l0,gramSchmidt:Id,qr:Mb});function Ds(C,x,p,w,D,W){w==null&&(w=.5),D==null&&(D=Number.NEGATIVE_INFINITY),W==null&&(W=0);var Q=C.shape[0];return p=Math.min(p,Q),Ee(0<=w&&w<=1,function(){return"iouThreshold must be in [0, 1], but was '"+w+"'"}),Ee(C.rank===2,function(){return"boxes must be a 2D tensor, but was of rank '"+C.rank+"'"}),Ee(C.shape[1]===4,function(){return"boxes must have 4 columns, but 2nd dimension was "+C.shape[1]}),Ee(x.rank===1,function(){return"scores must be a 1D tensor"}),Ee(x.shape[0]===Q,function(){return"scores has incompatible shape with boxes. Expected "+Q+", but was "+x.shape[0]}),Ee(0<=W&&W<=1,function(){return"softNmsSigma must be in [0, 1], but was '"+W+"'"}),{maxOutputSize:p,iouThreshold:w,scoreThreshold:D,softNmsSigma:W}}var pg=Bt({resizeBilinear_:function(C,x,p){p===void 0&&(p=!1);var w=et(C,"images","resizeBilinear");Ee(w.rank===3||w.rank===4,function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+w.rank+"."}),Ee(x.length===2,function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+x+"."});var D=w,W=!1;w.rank===3&&(W=!0,D=w.as4D(1,w.shape[0],w.shape[1],w.shape[2]));var Q=x[0],ie=x[1],fe=qe.runKernelFunc(function(ye,Oe){return Oe([D]),ye.resizeBilinear(D,Q,ie,p)},{x:D},function(ye,Oe){return{x:function(){return qe.runKernelFunc(function(Re){return Re.resizeBilinearBackprop(ye,Oe[0],p)},{})}}},"ResizeBilinear",{alignCorners:p,newHeight:Q,newWidth:ie});return W?fe.as3D(fe.shape[1],fe.shape[2],fe.shape[3]):fe}}),jh=Bt({resizeNearestNeighbor_:function(C,x,p){p===void 0&&(p=!1);var w=et(C,"images","resizeNearestNeighbor");Ee(w.rank===3||w.rank===4,function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+w.rank+"."}),Ee(x.length===2,function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+x+"."}),Ee(w.dtype==="float32"||w.dtype==="int32",function(){return"`images` must have `int32` or `float32` as dtype"});var D=w,W=!1;w.rank===3&&(W=!0,D=w.as4D(1,w.shape[0],w.shape[1],w.shape[2]));var Q=x[0],ie=x[1],fe=qe.runKernelFunc(function(ye,Oe){return Oe([D]),ye.resizeNearestNeighbor(D,Q,ie,p)},{batchImages:D},function(ye,Oe){return{batchImages:function(){return qe.runKernelFunc(function(Re){return Re.resizeNearestNeighborBackprop(ye,Oe[0],p)},{})}}});return W?fe.as3D(fe.shape[1],fe.shape[2],fe.shape[3]):fe}}),d0=Bt({nonMaxSuppression_:function(C,x,p,w,D){w===void 0&&(w=.5),D===void 0&&(D=Number.NEGATIVE_INFINITY);var W=et(C,"boxes","nonMaxSuppression"),Q=et(x,"scores","nonMaxSuppression"),ie=Ds(W,Q,p,w,D);p=ie.maxOutputSize,w=ie.iouThreshold,D=ie.scoreThreshold;var fe={maxOutputSize:p,iouThreshold:w,scoreThreshold:D};return qe.runKernelFunc(function(ye){return ye.nonMaxSuppression(W,Q,p,w,D)},{boxes:W,scores:Q},null,"NonMaxSuppressionV3",fe)}}),mg=Bt({nonMaxSuppressionWithScore_:function(C,x,p,w,D,W){w===void 0&&(w=.5),D===void 0&&(D=Number.NEGATIVE_INFINITY),W===void 0&&(W=0);var Q=et(C,"boxes","nonMaxSuppression"),ie=et(x,"scores","nonMaxSuppression"),fe=Ds(Q,ie,p,w,D,W),ye={maxOutputSize:p=fe.maxOutputSize,iouThreshold:w=fe.iouThreshold,scoreThreshold:D=fe.scoreThreshold,softNmsSigma:W=fe.softNmsSigma},Oe=qe.runKernel("NonMaxSuppressionV5",{boxes:Q,scores:ie},ye);return{selectedIndices:Oe[0],selectedScores:Oe[1]}}}),sv=Bt({cropAndResize_:function(C,x,p,w,D,W){var Q=et(C,"image","cropAndResize"),ie=et(x,"boxes","cropAndResize","float32"),fe=et(p,"boxInd","cropAndResize","int32");D=D||"bilinear",W=W||0;var ye=ie.shape[0];return Ee(Q.rank===4,function(){return"Error in cropAndResize: image must be rank 4,but got rank "+Q.rank+"."}),Ee(ie.rank===2&&ie.shape[1]===4,function(){return"Error in cropAndResize: boxes must be have size ["+ye+",4] but had shape "+ie.shape+"."}),Ee(fe.rank===1&&fe.shape[0]===ye,function(){return"Error in cropAndResize: boxInd must be have size ["+ye+"] but had shape "+ie.shape+"."}),Ee(w.length===2,function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+w.length+"."}),Ee(w[0]>=1&&w[1]>=1,function(){return"cropSize must be atleast [1,1], but was "+w}),Ee(D==="bilinear"||D==="nearest",function(){return"method must be bilinear or nearest, but was "+D}),qe.runKernelFunc(function(Oe,Re){return Oe.cropAndResize(Q,ie,fe,w,D,W)},{images:Q,boxes:ie,boxInd:fe},null,"CropAndResize",{method:D,extrapolationValue:W,cropSize:w})}}),uv=Object.freeze({resizeBilinear:pg,resizeNearestNeighbor:jh,nonMaxSuppression:d0,nonMaxSuppressionAsync:function(C,x,p,w,D){return w===void 0&&(w=.5),D===void 0&&(D=Number.NEGATIVE_INFINITY),S(this,void 0,void 0,function(){var W,Q,ie,fe,ye,Oe,Re;return M(this,function(Pe){switch(Pe.label){case 0:return W=et(C,"boxes","nonMaxSuppressionAsync"),Q=et(x,"scores","nonMaxSuppressionAsync"),ie=Ds(W,Q,p,w,D),p=ie.maxOutputSize,w=ie.iouThreshold,D=ie.scoreThreshold,[4,Promise.all([W.data(),Q.data()])];case 1:return fe=Pe.sent(),ye=fe[0],Oe=fe[1],Re=Bc(ye,Oe,p,w,D),W!==C&&W.dispose(),Q!==x&&Q.dispose(),[2,Re]}})})},nonMaxSuppressionWithScore:mg,nonMaxSuppressionWithScoreAsync:function(C,x,p,w,D,W){return w===void 0&&(w=.5),D===void 0&&(D=Number.NEGATIVE_INFINITY),W===void 0&&(W=0),S(this,void 0,void 0,function(){var Q,ie,fe,ye,Oe,Re,Pe;return M(this,function(je){switch(je.label){case 0:return Q=et(C,"boxes","nonMaxSuppressionAsync"),ie=et(x,"scores","nonMaxSuppressionAsync"),fe=Ds(Q,ie,p,w,D,W),p=fe.maxOutputSize,w=fe.iouThreshold,D=fe.scoreThreshold,W=fe.softNmsSigma,[4,Promise.all([Q.data(),ie.data()])];case 1:return ye=je.sent(),Oe=ye[0],Re=ye[1],Pe=Pc(Oe,Re,p,w,D,W),Q!==C&&Q.dispose(),ie!==x&&ie.dispose(),[2,Pe]}})})},cropAndResize:sv}),Md=function(C,x){return!(C>0)||x==="linear"},al=function(C,x,p){if(p==null||p==="linear")return C;if(p==="relu")return C.mul(x.step());throw new Error("Gradient for activation "+p+" has not been implemented yet.")},Sy=function(C,x){var p=x,w=as(C.shape,x.shape);return w.length>0&&(p=p.sum(w)),p.reshape(C.shape)},Ay=function(C,x,p){if(x==="linear")return C;if(x==="relu")return r0(C);if(x==="elu")return Il(C);if(x==="relu6")return rv(C);if(x==="prelu")return sg(C,p);throw new Error("Unknown fused activation "+x+".")},Xp=Bt({fusedMatMul_:function(C){var x,p=C.a,w=C.b,D=C.transposeA,W=D!==void 0&&D,Q=C.transposeB,ie=Q!==void 0&&Q,fe=C.bias,ye=C.activation,Oe=ye===void 0?"linear":ye,Re=C.preluActivationWeights;if(Md(qe.state.gradientDepth,Oe)===!1){var Pe=sy(p,w,W,ie);return fe!=null&&(Pe=zp(Pe,fe)),Ay(Pe,Oe,Re)}var je=et(p,"a","fused matMul"),Ge=et(w,"b","fused matMul");x=Bn(je,Ge),je=x[0],Ge=x[1];var rt=W?je.shape[je.rank-2]:je.shape[je.rank-1],nt=ie?Ge.shape[Ge.rank-1]:Ge.shape[Ge.rank-2],lt=W?je.shape[je.rank-1]:je.shape[je.rank-2],Nt=ie?Ge.shape[Ge.rank-2]:Ge.shape[Ge.rank-1],Rt=je.shape.slice(0,-2),Pt=Ge.shape.slice(0,-2),Kt=Ke(Rt),dn=Ke(Pt);Ee(je.rank>=2&&Ge.rank>=2&&je.rank===Ge.rank,function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+je.rank+" and "+Ge.rank+"."}),Ee(Tt(Rt,Pt),function(){return"Error in fused matMul: outer dimensions ("+Rt+") and ("+Pt+") of Tensors with shapes "+je.shape+" and "+Ge.shape+" must match."}),Ee(rt===nt,function(){return"Error in fused matMul: inner shapes ("+rt+") and ("+nt+") of Tensors with shapes "+je.shape+" and "+Ge.shape+" and transposeA="+W+" and transposeB="+ie+" must match."});var bn,pn,_n=je.shape.slice(0,-2).concat([lt,Nt]),On=W?je.as3D(Kt,rt,lt):je.as3D(Kt,lt,rt),_=ie?Ge.as3D(dn,Nt,nt):Ge.as3D(dn,nt,Nt);fe!=null&&ho(_n,(bn=Bn(bn=et(fe,"bias","fused matMul"),je)[0]).shape),Re!=null&&(pn=et(Re,"prelu weights","fused matMul"));var m={a:On,b:_};fe!=null&&(m.bias=bn),Re!=null&&(m.preluActivationWeights=pn);var f=[On,_];return qe.runKernelFunc(function(y,E){var z=y.fusedBatchMatMul({a:On,b:_,transposeA:W,transposeB:ie,bias:bn,activation:Oe,preluActivationWeights:pn});return E([On,_,z]),z},m,function(y,E){var z=E[0],Y=E[1],Z=E[2],le=al(y,Z,Oe),de={};return fe!=null&&(de={bias:function(){return Sy(bn,le)}}),Object.assign(W||ie?!W&&ie?{a:function(){return le.matMul(Y,!1,!1)},b:function(){return le.matMul(z,!0,!1)}}:W&&!ie?{a:function(){return Y.matMul(le,!1,!0)},b:function(){return z.matMul(le,!1,!1)}}:{a:function(){return Y.matMul(le,!0,!0)},b:function(){return le.matMul(z,!0,!0)}}:{a:function(){return le.matMul(Y,!1,!0)},b:function(){return z.matMul(le,!0,!1)}},de)},"_FusedMatMul",{transposeA:W,transposeB:ie,activation:Oe},f,[!0]).reshape(_n)}}),gg=Bt({fusedConv2d_:function(C){var x=C.x,p=C.filter,w=C.strides,D=C.pad,W=C.dataFormat,Q=W===void 0?"NHWC":W,ie=C.dilations,fe=ie===void 0?[1,1]:ie,ye=C.dimRoundingMode,Oe=C.bias,Re=C.activation,Pe=Re===void 0?"linear":Re,je=C.preluActivationWeights;if(Pe=Pe||"linear",Md(qe.state.gradientDepth,Pe)===!1){var Ge=$p(x,p,w,D,Q,fe,ye);return Oe!=null&&(Ge=zp(Ge,Oe)),Ay(Ge,Pe,je)}var rt=et(x,"x","conv2d"),nt=et(p,"filter","conv2d"),lt=rt,Nt=!1;rt.rank===3&&(Nt=!0,lt=rt.as4D(1,rt.shape[0],rt.shape[1],rt.shape[2])),Ee(lt.rank===4,function(){return"Error in fused conv2d: input must be rank 4, but got rank "+lt.rank+"."}),Ee(nt.rank===4,function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+nt.rank+"."}),ye!=null&&Ee(vt(D),function(){return"Error in fused conv2d: pad must be an integer when using, dimRoundingMode "+ye+" but got pad "+D+"."}),Ee(lt.shape[3]===nt.shape[2],function(){return"Error in conv2d: depth of input ("+lt.shape[3]+") must match input depth for filter "+nt.shape[2]+"."}),Ee(nu(w,fe),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+w+" and dilations '"+fe+"'"}),Ee(Q==="NHWC",function(){return"Error in conv2d: got dataFormat of "+Q+" but only NHWC is currently supported."});var Rt,Pt,Kt=qu(lt.shape,nt.shape,w,fe,D,ye);Oe!=null&&(Rt=Bn(Rt=et(Oe,"bias","fused conv2d"),rt)[0],ho(Kt.outShape,Rt.shape)),je!=null&&(Pt=et(je,"prelu weights","fused conv2d"));var dn={x:lt,filter:nt};Oe!=null&&(dn.bias=Rt),je!=null&&(dn.preluActivationWeights=Pt);var bn=[nt,lt],pn=qe.runKernelFunc(function(_n,On){var _=_n.fusedConv2d({input:lt,filter:nt,convInfo:Kt,bias:Rt,activation:Pe,preluActivationWeights:Pt});return On([nt,lt,_]),_},dn,function(_n,On){var _=On,m=_[0],f=_[1],y=_[2],E=al(_n,y,Pe);Ee(ps(fe),function(){return"Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+fe+"'"});var z={};return Oe!=null&&(z={bias:function(){return Sy(Rt,E)}}),Object.assign({x:function(){return J0(f.shape,E,m,w,D)},filter:function(){return X0(f,E,m.shape,w,D)}},z)},"FusedConv2D",{convInfo:Kt,activation:Pe},bn,[!0]);return Nt?pn.as3D(pn.shape[1],pn.shape[2],pn.shape[3]):pn}}),S1=Bt({fusedDepthwiseConv2d_:function(C){var x=C.x,p=C.filter,w=C.strides,D=C.pad,W=C.dataFormat,Q=W===void 0?"NHWC":W,ie=C.dilations,fe=ie===void 0?[1,1]:ie,ye=C.dimRoundingMode,Oe=C.bias,Re=C.activation,Pe=Re===void 0?"linear":Re,je=C.preluActivationWeights;if(Md(qe.state.gradientDepth,Pe)===!1){var Ge=ig(x,p,w,D,Q,fe,ye);return Oe!=null&&(Ge=zp(Ge,Oe)),Ay(Ge,Pe,je)}var rt=et(x,"x","depthwiseConv2d"),nt=et(p,"filter","depthwiseConv2d"),lt=rt,Nt=!1;rt.rank===3&&(Nt=!0,lt=rt.as4D(1,rt.shape[0],rt.shape[1],rt.shape[2])),Ee(lt.rank===4,function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got rank "+lt.rank+"."}),Ee(nt.rank===4,function(){return"Error in fused depthwiseConv2d: filter must be rank 4, but got rank "+nt.rank+"."}),Ee(lt.shape[3]===nt.shape[2],function(){return"Error in fused depthwiseConv2d: number of input channels ("+lt.shape[3]+") must match the inChannels dimension in filter "+nt.shape[2]+"."}),fe==null&&(fe=[1,1]),Ee(nu(w,fe),function(){return"Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides "+w+" and dilations '"+fe+"'"}),ye!=null&&Ee(vt(D),function(){return"Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode "+ye+" but got pad "+D+"."});var Rt,Pt,Kt=qu(lt.shape,nt.shape,w,fe,D,ye,!0);Oe!=null&&(Rt=Bn(Rt=et(Oe,"bias","fused conv2d"),rt)[0],ho(Kt.outShape,Rt.shape)),je!=null&&(Pt=et(je,"prelu weights","fused depthwiseConv2d"));var dn={x:lt,filter:nt};Oe!=null&&(dn.bias=Rt),je!=null&&(dn.preluActivationWeights=Pt);var bn=[nt,lt],pn=qe.runKernelFunc(function(_n,On){var _=_n.fusedDepthwiseConv2D({input:lt,filter:nt,convInfo:Kt,bias:Rt,activation:Pe,preluActivationWeights:Pt});return On([nt,lt,_]),_},dn,function(_n,On){Ee(ps(fe),function(){return"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+fe+"'"});var _=On[0],m=On[1],f=On[2],y=al(_n,f,Pe),E={};return Oe!=null&&(E={bias:function(){return Sy(Rt,y)}}),Object.assign({x:function(){return Q0(m.shape,y,_,Kt)},filter:function(){return e0(m,y,_.shape,Kt)}},E)},"FusedDepthwiseConv2D",{convInfo:Kt,activation:Pe},bn,[!0]);return Nt?pn.as3D(pn.shape[1],pn.shape[2],pn.shape[3]):pn}}),cv=Object.freeze({matMul:Xp,conv2d:gg,depthwiseConv2d:S1}),h0=Object.freeze({image:uv,linalg:f0,losses:c0,spectral:s0,fused:cv,signal:av,square:U0,squaredDifference:_h,conv1d:Qg,conv2d:$p,conv3d:Zg,depthwiseConv2d:ig,separableConv2d:ay,conv2dTranspose:Rf,conv3dTranspose:w1,op:Bt,batchNormalization2d:ry,batchNormalization3d:Zm,batchNormalization4d:q0,batchNormalization:Ib,batchNorm:y1,batchNorm2d:_d,batchNorm3d:Lp,batchNorm4d:Eh,booleanMaskAsync:Xg,complex:zo,real:qa,imag:Os,concat:va,concat1d:Ep,concat2d:Rm,concat3d:od,concat4d:Cp,split:to,matMul:sy,dot:og,outerProduct:uy,reverse:Od,reverse1d:cy,reverse2d:ag,reverse3d:t0,reverse4d:ly,maxPool:dy,avgPool:hy,pool:Mh,maxPool3d:_1,avgPool3d:py,slice:Bf,slice1d:ev,slice2d:my,slice3d:Fh,slice4d:Pf,abs:Ql,acos:W0,acosh:V0,asin:Lc,asinh:$0,atan:Bp,atanh:Ym,ceil:v1,clipByValue:Xm,cos:Zl,cosh:Jm,erf:Yv,exp:Xv,expm1:H0,floor:Db,log:Tb,log1p:Fo,logSigmoid:Jv,neg:Qv,reciprocal:Wg,round:Zv,rsqrt:Qm,sigmoid:Tf,sign:Nf,isNaN:ey,isInf:ty,isFinite:Pp,sin:kh,sinh:jp,softplus:Nb,sqrt:Vg,step:If,tan:zc,tanh:bd,all:tv,any:Nl,argMax:nv,argMin:gy,logSumExp:Dd,max:k1,mean:Hp,min:qp,moments:Td,sum:vy,prod:Rh,equal:Dl,equalStrict:Vc,greater:bc,greaterEqual:Vp,greaterEqualStrict:Gg,greaterStrict:K0,less:Y0,lessEqual:tg,lessEqualStrict:da,lessStrict:ng,notEqual:Tl,notEqualStrict:Nh,add:zp,addN:b1,addStrict:x1,atan2:Hg,div:Ed,divNoNan:Mf,divStrict:eg,floorDiv:Up,maximum:Ah,maximumStrict:Cd,minimum:Sd,minimumStrict:Wc,mod:Wp,modStrict:Oh,mul:Ff,mulStrict:ef,pow:Dh,powStrict:qg,squaredDifferenceStrict:Th,sub:tf,subStrict:Gs,elu:Il,leakyRelu:Gp,prelu:sg,relu:r0,relu6:rv,selu:yy,logicalAnd:Ch,logicalNot:iy,logicalOr:G0,logicalXor:Sh,where:Ao,whereAsync:kd,buffer:Qi,print:ch,batchToSpaceND:wf,broadcastTo:ad,cast:Lm,clone:zg,cumsum:sd,depthToSpace:Ap,expandDims:ya,eye:Op,multinomial:ud,oneHot:Dp,pad:cd,pad1d:_f,pad2d:ql,pad3d:Tp,pad4d:lh,rand:ld,randomNormal:Gl,randomGamma:F0,randomUniform:fd,reshape:Pa,spaceToBatchND:hs,squeeze:bs,stack:no,tile:_u,truncatedNormal:Kl,unstack:xs,setdiff1dAsync:Yl,fill:xu,linspace:kp,ones:yc,range:kl,scalar:Or,tensor:Qo,tensor1d:Vu,tensor2d:uc,tensor3d:bf,tensor4d:$u,tensor5d:_p,tensor6d:Mm,variable:Fm,zeros:go,onesLike:eu,zerosLike:Ei,transpose:Ks,softmax:Eu,logSoftmax:Oo,localResponseNormalization:by,norm:Kp,gather:Kg,unsortedSegmentSum:Yg,basicLSTMCell:xy,multiRNNCell:i0,movingAverage:Nd,stridedSlice:ug,topk:jf,scatterND:wy,fft:o0,ifft:a0,rfft:iv,irfft:nf,sparseToDense:_y,gatherND:Lf,diag:cg,dropout:Bh,hannWindow:u0,hammingWindow:ov,frame:fg,stft:dg,inTopKAsync:ky});function Gr(C,x){Array.isArray(C)||(C=[C]),C.forEach(function(p){p!=null&&Ee(p.dtype!=="complex64",function(){return x+" does not support complex64 tensors."})})}function q(C,x,p,w){if(p==="linear")return C.linear(x);if(p==="relu")return C.relu(x);if(p==="elu")return C.elu(x);if(p==="relu6")return C.relu6(x);if(p==="prelu")return C.prelu(x,w);throw new Error("Activation "+p+" has not been implemented for the CPU backend.")}var R=function(C){function x(){var p=C.call(this)||this;return p.blockSize=48,p.firstUse=!0,p.data=new gd(p,qe),p}return A(x,C),x.prototype.write=function(p,w,D){this.firstUse&&(this.firstUse=!1,L().get("IS_NODE")&&yf(` 7605============================ 7606Hi there ð. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details. 7607============================`));var W={};return this.data.set(W,{values:p,dtype:D}),W},x.prototype.move=function(p,w,D,W){this.data.set(p,{values:w,dtype:W})},x.prototype.numDataIds=function(){return this.data.numDataIds()},x.prototype.read=function(p){return S(this,void 0,void 0,function(){return M(this,function(w){return[2,this.readSync(p)]})})},x.prototype.readSync=function(p){var w=this.data.get(p),D=w.dtype,W=w.complexTensors;return D==="complex64"?Rc(this.readSync(W.real.dataId),this.readSync(W.imag.dataId)):this.data.get(p).values},x.prototype.bufferSync=function(p){var w=this.readSync(p.dataId),D=w;if(p.dtype==="string")try{D=w.map(function(W){return Ar(W)})}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return Qi(p.shape,p.dtype,D)},x.prototype.makeOutput=function(p,w,D){var W=this.write(p,w,D);return qe.makeTensorFromDataId(W,w,D,this)},x.prototype.disposeData=function(p){if(this.data.has(p)){var w=this.data.get(p).complexTensors;w!=null&&(w.real.dispose(),w.imag.dispose()),this.data.delete(p)}},x.prototype.time=function(p){return S(this,void 0,void 0,function(){var w;return M(this,function(D){return w=fn(),p(),[2,{kernelMs:fn()-w}]})})},x.prototype.memory=function(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}},x.prototype.complex=function(p,w){var D=this.makeOutput(null,p.shape,"complex64");return this.data.get(D.dataId).complexTensors={real:qe.keep(p.clone()),imag:qe.keep(w.clone())},D},x.prototype.real=function(p){return this.data.get(p.dataId).complexTensors.real.clone()},x.prototype.imag=function(p){return this.data.get(p.dataId).complexTensors.imag.clone()},x.prototype.slice=function(p,w,D){if(Gr(p,"slice"),ph(p.shape,w,D)){var W=Ip(w,p.strides),Q=Ke(D);return Qo(this.readSync(p.dataId).subarray(W,W+Q),D,p.dtype)}for(var ie=Qi(D,p.dtype),fe=this.bufferSync(p),ye=0;ye<ie.size;++ye){var Oe=ie.indexToLoc(ye).map(function(Re,Pe){return Re+w[Pe]});ie.values[ye]=fe.get.apply(fe,Oe)}return ie.toTensor()},x.prototype.stridedSlice=function(p,w,D,W){Gr(p,"stridedSlice");var Q=hd(w,D,W);if(Q.some(function(je){return je===0}))return Qo([],Q);for(var ie=Qi(Q,p.dtype),fe=this.bufferSync(p),ye=0;ye<ie.size;ye++){for(var Oe=ie.indexToLoc(ye),Re=new Array(Oe.length),Pe=0;Pe<Re.length;Pe++)Re[Pe]=Oe[Pe]*W[Pe]+w[Pe];ie.set.apply(ie,[fe.get.apply(fe,Re)].concat(Oe))}return ie.toTensor()},x.prototype.diag=function(p){for(var w=this.readSync(p.dataId),D=Qi([p.size,p.size],p.dtype),W=D.values,Q=0;Q<w.length;Q++)W[Q*p.size+Q]=w[Q];return D.toTensor()},x.prototype.unstack=function(p,w){for(var D=p.shape[w],W=new Array(p.rank-1),Q=0,ie=0;ie<p.rank;ie++)ie!==w&&(W[Q++]=p.shape[ie]);var fe=new Array(p.rank).fill(0),ye=p.shape.slice();ye[w]=1;var Oe=new Array(D);for(ie=0;ie<Oe.length;ie++)fe[w]=ie,Oe[ie]=this.slice(p,fe,ye).reshape(W);return Oe},x.prototype.reverse=function(p,w){Gr(p,"reverse");for(var D=Qi(p.shape,p.dtype),W=this.bufferSync(p),Q=function(fe){var ye=D.indexToLoc(fe),Oe=ye.slice();w.forEach(function(Re){return Oe[Re]=p.shape[Re]-1-Oe[Re]}),D.set.apply(D,[W.get.apply(W,Oe)].concat(ye))},ie=0;ie<D.size;ie++)Q(ie);return D.toTensor()},x.prototype.concat=function(p,w){var D=this;if(p[0].dtype==="complex64"){var W=p.map(function(je){return qa(je)}),Q=p.map(function(je){return Os(je)});return zo(this.concat(W,w),this.concat(Q,w))}var ie=p.map(function(je){var Ge=Ke(je.shape.slice(w));return je.as2D(-1,Ge)}),fe=sc(ie.map(function(je){return je.shape}),1),ye=Qi(fe,p[0].dtype).values;if(ie[0].shape[0]===1){var Oe=0;ie.forEach(function(je){ye.set(D.readSync(je.dataId),Oe),Oe+=je.size})}else{var Re=0;ie.forEach(function(je){for(var Ge=D.readSync(je.dataId),rt=0,nt=0;nt<je.shape[0];++nt)for(var lt=nt*fe[1]+Re,Nt=0;Nt<je.shape[1];++Nt)ye[lt+Nt]=Ge[rt++];Re+=je.shape[1]})}var Pe=sc(p.map(function(je){return je.shape}),w);return Qo(ye,Pe,p[0].dtype)},x.prototype.neg=function(p){return Gr(p,"neg"),this.multiply(Or(-1),p)},x.prototype.add=function(p,w){return p.dtype==="complex64"||w.dtype==="complex64"?this.broadcastedBinaryComplexOp(p.cast("complex64"),w.cast("complex64"),function(D,W,Q,ie){return{real:D+Q,imag:W+ie}}):this.broadcastedBinaryOp(p,w,kn(p.dtype,w.dtype),function(D,W){return D+W})},x.prototype.addN=function(p){var w=this;Gr(p,"addN");for(var D=p.map(function(Oe){return w.readSync(Oe.dataId)}),W=Qi(p[0].shape,p[0].dtype),Q=W.values,ie=0;ie<p.length;ie++)for(var fe=D[ie],ye=0;ye<Q.length;ye++)Q[ye]+=fe[ye];return W.toTensor()},x.prototype.softmax=function(p,w){var D=Vt([w],p.shape),W=this.max(p,D),Q=ia(W.shape,D),ie=this.subtract(p,W.reshape(Q)),fe=this.exp(ie),ye=this.sum(fe,D).reshape(Q);return this.realDivide(fe,ye)},x.prototype.subtract=function(p,w){return p.dtype==="complex64"||w.dtype==="complex64"?this.broadcastedBinaryComplexOp(p.cast("complex64"),w.cast("complex64"),function(D,W,Q,ie){return{real:D-Q,imag:W-ie}}):this.broadcastedBinaryOp(p,w,kn(p.dtype,w.dtype),function(D,W){return D-W})},x.prototype.pow=function(p,w){return Gr([p,w],"pow"),this.broadcastedBinaryOp(p,w,p.dtype,function(D,W){return Math.pow(D,W)})},x.prototype.batchMatMul=function(p,w,D,W){Gr([p,w],"matMul");for(var Q=D?p.shape[1]:p.shape[2],ie=D?p.shape[2]:p.shape[1],fe=W?w.shape[1]:w.shape[2],ye=p.shape[0],Oe=this.readSync(p.dataId),Re=this.readSync(w.dataId),Pe=D?[p.strides[0],1,p.strides[1]]:[p.strides[0],p.strides[1],1],je=Pe[0],Ge=Pe[1],rt=Pe[2],nt=W?[1,w.strides[1],w.strides[0]]:[w.strides[1],1,w.strides[0]],lt=nt[0],Nt=nt[1],Rt=nt[2],Pt=ie*fe,Kt=Qi([ye,ie,fe],p.dtype),dn=Kt.values,bn=this.blockSize,pn=0;pn<ye;pn++)for(var _n=0;_n<ie;_n+=bn)for(var On=0;On<fe;On+=bn)for(var _=0;_<Q;_+=bn)for(var m=Math.min(_n+bn,ie),f=Math.min(On+bn,fe),y=Math.min(_+bn,Q),E=_n;E<m;E++)for(var z=On;z<f;z++){for(var Y=0,Z=_;Z<y;Z++)Y+=Oe[pn*je+E*Ge+Z*rt]*Re[Z*lt+z*Nt+pn*Rt];dn[pn*Pt+(E*fe+z)]+=Y}return Kt.toTensor()},x.prototype.fusedBatchMatMul=function(p){var w=p.a,D=p.b,W=p.transposeA,Q=p.transposeB,ie=p.bias,fe=p.activation,ye=p.preluActivationWeights,Oe=this.batchMatMul(w,D,W,Q);return ie&&(Oe=this.add(Oe,ie)),fe&&(Oe=q(this,Oe,fe,ye)),Oe},x.prototype.multiply=function(p,w){return p.dtype==="complex64"||w.dtype==="complex64"?this.broadcastedBinaryComplexOp(p.cast("complex64"),w.cast("complex64"),function(D,W,Q,ie){return{real:D*Q-W*ie,imag:D*ie+W*Q}}):this.broadcastedBinaryOp(p,w,kn(p.dtype,w.dtype),function(D,W){return D*W})},x.prototype.realDivide=function(p,w){return Gr([p,w],"realDivide"),this.broadcastedBinaryOp(p,w,"float32",function(D,W){return D/W})},x.prototype.floorDiv=function(p,w){return Gr([p,w],"floorDiv"),this.broadcastedBinaryOp(p,w,"int32",function(D,W){return Math.floor(D/W)})},x.prototype.sum=function(p,w){Gr(p,"sum"),Aa("sum",w,p.rank);for(var D=ra(p.shape,w),W=D[0],Q=D[1],ie=go(W,kn(p.dtype,"int32")),fe=Ke(Q),ye=this.readSync(ie.dataId),Oe=this.readSync(p.dataId),Re=0;Re<ye.length;++Re){for(var Pe=Re*fe,je=0,Ge=0;Ge<fe;++Ge)je+=Oe[Pe+Ge];ye[Re]=je}return ie},x.prototype.prod=function(p,w){Gr(p,"sum");for(var D=ra(p.shape,w),W=D[0],Q=D[1],ie=go(W,kn(p.dtype,"int32")),fe=Ke(Q),ye=this.readSync(ie.dataId),Oe=this.readSync(p.dataId),Re=0;Re<ye.length;++Re){for(var Pe=Re*fe,je=1,Ge=0;Ge<fe;++Ge)je*=Oe[Pe+Ge];ye[Re]=je}return ie},x.prototype.unsortedSegmentSum=function(p,w,D){Gr(p,"unsortedSegmentSum");for(var W=[],Q=p.rank-w.rank,ie=0;ie<Q;++ie)w=w.expandDims(ie+1);for(ie=0;ie<D;++ie){var fe=Or(ie,"int32"),ye=Dl(fe,w).asType("float32").mul(p).sum(0);W.push(ye)}return no(W)},x.prototype.argMin=function(p,w){Gr(p,"argMin");var D=[w];Aa("argMin",D,p.rank);for(var W=ra(p.shape,D),Q=W[0],ie=W[1],fe=go(Q,"int32"),ye=Ke(ie),Oe=this.readSync(fe.dataId),Re=this.readSync(p.dataId),Pe=0;Pe<Oe.length;++Pe){for(var je=Pe*ye,Ge=Re[je],rt=0,nt=0;nt<ye;++nt){var lt=Re[je+nt];lt<Ge&&(Ge=lt,rt=nt)}Oe[Pe]=rt}return fe},x.prototype.argMax=function(p,w){Gr(p,"argMax");var D=[w];Aa("argMax",D,p.rank);for(var W=ra(p.shape,D),Q=W[0],ie=W[1],fe=go(Q,"int32"),ye=Ke(ie),Oe=this.readSync(fe.dataId),Re=this.readSync(p.dataId),Pe=0;Pe<Oe.length;++Pe){for(var je=Pe*ye,Ge=Re[je],rt=0,nt=0;nt<ye;++nt){var lt=Re[je+nt];lt>Ge&&(Ge=lt,rt=nt)}Oe[Pe]=rt}return fe},x.prototype.cumsum=function(p,w,D,W){if(Gr(p,"cumsum"),w!==p.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(p.rank-1)+" but got axis="+w);for(var Q=kn(p.dtype,"int32"),ie=go(p.shape,Q),fe=this.readSync(ie.dataId),ye=this.readSync(p.dataId),Oe=p.shape[p.rank-1],Re=W?function(nt,lt){return nt+Oe-lt-1}:function(nt,lt){return nt+lt},Pe=0;Pe<ye.length;Pe+=Oe)for(var je=0;je<Oe;je++){var Ge=Re(Pe,je);if(je===0)fe[Ge]=D?0:ye[Ge];else{var rt=Re(Pe,je-1);fe[Ge]=D?ye[rt]+fe[rt]:ye[Ge]+fe[rt]}}return ie},x.prototype.equal=function(p,w){return Gr([p,w],"equal"),this.broadcastedBinaryOp(p,w,"bool",function(D,W){return D===W?1:0})},x.prototype.notEqual=function(p,w){return Gr([p,w],"notEqual"),this.broadcastedBinaryOp(p,w,"bool",function(D,W){return D!==W?1:0})},x.prototype.less=function(p,w){return Gr([p,w],"less"),this.broadcastedBinaryOp(p,w,"bool",function(D,W){return D<W?1:0})},x.prototype.lessEqual=function(p,w){return Gr([p,w],"lessEqual"),this.broadcastedBinaryOp(p,w,"bool",function(D,W){return D<=W?1:0})},x.prototype.greater=function(p,w){return Gr([p,w],"greater"),this.broadcastedBinaryOp(p,w,"bool",function(D,W){return D>W?1:0})},x.prototype.greaterEqual=function(p,w){return Gr([p,w],"greaterEqual"),this.broadcastedBinaryOp(p,w,"bool",function(D,W){return D>=W?1:0})},x.prototype.logicalNot=function(p){Gr(p,"logicalNot");for(var w=this.readSync(p.dataId),D=new Uint8Array(w.length),W=0;W<w.length;++W)D[W]=w[W]?0:1;return this.makeOutput(D,p.shape,"bool")},x.prototype.logicalAnd=function(p,w){return Gr([p,w],"logicalAnd"),this.broadcastedBinaryOp(p,w,"bool",function(D,W){return D&&W})},x.prototype.logicalOr=function(p,w){return Gr([p,w],"logicalOr"),this.broadcastedBinaryOp(p,w,"bool",function(D,W){return D||W})},x.prototype.select=function(p,w,D){Gr([p,w,D],"select");for(var W=this.readSync(p.dataId),Q=this.readSync(w.dataId),ie=this.readSync(D.dataId),fe=go(w.shape,kn(w.dtype,D.dtype)),ye=this.readSync(fe.dataId),Oe=0,Re=p.rank===0||p.rank>1||w.rank===1?1:Ke(w.shape.slice(1)),Pe=0;Pe<W.length;Pe++)for(var je=0;je<Re;je++)W[Pe]===1?ye[Oe++]=Q[Pe]:ye[Oe++]=ie[Pe];return fe},x.prototype.where=function(p){Gr([p],"where");var w=this.readSync(p.dataId);return ne(p.shape,w)},x.prototype.topk=function(p,w,D){return Gr(p,"topk"),ae(this.readSync(p.dataId),p.shape,p.dtype,w)},x.prototype.min=function(p,w){Gr(p,"min"),Aa("min",w,p.rank);for(var D=ra(p.shape,w),W=D[0],Q=D[1],ie=go(W,p.dtype),fe=Ke(Q),ye=this.readSync(ie.dataId),Oe=this.readSync(p.dataId),Re=0;Re<ye.length;++Re){for(var Pe=Re*fe,je=Oe[Pe],Ge=0;Ge<fe;++Ge){var rt=Oe[Pe+Ge];rt<je&&(je=rt)}ye[Re]=je}return ie},x.prototype.minimum=function(p,w){return Gr([p,w],"minimum"),this.broadcastedBinaryOp(p,w,p.dtype,function(D,W){return Math.min(D,W)})},x.prototype.mod=function(p,w){return Gr([p,w],"mod"),this.broadcastedBinaryOp(p,w,p.dtype,function(D,W){var Q=D%W;return D<0&&W<0||D>=0&&W>=0?Q:(Q+W)%W})},x.prototype.max=function(p,w){Gr(p,"max"),Aa("max",w,p.rank);for(var D=ra(p.shape,w),W=D[0],Q=D[1],ie=go(W,p.dtype),fe=Ke(Q),ye=this.readSync(ie.dataId),Oe=this.readSync(p.dataId),Re=0;Re<ye.length;++Re){for(var Pe=Re*fe,je=Oe[Pe],Ge=0;Ge<fe;++Ge){var rt=Oe[Pe+Ge];rt>je&&(je=rt)}ye[Re]=je}return ie},x.prototype.maximum=function(p,w){return Gr([p,w],"maximum"),this.broadcastedBinaryOp(p,w,p.dtype,function(D,W){return Math.max(D,W)})},x.prototype.all=function(p,w){Gr(p,"all"),Aa("all",w,p.rank);for(var D=ra(p.shape,w),W=D[0],Q=D[1],ie=go(W,p.dtype),fe=Ke(Q),ye=this.readSync(ie.dataId),Oe=this.readSync(p.dataId),Re=0;Re<ye.length;++Re){for(var Pe=Re*fe,je=Oe[Pe],Ge=0;Ge<fe;++Ge){var rt=Oe[Pe+Ge];je=je&&rt}ye[Re]=je}return ie},x.prototype.any=function(p,w){Gr(p,"any"),Aa("any",w,p.rank);for(var D=ra(p.shape,w),W=D[0],Q=D[1],ie=go(W,p.dtype),fe=Ke(Q),ye=this.readSync(ie.dataId),Oe=this.readSync(p.dataId),Re=0;Re<ye.length;++Re){for(var Pe=Re*fe,je=Oe[Pe],Ge=0;Ge<fe;++Ge){var rt=Oe[Pe+Ge];je=je||rt}ye[Re]=je}return ie},x.prototype.squaredDifference=function(p,w){return Gr([p,w],"squaredDifference"),this.broadcastedBinaryOp(p,w,p.dtype,function(D,W){var Q=D-W;return Q*Q})},x.prototype.ceil=function(p){Gr(p,"ceil");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W)D[W]=Math.ceil(w[W]);return this.makeOutput(D,p.shape,"float32")},x.prototype.floor=function(p){Gr(p,"floor");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W)D[W]=Math.floor(w[W]);return this.makeOutput(D,p.shape,"float32")},x.prototype.sign=function(p){Gr(p,"x");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W)w[W]<0?D[W]=-1:w[W]>0?D[W]=1:D[W]=0;return this.makeOutput(D,p.shape,"float32")},x.prototype.isNaN=function(p){Gr(p,"x");for(var w=this.readSync(p.dataId),D=new Uint8Array(w.length),W=0;W<w.length;++W)Number.isNaN(w[W])&&(D[W]=1);return this.makeOutput(D,p.shape,"bool")},x.prototype.isInf=function(p){Gr(p,"x");for(var w=this.readSync(p.dataId),D=new Uint8Array(w.length),W=0;W<w.length;++W)Math.abs(w[W])===1/0&&(D[W]=1);return this.makeOutput(D,p.shape,"bool")},x.prototype.isFinite=function(p){Gr(p,"x");for(var w=this.readSync(p.dataId),D=new Uint8Array(w.length),W=0;W<w.length;++W)Number.isFinite(w[W])&&(D[W]=1);return this.makeOutput(D,p.shape,"bool")},x.prototype.round=function(p){Gr(p,"round");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W){var Q=Math.floor(w[W]);w[W]-Q<.5?D[W]=Math.floor(w[W]):w[W]-Q>.5?D[W]=Math.ceil(w[W]):D[W]=Q%2==0?Q:Q+1}return this.makeOutput(D,p.shape,"float32")},x.prototype.exp=function(p){Gr(p,"exp");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W)D[W]=Math.exp(w[W]);return this.makeOutput(D,p.shape,"float32")},x.prototype.expm1=function(p){Gr(p,"expm1");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W)D[W]=Math.expm1(w[W]);return this.makeOutput(D,p.shape,"float32")},x.prototype.log=function(p){Gr(p,"log");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W){var Q=w[W];D[W]=Math.log(Q)}return this.makeOutput(D,p.shape,"float32")},x.prototype.log1p=function(p){Gr(p,"log1p");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W){var Q=w[W];D[W]=Math.log1p(Q)}return this.makeOutput(D,p.shape,"float32")},x.prototype.sqrt=function(p){Gr(p,"sqrt");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W){var Q=w[W];D[W]=Math.sqrt(Q)}return this.makeOutput(D,p.shape,"float32")},x.prototype.rsqrt=function(p){Gr(p,"rsqrt");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W){var Q=w[W];D[W]=1/Math.sqrt(Q)}return this.makeOutput(D,p.shape,"float32")},x.prototype.reciprocal=function(p){Gr(p,"reciprocal");for(var w=this.readSync(p.dataId),D=new Float32Array(w.length),W=0;W<w.length;++W)D[W]=1/w[W];return this.makeOutput(D,p.shape,"float32")},x.prototype.linear=function(p){return p},x.prototype.relu=function(p){Gr(p,"relu");for(var w=go(p.shape,p.dtype),D=this.readSync(w.dataId),W=this.readSync(p.dataId),Q=0;Q<W.length;++Q)D[Q]=Math.max(0,W[Q]);return w},x.prototype.relu6=function(p){Gr(p,"relu");for(var w=go(p.shape,p.dtype),D=this.readSync(w.dataId),W=this.readSync(p.dataId),Q=0;Q<W.length;++Q)D[Q]=Math.min(Math.max(0,W[Q]),6);return w},x.prototype.prelu=function(p,w){return Gr([p,w],"prelu"),this.broadcastedBinaryOp(p,w,p.dtype,function(D,W){return D<0?W*D:D})},x.prototype.elu=function(p){Gr(p,"elu");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W){var Q=D[W];w[W]=Q>=0?Q:Math.exp(Q)-1}return this.makeOutput(w,p.shape,"float32")},x.prototype.eluDer=function(p,w){Gr([p,w],"eluDer");for(var D=new Float32Array(w.size),W=this.readSync(w.dataId),Q=this.readSync(p.dataId),ie=0;ie<W.length;++ie){var fe=W[ie];D[ie]=fe>=1?Q[ie]:Q[ie]*(fe+1)}return this.makeOutput(D,w.shape,"float32")},x.prototype.selu=function(p){Gr(p,"selu");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W){var Q=D[W];w[W]=Q>=0?1.0507009873554805*Q:1.7580993408473768*(Math.exp(Q)-1)}return this.makeOutput(w,p.shape,"float32")},x.prototype.clip=function(p,w,D){Gr(p,"clip");for(var W=new Float32Array(p.size),Q=this.readSync(p.dataId),ie=0;ie<Q.length;++ie){var fe=Q[ie];W[ie]=fe>D?D:fe<w?w:fe}return this.makeOutput(W,p.shape,"float32")},x.prototype.abs=function(p){for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.abs(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.complexAbs=function(p){for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<p.size;++W){var Q=D[2*W],ie=D[2*W+1];w[W]=Math.hypot(Q,ie)}return this.makeOutput(w,p.shape,"float32")},x.prototype.int=function(p){Gr(p,"int");for(var w=new Int32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=D[W];return this.makeOutput(w,p.shape,"int32")},x.prototype.sigmoid=function(p){Gr(p,"sigmoid");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=1/(1+Math.exp(-D[W]));return this.makeOutput(w,p.shape,"float32")},x.prototype.softplus=function(p){Gr(p,"softplus");for(var w=Math.log(11920928955078125e-23)+2,D=new Float32Array(p.size),W=this.readSync(p.dataId),Q=0;Q<W.length;++Q){var ie,fe=W[Q]>-w,ye=W[Q]<w,Oe=Math.exp(W[Q]);ie=ye?Oe:fe?W[Q]:Math.log(1+Oe),D[Q]=ie}return this.makeOutput(D,p.shape,"float32")},x.prototype.sin=function(p){Gr(p,"sin");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.sin(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.cos=function(p){Gr(p,"cos");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.cos(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.tan=function(p){Gr(p,"tan");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.tan(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.asin=function(p){Gr(p,"asin");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.asin(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.acos=function(p){Gr(p,"acos");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.acos(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.atan=function(p){Gr(p,"atan");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.atan(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.atan2=function(p,w){return Gr([p,w],"atan2"),this.broadcastedBinaryOp(p,w,p.dtype,function(D,W){return Math.atan2(D,W)})},x.prototype.sinh=function(p){Gr(p,"sinh");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.sinh(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.cosh=function(p){Gr(p,"cosh");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.cosh(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.tanh=function(p){Gr(p,"tanh");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=yt(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.asinh=function(p){Gr(p,"asinh");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.asinh(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.acosh=function(p){Gr(p,"acosh");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.acosh(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.atanh=function(p){Gr(p,"atanh");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W)w[W]=Math.atanh(D[W]);return this.makeOutput(w,p.shape,"float32")},x.prototype.erf=function(p){Gr(p,"erf");for(var w=new Float32Array(p.size),D=this.readSync(p.dataId),W=0;W<D.length;++W){var Q=Math.sign(D[W]),ie=Math.abs(D[W]),fe=1/(1+.3275911*ie);w[W]=Q*(1-((((1.061405429*fe-1.453152027)*fe+1.421413741)*fe-.284496736)*fe+.254829592)*fe*Math.exp(-ie*ie))}return this.makeOutput(w,p.shape,"float32")},x.prototype.step=function(p,w){w===void 0&&(w=0),Gr(p,"step");for(var D=new Float32Array(p.size),W=this.readSync(p.dataId),Q=0;Q<W.length;++Q){var ie=W[Q];isNaN(ie)?D[Q]=NaN:D[Q]=ie>0?1:w}return this.makeOutput(D,p.shape,"float32")},x.prototype.fusedConv2d=function(p){var w=p.input,D=p.filter,W=p.convInfo,Q=p.bias,ie=p.activation,fe=p.preluActivationWeights,ye=this.conv2d(w,D,W);return Q&&(ye=this.add(ye,Q)),ie&&(ye=q(this,ye,ie,fe)),ye},x.prototype.conv2d=function(p,w,D){Gr([p,w],"conv2d");for(var W=D.filterHeight,Q=D.filterWidth,ie=D.dilationHeight,fe=D.dilationWidth,ye=D.padInfo.left,Oe=D.padInfo.top,Re=D.dataFormat==="channelsLast",Pe=Qi(D.outShape,p.dtype),je=p.strides[0],Ge=Re?p.strides[1]:p.strides[2],rt=Re?p.strides[2]:1,nt=Re?1:p.strides[1],lt=Pe.strides[0],Nt=Re?Pe.strides[1]:Pe.strides[2],Rt=Re?Pe.strides[2]:1,Pt=Re?1:Pe.strides[1],Kt=this.readSync(p.dataId),dn=this.readSync(w.dataId),bn=Pe.values,pn=0;pn<D.batchSize;++pn)for(var _n=pn*je,On=pn*lt,_=0;_<D.outHeight;++_)for(var m=On+_*Nt,f=_*D.strideHeight-Oe,y=0;y<W;y++){var E=f+y*ie;if(!(E<0||E>=D.inHeight))for(var z=y*w.strides[0],Y=_n+E*Ge,Z=0;Z<D.outWidth;++Z)for(var le=m+Z*Rt,de=Z*D.strideWidth-ye,we=0;we<Q;we++){var De=de+we*fe;if(!(De<0||De>=D.inWidth))for(var Ne=Y+De*rt,Fe=z+we*w.strides[1],Ve=0;Ve<D.inChannels;++Ve){for(var Je=Kt[Ne+Ve*nt],Xe=0;Xe<D.outChannels;++Xe)bn[le+Xe*Pt]+=Je*dn[Fe+Xe];Fe+=D.outChannels}}}return Pe.toTensor()},x.prototype.conv3d=function(p,w,D){for(var W=D.filterDepth,Q=D.filterHeight,ie=D.filterWidth,fe=D.dilationDepth,ye=D.dilationHeight,Oe=D.dilationWidth,Re=D.padInfo.front,Pe=D.padInfo.left,je=D.padInfo.top,Ge=Qi(D.outShape,p.dtype),rt=this.readSync(p.dataId),nt=this.readSync(w.dataId),lt=Ge.values,Nt=0;Nt<D.batchSize;++Nt)for(var Rt=Nt*p.strides[0],Pt=Nt*Ge.strides[0],Kt=0;Kt<D.outDepth;++Kt)for(var dn=Pt+Kt*Ge.strides[1],bn=Kt*D.strideDepth-Re,pn=0;pn<W;pn++){var _n=bn+pn*fe;if(!(_n<0||_n>=D.inDepth))for(var On=pn*w.strides[0],_=Rt+_n*p.strides[1],m=0;m<D.outHeight;++m)for(var f=dn+m*Ge.strides[2],y=m*D.strideHeight-je,E=0;E<Q;E++){var z=y+E*ye;if(!(z<0||z>=D.inHeight))for(var Y=On+E*w.strides[1],Z=_+z*p.strides[2],le=0;le<D.outWidth;++le)for(var de=f+le*D.outChannels,we=le*D.strideWidth-Pe,De=0;De<ie;De++){var Ne=we+De*Oe;if(!(Ne<0||Ne>=D.inWidth))for(var Fe=Y+De*w.strides[2],Ve=Z+Ne*D.inChannels,Je=Fe,Xe=0;Xe<D.inChannels;++Xe){for(var ot=rt[Ve+Xe],xt=0;xt<D.outChannels;++xt)lt[de+xt]+=ot*nt[Je+xt];Je+=D.outChannels}}}}return Ge.toTensor()},x.prototype.conv2dDerInput=function(p,w,D){Gr([p,w],"conv2dDerInput");for(var W=Qi(D.inShape,"float32"),Q=W.values,ie=this.readSync(p.dataId),fe=this.readSync(w.dataId),ye=w.strides,Oe=ye[0],Re=ye[1],Pe=ye[2],je=D.batchSize,Ge=D.filterHeight,rt=D.filterWidth,nt=D.inChannels,lt=D.inHeight,Nt=D.inWidth,Rt=D.outChannels,Pt=D.outHeight,Kt=D.outWidth,dn=D.strideHeight,bn=D.strideWidth,pn=D.dataFormat,_n=Ge-1-D.padInfo.top,On=rt-1-D.padInfo.left,_=pn==="channelsLast",m=W.strides[0],f=_?W.strides[1]:W.strides[2],y=_?W.strides[2]:1,E=_?1:W.strides[1],z=p.strides[0],Y=_?p.strides[1]:p.strides[2],Z=_?p.strides[2]:1,le=_?1:p.strides[1],de=0;de<je;++de)for(var we=0;we<nt;++we)for(var De=0;De<lt;++De)for(var Ne=De-_n,Fe=Math.max(0,Math.ceil(Ne/dn)),Ve=Math.min(Pt,(Ge+Ne)/dn),Je=0;Je<Nt;++Je){for(var Xe=Je-On,ot=Math.max(0,Math.ceil(Xe/bn)),xt=Math.min(Kt,(rt+Xe)/bn),kt=0,At=Fe;At<Ve;++At)for(var Lt=At*dn-Ne,tn=ot;tn<xt;++tn)for(var ln=z*de+Y*At+Z*tn,nn=Oe*(Ge-1-Lt)+Re*(rt-1-(tn*bn-Xe))+Pe*we,cn=0;cn<Rt;++cn)kt+=ie[ln+le*cn]*fe[nn+cn];Q[m*de+f*De+y*Je+E*we]=kt}return W.toTensor()},x.prototype.conv3dDerInput=function(p,w,D){for(var W=Qi(D.inShape,"float32"),Q=W.values,ie=W.strides,fe=ie[0],ye=ie[1],Oe=ie[2],Re=ie[3],Pe=this.readSync(p.dataId),je=p.strides,Ge=je[0],rt=je[1],nt=je[2],lt=je[3],Nt=this.readSync(w.dataId),Rt=w.strides,Pt=Rt[0],Kt=Rt[1],dn=Rt[2],bn=Rt[3],pn=D.batchSize,_n=D.filterDepth,On=D.filterHeight,_=D.filterWidth,m=D.inChannels,f=D.inDepth,y=D.inHeight,E=D.inWidth,z=D.outChannels,Y=D.outDepth,Z=D.outHeight,le=D.outWidth,de=D.strideDepth,we=D.strideHeight,De=D.strideWidth,Ne=_n-1-D.padInfo.front,Fe=On-1-D.padInfo.top,Ve=_-1-D.padInfo.left,Je=0;Je<pn;++Je)for(var Xe=0;Xe<m;++Xe)for(var ot=0;ot<f;++ot)for(var xt=ot-Ne,kt=Math.max(0,Math.ceil(xt/de)),At=Math.min(Y,(_n+xt)/de),Lt=0;Lt<y;++Lt)for(var tn=Lt-Fe,ln=Math.max(0,Math.ceil(tn/we)),nn=Math.min(Z,(On+tn)/we),cn=0;cn<E;++cn){for(var Dn=cn-Ve,Rn=Math.max(0,Math.ceil(Dn/De)),Mn=Math.min(le,(_+Dn)/De),tr=0,ur=kt;ur<At;++ur)for(var vr=ur*de-xt,kr=ln;kr<nn;++kr)for(var yr=kr*we-tn,mr=Rn;mr<Mn;++mr)for(var jr=Ge*Je+rt*ur+nt*kr+lt*mr,Pr=Pt*(_n-1-vr)+Kt*(On-1-yr)+dn*(_-1-(mr*De-Dn))+bn*Xe,ei=0;ei<z;++ei)tr+=Pe[jr+ei]*Nt[Pr+ei];Q[fe*Je+ye*ot+Oe*Lt+Re*cn+Xe]=tr}return W.toTensor()},x.prototype.conv2dDerFilter=function(p,w,D){Gr([p,w],"conv2dDerFilter");for(var W=D.strideHeight,Q=D.strideWidth,ie=D.filterHeight,fe=D.filterWidth,ye=D.dataFormat==="channelsLast",Oe=Qi(D.filterShape,"float32"),Re=D.padInfo.left,Pe=D.padInfo.top,je=this.bufferSync(p),Ge=this.bufferSync(w),rt=0;rt<ie;++rt)for(var nt=Math.max(0,Math.ceil((Pe-rt)/W)),lt=Math.min(D.outHeight,(D.inHeight+Pe-rt)/W),Nt=0;Nt<fe;++Nt)for(var Rt=Math.max(0,Math.ceil((Re-Nt)/Q)),Pt=Math.min(D.outWidth,(D.inWidth+Re-Nt)/Q),Kt=0;Kt<D.inChannels;++Kt)for(var dn=0;dn<D.outChannels;++dn){for(var bn=0,pn=0;pn<D.batchSize;++pn)for(var _n=nt;_n<lt;++_n)for(var On=rt+_n*W-Pe,_=Rt;_<Pt;++_){var m=Nt+_*Q-Re;bn+=ye?je.get(pn,On,m,Kt)*Ge.get(pn,_n,_,dn):je.get(pn,Kt,On,m)*Ge.get(pn,dn,_n,_)}Oe.set(bn,rt,Nt,Kt,dn)}return Oe.toTensor()},x.prototype.conv3dDerFilter=function(p,w,D){for(var W=D.strideDepth,Q=D.strideHeight,ie=D.strideWidth,fe=D.filterDepth,ye=D.filterHeight,Oe=D.filterWidth,Re=Qi(D.filterShape,"float32"),Pe=Re.values,je=Re.strides,Ge=je[0],rt=je[1],nt=je[2],lt=je[3],Nt=this.readSync(w.dataId),Rt=w.strides,Pt=Rt[0],Kt=Rt[1],dn=Rt[2],bn=Rt[3],pn=this.readSync(p.dataId),_n=p.strides,On=_n[0],_=_n[1],m=_n[2],f=_n[3],y=D.padInfo.front,E=D.padInfo.left,z=D.padInfo.top,Y=0;Y<fe;++Y)for(var Z=Math.max(0,Math.ceil((y-Y)/W)),le=Math.min(D.outDepth,(D.inDepth+y-Y)/W),de=Y*Ge,we=0;we<ye;++we)for(var De=Math.max(0,Math.ceil((z-we)/Q)),Ne=Math.min(D.outHeight,(D.inHeight+z-we)/Q),Fe=we*rt+de,Ve=0;Ve<Oe;++Ve)for(var Je=Math.max(0,Math.ceil((E-Ve)/ie)),Xe=Math.min(D.outWidth,(D.inWidth+E-Ve)/ie),ot=Ve*nt+Fe,xt=0;xt<D.inChannels;++xt)for(var kt=xt*lt+ot,At=0;At<D.outChannels;++At){for(var Lt=0,tn=0;tn<D.batchSize;++tn)for(var ln=tn*On,nn=tn*Pt,cn=Z;cn<le;++cn)for(var Dn=(Y+cn*W-y)*_+ln,Rn=cn*Kt+nn,Mn=De;Mn<Ne;++Mn)for(var tr=(we+Mn*Q-z)*m+Dn,ur=Mn*dn+Rn,vr=Je;vr<Xe;++vr){var kr=vr*bn+ur;Lt+=pn[(Ve+vr*ie-E)*f+tr+xt]*Nt[kr+At]}Pe[kt+At]=Lt}return Re.toTensor()},x.prototype.fusedDepthwiseConv2D=function(p){var w=p.input,D=p.filter,W=p.convInfo,Q=p.bias,ie=p.activation,fe=p.preluActivationWeights,ye=this.depthwiseConv2D(w,D,W);return Q&&(ye=this.add(ye,Q)),ie&&(ye=q(this,ye,ie,fe)),ye},x.prototype.depthwiseConv2D=function(p,w,D){Gr([p,w],"depthwiseConv2D");for(var W=D.filterHeight,Q=D.filterWidth,ie=D.dilationHeight,fe=D.dilationWidth,ye=D.padInfo.left,Oe=D.padInfo.top,Re=D.outChannels/D.inChannels,Pe=Qi(D.outShape,p.dtype),je=this.readSync(p.dataId),Ge=this.readSync(w.dataId),rt=Pe.values,nt=0;nt<D.batchSize;++nt)for(var lt=nt*p.strides[0],Nt=nt*Pe.strides[0],Rt=0;Rt<D.outHeight;++Rt)for(var Pt=Nt+Rt*Pe.strides[1],Kt=Rt*D.strideHeight-ye,dn=0;dn<W;++dn){var bn=Kt+dn*ie;if(!(bn<0||bn>=D.inHeight))for(var pn=dn*w.strides[0],_n=lt+bn*p.strides[1],On=0;On<D.outWidth;++On)for(var _=Pt+On*Pe.strides[2],m=On*D.strideWidth-Oe,f=0;f<Q;++f){var y=m+f*fe;if(!(y<0||y>=D.inWidth))for(var E=pn+f*w.strides[1],z=_n+y*D.inChannels,Y=_,Z=E,le=0;le<D.inChannels;++le){for(var de=je[z+le],we=0;we<Re;++we)rt[Y+we]+=de*Ge[Z+we];Y+=Re,Z+=Re}}}return Pe.toTensor()},x.prototype.depthwiseConv2DDerInput=function(p,w,D){Gr([p,w],"depthwiseConv2DDerInput");for(var W=Qi(D.inShape,"float32"),Q=W.values,ie=W.strides,fe=ie[0],ye=ie[1],Oe=ie[2],Re=this.readSync(p.dataId),Pe=p.strides,je=Pe[0],Ge=Pe[1],rt=Pe[2],nt=this.readSync(w.dataId),lt=w.strides,Nt=lt[0],Rt=lt[1],Pt=lt[2],Kt=D.batchSize,dn=D.filterHeight,bn=D.filterWidth,pn=D.inChannels,_n=D.inHeight,On=D.inWidth,_=D.outChannels,m=D.outHeight,f=D.outWidth,y=D.strideHeight,E=D.strideWidth,z=dn-1-D.padInfo.top,Y=bn-1-D.padInfo.left,Z=_/pn,le=0;le<Kt;++le)for(var de=0;de<pn;++de)for(var we=0;we<_n;++we)for(var De=we-z,Ne=Math.max(0,Math.ceil(De/y)),Fe=Math.min(m,(dn+De)/y),Ve=0;Ve<On;++Ve){for(var Je=Ve-Y,Xe=Math.max(0,Math.ceil(Je/E)),ot=Math.min(f,(bn+Je)/E),xt=0,kt=Ne;kt<Fe;++kt)for(var At=kt*y-De,Lt=Xe;Lt<ot;++Lt)for(var tn=je*le+Ge*kt+rt*Lt,ln=Nt*(dn-1-At)+Rt*(bn-1-(Lt*E-Je))+Pt*de,nn=0;nn<Z;++nn)xt+=Re[tn+(de*Z+nn)]*nt[ln+nn];Q[fe*le+ye*we+Oe*Ve+de]=xt}return W.toTensor()},x.prototype.depthwiseConv2DDerFilter=function(p,w,D){Gr([p,w],"depthwiseConv2DDerFilter");for(var W=D.strideHeight,Q=D.strideWidth,ie=D.filterHeight,fe=D.filterWidth,ye=Qi(D.filterShape,"float32"),Oe=D.padInfo.left,Re=D.padInfo.top,Pe=D.outChannels/D.inChannels,je=this.bufferSync(p),Ge=this.bufferSync(w),rt=0;rt<ie;++rt)for(var nt=Math.max(0,Math.ceil((Re-rt)/W)),lt=Math.min(D.outHeight,(D.inHeight+Re-rt)/W),Nt=0;Nt<fe;++Nt)for(var Rt=Math.max(0,Math.ceil((Oe-Nt)/Q)),Pt=Math.min(D.outWidth,(D.inWidth+Oe-Nt)/Q),Kt=0;Kt<D.outChannels;++Kt){for(var dn=Math.trunc(Kt/Pe),bn=Kt%Pe,pn=0,_n=0;_n<D.batchSize;++_n)for(var On=nt;On<lt;++On)for(var _=rt+On*W-Re,m=Rt;m<Pt;++m){var f=Nt+m*Q-Oe;pn+=je.get(_n,_,f,dn)*Ge.get(_n,On,m,Kt)}ye.set(pn,rt,Nt,dn,bn)}return ye.toTensor()},x.prototype.tile=function(p,w){return Gr(p,"tile"),bh(this.bufferSync(p),w)},x.prototype.pad=function(p,w,D){Gr(p,"pad");var W=w.map(function(Pe,je){return Pe[0]+p.shape[je]+Pe[1]}),Q=w.map(function(Pe){return Pe[0]}),ie=this.bufferSync(p),fe=Qi(W,p.dtype);D!==0&&fe.values.fill(D);for(var ye=0;ye<p.size;ye++){var Oe=ie.indexToLoc(ye),Re=Oe.map(function(Pe,je){return Pe+Q[je]});fe.set.apply(fe,[ie.get.apply(ie,Oe)].concat(Re))}return fe.toTensor()},x.prototype.transpose=function(p,w){Gr(p,"transpose");for(var D=new Array(p.rank),W=0;W<D.length;W++)D[W]=p.shape[w[W]];var Q=this.readSync(p.dataId),ie=Qi(D,p.dtype),fe=this.bufferSync(p);for(W=0;W<p.size;++W){for(var ye=fe.indexToLoc(W),Oe=new Array(ye.length),Re=0;Re<Oe.length;Re++)Oe[Re]=ye[w[Re]];var Pe=ie.locToIndex(Oe);ie.values[Pe]=Q[W]}return ie.toTensor()},x.prototype.gather=function(p,w,D){Gr([p,w],"gather");var W=p.shape.slice(),Q=this.readSync(w.dataId);W[D]=Q.length;for(var ie=Qi(W,p.dtype),fe=this.bufferSync(p),ye=0;ye<ie.size;++ye){var Oe=ie.indexToLoc(ye),Re=Oe.slice();Re[D]=Q[Oe[D]];var Pe=fe.locToIndex(Re);ie.values[ye]=fe.values[Pe]}return ie.toTensor()},x.prototype.batchToSpaceND=function(p,w,D){Gr([p],"batchToSpaceND");var W=w.reduce(function(Re,Pe){return Re*Pe}),Q=tl(p.shape,w,W),ie=fh(Q.length,w.length),fe=dh(p.shape,w,W),ye=kf(D,w.length),Oe=zm(fe,D,w.length);return p.reshape(Q).transpose(ie).reshape(fe).slice(ye,Oe)},x.prototype.spaceToBatchND=function(p,w,D){Gr([p],"spaceToBatchND");var W=w.reduce(function(Pe,je){return Pe*je}),Q=[[0,0]];Q.push.apply(Q,D);for(var ie=1+w.length;ie<p.shape.length;++ie)Q.push([0,0]);var fe=p.pad(Q),ye=tl(fe.shape,w,W,!1),Oe=fh(ye.length,w.length,!1),Re=dh(fe.shape,w,W,!1);return fe.reshape(ye).transpose(Oe).reshape(Re)},x.prototype.pool=function(p,w,D){Gr(p,"pool");for(var W=w.strideHeight,Q=w.strideWidth,ie=w.dilationHeight,fe=w.dilationWidth,ye=w.effectiveFilterHeight,Oe=w.effectiveFilterWidth,Re=w.padInfo.top,Pe=w.padInfo.left,je=D==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,Ge=this.readSync(p.dataId),rt=Qi(w.outShape,p.dtype),nt=rt.values,lt=w.outShape[1]*w.outShape[2]*w.outShape[3],Nt=w.outShape[2]*w.outShape[3],Rt=w.outShape[3],Pt=0;Pt<w.batchSize;++Pt)for(var Kt=Pt*lt,dn=Pt*p.strides[0],bn=0;bn<w.inChannels;++bn)for(var pn=0;pn<w.outHeight;++pn)for(var _n=pn*W-Re,On=Math.max(0,_n),_=Math.min(w.inHeight,ye+_n),m=Kt+pn*Nt,f=0;f<w.outWidth;++f){for(var y=f*Q-Pe,E=Math.max(0,y),z=Math.min(w.inWidth,Oe+y),Y=je,Z=0,le=0,de=On;de<_;de+=ie){for(var we=dn+de*p.strides[1],De=E;De<z;De+=fe){var Ne=Ge[we+De*p.strides[2]+bn];D==="max"&&Ne>Y?Y=Ne:D==="avg"&&(Z+=Ne,le++)}if(isNaN(Y))break}nt[m+f*Rt+bn]=D==="avg"?Z/le:Y}return rt.toTensor()},x.prototype.maxPool=function(p,w){return this.pool(p,w,"max")},x.prototype.maxPoolPositions=function(p,w){for(var D=Qi(w.outShape,"int32"),W=w.strideHeight,Q=w.strideWidth,ie=w.dilationHeight,fe=w.dilationWidth,ye=w.effectiveFilterHeight,Oe=w.effectiveFilterWidth,Re=w.padInfo.top,Pe=w.padInfo.left,je=this.bufferSync(p),Ge=0;Ge<w.batchSize;++Ge)for(var rt=0;rt<w.inChannels;++rt)for(var nt=0;nt<w.outHeight;++nt){for(var lt=nt*W-Re,Nt=lt;Nt<0;)Nt+=ie;for(var Rt=Math.min(w.inHeight,ye+lt),Pt=0;Pt<w.outWidth;++Pt){for(var Kt=Pt*Q-Pe,dn=Kt;dn<0;)dn+=fe;for(var bn=Math.min(w.inWidth,Oe+Kt),pn=Number.NEGATIVE_INFINITY,_n=-1,On=Nt;On<Rt;On+=ie)for(var _=On-lt,m=dn;m<bn;m+=fe){var f=m-Kt,y=je.get(Ge,On,m,rt);y>pn&&(pn=y,_n=_*Oe+f)}D.set(_n,Ge,nt,Pt,rt)}}return D.toTensor()},x.prototype.maxPoolBackprop=function(p,w,D,W){Gr([w,D],"maxPoolBackprop");for(var Q=this.maxPoolPositions(w,W),ie=W.strideHeight,fe=W.strideWidth,ye=W.dilationHeight,Oe=W.dilationWidth,Re=W.effectiveFilterHeight,Pe=W.effectiveFilterWidth,je=Pe-1-W.padInfo.left,Ge=Re-1-W.padInfo.top,rt=Qi(w.shape,"float32"),nt=this.bufferSync(Q),lt=this.bufferSync(p),Nt=0;Nt<W.batchSize;++Nt)for(var Rt=0;Rt<W.inChannels;++Rt)for(var Pt=0;Pt<W.inHeight;++Pt)for(var Kt=0;Kt<W.inWidth;++Kt){for(var dn=Pt-Ge,bn=Kt-je,pn=0,_n=0;_n<Re;_n+=ye){var On=(dn+_n)/ie;if(!(On<0||On>=W.outHeight||Math.floor(On)!==On))for(var _=0;_<Pe;_+=Oe){var m=(bn+_)/fe;if(!(m<0||m>=W.outWidth||Math.floor(m)!==m)){var f=Re*Pe-1-nt.get(Nt,On,m,Rt)===_n*Pe+_?1:0;f!==0&&(pn+=lt.get(Nt,On,m,Rt)*f)}}}rt.set(pn,Nt,Pt,Kt,Rt)}return rt.toTensor()},x.prototype.avgPoolBackprop=function(p,w,D){Gr([p,w],"avgPoolBackprop");for(var W=D.strideHeight,Q=D.strideWidth,ie=D.filterHeight,fe=D.filterWidth,ye=D.dilationHeight,Oe=D.dilationWidth,Re=D.effectiveFilterHeight,Pe=D.effectiveFilterWidth,je=Pe-1-D.padInfo.left,Ge=Re-1-D.padInfo.top,rt=Qi(w.shape,"float32"),nt=1/(ie*fe),lt=this.bufferSync(p),Nt=0;Nt<D.batchSize;++Nt)for(var Rt=0;Rt<D.inChannels;++Rt)for(var Pt=0;Pt<D.inHeight;++Pt)for(var Kt=0;Kt<D.inWidth;++Kt){for(var dn=Pt-Ge,bn=Kt-je,pn=0,_n=0;_n<Re;_n+=ye){var On=(dn+_n)/W;if(!(On<0||On>=D.outHeight||Math.floor(On)!==On))for(var _=0;_<Pe;_+=Oe){var m=(bn+_)/Q;m<0||m>=D.outWidth||Math.floor(m)!==m||(pn+=lt.get(Nt,On,m,Rt))}}rt.set(pn*nt,Nt,Pt,Kt,Rt)}return rt.toTensor()},x.prototype.pool3d=function(p,w,D){Gr(p,"pool3d");for(var W=w.strideDepth,Q=w.strideHeight,ie=w.strideWidth,fe=w.dilationDepth,ye=w.dilationHeight,Oe=w.dilationWidth,Re=w.effectiveFilterDepth,Pe=w.effectiveFilterHeight,je=w.effectiveFilterWidth,Ge=w.padInfo.front,rt=w.padInfo.top,nt=w.padInfo.left,lt=D==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,Nt=this.readSync(p.dataId),Rt=Qi(w.outShape,p.dtype),Pt=Rt.values,Kt=w.outShape[1]*w.outShape[2]*w.outShape[3]*w.outShape[4],dn=w.outShape[2]*w.outShape[3]*w.outShape[4],bn=w.outShape[3]*w.outShape[4],pn=w.outShape[4],_n=0;_n<w.batchSize;++_n)for(var On=_n*Kt,_=_n*p.strides[0],m=0;m<w.inChannels;++m)for(var f=0;f<w.outDepth;++f){for(var y=f*W-Ge,E=y;E<0;)E+=fe;for(var z=Math.min(w.inDepth,Re+y),Y=On+f*dn,Z=0;Z<w.outHeight;++Z){for(var le=Z*Q-rt,de=le;de<0;)de+=ye;for(var we=Math.min(w.inHeight,Pe+le),De=Y+Z*bn,Ne=0;Ne<w.outWidth;++Ne){for(var Fe=Ne*ie-nt,Ve=Fe;Ve<0;)Ve+=Oe;for(var Je=Math.min(w.inWidth,je+Fe),Xe=De+Ne*pn,ot=lt,xt=0,kt=0,At=E;At<z;At+=fe){for(var Lt=_+At*p.strides[1],tn=de;tn<we;tn+=ye){for(var ln=Lt+tn*p.strides[2],nn=Ve;nn<Je;nn+=Oe){var cn=Nt[ln+nn*p.strides[3]+m];if(D==="max"&&cn>ot?ot=cn:D==="avg"&&(xt+=cn,kt++),isNaN(ot))break}if(isNaN(ot))break}if(isNaN(ot))break}Pt[Xe+m]=D==="avg"?xt/kt:ot}}}return Rt.toTensor()},x.prototype.avgPool3d=function(p,w){return Gr(p,"avgPool3d"),this.pool3d(p,w,"avg").toFloat()},x.prototype.avgPool3dBackprop=function(p,w,D){Gr([p,w],"avgPool3dBackprop");for(var W=D.strideDepth,Q=D.strideHeight,ie=D.strideWidth,fe=D.filterDepth,ye=D.filterHeight,Oe=D.filterWidth,Re=D.dilationDepth,Pe=D.dilationHeight,je=D.dilationWidth,Ge=D.effectiveFilterDepth,rt=D.effectiveFilterHeight,nt=D.effectiveFilterWidth,lt=Ge-1-D.padInfo.front,Nt=nt-1-D.padInfo.left,Rt=rt-1-D.padInfo.top,Pt=Qi(w.shape,"float32"),Kt=1/(fe*ye*Oe),dn=this.bufferSync(p),bn=0;bn<D.batchSize;++bn)for(var pn=0;pn<D.inChannels;++pn)for(var _n=0;_n<D.inDepth;++_n)for(var On=0;On<D.inHeight;++On)for(var _=0;_<D.inWidth;++_){for(var m=_n-lt,f=On-Rt,y=_-Nt,E=0,z=0;z<Ge;z+=Re){var Y=(m+z)/W;if(!(Y<0||Y>=D.outDepth||Math.floor(Y)!==Y))for(var Z=0;Z<rt;Z+=Pe){var le=(f+Z)/Q;if(!(le<0||le>=D.outHeight||Math.floor(le)!==le))for(var de=0;de<nt;de+=je){var we=(y+de)/ie;we<0||we>=D.outWidth||Math.floor(we)!==we||(E+=dn.get(bn,Y,le,we,pn))}}}Pt.set(E*Kt,bn,_n,On,_,pn)}return Pt.toTensor()},x.prototype.maxPool3d=function(p,w){return Gr(p,"maxPool3d"),this.pool3d(p,w,"max").toFloat()},x.prototype.maxPool3dPositions=function(p,w){for(var D=Qi(w.outShape,"int32"),W=w.strideDepth,Q=w.strideHeight,ie=w.strideWidth,fe=w.dilationDepth,ye=w.dilationHeight,Oe=w.dilationWidth,Re=w.effectiveFilterDepth,Pe=w.effectiveFilterHeight,je=w.effectiveFilterWidth,Ge=w.padInfo.front,rt=w.padInfo.top,nt=w.padInfo.left,lt=this.bufferSync(p),Nt=0;Nt<w.batchSize;++Nt)for(var Rt=0;Rt<w.inChannels;++Rt)for(var Pt=0;Pt<w.outDepth;++Pt){for(var Kt=Pt*W-Ge,dn=Kt;dn<0;)dn+=fe;for(var bn=Math.min(w.inDepth,Re+Kt),pn=0;pn<w.outHeight;++pn){for(var _n=pn*Q-rt,On=_n;On<0;)On+=ye;for(var _=Math.min(w.inHeight,Pe+_n),m=0;m<w.outWidth;++m){for(var f=m*ie-nt,y=f;y<0;)y+=Oe;for(var E=Math.min(w.inWidth,je+f),z=Number.NEGATIVE_INFINITY,Y=-1,Z=dn;Z<bn;Z+=fe)for(var le=Z-Kt,de=On;de<_;de+=ye)for(var we=de-_n,De=y;De<E;De+=Oe){var Ne=De-f,Fe=lt.get(Nt,Z,de,De,Rt);Fe>=z&&(z=Fe,Y=le*Pe*je+we*Pe+Ne)}D.set(Y,Nt,Pt,pn,m,Rt)}}}return D.toTensor()},x.prototype.maxPool3dBackprop=function(p,w,D,W){Gr([w,D],"maxPool3dBackprop");for(var Q=this.maxPool3dPositions(w,W),ie=W.strideDepth,fe=W.strideHeight,ye=W.strideWidth,Oe=W.dilationDepth,Re=W.dilationHeight,Pe=W.dilationWidth,je=W.effectiveFilterDepth,Ge=W.effectiveFilterHeight,rt=W.effectiveFilterWidth,nt=je-1-W.padInfo.front,lt=rt-1-W.padInfo.left,Nt=Ge-1-W.padInfo.top,Rt=Qi(w.shape,"float32"),Pt=this.bufferSync(Q),Kt=this.bufferSync(p),dn=0;dn<W.batchSize;++dn)for(var bn=0;bn<W.inChannels;++bn)for(var pn=0;pn<W.inDepth;++pn)for(var _n=0;_n<W.inHeight;++_n)for(var On=0;On<W.inWidth;++On){for(var _=pn-nt,m=_n-Nt,f=On-lt,y=0,E=0;E<je;E+=Oe){var z=(_+E)/ie;if(!(z<0||z>=W.outDepth||Math.floor(z)!==z))for(var Y=0;Y<Ge;Y+=Re){var Z=(m+Y)/fe;if(!(Z<0||Z>=W.outHeight||Math.floor(Z)!==Z))for(var le=0;le<rt;le+=Pe){var de=(f+le)/ye;if(!(de<0||de>=W.outWidth||Math.floor(de)!==de)){var we=je*Ge*rt-1-Pt.get(dn,z,Z,de,bn)===E*Ge*rt+Y*rt+le?1:0;we!==0&&(y+=Kt.get(dn,z,Z,de,bn)*we)}}}}Rt.set(y,dn,pn,_n,On,bn)}return Rt.toTensor()},x.prototype.cast=function(p,w){return Ku(p,w,this)},x.prototype.reshape=function(p,w){return Fc(p,w)},x.prototype.avgPool=function(p,w){return Gr(p,"avgPool"),this.pool(p,w,"avg").toFloat()},x.prototype.resizeBilinear=function(p,w,D,W){Gr(p,"resizeBilinear");for(var Q=p.shape,ie=Q[0],fe=Q[1],ye=Q[2],Oe=Q[3],Re=this.readSync(p.dataId),Pe=new Float32Array(Ke([ie,w,D,Oe])),je=[W&&w>1?fe-1:fe,W&&D>1?ye-1:ye],Ge=[W&&w>1?w-1:w,W&&D>1?D-1:D],rt=0,nt=je[0]/Ge[0],lt=je[1]/Ge[1],Nt=0;Nt<ie;Nt++)for(var Rt=0;Rt<w;Rt++)for(var Pt=nt*Rt,Kt=Math.floor(Pt),dn=Pt-Kt,bn=Math.min(fe-1,Math.ceil(Pt)),pn=Nt*p.strides[0]+Kt*p.strides[1],_n=Nt*p.strides[0]+bn*p.strides[1],On=0;On<D;On++)for(var _=lt*On,m=Math.floor(_),f=_-m,y=Math.min(ye-1,Math.ceil(_)),E=pn+m*p.strides[2],z=_n+m*p.strides[2],Y=pn+y*p.strides[2],Z=_n+y*p.strides[2],le=0;le<Oe;le++){var de=Re[E+le],we=Re[z+le],De=de+(Re[Y+le]-de)*f,Ne=De+(we+(Re[Z+le]-we)*f-De)*dn;Pe[rt++]=Ne}return Qo(Pe,[ie,w,D,Oe])},x.prototype.resizeBilinearBackprop=function(p,w,D){Gr([p,w],"resizeBilinearBackprop");for(var W=w.shape,Q=W[0],ie=W[1],fe=W[2],ye=W[3],Oe=p.shape,Re=Oe[1],Pe=Oe[2],je=new Float32Array(Q*ie*fe*ye),Ge=[D&&Re>1?ie-1:ie,D&&Pe>1?fe-1:fe],rt=[D&&Re>1?Re-1:Re,D&&Pe>1?Pe-1:Pe],nt=Ge[0]/rt[0],lt=Ge[1]/rt[1],Nt=this.readSync(p.dataId),Rt=0,Pt=0;Pt<Q;Pt++)for(var Kt=Pt*w.strides[0],dn=0;dn<Re;dn++)for(var bn=dn*nt,pn=Math.floor(bn),_n=Math.min(Math.ceil(bn),ie-1),On=Kt+pn*w.strides[1],_=Kt+_n*w.strides[1],m=bn-pn,f=1-m,y=0;y<Pe;y++)for(var E=y*lt,z=Math.floor(E),Y=Math.min(Math.ceil(E),fe-1),Z=E-z,le=1-Z,de=On+z*w.strides[2],we=On+Y*w.strides[2],De=_+z*w.strides[2],Ne=_+Y*w.strides[2],Fe=f*le,Ve=f*Z,Je=m*le,Xe=m*Z,ot=0;ot<ye;ot++){var xt=Nt[Rt++];je[de+ot]+=xt*Fe,je[we+ot]+=xt*Ve,je[De+ot]+=xt*Je,je[Ne+ot]+=xt*Xe}return $u(je,[Q,fe,ie,ye],w.dtype)},x.prototype.resizeNearestNeighbor=function(p,w,D,W){Gr(p,"resizeNearestNeighbor");for(var Q=p.shape,ie=Q[0],fe=Q[1],ye=Q[2],Oe=Q[3],Re=this.readSync(p.dataId),Pe=new Float32Array(ie*w*D*Oe),je=[W&&w>1?fe-1:fe,W&&D>1?ye-1:ye],Ge=[W&&w>1?w-1:w,W&&D>1?D-1:D],rt=je[0]/Ge[0],nt=je[1]/Ge[1],lt=0,Nt=0;Nt<ie;Nt++)for(var Rt=Nt*p.strides[0],Pt=0;Pt<w;Pt++)for(var Kt=rt*Pt,dn=Rt+Math.min(fe-1,W?Math.round(Kt):Math.floor(Kt))*p.strides[1],bn=0;bn<D;bn++)for(var pn=nt*bn,_n=dn+Math.min(ye-1,W?Math.round(pn):Math.floor(pn))*p.strides[2],On=0;On<Oe;On++){var _=Re[_n+On];Pe[lt++]=_}return Qo(Pe,[ie,w,D,Oe],p.dtype)},x.prototype.resizeNearestNeighborBackprop=function(p,w,D){Gr([p,w],"resizeNearestNeighborBackprop");for(var W=w.shape,Q=W[0],ie=W[1],fe=W[2],ye=W[3],Oe=p.shape,Re=Oe[1],Pe=Oe[2],je=new Float32Array(Q*ie*fe*ye),Ge=this.readSync(p.dataId),rt=[D&&Re>1?ie-1:ie,D&&Pe>1?fe-1:fe],nt=[D&&Re>1?Re-1:Re,D&&Pe>1?Pe-1:Pe],lt=rt[0]/nt[0],Nt=rt[1]/nt[1],Rt=1/lt,Pt=1/Nt,Kt=2*Math.ceil(Rt)+2,dn=2*Math.ceil(Pt)+2,bn=0;bn<Q;bn++)for(var pn=bn*w.strides[0],_n=0;_n<ie;_n++)for(var On=pn+_n*w.strides[1],_=Math.floor(_n*Rt),m=Math.floor(_-Kt/2),f=0;f<fe;f++)for(var y=On+f*w.strides[2],E=Math.floor(f*Pt),z=Math.floor(E-dn/2),Y=0;Y<ye;Y++){for(var Z=0,le=0;le<Kt;le++){var de=le+m;if(!(de<0||de>=Re)){var we=pn+de*p.strides[1],De=de*lt;if(_n===Math.min(ie-1,D?Math.round(De):Math.floor(De)))for(var Ne=0;Ne<dn;Ne++){var Fe=Ne+z;if(!(Fe<0||Fe>=Pe)){var Ve=we+Fe*p.strides[2],Je=Fe*Nt;f===Math.min(fe-1,D?Math.round(Je):Math.floor(Je))&&(Z+=Ge[Ve+Y])}}}}je[y+Y]=Z}return $u(je,w.shape,w.dtype)},x.prototype.batchNormalization=function(p,w,D,W,Q,ie){Gr([p,w,D,Q,ie],"batchNorm");for(var fe=this.readSync(p.dataId),ye=this.readSync(w.dataId),Oe=this.readSync(D.dataId),Re=Q?this.readSync(Q.dataId):new Float32Array([1]),Pe=ie?this.readSync(ie.dataId):new Float32Array([0]),je=new Float32Array(fe.length),Ge=Pe.length,rt=Re.length,nt=Oe.length,lt=ye.length,Nt=0,Rt=0,Pt=0,Kt=0,dn=0;dn<fe.length;++dn)je[dn]=Pe[Nt++]+(fe[dn]-ye[Rt++])*Re[Pt++]/Math.sqrt(Oe[Kt++]+W),Nt>=Ge&&(Nt=0),Rt>=lt&&(Rt=0),Pt>=rt&&(Pt=0),Kt>=nt&&(Kt=0);return $u(je,p.shape)},x.prototype.localResponseNormalization4D=function(p,w,D,W,Q){Gr(p,"localResponseNormalization4D");var ie=p.shape[3],fe=ie-1,ye=this.readSync(p.dataId),Oe=p.size,Re=new Float32Array(Oe);function Pe(nt){for(var lt=nt%ie,Nt=nt-lt+Math.max(0,lt-w),Rt=nt-lt+Math.min(lt+w,fe),Pt=0;Nt<=Rt;Nt++){var Kt=ye[Nt];Pt+=Kt*Kt}return Pt}for(var je=0;je<Oe;je++){var Ge=Pe(je),rt=ye[je]*Math.pow(D+W*Ge,-Q);Re[je]=rt}return $u(Re,p.shape)},x.prototype.LRNGrad=function(p,w,D,W,Q,ie,fe){Gr(p,"LRNGrad");for(var ye=p.shape[3],Oe=this.readSync(p.dataId),Re=this.readSync(w.dataId),Pe=this.readSync(D.dataId),je=new Float32Array(p.size),Ge=p.size,rt=0;rt<Ge;rt++){for(var nt=rt%ye,lt=rt-nt+Math.max(0,nt-W),Nt=rt-nt+Math.min(ye,nt+W+1),Rt=0,Pt=lt;Pt<Nt;Pt++)Rt+=Math.pow(Re[Pt],2);for(Rt=ie*Rt+Q,Pt=lt;Pt<Nt;Pt++){var Kt=-2*ie*fe*Re[Pt]*Pe[rt]/Rt;rt===Pt&&(Kt+=Math.pow(Rt,-fe)),Kt*=Oe[rt],je[Pt]+=Kt}}return $u(je,p.shape)},x.prototype.multinomial=function(p,w,D,W){Gr(p,"multinomial");for(var Q=w?p:Eu(p),ie=Q.shape[0],fe=Q.shape[1],ye=go([ie,D],"int32"),Oe=this.readSync(ye.dataId),Re=this.readSync(Q.dataId),Pe=0;Pe<ie;++Pe){var je=Pe*fe,Ge=new Float32Array(fe-1);Ge[0]=Re[je];for(var rt=1;rt<Ge.length;++rt)Ge[rt]=Ge[rt-1]+Re[je+rt];for(var nt=xf(W.toString()),lt=Pe*D,Nt=0;Nt<D;++Nt){var Rt=nt();Oe[lt+Nt]=Ge.length;for(var Pt=0;Pt<Ge.length;Pt++)if(Rt<Ge[Pt]){Oe[lt+Nt]=Pt;break}}}return ye},x.prototype.oneHot=function(p,w,D,W){Gr(p,"oneHot");var Q=new Float32Array(p.size*w);Q.fill(W);for(var ie=this.readSync(p.dataId),fe=0;fe<p.size;++fe)ie[fe]>=0&&ie[fe]<w&&(Q[fe*w+ie[fe]]=D);return uc(Q,[p.size,w],"int32")},x.prototype.nonMaxSuppression=function(p,w,D,W,Q){return Gr(p,"nonMaxSuppression"),Bc(this.readSync(p.dataId),this.readSync(w.dataId),D,W,Q)},x.prototype.fft=function(p){return this.fftBatch(p,!1)},x.prototype.ifft=function(p){return this.fftBatch(p,!0)},x.prototype.fftBatch=function(p,w){for(var D=p.shape[0],W=p.shape[1],Q=Qi(p.shape,"float32"),ie=Qi(p.shape,"float32"),fe=qa(p).as2D(D,W),ye=Os(p).as2D(D,W),Oe=0;Oe<D;Oe++)for(var Re=fe.slice([Oe,0],[1,W]),Pe=ye.slice([Oe,0],[1,W]),je=zo(Re,Pe),Ge=this.readSync(this.fftImpl(je,w).dataId),rt=0;rt<W;rt++){var nt=Cf(Ge,rt);Q.values[Oe*W+rt]=nt.real,ie.values[Oe*W+rt]=nt.imag}return zo(Q.toTensor(),ie.toTensor()).as2D(D,W)},x.prototype.fftImpl=function(p,w){var D=p.as1D(),W=D.size;if(this.isExponentOf2(W)){var Q=this.fftRadix2(D,W,w).as2D(p.shape[0],p.shape[1]);return w&&(Q=zo(qa(Q).div(Or(W)),Os(Q).div(Or(W)))),Q}var ie=this.readSync(p.dataId),fe=function(ye){for(var Oe=new Float32Array(ye.length/2),Re=new Float32Array(ye.length/2),Pe=0;Pe<ye.length;Pe+=2)Oe[Pe/2]=ye[Pe],Re[Pe/2]=ye[Pe+1];return{real:Oe,imag:Re}}(this.fourierTransformByMatmul(ie,W,w));return zo(fe.real,fe.imag).as2D(p.shape[0],p.shape[1])},x.prototype.isExponentOf2=function(p){return(p&p-1)==0},x.prototype.fftRadix2=function(p,w,D){if(w===1)return p;var W=this.readSync(p.dataId),Q=w/2,ie=function(lt){for(var Nt=Math.ceil(lt.length/4),Rt=new Float32Array(Nt),Pt=new Float32Array(Nt),Kt=0;Kt<lt.length;Kt+=4)Rt[Math.floor(Kt/4)]=lt[Kt],Pt[Math.floor(Kt/4)]=lt[Kt+1];return{real:Rt,imag:Pt}}(W),fe=zo(ie.real,ie.imag).as1D(),ye=function(lt){for(var Nt=Math.floor(lt.length/4),Rt=new Float32Array(Nt),Pt=new Float32Array(Nt),Kt=2;Kt<lt.length;Kt+=4)Rt[Math.floor(Kt/4)]=lt[Kt],Pt[Math.floor(Kt/4)]=lt[Kt+1];return{real:Rt,imag:Pt}}(W),Oe=zo(ye.real,ye.imag).as1D();fe=this.fftRadix2(fe,Q,D),Oe=this.fftRadix2(Oe,Q,D);var Re=function(lt,Nt){for(var Rt=new Float32Array(lt/2),Pt=new Float32Array(lt/2),Kt=0;Kt<Math.ceil(lt/2);Kt++){var dn=(Nt?2:-2)*Math.PI*(Kt/lt);Rt[Kt]=Math.cos(dn),Pt[Kt]=Math.sin(dn)}return{real:Rt,imag:Pt}}(w,D),Pe=zo(Re.real,Re.imag).mul(Oe),je=fe.add(Pe),Ge=fe.sub(Pe),rt=qa(je).concat(qa(Ge)),nt=Os(je).concat(Os(Ge));return zo(rt,nt).as1D()},x.prototype.fourierTransformByMatmul=function(p,w,D){for(var W=new Float32Array(2*w),Q=0;Q<w;Q++){for(var ie=0,fe=0,ye=0;ye<w;ye++){var Oe=Mp(Q*ye,w,D),Re=Cf(p,ye);ie+=Re.real*Oe.real-Re.imag*Oe.imag,fe+=Re.real*Oe.imag+Re.imag*Oe.real}D&&(ie/=w,fe/=w),Sf(W,ie,fe,Q)}return W},x.prototype.depthToSpace=function(p,w,D){Ee(D==="NHWC",function(){return"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+D}),Ee(w>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+w});for(var W=p.shape[0],Q=p.shape[1],ie=p.shape[2],fe=p.shape[3],ye=Q*w,Oe=ie*w,Re=fe/(w*w),Pe=this.readSync(p.dataId),je=new Float32Array(W*ye*Oe*Re),Ge=0,rt=0;rt<W;++rt)for(var nt=0;nt<ye;++nt)for(var lt=Math.floor(nt/w),Nt=nt%w,Rt=0;Rt<Oe;++Rt)for(var Pt=Math.floor(Rt/w),Kt=(Nt*w+Rt%w)*Re,dn=0;dn<Re;++dn){var bn=dn+Kt+fe*(Pt+ie*(lt+Q*rt));je[Ge++]=Pe[bn]}return $u(je,[W,ye,Oe,Re])},x.prototype.broadcastedBinaryOp=function(p,w,D,W){var Q=ho(p.shape,w.shape),ie=Qi(Q,D),fe=this.readSync(p.dataId),ye=this.readSync(w.dataId),Oe=js(p.shape,Q),Re=js(w.shape,Q),Pe=ie.values;if(Oe.length+Re.length===0)for(var je=0;je<Pe.length;++je)Pe[je]=W(fe[je%fe.length],ye[je%ye.length]);else{var Ge=this.bufferSync(p),rt=this.bufferSync(w),nt=function(lt){var Nt=ie.indexToLoc(lt),Rt=Nt.slice(-p.rank);Oe.forEach(function(bn){return Rt[bn]=0});var Pt=Ge.locToIndex(Rt),Kt=Nt.slice(-w.rank);Re.forEach(function(bn){return Kt[bn]=0});var dn=rt.locToIndex(Kt);Pe[lt]=W(fe[Pt],ye[dn])};for(je=0;je<Pe.length;++je)nt(je)}return ie.toTensor()},x.prototype.broadcastedBinaryComplexOp=function(p,w,D){var W=ho(p.shape,w.shape),Q=Qi(W,"float32"),ie=Qi(W,"float32"),fe=this.readSync(p.dataId),ye=this.readSync(w.dataId),Oe=js(p.shape,W),Re=js(w.shape,W),Pe=Q.values,je=ie.values;if(Oe.length+Re.length===0)for(var Ge=0;Ge<Pe.length;Ge++){var rt=Ge%fe.length,nt=Ge%ye.length,lt=D(fe[2*rt],fe[2*rt+1],ye[2*nt],ye[2*nt+1]);Pe[Ge]=lt.real,je[Ge]=lt.imag}else{var Nt=this.bufferSync(this.data.get(p.dataId).complexTensors.real),Rt=this.bufferSync(this.data.get(w.dataId).complexTensors.real),Pt=function(Kt){var dn=Q.indexToLoc(Kt),bn=dn.slice(-p.rank);Oe.forEach(function(m){return bn[m]=0});var pn=Nt.locToIndex(bn),_n=dn.slice(-w.rank);Re.forEach(function(m){return _n[m]=0});var On=Rt.locToIndex(_n),_=D(fe[2*pn],fe[2*pn+1],ye[2*On],ye[2*On+1]);Pe[Kt]=_.real,je[Kt]=_.imag};for(Ge=0;Ge<Pe.length;Ge++)Pt(Ge)}return this.complex(Q.toTensor(),ie.toTensor())},x.prototype.split=function(p,w,D){return vd(p,w,D)},x.prototype.dispose=function(){},x.prototype.floatPrecision=function(){return 32},x.prototype.epsilon=function(){return 1e-7},x.prototype.cropAndResize=function(p,w,D,W,Q,ie){for(var fe=p.shape,ye=fe[0],Oe=fe[1],Re=fe[2],Pe=fe[3],je=w.shape[0],Ge=W[0],rt=W[1],nt=Qi([je,Ge,rt,Pe],"float32"),lt=this.readSync(w.dataId),Nt=this.readSync(D.dataId),Rt=this.readSync(p.dataId),Pt=p.strides,Kt=nt.strides,dn=0;dn<je;dn++){var bn=4*dn,pn=lt[bn],_n=lt[bn+1],On=lt[bn+2],_=lt[bn+3],m=Nt[dn];if(!(m>=ye))for(var f=Ge>1?(On-pn)*(Oe-1)/(Ge-1):0,y=rt>1?(_-_n)*(Re-1)/(rt-1):0,E=0;E<Ge;E++){var z=Ge>1?pn*(Oe-1)+E*f:.5*(pn+On)*(Oe-1);if(z<0||z>Oe-1)for(var Y=0;Y<rt;Y++)for(var Z=0;Z<Pe;Z++){var le=Z+Y*Kt[2]+E*Kt[1]+dn*Kt[0];nt.values[le]=ie}else if(Q==="bilinear"){var de=Math.floor(z),we=Math.ceil(z),De=z-de;for(Y=0;Y<rt;Y++)if((At=rt>1?_n*(Re-1)+Y*y:.5*(_n+_)*(Re-1))<0||At>Re-1)for(Z=0;Z<Pe;Z++)le=Z+Y*Kt[2]+E*Kt[1]+dn*Kt[0],nt.values[le]=ie;else{var Ne=Math.floor(At),Fe=Math.ceil(At),Ve=At-Ne;for(Z=0;Z<Pe;Z++){var Je=Rt[le=Z+Ne*Pt[2]+de*Pt[1]+m*Pt[0]],Xe=Rt[le=Z+Fe*Pt[2]+de*Pt[1]+m*Pt[0]],ot=Rt[le=Z+Ne*Pt[2]+we*Pt[1]+m*Pt[0]],xt=Je+(Xe-Je)*Ve,kt=ot+(Rt[le=Z+Fe*Pt[2]+we*Pt[1]+m*Pt[0]]-ot)*Ve;le=Z+Y*Kt[2]+E*Kt[1]+dn*Kt[0],nt.values[le]=xt+(kt-xt)*De}}}else for(Y=0;Y<rt;++Y){var At;if((At=rt>1?_n*(Re-1)+Y*y:.5*(_n+_)*(Re-1))<0||At>Re-1)for(Z=0;Z<Pe;Z++)le=Z+Y*Kt[2]+E*Kt[1]+dn*Kt[0],nt.values[le]=ie;else{var Lt=Math.round(At),tn=Math.round(z);for(Z=0;Z<Pe;Z++){var ln=Z+Lt*Pt[2]+tn*Pt[1]+m*Pt[0],nn=Z+Y*Kt[2]+E*Kt[1]+dn*Kt[0];nt.values[nn]=Rt[ln]}}}}}return nt.toTensor()},x.prototype.sparseToDense=function(p,w,D,W){var Q=Ef(0,p,D),ie=Q.sliceRank,fe=Q.numUpdates,ye=Q.sliceSize,Oe=Q.strides,Re=Q.outputSize;return this.scatter(p,w,D,Re,ye,fe,ie,Oe,W,!1)},x.prototype.gatherND=function(p,w){var D=w.shape,W=D[D.length-1],Q=nl(p,w),ie=Q[0],fe=Q[1],ye=Q[2],Oe=Q[3];if(fe===0)return Qo([],ie,p.dtype);for(var Re=new co([fe,ye],p.dtype),Pe=this.readSync(w.dataId),je=this.readSync(p.dataId),Ge=0;Ge<fe;Ge++){for(var rt=[],nt=0,lt=0;lt<W;lt++){var Nt=Pe[Ge*W+lt];nt+=Nt*Oe[lt],rt.push(Nt)}if(nt<0||nt>=p.size/ye)throw new Error("Invalid indices: "+rt+" does not index into "+p.shape);for(var Rt=0;Rt<ye;Rt++)Re.values[Ge*ye+Rt]=je[nt*ye+Rt]}return Re.toTensor().reshape(ie)},x.prototype.scatterND=function(p,w,D){var W=Ef(0,p,D),Q=W.sliceRank,ie=W.numUpdates,fe=W.sliceSize,ye=W.strides,Oe=W.outputSize,Re=Or(0);return this.scatter(p,w,D,Oe,fe,ie,Q,ye,Re,!0)},x.prototype.fill=function(p,w,D){var W=Yt(D=D||xe(w),Ke(p));return W.fill(w),qe.makeTensor(W,p,D,this)},x.prototype.onesLike=function(p){if(p.dtype==="string")throw new Error("onesLike is not supported for string tensors");return this.fill(p.shape,1,p.dtype)},x.prototype.zerosLike=function(p){var w=Yt(p.dtype,Ke(p.shape));return this.makeOutput(w,p.shape,p.dtype)},x.prototype.linspace=function(p,w,D){return il(p,w,D)},x.prototype.scatter=function(p,w,D,W,Q,ie,fe,ye,Oe,Re){var Pe=[W/Q,Q],je=this.readSync(p.dataId),Ge=this.readSync(w.dataId);if(W===0)return Qo([],D,w.dtype);var rt=new co(Pe,w.dtype);rt.values.fill(this.readSync(Oe.dataId)[0]);for(var nt=0;nt<ie;nt++){for(var lt=[],Nt=0,Rt=0;Rt<fe;Rt++){var Pt=je[nt*fe+Rt];lt.push(Pt),Nt+=Pt*ye[Rt]}if(Nt<0||Nt>=W/Q)throw new Error("Invalid indices: "+lt+" does not index into "+D);for(var Kt=0;Kt<Q;Kt++)Re?rt.values[Nt*Q+Kt]+=Ge[nt*Q+Kt]:rt.values[Nt*Q+Kt]=w.rank===0?Ge[0]:Ge[nt*Q+Kt]}return rt.toTensor().reshape(D)},x}(gh);qe.registerBackend("cpu",function(){return new R},1);for(var F=0,I=[{kernelName:"NonMaxSuppressionV5",backendName:"cpu",kernelFunc:function(C){var x=C.inputs,p=C.backend,w=C.attrs,D=x,W=D.boxes,Q=D.scores,ie=w,fe=ie.maxOutputSize,ye=ie.iouThreshold,Oe=ie.scoreThreshold,Re=ie.softNmsSigma,Pe=p;Gr(W,"NonMaxSuppressionWithScore");var je=Pc(Pe.data.get(W.dataId).values,Pe.data.get(Q.dataId).values,fe,ye,Oe,Re);return[je.selectedIndices,je.selectedScores]}},{kernelName:"Square",backendName:"cpu",kernelFunc:function(C){var x=C.inputs,p=C.backend,w=x.x,D=p;Gr(w,"square");for(var W=D.data.get(w.dataId).values,Q=new Float32Array(W.length),ie=0;ie<W.length;++ie){var fe=W[ie];Q[ie]=fe*fe}return{dataId:D.write(Q,w.shape,w.dtype),shape:w.shape,dtype:w.dtype}}},{kernelName:Rp,backendName:"cpu",kernelFunc:function(C){var x=C.inputs,p=C.backend,w=x,D=w.a,W=w.b,Q=p;Gr([D,W],Rp);var ie=Q.data.get(D.dataId).values,fe=Q.data.get(W.dataId).values,ye=function(Pe,je,Ge,rt,nt,lt){var Nt=ho(Pe,je),Rt=Nt.length,Pt=ar(Nt),Kt=yn(nt,Ke(Nt)),dn=Pe.length,bn=je.length,pn=ar(Pe),_n=ar(je),On=js(Pe,Nt),_=js(je,Nt);if(On.length+_.length===0)for(var m=0;m<Kt.length;++m)Kt[m]=lt(Ge[m%Ge.length],rt[m%rt.length]);else{var f=function(y){var E=xr(y,Rt,Pt),z=E.slice(-dn);On.forEach(function(de){return z[de]=0});var Y=Dr(z,dn,pn),Z=E.slice(-bn);_.forEach(function(de){return Z[de]=0});var le=Dr(Z,bn,_n);Kt[y]=lt(Ge[Y],rt[le])};for(m=0;m<Kt.length;++m)f(m)}return[Kt,Nt]}(D.shape,W.shape,ie,fe,D.dtype,function(Pe,je){var Ge=Pe-je;return Ge*Ge}),Oe=ye[0],Re=ye[1];return{dataId:Q.write(Oe,Re,D.dtype),shape:Re,dtype:D.dtype}}}];F<I.length;F++)ce(I[F]);for(var U,X=0,oe=[{kernelName:"FromPixels",backendName:"webgl",kernelFunc:function(C){var x=C.inputs,p=C.backend,w=C.attrs,D=x.pixels,W=w.numChannels,Q=typeof HTMLVideoElement<"u"&&D instanceof HTMLVideoElement,ie=typeof HTMLImageElement<"u"&&D instanceof HTMLImageElement,fe=Q?[D.videoWidth,D.videoHeight]:[D.width,D.height],ye=fe[0],Oe=fe[1],Re=[Oe,ye],Pe=[Oe,ye,W];(ie||Q)&&(U==null&&(U=document.createElement("canvas").getContext("2d")),U.canvas.width=ye,U.canvas.height=Oe,U.drawImage(D,0,0,ye,Oe),D=U.canvas);var je=p.makeTensorInfo(Re,"int32");p.texData.get(je.dataId).usage=pr.PIXELS,p.gpgpu.uploadPixelDataToTexture(p.getTexture(je.dataId),D);var Ge=L().getBool("WEBGL_PACK")?new function(nt){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var lt=ue(),Nt=nt[0],Rt=nt[1];this.outputShape=nt,this.userCode=` 7608 void main() { 7609 ivec3 coords = getOutputCoords(); 7610 int texR = coords[0]; 7611 int texC = coords[1]; 7612 int depth = coords[2]; 7613 7614 vec4 result = vec4(0.); 7615 7616 for(int row=0; row<=1; row++) { 7617 for(int col=0; col<=1; col++) { 7618 texC = coords[1] + row; 7619 depth = coords[2] + col; 7620 7621 vec2 uv = (vec2(texC, texR) + halfCR) / 7622 vec2(`+Rt+".0, "+Nt+`.0); 7623 vec4 values = `+lt.texture2D+`(A, uv); 7624 float value; 7625 if (depth == 0) { 7626 value = values.r; 7627 } else if (depth == 1) { 7628 value = values.g; 7629 } else if (depth == 2) { 7630 value = values.b; 7631 } else if (depth == 3) { 7632 value = values.a; 7633 } 7634 7635 result[row * 2 + col] = floor(value * 255.0 + 0.5); 7636 } 7637 } 7638 7639 `+lt.output+` = result; 7640 } 7641 `}(Pe):new function(nt){this.variableNames=["A"];var lt=ue(),Nt=nt[0],Rt=nt[1];this.outputShape=nt,this.userCode=` 7642 void main() { 7643 ivec3 coords = getOutputCoords(); 7644 int texR = coords[0]; 7645 int texC = coords[1]; 7646 int depth = coords[2]; 7647 vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+Rt+".0, "+Nt+`.0); 7648 7649 vec4 values = `+lt.texture2D+`(A, uv); 7650 float value; 7651 if (depth == 0) { 7652 value = values.r; 7653 } else if (depth == 1) { 7654 value = values.g; 7655 } else if (depth == 2) { 7656 value = values.b; 7657 } else if (depth == 3) { 7658 value = values.a; 7659 } 7660 7661 setOutput(floor(value * 255.0 + 0.5)); 7662 } 7663 `}(Pe),rt=p.runWebGLProgram(Ge,[je],"int32");return p.disposeData(je.dataId),rt}},{kernelName:"NonMaxSuppressionV5",backendName:"webgl",kernelFunc:function(C){var x=C.inputs,p=C.backend,w=C.attrs;yf("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");var D=x,W=D.boxes,Q=D.scores,ie=w,fe=ie.maxOutputSize,ye=ie.iouThreshold,Oe=ie.scoreThreshold,Re=ie.softNmsSigma,Pe=p,je=Pc(Pe.readSync(W.dataId),Pe.readSync(Q.dataId),fe,ye,Oe,Re);return[je.selectedIndices,je.selectedScores]}},{kernelName:"Square",backendName:"webgl",kernelFunc:function(C){var x=C.inputs,p=C.backend,w=x.x,D=p,W=new Oi(w.shape,"return x * x;");return D.runWebGLProgram(W,[w],w.dtype)}},{kernelName:Rp,backendName:"webgl",kernelFunc:function(C){var x=C.inputs,p=C.backend,w=x,D=w.a,W=w.b,Q=p,ie=L().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Di("return (a - b) * (a - b);",D.shape,W.shape):new ii("return (a - b) * (a - b);",D.shape,W.shape);return Q.compileAndRun(ie,[D,W])}}];X<oe.length;X++)ce(oe[X]);for(var me=0,Se=[{kernelName:"Square",gradFunc:function(C,x){var p=x[0];return{x:function(){return C.mul(p.toFloat().mul(2))}}}},{kernelName:Rp,gradFunc:function(C,x){var p=x[0],w=x[1],D=Or(2);return{a:function(){return Ff(C,Ff(D,tf(p,w)))},b:function(){return Ff(C,Ff(D,tf(w,p)))}}}}];me<Se.length;me++)pe(Se[me]);var Me=function(){function C(){}return C.prototype.fetch=function(x,p){return fetch(x,p)},C.prototype.now=function(){return performance.now()},C.prototype.encode=function(x,p){if(p!=="utf-8"&&p!=="utf8")throw new Error("Browser's encoder only supports utf-8, but got "+p);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(x)},C.prototype.decode=function(x,p){return new TextDecoder(p).decode(x)},C}();L().get("IS_BROWSER")&&L().setPlatform("browser",new Me);var Te,tt=function(){function C(){this.util=n(249),this.textEncoder=new this.util.TextEncoder}return C.prototype.fetch=function(x,p){return L().global.fetch!=null?L().global.fetch(x,p):(Te==null&&(Te=n(250)),Te(x,p))},C.prototype.now=function(){var x=h.hrtime();return 1e3*x[0]+x[1]/1e6},C.prototype.encode=function(x,p){if(p!=="utf-8"&&p!=="utf8")throw new Error("Node built-in encoder only supports utf-8, but got "+p);return this.textEncoder.encode(x)},C.prototype.decode=function(x,p){return x.length===0?"":new this.util.TextDecoder(p).decode(x)},C}();L().get("IS_NODE")&&L().setPlatform("node",new tt);var at={float32:4,int32:4,uint16:2,uint8:1,bool:1},jt=4;function $t(C,x){for(var p={},w=0,D=function(ie){var fe=ie.name,ye=ie.dtype,Oe=ie.shape,Re=Ke(Oe),Pe=void 0;if("quantization"in ie){var je=ie.quantization;if(je.dtype!=="uint8"&&je.dtype!=="uint16")throw new Error("Weight "+ie.name+" has unknown quantization dtype "+je.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var Ge=at[je.dtype],rt=C.slice(w,w+Re*Ge),nt=je.dtype==="uint8"?new Uint8Array(rt):new Uint16Array(rt);if(ye==="float32")Pe=Float32Array.from(nt,function(dn){return dn*je.scale+je.min});else{if(ye!=="int32")throw new Error("Unsupported dtype in weight '"+fe+"': "+ye);Pe=Int32Array.from(nt,function(dn){return Math.round(dn*je.scale+je.min)})}w+=Re*Ge}else if(ye==="string"){var lt=Ke(ie.shape);Pe=[];for(var Nt=0;Nt<lt;Nt++){var Rt=new Uint32Array(C.slice(w,w+jt))[0];w+=jt;var Pt=new Uint8Array(C.slice(w,w+Rt));Pe.push(Pt),w+=Rt}}else{var Kt=at[ye];if(rt=C.slice(w,w+Re*Kt),ye==="float32")Pe=new Float32Array(rt);else if(ye==="int32")Pe=new Int32Array(rt);else{if(ye!=="bool")throw new Error("Unsupported dtype in weight '"+fe+"': "+ye);Pe=new Uint8Array(rt)}w+=Re*Kt}p[fe]=Qo(Pe,Oe,ye)},W=0,Q=x;W<Q.length;W++)D(Q[W]);return p}var vn=v!==void 0&&(typeof Blob>"u"||typeof atob>"u"||typeof btoa>"u");function wn(C){return vn?v.byteLength(C):new Blob([C]).size}function Nn(C){var x=0;C.forEach(function(D){x+=D.byteLength});var p=new Uint8Array(x),w=0;return C.forEach(function(D){p.set(new Uint8Array(D),w),w+=D.byteLength}),p.buffer}function In(C){for(C=C.trim();C.endsWith("/");)C=C.slice(0,C.length-1);var x=C.split("/");return x[x.length-1]}function Ln(C){if(C.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:C.modelTopology==null?0:wn(JSON.stringify(C.modelTopology)),weightSpecsBytes:C.weightSpecs==null?0:wn(JSON.stringify(C.weightSpecs)),weightDataBytes:C.weightData==null?0:C.weightData.byteLength}}var qn=function(){function C(){this.saveRouters=[],this.loadRouters=[]}return C.getInstance=function(){return C.instance==null&&(C.instance=new C),C.instance},C.registerSaveRouter=function(x){C.getInstance().saveRouters.push(x)},C.registerLoadRouter=function(x){C.getInstance().loadRouters.push(x)},C.getSaveHandlers=function(x){return C.getHandlers(x,"save")},C.getLoadHandlers=function(x,p){return C.getHandlers(x,"load",p)},C.getHandlers=function(x,p,w){var D=[];return(p==="load"?C.getInstance().loadRouters:C.getInstance().saveRouters).forEach(function(W){var Q=W(x,w);Q!==null&&D.push(Q)}),D},C}(),Cn="://",wr=function(){function C(){this.managers={}}return C.getInstance=function(){return C.instance==null&&(C.instance=new C),C.instance},C.registerManager=function(x,p){Ee(x!=null,function(){return"scheme must not be undefined or null."}),x.endsWith(Cn)&&(x=x.slice(0,x.indexOf(Cn))),Ee(x.length>0,function(){return"scheme must not be an empty string."});var w=C.getInstance();Ee(w.managers[x]==null,function(){return"A model store manager is already registered for scheme '"+x+"'."}),w.managers[x]=p},C.getManager=function(x){var p=this.getInstance().managers[x];if(p==null)throw new Error("Cannot find model manager for scheme '"+x+"'");return p},C.getSchemes=function(){return Object.keys(this.getInstance().managers)},C}();function Fr(C){if(C.indexOf(Cn)===-1)throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+wr.getSchemes().join(","));return{scheme:C.split(Cn)[0],path:C.split(Cn)[1]}}function Rr(C,x,p){return p===void 0&&(p=!1),S(this,void 0,void 0,function(){var w,D,W,Q,ie,fe,ye,Oe,Re;return M(this,function(Pe){switch(Pe.label){case 0:return Ee(C!==x,function(){return"Old path and new path are the same: '"+C+"'"}),Ee((w=qn.getLoadHandlers(C)).length>0,function(){return"Copying failed because no load handler is found for source URL "+C+"."}),Ee(w.length<2,function(){return"Copying failed because more than one ("+w.length+") load handlers for source URL "+C+"."}),D=w[0],Ee((W=qn.getSaveHandlers(x)).length>0,function(){return"Copying failed because no save handler is found for destination URL "+x+"."}),Ee(W.length<2,function(){return"Copying failed because more than one ("+w.length+") save handlers for destination URL "+x+"."}),Q=W[0],ie=Fr(C).scheme,fe=Fr(C).path,ye=ie===Fr(C).scheme,[4,D.load()];case 1:return Oe=Pe.sent(),p&&ye?[4,wr.getManager(ie).removeModel(fe)]:[3,3];case 2:Pe.sent(),Pe.label=3;case 3:return[4,Q.save(Oe)];case 4:return Re=Pe.sent(),!p||ye?[3,6]:[4,wr.getManager(ie).removeModel(fe)];case 5:Pe.sent(),Pe.label=6;case 6:return[2,Re.modelArtifactsInfo]}})})}var Xr="models_store",zr="model_info_store";function Ti(){if(!L().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var C=window||self,x=C.indexedDB||C.mozIndexedDB||C.webkitIndexedDB||C.msIndexedDB||C.shimIndexedDB;if(x==null)throw new Error("The current browser does not appear to support IndexedDB.");return x}function Wi(C){var x=C.result;x.createObjectStore(Xr,{keyPath:"modelPath"}),x.createObjectStore(zr,{keyPath:"modelPath"})}var zi=function(){function C(x){if(this.indexedDB=Ti(),x==null||!x)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=x}return C.prototype.save=function(x){return S(this,void 0,void 0,function(){return M(this,function(p){if(x.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,x)]})})},C.prototype.load=function(){return S(this,void 0,void 0,function(){return M(this,function(x){return[2,this.databaseAction(this.modelPath)]})})},C.prototype.databaseAction=function(x,p){var w=this;return new Promise(function(D,W){var Q=w.indexedDB.open("tensorflowjs",1);Q.onupgradeneeded=function(){return Wi(Q)},Q.onsuccess=function(){var ie=Q.result;if(p==null){var fe=ie.transaction(Xr,"readonly"),ye=fe.objectStore(Xr).get(w.modelPath);ye.onsuccess=function(){if(ye.result==null)return ie.close(),W(new Error("Cannot find model with path '"+w.modelPath+"' in IndexedDB."));D(ye.result.modelArtifacts)},ye.onerror=function(rt){return ie.close(),W(ye.error)},fe.oncomplete=function(){return ie.close()}}else{var Oe,Re=Ln(p),Pe=ie.transaction(zr,"readwrite"),je=Pe.objectStore(zr),Ge=je.put({modelPath:w.modelPath,modelArtifactsInfo:Re});Ge.onsuccess=function(){var rt=(Oe=ie.transaction(Xr,"readwrite")).objectStore(Xr).put({modelPath:w.modelPath,modelArtifacts:p,modelArtifactsInfo:Re});rt.onsuccess=function(){return D({modelArtifactsInfo:Re})},rt.onerror=function(nt){var lt=(je=Pe.objectStore(zr)).delete(w.modelPath);lt.onsuccess=function(){return ie.close(),W(rt.error)},lt.onerror=function(Nt){return ie.close(),W(rt.error)}}},Ge.onerror=function(rt){return ie.close(),W(Ge.error)},Pe.oncomplete=function(){Oe==null?ie.close():Oe.oncomplete=function(){return ie.close()}}}},Q.onerror=function(ie){return W(Q.error)}})},C.URL_SCHEME="indexeddb://",C}(),Xo=function(C){return L().getBool("IS_BROWSER")&&!Array.isArray(C)&&C.startsWith(zi.URL_SCHEME)?(x=C.slice(zi.URL_SCHEME.length),new zi(x)):null;var x};qn.registerSaveRouter(Xo),qn.registerLoadRouter(Xo);var wa=function(){function C(){this.indexedDB=Ti()}return C.prototype.listModels=function(){return S(this,void 0,void 0,function(){var x=this;return M(this,function(p){return[2,new Promise(function(w,D){var W=x.indexedDB.open("tensorflowjs",1);W.onupgradeneeded=function(){return Wi(W)},W.onsuccess=function(){var Q=W.result,ie=Q.transaction(zr,"readonly"),fe=ie.objectStore(zr).getAll();fe.onsuccess=function(){for(var ye={},Oe=0,Re=fe.result;Oe<Re.length;Oe++){var Pe=Re[Oe];ye[Pe.modelPath]=Pe.modelArtifactsInfo}w(ye)},fe.onerror=function(ye){return Q.close(),D(fe.error)},ie.oncomplete=function(){return Q.close()}},W.onerror=function(Q){return D(W.error)}})]})})},C.prototype.removeModel=function(x){return S(this,void 0,void 0,function(){var p=this;return M(this,function(w){var D;return x=(D=x).startsWith(zi.URL_SCHEME)?D.slice(zi.URL_SCHEME.length):D,[2,new Promise(function(W,Q){var ie=p.indexedDB.open("tensorflowjs",1);ie.onupgradeneeded=function(){return Wi(ie)},ie.onsuccess=function(){var fe,ye=ie.result,Oe=ye.transaction(zr,"readwrite"),Re=Oe.objectStore(zr),Pe=Re.get(x);Pe.onsuccess=function(){if(Pe.result==null)return ye.close(),Q(new Error("Cannot find model with path '"+x+"' in IndexedDB."));var je=Re.delete(x),Ge=function(){var rt=(fe=ye.transaction(Xr,"readwrite")).objectStore(Xr).delete(x);rt.onsuccess=function(){return W(Pe.result.modelArtifactsInfo)},rt.onerror=function(nt){return Q(Pe.error)}};je.onsuccess=Ge,je.onerror=function(rt){return Ge(),ye.close(),Q(Pe.error)}},Pe.onerror=function(je){return ye.close(),Q(Pe.error)},Oe.oncomplete=function(){fe==null?ye.close():fe.oncomplete=function(){return ye.close()}}},ie.onerror=function(fe){return Q(ie.error)}})]})})},C}();if(L().getBool("IS_BROWSER"))try{wr.registerManager(zi.URL_SCHEME,new wa)}catch{}var ua="/",oa="tensorflowjs_models",ha="info",Ma="model_topology",Wa="weight_specs",us="weight_data",Qu="model_metadata";function Hi(C){return{info:[oa,C,ha].join(ua),topology:[oa,C,Ma].join(ua),weightSpecs:[oa,C,Wa].join(ua),weightData:[oa,C,us].join(ua),modelMetadata:[oa,C,Qu].join(ua)}}function Ts(C){var x=C.split(ua);if(x.length<3)throw new Error("Invalid key format: "+C);return x.slice(1,x.length-1).join(ua)}var Us=function(){function C(x){if(!L().getBool("IS_BROWSER")||typeof window>"u"||window.localStorage===void 0)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,x==null||!x)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=x,this.keys=Hi(this.modelPath)}return C.prototype.save=function(x){return S(this,void 0,void 0,function(){var p,w,D;return M(this,function(W){if(x.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");p=JSON.stringify(x.modelTopology),w=JSON.stringify(x.weightSpecs),D=Ln(x);try{return this.LS.setItem(this.keys.info,JSON.stringify(D)),this.LS.setItem(this.keys.topology,p),this.LS.setItem(this.keys.weightSpecs,w),this.LS.setItem(this.keys.weightData,function(Q){if(vn)return v.from(Q).toString("base64");for(var ie=new Uint8Array(Q),fe="",ye=0,Oe=ie.length;ye<Oe;ye++)fe+=String.fromCharCode(ie[ye]);return btoa(fe)}(x.weightData)),this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:x.format,generatedBy:x.generatedBy,convertedBy:x.convertedBy,userDefinedMetadata:x.userDefinedMetadata})),[2,{modelArtifactsInfo:D}]}catch{throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error("Failed to save model '"+this.modelPath+"' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes="+D.modelTopologyBytes+", weightSpecsBytes="+D.weightSpecsBytes+", weightDataBytes="+D.weightDataBytes+".")}return[2]})})},C.prototype.load=function(){return S(this,void 0,void 0,function(){var x,p,w,D,W,Q,ie;return M(this,function(fe){if((x=JSON.parse(this.LS.getItem(this.keys.info)))==null)throw new Error("In local storage, there is no model with name '"+this.modelPath+"'");if(x.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");if(p={},(w=JSON.parse(this.LS.getItem(this.keys.topology)))==null)throw new Error("In local storage, the topology of model '"+this.modelPath+"' is missing.");if(p.modelTopology=w,(D=JSON.parse(this.LS.getItem(this.keys.weightSpecs)))==null)throw new Error("In local storage, the weight specs of model '"+this.modelPath+"' are missing.");if(p.weightSpecs=D,(W=this.LS.getItem(this.keys.modelMetadata))!=null&&(Q=JSON.parse(W),p.format=Q.format,p.generatedBy=Q.generatedBy,p.convertedBy=Q.convertedBy,p.userDefinedMetadata=Q.userDefinedMetadata),(ie=this.LS.getItem(this.keys.weightData))==null)throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return p.weightData=function(ye){if(vn){var Oe=v.from(ye,"base64");return Oe.buffer.slice(Oe.byteOffset,Oe.byteOffset+Oe.byteLength)}for(var Re=atob(ye),Pe=new Uint8Array(Re.length),je=0;je<Re.length;++je)Pe.set([Re.charCodeAt(je)],je);return Pe.buffer}(ie),[2,p]})})},C.URL_SCHEME="localstorage://",C}(),Zu=function(C){return L().getBool("IS_BROWSER")&&!Array.isArray(C)&&C.startsWith(Us.URL_SCHEME)?(x=C.slice(Us.URL_SCHEME.length),new Us(x)):null;var x};qn.registerSaveRouter(Zu),qn.registerLoadRouter(Zu);var Au=function(){function C(){Ee(L().getBool("IS_BROWSER"),function(){return"Current environment is not a web browser"}),Ee(typeof window>"u"||window.localStorage!==void 0,function(){return"Current browser does not appear to support localStorage"}),this.LS=window.localStorage}return C.prototype.listModels=function(){return S(this,void 0,void 0,function(){var x,p,w,D,W,Q;return M(this,function(ie){for(x={},p=oa+ua,w=ua+ha,D=0;D<this.LS.length;++D)(W=this.LS.key(D)).startsWith(p)&&W.endsWith(w)&&(Q=Ts(W),x[Q]=JSON.parse(this.LS.getItem(W)));return[2,x]})})},C.prototype.removeModel=function(x){return S(this,void 0,void 0,function(){var p,w;return M(this,function(D){var W;if(x=(W=x).startsWith(Us.URL_SCHEME)?W.slice(Us.URL_SCHEME.length):W,p=Hi(x),this.LS.getItem(p.info)==null)throw new Error("Cannot find model at path '"+x+"'");return w=JSON.parse(this.LS.getItem(p.info)),this.LS.removeItem(p.info),this.LS.removeItem(p.topology),this.LS.removeItem(p.weightSpecs),this.LS.removeItem(p.weightData),[2,w]})})},C}();if(L().getBool("IS_BROWSER"))try{wr.registerManager(Us.URL_SCHEME,new Au)}catch{}var xc="model",wc=".json",_c=".weights.bin";function Jp(C){return new Promise(function(x){return setTimeout(x)}).then(C)}var Lh=function(){function C(x){if(!L().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");x.startsWith(C.URL_SCHEME)&&(x=x.slice(C.URL_SCHEME.length)),x!=null&&x.length!==0||(x=xc),this.modelTopologyFileName=x+wc,this.weightDataFileName=x+_c}return C.prototype.save=function(x){return S(this,void 0,void 0,function(){var p,w,D,W,Q,ie;return M(this,function(fe){switch(fe.label){case 0:if(typeof document>"u")throw new Error("Browser downloads are not supported in this environment since `document` is not present");if(p=window.URL.createObjectURL(new Blob([x.weightData],{type:"application/octet-stream"})),!(x.modelTopology instanceof ArrayBuffer))return[3,1];throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");case 1:return w=[{paths:["./"+this.weightDataFileName],weights:x.weightSpecs}],D={modelTopology:x.modelTopology,format:x.format,generatedBy:x.generatedBy,convertedBy:x.convertedBy,weightsManifest:w},W=window.URL.createObjectURL(new Blob([JSON.stringify(D)],{type:"application/json"})),(Q=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor).download=this.modelTopologyFileName,Q.href=W,[4,Jp(function(){return Q.dispatchEvent(new MouseEvent("click"))})];case 2:return fe.sent(),x.weightData==null?[3,4]:((ie=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,ie.href=p,[4,Jp(function(){return ie.dispatchEvent(new MouseEvent("click"))})]);case 3:fe.sent(),fe.label=4;case 4:return[2,{modelArtifactsInfo:Ln(x)}]}})})},C.URL_SCHEME="downloads://",C}(),zf=function(){function C(x){if(x==null||x.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+x);this.files=x}return C.prototype.load=function(){return S(this,void 0,void 0,function(){var x,p,w=this;return M(this,function(D){return x=this.files[0],p=this.files.slice(1),[2,new Promise(function(W,Q){var ie=new FileReader;ie.onload=function(fe){var ye=JSON.parse(fe.target.result),Oe=ye.modelTopology;if(Oe!=null){p.length===0&&W({modelTopology:Oe});var Re=ye.weightsManifest;if(Re!=null){var Pe;try{Pe=w.checkManifestAndWeightFiles(Re,p)}catch(nt){return void Q(nt)}var je=[],Ge=[],rt=[];Re.forEach(function(nt){nt.paths.forEach(function(lt){Ge.push(lt),rt.push(null)}),je.push.apply(je,nt.weights)}),Re.forEach(function(nt){nt.paths.forEach(function(lt){var Nt=new FileReader;Nt.onload=function(Rt){var Pt=Rt.target.result,Kt=Ge.indexOf(lt);rt[Kt]=Pt,rt.indexOf(null)===-1&&W({modelTopology:Oe,weightSpecs:je,weightData:Nn(rt),format:ye.format,generatedBy:ye.generatedBy,convertedBy:ye.convertedBy,userDefinedMetadata:ye.userDefinedMetadata})},Nt.onerror=function(Rt){return Q("Failed to weights data from file of path '"+lt+"'.")},Nt.readAsArrayBuffer(Pe[lt])})})}else Q(new Error("weightManifest field is missing from file "+x.name))}else Q(new Error("modelTopology field is missing from file "+x.name))},ie.onerror=function(fe){return Q("Failed to read model topology and weights manifest JSON from file '"+x.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},ie.readAsText(x)})]})})},C.prototype.checkManifestAndWeightFiles=function(x,p){for(var w=[],D=p.map(function(fe){return In(fe.name)}),W={},Q=0,ie=x;Q<ie.length;Q++)ie[Q].paths.forEach(function(fe){var ye=In(fe);if(w.indexOf(ye)!==-1)throw new Error("Duplicate file basename found in weights manifest: '"+ye+"'");if(w.push(ye),D.indexOf(ye)===-1)throw new Error("Weight file with basename '"+ye+"' is not provided.");W[fe]=p[D.indexOf(ye)]});if(w.length!==p.length)throw new Error("Mismatch in the number of files in weights manifest ("+w.length+") and the number of weight files provided ("+p.length+").");return W},C}();function Fd(C,x,p,w){(function(W){Ee(W!=null&&Array.isArray(W)&&W.length>0,function(){return"promises must be a none empty array"})})(C),function(W,Q){Ee(W>=0&&W<=1,function(){return"Progress fraction must be in range [0, 1], but got startFraction "+W}),Ee(Q>=0&&Q<=1,function(){return"Progress fraction must be in range [0, 1], but got endFraction "+Q}),Ee(Q>=W,function(){return"startFraction must be no more than endFraction, but got startFraction "+W+" and endFraction "+Q})}(p=p??0,w=w??1);var D=0;return Promise.all(C.map(function(W){return W.then(function(Q){var ie=p+ ++D/C.length*(w-p);return x(ie),Q}),W}))}function Uf(C,x){return S(this,void 0,void 0,function(){var p,w,D,W,Q,ie,fe,ye,Oe;return M(this,function(Re){switch(Re.label){case 0:return x==null&&(x={}),p=x.fetchFunc==null?L().platform.fetch:x.fetchFunc,w=C.map(function(Pe){return p(Pe,x.requestInit,{isBinary:!0})}),D=0,W=.5,x.onProgress!=null?[3,2]:[4,Promise.all(w)];case 1:return Q=Re.sent(),[3,4];case 2:return[4,Fd(w,x.onProgress,D,W)];case 3:Q=Re.sent(),Re.label=4;case 4:return ie=Q.map(function(Pe){return Pe.arrayBuffer()}),fe=.5,ye=1,x.onProgress!=null?[3,6]:[4,Promise.all(ie)];case 5:return Oe=Re.sent(),[3,8];case 6:return[4,Fd(ie,x.onProgress,fe,ye)];case 7:Oe=Re.sent(),Re.label=8;case 8:return[2,Oe]}})})}function sl(C){var x=this;return function(p,w,D){return w===void 0&&(w=""),S(x,void 0,void 0,function(){var W,Q,ie,fe,ye,Oe,Re,Pe,je,Ge;return M(this,function(rt){switch(rt.label){case 0:if(W=p.map(function(){return!1}),Q={},ie=D!=null?D.map(function(){return!1}):[],fe=[],p.forEach(function(nt,lt){var Nt=0;nt.weights.forEach(function(Rt){var Pt="quantization"in Rt?Rt.quantization.dtype:Rt.dtype,Kt=at[Pt]*Ke(Rt.shape),dn=function(){W[lt]=!0,Q[lt]==null&&(Q[lt]=[]),Q[lt].push({manifestEntry:Rt,groupOffset:Nt,sizeBytes:Kt})};D!=null?D.forEach(function(bn,pn){bn===Rt.name&&(dn(),ie[pn]=!0)}):dn(),fe.push(Rt.name),Nt+=Kt})}),!ie.every(function(nt){return nt}))throw ye=D.filter(function(nt,lt){return!ie[lt]}),new Error("Could not find weights in manifest with names: "+ye.join(", ")+`. 7664Manifest JSON has weights with names: `+fe.join(", ")+".");return Oe=W.reduce(function(nt,lt,Nt){return lt&&nt.push(Nt),nt},[]),Re=[],Oe.forEach(function(nt){p[nt].paths.forEach(function(lt){var Nt=w+(w.endsWith("/")?"":"/")+lt;Re.push(Nt)})}),[4,C(Re)];case 1:return Pe=rt.sent(),je={},Ge=0,Oe.forEach(function(nt){for(var lt=p[nt].paths.length,Nt=0,Rt=0;Rt<lt;Rt++)Nt+=Pe[Ge+Rt].byteLength;for(var Pt=new ArrayBuffer(Nt),Kt=new Uint8Array(Pt),dn=0,bn=0;bn<lt;bn++){var pn=new Uint8Array(Pe[Ge+bn]);Kt.set(pn,dn),dn+=pn.byteLength}Q[nt].forEach(function(_n){var On=$t(Pt.slice(_n.groupOffset,_n.groupOffset+_n.sizeBytes),[_n.manifestEntry]);for(var _ in On)je[_]=On[_]}),Ge+=lt}),[2,je]}})})}}qn.registerSaveRouter(function(C){return L().getBool("IS_BROWSER")&&!Array.isArray(C)&&C.startsWith(Lh.URL_SCHEME)?function(x){return x===void 0&&(x="model"),new Lh(x)}(C.slice(Lh.URL_SCHEME.length)):null});var ks=function(){function C(x,p){if(this.DEFAULT_METHOD="POST",p==null&&(p={}),this.weightPathPrefix=p.weightPathPrefix,this.onProgress=p.onProgress,p.fetchFunc!=null?(Ee(typeof p.fetchFunc=="function",function(){return"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"}),this.fetch=p.fetchFunc):this.fetch=L().platform.fetch,Ee(x!=null&&x.length>0,function(){return"URL path for http must not be null, undefined or empty."}),Array.isArray(x)&&Ee(x.length===2,function(){return"URL paths for http must have a length of 2, (actual length is "+x.length+")."}),this.path=x,p.requestInit!=null&&p.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=p.requestInit||{}}return C.prototype.save=function(x){return S(this,void 0,void 0,function(){var p,w,D,W;return M(this,function(Q){switch(Q.label){case 0:if(x.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(p=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,w=[{paths:["./model.weights.bin"],weights:x.weightSpecs}],D={modelTopology:x.modelTopology,format:x.format,generatedBy:x.generatedBy,convertedBy:x.convertedBy,userDefinedMetadata:x.userDefinedMetadata,weightsManifest:w},p.body.append("model.json",new Blob([JSON.stringify(D)],{type:"application/json"}),"model.json"),x.weightData!=null&&p.body.append("model.weights.bin",new Blob([x.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,this.fetch(this.path,p)];case 1:if((W=Q.sent()).ok)return[2,{modelArtifactsInfo:Ln(x),responses:[W]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+W.status+".")}})})},C.prototype.load=function(){return S(this,void 0,void 0,function(){var x,p,w,D,W,Q,ie,fe,ye,Oe,Re,Pe;return M(this,function(je){switch(je.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(x=je.sent()).ok)throw new Error("Request to "+this.path+" failed with status code "+x.status+". Please verify this URL points to the model JSON of the model to load.");je.label=2;case 2:return je.trys.push([2,4,,5]),[4,x.json()];case 3:return p=je.sent(),[3,5];case 4:throw je.sent(),w="Failed to parse model JSON of response from "+this.path+".",this.path.endsWith(".pb")?w+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":w+=" Please make sure the server is serving valid JSON for this request.",new Error(w);case 5:if(D=p.modelTopology,W=p.weightsManifest,Q=p.generatedBy,ie=p.convertedBy,fe=p.format,ye=p.userDefinedMetadata,D==null&&W==null)throw new Error("The JSON from HTTP path "+this.path+" contains
7664neither model topology or manifest for weights.");return W==null?[3,7]:[4,this.loadWeights(W)];case 6:Pe=je.sent(),Oe=Pe[0],Re=Pe[1],je.label=7;case 7:return[2,{modelTopology:D,weightSpecs:Oe,weightData:Re,userDefinedMetadata:ye,generatedBy:Q,convertedBy:ie,format:fe}]}})})},C.prototype.loadWeights=function(x){return S(this,void 0,void 0,function(){var p,w,D,W,Q,ie,fe,ye,Oe,Re,Pe;return M(this,function(je){switch(je.label){case 0:for(p=Array.isArray(this.path)?this.path[1]:this.path,w=function(Ge){var rt=Ge.lastIndexOf("/"),nt=Ge.lastIndexOf("?");return[Ge.substring(0,rt)+"/",nt>rt?Ge.substring(nt):""]}(p),D=w[0],W=w[1],Q=this.weightPathPrefix||D,ie=[],fe=0,ye=x;fe<ye.length;fe++)Oe=ye[fe],ie.push.apply(ie,Oe.weights);return Re=[],x.forEach(function(Ge){Ge.paths.forEach(function(rt){Re.push(Q+rt+W)})}),[4,Uf(Re,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress})];case 1:return Pe=je.sent(),[2,[ie,Nn(Pe)]]}})})},C.URL_SCHEME_REGEX=/^https?:\/\//,C}();function Rd(C){return C.match(ks.URL_SCHEME_REGEX)!=null}var zh=function(C,x){return typeof fetch>"u"?null:(Array.isArray(C)?C.every(function(p){return Rd(p)}):Rd(C))?Qp(C,{onProgress:x}):null};function Qp(C,x){return new ks(C,x)}qn.registerSaveRouter(zh),qn.registerLoadRouter(zh);var Bd,ou=function(){function C(x){this.modelArtifacts=x}return C.prototype.load=function(){return S(this,void 0,void 0,function(){return M(this,function(x){return[2,this.modelArtifacts]})})},C}(),Uh=function(){function C(x){this.saveHandler=x}return C.prototype.save=function(x){return S(this,void 0,void 0,function(){return M(this,function(p){return[2,this.saveHandler(x)]})})},C}(),Zp=Object.freeze({browserFiles:function(C){return new zf(C)},browserHTTPRequest:function(C,x){return Qp(C,x)},concatenateArrayBuffers:Nn,decodeWeights:$t,encodeWeights:function(C,x){return S(this,void 0,void 0,function(){var p,w,D,W,Q,ie=this;return M(this,function(fe){switch(fe.label){case 0:for(p=[],w=[],D=Array.isArray(C)?C.map(function(ye){return ye.name}):Object.keys(C),W=function(ye){var Oe=D[ye],Re=Array.isArray(C)?C[ye].tensor:C[Oe];if(Re.dtype!=="float32"&&Re.dtype!=="int32"&&Re.dtype!=="bool"&&Re.dtype!=="string")throw new Error("Unsupported dtype in weight '"+Oe+"': "+Re.dtype);var Pe={name:Oe,shape:Re.shape,dtype:Re.dtype};if(Re.dtype==="string"){var je=new Promise(function(Ge){return S(ie,void 0,void 0,function(){var rt,nt,lt,Nt,Rt,Pt,Kt;return M(this,function(dn){switch(dn.label){case 0:return[4,Re.bytes()];case 1:for(rt=dn.sent(),nt=rt.reduce(function(bn,pn){return bn+pn.length},0)+jt*rt.length,lt=new Uint8Array(nt),Nt=0,Rt=0;Rt<rt.length;Rt++)Pt=rt[Rt],Kt=new Uint8Array(new Uint32Array([Pt.length]).buffer),lt.set(Kt,Nt),Nt+=jt,lt.set(Pt,Nt),Nt+=Pt.length;return Ge(lt),[2]}})})});w.push(je)}else w.push(Re.data());x!=null&&(Pe.group=x),p.push(Pe)},Q=0;Q<D.length;++Q)W(Q);return[4,Promise.all(w)];case 1:return[2,{data:function(ye){if(ye===null)throw new Error("Invalid input value: "+JSON.stringify(ye));var Oe=0,Re=[];ye.forEach(function(Ge){if(Oe+=Ge.byteLength,Re.push(Ge.byteLength===Ge.buffer.byteLength?Ge:new Ge.constructor(Ge)),!(Ge instanceof Float32Array||Ge instanceof Int32Array||Ge instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: "+Ge.constructor.name)});var Pe=new Uint8Array(Oe),je=0;return Re.forEach(function(Ge){Pe.set(new Uint8Array(Ge.buffer),je),je+=Ge.byteLength}),Pe.buffer}(fe.sent()),specs:p}]}})})},fromMemory:function(C,x,p,w){return arguments.length===1?C.modelTopology!=null||C.weightSpecs!=null?new ou(C):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new ou({modelTopology:C})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new ou({modelTopology:C,weightSpecs:x,weightData:p,trainingConfig:w}))},getLoadHandlers:function(C,x){return qn.getLoadHandlers(C,x)},getModelArtifactsInfoForJSON:Ln,getSaveHandlers:function(C){return qn.getSaveHandlers(C)},http:Qp,isHTTPScheme:Rd,loadWeights:function(C,x,p,w){return x===void 0&&(x=""),S(this,void 0,void 0,function(){return M(this,function(D){return[2,sl(function(W){return Uf(W,{requestInit:w})})(C,x,p)]})})},registerLoadRouter:function(C){return qn.registerLoadRouter(C)},registerSaveRouter:function(C){return qn.registerSaveRouter(C)},weightsLoaderFactory:sl,withSaveHandler:function(C){return new Uh(C)},copyModel:function(C,x){return S(this,void 0,void 0,function(){return M(this,function(p){return[2,Rr(C,x,!1)]})})},listModels:function(){return S(this,void 0,void 0,function(){var C,x,p,w,D,W,Q;return M(this,function(ie){switch(ie.label){case 0:C=wr.getSchemes(),x={},p=0,w=C,ie.label=1;case 1:return p<w.length?(D=w[p],[4,wr.getManager(D).listModels()]):[3,4];case 2:for(Q in W=ie.sent())x[D+Cn+Q]=W[Q];ie.label=3;case 3:return p++,[3,1];case 4:return[2,x]}})})},moveModel:function(C,x){return S(this,void 0,void 0,function(){return M(this,function(p){return[2,Rr(C,x,!0)]})})},removeModel:function(C){return S(this,void 0,void 0,function(){var x;return M(this,function(p){return x=Fr(C),[2,wr.getManager(x.scheme).removeModel(x.path)]})})}}
vendor: 22,935 bytes, lines 7664-7668
7664),em=Bt({confusionMatrix_:function(C,x,p){var w=et(C,"labels","confusionMatrix"),D=et(x,"predictions","confusionMatrix");Ee(p==null||p>0&&Number.isInteger(p),function(){return"If provided, numClasses must be a positive integer, but got "+p}),Ee(w.rank===1,function(){return"Expected the rank of labels to be 1, but got "+w.rank}),Ee(D.rank===1,function(){return"Expected the rank of predictions to be 1, but got "+D.rank}),Ee(w.shape[0]===D.shape[0],function(){return"Mismatch in the number of examples: "+w.shape[0]+" vs. "+D.shape[0]+". Labels and predictions should have the same number of elements."}),Ee(p>0&&Number.isInteger(p),function(){return"numClasses is required to be a positive integer, but got "+p});var W=Dp(w.asType("int32"),p),Q=Dp(D.asType("int32"),p);return W.transpose().matMul(Q).asType("int32")}}),af=Object.freeze({confusionMatrix:em}),vg=Bt({fromPixels_:function(C,x){if(x===void 0&&(x=3),x>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(C==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var p=!1,w=!1,D=!1,W=!1,Q=!1;if(C.data instanceof Uint8Array)p=!0;else if(typeof ImageData<"u"&&C instanceof ImageData)w=!0;else if(typeof HTMLVideoElement<"u"&&C instanceof HTMLVideoElement)D=!0;else if(typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement)W=!0;else{if(C.getContext==null)throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was "+C.constructor.name);Q=!0}if(D&&D&&C.readyState<2)throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the <video> element.");if(J("FromPixels",qe.backendName)!=null)return qe.runKernel("FromPixels",{pixels:C},{numChannels:x});var ie,fe,ye=D?[C.videoWidth,C.videoHeight]:[C.width,C.height],Oe=ye[0],Re=ye[1];if(Q?ie=C.getContext("2d").getImageData(0,0,Oe,Re).data:w||p?ie=C.data:(W||D)&&(Bd==null&&(Bd=document.createElement("canvas").getContext("2d")),Bd.canvas.width=Oe,Bd.canvas.height=Re,Bd.drawImage(C,0,0,Oe,Re),ie=Bd.getImageData(0,0,Oe,Re).data),x===4)fe=new Int32Array(ie);else{var Pe=Oe*Re;fe=new Int32Array(Pe*x);for(var je=0;je<Pe;je++)for(var Ge=0;Ge<x;++Ge)fe[je*x+Ge]=ie[4*je+Ge]}return bf(fe,[Re,Oe,x],"int32")}}),ul=Object.freeze({toPixels:function(C,x){return S(this,void 0,void 0,function(){var p,w,D,W,Q,ie,fe,ye,Oe,Re,Pe,je,Ge,rt,nt,lt,Nt,Rt,Pt,Kt,dn,bn,pn;return M(this,function(_n){switch(_n.label){case 0:if(p=et(C,"img","toPixels"),C instanceof Zt||(p=p.toInt()),p.rank!==2&&p.rank!==3)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+p.rank+".");if(w=p.shape.slice(0,2),D=w[0],W=w[1],(Q=p.rank===2?1:p.shape[2])>4||Q===2)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+Q);return[4,p.data()];case 1:return ie=_n.sent(),fe=p.min(),ye=p.max(),[4,Promise.all([fe.data(),ye.data()])];case 2:if(Oe=_n.sent(),Re=Oe[0],Pe=Oe[1],je=Re[0],Ge=Pe[0],fe.dispose(),ye.dispose(),p.dtype==="float32"){if(je<0||Ge>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+je+" - "+Ge+"].")}else{if(p.dtype!=="int32")throw new Error("Unsupported type for toPixels: "+p.dtype+". Please use float32 or int32 tensors.");if(je<0||Ge>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+je+" - "+Ge+"].")}for(rt=p.dtype==="float32"?255:1,nt=new Uint8ClampedArray(W*D*4),lt=0;lt<D*W;++lt)Nt=void 0,Rt=void 0,Pt=void 0,Kt=void 0,Q===1?(Nt=ie[lt]*rt,Rt=ie[lt]*rt,Pt=ie[lt]*rt,Kt=255):Q===3?(Nt=ie[3*lt]*rt,Rt=ie[3*lt+1]*rt,Pt=ie[3*lt+2]*rt,Kt=255):Q===4&&(Nt=ie[4*lt]*rt,Rt=ie[4*lt+1]*rt,Pt=ie[4*lt+2]*rt,Kt=ie[4*lt+3]*rt),nt[0+(dn=4*lt)]=Math.round(Nt),nt[dn+1]=Math.round(Rt),nt[dn+2]=Math.round(Pt),nt[dn+3]=Math.round(Kt);return x!=null&&(x.width=W,x.height=D,bn=x.getContext("2d"),pn=new ImageData(nt,W,D),bn.putImageData(pn,0,0)),p!==C&&p.dispose(),[2,nt]}})})},fromPixels:vg}),Ou=function(){function C(){}return C.prototype.getClassName=function(){return this.constructor.className},C.fromConfig=function(x,p){return new x(p)},C}(),$c=function(){function C(){this.classNameMap={}}return C.getMap=function(){return C.instance==null&&(C.instance=new C),C.instance},C.register=function(x){C.getMap().classNameMap[x.className]=[x,x.fromConfig]},C}();function au(C){Ee(C.className!=null,function(){return"Class being registered does not have the static className property defined."}),Ee(typeof C.className=="string",function(){return"className is required to be a string, but got type "+typeof C.className}),Ee(C.className.length>0,function(){return"Class being registered has an empty-string as its className, which is disallowed."}),$c.register(C)}var Wf=Object.freeze({Serializable:Ou,SerializationMap:$c,registerClass:au}),Wh=.001,tm=.1;function Vh(){return qe.backend.floatPrecision()===32?Wh:tm}function yg(C,x,p){var w=!0;if((dt(C)||dt(x))&&(w=!1),dt(C)&&dt(x)&&(w=!0),w){var D=C.constructor.name,W=x.constructor.name;if(D!==W)throw new Error("Arrays are of different type. Actual: "+D+". Expected: "+W)}if(Array.isArray(C)&&Array.isArray(x)){var Q=As(C),ie=As(x);if(!Tt(Q,ie))throw new Error("Arrays have different shapes. Actual: ["+Q+"]. Expected: ["+ie+"]")}var fe=dt(C)?C:Mt(C),ye=dt(x)?x:Mt(x);if(fe.length!==ye.length)throw new Error("Arrays have different lengths actual: "+fe.length+" vs expected: "+ye.length+`. 7665Actual: `+fe+`. 7666Expected: `+ye+".");for(var Oe=0;Oe<ye.length;++Oe){var Re=fe[Oe],Pe=ye[Oe];if(!p(Re,Pe))throw new Error("Arrays differ: actual["+Oe+"] = "+Re+", expected["+Oe+"] = "+Pe+`. 7667Actual: `+fe+`. 7668Expected: `+ye+".")}}function Vf(C,x,p){return!isFinite(C)&&!isFinite(x)||!(isNaN(C)||isNaN(x)||Math.abs(C-x)>p)}var fc=Object.freeze({TEST_EPSILON_FLOAT16:tm,expectArraysClose:function(C,x,p){return p==null&&(p=Vh()),yg(C,x,function(w,D){return Vf(w,D,p)})},testEpsilon:Vh,expectPromiseToFail:function(C,x){C().then(function(){return x.fail()},function(){return x()})},expectArraysEqual:function(C,x){var p=typeof x=="string"||typeof x=="number"||typeof x=="boolean"?[x]:x;return on(C)||on(C[0])||on(x)||on(x[0])?yg(C,p,function(w,D){return w==D}):yg(C,x,function(w,D){return Vf(w,D,0)})},expectNumbersClose:function(C,x,p){if(p==null&&(p=Vh()),!Vf(C,x,p))throw new Error("Numbers differ: actual === "+C+", expected === "+x)},expectValuesInRange:function(C,x,p){for(var w=0;w<C.length;w++)if(C[w]<x||C[w]>p)throw new Error("Value out of range:"+C[w]+" low: "+x+", high: "+p)},expectArrayBuffersEqual:function(C,x){expect(new Float32Array(C)).toEqual(new Float32Array(x))}}),Fb="1.7.0",$f=Object.freeze({gpgpu_util:Mu,webgl_util:oh,forceHalfFloat:function(){L().set("WEBGL_FORCE_F16_TEXTURES",!0)},MathBackendWebGL:g1,setWebGLContext:Lo,GPGPUContext:Ia}),nm=function(C){function x(){return C!==null&&C.apply(this,arguments)||this}return A(x,C),x.prototype.minimize=function(p,w,D){w===void 0&&(w=!1);var W=this.computeGradients(p,D),Q=W.value,ie=W.grads;if(D!=null){var fe=D.map(function(ye){return{name:ye.name,tensor:ie[ye.name]}});this.applyGradients(fe)}else this.applyGradients(ie);return ca(ie),w?Q:(Q.dispose(),null)},Object.defineProperty(x.prototype,"iterations",{get:function(){return this.iterations_==null&&(this.iterations_=0),this.iterations_},enumerable:!0,configurable:!0}),x.prototype.incrementIterations=function(){this.iterations_=this.iterations+1},x.prototype.computeGradients=function(p,w){return gn(p,w)},x.prototype.dispose=function(){this.iterations_!=null&&ca(this.iterations_)},x.prototype.saveIterations=function(){return S(this,void 0,void 0,function(){return M(this,function(p){return this.iterations_==null&&(this.iterations_=0),[2,{name:"iter",tensor:Or(this.iterations_,"int32")}]})})},x.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(p){throw new Error("getWeights() is not implemented for this optimizer yet.")})})},x.prototype.setWeights=function(p){return S(this,void 0,void 0,function(){return M(this,function(w){throw new Error("setWeights() is not implemented for this optimizer class "+this.getClassName())})})},x.prototype.extractIterations=function(p){return S(this,void 0,void 0,function(){var w;return M(this,function(D){switch(D.label){case 0:return w=this,[4,p[0].tensor.data()];case 1:return w.iterations_=D.sent()[0],[2,p.slice(1)]}})})},x}(Ou);Object.defineProperty(nm,Symbol.hasInstance,{value:function(C){return C.minimize!=null&&C.computeGradients!=null&&C.applyGradients!=null}});var Rb=function(C){function x(p,w,D){D===void 0&&(D=null);var W=C.call(this)||this;return W.learningRate=p,W.rho=w,W.epsilon=D,W.accumulatedGrads=[],W.accumulatedUpdates=[],D==null&&(W.epsilon=qe.backend.epsilon()),W}return A(x,C),x.prototype.applyGradients=function(p){var w=this;(Array.isArray(p)?p.map(function(D){return D.name}):Object.keys(p)).forEach(function(D,W){var Q=qe.registeredVariables[D];w.accumulatedGrads[W]==null&&(w.accumulatedGrads[W]={originalName:D+"/accum_grad",variable:eo(function(){return Ei(Q).variable(!1)})}),w.accumulatedUpdates[W]==null&&(w.accumulatedUpdates[W]={originalName:D+"/accum_var",variable:eo(function(){return Ei(Q).variable(!1)})});var ie=Array.isArray(p)?p[W].tensor:p[D];if(ie!=null){var fe=w.accumulatedGrads[W].variable,ye=w.accumulatedUpdates[W].variable;eo(function(){var Oe=fe.mul(w.rho).add(ie.square().mul(1-w.rho)),Re=ye.add(w.epsilon).sqrt().div(fe.add(w.epsilon).sqrt()).mul(ie),Pe=ye.mul(w.rho).add(Re.square().mul(1-w.rho));fe.assign(Oe),ye.assign(Pe);var je=Re.mul(-w.learningRate).add(Q);Q.assign(je)})}}),this.incrementIterations()},x.prototype.dispose=function(){this.accumulatedUpdates!=null&&(ca(this.accumulatedGrads.map(function(p){return p.variable})),ca(this.accumulatedUpdates.map(function(p){return p.variable})))},x.prototype.getWeights=function(){return S(this,void 0,void 0,function(){var p;return M(this,function(w){switch(w.label){case 0:return p=this.accumulatedGrads.concat(this.accumulatedUpdates),[4,this.saveIterations()];case 1:return[2,[w.sent()].concat(p.map(function(D){return{name:D.originalName,tensor:D.variable}}))]}})})},x.prototype.setWeights=function(p){return S(this,void 0,void 0,function(){var w;return M(this,function(D){switch(D.label){case 0:return[4,this.extractIterations(p)];case 1:return p=D.sent(),w=p.length/2,this.accumulatedGrads=p.slice(0,w).map(function(W){return{originalName:W.name,variable:W.tensor.variable(!1)}}),this.accumulatedUpdates=p.slice(w,2*w).map(function(W){return{originalName:W.name,variable:W.tensor.variable(!1)}}),[2]}})})},x.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},x.fromConfig=function(p,w){return new p(w.learningRate,w.rho,w.epsilon)},x.className="Adadelta",x}(nm);au(Rb);var Bb=function(C){function x(p,w){w===void 0&&(w=.1);var D=C.call(this)||this;return D.learningRate=p,D.initialAccumulatorValue=w,D.accumulatedGrads=[],D}return A(x,C),x.prototype.applyGradients=function(p){var w=this;(Array.isArray(p)?p.map(function(D){return D.name}):Object.keys(p)).forEach(function(D,W){var Q=qe.registeredVariables[D];w.accumulatedGrads[W]==null&&(w.accumulatedGrads[W]={originalName:D+"/accumulator",variable:eo(function(){return xu(Q.shape,w.initialAccumulatorValue).variable(!1)})});var ie=Array.isArray(p)?p[W].tensor:p[D];if(ie!=null){var fe=w.accumulatedGrads[W].variable;eo(function(){var ye=fe.add(ie.square());fe.assign(ye);var Oe=ie.div(ye.add(qe.backend.epsilon()).sqrt()).mul(-w.learningRate).add(Q);Q.assign(Oe)})}}),this.incrementIterations()},x.prototype.dispose=function(){this.accumulatedGrads!=null&&ca(this.accumulatedGrads.map(function(p){return p.variable}))},x.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(p){switch(p.label){case 0:return[4,this.saveIterations()];case 1:return[2,[p.sent()].concat(this.accumulatedGrads.map(function(w){return{name:w.originalName,tensor:w.variable}}))]}})})},x.prototype.setWeights=function(p){return S(this,void 0,void 0,function(){return M(this,function(w){switch(w.label){case 0:return[4,this.extractIterations(p)];case 1:return p=w.sent(),this.accumulatedGrads=p.map(function(D){return{originalName:D.name,variable:D.tensor.variable(!1)}}),[2]}})})},x.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},x.fromConfig=function(p,w){return new p(w.learningRate,w.initialAccumulatorValue)},x.className="Adagrad",x}(nm);au(Bb);var Pb=function(C){function x(p,w,D,W){W===void 0&&(W=null);var Q=C.call(this)||this;return Q.learningRate=p,Q.beta1=w,Q.beta2=D,Q.epsilon=W,Q.accumulatedFirstMoment=[],Q.accumulatedSecondMoment=[],eo(function(){Q.accBeta1=Or(w).variable(),Q.accBeta2=Or(D).variable()}),W==null&&(Q.epsilon=qe.backend.epsilon()),Q}return A(x,C),x.prototype.applyGradients=function(p){var w=this,D=Array.isArray(p)?p.map(function(W){return W.name}):Object.keys(p);eo(function(){var W=tf(1,w.accBeta1),Q=tf(1,w.accBeta2);D.forEach(function(ie,fe){var ye=qe.registeredVariables[ie];w.accumulatedFirstMoment[fe]==null&&(w.accumulatedFirstMoment[fe]={originalName:ie+"/m",variable:eo(function(){return Ei(ye).variable(!1)})}),w.accumulatedSecondMoment[fe]==null&&(w.accumulatedSecondMoment[fe]={originalName:ie+"/v",variable:eo(function(){return Ei(ye).variable(!1)})});var Oe=Array.isArray(p)?p[fe].tensor:p[ie];if(Oe!=null){var Re=w.accumulatedFirstMoment[fe].variable,Pe=w.accumulatedSecondMoment[fe].variable,je=Re.mul(w.beta1).add(Oe.mul(1-w.beta1)),Ge=Pe.mul(w.beta2).add(Oe.square().mul(1-w.beta2)),rt=je.div(W),nt=Ge.div(Q);Re.assign(je),Pe.assign(Ge);var lt=rt.div(nt.sqrt().add(w.epsilon)).mul(-w.learningRate).add(ye);ye.assign(lt)}}),w.accBeta1.assign(w.accBeta1.mul(w.beta1)),w.accBeta2.assign(w.accBeta2.mul(w.beta2))}),this.incrementIterations()},x.prototype.dispose=function(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&ca(this.accumulatedFirstMoment.map(function(p){return p.variable})),this.accumulatedSecondMoment!=null&&ca(this.accumulatedSecondMoment.map(function(p){return p.variable}))},x.prototype.getWeights=function(){return S(this,void 0,void 0,function(){var p;return M(this,function(w){switch(w.label){case 0:return p=this.accumulatedFirstMoment.concat(this.accumulatedSecondMoment),[4,this.saveIterations()];case 1:return[2,[w.sent()].concat(p.map(function(D){return{name:D.originalName,tensor:D.variable}}))]}})})},x.prototype.setWeights=function(p){return S(this,void 0,void 0,function(){var w,D=this;return M(this,function(W){switch(W.label){case 0:return[4,this.extractIterations(p)];case 1:return p=W.sent(),eo(function(){D.accBeta1.assign(Dh(D.beta1,D.iterations_+1)),D.accBeta2.assign(Dh(D.beta2,D.iterations_+1))}),w=p.length/2,this.accumulatedFirstMoment=p.slice(0,w).map(function(Q){return{originalName:Q.name,variable:Q.tensor.variable(!1)}}),this.accumulatedSecondMoment=p.slice(w,2*w).map(function(Q){return{originalName:Q.name,variable:Q.tensor.variable(!1)}}),[2]}})})},x.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},x.fromConfig=function(p,w){return new p(w.learningRate,w.beta1,w.beta2,w.epsilon)},x.className="Adam",x}(nm);au(Pb);var Oy=function(C){function x(p,w,D,W,Q){W===void 0&&(W=null),Q===void 0&&(Q=0);var ie=C.call(this)||this;return ie.learningRate=p,ie.beta1=w,ie.beta2=D,ie.epsilon=W,ie.decay=Q,ie.accumulatedFirstMoment=[],ie.accumulatedWeightedInfNorm=[],eo(function(){ie.iteration=Or(0).variable(),ie.accBeta1=Or(w).variable()}),W==null&&(ie.epsilon=qe.backend.epsilon()),ie}return A(x,C),x.prototype.applyGradients=function(p){var w=this,D=Array.isArray(p)?p.map(function(W){return W.name}):Object.keys(p);eo(function(){var W=tf(1,w.accBeta1),Q=Ed(-w.learningRate,w.iteration.mul(w.decay).add(1));D.forEach(function(ie,fe){var ye=qe.registeredVariables[ie];w.accumulatedFirstMoment[fe]==null&&(w.accumulatedFirstMoment[fe]={originalName:ie+"/m",variable:Ei(ye).variable(!1)}),w.accumulatedWeightedInfNorm[fe]==null&&(w.accumulatedWeightedInfNorm[fe]={originalName:ie+"/v",variable:Ei(ye).variable(!1)});var Oe=Array.isArray(p)?p[fe].tensor:p[ie];if(Oe!=null){var Re=w.accumulatedFirstMoment[fe].variable,Pe=w.accumulatedWeightedInfNorm[fe].variable,je=Re.mul(w.beta1).add(Oe.mul(1-w.beta1)),Ge=Pe.mul(w.beta2),rt=Oe.abs(),nt=Ge.maximum(rt);Re.assign(je),Pe.assign(nt);var lt=Q.div(W).mul(je.div(nt.add(w.epsilon))).add(ye);ye.assign(lt)}}),w.iteration.assign(w.iteration.add(1)),w.accBeta1.assign(w.accBeta1.mul(w.beta1))}),this.incrementIterations()},x.prototype.dispose=function(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&ca(this.accumulatedFirstMoment.map(function(p){return p.variable})),this.accumulatedWeightedInfNorm!=null&&ca(this.accumulatedWeightedInfNorm.map(function(p){return p.variable}))},x.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(p){throw new Error("getWeights() is not implemented for Adamax yet.")})})},x.prototype.setWeights=function(p){return S(this,void 0,void 0,function(){return M(this,function(w){throw new Error("setWeights() is not implemented for Adamax yet.")})})},x.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},x.fromConfig=function(p,w){return new p(w.learningRate,w.beta1,w.beta2,w.epsilon,w.decay)},x.className="Adamax",x}(nm);au(Oy);var A1=function(C){function x(p){var w=C.call(this)||this;return w.learningRate=p,w.setLearningRate(p),w}return A(x,C),x.prototype.applyGradients=function(p){var w=this;(Array.isArray(p)?p.map(function(D){return D.name}):Object.keys(p)).forEach(function(D,W){var Q=Array.isArray(p)?p[W].tensor:p[D];if(Q!=null){var ie=qe.registeredVariables[D];eo(function(){var fe=w.c.mul(Q).add(ie);ie.assign(fe)})}}),this.incrementIterations()},x.prototype.setLearningRate=function(p){this.learningRate=p,this.c!=null&&this.c.dispose(),this.c=xp(Or(-p))},x.prototype.dispose=function(){this.c.dispose()},x.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(p){switch(p.label){case 0:return[4,this.saveIterations()];case 1:return[2,[p.sent()]]}})})},x.prototype.setWeights=function(p){return S(this,void 0,void 0,function(){return M(this,function(w){switch(w.label){case 0:return[4,this.extractIterations(p)];case 1:if((p=w.sent()).length!==0)throw new Error("SGD optimizer does not have settable weights.");return[2]}})})},x.prototype.getConfig=function(){return{learningRate:this.learningRate}},x.fromConfig=function(p,w){return new p(w.learningRate)},x.className="SGD",x}(nm);au(A1);var Dy=function(C){function x(p,w,D){D===void 0&&(D=!1);var W=C.call(this,p)||this;return W.learningRate=p,W.momentum=w,W.useNesterov=D,W.accumulations=[],W.m=Or(W.momentum),W}return A(x,C),x.prototype.applyGradients=function(p){var w=this;(Array.isArray(p)?p.map(function(D){return D.name}):Object.keys(p)).forEach(function(D,W){var Q=qe.registeredVariables[D];w.accumulations[W]==null&&(w.accumulations[W]={originalName:D+"/momentum",variable:eo(function(){return Ei(Q).variable(!1)})});var ie=w.accumulations[W].variable,fe=Array.isArray(p)?p[W].tensor:p[D];fe!=null&&eo(function(){var ye,Oe=w.m.mul(ie).add(fe);ye=w.useNesterov?w.c.mul(fe.add(Oe.mul(w.m))).add(Q):w.c.mul(Oe).add(Q),ie.assign(Oe),Q.assign(ye)})}),this.incrementIterations()},x.prototype.dispose=function(){this.m.dispose(),this.accumulations!=null&&ca(this.accumulations.map(function(p){return p.variable}))},x.prototype.setMomentum=function(p){this.momentum=p},x.prototype.getWeights=function(){return S(this,void 0,void 0,function(){return M(this,function(p){switch(p.label){case 0:return[4,this.saveIterations()];case 1:return[2,[p.sent()].concat(this.accumulations.map(function(w){return{name:w.originalName,tensor:w.variable}}))]}})})},x.prototype.setWeights=function(p){return S(this,void 0,void 0,function(){return M(this,function(w){switch(w.label){case 0:return[4,this.extractIterations(p)];case 1:return p=w.sent(),this.accumulations=p.map(function(D){return{originalName:D.name,variable:D.tensor.variable(!1)}}),[2]}})})},x.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},x.fromConfig=function(p,w){return new p(w.learningRate,w.momentum,w.useNesterov)},x.className="Momentum",x}(A1);au(Dy);var O1=function(C){function x(p,w,D,W,Q){w===void 0&&(w=.9),D===void 0&&(D=0),W===void 0&&(W=null),Q===void 0&&(Q=!1);var ie=C.call(this)||this;if(ie.learningRate=p,ie.decay=w,ie.momentum=D,ie.epsilon=W,ie.accumulatedMeanSquares=[],ie.accumulatedMoments=[],ie.accumulatedMeanGrads=[],ie.centered=Q,W==null&&(ie.epsilon=qe.backend.epsilon()),p==null)throw new Error("learningRate for RMSPropOptimizer must be defined.");return ie}return A(x,C),x.prototype.applyGradients=function(p){var w=this;(Array.isArray(p)?p.map(function(D){return D.name}):Object.keys(p)).forEach(function(D,W){var Q=qe.registeredVariables[D];w.accumulatedMeanSquares[W]==null&&(w.accumulatedMeanSquares[W]={originalName:D+"/rms",variable:eo(function(){return Ei(Q).variable(!1)})}),w.accumulatedMoments[W]==null&&(w.accumulatedMoments[W]={originalName:D+"/momentum",variable:eo(function(){return Ei(Q).variable(!1)})}),w.accumulatedMeanGrads[W]==null&&w.centered&&(w.accumulatedMeanGrads[W]={originalName:D+"/mg",variable:eo(function(){return Ei(Q).variable(!1)})});var ie=Array.isArray(p)?p[W].tensor:p[D];if(ie!=null){var fe=w.accumulatedMeanSquares[W].variable,ye=w.accumulatedMoments[W].variable;eo(function(){var Oe=fe.mul(w.decay).add(ie.square().mul(1-w.decay));if(w.centered){var Re=w.accumulatedMeanGrads[W].variable,Pe=Re.mul(w.decay).add(ie.mul(1-w.decay)),je=ye.mul(w.momentum).add(ie.mul(w.learningRate).div(Oe.sub(Pe.square().add(w.epsilon)).sqrt()));fe.assign(Oe),Re.assign(Pe),ye.assign(je);var Ge=Q.sub(je);Q.assign(Ge)}else{var rt=fe.mul(w.decay).add(ie.square().mul(1-w.decay));je=ye.mul(w.momentum).add(ie.mul(w.learningRate).div(rt.add(w.epsilon).sqrt())),fe.assign(rt),ye.assign(je),Ge=Q.sub(je),Q.assign(Ge)}})}}),this.incrementIterations()},x.prototype.dispose=function(){this.accumulatedMeanSquares!=null&&ca(this.accumulatedMeanSquares.map(function(p){return p.variable})),this.accumulatedMeanGrads!=null&&this.centered&&ca(this.accumulatedMeanGrads.map(function(p){return p.variable})),this.accumulatedMoments!=null&&ca(this.accumulatedMoments.map(function(p){return p.variable}))},x.prototype.getWeights=function(){return S(this,void 0,void 0,function(){var p;return M(this,function(w){switch(w.label){case 0:return p=this.accumulatedMeanSquares.concat(this.accumulatedMoments),this.centered&&p.push.apply(
7668p,this.accumulatedMeanGrads),[4,this.saveIterations()];case 1:return[2,[w.sent()].concat(p.map(function(D){return{name:D.originalName,tensor:D.variable}}))]}})})},x.prototype.setWeights=function(p){return S(this,void 0,void 0,function(){var w;return M(this,function(D){switch(D.label){case 0:return[4,this.extractIterations(p)];case 1:return p=D.sent(),w=this.centered?p.length/3:p.length/2,this.accumulatedMeanSquares=p.slice(0,w).map(function(W){return{originalName:W.name,variable:W.tensor.variable(!1)}}),this.accumulatedMoments=p.slice(w,2*w).map(function(W){return{originalName:W.name,variable:W.tensor.variable(!1)}}),this.centered&&(this.accumulatedMeanGrads=p.slice(2*w,3*w).map(function(W){return{originalName:W.name,variable:W.tensor.variable(!1)}})),[2]}})})},x.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},x.fromConfig=function(p,w){return new p(w.learningRate,w.decay,w.momentum,w.epsilon,w.centered)},x.className="RMSProp",x}(nm);au(O1);var Ml=function(){function C(){}return C.sgd=function(x){return new A1(x)},C.momentum=function(x,p,w){return w===void 0&&(w=!1),new Dy(x,p,w)},C.rmsprop=function(x,p,w,D,W){return p===void 0&&(p=.9),w===void 0&&(w=0),D===void 0&&(D=null),W===void 0&&(W=!1),new O1(x,p,w,D,W)},C.adam=function(x,p,w,D){return x===void 0&&(x=.001),p===void 0&&(p=.9),w===void 0&&(w=.999),D===void 0&&(D=null),new Pb(x,p,w,D)},C.adadelta=function(x,p,w){return x===void 0&&(x=.001),p===void 0&&(p=.95),w===void 0&&(w=null),new Rb(x,p,w)},C.adamax=function(x,p,w,D,W){return x===void 0&&(x=.002),p===void 0&&(p=.9),w===void 0&&(w=.999),D===void 0&&(D=null),W===void 0&&(W=0),new Oy(x,p,w,D,W)},C.adagrad=function(x,p){return p===void 0&&(p=.1),new Bb(x,p)},C}(),jb={sgd:Ml.sgd,momentum:Ml.momentum,adadelta:Ml.adadelta,adagrad:Ml.adagrad,rmsprop:Ml.rmsprop,adamax:Ml.adamax,adam:Ml.adam},cl=typeof requestAnimationFrame<"u"?requestAnimationFrame:g!==void 0?g:function(C){return C()};function Pd(){return new Promise(function(C){return cl(function(){return C()})})}Zt.prototype.squaredDifference=function(C){return _h(this,C)},Ft=h0}.call(this,n(59),n(75),n(92).Buffer,n(207).setImmediate)},function(a,i,n){a.exports=n(281)},function(a,i,n){n.d(i,"c",function(){return h}),n.d(i,"a",function(){return v}),n.d(i,"b",function(){return g}),n.d(i,"d",function(){return O}),n.d(i,"e",function(){return A});/*! ***************************************************************************** 7669 Copyright (c) Microsoft Corporation. 7670 7671 Permission to use, copy, modify, and/or distribute this software for any 7672 purpose with or without fee is hereby granted. 7673 7674 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 7675 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 7676 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 7677 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 7678 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 7679 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 7680 PERFORMANCE OF THIS SOFTWARE. 7681 ***************************************************************************** */var s=function(S,M){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,L){P.__proto__=L}||function(P,L){for(var V in L)L.hasOwnProperty(V)&&(P[V]=L[V])})(S,M)};function h(S,M){function P(){this.constructor=S}s(S,M),S.prototype=M===null?Object.create(M):(P.prototype=M.prototype,new P)}var v=function(){return(v=Object.assign||function(S){for(var M,P=1,L=arguments.length;P<L;P++)for(var V in M=arguments[P])Object.prototype.hasOwnProperty.call(M,V)&&(S[V]=M[V]);return S}).apply(this,arguments)};function g(S,M,P,L){return new(P||(P=Promise))(function(V,N){function ee(re){try{K(L.next(re))}catch(ce){N(ce)}}function J(re){try{K(L.throw(re))}catch(ce){N(ce)}}function K(re){re.done?V(re.value):function(ce){return ce instanceof P?ce:new P(function(pe){pe(ce)})}(re.value).then(ee,J)}K((L=L.apply(S,M||[])).next())})}function O(S,M){var P,L,V,N,ee={label:0,sent:function(){if(1&V[0])throw V[1];return V[1]},trys:[],ops:[]};return N={next:J(0),throw:J(1),return:J(2)},typeof Symbol=="function"&&(N[Symbol.iterator]=function(){return this}),N;function J(K){return function(re){return function(ce){if(P)throw new TypeError("Generator is already executing.");for(;ee;)try{if(P=1,L&&(V=2&ce[0]?L.return:ce[0]?L.throw||((V=L.return)&&V.call(L),0):L.next)&&!(V=V.call(L,ce[1])).done)return V;switch(L=0,V&&(ce=[2&ce[0],V.value]),ce[0]){case 0:case 1:V=ce;break;case 4:return ee.label++,{value:ce[1],done:!1};case 5:ee.label++,L=ce[1],ce=[0];continue;case 7:ce=ee.ops.pop(),ee.trys.pop();continue;default:if(!(V=(V=ee.trys).length>0&&V[V.length-1])&&(ce[0]===6||ce[0]===2)){ee=0;continue}if(ce[0]===3&&(!V||ce[1]>V[0]&&ce[1]<V[3])){ee.label=ce[1];break}if(ce[0]===6&&ee.label<V[1]){ee.label=V[1],V=ce;break}if(V&&ee.label<V[2]){ee.label=V[2],ee.ops.push(ce);break}V[2]&&ee.ops.pop(),ee.trys.pop();continue}ce=M.call(S,ee)}catch(pe){ce=[6,pe],L=0}finally{P=V=0}if(5&ce[0])throw ce[1];return{value:ce[0]?ce[1]:void 0,done:!0}}([K,re])}}}function A(){for(var S=0,M=0,P=arguments.length;M<P;M++)S+=arguments[M].length;var L=Array(S),V=0;for(M=0;M<P;M++)for(var N=arguments[M],ee=0,J=N.length;ee<J;ee++,V++)L[V]=N[ee];return L}},function(a,i){function n(s,h,v,g,O,A,S){try{var M=s[A](S),P=M.value}catch(L){return void v(L)}M.done?h(P):Promise.resolve(P).then(g,O)}a.exports=function(s){return function(){var h=this,v=arguments;return new Promise(function(g,O){var A=s.apply(h,v);function S(P){n(A,g,O,S,M,"next",P)}function M(P){n(A,g,O,S,M,"throw",P)}S(void 0)})}},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i){function n(s){return a.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},a.exports.__esModule=!0,a.exports.default=a.exports,n(s)}a.exports=n,a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){var s=n(16),h=n(24),v=n(42),g=n(38),O=n(56),A=function(S,M,P){var L,V,N,ee,J=S&A.F,K=S&A.G,re=S&A.S,ce=S&A.P,pe=S&A.B,ke=K?s:re?s[M]||(s[M]={}):(s[M]||{}).prototype,Ce=K?h:h[M]||(h[M]={}),be=Ce.prototype||(Ce.prototype={});for(L in K&&(P=M),P)N=((V=!J&&ke&&ke[L]!==void 0)?ke:P)[L],ee=pe&&V?O(N,s):ce&&typeof N=="function"?O(Function.call,N):N,ke&&g(ke,L,N,S&A.U),Ce[L]!=N&&v(Ce,L,ee),ce&&be[L]!=N&&(be[L]=N)};s.core=h,A.F=1,A.G=2,A.S=4,A.P=8,A.B=16,A.W=32,A.U=64,A.R=128,a.exports=A},function(a,i){function n(s,h){for(var v=0;v<h.length;v++){var g=h[v];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(s,g.key,g)}}a.exports=function(s,h,v){return h&&n(s.prototype,h),v&&n(s,v),Object.defineProperty(s,"prototype",{writable:!1}),s},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i){a.exports=function(n,s){if(!(n instanceof s))throw new TypeError("Cannot call a class as a function")},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){n.d(i,"a",function(){return $e}),n.d(i,"b",function(){return ht}),n.d(i,"c",function(){return Dt}),n.d(i,"d",function(){return Ut}),n.d(i,"e",function(){return zt}),n.d(i,"f",function(){return Ee}),n.d(i,"g",function(){return Ce}),n.d(i,"h",function(){return ke}),n.d(i,"i",function(){return Ot}),n.d(i,"j",function(){return Mt}),n.d(i,"k",function(){return be}),n.d(i,"l",function(){return pe}),n.d(i,"m",function(){return _t}),n.d(i,"n",function(){return $i}),n.d(i,"o",function(){return jn}),n.d(i,"p",function(){return rn}),n.d(i,"q",function(){return Fn}),n.d(i,"r",function(){return xr}),n.d(i,"s",function(){return yt}),n.d(i,"t",function(){return Tt}),n.d(i,"u",function(){return cr}),n.d(i,"v",function(){return fn}),n.d(i,"w",function(){return Ar}),n.d(i,"x",function(){return fi}),n.d(i,"y",function(){return We}),n.d(i,"z",function(){return Ye}),n.d(i,"A",function(){return Ze});var s=n(1),h=n(72),v=n(40),g=n(71),O=n(39),A=n(70),S=n(135),M=n(184),P=n(183),L=n(69),V=n(182),N=n(68),ee=n(134),J=n(181),K=n(180),re=n(108),ce=n(45);const pe="year",ke="quarter",Ce="month",be="week",$e="date",ht="day",Dt="dayofyear",Ut="hours",Ee="minutes",Ot="seconds",zt="milliseconds",Mt=[pe,ke,Ce,be,$e,ht,Dt,Ut,Ee,Ot,zt],Ke=Mt.reduce((Ft,Qr,Zt)=>(Ft[Qr]=1+Zt,Ft),{});function Tt(Ft){const Qr=Object(s.i)(Ft).slice(),Zt={};return Qr.length||Object(s.o)("Missing time unit."),Qr.forEach(_e=>{Object(s.w)(Ke,_e)?Zt[_e]=1:Object(s.o)("Invalid time unit: ".concat(_e,"."))}),(Zt[be]||Zt[ht]?1:0)+(Zt[ke]||Zt[Ce]||Zt[$e]?1:0)+(Zt[Dt]?1:0)>1&&Object(s.o)("Incompatible time units: ".concat(Ft)),Qr.sort((_e,ge)=>Ke[_e]-Ke[ge]),Qr}const vt={[pe]:"%Y ",[ke]:"Q%q ",[Ce]:"%b ",[$e]:"%d ",[be]:"W%U ",[ht]:"
7681%a ",[Dt]:"%j ",[Ut]:"%H:00",[Ee]:"00:%M",[Ot]:":%S",[zt]:".%L",["".concat(pe,"-").concat(Ce)]:"%Y-%m ",["".concat(pe,"-").concat(Ce,"-").concat($e)]:"%Y-%m-%d ",["".concat(Ut,"-").concat(Ee)]:"%H:%M"};function yt(Ft,Qr){const Zt=Object(s.p)({},vt,Qr),_e=Tt(Ft),ge=_e.length;let Ae,Ie,it="",St=0;for(St=0;St<ge;)for(Ae=_e.length;Ae>St;--Ae)if(Zt[Ie=_e.slice(St,Ae).join("-")]!=null){it+=Zt[Ie],St=Ae;break}return it.trim()}const bt=new Date;function Ht(Ft){return bt.setFullYear(Ft),bt.setMonth(0),bt.setDate(1),bt.setHours(0,0,0,0),bt}function _t(Ft){return Vt(new Date(Ft))}function Ze(Ft){return sn(new Date(Ft))}function Vt(Ft){return h.a.count(Ht(Ft.getFullYear())-1,Ft)}function sn(Ft){return v.b.count(Ht(Ft.getFullYear())-1,Ft)}function yn(Ft){return Ht(Ft).getDay()}function Yt(Ft,Qr,Zt,_e,ge,Ae,Ie){if(0<=Ft&&Ft<100){const it=new Date(-1,Qr,Zt,_e,ge,Ae,Ie);return it.setFullYear(Ft),it}return new Date(Ft,Qr,Zt,_e,ge,Ae,Ie)}function We(Ft){return He(new Date(Ft))}function Ye(Ft){return dt(new Date(Ft))}function He(Ft){const Qr=Date.UTC(Ft.getUTCFullYear(),0,1);return g.a.count(Qr-1,Ft)}function dt(Ft){const Qr=Date.UTC(Ft.getUTCFullYear(),0,1);return O.b.count(Qr-1,Ft)}function It(Ft){return bt.setTime(Date.UTC(Ft,0,1)),bt.getUTCDay()}function ct(Ft,Qr,Zt,_e,ge,Ae,Ie){if(0<=Ft&&Ft<100){const it=new Date(Date.UTC(-1,Qr,Zt,_e,ge,Ae,Ie));return it.setUTCFullYear(Zt.y),it}return new Date(Date.UTC(Ft,Qr,Zt,_e,ge,Ae,Ie))}function on(Ft,Qr,Zt,_e,ge){const Ae=Qr||1,Ie=Object(s.W)(Ft),it=(Sn,un,qe)=>function($n,er,sr,pr){const Zr=sr<=1?$n:pr?(Mr,Ii)=>pr+sr*Math.floor(($n(Mr,Ii)-pr)/sr):(Mr,Ii)=>sr*Math.floor($n(Mr,Ii)/sr);return er?(Mr,Ii)=>er(Zr(Mr,Ii),Ii):Zr}(Zt[qe=qe||Sn],_e[qe],Sn===Ie&&Ae,un),St=new Date,Jt=Object(s.Fa)(Ft),kn=Jt[pe]?it(pe):Object(s.m)(2012),rr=Jt[Ce]?it(Ce):Jt[ke]?it(ke):s.Ma,Bn=Jt[be]&&Jt[ht]?it(ht,1,be+ht):Jt[be]?it(be,1):Jt[ht]?it(ht,1):Jt[$e]?it($e,1):Jt[Dt]?it(Dt,1):s.Q,Gn=Jt[Ut]?it(Ut):s.Ma,Zn=Jt[Ee]?it(Ee):s.Ma,Gt=Jt[Ot]?it(Ot):s.Ma,Wt=Jt[zt]?it(zt):s.Ma;return function(Sn){St.setTime(+Sn);const un=kn(St);return ge(un,rr(St),Bn(St,un),Gn(St),Zn(St),Gt(St),Wt(St))}}function Xt(Ft,Qr,Zt){return Qr+7*Ft-(Zt+6)%7}const En={[pe]:Ft=>Ft.getFullYear(),[ke]:Ft=>Math.floor(Ft.getMonth()/3),[Ce]:Ft=>Ft.getMonth(),[$e]:Ft=>Ft.getDate(),[Ut]:Ft=>Ft.getHours(),[Ee]:Ft=>Ft.getMinutes(),[Ot]:Ft=>Ft.getSeconds(),[zt]:Ft=>Ft.getMilliseconds(),[Dt]:Ft=>Vt(Ft),[be]:Ft=>sn(Ft),[be+ht]:(Ft,Qr)=>Xt(sn(Ft),Ft.getDay(),yn(Qr)),[ht]:(Ft,Qr)=>Xt(1,Ft.getDay(),yn(Qr))},xe={[ke]:Ft=>3*Ft,[be]:(Ft,Qr)=>Xt(Ft,0,yn(Qr))};function jn(Ft,Qr){return on(Ft,Qr||1,En,xe,Yt)}const nr={[pe]:Ft=>Ft.getUTCFullYear(),[ke]:Ft=>Math.floor(Ft.getUTCMonth()/3),[Ce]:Ft=>Ft.getUTCMonth(),[$e]:Ft=>Ft.getUTCDate(),[Ut]:Ft=>Ft.getUTCHours(),[Ee]:Ft=>Ft.getUTCMinutes(),[Ot]:Ft=>Ft.getUTCSeconds(),[zt]:Ft=>Ft.getUTCMilliseconds(),[Dt]:Ft=>He(Ft),[be]:Ft=>dt(Ft),[ht]:(Ft,Qr)=>Xt(1,Ft.getUTCDay(),It(Qr)),[be+ht]:(Ft,Qr)=>Xt(dt(Ft),Ft.getUTCDay(),It(Qr))},ar={[ke]:Ft=>3*Ft,[be]:(Ft,Qr)=>Xt(Ft,0,It(Qr))};function cr(Ft,Qr){return on(Ft,Qr||1,nr,ar,ct)}const Er={[pe]:A.a,[ke]:S.a.every(3),[Ce]:S.a,[be]:v.b,[$e]:h.a,[ht]:h.a,[Dt]:h.a,[Ut]:M.a,[Ee]:P.a,[Ot]:L.a,[zt]:V.a},hn={[pe]:N.a,[ke]:ee.a.every(3),[Ce]:ee.a,[be]:O.b,[$e]:g.a,[ht]:g.a,[Dt]:g.a,[Ut]:J.a,[Ee]:K.a,[Ot]:L.a,[zt]:V.a};function rn(Ft){return Er[Ft]}function fn(Ft){return hn[Ft]}function Xn(Ft,Qr,Zt){return Ft?Ft.offset(Qr,Zt):void 0}function Fn(Ft,Qr,Zt){return Xn(rn(Ft),Qr,Zt)}function Ar(Ft,Qr,Zt){return Xn(fn(Ft),Qr,Zt)}function Dr(Ft,Qr,Zt,_e){return Ft?Ft.range(Qr,Zt,_e):void 0}function xr(Ft,Qr,Zt,_e){return Dr(rn(Ft),Qr,Zt,_e)}function fi(Ft,Qr,Zt,_e){return Dr(fn(Ft),Qr,Zt,_e)}const ci=31536e6,qr=[pe,Ce,$e,Ut,Ee,Ot,zt],mi=qr.slice(0,-1),Ir=mi.slice(0,-1),ti=Ir.slice(0,-1),ri=ti.slice(0,-1),yi=[pe,Ce],na=[pe],co=[[mi,1,1e3],[mi,5,5e3],[mi,15,15e3],[mi,30,3e4],[Ir,1,6e4],[Ir,5,3e5],[Ir,15,9e5],[Ir,30,18e5],[ti,1,36e5],[ti,3,108e5],[ti,6,216e5],[ti,12,432e5],[ri,1,864e5],[[pe,be],1,6048e5],[yi,1,2592e6],[yi,3,7776e6],[na,1,ci]];function $i(Ft){const Qr=Ft.extent,Zt=Ft.maxbins||40,_e=Math.abs(Object(s.Z)(Qr))/Zt;let ge,Ae,Ie=Object(re.a)(it=>it[2]).right(co,_e);return Ie===co.length?(ge=na,Ae=Object(ce.c)(Qr[0]/ci,Qr[1]/ci,Zt)):Ie?(ge=(Ie=co[_e/co[Ie-1][2]<co[Ie][2]/_e?Ie-1:Ie])[0],Ae=Ie[1]):(ge=qr,Ae=Math.max(Object(ce.c)(Qr[0],Qr[1],Zt),1)),{units:ge,step:Ae}}},function(a,i,n){n.d(i,"e",function(){return s}),n.d(i,"c",function(){return h}),n.d(i,"b",function(){return v}),n.d(i,"a",function(){return g}),n.d(i,"f",function(){return O}),n.d(i,"d",function(){return A}),n.d(i,"g",function(){return S});const s=1e3,h=60*s,v=60*h,g=24*v,O=7*g,A=30*g,S=365*g},function(a,i){a.exports=function(n){return typeof n=="object"?n!==null:typeof n=="function"}},function(a,i,n){var s=n(13);a.exports=function(h){if(!s(h))throw TypeError(h+" is not an object!");return h}},function(a,i){a.exports=function(n){try{return!!n()}catch{return!0}}},function(a,i){var n=a.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=n)},function(a,i,n){a.exports=n(280)},function(a,i){a.exports=function(n,s,h){return s in n?Object.defineProperty(n,s,{value:h,enumerable:!0,configurable:!0,writable:!0}):n[s]=h,n},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){var s=n(129)("wks"),h=n(84),v=n(16).Symbol,g=typeof v=="function";(a.exports=function(O){return s[O]||(s[O]=g&&v[O]||(g?v:h)("Symbol."+O))}).store=s},function(a,i,n){n.r(i),function(s){n.d(i,"GraphModel",function(){return Ft}),n.d(i,"loadGraphModel",function(){return Qr}),n.d(i,"deregisterOp",function(){return V}),n.d(i,"registerOp",function(){return P}),n.d(i,"version_converter",function(){return Zt});var h,v,g=n(0),O=function(){return(O=Object.assign||function(_e){for(var ge,Ae=1,Ie=arguments.length;Ae<Ie;Ae++)for(var it in ge=arguments[Ae])Object.prototype.hasOwnProperty.call(ge,it)&&(_e[it]=ge[it]);return _e}).apply(this,arguments)};/** 7682 * @license 7683 * Copyright 2020 Google LLC. All Rights Reserved. 7684 * Licensed under the Apache License, Version 2.0 (the "License");
7685 * you may not use this file except in compliance with the License. 7686 * You may obtain a copy of the License at 7687 * 7688 * http://www.apache.org/licenses/LICENSE-2.0 7689 * 7690 * Unless required by applicable law or agreed to in writing, software 7691 * distributed under the License is distributed on an "AS IS" BASIS, 7692 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7693 * See the License for the specific language governing permissions and 7694 * limitations under the License. 7695 * ============================================================================= 7696 */function A(_e,ge,Ae,Ie){return new(Ae||(Ae=Promise))(function(it,St){function Jt(Bn){try{rr(Ie.next(Bn))}catch(Gn){St(Gn)}}function kn(Bn){try{rr(Ie.throw(Bn))}catch(Gn){St(Gn)}}function rr(Bn){Bn.done?it(Bn.value):new Ae(function(Gn){Gn(Bn.value)}).then(Jt,kn)}rr((Ie=Ie.apply(_e,ge||[])).next())})}function S(_e,ge){var Ae,Ie,it,St,Jt={label:0,sent:function(){if(1&it[0])throw it[1];return it[1]},trys:[],ops:[]};return St={next:kn(0),throw:kn(1),return:kn(2)},typeof Symbol=="function"&&(St[Symbol.iterator]=function(){return this}),St;function kn(rr){return function(Bn){return function(Gn){if(Ae)throw new TypeError("Generator is already executing.");for(;Jt;)try{if(Ae=1,Ie&&(it=2&Gn[0]?Ie.return:Gn[0]?Ie.throw||((it=Ie.return)&&it.call(Ie),0):Ie.next)&&!(it=it.call(Ie,Gn[1])).done)return it;switch(Ie=0,it&&(Gn=[2&Gn[0],it.value]),Gn[0]){case 0:case 1:it=Gn;break;case 4:return Jt.label++,{value:Gn[1],done:!1};case 5:Jt.label++,Ie=Gn[1],Gn=[0];continue;case 7:Gn=Jt.ops.pop(),Jt.trys.pop();continue;default:if(!(it=(it=Jt.trys).length>0&&it[it.length-1])&&(Gn[0]===6||Gn[0]===2)){Jt=0;continue}if(Gn[0]===3&&(!it||Gn[1]>it[0]&&Gn[1]<it[3])){Jt.label=Gn[1];break}if(Gn[0]===6&&Jt.label<it[1]){Jt.label=it[1],it=Gn;break}if(it&&Jt.label<it[2]){Jt.label=it[2],Jt.ops.push(Gn);break}it[2]&&Jt.ops.pop(),Jt.trys.pop();continue}Gn=ge.call(_e,Jt)}catch(Zn){Gn=[6,Zn],Ie=0}finally{Ae=it=0}if(5&Gn[0])throw Gn[1];return{value:Gn[0]?Gn[1]:void 0,done:!0}}([rr,Bn])}}}(function(_e){_e[_e.DT_INVALID=0]="DT_INVALID",_e[_e.DT_FLOAT=1]="DT_FLOAT",_e[_e.DT_DOUBLE=2]="DT_DOUBLE",_e[_e.DT_INT32=3]="DT_INT32",_e[_e.DT_UINT8=4]="DT_UINT8",_e[_e.DT_INT16=5]="DT_INT16",_e[_e.DT_INT8=6]="DT_INT8",_e[_e.DT_STRING=7]="DT_STRING",_e[_e.DT_COMPLEX64=8]="DT_COMPLEX64",_e[_e.DT_INT64=9]="DT_INT64",_e[_e.DT_BOOL=10]="DT_BOOL",_e[_e.DT_QINT8=11]="DT_QINT8",_e[_e.DT_QUINT8=12]="DT_QUINT8",_e[_e.DT_QINT32=13]="DT_QINT32",_e[_e.DT_BFLOAT16=14]="DT_BFLOAT16",_e[_e.DT_FLOAT_REF=101]="DT_FLOAT_REF",_e[_e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",_e[_e.DT_INT32_REF=103]="DT_INT32_REF",_e[_e.DT_UINT8_REF=104]="DT_UINT8_REF",_e[_e.DT_INT16_REF=105]="DT_INT16_REF",_e[_e.DT_INT8_REF=106]="DT_INT8_REF",_e[_e.DT_STRING_REF=107]="DT_STRING_REF",_e[_e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",_e[_e.DT_INT64_REF=109]="DT_INT64_REF",_e[_e.DT_BOOL_REF=110]="DT_BOOL_REF",_e[_e.DT_QINT8_REF=111]="DT_QINT8_REF",_e[_e.DT_QUINT8_REF=112]="DT_QUINT8_REF",_e[_e.DT_QINT32_REF=113]="DT_QINT32_REF",_e[_e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF"})(h||(h={})),function(_e){(function(ge){ge[ge.LEGACY=0]="LEGACY",ge[ge.V1=1]="V1",ge[ge.V2=2]="V2"})(_e.CheckpointFormatVersion||(_e.CheckpointFormatVersion={}))}(v||(v={}));var M={};function P(_e,ge){var Ae={tfOpName:_e,category:"custom",inputs:[],attrs:[],customExecutor:ge};M[_e]=Ae}function L(_e){return M[_e]}function V(_e){delete M[_e]}function N(_e,ge,Ae,Ie){var it=ge.inputParams[_e];if(it&&it.inputIndexStart!==void 0){var St=it.inputIndexStart,Jt=it.inputIndexEnd===0?void 0:it.inputIndexEnd===void 0?St+1:it.inputIndexEnd;if(it.type==="tensor")return ee(ge.inputNames[it.inputIndexStart],Ae,Ie);if(it.type==="tensors")return ge.inputNames.slice(St,Jt).map(function(Bn){return ee(Bn,Ae,Ie)});var kn=Array.prototype.slice.call(ee(ge.inputNames.slice(St)[0],Ae,Ie).dataSync());return it.type==="number"?kn[0]:kn}var rr=ge.attrParams[_e];return rr&&rr.value}function ee(_e,ge,Ae){var Ie=re(_e),it=Ie[0],St=Ie[1],Jt=Ae.currentContextIds.find(function(kn){return!!ge[K(it,kn)]});return Jt!==void 0?ge[K(it,Jt)][St]:void 0}function J(_e,ge){var Ae=re(_e),Ie=Ae[0],it=Ae[1];return[K(Ie,ge&&ge.currentContextId),it]}function K(_e,ge){return ge?_e+"-"+ge:_e}function re(_e){var ge=_e.lastIndexOf(":");return ge===-1?[_e,0]:[_e.substring(0,ge),Number(_e.substring(ge+1))]}function ce(_e,ge){for(var Ae=[],Ie=0;Ie<_e.length;Ie+=ge)Ae.push(_e.slice(Ie,Ie+ge));return Ae}var pe=Object.freeze({json:[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
7696]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),ke=Object.freeze({json:[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"clip_value_min",name:"clipValueMin",type:"number"},{tfName:"clip_value_max",name:"clipValueMax",type:"number"}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
7696]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"clipValueMin",name:"clipValueMin",type:"number",defaultValue:0},{tfName:"clipValueMax",name:"clipValueMax",type:"number",defaultValue:6}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
7696]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Prod",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axes",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),Ce=Object.freeze({json:[{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"}]}]}),be=Object.freeze({json:[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}
7696,{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
vendor: 4,400 bytes, line 7696
7696,{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]}]}),$e=Object.freeze({json:[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}]}),ht=Object.freeze({json:[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
7696]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),Dt=Object.freeze({json:[{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]}]}),Ut=Object.freeze({json:[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}]}),Ee=Object.freeze({json:[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]}]}),Ot=Object.freeze({json:[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}
7696]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),zt=Object.freeze({json:[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),Mt=Object.freeze({json:[{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"SparseToDense",category:"normalization",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!0,notSupported:!0}
vendor: 4,881 bytes, line 7696
7696]}]}),Ke=Object.freeze({json:[{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]}]}),Tt=Object.freeze({json:[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool",notSupported:!0}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}
7696]}]}),vt=Object.freeze({json:[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}]}),yt=Object.freeze({json:[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]}]}),bt=function(){function _e(){var ge=[pe,ke,Ce,be,$e,ht,Dt,Ot,Ee,Ut,zt,Mt,Ke,Tt,vt,yt],Ae=[].concat.apply([],ge.map(function(Ie){return Ie.json}));this.opMappers=Ae.reduce(function(Ie,it){return Ie[it.tfOpName]=it,Ie},{})}return Object.defineProperty(_e,"Instance",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),_e.prototype.transformGraph=function(ge,Ae){var Ie=this;Ae===void 0&&(Ae={});var it=[],St=[],Jt=ge.node.reduce(function(Gt,Wt){return Gt[Wt.name]=Ie.mapNode(Wt),Wt.op.startsWith("Placeholder")&&it.push(Gt[Wt.name]),Wt.op==="Const"&&St.push(Gt[Wt.name]),Gt},{}),kn=[],rr=[],Bn={},Gn={};Ae!=null&&(Bn=this.mapSignatureEntries(Ae.inputs),Gn=this.mapSignatureEntries(Ae.outputs));var Zn=Object.keys(Jt);return Zn.forEach(function(Gt){var Wt=Jt[Gt];Wt.inputNames.forEach(function(Sn){var un=J(Sn)[0];Wt.inputs.push(Jt[un]),Jt[un].children.push(Wt)})}),Object.keys(Gn).length===0?Zn.forEach(function(Gt){var Wt=Jt[Gt];Wt.children.length===0&&rr.push(Wt)}):Object.keys(Gn).forEach(function(Gt){var Wt=J(Gt)[0],Sn=Jt[Wt];Sn!=null&&(Sn.signatureKey=Gn[Gt],rr.push(Sn))}),Object.keys(Bn).length>0?Object.keys(Bn).forEach(function(Gt){var Wt=J(Gt)[0],Sn=Jt[Wt];Sn&&(Sn.signatureKey=Bn[Gt],kn.push(Sn))}):kn=it,{nodes:Jt,inputs:kn,outputs:rr,weights:St,placeholders:it,signature:Ae}},_e.prototype.mapSignatureEntries=function(ge){return Object.keys(ge||{}).reduce(function(Ae,Ie){return Ae[ge[Ie].name]=Ie,Ae},{})},_e.prototype.mapNode=function(ge){var Ae=L(ge.op)||this.opMappers[ge.op]||{};ge.attr==null&&(ge.attr={});var Ie={name:ge.name,op:ge.op,category:Ae.category,inputNames:(ge.input||[]).map(function(it){return it.startsWith("^")?it.substr(1):it}),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:ge.attr};return Ae.inputs!=null&&(Ie.inputParams=Ae.inputs.reduce(function(it,St){return it[St.name]={type:St.type,inputIndexStart:St.start,inputIndexEnd:St.end},it},{})),Ae.attrs!=null&&(Ie.attrParams=Ae.attrs.reduce(function(it,St){var Jt=St.type,kn=void 0;switch(St.type){case"string":(kn=_t(ge.attr,St.tfName,St.defaultValue))===void 0&&St.tfDeprecatedName&&(kn=_t(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"string[]":(kn=dt(ge.attr,St.tfName,St.defaultValue))===void 0&&St.tfDeprecatedName&&(kn=dt(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"number":(kn=Vt(ge.attr,St.tfName,St.defaultValue||0))===void 0&&St.tfDeprecatedName&&(kn=Vt(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"number[]":(kn=He(ge.attr,St.tfName,St.defaultValue))===void 0&&St.tfDeprecatedName&&(kn=He(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"bool":(kn=Ze(ge.attr,St.tfName,St.defaultValue))===void 0&&St.tfDeprecatedName&&(kn=
7696Ze(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"bool[]":(kn=ct(ge.attr,St.tfName,St.defaultValue))===void 0&&St.tfDeprecatedName&&(kn=ct(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"shape":(kn=Ye(ge.attr,St.tfName,St.defaultValue))===void 0&&St.tfDeprecatedName&&(kn=Ye(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"shape[]":(kn=It(ge.attr,St.tfName,St.defaultValue))===void 0&&St.tfDeprecatedName&&(kn=It(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"dtype":(kn=yn(ge.attr,St.tfName,St.defaultValue))===void 0&&St.tfDeprecatedName&&(kn=yn(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"dtype[]":(kn=Yt(ge.attr,St.tfName,St.defaultValue))===void 0&&St.tfDeprecatedName&&(kn=Yt(ge.attr,St.tfDeprecatedName,St.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: "+St.type+" for op: "+ge.op)}return it[St.name]={value:kn,type:Jt},it},{})),Ie},_e}();function Ht(_e,ge){var Ae=Array.isArray(_e)?String.fromCharCode.apply(null,_e):function(Ie){var it=Object(g.env)().global;if(it.atob!==void 0)return it.atob(Ie);if(s!==void 0)return new s(Ie,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}(_e);return ge?Ae:Ae.toLowerCase()}function _t(_e,ge,Ae,Ie){Ie===void 0&&(Ie=!1);var it=_e[ge];return it!=null?Ht(it.s,Ie):Ae}function Ze(_e,ge,Ae){var Ie=_e[ge];return Ie?Ie.b:Ae}function Vt(_e,ge,Ae){var Ie=_e[ge]||{},it=Ie.i!=null?Ie.i:Ie.f!=null?Ie.f:Ae;return typeof it=="number"?it:parseInt(it,10)}function sn(_e){switch(typeof _e=="string"&&(_e=h[_e]),_e){case h.DT_FLOAT:return"float32";case h.DT_INT32:case h.DT_INT64:case h.DT_INT8:case h.DT_UINT8:return"int32";case h.DT_BOOL:return"bool";case h.DT_DOUBLE:return"float32";case h.DT_STRING:return"string";default:return null}}function yn(_e,ge,Ae){var Ie=_e[ge];return Ie&&Ie.type?sn(Ie.type):Ae}function Yt(_e,ge,Ae){var Ie=_e[ge];return Ie&&Ie.list&&Ie.list.type?Ie.list.type.map(function(it){return sn(it)}):Ae}function We(_e){if(!_e.unknownRank)return _e.dim!=null?_e.dim.map(function(ge){return typeof ge.size=="number"?ge.size:parseInt(ge.size,10)}):[]}function Ye(_e,ge,Ae){var Ie=_e[ge];return Ie&&Ie.shape?We(Ie.shape):Ae}function He(_e,ge,Ae){var Ie=_e[ge];return Ie?((Ie.list.f&&Ie.list.f.length?Ie.list.f:Ie.list.i)||[]).map(function(it){return typeof it=="number"?it:parseInt(it,10)}):Ae}function dt(_e,ge,Ae,Ie){Ie===void 0&&(Ie=!1);var it=_e[ge];return it&&it.list&&it.list.s?it.list.s.map(function(St){return Ht(St,Ie)}):Ae}function It(_e,ge,Ae){var Ie=_e[ge];return Ie&&Ie.list&&Ie.list.shape?Ie.list.shape.map(function(it){return We(it)}):Ae}function ct(_e,ge,Ae){var Ie=_e[ge];return Ie&&Ie.list&&Ie.list.b?Ie.list.b:Ae}var on=function(){function _e(ge,Ae,Ie){var it=this;this.node=ge,this.tensorMap=Ae,this.context=Ie,this.inputs=[],this.attrs={},this.inputs=ge.inputNames.map(function(St){return it.getInput(St)}),ge.rawAttrs!=null&&(this.attrs=Object.keys(ge.rawAttrs).reduce(function(St,Jt){return St[Jt]=it.getAttr(Jt),St},{}))}return _e.prototype.getInput=function(ge){return ee(ge,this.tensorMap,this.context)},_e.prototype.getAttr=function(ge,Ae){var Ie=this.node.rawAttrs[ge];if(Ie.tensor!=null)return ee(ge,this.tensorMap,this.context);if(Ie.i!=null||Ie.f!=null)return Vt(this.node.rawAttrs,ge,Ae);if(Ie.s!=null)return _t(this.node.rawAttrs,ge,Ae);if(Ie.b!=null)return Ze(this.node.rawAttrs,ge,Ae);if(Ie.shape!=null)return Ye(this.node.rawAttrs,ge,Ae);if(Ie.type!=null)return yn(this.node.rawAttrs,ge,Ae);if(Ie.list!=null){if(Ie.list.i!=null||Ie.list.f!=null)return He(this.node.rawAttrs,ge,Ae);if(Ie.list.s!=null)return dt(this.node.rawAttrs,ge,Ae);if(Ie.list.shape!=null)return It(this.node.rawAttrs,ge,Ae);if(Ie.list.b!=null)return ct(this.node.rawAttrs,ge,Ae);if(Ie.list.type!=null)return Yt(this.node.rawAttrs,ge,Ae)}return Ae},_e}(),Xt=function(_e,ge,Ae){switch(_e.op){case"BiasAdd":case"AddV2":case"Add":return[Object(g.add)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"AddN":return[Object(g.addN)(N("tensors",_e,ge,Ae))];case"FloorMod":case"Mod":return[Object(g.mod)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"Mul":return[Object(g.mul)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];
vendor: 9,041 bytes, lines 7696-7699
7696case"RealDiv":case"Div":return[Object(g.div)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"DivNoNan":return[Object(g.divNoNan)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"FloorDiv":return[Object(g.floorDiv)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"Sub":return[Object(g.sub)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"Minimum":return[Object(g.minimum)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"Maximum":return[Object(g.maximum)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"Pow":return[Object(g.pow)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"SquaredDifference":return[Object(g.squaredDifference)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];default:throw TypeError("Node type "+_e.op+" is not implemented")}},En=function(_e,ge,Ae){switch(_e.op){case"Abs":case"ComplexAbs":return[Object(g.abs)(N("x",_e,ge,Ae))];case"Acos":return[Object(g.acos)(N("x",_e,ge,Ae))];case"Acosh":return[Object(g.acosh)(N("x",_e,ge,Ae))];case"Asin":return[Object(g.asin)(N("x",_e,ge,Ae))];case"Asinh":return[Object(g.asinh)(N("x",_e,ge,Ae))];case"Atan":return[Object(g.atan)(N("x",_e,ge,Ae))];case"Atan2":return[Object(g.atan2)(N("x",_e,ge,Ae),N("y",_e,ge,Ae))];case"Atanh":return[Object(g.atanh)(N("x",_e,ge,Ae))];case"Ceil":return[Object(g.ceil)(N("x",_e,ge,Ae))];case"Complex":return[Object(g.complex)(N("real",_e,ge,Ae),N("imag",_e,ge,Ae))];case"Cos":return[Object(g.cos)(N("x",_e,ge,Ae))];case"Cosh":return[Object(g.cosh)(N("x",_e,ge,Ae))];case"Elu":return[Object(g.elu)(N("x",_e,ge,Ae))];case"Erf":return[Object(g.erf)(N("x",_e,ge,Ae))];case"Exp":return[Object(g.exp)(N("x",_e,ge,Ae))];case"Expm1":return[Object(g.expm1)(N("x",_e,ge,Ae))];case"Floor":return[Object(g.floor)(N("x",_e,ge,Ae))];case"Log":return[Object(g.log)(N("x",_e,ge,Ae))];case"Log1p":return[Object(g.log1p)(N("x",_e,ge,Ae))];case"Imag":return[Object(g.imag)(N("x",_e,ge,Ae))];case"Neg":return[Object(g.neg)(N("x",_e,ge,Ae))];case"Reciprocal":return[Object(g.reciprocal)(N("x",_e,ge,Ae))];case"Real":return[Object(g.real)(N("x",_e,ge,Ae))];case"Relu":return[Object(g.relu)(N("x",_e,ge,Ae))];case"Round":return[Object(g.round)(N("x",_e,ge,Ae))];case"Selu":return[Object(g.selu)(N("x",_e,ge,Ae))];case"Sigmoid":return[Object(g.sigmoid)(N("x",_e,ge,Ae))];case"Sin":return[Object(g.sin)(N("x",_e,ge,Ae))];case"Sign":return[Object(g.sign)(N("x",_e,ge,Ae))];case"Sinh":return[Object(g.sinh)(N("x",_e,ge,Ae))];case"Softplus":return[Object(g.softplus)(N("x",_e,ge,Ae))];case"Sqrt":return[Object(g.sqrt)(N("x",_e,ge,Ae))];case"Square":return[Object(g.square)(N("x",_e,ge,Ae))];case"Tanh":return[Object(g.tanh)(N("x",_e,ge,Ae))];case"Tan":return[Object(g.tan)(N("x",_e,ge,Ae))];case"Relu6":case"ClipByValue":return[Object(g.clipByValue)(N("x",_e,ge,Ae),N("clipValueMin",_e,ge,Ae),N("clipValueMax",_e,ge,Ae))];case"Rsqrt":return[Object(g.rsqrt)(ee(_e.inputNames[0],ge,Ae))];case"Prod":return[Object(g.prod)(N("x",_e,ge,Ae),N("axes",_e,ge,Ae))];case"LeakyRelu":return[Object(g.leakyRelu)(N("x",_e,ge,Ae),N("alpha",_e,ge,Ae))];case"Prelu":return[Object(g.prelu)(N("x",_e,ge,Ae),N("alpha",_e,ge,Ae))];default:throw TypeError("Node type "+_e.op+" is not implemented")}},xe=function(){function _e(ge,Ae,Ie,it,St,Jt,kn){this.name=ge,this.dtype=Ae,this.maxSize=Ie,this.elementShape=it,this.identicalElementShapes=St,this.dynamicSize=Jt,this.clearAfterRead=kn,this.tensors=[],this.closed_=!1,this.id=_e.nextId++}return Object.defineProperty(_e.prototype,"closed",{get:function(){return this.closed_},enumerable:!0,configurable:!0}),_e.prototype.clearAndClose=function(){this.tensors.forEach(function(ge){return ge.tensor.dispose()}),this.tensors=[],this.closed_=!0},_e.prototype.size=function(){return this.tensors.length},_e.prototype.read=function(ge){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(ge<0||ge>=this.tensors.length)throw new Error("Tried to read from index "+ge+", but array size is: "+this.tensors.length);var Ae=this.tensors[ge];if(Ae.cleared)throw new Error("TensorArray "+this.name+": Could not read index "+ge+" twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).");return this.clearAfterRead&&(Ae.cleared=!0),Ae.read=!0,Ae.tensor},_e.prototype.readMany=function(ge){var Ae=this;return ge.map(function(Ie){return Ae.read(Ie)})},_e.prototype.write=function(ge,Ae){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(ge<0||!this.dynamicSize&&ge>=this.maxSize)throw new Error("Tried to write to index "+ge+", but array is not resizeable and size is: "+this.maxSize);var Ie=this.tensors[ge]||{};if(Ae.dtype!==this.dtype)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+ge+`, 7697 because the value dtype is `+Ae.dtype+", but TensorArray dtype is "+this.dtype+".");if(this.size()!==0||this.elementShape!=null&&this.elementShape.length!==0||(this.elementShape=Ae.shape),this.assertShapesMatchAllowUndefinedSize(this.elementShape,Ae.shape,"TensorArray "+this.name+": Could not write to TensorArray index "+ge+"."),Ie&&Ie.read)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+ge+", because it has already been read.");if(Ie&&Ie.written)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+ge+", because it has already been written.");Ie.tensor=Ae,Ie.written=!0,this.tensors[ge]=Ie},_e.prototype.writeMany=function(ge,Ae){var Ie=this;if(ge.length!==Ae.length)throw new Error("TensorArray "+this.name+": could not write multiple tensors,because the index size: "+ge.length+" is not the same as tensors size: "+Ae.length+".");ge.forEach(function(it,St){return Ie.write(it,Ae[St])})},_e.prototype.gather=function(ge,Ae){if(Ae&&Ae!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but gather requested dtype "+Ae);if(!ge){ge=[];for(var Ie=0;Ie<this.size();Ie++)ge.push(Ie)}if(ge.length===0)return Object(g.tensor)([],[0].concat(this.elementShape));var it=this.readMany(ge);return this.assertShapesMatchAllowUndefinedSize(this.elementShape,it[0].shape,"TensorArray shape mismatch: "),Object(g.stack)(it,0)},_e.prototype.concat=function(ge){if(ge&&ge!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but concat requested dtype "+ge);if(this.size()===0)return Object(g.tensor)([],[0].concat(this.elementShape));for(var Ae=[],Ie=0;Ie<this.size();Ie++)Ae.push(Ie);var it=this.readMany(Ae);return this.assertShapesMatchAllowUndefinedSize(this.elementShape,it[0].shape,"TensorArray shape mismatch: tensor array shape ("+this.elementShape+") vs first tensor shape ("+it[0].shape+")"),Object(g.concat)(it,0)},_e.prototype.scatter=function(ge,Ae){if(Ae.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+Ae.dtype);if(ge.length!==Ae.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: "+ge.length+" vs. "+Ae.shape[0]);var Ie=Math.max.apply(Math,ge);if(!this.dynamicSize&&Ie>=this.maxSize)throw new Error("Max index must be < array size ("+Ie+" vs. "+this.maxSize+")");this.writeMany(ge,Object(g.unstack)(Ae,0))},_e.prototype.split=function(ge,Ae){var Ie=this;if(Ae.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+Ae.dtype);var it=0,St=ge.map(function(Gn){return it+=Gn});if(it!==Ae.shape[0])throw new Error(`Expected sum of lengths to be equal to 7698 tensor.shape[0], but sum of lengths is 7699 `+it+", and tensor's shape is: "+Ae.shape);if(!this.dynamicSize&&ge.length!==this.maxSize)throw new Error("TensorArray's size is not equal to the size of lengths ("+this.maxSize+" vs. "+ge.length+"), and the TensorArray is not marked as dynamically resizeable");var Jt=it===0?0:Ae.size/it,kn=[];Object(g.tidy)(function(){Ae=Ae.reshape([1,it,Jt]);for(var Gn=0;Gn<ge.length;++Gn){var Zn=[0,Gn===0?0:St[Gn-1],0],Gt=[1,ge[Gn],Jt];kn[Gn]=Object(g.slice)(Ae,Zn,Gt).reshape(Ie.elementShape)}return kn});for(var rr=[],Bn=0;Bn<ge.length;Bn++)rr[Bn]=Bn;this.writeMany(rr,kn)},_e.prototype.assertShapesMatchAllowUndefinedSize=function(ge,Ae,Ie){Ie===void 0&&(Ie=""),g.util.assert(this.shapesEqualAllowUndefinedSize(ge,Ae),function(){return Ie+" Shapes "+ge+" and "+Ae+" must match"})},_e.prototype.shapesEqualAllowUndefinedSize=function(ge,Ae){if(ge.length!==Ae.length)return!1;for(var Ie=0;Ie<ge.length;Ie++)if(ge[Ie]!==-1&&Ae[Ie]!==-1&&ge[Ie]!==Ae[Ie])return!1;return!0},_e.nextId=0,_e}(),jn=function(_e,ge,Ae){return A(void 0,void 0,void 0,function(){var Ie,it,St,Jt,kn,rr,Bn,Gn,Zn,Gt,Wt,Sn,un,qe,$n,er,sr,pr,Zr,Mr,Ii,Lo,Ai,ko,Ji,ai,Yr,Hn,ki,lo,Kr,Io,Ko,Eo,Yo;return S(this,function(vs){switch(vs.label){case 0:switch(_e.op){case"LoopCond":return[3,1];case"Switch":return[3,2];case"Merge":return[3,4];case"Enter":return[3,5];case"Exit":return[3,6];case"NextIteration":return[3,7];case"TensorArrayV3":return[3,8];case"TensorArrayWriteV3":return[3,9];case"TensorArrayReadV3":return[3,10];case"TensorArrayGatherV3":return[3,11];case"TensorArrayScatterV3":return[3,12];case"TensorArrayConcatV3":return[3,13];case"TensorArraySplitV3":return[3,14];case"TensorArraySizeV3":return[3,15];
7699case"TensorArrayCloseV3":return[3,16]}return[3,17];case 1:return[2,[N("pred",_e,ge,Ae).clone()]];case 2:return Ie=N("pred",_e,ge,Ae),it=N("data",_e,ge,Ae),[4,Ie.data()];case 3:return[2,vs.sent()[0]?[void 0,it.clone()]:[it.clone(),void 0]];case 4:return[2,(St=_e.inputNames.find(function(gu){return ee(gu,ge,Ae)!==void 0}))?[ee(St,ge,Ae).clone()]:void 0];case 5:return Jt=N("frameName",_e,ge,Ae),kn=N("tensor",_e,ge,Ae),Ae.enterFrame(Jt),[2,[kn.clone()]];case 6:return rr=N("tensor",_e,ge,Ae),Ae.exitFrame(),[2,[rr.clone()]];case 7:return Bn=N("tensor",_e,ge,Ae),Ae.nextIteration(),[2,[Bn.clone()]];case 8:return Gn=N("size",_e,ge,Ae),Zn=N("dtype",_e,ge,Ae),Gt=N("elementShape",_e,ge,Ae),Wt=N("dynamicSize",_e,ge,Ae),Sn=N("clearAfterRead",_e,ge,Ae),un=N("identicalElementShapes",_e,ge,Ae),qe=N("name",_e,ge,Ae),$n=new xe(qe,Zn,Gn,Gt,un,Wt,Sn),Ae.addTensorArray($n),[2,[Object(g.scalar)($n.id),Object(g.scalar)(1)]];case 9:return er=N("tensorArrayId",_e,ge,Ae),sr=N("index",_e,ge,Ae),pr=N("tensor",_e,ge,Ae),Ae.getTensorArray(er).write(sr,pr),[2,[Object(g.scalar)(1)]];case 10:return Zr=N("tensorArrayId",_e,ge,Ae),Mr=N("index",_e,ge,Ae),[2,[Ae.getTensorArray(Zr).read(Mr)]];case 11:return Ii=N("tensorArrayId",_e,ge,Ae),Lo=N("indices",_e,ge,Ae),Ai=N("dtype",_e,ge,Ae),[2,[Ae.getTensorArray(Ii).gather(Lo,Ai)]];case 12:return ko=N("tensorArrayId",_e,ge,Ae),Ji=N("indices",_e,ge,Ae),ai=N("tensor",_e,ge,Ae),Ae.getTensorArray(ko).scatter(Ji,ai),[2,[Object(g.scalar)(1)]];case 13:return Yr=N("tensorArrayId",_e,ge,Ae),Hn=Ae.getTensorArray(Yr),ki=N("dtype",_e,ge,Ae),[2,[Hn.concat(ki)]];case 14:return lo=N("tensorArrayId",_e,ge,Ae),Kr=N("tensor",_e,ge,Ae),Io=N("lengths",_e,ge,Ae),Ae.getTensorArray(lo).split(Io,Kr),[2,[Object(g.scalar)(1)]];case 15:return Ko=N("tensorArrayId",_e,ge,Ae),Eo=Ae.getTensorArray(Ko),[2,[Object(g.scalar)(Eo.size(),"int32")]];case 16:return Yo=N("tensorArrayId",_e,ge,Ae),Ae.getTensorArray(Yo).clearAndClose(),[2,[Object(g.scalar)(0)]];case 17:throw TypeError("Node type "+_e.op+" is not implemented")}})})},nr=function(_e,ge,Ae){switch(_e.op){case"Conv1D":var Ie=N("stride",_e,ge,Ae),it=N("pad",_e,ge,Ae),St=N("dataFormat",_e,ge,Ae).toUpperCase(),Jt=N("dilation",_e,ge,Ae);return[Object(g.conv1d)(N("x",_e,ge,Ae),N("filter",_e,ge,Ae),Ie,it,St,Jt)];case"Conv2D":Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae),St=N("dataFormat",_e,ge,Ae).toUpperCase();var kn=N("dilations",_e,ge,Ae);return[Object(g.conv2d)(N("x",_e,ge,Ae),N("filter",_e,ge,Ae),[Ie[1],Ie[2]],it,St,[kn[1],kn[2]])];case"_FusedConv2D":case"FusedDepthwiseConv2dNative":var rr=N("fusedOps",_e,ge,Ae),Bn=rr[0],Gn=rr[1],Zn=Bn==="biasadd",Gt=Gn==="prelu",Wt=Bn==="fusedbatchnorm",Sn=N("numArgs",_e,ge,Ae);if(Zn){if(Gt&&Sn!==2)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!Gt&&Sn!==1)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(Wt)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported.");Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae),St=N("dataFormat",_e,ge,Ae).toUpperCase(),kn=N("dilations",_e,ge,Ae);var un=N("args",_e,ge,Ae),qe=un[0],$n=un[1];return[(_e.op==="_FusedConv2D"?g.fused.conv2d:g.fused.depthwiseConv2d)({x:N("x",_e,ge,Ae),filter:N("filter",_e,ge,Ae),strides:[Ie[1],Ie[2]],pad:it,dataFormat:St,dilations:[kn[1],kn[2]],bias:qe,activation:Gn,preluActivationWeights:$n})];case"Conv2DBackpropInput":case"Conv2dTranspose":var er=N("outputShape",_e,ge,Ae);return Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae),[Object(g.conv2dTranspose)(N("x",_e,ge,Ae),N("filter",_e,ge,Ae),er,[Ie[1],Ie[2]],it)];case"DepthwiseConv2dNative":case"DepthwiseConv2d":return Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae),kn=N("dilations",_e,ge,Ae),St=N("dataFormat",_e,ge,Ae).toUpperCase(),[Object(g.depthwiseConv2d)(N("input",_e,ge,Ae),N("filter",_e,ge,Ae),[Ie[1],Ie[2]],it,St,[kn[1],kn[2]])];case"Conv3D":return Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae),St=N("dataFormat",_e,ge,Ae).toUpperCase(),kn=N("dilations",_e,ge,Ae),[Object(g.conv3d)(N("x",_e,ge,Ae),N("filter",_e,ge,Ae),[Ie[1],Ie[2],Ie[3]],it,St,[kn[1],kn[2],kn[3]])];case"AvgPool":Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae);var sr=N("kernelSize",_e,ge,Ae);return[Object(g.avgPool)(N("x",_e,ge,Ae),[sr[1],sr[2]],[Ie[1],Ie[2]],it)];case"MaxPool":return Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae),sr=N("kernelSize",_e,ge,Ae),[Object(g.maxPool)(N("x",_e,ge,Ae),[sr[1],sr[2]],[Ie[1],Ie[2]],it)];case"MaxPoolWithArgmax":Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae),sr=N("kernelSize",_e,ge,Ae);var pr=N("includeBatchInIndex",_e,ge,Ae),Zr=Object(g.maxPoolWithArgmax)(N("x",_e,ge,Ae),[sr[1],sr[2]],[Ie[1],Ie[2]],it,pr);return[Zr.result,Zr.indexes];case"AvgPool3D":return Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae),sr=N("kernelSize",_e,ge,Ae),[Object(g.avgPool3d)(N("x",_e,ge,Ae),[sr[1],sr[2],sr[3]],[Ie[1],Ie[2],Ie[3]],it)];case"MaxPool3D":return Ie=N("strides",_e,ge,Ae),it=N("pad",_e,ge,Ae),sr=N("kernelSize",_e,ge,Ae),[Object(g.maxPool3d)(N("x",_e,ge,Ae),[sr[1],sr[2],sr[3]],[Ie[1],Ie[2],Ie[3]],it)];default:throw TypeError("Node type "+_e.op+" is not implemented")}},ar=function(_e,ge,Ae){switch(_e.op){case"Fill":var Ie=N("shape",_e,ge,Ae),it=N("dtype",_e,ge,Ae),St=N("value",_e,ge,Ae);return[Object(g.fill)(Ie,St,it)];case"LinSpace":var Jt=N("start",_e,ge,Ae),kn=N("stop",_e,ge,Ae),rr=N("num",_e,ge,Ae);
7699return[Object(g.linspace)(Jt,kn,rr)];case"Multinomial":var Bn=N("logits",_e,ge,Ae),Gn=N("numSamples",_e,ge,Ae),Zn=N("seed",_e,ge,Ae);return[Object(g.multinomial)(Bn,Gn,Zn)];case"OneHot":var Gt=N("indices",_e,ge,Ae),Wt=N("depth",_e,ge,Ae),Sn=N("onValue",_e,ge,Ae),un=N("offValue",_e,ge,Ae);return[Object(g.oneHot)(Gt,Wt,Sn,un)];case"Ones":return[Object(g.ones)(N("shape",_e,ge,Ae),N("dtype",_e,ge,Ae))];case"OnesLike":return[Object(g.onesLike)(N("x",_e,ge,Ae))];case"RandomUniform":return[Object(g.randomUniform)(N("shape",_e,ge,Ae),N("minval",_e,ge,Ae),N("maxval",_e,ge,Ae),N("dtype",_e,ge,Ae))];case"Range":Jt=N("start",_e,ge,Ae);var qe=N("stop",_e,ge,Ae),$n=N("step",_e,ge,Ae);return[Object(g.range)(Jt,qe,$n,N("dtype",_e,ge,Ae))];case"TruncatedNormal":Ie=N("shape",_e,ge,Ae);var er=N("mean",_e,ge,Ae),sr=N("stdDev",_e,ge,Ae);return Zn=N("seed",_e,ge,Ae),[Object(g.truncatedNormal)(Ie,er,sr,N("dtype",_e,ge,Ae),Zn)];case"Zeros":return[Object(g.zeros)(N("shape",_e,ge,Ae),N("dtype",_e,ge,Ae))];case"ZerosLike":return[Object(g.zerosLike)(N("x",_e,ge,Ae))];default:throw TypeError("Node type "+_e.op+" is not implemented")}},cr=function(_e,ge,Ae){return A(void 0,void 0,void 0,function(){var Ie,it,St,Jt,kn,rr,Bn,Gn;return S(this,function(Zn){switch(Zn.label){case 0:switch(_e.op){case"NonMaxSuppressionV5":case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":return[3,1];case"Where":return[3,5];case"ListDiff":return[3,7]}return[3,8];case 1:return Ie=N("boxes",_e,ge,Ae),it=N("scores",_e,ge,Ae),St=N("maxOutputSize",_e,ge,Ae),Jt=N("iouThreshold",_e,ge,Ae),kn=N("scoreThreshold",_e,ge,Ae),_e.op!=="NonMaxSuppressionV5"?[3,3]:(rr=N("softNmsSigma",_e,ge,Ae),[4,g.image.nonMaxSuppressionWithScoreAsync(Ie,it,St,Jt,kn,rr)]);case 2:return[2,[(Gn=Zn.sent()).selectedIndices,Gn.selectedScores]];case 3:return[4,g.image.nonMaxSuppressionAsync(Ie,it,St,Jt,kn)];case 4:return[2,[Zn.sent()]];case 5:return Bn=N("condition",_e,ge,Ae).asType("bool"),[4,Object(g.whereAsync)(Bn)];case 6:return Gn=[Zn.sent()],Bn.dispose(),[2,Gn];case 7:return[2,Object(g.setdiff1dAsync)(N("x",_e,ge,Ae),N("y",_e,ge,Ae))];case 8:throw TypeError("Node type "+_e.op+" is not implemented")}})})},Er=function(_e,ge,Ae){switch(_e.op){case"TopKV2":var Ie=N("x",_e,ge,Ae),it=N("k",_e,ge,Ae),St=N("sorted",_e,ge,Ae),Jt=Object(g.topk)(Ie,it,St);return[Jt.values,Jt.indices];default:throw TypeError("Node type "+_e.op+" is not implemented")}},hn=function(_e,ge,Ae){switch(_e.op){case"Const":return ge[_e.name];case"PlaceholderWithDefault":var Ie=N("default",_e,ge,Ae);return[ee(_e.name,ge,Ae)||Ie];case"Placeholder":return[ee(_e.name,ge,Ae)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":return[N("x",_e,ge,Ae).clone()];case"IdentityN":return N("x",_e,ge,Ae).map(function(Bn){return Bn.clone()});case"Snapshot":return[N("x",_e,ge,Ae).clone()];case"Shape":return[Object(g.tensor1d)(N("x",_e,ge,Ae).shape,"int32")];case"ShapeN":return N("x",_e,ge,Ae).map(function(Bn){return Object(g.tensor1d)(Bn.shape)});case"Size":return[Object(g.scalar)(N("x",_e,ge,Ae).size,"int32")];case"Rank":return[Object(g.scalar)(N("x",_e,ge,Ae).rank,"int32")];case"NoOp":return[Object(g.scalar)(1)];case"Print":var it=N("x",_e,ge,Ae),St=N("data",_e,ge,Ae),Jt=N("message",_e,ge,Ae),kn=N("summarize",_e,ge,Ae);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(Jt);for(var rr=0;rr<St.length;rr++)console.log(Array.prototype.slice.call(St[rr].dataSync()).slice(0,kn));return[it];default:throw TypeError("Node type "+_e.op+" is not implemented")}},rn=function(_e,ge,Ae){switch(_e.op){case"ResizeBilinear":var Ie=N("images",_e,ge,Ae),it=N("size",_e,ge,Ae),St=N("alignCorners",_e,ge,Ae);return[g.image.resizeBilinear(Ie,[it[0],it[1]],St)];case"ResizeNearestNeighbor":return Ie=N("images",_e,ge,Ae),it=N("size",_e,ge,Ae),St=N("alignCorners",_e,ge,Ae),[g.image.resizeNearestNeighbor(Ie,[it[0],it[1]],St)];case"CropAndResize":var Jt=N("image",_e,ge,Ae),kn=N("boxes",_e,ge,Ae),rr=N("boxInd",_e,ge,Ae),Bn=N("cropSize",_e,ge,Ae),Gn=N("method",_e,ge,Ae),Zn=N("extrapolationValue",_e,ge,Ae);return[g.image.cropAndResize(Jt,kn,rr,Bn,Gn,Zn)];default:throw TypeError("Node type "+_e.op+" is not implemented")}},fn=function(_e,ge,Ae){switch(_e.op){case"Equal":return[Object(g.equal)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"NotEqual":return[Object(g.notEqual)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"Greater":return[Object(g.greater)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"GreaterEqual":return[Object(g.greaterEqual)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"Less":return[Object(g.less)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"LessEqual":return[Object(g.lessEqual)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"LogicalAnd":return[Object(g.logicalAnd)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"LogicalNot":return[Object(g.logicalNot)(N("a",_e,ge,Ae))];case"LogicalOr":return[Object(g.logicalOr)(N("a",_e,ge,Ae),N("b",_e,ge,Ae))];case"Select":case"SelectV2":return[Object(g.where)(N("condition",_e,ge,Ae),N("a",_e,ge,Ae),N("b",_e,ge,Ae))];default:throw TypeError("Node type "+_e.op+" is not implemented")}},Xn=function(_e,ge,Ae){switch(_e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[Object(g.matMul)(N("a",_e,ge,Ae),N("b",_e,ge,Ae),N("transposeA",_e,ge,Ae),N("transposeB",_e,ge,Ae))];case"Transpose":return[Object(g.transpose)(N("x",_e,ge,Ae),N("perm",_e,ge,Ae))];case"_FusedMatMul":var Ie=N("fusedOps",_e,ge,Ae),it=Ie[0],St=Ie[1],Jt=it==="biasadd",kn=St==="prelu",rr=N("numArgs",_e,ge,Ae);if(Jt){if(kn&&rr!==2)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!kn&&rr!==1)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}var Bn=N("args",_e,ge,Ae),Gn=Bn[0],Zn=Bn[1];return[g.fused.matMul({a:N("a",_e,ge,Ae),b:N("b",_e,ge,Ae),transposeA:N("transposeA",_e,ge,Ae),transposeB:N("transposeB",_e,ge,Ae),bias:Gn,activation:St,preluActivationWeights:Zn})];default:throw TypeError("Node type "+_e.op+" is not implemented")}},Fn=function(_e,ge,Ae){switch(_e.op){case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[Object(g.batchNorm)(N("x",_e,ge,Ae),N("mean",_e,ge,Ae),N("variance",_e,ge,Ae),N("offset",_e,ge,Ae),N("scale",_e,ge,Ae),N("epsilon",_e,ge,Ae))];case"LRN":return[Object(g.localResponseNormalization)(N("x",_e,ge,Ae),N("radius",_e,ge,Ae),N("bias",_e,ge,Ae),N("alph
7699a",_e,ge,Ae),N("beta",_e,ge,Ae))];case"Softmax":return[Object(g.softmax)(N("x",_e,ge,Ae))];case"LogSoftmax":return[Object(g.logSoftmax)(N("x",_e,ge,Ae))];case"SparseToDense":return[Object(g.sparseToDense)(N("sparseIndices",_e,ge,Ae),N("outputShape",_e,ge,Ae),N("sparseValues",_e,ge,Ae),N("defaultValue",_e,ge,Ae))];default:throw TypeError("Node type "+_e.op+" is not implemented")}},Ar=function(_e,ge,Ae){switch(_e.op){case"Max":var Ie=N("axis",_e,ge,Ae),it=N("keepDims",_e,ge,Ae);return[Object(g.max)(N("x",_e,ge,Ae),Ie,it)];case"Mean":return Ie=N("axis",_e,ge,Ae),it=N("keepDims",_e,ge,Ae),[Object(g.mean)(N("x",_e,ge,Ae),Ie,it)];case"Min":return Ie=N("axis",_e,ge,Ae),it=N("keepDims",_e,ge,Ae),[Object(g.min)(N("x",_e,ge,Ae),Ie,it)];case"Sum":return Ie=N("axis",_e,ge,Ae),it=N("keepDims",_e,ge,Ae),[Object(g.sum)(N("x",_e,ge,Ae),Ie,it)];case"All":return Ie=N("axis",_e,ge,Ae),it=N("keepDims",_e,ge,Ae),[Object(g.all)(N("x",_e,ge,Ae),Ie,it)];case"Any":return Ie=N("axis",_e,ge,Ae),it=N("keepDims",_e,ge,Ae),[Object(g.any)(N("x",_e,ge,Ae),Ie,it)];case"ArgMax":return Ie=N("axis",_e,ge,Ae),[Object(g.argMax)(N("x",_e,ge,Ae),Ie)];case"ArgMin":return Ie=N("axis",_e,ge,Ae),[Object(g.argMin)(N("x",_e,ge,Ae),Ie)];case"Prod":return Ie=N("axis",_e,ge,Ae),it=N("keepDims",_e,ge,Ae),[Object(g.prod)(N("x",_e,ge,Ae),Ie,it)];default:throw TypeError("Node type "+_e.op+" is not implemented")}},Dr=function(_e,ge,Ae){switch(_e.op){case"ConcatV2":case"Concat":var Ie=N("n",_e,ge,Ae),it=N("axis",_e,ge,Ae),St=N("tensors",_e,ge,Ae);return St=St.slice(0,Ie),[Object(g.concat)(St,it)];case"GatherV2":case"Gather":it=N("axis",_e,ge,Ae);var Jt=N("x",_e,ge,Ae),kn=N("indices",_e,ge,Ae);return[Object(g.gather)(Jt,kn.asType("int32"),it)];case"ReverseV2":case"Reverse":return it=N("axis",_e,ge,Ae),Jt=N("x",_e,ge,Ae),[Object(g.reverse)(Jt,it)];case"Slice":var rr=N("begin",_e,ge,Ae),Bn=N("size",_e,ge,Ae);return[Object(g.slice)(N("x",_e,ge,Ae),rr,Bn)];case"StridedSlice":rr=N("begin",_e,ge,Ae);var Gn=N("end",_e,ge,Ae),Zn=N("strides",_e,ge,Ae),Gt=N("beginMask",_e,ge,Ae),Wt=N("endMask",_e,ge,Ae),Sn=N("ellipsisMask",_e,ge,Ae),un=N("newAxisMask",_e,ge,Ae),qe=N("shrinkAxisMask",_e,ge,Ae),$n=N("x",_e,ge,Ae);if(rr.length===1&&$n.shape.length>1)for(var er=1;er<$n.shape.length;er++)rr.push(0),Gn.push($n.shape[er]),Zn.push(Zn[0]);return[Object(g.stridedSlice)($n,rr,Gn,Zn,Gt,Wt,Sn,un,qe)];case"Pack":return Object(g.tidy)(function(){var ko=N("axis",_e,ge,Ae),Ji=N("tensors",_e,ge,Ae),ai=Ji[0].shape,Yr=Ji[0].squeeze().shape,Hn=Ji.map(function(ki){var lo=g.util.arraysEqual(ki.shape,ai);if(!lo&&!g.util.arraysEqual(ki.squeeze().shape,Yr))throw new Error("the input tensors shape does not match");return lo?ki:ki.reshape(ai)});return[Object(g.stack)(Hn,ko)]});case"Unpack":return Object(g.tidy)(function(){var ko=N("axis",_e,ge,Ae),Ji=N("tensor",_e,ge,Ae);return Object(g.unstack)(Ji,ko)});case"Tile":var sr=N("reps",_e,ge,Ae);return[Object(g.tile)(N("x",_e,ge,Ae),sr)];case"Split":case"SplitV":it=N("axis",_e,ge,Ae);var pr=N("numOrSizeSplits",_e,ge,Ae);return Object(g.split)(N("x",_e,ge,Ae),pr,it);case"ScatterNd":kn=N("indices",_e,ge,Ae);var Zr=N("values",_e,ge,Ae),Mr=N("shape",_e,ge,Ae);return[Object(g.scatterND)(kn,Zr,Mr)];case"GatherNd":var Ii=N("x",_e,ge,Ae);return kn=N("indices",_e,ge,Ae),[Object(g.gatherND)(Ii,kn)];case"SparseToDense":kn=N("sparseIndices",_e,ge,Ae),Mr=N("outputShape",_e,ge,Ae);var Lo=N("sparseValues",_e,ge,Ae),Ai=N("defaultValue",_e,ge,Ae);return[Object(g.sparseToDense)(kn,Lo,Mr,Lo.dtype===Ai.dtype?Ai:Ai.asType(Lo.dtype))];default:throw TypeError("Node type "+_e.op+" is not implemented")}},xr=function(_e,ge,Ae){switch(_e.op){case"FFT":return[Object(g.fft)(N("x",_e,ge,Ae))];case"IFFT":return[Object(g.ifft)(N("x",_e,ge,Ae))];case"RFFT":return[Object(g.rfft)(N("x",_e,ge,Ae))];case"IRFFT":return[Object(g.irfft)(N("x",_e,ge,Ae))];default:throw TypeError("Node type "+_e.op+" is not implemented")}},fi=function(_e,ge,Ae){switch(_e.op){case"Cast":return[Object(g.cast)(N("x",_e,ge,Ae),N("dtype",_e,ge,Ae))];case"ExpandDims":var Ie=N("axis",_e,ge,Ae);return[Object(g.expandDims)(N("x",_e,ge,Ae),Ie)];case"Squeeze":return Ie=N("axis",_e,ge,Ae),[Object(g.squeeze)(N("x",_e,ge,Ae),Ie)];case"Reshape":return[Object(g.reshape)(N("x",_e,ge,Ae),N("shape",_e,ge,Ae))];
7699case"PadV2":case"Pad":return[Object(g.pad)(N("x",_e,ge,Ae),ce(N("padding",_e,ge,Ae),2),N("constantValue",_e,ge,Ae))];case"SpaceToBatchND":var it=N("blockShape",_e,ge,Ae),St=ce(N("paddings",_e,ge,Ae),2);return[Object(g.spaceToBatchND)(N("x",_e,ge,Ae),it,St)];case"BatchToSpaceND":it=N("blockShape",_e,ge,Ae);var Jt=ce(N("crops",_e,ge,Ae),2);return[Object(g.batchToSpaceND)(N("x",_e,ge,Ae),it,Jt)];case"DepthToSpace":var kn=N("blockSize",_e,ge,Ae),rr=N("dataFormat",_e,ge,Ae).toUpperCase();return[Object(g.depthToSpace)(N("x",_e,ge,Ae),kn,rr)];default:throw TypeError("Node type "+_e.op+" is not implemented")}};function ci(_e,ge,Ae){var Ie=function(it,St,Jt){switch(it.category){case"arithmetic":return Object(g.tidy)(function(){return Xt(it,St,Jt)});case"basic_math":return Object(g.tidy)(function(){return En(it,St,Jt)});case"control":return jn(it,St,Jt);case"convolution":return Object(g.tidy)(function(){return nr(it,St,Jt)});case"creation":return Object(g.tidy)(function(){return ar(it,St,Jt)});case"dynamic":return cr(it,St,Jt);case"evaluation":return Object(g.tidy)(function(){return Er(it,St,Jt)});case"image":return Object(g.tidy)(function(){return rn(it,St,Jt)});case"graph":return Object(g.tidy)(function(){return hn(it,St,Jt)});case"logical":return Object(g.tidy)(function(){return fn(it,St,Jt)});case"matrices":return Object(g.tidy)(function(){return Xn(it,St,Jt)});case"normalization":return Object(g.tidy)(function(){return Fn(it,St,Jt)});case"reduction":return Object(g.tidy)(function(){return Ar(it,St,Jt)});case"slice_join":return Object(g.tidy)(function(){return Dr(it,St,Jt)});case"spectral":return Object(g.tidy)(function(){return xr(it,St,Jt)});case"transformation":return Object(g.tidy)(function(){return fi(it,St,Jt)});case"custom":var kn=L(it.op);if(kn&&kn.customExecutor)return kn.customExecutor(new on(it,St,Jt));throw TypeError("Custom op "+it.op+" is not registered.");default:throw TypeError("Unknown op '"+it.op+"'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()")}}(_e,ge,Ae);return Ie instanceof Promise?Ie.then(function(it){return[].concat(it)}):[].concat(Ie)}var qr=function(){function _e(ge,Ae){this.weightMap=ge,this.tensorArrayMap=Ae,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}return _e.prototype.newFrame=function(ge,Ae){return{id:ge,frameName:Ae,iterationId:0}},Object.defineProperty(_e.prototype,"currentContext",{get:function(){return this.contexts},set:function(ge){this.contexts!==ge&&(this.contexts=ge,this.generateCurrentContextIds())},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"currentContextId",{get:function(){return this._currentContextIds[0]},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"currentContextIds",{get:function(){return this._currentContextIds},enumerable:!0,configurable:!0}),_e.prototype.generateCurrentContextIds=function(){for(var ge=[],Ae=0;Ae<this.contexts.length-1;Ae++){var Ie=this.contexts.slice(0,this.contexts.length-Ae);ge.push(this.contextIdforContexts(Ie))}ge.push(""),this._currentContextIds=ge},_e.prototype.contextIdforContexts=function(ge){return ge?ge.map(function(Ae){return Ae.id===0&&Ae.iterationId===0?"":Ae.frameName+"-"+Ae.iterationId}).join("/"):""},_e.prototype.enterFrame=function(ge){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,ge)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))},_e.prototype.exitFrame=function(){if(!(this.contexts&&this.contexts.length>1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()},_e.prototype.nextIteration=function(){if(!(this.contexts&&this.contexts.length>0))throw new Error("Cannot increase frame iteration, the context is empty");this.contexts=this.contexts.slice(),this.lastId++;var ge=Object.assign({},this.contexts[this.contexts.length-1]);ge.iterationId+=1,ge.id=this.lastId,this.contexts.splice(-1,1,ge),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))},_e.prototype.getWeight=function(ge){return this.weightMap[ge]},_e.prototype.addTensorArray=function(ge){this.tensorArrayMap[ge.id]=ge},_e.prototype.getTensorArray=function(ge){return this.tensorArrayMap[ge]},_e}();function mi(_e,ge,Ae){for(var Ie=new Set,it=[],St=null,Jt=null,kn=new Set,rr=Object.keys(_e).map(function(Zn){return re(Zn)[0]}),Bn=ge.slice();Bn.length>0;){var Gn=Bn.pop();(ri(Gn)||yi(Gn))&&St==null&&(Jt=(St=Gn).children.map(function(Zn){return Zn.name}).filter(function(Zn){return Ie.has(Zn)})),Ie.add(Gn.name),Ae[Gn.name]==null&&rr.indexOf(Gn.name)===-1&&(Gn.inputs.length!==0?Gn.inputs.forEac
7699h(function(Zn){kn.has(Zn.name)||(kn.add(Zn.name),Bn.push(Zn))}):it.push(Gn.name))}return{inputs:_e,outputs:ge,usedNodes:Ie,missingInputs:it,dynamicNode:St,syncInputs:Jt}}var Ir=["Switch","Merge","Enter","Exit","NextIteration"],ti=["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"];function ri(_e){return Ir.indexOf(_e.op)>=0}function yi(_e){return ti.indexOf(_e.op)>=0}var na=function(){function _e(ge){this.graph=ge,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this._outputs=ge.outputs,this._inputs=ge.inputs,this._signature=ge.signature}return Object.defineProperty(_e.prototype,"weightMap",{get:function(){return this._weightMap},set:function(ge){var Ae=Object.keys(ge).map(function(Ie){return ge[Ie].map(function(it){return it.id})});this.weightIds=[].concat.apply([],Ae),this._weightMap=ge},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"inputs",{get:function(){return this._inputs.map(function(ge){return{name:ge.name,shape:ge.attrParams.shape?ge.attrParams.shape.value:void 0,dtype:ge.attrParams.dtype?ge.attrParams.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"outputs",{get:function(){return this._outputs.map(function(ge){return{name:ge.name,shape:ge.attrParams.shape?ge.attrParams.shape.value:void 0,dtype:ge.attrParams.dtype?ge.attrParams.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"inputNodes",{get:function(){return this._inputs.map(function(ge){return ge.signatureKey||ge.name})},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"outputNodes",{get:function(){return this._outputs.map(function(ge){return ge.signatureKey||ge.name})},enumerable:!0,configurable:!0}),_e.prototype.getCompilationKey=function(ge,Ae){var Ie=ge.map(function(St){return St.name}).sort(),it=Ae.map(function(St){return St.name}).sort();return Ie.join(this.SEPERATOR)+"--"+it.join(this.SEPERATOR)},_e.prototype.compile=function(ge,Ae){var Ie=mi(ge,Ae,this.weightMap),it=Ie.missingInputs,St=Ie.dynamicNode,Jt=Ie.syncInputs;if(St!=null)throw new Error("This execution contains the node '"+St.name+"', which has the dynamic op '"+St.op+"'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs ["+Jt+"]");if(it.length>0){var kn=Ae.map(function(Bn){return Bn.name}),rr=Object.keys(ge);throw new Error("Cannot compute the outputs ["+kn+"] from the provided inputs ["+rr+"]. Missing the following inputs: ["+it+"]")}return function(Bn,Gn,Zn){var Gt=Zn.usedNodes,Wt=Zn.inputs,Sn=[];Object.keys(Wt).map(function(er){return re(er)[0]}).map(function(er){return Bn.nodes[er]}).forEach(function(er){Gt.has(er.name)&&Sn.push(er)}),Bn.weights.forEach(function(er){Gt.has(er.name)&&Sn.push(er)});for(var un=new Set,qe=[];Sn.length>0;){var $n=Sn.pop();un.add($n.name),Gn[$n.name]||qe.push($n),$n.children.forEach(function(er){!un.has(er.name)&&Gt.has(er.name)&&er.inputs.every(function(sr){return un.has(sr.name)})&&Sn.push(er)})}return qe}(this.graph,this.weightMap,Ie)},_e.prototype.execute=function(ge,Ae){var Ie=this;ge=this.mapInputs(ge);var it=Object.keys(ge).sort();this.checkInputs(ge),this.checkInputShapeAndType(ge),Ae=this.mapOutputs(Ae),this.checkOutputs(Ae);var St=it.map(function(Gn){return Ie.graph.nodes[re(Gn)[0]]}),Jt=Ae.map(function(Gn){return Ie.graph.nodes[re(Gn)[0]]}),kn=this.getCompilationKey(St,Jt),rr=this.compiledMap.get(kn);rr==null&&(rr=this.compile(ge,Jt),this.compiledMap.set(kn,rr));var Bn={};return Object(g.tidy)(function(){var Gn=new qr(Ie._weightMap,Bn),Zn=O({},Ie.weightMap);Object.keys(ge).forEach(function($n){var er=re($n),sr=er[0],pr=[];pr[er[1]]=ge[$n],Zn[sr]=pr});for(var Gt=Ie.getFrozenTensorIds(Zn),Wt={},Sn=0;Sn<rr.length;Sn++){var un=rr[Sn];if(!Zn[un.name]){var qe=ci(un,Zn,Gn);if(qe instanceof Promise)throw new Error("The execution of the op '"+un.op+"' returned a promise. Please use model.executeAsync() instead.");Zn[un.name]=qe,Ie.checkTensorForDisposal(un.name,un,Zn,Gn,Gt,Ae,Wt)}}return Ae.map(function($n){return ee($n,Zn,Gn)})})},_e.prototype.getFrozenTensorIds=function(ge){var Ae=[].concat.apply([],Object.keys(ge).map(function(Ie){return ge[Ie]}).map(function(Ie){return Ie.map(function(it){return it.id})}));return new Set(Ae)},_e.prototype.checkTensorForDisposal=function(ge,Ae,Ie,it,St,Jt,kn){Ae.category!=="control"&&Jt.indexOf(ge)===-1&&(Ie[ge].forEach(function(rr){rr!=null&&(kn[rr.id]=(kn[rr.id]||0)+Ae.children.length)}
7699),Ae.inputs.forEach(function(rr){if(rr.category!=="control"){var Bn=function(Gn,Zn,Gt){return Zn[K(Gn,Gt.currentContextId)]}(rr.name,Ie,it);Bn!=null&&Bn.forEach(function(Gn){if(Gn&&!St.has(Gn.id)){var Zn=kn[Gn.id];Zn===1?(Gn.dispose(),delete kn[Gn.id]):Zn!=null&&kn[Gn.id]--}})}}))},_e.prototype.executeAsync=function(ge,Ae){return A(this,void 0,void 0,function(){var Ie,it,St,Jt,kn,rr,Bn=this;return S(this,function(Gn){switch(Gn.label){case 0:return ge=this.mapInputs(ge),this.checkInputs(ge),this.checkInputShapeAndType(ge),Ae=this.mapOutputs(Ae),this.checkOutputs(Ae),Ie={},it=new qr(this._weightMap,Ie),[4,this.executeWithControlFlow(ge,it,Ae)];case 1:return St=Gn.sent(),Jt=Ae.map(function(Zn){return ee(Zn,St,it)}),kn=new Set(Jt.map(function(Zn){return Zn.id})),rr=new Set(Object.keys(ge).map(function(Zn){return ge[Zn].id})),Object.keys(St).forEach(function(Zn){St[Zn].forEach(function(Gt){!Gt||Gt.isDisposed||kn.has(Gt.id)||rr.has(Gt.id)||Bn.weightIds.indexOf(Gt.id)!==-1||Gt.dispose()})}),[2,Jt]}})})},_e.prototype.executeWithControlFlow=function(ge,Ae,Ie){return A(this,void 0,void 0,function(){var it,St,Jt,kn,rr,Bn,Gn,Zn,Gt,Wt,Sn,un,qe,$n,er,sr,pr=this;return S(this,function(Zr){switch(Zr.label){case 0:it=Object.keys(ge),St=it.map(function(Mr){return pr.graph.nodes[re(Mr)[0]]}),Jt=Ie.map(function(Mr){return pr.graph.nodes[re(Mr)[0]]}),kn=mi(ge,Jt,this.weightMap),rr=kn.usedNodes,Bn=kn.missingInputs,Gn=kn.dynamicNode,Zn=kn.syncInputs,Gt=St.concat(this.graph.weights).map(function(Mr){return{node:Mr,contexts:Ae.currentContext}}),Wt=O({},this.weightMap),Object.keys(ge).forEach(function(Mr){var Ii=re(Mr),Lo=Ii[0],Ai=[];Ai[Ii[1]]=ge[Mr],Wt[Lo]=Ai}),Sn={},un=this.getFrozenTensorIds(Wt),qe={},Zr.label=1;case 1:return Gt.length>0?($n=this.processStack(St,Gt,Ae,Wt,qe,un,Ie,Sn,rr),[4,Promise.all($n)]):[3,3];case 2:return Zr.sent(),[3,1];case 3:if(Gn==null&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead."),(er=Jt.filter(function(Mr){return!ri(Mr)&&!ee(Mr.name,Wt,Ae)}).map(function(Mr){return Mr.name})).length>0)throw sr="",Gn!=null&&(sr="Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs ["+Zn+"]"),new Error("Cannot compute the outputs ["+er+"] from the provided inputs ["+it+"]. Consider providing the following inputs: ["+Bn+"]. "+sr);return[2,Wt]}})})},_e.prototype.processStack=function(ge,Ae,Ie,it,St,Jt,kn,rr,Bn){for(var Gn=this,Zn=[],Gt=function(){var Sn=Ae.pop();Ie.currentContext=Sn.contexts;var un="";if(Sn.node.op==="Enter"&&N("isConstant",Sn.node,it,Ie)&&(un=J(Sn.node.name,Ie)[0]),ge.indexOf(Sn.node)===-1){var qe=ci(Sn.node,it,Ie);un||(un=J(Sn.node.name,Ie)[0]);var $n=Ie.currentContext;qe instanceof Promise?Zn.push(qe.then(function(er){return it[un]=er,Ie.currentContext=$n,Gn.checkTensorForDisposal(un,Sn.node,it,Ie,Jt,kn,rr),Gn.processChildNodes(Sn.node,Ae,Ie,it,St,Bn),er})):(it[un]=qe,Wt.checkTensorForDisposal(un,Sn.node,it,Ie,Jt,kn,rr),Wt.processChildNodes(Sn.node,Ae,Ie,it,St,Bn))}else Wt.processChildNodes(Sn.node,Ae,Ie,it,St,Bn)},Wt=this;Ae.length>0;)Gt();return Zn},_e.prototype.processChildNodes=function(ge,Ae,Ie,it,St,Jt){ge.children.forEach(function(kn){var rr=J(kn.name,Ie)[0];!St[rr]&&Jt.has(kn.name)&&(kn.op==="Merge"?kn.inputNames.some(function(Bn){return!!ee(Bn,it,Ie)})&&(St[rr]=!0,Ae.push({contexts:Ie.currentContext,node:kn})):kn.inputNames.every(function(Bn){return!!ee(Bn,it,Ie)})&&(St[rr]=!0,Ae.push({contexts:Ie.currentContext,node:kn})))})},_e.prototype.dispose=function(){var ge=this;Object.keys(this.weightMap).forEach(function(Ae){return ge.weightMap[Ae].forEach(function(Ie){return Ie.dispose()})})},_e.prototype.checkInputShapeAndType=function(ge){var Ae=this;Object.keys(ge).forEach(function(Ie){var it=ge[Ie],St=re(Ie)[0],Jt=Ae.graph.nodes[St];if(Jt.attrParams.shape&&Jt.attrParams.shape.value){var kn=Jt.attrParams.shape.value,rr=kn.length===it.shape.length&&it.shape.every(function(Bn,Gn){return kn[Gn]===-1||kn[Gn]===Bn});g.util.assert(rr,function(){return"The shape of dict['"+Jt.name+"'] provided in model.execute(dict) must be ["+kn+"], but was ["+it.shape+"]"})}Jt.attrParams.dtype&&Jt.attrParams.dtype.value&&g.util.assert(it.dtype===Jt.attrParams.dtype.value,function(){return"The dtype of dict['"+Jt.name+"'] provided in model.execute(dict) must be "+Jt.attrParams.dtype.value+", but was "+it.dtype})})}
7699,_e.prototype.mapInputs=function(ge){var Ae={};for(var Ie in ge)this._signature!=null&&this._signature.inputs!=null&&this._signature.inputs[Ie]!=null?Ae[this._signature.inputs[Ie].name]=ge[Ie]:Ae[Ie]=ge[Ie];return Ae},_e.prototype.checkInputs=function(ge){var Ae=this,Ie=Object.keys(ge).filter(function(it){var St=re(it)[0];return Ae.graph.nodes[St]==null});if(Ie.length>0)throw new Error("The dict provided in model.execute(dict) has keys: ["+Ie+"] that are not part of graph")},_e.prototype.mapOutputs=function(ge){var Ae=this;return ge.map(function(Ie){return Ae._signature!=null&&Ae._signature.outputs!=null&&Ae._signature.outputs[Ie]!=null?Ae._signature.outputs[Ie].name:Ie},{})},_e.prototype.checkOutputs=function(ge){var Ae=this;ge.forEach(function(Ie){var it=re(Ie)[0];if(!Ae.graph.nodes[it])throw new Error("The output '"+Ie+"' is not found in the graph")})},_e}(),co="?tfjs-format=file",$i="model.json",Ft=function(){function _e(ge,Ae){Ae===void 0&&(Ae={}),this.modelUrl=ge,this.loadOptions=Ae,this.version="n/a",Ae==null&&(this.loadOptions={})}return Object.defineProperty(_e.prototype,"modelVersion",{get:function(){return this.version},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"inputNodes",{get:function(){return this.executor.inputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"outputNodes",{get:function(){return this.executor.outputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"inputs",{get:function(){return this.executor.inputs},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"outputs",{get:function(){return this.executor.outputs},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"weights",{get:function(){return this.executor.weightMap},enumerable:!0,configurable:!0}),_e.prototype.findIOHandler=function(){var ge=this.modelUrl;if(ge.load!=null)this.handler=ge;else if(this.loadOptions.requestInit!=null)this.handler=g.io.browserHTTPRequest(ge,this.loadOptions);else{var Ae=g.io.getLoadHandlers(ge,this.loadOptions.onProgress);if(Ae.length===0)Ae.push(g.io.browserHTTPRequest(ge,this.loadOptions));else if(Ae.length>1)throw new Error("Found more than one ("+Ae.length+") load handlers for URL '"+[ge]+"'");this.handler=Ae[0]}},_e.prototype.load=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it;return S(this,function(St){switch(St.label){case 0:if(this.findIOHandler(),this.handler.load==null)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return ge=this,[4,this.handler.load()];case 1:return ge.artifacts=St.sent(),Ae=this.artifacts.modelTopology,Ie={},this.artifacts.userDefinedMetadata!=null&&(Ie=this.artifacts.userDefinedMetadata.signature),this.version=Ae.versions.producer+"."+Ae.versions.minConsumer,it=g.io.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs),this.executor=new na(bt.Instance.transformGraph(Ae,Ie)),this.executor.weightMap=this.convertTensorMapToTensorsMap(it),[2,!0]}})})},_e.prototype.save=function(ge,Ae){return A(this,void 0,void 0,function(){var Ie;return S(this,function(it){if(typeof ge=="string"){if((Ie=g.io.getSaveHandlers(ge)).length===0)throw new Error("Cannot find any save handlers for URL '"+ge+"'");if(Ie.length>1)throw new Error("Found more than one ("+Ie.length+") save handlers for URL '"+ge+"'");ge=Ie[0]}if(ge.save==null)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return[2,ge.save(this.artifacts)]})})},_e.prototype.predict=function(ge,Ae){return this.execute(ge,this.outputNodes)},_e.prototype.normalizeInputs=function(ge){if(!(ge instanceof g.Tensor||Array.isArray(ge)))return ge;if((ge=Array.isArray(ge)?ge:[ge]).length!==this.inputNodes.length)throw new Error("Input tensor count mismatch,the graph model has "+this.inputNodes.length+" placeholders, while there are "+ge.length+" input tensors.");return this.inputNodes.reduce(function(Ae,Ie,it){return Ae[Ie]=ge[it],Ae},{})},_e.prototype.normalizeOutputs=function(ge){return ge=ge||this.outputNodes,Array.isArray(ge)?ge:[ge]},_e.prototype.execute=function(ge,Ae){ge=this.normalizeInputs(ge),Ae=this.normalizeOutputs(Ae);var Ie=this.executor.execute(ge,Ae);return Ie.length>1?Ie:Ie[0]},_e.prototype.executeAsync=function(ge,Ae){return A(this,void 0,void 0,function(){var Ie;return S(this,function(it){switch(it.label){case 0:return ge=this.normalizeInputs(ge),Ae=this.normalizeOutputs(Ae),[4,this.executor.executeAsync(ge,Ae)];case 1:return[2,(Ie=it.sent()).length>1?Ie:Ie[0]]}})})},_e.prototype.convertTensorMapToTensorsMap=function(ge){return Object.keys(ge).reduce(function(Ae,Ie){return Ae[Ie]=[ge[Ie]],Ae},{})},_e.prototype.dispose=function(){this.executor.dispose()},_e}();function Qr(_e,ge){return ge===void 0&&(ge={}),A(this,void 0,void 0,function(){var Ae;return S(this,function(Ie){switch(Ie.label){case 0:if(_e==null)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");return ge==null&&(ge={}),ge.fromTFHub&&_e.load==null&&(_e.endsWith("/")||(_e+="/"),_e=""+_e+$i+co),[4,(Ae=new Ft(_e,ge)).load()];case 1:return Ie.sent(),[2,Ae]}})})}var Zt="1.7.4"}.call(this,n(92).Buffer)},function(a,i,n){/** 7700* @license 7701* Copyright 2017 Google Inc. All Rights Reserved. 7702* Licensed under the Apache License, Version 2.0 (the "License");
7703* you may not use this file except in compliance with the License. 7704* You may obtain a copy of the License at 7705* 7706* http://www.apache.org/licenses/LICENSE-2.0 7707* 7708* Unless required by applicable law or agreed to in writing, software 7709* distributed under the License is distributed on an "AS IS" BASIS, 7710* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7711* See the License for the specific language governing permissions and 7712* limitations under the License. 7713* ============================================================================= 7714*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(103);function h(J){for(var K=J.length,re=0,ce=0;K>0;)ce=Math.random()*K|0,re=J[--K],J[K]=J[ce],J[ce]=re}function v(J,K){if(!J)throw new Error(typeof K=="string"?K:K())}function g(J,K,re){if(K===void 0&&(K=[]),re===void 0&&(re=!1),K==null&&(K=[]),Array.isArray(J)||P(J)&&!re)for(var ce=0;ce<J.length;++ce)g(J[ce],K,re);else K.push(J);return K}function O(J,K){if(J===K)return!0;if(J==null||K==null||J.length!==K.length)return!1;for(var re=0;re<J.length;re++)if(J[re]!==K[re])return!1;return!0}function A(J){return J%1==0}function S(J,K){var re=K.length;return v((J=J==null?K.map(function(ce,pe){return pe}):[].concat(J)).every(function(ce){return ce>=-re&&ce<re}),function(){return"All values in axis param must be in range [-"+re+", "+re+") but got axis "+J}),v(J.every(function(ce){return A(ce)}),function(){return"All values in axis param must be integers but got axis "+J}),J.map(function(ce){return ce<0?re+ce:ce})}function M(J,K){for(var re=0;re<J.length;re++){var ce=J[re];if(isNaN(ce)||!isFinite(ce))throw Error("A tensor of type "+K+" being uploaded contains "+ce+".")}}function P(J){return J instanceof Float32Array||J instanceof Int32Array||J instanceof Uint8Array}function L(J){return typeof J=="string"||J instanceof String}function V(J){return typeof J=="boolean"}function N(J){return typeof J=="number"}function ee(J,K){if(K==null||K==="float32"||K==="complex64")return new Float32Array(J);if(K==="int32")return new Int32Array(J);if(K==="bool")return new Uint8Array(J);throw new Error("Unknown data type "+K)}i.shuffle=h,i.clamp=function(J,K,re){return Math.max(J,Math.min(K,re))},i.nearestLargerEven=function(J){return J%2==0?J:J+1},i.sum=function(J){for(var K=0,re=0;re<J.length;re++)K+=J[re];return K},i.randUniform=function(J,K){var re=Math.random();return K*re+(1-re)*J},i.distSquared=function(J,K){for(var re=0,ce=0;ce<J.length;ce++){var pe=Number(J[ce])-Number(K[ce]);re+=pe*pe}return re},i.assert=v,i.assertShapesMatch=function(J,K,re){re===void 0&&(re=""),v(O(J,K),function(){return re+" Shapes "+J+" and "+K+" must match"})},i.assertNonNull=function(J){v(J!=null,function(){return"The input to the tensor constructor must be a non-null value."})},i.flatten=g,i.sizeFromShape=function(J){if(J.length===0)return 1;for(var K=J[0],re=1;re<J.length;re++)K*=J[re];return K},i.isScalarShape=function(J){return J.length===0},i.arraysEqual=O,i.isInt=A,i.tanh=function(J){if(Math.tanh!=null)return Math.tanh(J);if(J===1/0)return 1;if(J===-1/0)return-1;var K=Math.exp(2*J);return(K-1)/(K+1)},i.sizeToSquarishShape=function(J){var K=Math.ceil(Math.sqrt(J));return[K,Math.ceil(J/K)]},i.createShuffledIndices=function(J){for(var K=new Uint32Array(J),re=0;re<J;++re)K[re]=re;return h(K),K},i.rightPad=function(J,K){return K<=J.length?J:J+" ".repeat(K-J.length)},i.repeatedTry=function(J,K,re){return K===void 0&&(K=function(ce){return 0}),new Promise(function(ce,pe){var ke=0,Ce=function(){if(J())ce();else{var be=K(++ke);re!=null&&ke>=re?pe():setTimeout(Ce,be)}};Ce()})},i.inferFromImplicitShape=function(J,K){for(var re=1,ce=-1,pe=0;pe<J.length;++pe)if(J[pe]>=0)re*=J[pe];else if(J[pe]===-1){if(ce!==-1)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+ce+" and dim "+pe);ce=pe}else if(J[pe]<0)throw Error("Shapes can not be < 0. Found "+J[pe]+" at dim "+pe);if(ce===-1){if(K>0&&K!==re)throw Error("Size("+K+") must match the product of shape "+J);return J}if(re===0)throw Error("Cannot infer the missing size in ["+J+"] when there are 0 elements");if(K%re!=0)throw Error("The implicit shape can't be a fractional number. Got "+K+" / "+re);var ke=J.slice();return ke[ce]=K/re,ke},i.parseAxisParam=S,i.squeezeShape=function(J,K){for(var re=[],ce=[],pe=K!=null&&Array.isArray(K)&&K.length===0,ke=K==null||pe?null:S(K,J).sort(),Ce=0,be=0;be<J.length;++be){if(ke!=null){if(ke[Ce]===be&&J[be]!==1)throw new Error("Can't squeeze axis "+be+" since its dim '"+J[be]+"' is not 1");(ke[Ce]==null||ke[Ce]>be)&&J[be]===1&&(re.push(J[be]),ce.push(be)),ke[Ce]<=be&&Ce++}J[be]!==1&&(re.push(J[be]),ce.push(be))}return{newShape:re,keptDims:ce}},i.getTypedArrayFromDType=function(J,K){var re=null;if(J==null||J==="float32")re=new Float32Array(K);else if(J==="int32")re=new Int32Array(K);else{if(J!=="bool")throw new Error("Unknown data type "+J);re=new Uint8Array(K)}return re},i.getArrayFromDType=function(J,K){var re=null;if(J==null||J==="float32")re=new Float32Array(K);else if(J==="int32")re=new Int32Array(K);else if(J==="bool")re=new Uint8Array(K);else{if(J!=="string")throw new Error("Unknown data type "+J);re=new Array(K)}return re},i.checkConversionForErrors=M,i.isValidDtype=function(J){return J==="bool"||J==="complex64"||J==="float32"||J==="int32"||J==="string"},i.hasEncodingLoss=function(J,K){return!(K==="complex64"||K==="float32"&&J!=="complex64"||K==="int32"&&J!=="float32"&&J!=="complex64"||K==="bool"&&J==="bool")},i.isTypedArray=P,i.bytesPerElement=function(J){if(J==="float32"||J==="int32")return 4;if(J==="complex64")return 8;if(J==="bool")return 1;throw new Error("Unknown dtype "+J)},i.bytesFromStringArray=function(J){if(J==null)return 0;var K=0;return J.forEach(function(re){return K+=re.length}),K},i.isString=L,i.isBoolean=V,i.isNumber=N,i.inferDtype=function J(K){return Array.isArray(K)?J(K[0]):K instanceof Float32Array?"float32":K instanceof Int32Array||K instanceof Uint8Array?"int32":N(K)?"float32":L(K)?"string":V(K)?"bool":"float32"},i.isFunction=function(J){return!!(J&&J.constructor&&J.call&&J.apply)},i.nearestDivisor=function(J,K){for(var re=K;re<J;++re)if(J%re==0)return re;return J},i.computeStrides=function(J){var K=J.length;if(K<2)return[];var re=new Array(K-1);re[K-2]=J[K-1];for(var ce=K-3;ce>=0;--ce)re[ce]=re[ce+1]*J[ce+1];return re},i.toTypedArray=function(J,K,re){if(K==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(J)&&(J=g(J)),re&&M(J,K),function(ke,Ce){return ke instanceof Float32Array&&Ce==="float32"||ke instanceof Int32Array&&Ce==="int32"||ke instanceof Uint8Array&&Ce==="bool"}(J,K))return J;if(K==null||K==="float32"||K==="complex64")return new Float32Array(J);if(K==="int32")return new Int32Array(J);if(K==="bool"){for(var ce=new Uint8Array(J.length),pe=0;pe<ce.length;++pe)Math.round(J[pe])!==0&&(ce[pe]=1);return ce}throw new Error("Unknown data type "+K)},i.toNestedArray=function(J,K){if(J.length===0)return K[0];var re=J.reduce(function(ce,pe){return ce*pe});if(re===0)return[];if(re!==K.length)throw new Error("["+J+"] does not match the input size.");return function ce(pe,ke,Ce){var be=new Array;
vendor: 11,543 bytes, lines 7714-7729
7714if(ke.length===1)for(var $e=ke[0],ht=0;ht<$e;ht++)be[ht]=Ce[pe+ht];else{$e=ke[0];var Dt=ke.slice(1),Ut=Dt.reduce(function(Ee,Ot){return Ee*Ot});for(ht=0;ht<$e;ht++)be[ht]=ce(pe+ht*Ut,Dt,Ce)}return be}(0,J,K)},i.makeOnesTypedArray=function(J,K){for(var re=ee(J,K),ce=0;ce<re.length;ce++)re[ce]=1;return re},i.makeZerosTypedArray=ee,i.now=function(){return s.env().platform.now()},i.assertNonNegativeIntegerDimensions=function(J){J.forEach(function(K){v(Number.isInteger(K)&&K>=0,function(){return"Tensor must have a shape comprised of positive integers but got shape ["+J+"]."})})},i.fetch=function(J,K){return s.env().platform.fetch(J,K)},i.encodeString=function(J,K){return K===void 0&&(K="utf-8"),K=K||"utf-8",s.env().platform.encode(J,K)},i.decodeString=function(J,K){return K===void 0&&(K="utf-8"),K=K||"utf-8",s.env().platform.decode(J,K)},i.locToIndex=function(J,K,re){if(K===0)return 0;if(K===1)return J[0];for(var ce=J[J.length-1],pe=0;pe<J.length-1;++pe)ce+=re[pe]*J[pe];return ce},i.indexToLoc=function(J,K,re){if(K===0)return[];if(K===1)return[J];for(var ce=new Array(K),pe=0;pe<ce.length-1;++pe)ce[pe]=Math.floor(J/re[pe]),J-=ce[pe]*re[pe];return ce[ce.length-1]=J,ce}},function(a,i,n){var s=n(54),h=Math.min;a.exports=function(v){return v>0?h(s(v),9007199254740991):0}},function(a,i,n){var s=n(262),h=n(261),v=n(187),g=n(260);a.exports=function(O,A){return s(O)||h(O,A)||v(O,A)||g()},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i){var n=a.exports={version:"2.6.12"};typeof __e=="number"&&(__e=n)},function(a,i,n){(function(s,h){/** 7715 * @license 7716 * Copyright 2018 Google LLC. All Rights Reserved. 7717 * Licensed under the Apache License, Version 2.0 (the "License"); 7718 * you may not use this file except in compliance with the License. 7719 * You may obtain a copy of the License at 7720 * 7721 * http://www.apache.org/licenses/LICENSE-2.0 7722 * 7723 * Unless required by applicable law or agreed to in writing, software 7724 * distributed under the License is distributed on an "AS IS" BASIS, 7725 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7726 * See the License for the specific language governing permissions and 7727 * limitations under the License. 7728 * ============================================================================= 7729 */var v=this&&this.__awaiter||function(re,ce,pe,ke){return new(pe||(pe=Promise))(function(Ce,be){function $e(Ut){try{Dt(ke.next(Ut))}catch(Ee){be(Ee)}}function ht(Ut){try{Dt(ke.throw(Ut))}catch(Ee){be(Ee)}}function Dt(Ut){Ut.done?Ce(Ut.value):new pe(function(Ee){Ee(Ut.value)}).then($e,ht)}Dt((ke=ke.apply(re,ce||[])).next())})},g=this&&this.__generator||function(re,ce){var pe,ke,Ce,be,$e={label:0,sent:function(){if(1&Ce[0])throw Ce[1];return Ce[1]},trys:[],ops:[]};return be={next:ht(0),throw:ht(1),return:ht(2)},typeof Symbol=="function"&&(be[Symbol.iterator]=function(){return this}),be;function ht(Dt){return function(Ut){return function(Ee){if(pe)throw new TypeError("Generator is already executing.");for(;$e;)try{if(pe=1,ke&&(Ce=2&Ee[0]?ke.return:Ee[0]?ke.throw||((Ce=ke.return)&&Ce.call(ke),0):ke.next)&&!(Ce=Ce.call(ke,Ee[1])).done)return Ce;switch(ke=0,Ce&&(Ee=[2&Ee[0],Ce.value]),Ee[0]){case 0:case 1:Ce=Ee;break;case 4:return $e.label++,{value:Ee[1],done:!1};case 5:$e.label++,ke=Ee[1],Ee=[0];continue;case 7:Ee=$e.ops.pop(),$e.trys.pop();continue;default:if(!(Ce=(Ce=$e.trys).length>0&&Ce[Ce.length-1])&&(Ee[0]===6||Ee[0]===2)){$e=0;continue}if(Ee[0]===3&&(!Ce||Ee[1]>Ce[0]&&Ee[1]<Ce[3])){$e.label=Ee[1];break}if(Ee[0]===6&&$e.label<Ce[1]){$e.label=Ce[1],Ce=Ee;break}if(Ce&&$e.label<Ce[2]){$e.label=Ce[2],$e.ops.push(Ee);break}Ce[2]&&$e.ops.pop(),$e.trys.pop();continue}Ee=ce.call(re,$e)}catch(Ot){Ee=[6,Ot],ke=0}finally{pe=Ce=0}if(5&Ee[0])throw Ee[1];return{value:Ee[0]?Ee[1]:void 0,done:!0}}([Dt,Ut])}}};Object.defineProperty(i,"__esModule",{value:!0});var O,A=n(103),S=n(382),M=n(381),P=n(380),L=n(33),V=n(74),N=n(21),ee=n(21),J=function(){function re(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null}}return re.prototype.dispose=function(){for(var ce in this.registeredVariables)this.registeredVariables[ce].dispose()},re}(),K=function(){function re(ce){this.ENV=ce,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new J}return re.prototype.ready=function(){return v(this,void 0,void 0,function(){var ce,pe,ke;return g(this,function(Ce){switch(Ce.label){case 0:if(this.pendingBackendInit!=null)return[2,this.pendingBackendInit.then(function(){})];if(this.backendInstance!=null)return[2];ce=this.getSortedBackends(),pe=0,Ce.label=1;case 1:return pe<ce.length?(ke=ce[pe],[4,this.initializeBackend(ke).success]):[3,5];case 2:return Ce.sent()?[4,this.setBackend(ke)]:[3,4];case 3:return Ce.sent(),[2];case 4:return pe++,[3,1];case 5:throw new Error("Could not initialize any backends, all backend initializations failed.")}})})},Object.defineProperty(re.prototype,"backend",{get:function(){if(this.pendingBackendInit!=null)throw new Error("Backend '"+this.backendName+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");if(this.backendInstance==null){var ce=this.initializeBackendsAndReturnBest(),pe=ce.name;if(ce.asyncInit)throw new Error("The highest priority backend '"+pe+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(pe)}return this.backendInstance},enumerable:!0,configurable:!0}),re.prototype.backendNames=function(){return Object.keys(this.registryFactory)},re.prototype.findBackend=function(ce){return!(ce in this.registry)&&(!(ce in this.registryFactory)||this.initializeBackend(ce).asyncInit)?null:this.registry[ce]},re.prototype.findBackendFactory=function(ce){return ce in this.registryFactory?this.registryFactory[ce].factory:null},re.prototype.registerBackend=function(ce,pe,ke){return ke===void 0&&(ke=1),ce in this.registryFactory?(console.warn(ce+" backend was already registered. Reusing existing backend factory."),!1):(this.registryFactory[ce]={factory:pe,priority:ke},!0)},re.prototype.setBackend=function(ce){return v(this,void 0,void 0,function(){var pe,ke,Ce;return g(this,function(be){switch(be.label){case 0:if(this.registryFactory[ce]==null)throw new Error("Backend name '"+ce+"' not found in registry");return this.backendName=ce,this.registry[ce]!=null?[3,4]:(this.backendInstance=null,pe=this.initializeBackend(ce),ke=pe.success,pe.asyncInit?[4,ke]:[3,2]);case 1:return Ce=be.sent(),[3,3];case 2:Ce=ke,be.label=3;case 3:if(!Ce)return[2,!1];be.label=4;case 4:return this.backendInstance=this.registry[ce],this.setupRegisteredKernels(),this.profiler=new M.Profiler(this.backendInstance),[2,!0]}})})},re.prototype.setupRegisteredKernels=function(){var ce=this;S.getKernelsForBackend(this.backendName).forEach(function(pe){pe.setupFunc!=null&&pe.setupFunc(ce.backendInstance)})},re.prototype.disposeRegisteredKernels=function(ce){var pe=this;S.getKernelsForBackend(ce).forEach(function(ke){ke.disposeFunc!=null&&ke.disposeFunc(pe.registry[ce])})},re.prototype.initializeBackend=function(ce){var pe=this,ke=this.registryFactory[ce];if(ke==null)throw new Error("Cannot initialize backend "+ce+", no registration found.");try{var Ce=ke.factory();if(Promise.resolve(Ce)===Ce){var be=++this.pendingBackendInitId,$e=Ce.then(function(ht){return!(be<pe.pendingBackendInitId)&&(pe.registry[ce]=ht,pe.pendingBackendInit=null,!0)}).catch(function(ht){return!(be<pe.pendingBackendInitId)&&(pe.pendingBackendInit=null,console.warn("Initialization of backend "+ce+" failed"),console.warn(ht.stack||ht.message),!1)});return this.pendingBackendInit=$e,{success:$e,asyncInit:!0}}return this.registry[ce]=Ce,{success:!0,asyncInit:!1}}catch(ht){return console.warn("Initialization of backend "+ce+" failed"),console.warn(ht.stack||ht.message),{success:!1,asyncInit:!1}}},re.prototype.removeBackend=function(ce){if(!(ce in this.registryFactory))throw new Error(ce+" backend not found in registry");this.backendName===ce&&this.pendingBackendInit!=null&&this.pendingBackendInitId++,ce in this.registry&&(this.disposeRegisteredKernels(ce),this.registry[ce].dispose(),delete this.registry[ce]),delete this.registryFactory[ce],this.backendName===ce&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)},re.prototype.getSortedBackends=function(){var ce=this;if(Object.keys(this.registryFactory).length===0)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(function(pe,ke){return ce.registryFactory[ke].priority-ce.registryFactory[pe].priority})},re.prototype.initializeBackendsAndReturnBest=function(){for(var ce=this.getSortedBackends(),pe=0;pe<ce.length;pe++){var ke=ce[pe],Ce=this.initializeBackend(ke),be=Ce.success,$e=Ce.asyncInit;if($e||be)return{name:ke,asyncInit:$e}}throw new Error("Could not initialize any backends, all backend initializations failed.")},re.prototype.moveData=function(ce,pe){var ke=this.state.tensorInfo.get(pe),Ce=ke.backend,be=this.readSync(pe);Ce.disposeData(pe),ke.backend=ce,ce.move(pe,be,ke.shape,ke.dtype),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++},re.prototype.tidy=function(ce,pe){var ke,Ce=this,be=null;if(pe==null){if(typeof ce!="function")throw new Error("Please provide a function to tidy()");pe=ce}else{if(typeof ce!="string"&&!(ce instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if(typeof pe!="function")throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");be=ce}return this.scopedRun(function(){return Ce.startScope(be)},function(){return Ce.endScope(ke)},function(){return(ke=pe())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),ke})},re.prototype.scopedRun=function(ce,pe,ke){ce();try{var Ce=ke();return pe(),Ce}catch(be){throw pe(),be}},re.prototype.nextTensorId=function(){return re.nextTensorId++},re.prototype.nextVariableId=function(){return re.nextVariableId++},re.prototype.clone=function(ce){var pe=this.makeTensorFromDataId(ce.dataId,ce.shape,ce.dtype),ke={x:ce};return this.addTapeNode(this.state.activeScope.name,ke,[pe],function(Ce){return{x:function(){return Ce.toFloat()}}},[],{}),pe},re.prototype.runKernel=function(ce,pe,ke,Ce,be){return this.runKernelFunc(null,pe,null,ce,ke,Ce,be)},re.prototype.shouldCheckForMemLeaks=function(){return this.ENV.getBool("IS_TEST")},re.prototype.checkKernelForMemLeak=function(ce,pe,ke){var Ce=this.backend.numDataIds(),be=0;ke.forEach(function(Dt){be+=Dt.dtype==="complex64"?3:1});var $e=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],ht=Ce-pe-be-$e;if(ht>0)throw new Error("Backend '"+this.backendName+"' has an internal memory leak ("+ht+" data ids) after running '"+ce+"'")},re.prototype.runKernelFunc=function(ce,pe,ke,Ce,be,$e,ht){var Dt,Ut=this,Ee=[],Ot=this.isTapeOn();Ce==null&&(Ce=this.state.activeScope!=null?this.state.activeScope.name:"");var zt,Mt=this.state.numBytes,Ke=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);var Tt,vt=S.getKernel(Ce,this.backendName);if(vt!=null)zt=function(){var bt=Ut.backend.numDataIds();
7729Tt=vt.kernelFunc({inputs:pe,attrs:be,backend:Ut.backend});var Ht=Array.isArray(Tt)?Tt:[Tt];Ut.shouldCheckForMemLeaks()&&Ut.checkKernelForMemLeak(Ce,bt,Ht);var _t=Ht.map(function(sn){var yn=sn.dataId,Yt=sn.shape,We=sn.dtype;return Ut.makeTensorFromDataId(yn,Yt,We)});if(Ot){var Ze=Ut.getTensorsForGradient(Ce,pe,_t);if(Ze==null){ht==null&&(ht=[]);var Vt=_t.filter(function(sn,yn){return ht[yn]});Ze=($e||[]).slice().concat(Vt)}Ee=Ut.saveTensorsForBackwardMode(Ze)}return _t};else{var yt=function(bt){Ot&&(Ee=bt.map(function(Ht){return Ut.keep(Ut.clone(Ht))}))};zt=function(){var bt=Ut.backend.numDataIds();Tt=Ut.tidy(function(){return ce(Ut.backend,yt)});var Ht=Array.isArray(Tt)?Tt:[Tt];return Ut.shouldCheckForMemLeaks()&&Ut.checkKernelForMemLeak(Ce,bt,Ht),Ht}}return this.scopedRun(function(){return Ut.state.kernelDepth++},function(){return Ut.state.kernelDepth--},function(){Dt=Ut.ENV.getBool("DEBUG")?Ut.profiler.profileKernel(Ce,pe,function(){return zt()}):zt()}),Ot&&this.addTapeNode(Ce,pe,Dt,ke,Ee,be),this.state.profiling&&this.state.activeProfile.kernels.push({name:Ce,bytesAdded:this.state.numBytes-Mt,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-Ke,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(pe).map(function(bt){return pe[bt].shape}),outputShapes:Dt.map(function(bt){return bt.shape})}),Array.isArray(Tt)?Dt:Dt[0]},re.prototype.saveTensorsForBackwardMode=function(ce){var pe=this;return ce.map(function(ke){return pe.keep(pe.clone(ke))})},re.prototype.getTensorsForGradient=function(ce,pe,ke){var Ce=S.getGradient(ce);if(Ce!=null){var be=Ce.inputsToSave||[],$e=Ce.outputsToSave||[],ht=void 0;Ce.saveAllInputs?(N.assert(Array.isArray(pe),function(){return"saveAllInputs is true, expected inputs to be an array."}),ht=Object.keys(pe).map(function(Ut){return pe[Ut]})):ht=be.map(function(Ut){return pe[Ut]});var Dt=ke.filter(function(Ut,Ee){return $e[Ee]});return ht.concat(Dt)}return null},re.prototype.makeTensor=function(ce,pe,ke,Ce){if(ce==null)throw new Error("Values passed to engine.makeTensor() are null");ke=ke||"float32",Ce=Ce||this.backend;var be=ce;ke==="string"&&N.isString(ce[0])&&(be=ce.map(function(Ee){return N.encodeString(Ee)}));var $e=Ce.write(be,pe,ke),ht=new L.Tensor(pe,ke,$e,this.nextTensorId());if(this.incRef(ht,Ce),ke==="string"){var Dt=this.state.tensorInfo.get($e),Ut=ee.bytesFromStringArray(be);this.state.numBytes+=Ut-Dt.bytes,Dt.bytes=Ut}return ht},re.prototype.makeTensorFromDataId=function(ce,pe,ke,Ce){ke=ke||"float32";var be=new L.Tensor(pe,ke,ce,this.nextTensorId());return this.incRef(be,Ce),be},re.prototype.makeVariable=function(ce,pe,ke,Ce){pe===void 0&&(pe=!0),ke=ke||this.nextVariableId().toString(),Ce!=null&&Ce!==ce.dtype&&(ce=ce.asType(Ce));var be=new L.Variable(ce,pe,ke,this.nextTensorId());if(this.state.registeredVariables[be.name]!=null)throw new Error("Variable with name "+be.name+" was already registered");return this.state.registeredVariables[be.name]=be,this.incRef(be,this.backend),be},re.prototype.incRef=function(ce,pe){var ke=this.state.tensorInfo.has(ce.dataId)?this.state.tensorInfo.get(ce.dataId).refCount:0;if(this.state.numTensors++,ce.dtype==="string"&&this.state.numStringTensors++,ke===0){this.state.numDataBuffers++;var Ce=0;ce.dtype!=="complex64"&&ce.dtype!=="string"&&(Ce=ce.size*N.bytesPerElement(ce.dtype)),this.state.tensorInfo.set(ce.dataId,{backend:pe||this.backend,dtype:ce.dtype,shape:ce.shape,bytes:Ce,refCount:0}),this.state.numBytes+=Ce}this.state.tensorInfo.get(ce.dataId).refCount++,ce instanceof L.Variable||this.track(ce)},re.prototype.disposeTensor=function(ce){if(this.state.tensorInfo.has(ce.dataId)){this.state.numTensors--,ce.dtype==="string"&&this.state.numStringTensors--;var pe=this.state.tensorInfo.get(ce.dataId);pe.refCount<=1?(ce.dtype!=="complex64"&&(this.state.numBytes-=pe.bytes),this.state.numDataBuffers--,pe.backend.disposeData(ce.dataId),this.state.tensorInfo.delete(ce.dataId)):this.state.tensorInfo.get(ce.dataId).refCount--}},re.prototype.disposeVariables=function(){for(var ce in this.state.registeredVariables){var pe=this.state.registeredVariables[ce];this.disposeVariable(pe)}},re.prototype.disposeVariable=function(ce){this.disposeTensor(ce),this.state.registeredVariables[ce.name]!=null&&delete this.state.registeredVariables[ce.name]},re.prototype.memory=function(){var ce=this.backend.memory();return ce.numTensors=this.state.numTensors,ce.numDataBuffers=this.state.numDataBuffers,ce.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(ce.unreliable=!0,ce.reasons==null&&(ce.reasons=[]),ce.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),ce},re.prototype.profile=function(ce){return v(this,void 0,void 0,function(){var pe,ke;return g(this,function(Ce){return this.state.profiling=!0,pe=this.state.numBytes,ke=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=ce(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map(function(be){return be.totalBytesSnapshot})),this.state.activeProfile.newBytes=this.state.numBytes-pe,this.state.activeProfile.newTensors=this.state.numTensors-ke,[2,this.state.activeProfile]})})},re.prototype.isTapeOn=function(){return this.state.gradientDepth>
77290&&this.state.kernelDepth===0},re.prototype.addTapeNode=function(ce,pe,ke,Ce,be,$e){var ht=this,Dt={id:this.state.nextTapeNodeId++,kernelName:ce,inputs:pe,outputs:ke,saved:be},Ut=S.getGradient(ce);Ut!=null&&(Ce=Ut.gradFunc),Ce!=null&&(Dt.gradient=function(Ee){return Ee=Ee.map(function(Ot,zt){if(Ot==null){var Mt=ke[zt],Ke=N.makeZerosTypedArray(Mt.size,Mt.dtype);return ht.makeTensor(Ke,Mt.shape,Mt.dtype)}return Ot}),Ce(Ee.length>1?Ee:Ee[0],be,$e)}),this.state.activeTape.push(Dt)},re.prototype.keep=function(ce){return ce.kept=!0,ce},re.prototype.startTape=function(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++},re.prototype.endTape=function(){this.state.gradientDepth--},re.prototype.startScope=function(ce){var pe={track:[],name:"unnamed scope",id:this.state.nextScopeId++};ce&&(pe.name=ce),this.state.scopeStack.push(pe),this.state.activeScope=pe},re.prototype.endScope=function(ce){for(var pe=this,ke=V.getTensorsInContainer(ce),Ce=new Set(ke.map(function(Dt){return Dt.id})),be=0;be<this.state.activeScope.track.length;be++){var $e=this.state.activeScope.track[be];$e.kept||Ce.has($e.id)||$e.dispose()}var ht=this.state.scopeStack.pop();this.state.activeScope=this.state.scopeStack.length===0?null:this.state.scopeStack[this.state.scopeStack.length-1],ke.forEach(function(Dt){Dt.kept||Dt.scopeId!==ht.id||pe.track(Dt)})},re.prototype.gradients=function(ce,pe,ke,Ce){var be=this;if(Ce===void 0&&(Ce=!1),N.assert(pe.length>0,function(){return"gradients() received an empty list of xs."}),ke!=null&&ke.dtype!=="float32")throw new Error("dy must have 'float32' dtype, but has '"+ke.dtype+"'");var $e=this.scopedRun(function(){return be.startTape()},function(){return be.endTape()},function(){return be.tidy("forward",ce)});N.assert($e instanceof L.Tensor,function(){return"The result y returned by f() must be a tensor."});var ht=P.getFilteredNodesXToY(this.state.activeTape,pe,$e);if(!Ce&&ht.length===0&&pe.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",function(){var Dt={};Dt[$e.id]=ke??function(Ee){var Ot=ee.makeOnesTypedArray(ee.sizeFromShape(Ee),"float32");return i.ENGINE.makeTensor(Ot,Ee,"float32")}($e.shape),P.backpropagateGradients(Dt,ht,function(Ee){return be.tidy(Ee)});var Ut=pe.map(function(Ee){return Dt[Ee.id]});return be.state.gradientDepth===0&&(be.state.activeTape.forEach(function(Ee){for(var Ot=0,zt=Ee.saved;Ot<zt.length;Ot++)zt[Ot].dispose()}),be.state.activeTape=null),{value:$e,grads:Ut}})},re.prototype.customGrad=function(ce){var pe=this;return N.assert(N.isFunction(ce),function(){return"The f passed in customGrad(f) must be a function."}),function(){for(var ke,Ce=[],be=0;be<arguments.length;be++)Ce[be]=arguments[be];N.assert(Ce.every(function(ht){return ht instanceof L.Tensor}),function(){return"The args passed in customGrad(f)(x1, x2,...) must all be tensors"});var $e={};return Ce.forEach(function(ht,Dt){$e[Dt]=ht}),pe.runKernelFunc(function(ht,Dt){return ke=ce.apply(void 0,Ce.concat([Dt])),N.assert(ke.value instanceof L.Tensor,function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"}),N.assert(N.isFunction(ke.gradFunc),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."}),ke.value},$e,function(ht,Dt){var Ut=ke.gradFunc(ht,Dt),Ee=Array.isArray(Ut)?Ut:[Ut];N.assert(Ee.length===Ce.length,function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."}),N.assert(Ee.every(function(zt){return zt instanceof L.Tensor}),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."});var Ot={};return Ee.forEach(function(zt,Mt){Ot[Mt]=function(){return zt}}),Ot})}},re.prototype.readSync=function(ce){return this.state.tensorInfo.get(ce).backend.readSync(ce)},re.prototype.read=function(ce){return this.state.tensorInfo.get(ce).backend.read(ce)},re.prototype.time=function(ce){return v(this,void 0,void 0,function(){var pe,ke;return g(this,function(Ce){switch(Ce.label){case 0:return pe=ee.now(),[4,this.backend.time(ce)];case 1:return(ke=Ce.sent()).wallMs=ee.now()-pe,[2,ke]}})})},re.prototype.track=function(ce){return this.state.activeScope!=null&&(ce.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(ce)),ce},Object.defineProperty(re.prototype,"registeredVariables",{get:function(){return this.state.registeredVariables},enumerable:!0,configurable:!0}),re.prototype.reset=function(){for(var ce in this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new J,this.registry)this.disposeRegisteredKernels(ce),this.registry[ce].dispose(),delete this.registry[ce];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null},re.nextTensorId=0,re.nextVariableId=0,re}();i.Engine=K,i.ENGINE=function(){var re=function(){if(O==null){var pe=void 0;if(typeof window<"u")pe=window;else if(s!==void 0)pe=s;else if(h!==void 0)pe=h;else{if(typeof self>"u")throw new Error("Could not find a global object");pe=self}O=pe}return O}();if(re._tfengine==null){var ce=new A.Environment(re);re._tfengine=new K(ce)}
7729return A.setEnvironmentGlobal(re._tfengine.ENV),L.setTensorTracker(function(){return re._tfengine}),re._tfengine}()}).call(this,n(59),n(75))},function(a,i,n){var s=n(14),h=n(240),v=n(66),g=Object.defineProperty;i.f=n(27)?Object.defineProperty:function(O,A,S){if(s(O),A=v(A,!0),s(S),h)try{return g(O,A,S)}catch{}if("get"in S||"set"in S)throw TypeError("Accessors not supported!");return"value"in S&&(O[A]=S.value),O}},function(a,i,n){a.exports=!n(15)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});/** 7730 * @license 7731 * Copyright 2018 Google Inc. All Rights Reserved. 7732 * Licensed under the Apache License, Version 2.0 (the "License"); 7733 * you may not use this file except in compliance with the License. 7734 * You may obtain a copy of the License at 7735 * 7736 * http://www.apache.org/licenses/LICENSE-2.0 7737 * 7738 * Unless required by applicable law or agreed to in writing, software 7739 * distributed under the License is distributed on an "AS IS" BASIS, 7740 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7741 * See the License for the specific language governing permissions and 7742 * limitations under the License. 7743 * ============================================================================= 7744 */var s=n(25);i.op=function(h){var v=Object.keys(h);if(v.length!==1)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+v.length+" keys.");var g=v[0],O=h[g];g.endsWith("_")&&(g=g.substring(0,g.length-1));var A=function(){for(var S=[],M=0;M<arguments.length;M++)S[M]=arguments[M];s.ENGINE.startScope(g);try{var P=O.apply(void 0,S);return P instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),s.ENGINE.endScope(P),P}catch(L){throw s.ENGINE.endScope(null),L}};return Object.defineProperty(A,"name",{value:g,configurable:!0}),A}},function(a,i,n){/** 7745* @license 7746* Copyright 2018 Google LLC. All Rights Reserved. 7747* Licensed under the Apache License, Version 2.0 (the "License"); 7748* you may not use this file except in compliance with the License. 7749* You may obtain a copy of the License at 7750* 7751* http://www.apache.org/licenses/LICENSE-2.0 7752* 7753* Unless required by applicable law or agreed to in writing, software 7754* distributed under the License is distributed on an "AS IS" BASIS, 7755* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7756* See the License for the specific language governing permissions and 7757* limitations under the License. 7758* ============================================================================= 7759*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(103),v=n(33),g=n(21);function O(M,P){var L=M;if(g.isTypedArray(M))return P==="string"?[]:[M.length];if(!Array.isArray(M))return[];for(var V=[];Array.isArray(L)||g.isTypedArray(L)&&P!=="string";)V.push(L.length),L=L[0];return Array.isArray(M)&&h.env().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function N(ee,J,K){if(K=K||[],!Array.isArray(ee)&&!g.isTypedArray(ee))return void g.assert(J.length===0,function(){return"Element arr["+K.join("][")+"] is a primitive, but should be an array/TypedArray of "+J[0]+" elements"});g.assert(J.length>0,function(){return"Element arr["+K.join("][")+"] should be a primitive, but is an array of "+ee.length+" elements"}),g.assert(ee.length===J[0],function(){return"Element arr["+K.join("][")+"] should have "+J[0]+" elements, but has "+ee.length+" elements"});for(var re=J.slice(1),ce=0;ce<ee.length;++ce)N(ee[ce],re,K.concat(ce))}(M,V,[]),V}function A(M,P,L,V){if(M!=null&&(M!=="numeric"&&M!==P||M==="numeric"&&P==="string"))throw new Error("Argument '"+L+"' passed to '"+V+"' must be "+M+" tensor, but got "+P+" tensor")}function S(M,P,L,V){if(V===void 0&&(V="numeric"),M instanceof v.Tensor)return A(V,M.dtype,P,L),M;var N=g.inferDtype(M);if(N!=="string"&&["bool","int32","float32"].indexOf(V)>=0&&(N=V),A(V,N,P,L),M==null||!g.isTypedArray(M)&&!Array.isArray(M)&&typeof M!="number"&&typeof M!="boolean"&&typeof M!="string"){var ee=M==null?"null":M.constructor.name;throw new Error("Argument '"+P+"' passed to '"+L+"' must be a Tensor or TensorLike, but got '"+ee+"'")}var J=O(M,N);g.isTypedArray(M)||Array.isArray(M)||(M=[M]);
7759var K=N!=="string"?g.toTypedArray(M,N,h.env().getBool("DEBUG")):g.flatten(M,[],!0);return s.ENGINE.makeTensor(K,J,N)}i.inferShape=O,i.convertToTensor=S,i.convertToTensorArray=function(M,P,L,V){if(V===void 0&&(V="numeric"),!Array.isArray(M))throw new Error("Argument "+P+" passed to "+L+" must be a `Tensor[]` or `TensorLike[]`");return M.map(function(N,ee){return S(N,P+"["+ee+"]",L)},V)}},function(a,i,n){var s=n(254),h=n(253),v=n(187),g=n(252);a.exports=function(O){return s(O)||h(O)||v(O)||g()},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){n.d(i,"a",function(){return v});var s=new Date,h=new Date;function v(g,O,A,S){function M(P){return g(P=arguments.length===0?new Date:new Date(+P)),P}return M.floor=function(P){return g(P=new Date(+P)),P},M.ceil=function(P){return g(P=new Date(P-1)),O(P,1),g(P),P},M.round=function(P){var L=M(P),V=M.ceil(P);return P-L<V-P?L:V},M.offset=function(P,L){return O(P=new Date(+P),L==null?1:Math.floor(L)),P},M.range=function(P,L,V){var N,ee=[];if(P=M.ceil(P),V=V==null?1:Math.floor(V),!(P<L&&V>0))return ee;do ee.push(N=new Date(+P)),O(P,V),g(P);while(N<P&&P<L);return ee},M.filter=function(P){return v(function(L){if(L>=L)for(;g(L),!P(L);)L.setTime(L-1)},function(L,V){if(L>=L)if(V<0)for(;++V<=0;)for(;O(L,-1),!P(L););else for(;--V>=0;)for(;O(L,1),!P(L););})},A&&(M.count=function(P,L){return s.setTime(+P),h.setTime(+L),g(s),g(h),Math.floor(A(s,h))},M.every=function(P){return P=Math.floor(P),isFinite(P)&&P>0?P>1?M.filter(S?function(L){return S(L)%P==0}:function(L){return M.count(0,L)%P==0}):M:null}),M}},function(a,i,n){const s=n(116),{MAX_LENGTH:h,MAX_SAFE_INTEGER:v}=n(117),{re:g,t:O}=n(90),A=n(115),{compareIdentifiers:S}=n(146);class M{constructor(L,V){if(V=A(V),L instanceof M){if(L.loose===!!V.loose&&L.includePrerelease===!!V.includePrerelease)return L;L=L.version}else if(typeof L!="string")throw new TypeError(`Invalid Version: ${L}`);if(L.length>h)throw new TypeError(`version is longer than ${h} characters`);s("SemVer",L,V),this.options=V,this.loose=!!V.loose,this.includePrerelease=!!V.includePrerelease;const N=L.trim().match(V.loose?g[O.LOOSE]:g[O.FULL]);if(!N)throw new TypeError(`Invalid Version: ${L}`);if(this.raw=L,this.major=+N[1],this.minor=+N[2],this.patch=+N[3],this.major>v||this.major<0)throw new TypeError("Invalid major version");if(this.minor>v||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>v||this.patch<0)throw new TypeError("Invalid patch version");N[4]?this.prerelease=N[4].split(".").map(ee=>{if(/^[0-9]+$/.test(ee)){const J=+ee;if(J>=0&&J<v)return J}return ee}):this.prerelease=[],this.build=N[5]?N[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(L){if(s("SemVer.compare",this.version,this.options,L),!(L instanceof M)){if(typeof L=="string"&&L===this.version)return 0;L=new M(L,this.options)}return L.version===this.version?0:this.compareMain(L)||this.comparePre(L)}compareMain(L){return L instanceof M||(L=new M(L,this.options)),S(this.major,L.major)||S(this.minor,L.minor)||S(this.patch,L.patch)}comparePre(L){if(L instanceof M||(L=new M(L,this.options)),this.prerelease.length&&!L.prerelease.length)return-1;if(!this.prerelease.length&&L.prerelease.length)return 1;if(!this.prerelease.length&&!L.prerelease.length)return 0;let V=0;do{const N=this.prerelease[V],ee=L.prerelease[V];if(s("prerelease compare",V,N,ee),N===void 0&&ee===void 0)return 0;if(ee===void 0)return 1;if(N===void 0)return-1;if(N!==ee)return S(N,ee)}while(++V)}compareBuild(L){L instanceof M||(L=new M(L,this.options));let V=0;do{const N=this.build[V],ee=L.build[V];if(s("prerelease compare",V,N,ee),N===void 0&&ee===void 0)return 0;if(ee===void 0)return 1;if(N===void 0)return-1;if(N!==ee)return S(N,ee)}while(++V)}inc(L,V){switch(L){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",V);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",V);break;case"prepatch":this.prerelease.length=0,this.inc("patch",V),this.inc("pre",V);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",V),this.inc("pre",V);break;case"major":this.minor===0&&this.patch===0&&this.prerelease.length!==0||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":this.patch===0&&this.prerelease.length!==0||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{let N=this.prerelease.length;for(;--N>=0;)typeof this.prerelease[N]=="number"&&(this.prerelease[N]++,N=-2);N===-1&&this.prerelease.push(0)}V&&(this.prerelease[0]===V?isNaN(this.prerelease[1])&&(this.prerelease=[V,0]):this.prerelease=[V,0]);break;default:throw new Error(`invalid increment argument: ${L}`)}return this.format(),this.raw=this.version,this}}a.exports=M},function(a,i,n){/** 7760* @license 7761* Copyright 2017 Google Inc. All Rights Reserved. 7762* Licensed under the Apache License, Version 2.0 (the "License");
7763* you may not use this file except in compliance with the License. 7764* You may obtain a copy of the License at 7765* 7766* http://www.apache.org/licenses/LICENSE-2.0 7767* 7768* Unless required by applicable law or agreed to in writing, software 7769* distributed under the License is distributed on an "AS IS" BASIS, 7770* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7771* See the License for the specific language governing permissions and 7772* limitations under the License. 7773* ============================================================================= 7774*/var s=this&&this.__extends||function(){var ee=function(J,K){return(ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(re,ce){re.__proto__=ce}||function(re,ce){for(var pe in ce)ce.hasOwnProperty(pe)&&(re[pe]=ce[pe])})(J,K)};return function(J,K){function re(){this.constructor=J}ee(J,K),J.prototype=K===null?Object.create(K):(re.prototype=K.prototype,new re)}}(),h=this&&this.__awaiter||function(ee,J,K,re){return new(K||(K=Promise))(function(ce,pe){function ke($e){try{be(re.next($e))}catch(ht){pe(ht)}}function Ce($e){try{be(re.throw($e))}catch(ht){pe(ht)}}function be($e){$e.done?ce($e.value):new K(function(ht){ht($e.value)}).then(ke,Ce)}be((re=re.apply(ee,J||[])).next())})},v=this&&this.__generator||function(ee,J){var K,re,ce,pe,ke={label:0,sent:function(){if(1&ce[0])throw ce[1];return ce[1]},trys:[],ops:[]};return pe={next:Ce(0),throw:Ce(1),return:Ce(2)},typeof Symbol=="function"&&(pe[Symbol.iterator]=function(){return this}),pe;function Ce(be){return function($e){return function(ht){if(K)throw new TypeError("Generator is already executing.");for(;ke;)try{if(K=1,re&&(ce=2&ht[0]?re.return:ht[0]?re.throw||((ce=re.return)&&ce.call(re),0):re.next)&&!(ce=ce.call(re,ht[1])).done)return ce;switch(re=0,ce&&(ht=[2&ht[0],ce.value]),ht[0]){case 0:case 1:ce=ht;break;case 4:return ke.label++,{value:ht[1],done:!1};case 5:ke.label++,re=ht[1],ht=[0];continue;case 7:ht=ke.ops.pop(),ke.trys.pop();continue;default:if(!(ce=(ce=ke.trys).length>0&&ce[ce.length-1])&&(ht[0]===6||ht[0]===2)){ke=0;continue}if(ht[0]===3&&(!ce||ht[1]>ce[0]&&ht[1]<ce[3])){ke.label=ht[1];break}if(ht[0]===6&&ke.label<ce[1]){ke.label=ce[1],ce=ht;break}if(ce&&ke.label<ce[2]){ke.label=ce[2],ke.ops.push(ht);break}ce[2]&&ke.ops.pop(),ke.trys.pop();continue}ht=J.call(ee,ke)}catch(Dt){ht=[6,Dt],re=0}finally{K=ce=0}if(5&ht[0])throw ht[1];return{value:ht[0]?ht[1]:void 0,done:!0}}([be,$e])}}};Object.defineProperty(i,"__esModule",{value:!0});var g=n(379),O=n(21),A=n(21),S=function(){function ee(J,K,re){var ce=this;if(this.dtype=K,this.shape=J.slice(),this.size=O.sizeFromShape(J),re!=null){var pe=re.length;O.assert(pe===this.size,function(){return"Length of values '"+pe+"' does not match the size inferred by the shape '"+ce.size+"'."})}if(K==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=re||O.getArrayFromDType(K,this.size),this.strides=A.computeStrides(J)}return ee.prototype.set=function(J){for(var K=this,re=[],ce=1;ce<arguments.length;ce++)re[ce-1]=arguments[ce];re.length===0&&(re=[0]),O.assert(re.length===this.rank,function(){return"The number of provided coordinates ("+re.length+") must match the rank ("+K.rank+")"});var pe=this.locToIndex(re);this.values[pe]=J},ee.prototype.get=function(){for(var J=[],K=0;K<arguments.length;K++)J[K]=arguments[K];J.length===0&&(J=[0]);for(var re=0,ce=0,pe=J;ce<pe.length;ce++){var ke=pe[ce];if(ke<0||ke>=this.shape[re]){var Ce="Requested out of range element at "+J+". Buffer shape="+this.shape;throw new Error(Ce)}re++}for(var be=J[J.length-1],$e=0;$e<J.length-1;++$e)be+=this.strides[$e]*J[$e];return this.values[be]},ee.prototype.locToIndex=function(J){if(this.rank===0)return 0;if(this.rank===1)return J[0];for(var K=J[J.length-1],re=0;re<J.length-1;++re)K+=this.strides[re]*J[re];return K},ee.prototype.indexToLoc=function(J){if(this.rank===0)return[];if(this.rank===1)return[J];for(var K=new Array(this.shape.length),re=0;re<K.length-1;++re)K[re]=Math.floor(J/this.strides[re]),J-=K[re]*this.strides[re];return K[K.length-1]=J,K},Object.defineProperty(ee.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),ee.prototype.toTensor=function(){return M().makeTensor(this.values,this.shape,this.dtype)},ee}();i.TensorBuffer=S;var M=null,P=null,L=null;i.setTensorTracker=function(ee){M=ee},i.setOpHandler=function(ee){P=ee},i.setDeprecationWarningFn=function(ee){L=ee};var V=function(){function ee(J,K,re,ce){this.kept=!1,this.isDisposedInternal=!1,this.shape=J.slice(),this.dtype=K||"float32",this.size=O.sizeFromShape(J),this.strides=A.computeStrides(J),this.dataId=re,this.id=ce,this.rankType=this.rank<5?this.rank.toString():"higher"}return ee.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},ee.prototype.asScalar=function(){return this.throwIfDisposed(),O.assert(this.size===1,function(){return"The array must have only 1 element."}),this.reshape([])},ee.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},ee.prototype.as2D=function(J,K){return this.throwIfDisposed(),this.reshape([J,K])},ee.prototype.as3D=function(J,K,re){return this.throwIfDisposed(),this.reshape([J,K,re])},ee.prototype.as4D=function(J,K,re,ce){return this.throwIfDisposed(),this.reshape([J,K,re,ce])},ee.prototype.as5D=function(J,K,re,ce,pe){return this.throwIfDisposed(),this.reshape([J,K,re,ce,pe])},ee.prototype.asType=function(J){return this.throwIfDisposed(),P.cast(this,J)},Object.defineProperty(ee.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),ee.prototype.buffer=function(){return h(this,void 0,void 0,function(){var J;return v(this,function(K){switch(K.label){case 0:return[4,this.data()];case 1:return J=K.sent(),[2,P.buffer(this.shape,this.dtype,J)]}})})},ee.prototype.bufferSync=function(){return P.buffer(this.shape,this.dtype,this.dataSync())},ee.prototype.array=function(){return h(this,void 0,void 0,function(){var J;return v(this,function(K){switch(K.label){case 0:return[4,this.data()];case 1:return J=K.sent(),[2,A.toNestedArray(this.shape,J)]}})})},ee.prototype.arraySync=function(){return A.toNestedArray(this.shape,this.dataSync())},ee.prototype.data=function(){return h(this,void 0,void 0,function(){var J,K;return v(this,function(re){switch(re.label){case 0:return this.throwIfDisposed(),J=M().read(this.dataId),this.dtype!=="string"?[3,2]:[4,J];case 1:K=re.sent();try{return[2,K.map(function(ce){return O.decodeString(ce)})]}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}re.label=2;case 2:return[2,J]}})})},ee.prototype.dataSync=function(){this.throwIfDisposed();var J=M().readSync(this.dataId);if(this.dtype==="string")try{return J.map(function(K){return O.decodeString(K)})}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return J},ee.prototype.bytes=function(){return h(this,void 0,void 0,function(){var J;return v(this,function(K){switch(K.label){case 0:return this.throwIfDisposed(),[4,M().read(this.dataId)];case 1:return J=K.sent(),this.dtype==="string"?[2,J]:[2,new Uint8Array(J.buffer)]}})})},ee.prototype.dispose=function(){this.isDisposed||(M().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(ee.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),ee.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},ee.prototype.toFloat=function(){return this.asType("float32")},ee.prototype.toInt=function(){return this.asType("int32")},ee.prototype.toBool=function(){return this.asType("bool")},ee.prototype.print=function(J){return J===void 0&&(J=!1),P.print(this,J)},ee.prototype.reshape=function(J){return this.throwIfDisposed(),P.reshape(this,J)},ee.prototype.reshapeAs=function(J){return this.throwIfDisposed(),this.reshape(J.shape)},ee.prototype.expandDims=function(J){return J===void 0&&(J=0),P.expandDims(this,J)},ee.prototype.cumsum=function(J,K,re){return J===void 0&&(J=0),K===void 0&&(K=!1),re===void 0&&(re=!1),P.cumsum(this,J,K,re)},ee.prototype.squeeze=function(J){return this.throwIfDisposed(),P.squeeze(this,J)},ee.prototype.clone=function(){return this.throwIfDisposed(),P.clone(this)},ee.prototype.toString=function(J){J===void 0&&(J=!1);var K=this.dataSync();return g.tensorToString(K,this.shape,this.dtype,J)},ee.prototype.gather=function(J,K){return K===void 0&&(K=0),this.throwIfDisposed(),P.gather(this,J,K)},ee.prototype.matMul=function(J,K,re){return K===void 0&&(K=!1),re===void 0&&(re=!1),this.throwIfDisposed(),P.matMul(this,J,K,re)},ee.prototype.dot=function(J){return this.throwIfDisposed(),P.dot(this,J)},ee.prototype.norm=function(J,K,re){return J===void 0&&(J="euclidean"),K===void 0&&(K=null),re===void 0&&(re=!1),this.throwIfDisposed(),P.norm(this,J,K,re)},ee.prototype.slice=function(J,K){return this.throwIfDisposed(),P.slice(this,J,K)},ee.prototype.reverse=function(J){return this.throwIfDisposed(),P.reverse(this,J)},ee.prototype.concat=function(J,K){return K===void 0&&(K=0),this.throwIfDisposed(),J instanceof ee&&(J=[J]),P.concat([this].concat(J),K)},ee.prototype.split=function(J,K){return K===void 0&&(K=0),this.throwIfDisposed(),P.split(this,J,K)},ee.prototype.stack=function(J,K){return K===void 0&&(K=0),P.stack([this,J],K)},ee.prototype.unstack=function(J){return J===void 0&&(J=0),P.unstack(this,J)},ee.prototype.batchNormalization=function(J,K,re,ce,pe){return re===void 0&&(re=.001),L("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(J,K,pe,ce,re)},ee.prototype.all=function(J,K){return J===void 0&&(J=null),K===void 0&&(K=!1),this.throwIfDisposed(),P.all
vendor: 11,266 bytes, line 7774
7774(this,J,K)},ee.prototype.any=function(J,K){return J===void 0&&(J=null),K===void 0&&(K=!1),this.throwIfDisposed(),P.any(this,J,K)},ee.prototype.logSumExp=function(J,K){return J===void 0&&(J=null),K===void 0&&(K=!1),this.throwIfDisposed(),P.logSumExp(this,J,K)},ee.prototype.sum=function(J,K){return J===void 0&&(J=null),K===void 0&&(K=!1),this.throwIfDisposed(),P.sum(this,J,K)},ee.prototype.prod=function(J,K){return J===void 0&&(J=null),K===void 0&&(K=!1),this.throwIfDisposed(),P.prod(this,J,K)},ee.prototype.mean=function(J,K){return J===void 0&&(J=null),K===void 0&&(K=!1),this.throwIfDisposed(),P.mean(this,J,K)},ee.prototype.min=function(J,K){return J===void 0&&(J=null),K===void 0&&(K=!1),this.throwIfDisposed(),P.min(this,J,K)},ee.prototype.max=function(J,K){return J===void 0&&(J=null),K===void 0&&(K=!1),this.throwIfDisposed(),P.max(this,J,K)},ee.prototype.argMin=function(J){return J===void 0&&(J=null),this.throwIfDisposed(),P.argMin(this,J)},ee.prototype.argMax=function(J){return J===void 0&&(J=null),this.throwIfDisposed(),P.argMax(this,J)},ee.prototype.cast=function(J){return this.throwIfDisposed(),P.cast(this,J)},ee.prototype.addStrict=function(J){return this.throwIfDisposed(),P.addStrict(this,J)},ee.prototype.atan2=function(J){return this.throwIfDisposed(),P.atan2(this,J)},ee.prototype.sub=function(J){return this.throwIfDisposed(),P.sub(this,J)},ee.prototype.subStrict=function(J){return this.throwIfDisposed(),P.subStrict(this,J)},ee.prototype.pow=function(J){return this.throwIfDisposed(),P.pow(this,J)},ee.prototype.powStrict=function(J){return this.throwIfDisposed(),P.powStrict(this,J)},ee.prototype.mul=function(J){return this.throwIfDisposed(),P.mul(this,J)},ee.prototype.mulStrict=function(J){return this.throwIfDisposed(),P.mulStrict(this,J)},ee.prototype.floorDiv=function(J){return this.throwIfDisposed(),P.floorDiv(this,J)},ee.prototype.divStrict=function(J){return this.throwIfDisposed(),P.divStrict(this,J)},ee.prototype.minimum=function(J){return this.throwIfDisposed(),P.minimum(this,J)},ee.prototype.minimumStrict=function(J){return this.throwIfDisposed(),P.minimumStrict(this,J)},ee.prototype.maximum=function(J){return this.throwIfDisposed(),P.maximum(this,J)},ee.prototype.maximumStrict=function(J){return this.throwIfDisposed(),P.maximumStrict(this,J)},ee.prototype.mod=function(J){return this.throwIfDisposed(),P.mod(this,J)},ee.prototype.modStrict=function(J){return this.throwIfDisposed(),P.modStrict(this,J)},ee.prototype.squaredDifferenceStrict=function(J){return this.throwIfDisposed(),P.squaredDifferenceStrict(this,J)},ee.prototype.notEqual=function(J){return this.throwIfDisposed(),P.notEqual(this,J)},ee.prototype.notEqualStrict=function(J){return this.throwIfDisposed(),P.notEqualStrict(this,J)},ee.prototype.less=function(J){return this.throwIfDisposed(),P.less(this,J)},ee.prototype.lessStrict=function(J){return this.throwIfDisposed(),P.lessStrict(this,J)},ee.prototype.equal=function(J){return this.throwIfDisposed(),P.equal(this,J)},ee.prototype.equalStrict=function(J){return this.throwIfDisposed(),P.equalStrict(this,J)},ee.prototype.lessEqual=function(J){return this.throwIfDisposed(),P.lessEqual(this,J)},ee.prototype.lessEqualStrict=function(J){return this.throwIfDisposed(),P.lessEqualStrict(this,J)},ee.prototype.greater=function(J){return this.throwIfDisposed(),P.greater(this,J)},ee.prototype.greaterStrict=function(J){return this.throwIfDisposed(),P.greaterStrict(this,J)},ee.prototype.greaterEqual=function(J){return this.throwIfDisposed(),P.greaterEqual(this,J)},ee.prototype.greaterEqualStrict=function(J){return this.throwIfDisposed(),P.greaterEqualStrict(this,J)},ee.prototype.logicalAnd=function(J){return this.throwIfDisposed(),P.logicalAnd(this,J)},ee.prototype.logicalOr=function(J){return this.throwIfDisposed(),P.logicalOr(this,J)},ee.prototype.logicalNot=function(){return this.throwIfDisposed(),P.logicalNot(this)},ee.prototype.logicalXor=function(J){return this.throwIfDisposed(),P.logicalXor(this,J)},ee.prototype.where=function(J,K){return this.throwIfDisposed(),P.where(J,this,K)},ee.prototype.neg=function(){return this.throwIfDisposed(),P.neg(this)},ee.prototype.ceil=function(){return this.throwIfDisposed(),P.ceil(this)},ee.prototype.floor=function(){return this.throwIfDisposed(),P.floor(this)},ee.prototype.sign=function(){return this.throwIfDisposed(),P.sign(this)},ee.prototype.isNaN=function(){return this.throwIfDisposed(),P.isNaN(this)},ee.prototype.isInf=function(){return this.throwIfDisposed(),P.isInf(this)},ee.prototype.isFinite=function(){return this.throwIfDisposed(),P.isFinite(this)},ee.prototype.exp=function(){return this.throwIfDisposed(),P.exp(this)},ee.prototype.expm1=function(){return this.throwIfDisposed(),P.expm1(this)},ee.prototype.log=function(){return this.throwIfDisposed(),P.log(this)},ee.prototype.log1p=function(){return this.throwIfDisposed(),P.log1p(this)},ee.prototype.sqrt=function(){return this.throwIfDisposed(),P.sqrt(this)},ee.prototype.rsqrt=function(){return this.throwIfDisposed(),P.rsqrt(this)},ee.prototype.square=function(){return this.throwIfDisposed(),P.square(this)},ee.prototype.reciprocal=function(){return this.throwIfDisposed(),P.reciprocal(this)},ee.prototype.abs=function(){return this.throwIfDisposed(),P.abs(this)},ee.prototype.clipByValue=function(J,K){return this.throwIfDisposed(),P.clipByValue(this,J,K)},ee.prototype.relu=function(){return this.throwIfDisposed(),P.relu(this)},ee.prototype.relu6=function(){return this.throwIfDisposed(),P.relu6(this)},ee.prototype.elu=function(){return this.throwIfDisposed(),P.elu(this)},ee.prototype.selu=function(){return this.throwIfDisposed(),P.selu(this)},ee.prototype.leakyRelu=function(J){return J===void 0&&(J=.2),this.throwIfDisposed(),P.leakyRelu(this,J)},ee.prototype.prelu=function(J){return this.throwIfDisposed(),P.prelu(this,J)},ee.prototype.sigmoid=function(){return this.throwIfDisposed(),P.sigmoid(this)},ee.prototype.logSigmoid=function(){return this.throwIfDisposed(),P.logSigmoid(this)},ee.prototype.softplus=function(){return this.throwIfDisposed(),P.softplus(this)},ee.prototype.zerosLike=function(){return this.throwIfDisposed(),P.zerosLike(this)},ee.prototype.onesLike=function(){return this.throwIfDisposed(),P.onesLike(this)},ee.prototype.sin=function(){return this.throwIfDisposed(),P.sin(this)},ee.prototype.cos=function(){return this.throwIfDisposed(),P.cos(this)},ee.prototype.tan=function(){return this.throwIfDisposed(),P.tan(this)},ee.prototype.asin=function(){return this.throwIfDisposed(),P.asin(this)},ee.prototype.acos=function(){return this.throwIfDisposed(),P.acos(this)},ee.prototype.atan=function(){return this.throwIfDisposed(),P.atan(this)},ee.prototype.sinh=function(){return this.throwIfDisposed(),P.sinh(this)},ee.prototype.cosh=function(){return this.throwIfDisposed(),P.cosh(this)},ee.prototype.tanh=function(){return this.throwIfDisposed(),P.tanh(this)},ee.prototype.asinh=function(){return this.throwIfDisposed(),P.asinh(this)},ee.prototype.acosh=function(){return this.throwIfDisposed(),P.acosh(this)},ee.prototype.atanh=function(){return this.throwIfDisposed(),P.atanh(this)},ee.prototype.erf=function(){return this.throwIfDisposed(),P.erf(this)},ee.prototype.round=function(){return this.throwIfDisposed(),P.round(this)},ee.prototype.step=function(J){return J===void 0&&(J=0),this.throwIfDisposed(),P.step(this,J)},ee.prototype.softmax=function(J){return J===void 0&&(J=-1),this.throwIfDisposed(),P.softmax(this,J)},ee.prototype.logSoftmax=function(J){return J===void 0&&(J=-1),this.throwIfDisposed(),P.logSoftmax(this,J)},ee.prototype.resizeBilinear=function(J,K){return K===void 0&&(K=!1),this.throwIfDisposed(),P.image.resizeBilinear(this,J,K)},ee.prototype.resizeNearestNeighbor=function(J,K){return K===void 0&&(K=!1),this.throwIfDisposed(),P.image.resizeNearestNeighbor(this,J,K)},ee.prototype.conv1d=function(J,K,re,ce,pe,ke){return ce===void 0&&(ce="NWC"),pe===void 0&&(pe=1),this.throwIfDisposed(),P.conv1d(this,J,K,re,ce,pe,ke)},ee.prototype.conv2d=function(J,K,re,ce,pe,ke){return ce===void 0&&(ce="NHWC"),pe===void 0&&(pe=[1,1]),this.throwIfDisposed(),P.conv2d(this,J,K,re,ce,pe,ke)},ee.prototype.conv2dTranspose=function(J,K,re,ce,pe){return this.throwIfDisposed(),P.conv2dTranspose(this,J,K,re,ce,pe)},ee.prototype.depthwiseConv2D=function(J,K,re,ce,pe,ke){return ce===void 0&&(ce="NHWC"),pe===void 0&&(pe=[1,1]),this.throwIfDisposed(),P.depthwiseConv2d(this,J,K,re,ce,pe,ke)},ee.prototype.separableConv2d=function(J,K,re,ce,pe,ke){return pe===void 0&&(pe=[1,1]),ke===void 0&&(ke="NHWC"),this.throwIfDisposed(),P.separableConv2d(this,J,K,re,ce,pe,ke)},ee.prototype.avgPool=function(J,K,re,ce){return this.throwIfDisposed(),P.avgPool(this,J,K,re,ce)},ee.prototype.maxPool=function(J,K,re,ce){return this.throwIfDisposed(),P.maxPool(this,J,K,re,ce)},ee.prototype.localResponseNormalization=function(J,K,re,ce){return J===void 0&&(J=5),K===void 0&&(K=1),re===void 0&&(re=1),ce===void 0&&(ce=.5),P.localResponseNormalization(this,J,K,re,ce)},ee.prototype.pool=function(J,K,re,ce,pe){return this.throwIfDisposed(),P.pool(this,J,K,re,ce,pe)},ee.prototype.variable=function(J,K,re){return J===void 0&&(J=!0),this.throwIfDisposed(),M().makeVariable(this,J,K,re)},ee.prototype.unsortedSegmentSum=function(J,K){return this.throwIfDisposed(),P.unsortedSegmentSum(this,J,K)},ee.prototype.batchToSpaceND=function(J,K){return this.throwIfDisposed(),P.batchToSpaceND(this,J,K)},ee.prototype.spaceToBatchND=function(J,K){return this.throwIfDisposed(),P.spaceToBatchND(this,J,K)},ee.prototype.topk=function(J,K){return J===void 0&&(J=1),K===void 0&&(K=!0),this.throwIfDisposed(),P.topk(this,J,K)},ee.prototype.stridedSlice=function(J,K,re,ce,pe,ke,Ce,be){return ce===void 0&&(ce=0),pe===void 0&&(pe=0),ke===void 0&&(ke=0),Ce===void 0&&(Ce=0),be===void 0&&(be=0),this.throwIfDisposed(),P.stridedSlice(this,J,K,re,ce,pe,ke,Ce,be)},ee.prototype.depthToSpace=function(J,K){return this.throwIfDisposed(),P.depthToSpace(this,J,K)},ee.prototype.fft=function(){return this.throwIfDisposed(),P.spectral.fft(this)},ee.prototype.ifft=function(){return this.throwIfDisposed(),P.spectral.ifft(this)},ee.prototype.rfft=function(){return this.throwIfDisposed(),P.spectral.rfft(this)},ee.prototype.irfft=function(){return this.throwIfDisposed(),P.spectral.irfft(this)},ee}();i.Tensor=V,Object.defineProperty(V,Symbol.hasInstance,{value:function(ee){return!!ee&&ee.dataId!=null&&ee.shape!=null&&ee.dtype!=null}});var N=function(ee){function J(K,re,ce,pe){var ke=ee.call(this,K.shape,K.dtype,K.dataId,pe)||this;return ke.trainable=re,ke.name=ce,ke}return s(J,ee),J.prototype.assign=function(K){if(K.dtype!==this.dtype)throw new Error("dtype of the new value ("+K.dtype+") and previous value ("+this.dtype+") must match");if(!O.arraysEqual(K.shape,this.shape))throw new Error("shape of the new value ("+K.shape+") and previous value ("+this.shape+") must match");M().disposeTensor(this),this.dataId=K.dataId,M().incRef(this,null)},J.prototype.dispose=function(){M().disposeVariable(this),this.isDisposedInternal=!0},J}(V);i.Variable=N,Object.defineProperty(N,Symbol.hasInstance,{value:function(ee){return ee instanceof V&&ee.assign!=null&&ee.assign instanceof Function}})},function(a,i,n){var s=n(61);a.exports=function(h){return Object(s(h))}}
7774,function(a,i){function n(s){return a.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(h){return h.__proto__||Object.getPrototypeOf(h)},a.exports.__esModule=!0,a.exports.default=a.exports,n(s)}a.exports=n,a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){var s=n(195),h=Object.prototype.toString;function v(P){return h.call(P)==="[object Array]"}function g(P){return P===void 0}function O(P){return P!==null&&typeof P=="object"}function A(P){if(h.call(P)!=="[object Object]")return!1;var L=Object.getPrototypeOf(P);return L===null||L===Object.prototype}function S(P){return h.call(P)==="[object Function]"}function M(P,L){if(P!=null)if(typeof P!="object"&&(P=[P]),v(P))for(var V=0,N=P.length;V<N;V++)L.call(null,P[V],V,P);else for(var ee in P)Object.prototype.hasOwnProperty.call(P,ee)&&L.call(null,P[ee],ee,P)}a.exports={isArray:v,isArrayBuffer:function(P){return h.call(P)==="[object ArrayBuffer]"},isBuffer:function(P){return P!==null&&!g(P)&&P.constructor!==null&&!g(P.constructor)&&typeof P.constructor.isBuffer=="function"&&P.constructor.isBuffer(P)},isFormData:function(P){return typeof FormData<"u"&&P instanceof FormData},isArrayBufferView:function(P){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(P):P&&P.buffer&&P.buffer instanceof ArrayBuffer},isString:function(P){return typeof P=="string"},isNumber:function(P){return typeof P=="number"},isObject:O,isPlainObject:A,isUndefined:g,isDate:function(P){return h.call(P)==="[object Date]"},isFile:function(P){return h.call(P)==="[object File]"},isBlob:function(P){return h.call(P)==="[object Blob]"},isFunction:S,isStream:function(P){return O(P)&&S(P.pipe)},isURLSearchParams:function(P){return typeof URLSearchParams<"u"&&P instanceof URLSearchParams},isStandardBrowserEnv:function(){return(typeof navigator>"u"||navigator.product!=="ReactNative"&&navigator.product!=="NativeScript"&&navigator.product!=="NS")&&typeof window<"u"&&typeof document<"u"},forEach:M,merge:function P(){var L={};function V(J,K){A(L[K])&&A(J)?L[K]=P(L[K],J):A(J)?L[K]=P({},J):v(J)?L[K]=J.slice():L[K]=J}for(var N=0,ee=arguments.length;N<ee;N++)M(arguments[N],V);return L},extend:function(P,L,V){return M(L,function(N,ee){P[ee]=V&&typeof N=="function"?s(N,V):N}),P},trim:function(P){return P.trim?P.trim():P.replace(/^\s+|\s+$/g,"")},stripBOM:function(P){return P.charCodeAt(0)===65279&&(P=P.slice(1)),P}}},function(a,i,n){var s=n(8),h=n(15),v=n(61),g=/"/g,O=function(A,S,M,P){var L=String(v(A)),V="<"+S;return M!==""&&(V+=" "+M+'="'+String(P).replace(g,""")+'"'),V+">"+L+"</"+S+">"};a.exports=function(A,S){var M={};M[A]=S(O),s(s.P+s.F*h(function(){var P=""[A]('"');return P!==P.toLowerCase()||P.split('"').length>3}),"String",M)}},function(a,i,n){var s=n(16),h=n(42),v=n(43),g=n(84)("src"),O=n(576),A=(""+O).split("toString");n(24).inspectSource=function(S){return O.call(S)},(a.exports=function(S,M,P,L){var V=typeof P=="function";V&&(v(P,"name")||h(P,"name",M)),S[M]!==P&&(V&&(v(P,g)||h(P,g,S[M]?""+S[M]:A.join(String(M)))),S===s?S[M]=P:L?S[M]?S[M]=P:h(S,M,P):(delete S[M],h(S,M,P)))})(Function.prototype,"toString",function(){return typeof this=="function"&&this[g]||O.call(this)})},function(a,i,n){n.d(i,"b",function(){return g}),n.d(i,"a",function(){return O}),n.d(i,"c",function(){return M});var s=n(31),h=n(12);function v(V){return Object(s.a)(function(N){N.setUTCDate(N.getUTCDate()-(N.getUTCDay()+7-V)%7),N.setUTCHours(0,0,0,0)},function(N,ee){N.setUTCDate(N.getUTCDate()+7*ee)},function(N,ee){return(ee-N)/h.f})}var g=v(0),O=v(1),A=v(2),S=v(3),M=v(4),P=v(5),L=v(6);g.range,O.range,A.range,S.range,M.range,P.range,L.range},function(a,i,n){n.d(i,"b",function(){return g}),n.d(i,"a",function(){return O}),n.d(i,"c",function(){return M});var s=n(31),h=n(12);function v(V){return Object(s.a)(function(N){N.setDate(N.getDate()-(N.getDay()+7-V)%7),N.setHours(0,0,0,0)},function(N,ee){N.setDate(N.getDate()+7*ee)},function(N,ee){return(ee-N-(ee.getTimezoneOffset()-N.getTimezoneOffset())*h.c)/h.f})}var g=v(0),O=v(1),A=v(2),S=v(3),M=v(4),P=v(5),L=v(6);g.range,O.range,A.range,S.range,M.range,P.range,L.range},function(a,i,n){var s=n(107),h=n(61);a.exports=function(v){return s(h(v))}},function(a,i,n){var s=n(26),h=n(85);a.exports=n(27)?function(v,g,O){return s.f(v,g,h(1,O))}:function(v,g,O){return v[g]=O,v}},function(a,i){var n={}.hasOwnProperty;a.exports=function(s,h){return n.call(s,h)}},function(a,i,n){var s=n(45),h=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function v(Yt){if(!(We=h.exec(Yt)))throw new Error("invalid format: "+Yt);var We;return new g({fill:We[1],align:We[2],sign:We[3],symbol:We[4],zero:We[5],width:We[6],comma:We[7],precision:We[8]&&We[8].slice(1),trim:We[9],type:We[10]})}function g(Yt){this.fill=Yt.fill===void 0?" ":Yt.fill+"",this.align=Yt.align===void 0?">":Yt.align+"",this.sign=Yt.sign===void 0?"-":Yt.sign+"",this.symbol=Yt.symbol===void 0?"":Yt.symbol+"",this.zero=!!Yt.zero,this.width=Yt.width===void 0?void 0:+Yt.width,this.comma=!!Yt.comma,this.precision=Yt.precision===void 0?void 0:+Yt.precision,this.trim=!!Yt.trim,this.type=Yt.type===void 0?"":Yt.type+""}v.prototype=g.prototype,g.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,0|this.width))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};function O(Yt,We){if((Ye=(Yt=We?Yt.toExponential(We-1):Yt.toExponential()).indexOf("e"))<0)return null;var Ye,He=Yt.slice(0,Ye);return[He.length>1?He[0]+He.slice(2):He,+Yt.slice(Ye+1)]}var A,S,M,P,L=function(Yt){return(Yt=O(Math.abs(Yt)))?Yt[1]:NaN},V=function(Yt,We){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(L(We)/3)))-L(Math.abs(Yt)))},N=function(Yt,We){return Yt=Math.abs(Yt),We=Math.abs(We)-Yt,Math.max(0,L(We)-L(Yt))+1},ee=function(Yt){return Math.max(0,-L(Math.abs(Yt)))},J=function(Yt){e:for(var We,Ye=Yt.length,He=1,dt=-1;He<Ye;++He)switch(Yt[He]){case".":dt=We=He;break;case"0":dt===0&&(dt=He),We=He;break;default:if(!+Yt[He])break e;dt>
77740&&(dt=0)}return dt>0?Yt.slice(0,dt)+Yt.slice(We+1):Yt},K=function(Yt,We){var Ye=O(Yt,We);if(!Ye)return Yt+"";var He=Ye[0],dt=Ye[1];return dt<0?"0."+new Array(-dt).join("0")+He:He.length>dt+1?He.slice(0,dt+1)+"."+He.slice(dt+1):He+new Array(dt-He.length+2).join("0")},re={"%":(Yt,We)=>(100*Yt).toFixed(We),b:Yt=>Math.round(Yt).toString(2),c:Yt=>Yt+"",d:function(Yt){return Math.abs(Yt=Math.round(Yt))>=1e21?Yt.toLocaleString("en").replace(/,/g,""):Yt.toString(10)},e:(Yt,We)=>Yt.toExponential(We),f:(Yt,We)=>Yt.toFixed(We),g:(Yt,We)=>Yt.toPrecision(We),o:Yt=>Math.round(Yt).toString(8),p:(Yt,We)=>K(100*Yt,We),r:K,s:function(Yt,We){var Ye=O(Yt,We);if(!Ye)return Yt+"";var He=Ye[0],dt=Ye[1],It=dt-(A=3*Math.max(-8,Math.min(8,Math.floor(dt/3))))+1,ct=He.length;return It===ct?He:It>ct?He+new Array(It-ct+1).join("0"):It>0?He.slice(0,It)+"."+He.slice(It):"0."+new Array(1-It).join("0")+O(Yt,Math.max(0,We+It-1))[0]},X:Yt=>Math.round(Yt).toString(16).toUpperCase(),x:Yt=>Math.round(Yt).toString(16)},ce=function(Yt){return Yt},pe=Array.prototype.map,ke=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Ce=function(Yt){var We=Yt.grouping===void 0||Yt.thousands===void 0?ce:function(xe,jn){return function(nr,ar){for(var cr=nr.length,Er=[],hn=0,rn=xe[0],fn=0;cr>0&&rn>0&&(fn+rn+1>ar&&(rn=Math.max(1,ar-fn)),Er.push(nr.substring(cr-=rn,cr+rn)),!((fn+=rn+1)>ar));)rn=xe[hn=(hn+1)%xe.length];return Er.reverse().join(jn)}}(pe.call(Yt.grouping,Number),Yt.thousands+""),Ye=Yt.currency===void 0?"":Yt.currency[0]+"",He=Yt.currency===void 0?"":Yt.currency[1]+"",dt=Yt.decimal===void 0?".":Yt.decimal+"",It=Yt.numerals===void 0?ce:function(xe){return function(jn){return jn.replace(/[0-9]/g,function(nr){return xe[+nr]})}}(pe.call(Yt.numerals,String)),ct=Yt.percent===void 0?"%":Yt.percent+"",on=Yt.minus===void 0?"â":Yt.minus+"",Xt=Yt.nan===void 0?"NaN":Yt.nan+"";function En(xe){var jn=(xe=v(xe)).fill,nr=xe.align,ar=xe.sign,cr=xe.symbol,Er=xe.zero,hn=xe.width,rn=xe.comma,fn=xe.precision,Xn=xe.trim,Fn=xe.type;Fn==="n"?(rn=!0,Fn="g"):re[Fn]||(fn===void 0&&(fn=12),Xn=!0,Fn="g"),(Er||jn==="0"&&nr==="=")&&(Er=!0,jn="0",nr="=");var Ar=cr==="$"?Ye:cr==="#"&&/[boxX]/.test(Fn)?"0"+Fn.toLowerCase():"",Dr=cr==="$"?He:/[%p]/.test(Fn)?ct:"",xr=re[Fn],fi=/[defgprs%]/.test(Fn);function ci(qr){var mi,Ir,ti,ri=Ar,yi=Dr;if(Fn==="c")yi=xr(qr)+yi,qr="";
7774else{var na=(qr=+qr)<0||1/qr<0;if(qr=isNaN(qr)?Xt:xr(Math.abs(qr),fn),Xn&&(qr=J(qr)),na&&+qr==0&&ar!=="+"&&(na=!1),ri=(na?ar==="("?ar:on:ar==="-"||ar==="("?"":ar)+ri,yi=(Fn==="s"?ke[8+A/3]:"")+yi+(na&&ar==="("?")":""),fi){for(mi=-1,Ir=qr.length;++mi<Ir;)if(48>(ti=qr.charCodeAt(mi))||ti>57){yi=(ti===46?dt+qr.slice(mi+1):qr.slice(mi))+yi,qr=qr.slice(0,mi);break}}}rn&&!Er&&(qr=We(qr,1/0));var co=ri.length+qr.length+yi.length,$i=co<hn?new Array(hn-co+1).join(jn):"";switch(rn&&Er&&(qr=We($i+qr,$i.length?hn-yi.length:1/0),$i=""),nr){case"<":qr=ri+qr+yi+$i;break;case"=":qr=ri+$i+qr+yi;break;case"^":qr=$i.slice(0,co=$i.length>>1)+ri+qr+yi+$i.slice(co);break;default:qr=$i+ri+qr+yi}return It(qr)}return fn=fn===void 0?6:/[gprs]/.test(Fn)?Math.max(1,Math.min(21,fn)):Math.max(0,Math.min(20,fn)),ci.toString=function(){return xe+""},ci}return{format:En,formatPrefix:function(xe,jn){var nr=En(((xe=v(xe)).type="f",xe)),ar=3*Math.max(-8,Math.min(8,Math.floor(L(jn)/3))),cr=Math.pow(10,-ar),Er=ke[8+ar/3];return function(hn){return nr(cr*hn)+Er}}}};(function(Yt){S=Ce(Yt),M=S.format,P=S.formatPrefix})({thousands:",",grouping:[3],currency:["$",""]});var be=n(11),$e=n(1),ht=n(100),Dt=n(246);function Ut(Yt){const We={};return Ye=>We[Ye]||(We[Ye]=Yt(Ye))}function Ee(Yt){const We=Ut(Yt.format),Ye=Yt.formatPrefix;return{format:We,formatPrefix:Ye,formatFloat(He){const dt=v(He||",");if(dt.precision==null){switch(dt.precision=12,dt.type){case"%":dt.precision-=2;break;case"e":dt.precision-=1}return function(It,ct){return on=>{const Xt=It(on),En=Xt.indexOf(ct);if(En<0)return Xt;let xe=function(nr,ar){let cr,Er=nr.lastIndexOf("e");if(Er>0)return Er;for(Er=nr.length;--Er>ar;)if((cr=nr.charCodeAt(Er))>=48&&cr<=57)return Er+1}(Xt,En);const jn=xe<Xt.length?Xt.slice(xe):"";for(;--xe>En;)if(Xt[xe]!=="0"){++xe;break}return Xt.slice(0,xe)+jn}}(We(dt),We(".1f")(1)[1])}return We(dt)},formatSpan(He,dt,It,ct){ct=v(ct??",f");const on=Object(s.c)(He,dt,It),Xt=Math.max(Math.abs(He),Math.abs(dt));let En;if(ct.precision==null)switch(ct.type){case"s":return isNaN(En=V(on,Xt))||(ct.precision=En),Ye(ct,Xt);case"":case"e":case"g":case"p":case"r":isNaN(En=N(on,Xt))||(ct.precision=En-(ct.type==="e"));break;case"f":case"%":isNaN(En=ee(on))||(ct.precision=En-2*(ct.type==="%"))}return We(ct)}}}let Ot,zt;function Mt(){return Ot=Ee({format:M,formatPrefix:P})}function Ke(Yt){return Ee(Ce(Yt))}function Tt(Yt){return arguments.length?Ot=Ke(Yt):Ot}function vt(Yt,We,Ye){Ye=Ye||{},Object($e.H)(Ye)||Object($e.o)("Invalid time multi-format specifier: ".concat(Ye));const He=We(be.i),dt=We(be.f),It=We(be.d),ct=We(be.a),on=We(be.k),Xt=We(be.g),En=We(be.h),xe=We(be.l),jn=Yt(Ye[be.e]||".%L"),nr=Yt(Ye[be.i]||":%S"),ar=Yt(Ye[be.f]||"%I:%M"),cr=Yt(Ye[be.d]||"%I %p"),Er=Yt(Ye[be.a]||Ye[be.b]||"%a %d"),hn=Yt(Ye[be.k]||"%b %d"),rn=Yt(Ye[be.g]||"%B"),fn=Yt(Ye[be.h]||"%B"),Xn=Yt(Ye[be.l]||"%Y");return Fn=>(He(Fn)<Fn?jn:dt(Fn)<Fn?nr:It(Fn)<Fn?ar:ct(Fn)<Fn?cr:Xt(Fn)<Fn?on(Fn)<Fn?Er:hn:xe(Fn)<Fn?En(Fn)<Fn?rn:fn:Xn)(Fn)}function yt(Yt){const We=Ut(Yt.format),Ye=Ut(Yt.utcFormat);return{timeFormat:He=>Object($e.J)(He)?We(He):vt(We,be.p,He),utcFormat:He=>Object($e.J)(He)?Ye(He):vt(Ye,be.v,He),timeParse:Ut(Yt.parse),utcParse:Ut(Yt.utcParse)}}function bt(){return zt=yt({format:ht.a,parse:ht.b,utcFormat:ht.c,utcParse:ht.d})}function Ht(Yt){return yt(Object(Dt.a)(Yt))}function _t(Yt){return arguments.length?zt=Ht(Yt):zt}n.d(i,"a",function(){return sn}),n.d(i,"b",function(){return Vt}),n.d(i,"c",function(){return Tt}),n.d(i,"d",function(){return yn}),n.d(i,"e",function(){return _t}),Mt(),bt();const Ze=(Yt,We)=>Object($e.p)({},Yt,We);function Vt(Yt,We){const Ye=Yt?Ke(Yt):Tt(),He=We?Ht(We):_t();return Ze(Ye,He)}function sn(Yt,We){const Ye=arguments.length;return Ye&&Ye!==2&&Object($e.o)("defaultLocale expects either zero or two arguments."),Ye?Ze(Tt(Yt),_t(We)):Ze(Tt(),_t())}function yn(){return Mt(),bt(),sn()}},function(a,i,n){n.d(i,"b",function(){return g}),n.d(i,"c",function(){return O});var s=Math.sqrt(50),h=Math.sqrt(10),v=Math.sqrt(2);function g(A,S,M){var P=(S-A)/Math.max(0,M),L=Math.floor(Math.log(P)/Math.LN10),V=P/Math.pow(10,L);return L>=0?(V>=s?10:V>=h?5:V>=v?2:1)*Math.pow(10,L):-Math.pow(10,-L)/(V>=s?10:V>=h?5:V>=v?2:1)}function O(A,S,M){var P=Math.abs(S-A)/Math.max(0,M),L=Math.pow(10,Math.floor(Math.log(P)/Math.LN10)),V=P/L;return V>=s?L*=10:V>=h?L*=5:V>=v&&(L*=2),S<A?-L:L}i.a=function(A,S,M){var P,L,V,N,ee=-1;if(M=+M,(A=+A)==(S=+S)&&M>0)return[A];if((P=S<A)&&(L=A,A=S,S=L),(N=g(A,S,M))===0||!isFinite(N))return[];if(N>0){let J=Math.round(A/N),K=Math.round(S/N);for(J*N<A&&++J,K*N>S&&--K,V=new Array(L=K-J+1);++ee<L;)V[ee]=(J+ee)*N}else{N=-N;let J=Math.round(A*N),K=Math.round(S*N);for(J/N<A&&++J,K/N>S&&--K,V=new Array(L=K-J+1);++ee<L;)V[ee]=(J+ee)/N}return P&&V.reverse(),V}},function(a,i,n){/** 7775* @license 7776* Copyright 2018 Google LLC. All Rights Reserved. 7777* Licensed under the Apache License, Version 2.0 (the "License");
7778* you may not use this file except in compliance with the License. 7779* You may obtain a copy of the License at 7780* 7781* http://www.apache.org/licenses/LICENSE-2.0 7782* 7783* Unless required by applicable law or agreed to in writing, software 7784* distributed under the License is distributed on an "AS IS" BASIS, 7785* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7786* See the License for the specific language governing permissions and 7787* limitations under the License. 7788* ============================================================================= 7789*/var s=this&&this.__awaiter||function(g,O,A,S){return new(A||(A=Promise))(function(M,P){function L(ee){try{N(S.next(ee))}catch(J){P(J)}}function V(ee){try{N(S.throw(ee))}catch(J){P(J)}}function N(ee){ee.done?M(ee.value):new A(function(J){J(ee.value)}).then(L,V)}N((S=S.apply(g,O||[])).next())})};Object.defineProperty(i,"__esModule",{value:!0});const h=n(198),v=n(197);i.getDrawArea=function(g){if(g instanceof HTMLElement)return g;if(h.isSurface(g))return g.drawArea;if(h.isSurfaceInfo(g))return v.visor().surface({name:g.name,tab:g.tab,styles:g.styles}).drawArea;throw new Error("Not a drawable")},i.shallowEquals=function(g,O){const A=Object.getOwnPropertyNames(g),S=Object.getOwnPropertyNames(O);if(A.length!==S.length)return!1;for(let M=0;M<A.length;M++){const P=A[M];if(g[P]!==O[P])return!1}return!0},i.nextFrame=function(){return s(this,void 0,void 0,function*(){yield new Promise(g=>requestAnimationFrame(g))})}},function(a,i,n){class s{constructor(zt,Mt){if(Mt=v(Mt),zt instanceof s)return zt.loose===!!Mt.loose&&zt.includePrerelease===!!Mt.includePrerelease?zt:new s(zt.raw,Mt);if(zt instanceof g)return this.raw=zt.value,this.set=[[zt]],this.format(),this;if(this.options=Mt,this.loose=!!Mt.loose,this.includePrerelease=!!Mt.includePrerelease,this.raw=zt,this.set=zt.split(/\s*\|\|\s*/).map(Ke=>this.parseRange(Ke.trim())).filter(Ke=>Ke.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${zt}`);if(this.set.length>1){const Ke=this.set[0];if(this.set=this.set.filter(Tt=>!N(Tt[0])),this.set.length===0)this.set=[Ke];else if(this.set.length>1){for(const Tt of this.set)if(Tt.length===1&&ee(Tt[0])){this.set=[Tt];break}}}this.format()}format(){return this.range=this.set.map(zt=>zt.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(zt){zt=zt.trim();const Mt=`parseRange:${Object.keys(this.options).join(",")}:${zt}`,Ke=h.get(Mt);if(Ke)return Ke;const Tt=this.options.loose,vt=Tt?S[M.HYPHENRANGELOOSE]:S[M.HYPHENRANGE];zt=zt.replace(vt,Ut(this.options.includePrerelease)),O("hyphen replace",zt),zt=zt.replace(S[M.COMPARATORTRIM],P),O("comparator trim",zt,S[M.COMPARATORTRIM]),zt=(zt=(zt=zt.replace(S[M.TILDETRIM],L)).replace(S[M.CARETTRIM],V)).split(/\s+/).join(" ");const yt=Tt?S[M.COMPARATORLOOSE]:S[M.COMPARATOR],bt=zt.split(" ").map(Ze=>K(Ze,this.options)).join(" ").split(/\s+/).map(Ze=>Dt(Ze,this.options)).filter(this.options.loose?Ze=>!!Ze.match(yt):()=>!0).map(Ze=>new g(Ze,this.options)),Ht=(bt.length,new Map);for(const Ze of bt){if(N(Ze))return[Ze];Ht.set(Ze.value,Ze)}Ht.size>1&&Ht.has("")&&Ht.delete("");const _t=[...Ht.values()];return h.set(Mt,_t),_t}intersects(zt,Mt){if(!(zt instanceof s))throw new TypeError("a Range is required");return this.set.some(Ke=>J(Ke,Mt)&&zt.set.some(Tt=>J(Tt,Mt)&&Ke.every(vt=>Tt.every(yt=>vt.intersects(yt,Mt)))))}test(zt){if(!zt)return!1;if(typeof zt=="string")try{zt=new A(zt,this.options)}catch{return!1}for(let Mt=0;Mt<this.set.length;Mt++)if(Ee(this.set[Mt],zt,this.options))return!0;return!1}}a.exports=s;const h=new(n(335))({max:1e3}),v=n(115),g=n(113),O=n(116),A=n(32),{re:S,t:M,comparatorTrimReplace:P,tildeTrimReplace:L,caretTrimReplace:V}=n(90),N=Ot=>Ot.value==="<0.0.0-0",ee=Ot=>Ot.value==="",J=(Ot,zt)=>{let Mt=!0;const Ke=Ot.slice();let Tt=Ke.pop();for(;Mt&&Ke.length;)Mt=Ke.every(vt=>Tt.intersects(vt,zt)),Tt=Ke.pop();return Mt},K=(Ot,zt)=>(O("comp",Ot,zt),Ot=ke(Ot,zt),O("caret",Ot),Ot=ce(Ot,zt),O("tildes",Ot),Ot=be(Ot,zt),O("xrange",Ot),Ot=ht(Ot,zt),O("stars",Ot),Ot),re=Ot=>!Ot||Ot.toLowerCase()==="x"||Ot==="*",ce=(Ot,zt)=>Ot.trim().split(/\s+/).map(Mt=>pe(Mt,zt)).join(" "),pe=(Ot,zt)=>{const Mt=zt.loose?S[M.TILDELOOSE]:S[M.TILDE];return Ot.replace(Mt,(Ke,Tt,vt,yt,bt)=>{let Ht;return O("tilde",Ot,Ke,Tt,vt,yt,bt),re(Tt)?Ht="":re(vt)?Ht=`>=${Tt}.0.0 <${+Tt+1}.0.0-0`:re(yt)?Ht=`>=${Tt}.${vt}.0 <${Tt}.${+vt+1}.0-0`:bt?(O("replaceTilde pr",bt),Ht=`>=${Tt}.${vt}.${yt}-${bt} <${Tt}.${+vt+1}.0-0`):Ht=`>=${Tt}.${vt}.${yt} <${Tt}.${+vt+1}.0-0`,O("tilde return",Ht),Ht})},ke=(Ot,zt)=>Ot.trim().split(/\s+/).map(Mt=>Ce(Mt,zt)).join(" "),Ce=(Ot,zt)=>{O("caret",Ot,zt);const Mt=zt.loose?S[M.CARETLOOSE]:S[M.CARET],Ke=zt.includePrerelease?"-0":"";return Ot.replace(Mt,(Tt,vt,yt,bt,Ht)=>{let _t;return O("caret",Ot,Tt,vt,yt,bt,Ht),re(vt)?_t="":re(yt)?_t=`>=${vt}.0.0${Ke} <${+vt+1}.0.0-0`:re(bt)?_t=vt==="0"?`>=${vt}.${yt}.0${Ke} <${vt}
7789.${+yt+1}.0-0`:`>=${vt}.${yt}.0${Ke} <${+vt+1}.0.0-0`:Ht?(O("replaceCaret pr",Ht),_t=vt==="0"?yt==="0"?`>=${vt}.${yt}.${bt}-${Ht} <${vt}.${yt}.${+bt+1}-0`:`>=${vt}.${yt}.${bt}-${Ht} <${vt}.${+yt+1}.0-0`:`>=${vt}.${yt}.${bt}-${Ht} <${+vt+1}.0.0-0`):(O("no pr"),_t=vt==="0"?yt==="0"?`>=${vt}.${yt}.${bt}${Ke} <${vt}.${yt}.${+bt+1}-0`:`>=${vt}.${yt}.${bt}${Ke} <${vt}.${+yt+1}.0-0`:`>=${vt}.${yt}.${bt} <${+vt+1}.0.0-0`),O("caret return",_t),_t})},be=(Ot,zt)=>(O("replaceXRanges",Ot,zt),Ot.split(/\s+/).map(Mt=>$e(Mt,zt)).join(" ")),$e=(Ot,zt)=>{Ot=Ot.trim();const Mt=zt.loose?S[M.XRANGELOOSE]:S[M.XRANGE];return Ot.replace(Mt,(Ke,Tt,vt,yt,bt,Ht)=>{O("xRange",Ot,Ke,Tt,vt,yt,bt,Ht);const _t=re(vt),Ze=_t||re(yt),Vt=Ze||re(bt),sn=Vt;return Tt==="="&&sn&&(Tt=""),Ht=zt.includePrerelease?"-0":"",_t?Ke=Tt===">"||Tt==="<"?"<0.0.0-0":"*":Tt&&sn?(Ze&&(yt=0),bt=0,Tt===">"?(Tt=">=",Ze?(vt=+vt+1,yt=0,bt=0):(yt=+yt+1,bt=0)):Tt==="<="&&(Tt="<",Ze?vt=+vt+1:yt=+yt+1),Tt==="<"&&(Ht="-0"),Ke=`${Tt+vt}.${yt}.${bt}${Ht}`):Ze?Ke=`>=${vt}.0.0${Ht} <${+vt+1}.0.0-0`:Vt&&(Ke=`>=${vt}.${yt}.0${Ht} <${vt}
7789.${+yt+1}.0-0`),O("xRange return",Ke),Ke})},ht=(Ot,zt)=>(O("replaceStars",Ot,zt),Ot.trim().replace(S[M.STAR],"")),Dt=(Ot,zt)=>(O("replaceGTE0",Ot,zt),Ot.trim().replace(S[zt.includePrerelease?M.GTE0PRE:M.GTE0],"")),Ut=Ot=>(zt,Mt,Ke,Tt,vt,yt,bt,Ht,_t,Ze,Vt,sn,yn)=>`${Mt=re(Ke)?"":re(Tt)?`>=${Ke}.0.0${Ot?"-0":""}`:re(vt)?`>=${Ke}.${Tt}.0${Ot?"-0":""}`:yt?`>=${Mt}`:`>=${Mt}${Ot?"-0":""}`} ${Ht=re(_t)?"":re(Ze)?`<${+_t+1}.0.0-0`:re(Vt)?`<${_t}.${+Ze+1}.0-0`:sn?`<=${_t}.${Ze}.${Vt}-${sn}`:Ot?`<${_t}.${Ze}.${+Vt+1}-0`:`<=${Ht}`}`.trim(),Ee=(Ot,zt,Mt)=>{for(let Ke=0;Ke<Ot.length;Ke++)if(!Ot[Ke].test(zt))return!1;if(zt.prerelease.length&&!Mt.includePrerelease){for(let Ke=0;Ke<Ot.length;Ke++)if(O(Ot[Ke].semver),Ot[Ke].semver!==g.ANY&&Ot[Ke].semver.prerelease.length>0){const Tt=Ot[Ke].semver;if(Tt.major===zt.major&&Tt.minor===zt.minor&&Tt.patch===zt.patch)return!0}return!1}return!0}},function(a,i,n){const s=n(32);a.exports=(h,v,g)=>new s(h,g).compare(new s(v,g))},function(a,i,n){var s=n(15);a.exports=function(h,v){return!!h&&s(function(){v?h.call(null,function(){},1):h.call(null)})}},function(a,i,n){n.r(i);var s=function(Ce,be){if(($e=(Ce=be?Ce.toExponential(be-1):Ce.toExponential()).indexOf("e"))<0)return null;var $e,ht=Ce.slice(0,$e);return[ht.length>1?ht[0]+ht.slice(2):ht,+Ce.slice($e+1)]},h=function(Ce){return(Ce=s(Math.abs(Ce)))?Ce[1]:NaN},v=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function g(Ce){return new O(Ce)}function O(Ce){if(!(be=v.exec(Ce)))throw new Error("invalid format: "+Ce);var be;this.fill=be[1]||" ",this.align=be[2]||">",this.sign=be[3]||"-",this.symbol=be[4]||"",this.zero=!!be[5],this.width=be[6]&&+be[6],this.comma=!!be[7],this.precision=be[8]&&+be[8].slice(1),this.trim=!!be[9],this.type=be[10]||""}g.prototype=O.prototype,O.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width==null?"":Math.max(1,0|this.width))+(this.comma?",":"")+(this.precision==null?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var A,S,M,P,L=function(Ce){e:for(var be,$e=Ce.length,ht=1,Dt=-1;ht<$e;++ht)switch(Ce[ht]){case".":Dt=be=ht;break;case"0":Dt===0&&(Dt=ht),be=ht;break;default:if(Dt>0){if(!+Ce[ht])break e;Dt=0}}return Dt>0?Ce.slice(0,Dt)+Ce.slice(be+1):Ce},V=function(Ce,be){var $e=s(Ce,be);if(!$e)return Ce+"";var ht=$e[0],Dt=$e[1];return Dt<0?"0."+new Array(-Dt).join("0")+ht:ht.length>Dt+1?ht.slice(0,Dt+1)+"."+ht.slice(Dt+1):ht+new Array(Dt-ht.length+2).join("0")},N={"%":function(Ce,be){return(100*Ce).toFixed(be)},b:function(Ce){return Math.round(Ce).toString(2)},c:function(Ce){return Ce+""},d:function(Ce){return Math.round(Ce).toString(10)},e:function(Ce,be){return Ce.toExponential(be)},f:function(Ce,be){return Ce.toFixed(be)},g:function(Ce,be){return Ce.toPrecision(be)},o:function(Ce){return Math.round(Ce).toString(8)},p:function(Ce,be){return V(100*Ce,be)},r:V,s:function(Ce,be){var $e=s(Ce,be);if(!$e)return Ce+"";var ht=$e[0],Dt=$e[1],Ut=Dt-(A=3*Math.max(-8,Math.min(8,Math.floor(Dt/3))))+1,Ee=ht.length;return Ut===Ee?ht:Ut>Ee?ht+new Array(Ut-Ee+1).join("0"):Ut>0?ht.slice(0,Ut)+"."+ht.slice(Ut):"0."+new Array(1-Ut).join("0")+s(Ce,Math.max(0,be+Ut-1))[0]},X:function(Ce){return Math.round(Ce).toString(16).toUpperCase()},x:function(Ce){return Math.round(Ce).toString(16)}},ee=function(Ce){return Ce},J=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],K=function(Ce){var be=Ce.grouping&&Ce.thousands?function(Ot,zt){return function(Mt,Ke){for(var Tt=Mt.length,vt=[],yt=0,bt=Ot[0],Ht=0;Tt>0&&bt>0&&(Ht+bt+1>Ke&&(bt=Math.max(1,Ke-Ht)),vt.push(Mt.substring(Tt-=bt,Tt+bt)),!((Ht+=bt+1)>Ke));)bt=Ot[yt=(yt+1)%Ot.length];return vt.reverse().join(zt)}}(Ce.grouping,Ce.thousands):ee,$e=Ce.currency,ht=Ce.decimal,Dt=Ce.numerals?function(Ot){return function(zt){return zt.replace(/[0-9]/g,function(Mt){return Ot[+Mt]})}}(Ce.numerals):ee,Ut=Ce.percent||"%";function Ee(Ot){var zt=(Ot=g(Ot)).fill,Mt=Ot.align,Ke=Ot.sign,Tt=Ot.symbol,vt=Ot.zero,yt=Ot.width,bt=Ot.comma,Ht=Ot.precision,_t=Ot.trim,Ze=Ot.type;Ze==="n"?(bt=!0,Ze="g"):N[Ze]||(Ht==null&&(Ht=12),_t=!0,Ze="g"),(vt||zt==="0"&&Mt==="=")&&(vt=!0,zt="0",Mt="=");var Vt=Tt==="$"?$e[0]:Tt==="#"&&/[boxX]/.test(Ze)?"0"+Ze.toLowerCase():"",sn=Tt==="$"?$e[1]:/[%p]/.test(Ze)?Ut:"",yn=N[Ze],Yt=/[defgprs%]/.test(Ze);function We(Ye){var He,dt,It,ct=Vt,on=sn;if(Ze==="c")on=yn(Ye)+on,Ye="";else{var Xt=(Ye=+Ye)<0;if(Ye=yn(Math.abs(Ye),Ht),_t&&(Ye=L(Ye)),Xt&&+Ye==0&&(Xt=!1),ct=(Xt?Ke==="("?Ke:"-":Ke==="-"||Ke==="("?"":Ke)+ct,on=(Ze==="s"?J[8+A/3]:"")+on+(Xt&&Ke==="("?")":""),Yt){for(He=-1,dt=Ye.length;++He<dt;)if(48>(It=Ye.charCodeAt(He))||It>57){on=(It===46?ht+Ye.slice(He+1):Ye.slice(He))+on,Ye=Ye.slice(0,He);break}}}bt&&!vt&&(Ye=be(Ye,1/0));var En=ct.length+Ye.length+on.length,xe=En<yt?new Array(yt-En+1).join(zt):"";switch(bt&&vt&&(Ye=be(xe+Ye,xe.length?yt-on.length:1/0),xe=""),Mt){case"<":Ye=ct+Ye+on+xe;break;case"=":Ye=ct+xe+Ye+on;break;case"^":Ye=xe.slice(0,En=xe.length>>1)+ct+Ye+on+xe.slice(En);break;default:Ye=xe+ct+Ye+on}return Dt(Ye)}return Ht=Ht==null?6:/[gprs]/.test(Ze)?Math.max(1,Math.min(21,Ht)):Math.max(0,Math.min(20,Ht)),We.toString=function(){return Ot+""},We}return{format:Ee,formatPrefix:function(Ot,zt){var Mt=Ee(((Ot=g(Ot)).type="f",Ot)),Ke=3*Math.max(-8,Math.min(8,Math.floor(h(zt)/3))),Tt=Math.pow(10,-Ke),vt=J[8+Ke/3];return function(yt){return Mt(Tt*yt)+vt}}}};function re(Ce){return S=K(Ce),M=S.format,P=S.formatPrefix,S}re({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var ce=function(Ce){return Math.max(0,-h(Math.abs(Ce)))},pe=function(Ce,be){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(h(be)/3)))-h(Math.abs(Ce)))},ke=function(Ce,be){return Ce=Math.abs(Ce),be=Math.abs(be)-Ce,Math.max(0,h(be)-h(Ce))+1};n.d(i,"formatDefaultLocale",function(){return re}),n.d(i,"format",function(){return M}),n.d(i,"formatPrefix",function(){return P}),n.d(i,"formatLocale",function(){return K}),n.d(i,"formatSpecifier",function(){return g}),n.d(i,"precisionFixed",function(){return ce}),n.d(i,"precisionPrefix",function(){return pe}),n.d(i,"precisionRound",function(){return ke})},function(a,i,n){var s=n(56),h=n(107),v=n(34),g=n(22),O=n(224);a.exports=function(A,S){var M=A==1,P=A==2,L=A==3,V=A==4,N=A==6,ee=A==5||N,J=S||O;return function(K,re,ce){for(var pe,ke,Ce=v(K),be=h(Ce),$e=s(re,ce,3),ht=g(be.length),Dt=0,Ut=M?J(K,ht):P?J(K,0):void 0;ht>Dt;Dt++)if((ee||Dt in be)&&(ke=$e(pe=be[Dt],Dt,Ce),A)){if(M)Ut[Dt]=ke;else if(ke)switch(A){case 3:return!0;case 5:return pe;case 6:return Dt;case 2:Ut.push(pe)}else if(V)return!1}return N?-1:L||V?V:Ut}}},function(a,i,n){var s=n(8),h=n(24),v=n(15);a.exports=function(g,O){var A=(h.Object||{})[g]||Object[g],S={};S[g]=O(A),s(s.S+s.F*v(function(){A(1)}),"Object",S)}},function(a,i,n){var s=n(106),h=n(85),v=n(41),g=n(66),O=n(43),A=n(240),S=Object.getOwnPropertyDescriptor;i.f=n(27)?S:function(M,P){if(M=v(M),P=g(P,!0),A)try{return S(M,P)}catch{}if(O(M,P))return h(!s.f.call(M,P),M[P])}},function(a,i){var n=Math.ceil,s=Math.floor;a.exports=function(h){return isNaN(h=+h)?0:(h>0?s:n)(h)}},function(a,i){a.exports=function(n){if(typeof n!="function")throw TypeError(n+" is not a function!");return n}},function(a,i,n){var s=n(55);a.exports=function(h,v,g){if(s(h),v===void 0)return h;switch(g){case 1:return function(O){return h.call(v,O)};case 2:return function(O,A){return h.call(v,O,A)};case 3:return function(O,A,S){return h.call(v,O,A,S)}}return function(){return h.apply(v,arguments)}}},function(a,i,n){var s=n(7).default,h=n(258);a.exports=function(v,g){if(g&&(s(g)==="object"||typeof g=="function"))return g;if(g!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return h(v)},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){var s=n(259);a.exports=function(h,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function");h.prototype=Object.create(v&&v.prototype,{constructor:{value:h,writable:!0,configurable:!0}}),Object.defineProperty(h,"prototype",{writable:!1}),v&&s(h,v)},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch{typeof window=="object"&&(n=window)}a.exports=n},function(a,i,n){if(n(27)){var s=n(83),h=n(16),v=n(15),g=n(8),O=n(118),A=n(151),S=n(56),M=n(94),P=n(85),L=n(42),V=n(93),N=n(54),ee=n(22),J=n(213),K=n(81),re=n(66),ce=n(43),pe=n(105),ke=n(13),Ce=n(34),be=n(159),$e=n(80),ht=n(78),Dt=n(79).f,Ut=n(157),Ee=n(84),Ot=n(19),zt=n(51),Mt=n(128),Ke=n(104),Tt=n(155),vt=n(96),yt=n(125),bt=n(95),Ht=n(156),_t=n(222),Ze=n(26),Vt=n(53),sn=Ze.f,yn=Vt.f,Yt=h.RangeError,We=h.TypeError,Ye=h.Uint8Array,He=Array.prototype,dt=A.ArrayBuffer,It=A.DataView,ct=zt(0),on=zt(2),Xt=zt(3),En=zt(4),xe=zt(5),jn=zt(6),nr=Mt(!0),ar=Mt(!1),cr=Tt.values,Er=Tt.keys,hn=Tt.entries,rn=He.lastIndexOf,fn=He.reduce,Xn=He.reduceRight,Fn=He.join,Ar=He.sort,Dr=He.slice,xr=He.toString,fi=He.toLocaleStr
vendor: 6,086 bytes, line 7789
7789ing,ci=Ot("iterator"),qr=Ot("toStringTag"),mi=Ee("typed_constructor"),Ir=Ee("def_constructor"),ti=O.CONSTR,ri=O.TYPED,yi=O.VIEW,na=zt(1,function(un,qe){return Zt(Ke(un,un[Ir]),qe)}),co=v(function(){return new Ye(new Uint16Array([1]).buffer)[0]===1}),$i=!!Ye&&!!Ye.prototype.set&&v(function(){new Ye(1).set({})}),Ft=function(un,qe){var $n=N(un);if($n<0||$n%qe)throw Yt("Wrong offset!");return $n},Qr=function(un){if(ke(un)&&ri in un)return un;throw We(un+" is not a typed array!")},Zt=function(un,qe){if(!(ke(un)&&mi in un))throw We("It is not a typed array constructor!");return new un(qe)},_e=function(un,qe){return ge(Ke(un,un[Ir]),qe)},ge=function(un,qe){for(var $n=0,er=qe.length,sr=Zt(un,er);er>$n;)sr[$n]=qe[$n++];return sr},Ae=function(un,qe,$n){sn(un,qe,{get:function(){return this._d[$n]}})},Ie=function(un){var qe,$n,er,sr,pr,Zr,Mr=Ce(un),Ii=arguments.length,Lo=Ii>1?arguments[1]:void 0,Ai=Lo!==void 0,ko=Ut(Mr);if(ko!=null&&!be(ko)){for(Zr=ko.call(Mr),er=[],qe=0;!(pr=Zr.next()).done;qe++)er.push(pr.value);Mr=er}for(Ai&&Ii>2&&(Lo=S(Lo,arguments[2],2)),qe=0,$n=ee(Mr.length),sr=Zt(this,$n);$n>qe;qe++)sr[qe]=Ai?Lo(Mr[qe],qe):Mr[qe];return sr},it=function(){for(var un=0,qe=arguments.length,$n=Zt(this,qe);qe>un;)$n[un]=arguments[un++];return $n},St=!!Ye&&v(function(){fi.call(new Ye(1))}),Jt=function(){return fi.apply(St?Dr.call(Qr(this)):Qr(this),arguments)},kn={copyWithin:function(un,qe){return _t.call(Qr(this),un,qe,arguments.length>2?arguments[2]:void 0)},every:function(un){return En(Qr(this),un,arguments.length>1?arguments[1]:void 0)},fill:function(un){return Ht.apply(Qr(this),arguments)},filter:function(un){return _e(this,on(Qr(this),un,arguments.length>1?arguments[1]:void 0))},find:function(un){return xe(Qr(this),un,arguments.length>1?arguments[1]:void 0)},findIndex:function(un){return jn(Qr(this),un,arguments.length>1?arguments[1]:void 0)},forEach:function(un){ct(Qr(this),un,arguments.length>1?arguments[1]:void 0)},indexOf:function(un){return ar(Qr(this),un,arguments.length>1?arguments[1]:void 0)},includes:function(un){return nr(Qr(this),un,arguments.length>1?arguments[1]:void 0)},join:function(un){return Fn.apply(Qr(this),arguments)},lastIndexOf:function(un){return rn.apply(Qr(this),arguments)},map:function(un){return na(Qr(this),un,arguments.length>1?arguments[1]:void 0)},reduce:function(un){return fn.apply(Qr(this),arguments)},reduceRight:function(un){return Xn.apply(Qr(this),arguments)},reverse:function(){for(var un,qe=Qr(this).length,$n=Math.floor(qe/2),er=0;er<$n;)un=this[er],this[er++]=this[--qe],this[qe]=un;return this},some:function(un){return Xt(Qr(this),un,arguments.length>1?arguments[1]:void 0)},sort:function(un){return Ar.call(Qr(this),un)},subarray:function(un,qe){var $n=Qr(this),er=$n.length,sr=K(un,er);return new(Ke($n,$n[Ir]))($n.buffer,$n.byteOffset+sr*$n.BYTES_PER_ELEMENT,ee((qe===void 0?er:K(qe,er))-sr))}},rr=function(un,qe){return _e(this,Dr.call(Qr(this),un,qe))},Bn=function(un){Qr(this);var qe=Ft(arguments[1],1),$n=this.length,er=Ce(un),sr=ee(er.length),pr=0;if(sr+qe>$n)throw Yt("Wrong length!");for(;pr<sr;)this[qe+pr]=er[pr++]},Gn={entries:function(){return hn.call(Qr(this))},keys:function(){return Er.call(Qr(this))},values:function(){return cr.call(Qr(this))}},Zn=function(un,qe){return ke(un)&&un[ri]&&typeof qe!="symbol"&&qe in un&&String(+qe)==String(qe)},Gt=function(un,qe){return Zn(un,qe=re(qe,!0))?P(2,un[qe]):yn(un,qe)},Wt=function(un,qe,$n){return!(Zn(un,qe=re(qe,!0))&&ke($n)&&ce($n,"value"))||ce($n,"get")||ce($n,"set")||$n.configurable||ce($n,"writable")&&!$n.writable||ce($n,"enumerable")&&!$n.enumerable?sn(un,qe,$n):(un[qe]=$n.value,un)};ti||(Vt.f=Gt,Ze.f=Wt),g(g.S+g.F*!ti,"Object",{getOwnPropertyDescriptor:Gt,defineProperty:Wt}),v(function(){xr.call({})})&&(xr=fi=function(){return Fn.call(this)});var Sn=V({},kn);V(Sn,Gn),L(Sn,ci,Gn.values),V(Sn,{slice:rr,set:Bn,constructor:function(){},toString:xr,toLocaleString:Jt}),Ae(Sn,"buffer","b"),Ae(Sn,"byteOffset","o"),Ae(Sn,"byteLength","l"),Ae(Sn,"length","e"),sn(Sn,qr,{get:function(){return this[ri]}}),a.exports=function(un,qe,$n,er){var sr=un+((er=!!er)?"Clamped":"")+"Array",pr="get"+un,Zr="set"+un,Mr=h[sr],Ii=Mr||{},Lo=Mr&&ht(Mr),Ai=!Mr||!O.ABV,ko={},Ji=Mr&&Mr.prototype,ai=function(lo,Kr){sn(lo,Kr,{get:function(){return function(Io,Ko){var Eo=Io._d;return Eo.v[pr](Ko*qe+Eo.o,co)}(this,Kr)},set:function(Io){return function(Ko,Eo,Yo){var vs=Ko._d;er&&(Yo=(Yo=Math.round(Yo))<0?0:Yo>255?255:255&Yo),vs.v[Zr](Eo*qe+vs.o,Yo,co)}(this,Kr,Io)},enumerable:!0})};Ai?(Mr=$n(function(lo,Kr,Io,Ko){M(lo,Mr,sr,"_d");var Eo,Yo,vs,gu,pp=0,fo=0;if(ke(Kr)){if(!(Kr instanceof dt||(gu=pe(Kr))=="ArrayBuffer"||gu=="SharedArrayBuffer"))return ri in Kr?ge(Mr,Kr):Ie.call(Mr,Kr);Eo=Kr,fo=Ft(Io,qe);var yl=Kr.byteLength;if(Ko===void 0){if(yl%qe||(Yo=yl-fo)<0)throw Yt("Wrong length!")}else if((Yo=ee(Ko)*qe)+fo>yl)throw Yt("Wrong length!");vs=Yo/qe}else vs=J(Kr),Eo=new dt(Yo=vs*qe);for(L(lo,"_d",{b:Eo,o:fo,l:Yo,e:vs,v:new It(Eo)});pp<vs;)ai(lo,pp++)}),Ji=Mr.prototype=$e(Sn),L(Ji,"constructor",Mr)):v(function(){Mr(1)})&&v(function(){new Mr(-1)})&&yt(function(lo){new Mr,new Mr(null),new Mr(1.5),new Mr(lo)},!0)||(Mr=$n(function(lo,Kr,Io,Ko){var Eo;return M(lo,Mr,sr),ke(Kr)?Kr instanceof dt||(Eo=pe(Kr))=="ArrayBuffer"||Eo=="SharedArrayBuffer"?Ko!==void 0?new Ii(Kr,Ft(Io,qe),Ko):Io!==void 0?new Ii(Kr,Ft(Io,qe)):new Ii(Kr):ri in Kr?ge(Mr,Kr):Ie.call(Mr,Kr):new Ii(J(Kr))}),ct(Lo!==Function.prototype?Dt(Ii).concat(Dt(Lo)):Dt(Ii),function(lo){lo in Mr||L(Mr,lo,Ii[lo])}),Mr.prototype=Ji,s||(Ji.constructor=Mr));var Yr=Ji[ci],Hn=!!Yr&&(Yr.name=="values"||Yr.name==null),ki=Gn.values;L(Mr,mi,!0),L(Ji,ri,sr),L(Ji,yi,!0),L(Ji,Ir,Mr),(er?new Mr(1)[qr]==sr:qr in Ji)||sn(Ji,qr,{get:function(){return sr}}),ko[sr]=Mr,g(g.G+g.W+g.F*(Mr!=Ii),ko),g(g.S,sr,{BYTES_PER_ELEMENT:qe}),g(g.S+g.F*v(function(){Ii.of.call(Mr,1)}),sr,{from:Ie,of:it}),"BYTES_PER_ELEMENT"in Ji||L(Ji,"BYTES_PER_ELEMENT",qe),g(g.P,sr,kn),bt(sr),g(g.P+g.F*$i,sr,{set:Bn}),g(g.P+g.F*!Hn,sr,Gn),s||Ji.toString==xr||(Ji.toString=xr),g(g.P+g.F*v(function(){new Mr(1).slice()}),sr,{slice:rr}
7789),g(g.P+g.F*(v(function(){return[1,2].toLocaleString()!=new Mr([1,2]).toLocaleString()})||!v(function(){Ji.toLocaleString.call([1,2])})),sr,{toLocaleString:Jt}),vt[sr]=Hn?Yr:ki,s||Hn||L(Ji,ci,ki)}}else a.exports=function(){}},function(a,i){a.exports=function(n){if(n==null)throw TypeError("Can't call method on "+n);return n}},function(a,i){var n={}.toString;a.exports=function(s){return n.call(s).slice(8,-1)}},function(a,i,n){(function(s){n.d(i,"a",function(){return Dt}),n.d(i,"b",function(){return Ut}),n.d(i,"c",function(){return ce}),n.d(i,"d",function(){return pe}),n.d(i,"e",function(){return zt}),n.d(i,"f",function(){return Ot}),n.d(i,"g",function(){return Ee}),n.d(i,"h",function(){return J});var h=n(1),v=n(582),g=n(176),O=n(44);const A=/^(data:|([A-Za-z]+:)?\/\/)/,S=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,M=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,P="file://";async function L(){Object(h.o)("No file system access.")}async function V(){Object(h.o)("No HTTP fetch method available.")}const N=Mt=>Mt!=null&&Mt==Mt,ee=Mt=>!(Number.isNaN(+Mt)||Mt instanceof Date),J={boolean:h.Ca,integer:h.Ea,number:h.Ea,date:h.Da,string:h.Ga,unknown:h.y},K=[Mt=>Mt==="true"||Mt==="false"||Mt===!0||Mt===!1,Mt=>ee(Mt)&&Number.isInteger(+Mt),ee,Mt=>!Number.isNaN(Date.parse(Mt))],re=["boolean","integer","number","date"];function ce(Mt,Ke){if(!Mt||!Mt.length)return"unknown";const Tt=Mt.length,vt=K.length,yt=K.map((bt,Ht)=>Ht+1);for(let bt,Ht,_t=0,Ze=0;_t<Tt;++_t)for(Ht=Ke?Mt[_t][Ke]:Mt[_t],bt=0;bt<vt;++bt)if(yt[bt]&&N(Ht)&&!K[bt](Ht)&&(yt[bt]=0,++Ze===K.length))return"string";return re[yt.reduce((bt,Ht)=>bt===0?Ht:bt,0)-1]}function pe(Mt,Ke){return Ke.reduce((Tt,vt)=>(Tt[vt]=ce(Mt,vt),Tt),{})}function ke(Mt){const Ke=function(Tt,vt){const yt={delimiter:Mt};return Ce(Tt,vt?Object(h.p)(vt,yt):yt)};return Ke.responseType="text",Ke}function Ce(Mt,Ke){return Ke.header&&(Mt=Ke.header.map(h.Ba).join(Ke.delimiter)+` 7790`+Mt),Object(v.a)(Ke.delimiter).parse(Mt+"")}function be(Mt,Ke){const Tt=Ke&&Ke.property?Object(h.u)(Ke.property):h.y;return Object(h.H)(Mt)&&!function(vt){return!(typeof s!="function"||!Object(h.E)(s.isBuffer))&&s.isBuffer(vt)}(Mt)?function(vt,yt){return!Object(h.B)(vt)&&Object(h.F)(vt)&&(vt=[...vt]),yt&&yt.copy?JSON.parse(JSON.stringify(vt)):vt}(Tt(Mt),Ke):Tt(JSON.parse(Mt))}Ce.responseType="text",be.responseType="json";const $e={interior:(Mt,Ke)=>Mt!==Ke,exterior:(Mt,Ke)=>Mt===Ke};function ht(Mt,Ke){let Tt,vt,yt,bt;return Mt=be(Mt,Ke),Ke&&Ke.feature?(Tt=g.a,yt=Ke.feature):Ke&&Ke.mesh?(Tt=g.b,yt=Ke.mesh,bt=$e[Ke.filter]):Object(h.o)("Missing TopoJSON feature or mesh parameter."),(vt=(vt=Mt.objects[yt])?Tt(Mt,vt,bt):Object(h.o)("Invalid TopoJSON object: "+yt))&&vt.features||[vt]}ht.responseType="json";const Dt={dsv:Ce,csv:ke(","),tsv:ke(" "),json:be,topojson:ht};function Ut(Mt,Ke){return arguments.length>1?(Dt[Mt]=Ke,this):Object(h.w)(Dt,Mt)?Dt[Mt]:null}function Ee(Mt){const Ke=Ut(Mt);return Ke&&Ke.responseType||"text"}function Ot(Mt,Ke,Tt,vt){const yt=Ut((Ke=Ke||{}).type||"json");return yt||Object(h.o)("Unknown data format type: "+Ke.type),Mt=yt(Mt,Ke),Ke.parse&&function(bt,Ht,_t,Ze){if(!bt.length)return;const Vt=Object(O.e)();_t=_t||Vt.timeParse,Ze=Ze||Vt.utcParse;let sn,yn,Yt,We,Ye,He,dt=bt.columns||Object.keys(bt[0]);Ht==="auto"&&(Ht=pe(bt,dt));const It=(dt=Object.keys(Ht)).map(ct=>{const on=Ht[ct];let Xt,En;if(on&&(on.startsWith("date:")||on.startsWith("utc:")))return Xt=on.split(/:(.+)?/,2),((En=Xt[1])[0]==="'"&&En[En.length-1]==="'"||En[0]==='"'&&En[En.length-1]==='"')&&(En=En.slice(1,-1)),(Xt[0]==="utc"?Ze:_t)(En);if(!J[on])throw Error("Illegal format pattern: "+ct+":"+on);return J[on]});for(Yt=0,Ye=bt.length,He=dt.length;Yt<Ye;++Yt)for(sn=bt[Yt],We=0;We<He;++We)yn=dt[We],sn[yn]=It[We](sn[yn])}(Mt,Ke.parse,Tt,vt),Object(h.w)(Mt,"columns")&&delete Mt.columns,Mt}const zt=function(Mt,Ke){return Tt=>({options:Tt||{},sanitize:async function(vt,yt){yt=Object(h.p)({},this.options,yt);const bt=this.fileAccess,Ht={href:null};let _t,Ze,Vt;const sn=S.test(vt.replace(M,""));vt!=null&&typeof vt=="string"&&sn||Object(h.o)("Sanitize failure, invalid URI: "+Object(h.Ba)(vt));const yn=A.test(vt);
7790return(Vt=yt.baseURL)&&!yn&&(vt.startsWith("/")||Vt.endsWith("/")||(vt="/"+vt),vt=Vt+vt),Ze=(_t=vt.startsWith(P))||yt.mode==="file"||yt.mode!=="http"&&!yn&&bt,_t?vt=vt.slice(P.length):vt.startsWith("//")&&(yt.defaultProtocol==="file"?(vt=vt.slice(2),Ze=!0):vt=(yt.defaultProtocol||"http")+":"+vt),Object.defineProperty(Ht,"localFile",{value:!!Ze}),Ht.href=vt,yt.target&&(Ht.target=yt.target+""),yt.rel&&(Ht.rel=yt.rel+""),yt.context==="image"&&yt.crossOrigin&&(Ht.crossOrigin=yt.crossOrigin+""),Ht},load:async function(vt,yt){const bt=await this.sanitize(vt,yt),Ht=bt.href;return bt.localFile?this.file(Ht):this.http(Ht,yt)},fileAccess:!!Ke,file:function(vt){return vt?yt=>new Promise((bt,Ht)=>{vt.readFile(yt,(_t,Ze)=>{_t?Ht(_t):bt(Ze)})}):L}(Ke),http:function(vt){return vt?async function(yt,bt){const Ht=Object(h.p)({},this.options.http,bt),_t=bt&&bt.response,Ze=await vt(yt,Ht);return Ze.ok?Object(h.E)(Ze[_t])?Ze[_t]():Ze.text():Object(h.o)(Ze.status+""+Ze.statusText)}:V}(Mt)})}(typeof fetch<"u"&&fetch,null)}).call(this,n(92).Buffer)},function(a,i,n){/** 7791* @license 7792* Copyright 2018 Google LLC. All Rights Reserved. 7793* Licensed under the Apache License, Version 2.0 (the "License"); 7794* you may not use this file except in compliance with the License. 7795* You may obtain a copy of the License at 7796* 7797* http://www.apache.org/licenses/LICENSE-2.0 7798* 7799* Unless required by applicable law or agreed to in writing, software 7800* distributed under the License is distributed on an "AS IS" BASIS, 7801* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7802* See the License for the specific language governing permissions and 7803* limitations under the License. 7804* ============================================================================= 7805*/Object.defineProperty(i,"__esModule",{value:!0});const s=n(102),h=n(46),v={prepend:!1};i.subSurface=function(g,O,A={}){const S=h.getDrawArea(g),M=s.css({"& canvas":{display:"block"},marginTop:".5rem",marginBottom:".5rem"}),P=s.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({},v,A);let V=S.querySelector(`div[data-name=${O}]`);if(!V){if((V=document.createElement("div")).setAttribute("class",`${M}
7805`),V.dataset.name=O,L.title){const N=document.createElement("div");N.setAttribute("class",`subsurface-title ${P}`),N.innerText=L.title,V.appendChild(N)}L.prepend?S.insertBefore(V,S.firstChild):S.appendChild(V)}return V},i.getDefaultWidth=function(g){let O=0,A=g;for(;A&&A.clientWidth===0;)A=A.parentElement,O=50;return A.clientWidth-O},i.getDefaultHeight=function(g){return g.clientHeight===0?200:g.clientHeight}},function(a,i,n){var s=n(84)("meta"),h=n(13),v=n(43),g=n(26).f,O=0,A=Object.isExtensible||function(){return!0},S=!n(15)(function(){return A(Object.preventExtensions({}))}),M=function(L){g(L,s,{value:{i:"O"+ ++O,w:{}}})},P=a.exports={KEY:s,NEED:!1,fastKey:function(L,V){if(!h(L))return typeof L=="symbol"?L:(typeof L=="string"?"S":"P")+L;if(!v(L,s)){if(!A(L))return"F";if(!V)return"E";M(L)}return L[s].i},getWeak:function(L,V){if(!v(L,s)){if(!A(L))return!0;if(!V)return!1;M(L)}return L[s].w},onFreeze:function(L){return S&&P.NEED&&A(L)&&!v(L,s)&&M(L),L}}},function(a,i,n){var s=n(13);a.exports=function(h,v){if(!s(h))return h;var g,O;if(v&&typeof(g=h.toString)=="function"&&!s(O=g.call(h))||typeof(g=h.valueOf)=="function"&&!s(O=g.call(h))||!v&&typeof(g=h.toString)=="function"&&!s(O=g.call(h)))return O;throw TypeError("Can't convert object to primitive value")}},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),n(0),n(384);const s=n(349),h=n(289),v=n(288),g=n(137),O=n(196),A=n(287),S=n(109),M=n(286),P=n(285),L=n(284),V=n(283),N=n(110),ee=n(282);i.version_vis=ee.version;const J={barchart:s.barchart,table:S.table,histogram:g.histogram,linechart:O.linechart,scatterplot:A.scatterplot,confusionMatrix:h.confusionMatrix,heatmap:v.heatmap};i.render=J;const K={accuracy:N.accuracy,perClassAccuracy:N.perClassAccuracy,confusionMatrix:N.confusionMatrix};i.metrics=K;const re={history:M.history,fitCallbacks:M.fitCallbacks,perClassAccuracy:L.perClassAccuracy,valuesDistribution:V.valuesDistribution,layer:P.layer,modelSummary:P.modelSummary};i.show=re;var ce=n(197);i.visor=ce.visor,function(pe){for(var ke in pe)i.hasOwnProperty(ke)||(i[ke]=pe[ke])}(n(198))},function(a,i,n){var s=n(31),h=Object(s.a)(function(v){v.setUTCMonth(0,1),v.setUTCHours(0,0,0,0)},function(v,g){v.setUTCFullYear(v.getUTCFullYear()+g)},function(v,g){return g.getUTCFullYear()-v.getUTCFullYear()},function(v){return v.getUTCFullYear()});h.every=function(v){return isFinite(v=Math.floor(v))&&v>0?Object(s.a)(function(g){g.setUTCFullYear(Math.floor(g.getUTCFullYear()/v)*v),g.setUTCMonth(0,1),g.setUTCHours(0,0,0,0)},function(g,O){g.setUTCFullYear(g.getUTCFullYear()+O*v)}):null},i.a=h,h.range},function(a,i,n){var s=n(31),h=n(12),v=Object(s.a)(function(g){g.setTime(g-g.getMilliseconds())},function(g,O){g.setTime(+g+O*h.e)},function(g,O){return(O-g)/h.e},function(g){return g.getUTCSeconds()});i.a=v,v.range},function(a,i,n){var s=n(31),h=Object(s.a)(function(v){v.setMonth(0,1),v.setHours(0,0,0,0)},function(v,g){v.setFullYear(v.getFullYear()+g)},function(v,g){return g.getFullYear()-v.getFullYear()},function(v){return v.getFullYear()});h.every=function(v){return isFinite(v=Math.floor(v))&&v>0?Object(s.a)(function(g){g.setFullYear(Math.floor(g.getFullYear()/v)*v),g.setMonth(0,1),g.setHours(0,0,0,0)},function(g,O){g.setFullYear(g.getFullYear()+O*v)}):null},i.a=h,h.range},function(a,i,n){var s=n(31),h=n(12),v=Object(s.a)(function(g){g.setUTCHours(0,0,0,0)},function(g,O){g.setUTCDate(g.getUTCDate()+O)},function(g,O){return(O-g)/h.a},function(g){return g.getUTCDate()-1});i.a=v,v.range},function(a,i,n){var s=n(31),h=n(12),v=Object(s.a)(g=>g.setHours(0,0,0,0),(g,O)=>g.setDate(g.getDate()+O),(g,O)=>(O-g-(O.getTimezoneOffset()-g.getTimezoneOffset())*h.c)/h.a,g=>g.getDate()-1);i.a=v,v.range},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.Add="Add",i.AddN="AddN",i.Div="Div",i.FusedBatchNorm="FusedBatchNorm",i.SquaredDifference="SquaredDifference",i.Square="Square",i.Transpose="Transpose",i.NonMaxSuppressionV5="NonMaxSuppressionV5",i.BroadcastTo="BroadcastTo",i.OneHot="OneHot",i.Identity="Identity",i.Tile="Tile",i.PadV2="PadV2",i.FromPixels="FromPixels",i.MaxPoolWithArgmax="MaxPoolWithArgmax"},function(a,i,n){/** 7806* @license 7807* Copyright 2018 Google LLC. All Rights Reserved. 7808* Licensed under the Apache License, Version 2.0 (the "License");
7809* you may not use this file except in compliance with the License. 7810* You may obtain a copy of the License at 7811* 7812* http://www.apache.org/licenses/LICENSE-2.0 7813* 7814* Unless required by applicable law or agreed to in writing, software 7815* distributed under the License is distributed on an "AS IS" BASIS, 7816* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 7817* See the License for the specific language governing permissions and 7818* limitations under the License. 7819* ============================================================================= 7820*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(33),h=n(378),v=n(21);i.makeTypesMatch=function(g,O){if(g.dtype===O.dtype)return[g,O];var A=h.upcastType(g.dtype,O.dtype);return[g.cast(A),O.cast(A)]},i.assertTypesMatch=function(g,O){v.assert(g.dtype===O.dtype,function(){return"The dtypes of the first("+g.dtype+") and second("+O.dtype+") input must match"})},i.isTensorInList=function(g,O){return O.some(function(A){return A.id===g.id})},i.getTensorsInContainer=function(g){var O=[];return function A(S,M,P){if(S!=null){if(S instanceof s.Tensor)M.push(S);else if(function(ee){return Array.isArray(ee)||typeof ee=="object"}(S)){var L=S;for(var V in L){var N=L[V];P.has(N)||(P.add(N),A(N,M,P))}}}}(g,O,new Set),O}},function(a,i){var n,s,h=a.exports={};function v(){throw new Error("setTimeout has not been defined")}function g(){throw new Error("clearTimeout has not been defined")}function O(J){if(n===setTimeout)return setTimeout(J,0);if((n===v||!n)&&setTimeout)return n=setTimeout,setTimeout(J,0);try{return n(J,0)}catch{try{return n.call(null,J,0)}catch{return n.call(this,J,0)}}}(function(){try{n=typeof setTimeout=="function"?setTimeout:v}catch{n=v}try{s=typeof clearTimeout=="function"?clearTimeout:g}catch{s=g}})();var A,S=[],M=!1,P=-1;function L(){M&&A&&(M=!1,A.length?S=A.concat(S):P=-1,S.length&&V())}function V(){if(!M){var J=O(L);M=!0;for(var K=S.length;K;){for(A=S,S=[];++P<K;)A&&A[P].run();P=-1,K=S.length}A=null,M=!1,function(re){if(s===clearTimeout)return clearTimeout(re);if((s===g||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(re);try{s(re)}catch{try{return s.call(null,re)}catch{return s.call(this,re)}}}(J)}}function N(J,K){this.fun=J,this.array=K}function ee(){}h.nextTick=function(J){var K=new Array(arguments.length-1);if(arguments.length>1)for(var re=1;re<arguments.length;re++)K[re-1]=arguments[re];S.push(new N(J,K)),S.length!==1||M||O(V)},N.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=ee,h.addListener=ee,h.once=ee,h.off=ee,h.removeListener=ee,h.removeAllListeners=ee,h.emit=ee,h.prependListener=ee,h.prependOnceListener=ee,h.listeners=function(J){return[]},h.binding=function(J){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(J){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(a,i,n){var s=n(13);a.exports=function(h,v){if(!s(h)||h._t!==v)throw TypeError("Incompatible receiver, "+v+" required!");return h}},function(a,i,n){var s=n(19)("unscopables"),h=Array.prototype;h[s]==null&&n(42)(h,s,{}),a.exports=function(v){h[s][v]=!0}},function(a,i,n){var s=n(43),h=n(34),v=n(173)("IE_PROTO"),g=Object.prototype;a.exports=Object.getPrototypeOf||function(O){return O=h(O),s(O,v)?O[v]:typeof O.constructor=="function"&&O instanceof O.constructor?O.constructor.prototype:O instanceof Object?g:null}},function(a,i,n){var s=n(238),h=n(172).concat("length","prototype");i.f=Object.getOwnPropertyNames||function(v){return s(v,h)}},function(a,i,n){var s=n(14),h=n(237),v=n(172),g=n(173)("IE_PROTO"),O=function(){},A=function(){var S,M=n(175)("iframe"),P=v.length;for(M.style.display="none",n(171).appendChild(M),M.src="javascript:",(S=M.contentWindow.document).open(),S.write("<script>document.F=Object<\/script>"),S.close(),A=S.F;P--;)delete A.prototype[v[P]];return A()};a.exports=Object.create||function(S,M){var P;return S!==null?(O.prototype=s(S),P=new O,O.prototype=null,P[g]=S):P=A(),M===void 0?P:h(P,M)}},function(a,i,n){var s=n(54),h=Math.max,v=Math.min;a.exports=function(g,O){return(g=s(g))<0?h(g+O,0):v(g,O)}},function(a,i,n){var s=n(238),h=n(172);a.exports=Object.keys||function(v){return s(v,h)}},function(a,i){a.exports=!1},function(a,i){var n=0,s=Math.random();a.exports=function(h){return"Symbol(".concat(h===void 0?"":h,")_",(++n+s).toString(36))}},function(a,i){a.exports=function(n,s){return{enumerable:!(1&n),configurable:!(2&n),writable:!(4&n),value:s}}},function(a,i,n){a.exports=function(s,h){h||(h={}),typeof h=="function"&&(h={cmp:h});var v=typeof h.cycles=="boolean"&&h.cycles,g=h.cmp&&function(A){return function(S){return function(M,P){var L={key:M,value:S[M]},V={key:P,value:S[P]};return A(L,V)}}}(h.cmp),O=[];return function A(S){if(S&&S.toJSON&&typeof S.toJSON=="function"&&(S=S.toJSON()),S!==void 0){if(typeof S=="number")return isFinite(S)?""+S:"null";if(typeof S!="object")return JSON.stringify(S);var M,P;if(Array.isArray(S)){for(P="[",M=0;M<S.length;M++)M&&(P+=","),P+=A(S[M])||"null";return P+"]"}if(S===null)return"null";if(O.indexOf(S)!==-1){if(v)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var L=O.push(S)-1,V=Object.keys(S).sort(g&&g(S));for(P="",M=0;M<V.length;M++){var N=V[M],ee=A(S[N]);ee&&(P&&(P+=","),P+=JSON.stringify(N)+":"+ee)}return O.splice(L,1),"{"+P+"}"}}(s)}},function(a,i,n){i.a=function(s,h){return s<h?-1:s>h?1:s>=h?0:NaN}},function(a,i,n){n.r(i);var s={};n.d(s,"JsonPatchError",function(){return Mt}),n.d(s,"deepClone",function(){return Ke}),n.d(s,"getValueByPointer",function(){return yt}),n.d(s,"applyOperation",function(){return bt}),n.d(s,"applyPatch",function(){return Ht}),n.d(s,"applyReducer",function(){return _t}),n.d(s,"validator",function(){return Ze}),n.d(s,"validate",function(){return Vt}),n.d(s,"_areEquals",function(){return sn});var h={};n.d(h,"unobserve",function(){return Ye}),n.d(h,"observe",function(){return He}),n.d(h,"generate",function(){return dt}),n.d(h,"compare",function(){return ct});var v={};n.d(v,"aggregate",function(){return _l}),n.d(v,"bin",function(){return Nm}),n.d(v,"collect",function(){return jg}),n.d(v,"compare",function(){return I0}),n.d(v,"countpattern",function(){return yf}),n.d(v,"cross",function(){return As}
7820),n.d(v,"density",function(){return Im}),n.d(v,"dotbin",function(){return Ic}),n.d(v,"expression",function(){return ds}),n.d(v,"extent",function(){return sc}),n.d(v,"facet",function(){return zo}),n.d(v,"field",function(){return qa}),n.d(v,"filter",function(){return Qo}),n.d(v,"flatten",function(){return bu}),n.d(v,"fold",function(){return Or}),n.d(v,"formula",function(){return Vu}),n.d(v,"generate",function(){return uc}),n.d(v,"impute",function(){return _p}),n.d(v,"joinaggregate",function(){return Mm}),n.d(v,"kde",function(){return Fm}),n.d(v,"key",function(){return yc}),n.d(v,"load",function(){return xu}),n.d(v,"lookup",function(){return kl}),n.d(v,"multiextent",function(){return eu}),n.d(v,"multivalues",function(){return va}),n.d(v,"params",function(){return Rm}),n.d(v,"pivot",function(){return od}),n.d(v,"prefacet",function(){return Cp}),n.d(v,"project",function(){return to}),n.d(v,"proxy",function(){return Li}),n.d(v,"quantile",function(){return za}),n.d(v,"relay",function(){return Bm}),n.d(v,"sample",function(){return Pm}),n.d(v,"sequence",function(){return jm}),n.d(v,"sieve",function(){return Lg}),n.d(v,"subflow",function(){return Bt}),n.d(v,"timeunit",function(){return el}),n.d(v,"tupleindex",function(){return xf}),n.d(v,"values",function(){return Iu}),n.d(v,"window",function(){return wf});var g={};n.d(g,"interpolate",function(){return Ua}),n.d(g,"interpolateArray",function(){return ja}),n.d(g,"interpolateBasis",function(){return oi}),n.d(g,"interpolateBasisClosed",function(){return Br}),n.d(g,"interpolateDate",function(){return Ta}),n.d(g,"interpolateDiscrete",function(){return v1}),n.d(g,"interpolateHue",function(){return Xm}),n.d(g,"interpolateNumber",function(){return Zi}),n.d(g,"interpolateNumberArray",function(){return ro}),n.d(g,"interpolateObject",function(){return Xi}),n.d(g,"interpolateRound",function(){return Na}),n.d(g,"interpolateString",function(){return Qa}),n.d(g,"interpolateTransformCss",function(){return H0}),n.d(g,"interpolateTransformSvg",function(){return Db}),n.d(g,"interpolateZoom",function(){return Jv}),n.d(g,"interpolateRgb",function(){return wi}),n.d(g,"interpolateRgbBasis",function(){return _o}),n.d(g,"interpolateRgbBasisClosed",function(){return ba}),n.d(g,"interpolateHsl",function(){return Wg}),n.d(g,"interpolateHslLong",function(){return Zv}),n.d(g,"interpolateLab",function(){return Zm}),n.d(g,"interpolateHcl",function(){return Ib}),n.d(g,"interpolateHclLong",function(){return y1}),n.d(g,"interpolateCubehelix",function(){return zp}),n.d(g,"interpolateCubehelixLong",function(){return b1}),n.d(g,"piecewise",function(){return Lc}),n.d(g,"quantize",function(){return x1});var O={};n.d(O,"bound",function(){return nj}),n.d(O,"identifier",function(){return A4}),n.d(O,"mark",function(){return ij}),n.d(O,"overlap",function(){return oj}),n.d(O,"render",function(){return fj}),n.d(O,"viewlayout",function(){return vj});var A={};n.d(A,"axisticks",function(){return bj}),n.d(A,"datajoin",function(){return xj}),n.d(A,"encode",function(){return wj}),n.d(A,"legendentries",function(){return _j}),n.d(A,"linkpath",function(){return O4}),n.d(A,"pie",function(){return D4}),n.d(A,"scale",function(){return Oj}),n.d(A,"sortitems",function(){return Nj}),n.d(A,"stack",function(){return N4});var S={};n.d(S,"contour",function(){return cI}),n.d(S,"geojson",function(){return dI}),n.d(S,"geopath",function(){return hI}),n.d(S,"geopoint",function(){return pI}),n.d(S,"geoshape",function(){return mI}),n.d(S,"graticule",function(){return gI}),n.d(S,"heatmap",function(){return vI}),n.d(S,"isocontour",function(){return aI}),n.d(S,"kde2d",function(){return uI}),n.d(S,"projection",function(){return W8});var M={};n.d(M,"force",function(){return kI});var P={};n.d(P,"nest",function(){return TI}),n.d(P,"pack",function(){return II}),n.d(P,"partition",function(){return FI}),n.d(P,"stratify",function(){return RI}),n.d(P,"tree",function(){return PI}),n.d(P,"treelinks",function(){return jI}),n.d(P,"treemap",function(){return zI});var L={};n.d(L,"label",function(){return WI});var V={};n.d(V,"loess",function(){return VI}),n.d(V,"regression",function(){return HI});var N={};n.d(N,"voronoi",function(){return XI});var ee={};n.d(ee,"wordcloud",function(){return QI});var J={};n.d(J,"crossfilter",function(){return ZI}),n.d(J,"resolvefilter",function(){return eM});var K={};n.d(K,"Dataflow",function(){return Zn}),n.d(K,"EventStream",function(){return $i}),n.d(K,"MultiPulse",function(){return Jt}),n.d(K,"Operator",function(){return yi}),n.d(K,"Parameters",function(){return Ir}),n.d(K,"Pulse",function(){return Ae}),n.d(K,"Transform",function(){return Wt}),n.d(K,"changeset",function(){return qr}),n.d(K,"definition",function(){return un}),n.d(K,"ingest",function(){return Fn}),n.d(K,"isTuple",function(){return rn}),n.d(K,"transform",function(){return qe}),n.d(K,"transforms",function(){return Sn}),n.d(K,"tupleid",function(){return fn}),n.d(K,"interpolate",function(){return Zg}),n.d(K,"interpolateColors",function(){return Ad}),n.d(K,"interpolateRange",function(){return Jg}),n.d(K,"quantizeInterpolator",function(){return Qg}),n.d(K,"scale",function(){return da}),n.d(K,"scheme",function(){return Q0}),n.d(K,"projection",function(){return oI}),n.d(K,"View",function(){return H9}),n.d(K,"defaultLocale",function(){return nr.a}),n.d(K,"formatLocale",function(){return nr.c}),n.d(K,"locale",function(){return nr.b}),n.d(K,"resetDefaultLocale",function(){return nr.d}),n.d(K,"timeFormatLocale",function(){return nr.e}),n.d(K,"expressionFunction",function(){return ll}),n.d(K,"parse",function(){return Dre}),n.d(K,"runtimeContext",function(){return C9}),n.d(K,"codegenExpression",function(){return kie}),n.d(K,"parseExpression",function(){return xie}),n.d(K,"parseSelector",function(){return Ow}),n.d(K,"version",function(){return Nie}),n.d(K,"Debug",function(){return xe.a}),n.d(K,"Error",function(){return xe.b}),n.d(K,"Info",function(){return xe.c}),n.d(K,"None",function(){return xe.d}),n.d(K,"Warn",function(){return xe.e}),n.d(K,"accessor",function(){return xe.f}),n.d(K,"accessorFields",function(){return xe.g}),n.d(K,"accessorName",function(){return xe.h}),n.d(K,"array",function(){return xe.i}),n.d(K,"ascending",function(){return xe.j}),n.d(K,"clampRange",function(){return xe.k}),n.d(K,"compare",function(){return xe.l}),n.d(K,"constant",function(){return xe.m}),n.d(K,"debounce",function(){return xe.n}),n.d(K,"error",function(){return xe.o}),n.d(K,"extend",function(){return xe.p}),n.d(K,"extent",function(){return xe.q}),n.d(K,"extentIndex",function(){return xe.r}),n.d(K,"falsy",function(){return xe.s}),n.d(K,"fastmap",function(){return xe.t}),n.d(K,"field",function(){return xe.u}),n.d(K,"flush",function(){return xe.v}),n.d(K,"hasOwnProperty",function(){return xe.w}),n.d(K,"id",function(){return xe.x}),n.d(K,"identity",function(){return xe.y}),n.d(K,"inherits",function(){return xe.z}),n.d(K,"inrange",function(){return xe.A}),n.d(K,"isArray",function(){return xe.B}),n.d(K,"isBoolean",function(){return xe.C}),n.d(K,"isDate",function(){return xe.D}),n.d(K,"isFunction",function(){return xe.E}),n.d(K,"isIterable",function(){return xe.F}),n.d(K,"isNumber",function(){return xe.G}),n.d(K,"isObject",function(){return xe.H}),n.d(K,"isRegExp",function(){return xe.I}),n.d(K,"isString",function(){return xe.J}),n.d(K,"key",function(){return xe.K}),n.d(K,"lerp",function(){return xe.L}),n.d(K,"logger",function(){return xe.M}),n.d(K,"lruCache",function(){return xe.N}),n.d(K,"merge",function(){return xe.O}),n.d(K,"mergeConfig",function(){return xe.P}),n.d(K,"one",function(){return xe.Q}),n.d(K,"pad",function(){return xe.R}
7820),n.d(K,"panLinear",function(){return xe.S}),n.d(K,"panLog",function(){return xe.T}),n.d(K,"panPow",function(){return xe.U}),n.d(K,"panSymlog",function(){return xe.V}),n.d(K,"peek",function(){return xe.W}),n.d(K,"quarter",function(){return xe.X}),n.d(K,"repeat",function(){return xe.Y}),n.d(K,"span",function(){return xe.Z}),n.d(K,"splitAccessPath",function(){return xe.Aa}),n.d(K,"stringValue",function(){return xe.Ba}),n.d(K,"toBoolean",function(){return xe.Ca}),n.d(K,"toDate",function(){return xe.Da}),n.d(K,"toNumber",function(){return xe.Ea}),n.d(K,"toSet",function(){return xe.Fa}),n.d(K,"toString",function(){return xe.Ga}),n.d(K,"truncate",function(){return xe.Ha}),n.d(K,"truthy",function(){return xe.Ia}),n.d(K,"utcquarter",function(){return xe.Ja}),n.d(K,"visitArray",function(){return xe.Ka}),n.d(K,"writeConfig",function(){return xe.La}),n.d(K,"zero",function(){return xe.Ma}),n.d(K,"zoomLinear",function(){return xe.Na}),n.d(K,"zoomLog",function(){return xe.Oa}),n.d(K,"zoomPow",function(){return xe.Pa}),n.d(K,"zoomSymlog",function(){return xe.Qa}),n.d(K,"bandwidthNRD",function(){return ai}),n.d(K,"bin",function(){return Yr}),n.d(K,"bootstrapCI",function(){return lo}),n.d(K,"cumulativeLogNormal",function(){return Sm}),n.d(K,"cumulativeNormal",function(){return fo}),n.d(K,"cumulativeUniform",function(){return mp}),n.d(K,"densityLogNormal",function(){return Vl}),n.d(K,"densityNormal",function(){return pp}),n.d(K,"densityUniform",function(){return eh}),n.d(K,"dotbin",function(){return Kr}),n.d(K,"quantileLogNormal",function(){return Qs}),n.d(K,"quantileNormal",function(){return yl}),n.d(K,"quantileUniform",function(){return $l}),n.d(K,"quantiles",function(){return ko}),n.d(K,"quartiles",function(){return Ji}),n.d(K,"random",function(){return Hn}),n.d(K,"randomInteger",function(){return Ko}),n.d(K,"randomKDE",function(){return Wl}),n.d(K,"randomLCG",function(){return Io}),n.d(K,"randomLogNormal",function(){return Zd}),n.d(K,"randomMixture",function(){return Am}),n.d(K,"randomNormal",function(){return Tc}),n.d(K,"randomUniform",function(){return nd}),n.d(K,"regressionExp",function(){return xl}),n.d(K,"regressionLinear",function(){return Zs}),n.d(K,"regressionLoess",function(){return nh}),n.d(K,"regressionLog",function(){return ls}),n.d(K,"regressionPoly",function(){return vc}),n.d(K,"regressionPow",function(){return rd}),n.d(K,"regressionQuad",function(){return wl}),n.d(K,"sampleCurve",function(){return rh}),n.d(K,"sampleLogNormal",function(){return Jc}),n.d(K,"sampleNormal",function(){return gu}),n.d(K,"sampleUniform",function(){return Qc}),n.d(K,"setRandom",function(){return ki}),n.d(K,"DATE",function(){return gr.a}),n.d(K,"DAY",function(){return gr.b}),n.d(K,"DAYOFYEAR",function(){return gr.c}),n.d(K,"HOURS",function(){return gr.d}),n.d(K,"MILLISECONDS",function(){return gr.e}),n.d(K,"MINUTES",function(){return gr.f}),n.d(K,"MONTH",function(){return gr.g}),n.d(K,"QUARTER",function(){return gr.h}),n.d(K,"SECONDS",function(){return gr.i}),n.d(K,"TIME_UNITS",function(){return gr.j}),n.d(K,"WEEK",function(){return gr.k}),n.d(K,"YEAR",function(){return gr.l}),n.d(K,"dayofyear",function(){return gr.m}),n.d(K,"timeBin",function(){return gr.n}),n.d(K,"timeFloor",function(){return gr.o}),n.d(K,"timeInterval",function(){return gr.p}),n.d(K,"timeOffset",function(){return gr.q}),n.d(K,"timeSequence",function(){return gr.r}),n.d(K,"timeUnitSpecifier",function(){return gr.s}),n.d(K,"timeUnits",function(){return gr.t}),n.d(K,"utcFloor",function(){return gr.u}),n.d(K,"utcInterval",function(){return gr.v}),n.d(K,"utcOffset",function(){return gr.w}),n.d(K,"utcSequence",function(){return gr.x}),n.d(K,"utcdayofyear",function(){return gr.y}),n.d(K,"utcweek",function(){return gr.z}),n.d(K,"week",function(){return gr.A}),n.d(K,"format",function(){return jn.a}),n.d(K,"formats",function(){return jn.b}),n.d(K,"inferType",function(){return jn.c}),n.d(K,"inferTypes",function(){return jn.d}),n.d(K,"loader",function(){return jn.e}),n.d(K,"read",function(){return jn.f}),n.d(K,"responseType",function(){return jn.g}),n.d(K,"typeParsers",function(){return jn.h}),n.d(K,"Bounds",function(){return zs}),n.d(K,"CanvasHandler",function(){return Ge}),n.d(K,"CanvasRenderer",function(){return Pt}),n.d(K,"Gradient",function(){return nv}),n.d(K,"GroupItem",function(){return hg}),n.d(K,"Handler",function(){return p}),n.d(K,"Item",function(){return Yp}
7820),n.d(K,"Marks",function(){return $f}),n.d(K,"RenderType",function(){return yr}),n.d(K,"Renderer",function(){return D}),n.d(K,"ResourceLoader",function(){return c0}),n.d(K,"SVGHandler",function(){return dn}),n.d(K,"SVGRenderer",function(){return xt}),n.d(K,"SVGStringRenderer",function(){return kr}),n.d(K,"Scenegraph",function(){return Dy}),n.d(K,"boundClip",function(){return Bo}),n.d(K,"boundContext",function(){return h0}),n.d(K,"boundItem",function(){return nm}),n.d(K,"boundMark",function(){return Bb}),n.d(K,"boundStroke",function(){return Id}),n.d(K,"domChild",function(){return cl}),n.d(K,"domClear",function(){return Pd}),n.d(K,"domCreate",function(){return Ml}),n.d(K,"domFind",function(){return jb}),n.d(K,"font",function(){return tm}),n.d(K,"fontFamily",function(){return Wh}),n.d(K,"fontSize",function(){return ul}),n.d(K,"intersect",function(){return Pr}),n.d(K,"intersectBoxLine",function(){return Me}),n.d(K,"intersectPath",function(){return X}),n.d(K,"intersectPoint",function(){return oe}),n.d(K,"intersectRule",function(){return Se}),n.d(K,"lineHeight",function(){return Ou}),n.d(K,"markup",function(){return Fe}),n.d(K,"multiLineOffset",function(){return au}),n.d(K,"pathCurves",function(){return Dd}),n.d(K,"pathEqual",function(){return ma}),n.d(K,"pathParse",function(){return qp}),n.d(K,"pathRectangle",function(){return _y}),n.d(K,"pathRender",function(){return Kp}),n.d(K,"pathSymbols",function(){return Nd}),n.d(K,"pathTrail",function(){return Lf}),n.d(K,"point",function(){return x}),n.d(K,"renderModule",function(){return jr}),n.d(K,"resetSVGClipId",function(){return Ey}),n.d(K,"resetSVGDefIds",function(){return Fa}),n.d(K,"sceneEqual",function(){return Jo}),n.d(K,"sceneFromJSON",function(){return A1}),n.d(K,"scenePickVisit",function(){return qn}),n.d(K,"sceneToJSON",function(){return Oy}),n.d(K,"sceneVisit",function(){return Ln}),n.d(K,"sceneZOrder",function(){return In}),n.d(K,"serializeXML",function(){return Ve}),n.d(K,"textMetrics",function(){return ou});var re={};n.d(re,"invalidSpec",function(){return xoe}),n.d(re,"FIT_NON_SINGLE",function(){return woe}),n.d(re,"containerSizeNonSingle",function(){return _oe}),n.d(re,"containerSizeNotCompatibleWithAutosize",function(){return koe}),n.d(re,"droppingFit",function(){return Eoe}),n.d(re,"cannotProjectOnChannelWithoutField",function(){return Coe}),n.d(re,"cannotProjectAggregate",function(){return Soe}),n.d(re,"nearestNotSupportForContinuous",function(){return Aoe}),n.d(re,"selectionNotSupported",function(){return Ooe}),n.d(re,"selectionNotFound",function(){return Doe}),n.d(re,"SCALE_BINDINGS_CONTINUOUS",function(){return Toe}),n.d(re,"LEGEND_BINDINGS_PROJECT_LENGTH",function(){return Noe}),n.d(re,"noSameUnitLookup",function(){return Ioe}),n.d(re,"noSuchRepeatedValue",function(){return Moe}),n.d(re,"columnsNotSupportByRowCol",function(){return Foe}),n.d(re,"CONCAT_CANNOT_SHARE_AXIS",function(){return Roe}),n.d(re,"unrecognizedParse",function(){return Boe}),n.d(re,"differentParse",function(){return Poe}),n.d(re,"invalidTransformIgnored",function(){return joe}),n.d(re,"NO_FIELDS_NEEDS_AS",function(){return Loe}),n.d(re,"customFormatTypeNotAllowed",function(){return zoe}),n.d(re,"encodingOverridden",function(){return Uoe}),n.d(re,"projectionOverridden",function(){return Woe}),n.d(re,"REPLACE_ANGLE_WITH_THETA",function(){return Voe}),n.d(re,"primitiveChannelDef",function(){return $oe}),n.d(re,"invalidFieldType",function(){return Hoe}),n.d(re,"invalidFieldTypeForCountAggregate",function(){return qoe}),n.d(re,"invalidAggregate",function(){return Goe}),n.d(re,"missingFieldType",function(){return Koe}),n.d(re,"droppingColor",function(){return Yoe}),n.d(re,"emptyFieldDef",function(){return Xoe}),n.d(re,"latLongDeprecated",function(){return Joe}),n.d(re,"LINE_WITH_VARYING_SIZE",function(){return Qoe}),n.d(re,"incompatibleChannel",function(){return Zoe}),n.d(re,"invalidEncodingChannel",function(){return eae}),n.d(re,"facetChannelShouldBeDiscrete",function(){return tae}),n.d(re,"facetChannelDropped",function(){return nae}),n.d(re,"discreteChannelCannotEncode",function(){return rae}),n.d(re,"lineWithRange",function(){return iae}),n.d(re,"orientOverridden",function(){return oae}),n.d(re,"CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN",function(){return aae}),n.d(re,"RANGE_STEP_DEPRECATED",function(){return sae}),n.d(re,"cannotUseScalePropertyWithNonColor",function(){return uae}),n.d(re,"unaggregateDomainHasNoEffectForRawField",function(){return cae}),n.d(re,"unaggregateDomainWithNonSharedDomainOp",function(){return lae}),n.d(re,"unaggregatedDomainWithLogScale",function(){return fae}),n.d(re,"cannotApplySizeToNonOrientedMark",function(){return dae}),n.d(re,"scaleTypeNotWorkWithChannel",function(){return hae}),n.d(re,"scaleTypeNotWorkWithFieldDef",function(){return pae}),n.d(re,"scalePropertyNotWorkWithScaleType",function(){return mae}),n.d(re,"scaleTypeNotWorkWithMark",function(){return gae}),n.d(re,"stepDropped",function(){return vae}),n.d(re,"mergeConflictingProperty",function(){return yae}),n.d(re,"mergeConflictingDomainProperty",function(){return bae}),n.d(re,"independentScaleMeansIndependentGuide",function(){return xae}),n.d(re,"domainSortDropped",function(){return wae}),n.d(re,"MORE_THAN_ONE_SORT",function(){return _ae}),n.d(re,"FACETED_INDEPENDENT_DIFFERENT_SOURCES",function(){return kae}),n.d(re,"FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES",function(){return Eae}),n.d(re,"FACETED_INDEPENDENT_SAME_SOURCE",function(){return Cae}),n.d(re,"INVALID_CHANNEL_FOR_AXIS",function(){return Sae}),n.d(re,"cannotStackRangedMark",function(){return Aae}),n.d(re,"cannotStackNonLinearScale",function(){return Oae}),n.d(re,"stackNonSummativeAggregate",function(){return Dae}
7820),n.d(re,"invalidTimeUnit",function(){return Tae}),n.d(re,"droppedDay",function(){return Nae}),n.d(re,"errorBarCenterAndExtentAreNotNeeded",function(){return Iae}),n.d(re,"errorBarCenterIsUsedWithWrongExtent",function(){return Mae}),n.d(re,"errorBarContinuousAxisHasCustomizedAggregate",function(){return Fae}),n.d(re,"errorBarCenterIsNotNeeded",function(){return Rae}),n.d(re,"errorBand1DNotSupport",function(){return Bae}),n.d(re,"channelRequiredForBinned",function(){return Pae}),n.d(re,"domainRequiredForThresholdScale",function(){return jae});var ce={};n.d(ce,"compile",function(){return ile}),n.d(ce,"extractTransforms",function(){return ale}),n.d(ce,"normalize",function(){return mW}),n.d(ce,"version",function(){return sle});var pe={};n.d(pe,"dark",function(){return ule}),n.d(pe,"excel",function(){return cle}),n.d(pe,"fivethirtyeight",function(){return lle}),n.d(pe,"ggplot2",function(){return fle}),n.d(pe,"googlecharts",function(){return gle}),n.d(pe,"latimes",function(){return dle}),n.d(pe,"quartz",function(){return hle}),n.d(pe,"urbaninstitute",function(){return mle}),n.d(pe,"version",function(){return vle}),n.d(pe,"vox",function(){return ple});/*! 7821 * https://github.com/Starcounter-Jack/JSON-Patch 7822 * (c) 2017 Joachim Wester 7823 * MIT license 7824 */var ke=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,l){u.__proto__=l}||function(u,l){for(var d in l)l.hasOwnProperty(d)&&(u[d]=l[d])})(t,r)};return function(t,r){function u(){this.constructor=t}e(t,r),t.prototype=r===null?Object.create(r):(u.prototype=r.prototype,new u)}}(),Ce=Object.prototype.hasOwnProperty;function be(e,t){return Ce.call(e,t)}function $e(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);t=[];for(var u in e)be(e,u)&&t.push(u);return t}function ht(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Dt(e){for(var t,r=0,u=e.length;r<u;){if(!((t=e.charCodeAt(r))>=48&&t<=57))return!1;r++}return!0}function Ut(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ee(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ot(e,t){var r=[e];for(var u in t){var l=typeof t[u]=="object"?JSON.stringify(t[u],null,2):t[u];l!==void 0&&r.push(u+": "+l)}return r.join(` 7825`)}var zt=function(e){function t(r,u,l,d,b){var k=this.constructor,T=e.call(this,Ot(r,{name:u,index:l,operation:d,tree:b}))||this;return T.name=u,T.index=l,T.operation=d,T.tree=b,Object.setPrototypeOf(T,k.prototype),T.message=Ot(r,{name:u,index:l,operation:d,tree:b}),T}return ke(t,e),t}(Error),Mt=zt,Ke=ht,Tt={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var u=e[t];return delete e[t],{newDocument:r,removed:u}},replace:function(e,t,r){var u=e[t];return e[t]=this.value,{newDocument:r,removed:u}},move:function(e,t,r){var u=yt(r,this.path);u&&(u=ht(u));var l=bt(r,{op:"remove",path:this.from}).removed;return bt(r,{op:"add",path:this.path,value:l}),{newDocument:r,removed:u}},copy:function(e,t,r){var u=yt(r,this.from);return bt(r,{op:"add",path:this.path,value:ht(u)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:sn(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},vt={add:function(e,t,r){return Dt(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var u=e[t];return e[t]=this.value,{newDocument:r,removed:u}},move:Tt.move,copy:Tt.copy,test:Tt.test,_get:Tt._get};function yt(e,t){if(t=="")return e;var r={op:"_get",path:t};return bt(e,r),r.value}function bt(e,t,r,u,l,d){if(r===void 0&&(r=!1),u===void 0&&(u=!0),l===void 0&&(l=!0),d===void 0&&(d=0),r&&(typeof r=="function"?r(t,0,e,t.path):Ze(t,0)),t.path===""){var b={newDocument:e};if(t.op==="add")return b.newDocument=t.value,b;if(t.op==="replace")return b.newDocument=t.value,b.removed=e,b;if(t.op==="move"||t.op==="copy")return b.newDocument=yt(e,t.from),t.op==="move"&&(b.removed=e),b;if(t.op==="test"){if(b.test=sn(e,t.value),b.test===!1)throw new Mt("Test operation failed","TEST_OPERATION_FAILED",d,t,e);return b.newDocument=e,b}if(t.op==="remove")return b.removed=e,b.newDocument=null,b;if(t.op==="_get")return t.value=e,b;if(r)throw new Mt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",d,t,e);return b}u||(e=ht(e));var k=(t.path||"").split("/"),T=e,j=1,$=k.length,G=void 0,te=void 0,se=void 0;for(se=typeof r=="function"?r:Ze;;){if((te=k[j])&&te.indexOf("~")!=-1&&(te=Ee(te)),l&&te=="__proto__")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(r&&G===void 0&&(T[te]===void 0?G=k.slice(0,j).join("/"):j==$-1&&(G=t.path),G!==void 0&&se(t,0,e,G)),j++,Array.isArray(T)){if(te==="-")te=T.length;
vendor: 1,360 bytes, line 7825
7825else{if(r&&!Dt(te))throw new Mt("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",d,t,e);Dt(te)&&(te=~~te)}if(j>=$){if(r&&t.op==="add"&&te>T.length)throw new Mt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",d,t,e);if((b=vt[t.op].call(t,T,te,e)).test===!1)throw new Mt("Test operation failed","TEST_OPERATION_FAILED",d,t,e);return b}}else if(j>=$){if((b=Tt[t.op].call(t,T,te,e)).test===!1)throw new Mt("Test operation failed","TEST_OPERATION_FAILED",d,t,e);return b}if(T=T[te],r&&j<$&&(!T||typeof T!="object"))throw new Mt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",d,t,e)}}function Ht(e,t,r,u,l){if(u===void 0&&(u=!0),l===void 0&&(l=!0),r&&!Array.isArray(t))throw new Mt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");u||(e=ht(e));for(var d=new Array(t.length),b=0,k=t.length;b<k;b++)d[b]=bt(e,t[b],r,!0,l,b),e=d[b].newDocument;return d.newDocument=e,d}function _t(e,t,r){var u=bt(e,t);if(u.test===!1)throw new Mt("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return u.newDocument}function Ze(e,t,r,u){if(typeof e!="object"||e===null||Array.isArray(e))throw new Mt("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);
7825if(!Tt[e.op])throw new Mt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r);if(typeof e.path!="string")throw new Mt("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Mt('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Mt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Mt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&function k(T){if(T===void 0)return!0;if(T){if(Array.isArray(T)){for(var j=0,$=T.length;j<$;j++)if(k(T[j]))return!0}else if(typeof T=="object"){var G=$e(T),te=G.length;for(j=0;j<te;j++)if(k(T[G[j]]))return!0}}return!1}(e.value))throw new Mt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var l=e.path.split("/").length,d=u.split("/").length;if(l!==d+1&&l!==d)throw new Mt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==u)throw new Mt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var b=Vt([{op:"_get",path:e.from,value:void 0}],r);if(b&&b.name==="OPERATION_PATH_UNRESOLVABLE")throw new Mt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}function Vt(e,t,r){try{if(!Array.isArray(e))throw new Mt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Ht(ht(t),ht(e),r||!0);else{r=r||Ze;for(var u=0;u<e.length;u++)r(e[u],u,t,void 0)}}catch(l){if(l instanceof Mt)return l;throw l}}function sn(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r,u,l,d=Array.isArray(e),b=Array.isArray(t);if(d&&b){if((u=e.length)!=t.length)return!1;for(r=u;r--!=0;)if(!sn(e[r],t[r]))return!1;return!0}if(d!=b)return!1;var k=Object.keys(e);if((u=k.length)!==Object.keys(t).length)return!1;for(r=u;r--!=0;)if(!t.hasOwnProperty(k[r]))return!1;for(r=u;r--!=0;)if(!sn(e[l=k[r]],t[l]))return!1;return!0}return e!=e&&t!=t}/*! 7826 * https://github.com/Starcounter-Jack/JSON-Patch 7827 * (c) 2017 Joachim Wester 7828 * MIT license 7829 */var yn=new WeakMap,Yt=function(){return function(e){this.observers=new Map,this.obj=e}}(),We=function(){return function(e,t){this.callback=e,this.observer=t}}();function Ye(e,t){t.unobserve()}function He(e,t){var r,u=function(k){return yn.get(k)}(e);if(u){var l=function(k,T){return k.observers.get(T)}(u,t);r=l&&l.observer}else u=new Yt(e),yn.set(e,u);if(r)return r;if(r={},u.value=ht(e),t){r.callback=t,r.next=null;var d=function(){dt(r)},b=function(){clearTimeout(r.next),r.next=setTimeout(d)};typeof window<"u"&&(window.addEventListener("mouseup",b),window.addEventListener("keyup",b),window.addEventListener("mousedown",b),window.addEventListener("keydown",b),window.addEventListener("change",b))}return r.patches=[],r.object=e,r.unobserve=function(){dt(r),clearTimeout(r.next),function(k,T){k.observers.delete(T.callback)}(u,r),typeof window<"u"&&(window.removeEventListener("mouseup",b),window.removeEventListener("keyup",b),window.removeEventListener("mousedown",b),window.removeEventListener("keydown",b),window.removeEventListener("change",b))},u.observers.set(t,new We(t,r)),r}function dt(e,t){t===void 0&&(t=!1);var r=yn.get(e.object);It(r.value,e.object,e.patches,"",t),e.patches.length&&Ht(r.value,e.patches);var u=e.patches;return u.length>0&&(e.patches=[],e.callback&&e.callback(u)),u}function It(e,t,r,u,l){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var d=$e(t),b=$e(e),k=!1,T=b.length-1;T>=0;T--){var j=e[G=b[T]];if(!be(t,G)||t[G]===void 0&&j!==void 0&&Array.isArray(t)===!1)Array.isArray(e)===Array.isArray(t)?(l&&r.push({op:"test",path:u+"/"+Ut(G),value:ht(j)}),r.push({op:"remove",path:u+"/"+Ut(G)}),k=!0):(l&&r.push({op:"test",path:u,value:e}),r.push({op:"replace",path:u,value:t}));else{var $=t[G];typeof j=="object"&&j!=null&&typeof $=="object"&&$!=null&&Array.isArray(j)===Array.isArray($)?It(j,$,r,u+"/"+Ut(G),l):j!==$&&(l&&r.push({op:"test",path:u+"/"+Ut(G),value:ht(j)}),r.push({op:"replace",path:u+"/"+Ut(G),value:ht($)}))}}if(k||d.length!=b.length)for(T=0;T<d.length;T++){var G;be(e,G=d[T])||t[G]===void 0||r.push({op:"add",path:u+"/"+Ut(G),value:ht(t[G])})}}}function ct(e,t,r){r===void 0&&(r=!1);var u=[];return It(e,t,u,"",r),u}Object.assign({},s,h,{JsonPatchError:zt,deepClone:ht,escapePathComponent:Ut,unescapePathComponent:Ee});
vendor: 5,147 bytes, line 7829
7829var on=n(133),Xt=n.n(on),En=n(179),xe=n(1),jn=n(63),nr=n(44);function ar(e){const t=e||xe.y,r=[],u={};return r.add=l=>{const d=t(l);return u[d]||(u[d]=1,r.push(l)),r},r.remove=l=>{const d=t(l);if(u[d]){u[d]=0;const b=r.indexOf(l);b>=0&&r.splice(b,1)}return r},r}async function cr(e,t){try{await t(e)}catch(r){e.error(r)}}const Er=Symbol("vega_id");let hn=1;function rn(e){return!(!e||!fn(e))}function fn(e){return e[Er]}function Xn(e,t){return e[Er]=t,e}function Fn(e){const t=e===Object(e)?e:{data:e};return fn(t)?t:Xn(t,hn++)}function Ar(e){return Dr(e,Fn({}))}function Dr(e,t){for(const r in e)t[r]=e[r];return t}function xr(e,t){return Xn(t,fn(e))}function fi(e,t){return e?t?(r,u)=>e(r,u)||fn(t(r))-fn(t(u)):(r,u)=>e(r,u)||fn(r)-fn(u):null}function ci(e){return e&&e.constructor===qr}function qr(){const e=[],t=[],r=[],u=[],l=[];let d=null,b=!1;return{constructor:qr,insert(k){const T=Object(xe.i)(k),j=T.length;for(let $=0;$<j;++$)e.push(T[$]);return this},remove(k){const T=Object(xe.E)(k)?u:t,j=Object(xe.i)(k),$=j.length;for(let G=0;G<$;++G)T.push(j[G]);return this},modify(k,T,j){const $={field:T,value:Object(xe.m)(j)};return Object(xe.E)(k)?($.filter=k,l.push($)):($.tuple=k,r.push($)),this},encode(k,T){return Object(xe.E)(k)?l.push({filter:k,field:T}):r.push({tuple:k,field:T}),this},clean(k){return d=k,this},reflow(){return b=!0,this},pulse(k,T){const j={},$={};let G,te,se,he,ve,Be;for(G=0,te=T.length;G<te;++G)j[fn(T[G])]=1;for(G=0,te=t.length;G<te;++G)j[fn(ve=t[G])]=-1;for(G=0,te=u.length;G<te;++G)he=u[G],T.forEach(Ue=>{he(Ue)&&(j[fn(Ue)]=-1)});for(G=0,te=e.length;G<te;++G)Be=fn(ve=e[G]),j[Be]?j[Be]=1:k.add.push(Fn(e[G]));for(G=0,te=T.length;G<te;++G)ve=T[G],j[fn(ve)]<0&&k.rem.push(ve);function ze(Ue,st,ut){ut?Ue[st]=ut(Ue):k.encode=st,b||($[fn(Ue)]=Ue)}for(G=0,te=r.length;G<te;++G)ve=(se=r[G]).tuple,he=se.field,(Be=j[fn(ve)])>0&&(ze(ve,he,se.value),k.modifies(he));for(G=0,te=l.length;G<te;++G)se=l[G],he=se.filter,T.forEach(Ue=>{he(Ue)&&j[fn(Ue)]>0&&ze(Ue,se.field,se.value)}),k.modifies(se.field);if(b)k.mod=t.length||u.length?T.filter(Ue=>j[fn(Ue)]>0):T.slice();else for(Be in $)k.mod.push($[Be]);return(d||d==null&&(t.length||u.length))&&k.clean(!0),k}}}const mi="_:mod:_";function Ir(){Object.defineProperty(this,mi,{writable:!0,value:{}})}Ir.prototype={set(e,t,r,u){const l=this,d=l[e],b=l[mi];return t!=null&&t>=0?(d[t]!==r||u)&&(d[t]=r,b[t+":"+e]=-1,b[e]=-1):(d!==r||u)&&(l[e]=r,b[e]=Object(xe.B)(r)?1+r.length:-1),l},modified(e,t){const r=this[mi];if(!arguments.length){for(const u in r)if(r[u])return!0;return!1}if(Object(xe.B)(e)){for(let u=0;u<e.length;++u)if(r[e[u]])return!0;return!1}return t!=null&&t>=0?t+1<r[e]||!!r[t+":"+e]:!!r[e]},clear(){return this[mi]={},this}};let ti=0;const ri=new Ir;function yi(e,t,r,u){this.id=++ti,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),r&&this.parameters(r,u)}function na(e){return function(t){const r=this.flags;return arguments.length===0?!!(r&e):(this.flags=t?r|e:r&~e,this)}}yi.prototype={targets(){return this._targets||(this._targets=ar(xe.x))},set(e){return this.value!==e?(this.value=e,1):0},skip:na(1),modified:na(2),parameters(e,t,r){t=t!==!1;const u=this._argval=this._argval||new Ir,l=this._argops=this._argops||[],d=[];let b,k,T,j;const $=(G,te,se)=>{se instanceof yi?(se!==this&&(t&&se.targets().add(this),d.push(se)),l.push({op:se,name:G,index:te})):u.set(G,te,se)};for(b in e)if(k=e[b],b==="pulse")Object(xe.i)(k).forEach(G=>{G instanceof yi?G!==this&&(G.targets().add(this),d.push(G)):Object(xe.o)("Pulse parameters must be operator instances.")}),this.source=k;else if(Object(xe.B)(k))for(u.set(b,-1,Array(T=k.length)),j=0;j<T;++j)$(b,j,k[j]);else $(b,-1,k);return this.marshall().clear(),r&&(l.initonly=!0),d},marshall(e){const t=this._argval||ri,r=this._argops;let u,l,d,b;if(r){const k=r.length;for(l=0;l<k;++l)b=(d=(u=r[l]).op).modified()&&d.stamp===e,t.set(u.name,u.index,d.value,b);if(r.initonly){for(l=0;l<k;++l)(u=r[l]).op.targets().remove(this);this._argops=null,this._update=null}}return t},detach(){const e=this._argops;let t,r,u;if(e)for(t=0,r=e.length;t<r;++t)(u=e[t].op)._targets&&u._targets.remove(this);this.pulse=null,this.source=null},evaluate(e){const t=this._update;if(t){const r=this.marshall(e.stamp),u=t.call(this,r,e);if(r.clear(),u!==this.value)this.value=u;else if(!this.modified())return e.StopPropagation}},run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e}};let co=0;function $i(e,t,r){this.id=++co,this.value=null,r&&(this.receive=r),e&&(this._filter=e),t&&(this._apply=t)}function Ft(e,t,r){return new $i(e,t,r)}$i.prototype={_filter:xe.Ia,_apply:xe.y,targets(){return this._targets||(this._targets=ar(xe.x))},consume(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive(e){if(this._filter(e)){const t=this.value=this._apply(e),r=this._targets,u=r?r.length:0;for(let l=0;l<u;++l)r[l].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter(e){const t=Ft(e);return this.targets().add(t),t},apply(e){const t=Ft(null,e);return this.targets().add(t),t}
7829,merge(){const e=Ft();this.targets().add(e);for(let t=0,r=arguments.length;t<r;++t)arguments[t].targets().add(e);return e},throttle(e){let t=-1;return this.filter(()=>{const r=Date.now();return r-t>e?(t=r,1):0})},debounce(e){const t=Ft();return this.targets().add(Ft(null,null,Object(xe.n)(e,r=>{const u=r.dataflow;t.receive(r),u&&u.run&&u.run()}))),t},between(e,t){let r=!1;return e.targets().add(Ft(null,null,()=>r=!0)),t.targets().add(Ft(null,null,()=>r=!1)),this.filter(()=>r)},detach(){this._filter=xe.Ia,this._targets=null}};const Qr={skip:!0};function Zt(e,t,r,u,l,d){const b=Object(xe.p)({},d,Qr);let k,T;Object(xe.E)(r)||(r=Object(xe.m)(r)),u===void 0?k=j=>e.touch(r(j)):Object(xe.E)(u)?(T=new yi(null,u,l,!1),k=j=>{T.evaluate(j);const $=r(j),G=T.value;ci(G)?e.pulse($,G,d):e.update($,G,b)}):k=j=>e.update(r(j),u,b),t.apply(k)}function _e(e,t,r,u,l,d){if(u===void 0)t.targets().add(r);else{const b=d||{},k=new yi(null,function(T,j){return j=Object(xe.E)(j)?j:Object(xe.m)(j),T?function($,G){const te=j($,G);return T.skip()||(T.skip(te!==this.value).value=te),te}:j}(r,u),l,!1);k.modified(b.force),k.rank=t.rank,t.targets().add(k),r&&(k.skip(!0),k.value=r.value,k.targets().add(r),e.connect(r,[k]))}}const ge={};function Ae(e,t,r){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=r||null}function Ie(e,t){const r=[];return Object(xe.Ka)(e,t,u=>r.push(u)),r}function it(e,t){const r={};return e.visit(t,u=>{r[fn(u)]=1}),u=>r[fn(u)]?null:u}function St(e,t){return e?(r,u)=>e(r,u)&&t(r,u):t}function Jt(e,t,r,u){const l=this,d=r.length;let b=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=u||null,this.pulses=r;for(let k=0;k<d;++k){const T=r[k];if(T.stamp===t){if(T.fields){const j=l.fields||(l.fields={});for(const $ in T.fields)j[$]=1}T.changed(l.ADD)&&(b|=l.ADD),T.changed(l.REM)&&(b|=l.REM),T.changed(l.MOD)&&(b|=l.MOD)}}this.changes=b}function kn(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}Ae.prototype={StopPropagation:ge,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(e){return new Ae(this.dataflow).init(this,e)},clone(){const e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||((e=new Ae(this.dataflow).init(this)).add=e.source,e.rem=[]),e},init(e,t){const r=this;return r.stamp=e.stamp,r.encode=e.encode,!e.fields||64&t||(r.fields=e.fields),1&t?(r.addF=e.addF,r.add=e.add):(r.addF=null,r.add=[]),2&t?(r.remF=e.remF,r.rem=e.rem):(r.remF=null,r.rem=[]),4&t?(r.modF=e.modF,r.mod=e.mod):(r.modF=null,r.mod=[]),32&t?(r.srcF=null,r.source=null):(r.srcF=e.srcF,r.source=e.source,e.cleans&&(r.cleans=e.cleans)),r},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow(e){if(e)return this.fork(7).reflow();const t=this.add.length,r=this.source&&this.source.length;return r&&r!==t&&(this.mod=this.source,t&&this.filter(4,it(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return Object(xe.B)(e)?e.forEach(r=>t[r]=!0):t[e]=!0,this},modified(e,t){const r=this.fields;return!(!t&&!this.mod.length||!r)&&(arguments.length?Object(xe.B)(e)?e.some(u=>r[u]):r[e]:!!r)},filter(e,t){const r=this;return 1&e&&(r.addF=St(r.addF,t)),2&e&&(r.remF=St(r.remF,t)),4&e&&(r.modF=St(r.modF,t)),16&e&&(r.srcF=St(r.srcF,t)),r},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=Ie(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=Ie(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=Ie(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const r=this,u=t;if(16&e)return Object(xe.Ka)(r.source,r.srcF,u),r;1&e&&Object(xe.Ka)(r.add,r.addF,u),2&e&&Object(xe.Ka)(r.rem,r.remF,u),4&e&&Object(xe.Ka)(r.mod,r.modF,u);const l=r.source;if(8&e&&l){const d=r.add.length+r.mod.length;d===l.length||(d?Object(xe.Ka)(l,it(r,5),u):Object(xe.Ka)(l,r.srcF,u))}return r}},Object(xe.z)(Jt,Ae,{fork(e){const t=new Ae(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,r=>t.add.push(r)),e&t.REM&&this.visit(t.REM,r=>t.rem.push(r)),e&t.MOD&&this.visit(t.MOD,r=>t.mod.push(r))),t},changed(e){return this.changes&e},modified(e){const t=this,r=t.fields;return r&&t.changes&t.MOD?Object(xe.B)(e)?e.some(u=>r[u]):r[e]:0},filter(){Object(xe.o)("MultiPulse does not support filtering.")},materialize(){Object(xe.o)("MultiPulse does not support materialization.")},visit(e,t){const r=this,u=r.pulses,l=u.length;let d=0;if(e&r.SOURCE)for(;d<l;++d)u[d].visit(e,t);else for(;d<l;++d)u[d].stamp===r.stamp&&u[d].visit(e,t);return r}});const rr={skip:!1,force:!1};function Bn(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:r=>(t.push(r),Gn(t,0,t.length-1,e)),pop:()=>{const r=t.pop();let u;return t.length?(u=t[0],t[0]=r,function(l,d,b){const k=d,T=l.length,j=l[d];let $,G=1+(d<<1);for(;G<T;)($=G+1)<T&&b(l[G],l[$])>=0&&(G=$),l[d]=l[G],G=1+((d=G)<<1);l[d]=j,Gn(l,k,d,b)}(t,0,e)):u=r,u}}}function Gn(e,t,r,u){let l,d;const b=e[r];for(;r>t&&u(b,l=e[d=r-1>>1])<0;)e[r]=l,r=d;return e[r]=b}function Zn(){this.logger(Object(xe.M)()),this.logLevel(xe.b),this._clock=0,this._rank=0,this._locale=Object(nr.a)();try{this._loader=Object(jn.e)()}catch{}this._touched=ar(xe.x),this._input={},this._pulse=null,this._heap=Bn((e,t)=>e.qrank-t.qrank),this._postrun=[]}function Gt(e){return function(){return this._log[e].apply(this,arguments)}}
7829function Wt(e,t){yi.call(this,e,null,t)}Zn.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:Gt("error"),warn:Gt("warn"),info:Gt("info"),debug:Gt("debug"),logLevel:Gt("level"),cleanThreshold:1e4,add:function(e,t,r,u){let l,d=1;return e instanceof yi?l=e:e&&e.prototype instanceof yi?l=new e:Object(xe.E)(e)?l=new yi(null,e):(d=0,l=new yi(e,t)),this.rank(l),d&&(u=r,r=t),r&&this.connect(l,l.parameters(r,u)),this.touch(l),l},connect:function(e,t){const r=e.rank,u=t.length;for(let l=0;l<u;++l)if(r<t[l].rank)return void this.rerank(e)},rank:function(e){e.rank=++this._rank},rerank:function(e){const t=[e];let r,u,l;for(;t.length;)if(this.rank(r=t.pop()),u=r._targets)for(l=u.length;--l>=0;)t.push(r=u[l]),r===e&&Object(xe.o)("Cycle detected in dataflow graph.")},pulse:function(e,t,r){this.touch(e,r||rr);const u=new Ae(this,this._clock+(this._pulse?0:1)),l=e.pulse&&e.pulse.source||[];return u.target=e,this._input[e.id]=t.pulse(u,l),this},touch:function(e,t){const r=t||rr;return this._pulse?this._enqueue(e):this._touched.add(e),r.skip&&e.skip(!0),this},update:function(e,t,r){const u=r||rr;return(e.set(t)||u.force)&&this.touch(e,u),this},changeset:qr,ingest:function(e,t,r){return t=this.parse(t,r),this.pulse(e,this.changeset().insert(t))},parse:function(e,t){const r=this.locale();return Object(jn.f)(e,t,r.timeParse,r.utcParse)},preload:async function(e,t,r){const u=this,l=u._pending||function(b){let k;const T=new Promise(j=>k=j);return T.requests=0,T.done=()=>{--T.requests==0&&(b._pending=null,k(b))},b._pending=T}(u);l.requests+=1;const d=await u.request(t,r);return u.pulse(e,u.changeset().remove(xe.Ia).insert(d.data||[])),l.done(),d},request:async function(e,t){const r=this;let u,l=0;try{u=await r.loader().load(e,{context:"dataflow",response:Object(jn.g)(t&&t.type)});try{u=r.parse(u,t)}catch(d){l=-2,r.warn("Data ingestion failed",e,d)}}catch(d){l=-1,r.warn("Loading failed",e,d)}return{data:u,status:l}},events:function(e,t,r,u){const l=this,d=Ft(r,u),b=function(j){j.dataflow=l;try{d.receive(j)}catch($){l.error($)}finally{l.run()}};let k;const T=(k=typeof e=="string"&&typeof document<"u"?document.querySelectorAll(e):Object(xe.i)(e)).length;for(let j=0;j<T;++j)k[j].addEventListener(t,b);return d},on:function(e,t,r,u,l){return(e instanceof yi?_e:Zt)(this,e,t,r,u,l),this},evaluate:async function(e,t,r){const u=this,l=[];if(u._pulse)return kn(u);if(u._pending&&await u._pending,t&&await cr(u,t),!u._touched.length)return u.debug("Dataflow invoked, but nothing to do."),u;const d=++u._clock;u._pulse=new Ae(u,d,e),u._touched.forEach($=>u._enqueue($,!0)),u._touched=ar(xe.x);let b,k,T,j=0;try{for(;u._heap.size()>0;)(b=u._heap.pop()).rank===b.qrank?((k=b.run(u._getPulse(b,e))).then?k=await k:k.async&&(l.push(k.async),k=ge),k!==ge&&b._targets&&b._targets.forEach($=>u._enqueue($)),++j):u._enqueue(b,!0)}catch($){u._heap.clear(),T=$}if(u._input={},u._pulse=null,u.debug(`Pulse ${d}: ${j} operators`),T&&(u._postrun=[],u.error(T)),u._postrun.length){const $=u._postrun.sort((G,te)=>te.priority-G.priority);u._postrun=[];for(let G=0;G<$.length;++G)await cr(u,$[G].callback)}return r&&await cr(u,r),l.length&&Promise.all(l).then($=>u.runAsync(null,()=>{$.forEach(G=>{try{G(u)}catch(te){u.error(te)}})})),u},run:function(e,t,r){return this._pulse?kn(this):(this.evaluate(e,t,r),this)},runAsync:async function(e,t,r){for(;this._running;)await this._running;const u=()=>this._running=null;return(this._running=this.evaluate(e,t,r)).then(u,u),this._running},runAfter:function(e,t,r){if(this._pulse||t)this._postrun.push({priority:r||0,callback:e});else try{e(this)}catch(u){this.error(u)}},_enqueue:function(e,t){const r=e.stamp<this._clock;r&&(e.stamp=this._clock),(r||t)&&(e.qrank=e.rank,this._heap.push(e))},_getPulse:function(e,t){const r=e.source,u=this._clock;return r&&Object(xe.B)(r)?new Jt(this,u,r.map(l=>l.pulse),t):this._input[e.id]||function(l,d){return d&&d.stamp===l.stamp?d:(l=l.fork(),d&&d!==ge&&(l.source=d.source),l)}(this._pulse,r&&r.pulse)}},Object(xe.z)(Wt,yi,{run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?this.skip(!1):t=this.evaluate(e),(t=t||e).then?t=t.then(r=>this.pulse=r):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),r=this.transform(t,e);return t.clear(),r},transform(){}});const Sn={};function un(e){const t=qe(e);return t&&t.Definition||null}function qe(e){return e=e&&e.toLowerCase(),Object(xe.w)(Sn,e)?Sn[e]:null}var $n=n(87);function er(e,t){let r;if(t===void 0)for(const u of e)u!=null&&(r<u||r===void 0&&u>=u)&&(r=u);else{let u=-1;for(let l of e)(l=t(l,++u,e))!=null&&(r<l||r===void 0&&l>=l)&&(r=l)}return r}function sr(e,t){let r;if(t===void 0)for(const u of e)u!=null&&(r>u||r===void 0&&u>=u)&&(r=u);else{let u=-1;for(let l of e)(l=t(l,++u,e))!=null&&(r>l||r===void 0&&l>=l)&&(r=l)}return r}function pr(e,t,r){const u=e[t];e[t]=e[r],e[r]=u}var Zr=function(e){return e===null?NaN:+e};function Mr(e,t,r){if(u=(e=Float64Array.from(function*(k,T){if(T===void 0)for(let j of k)j!=null&&(j=+j)>=j&&(yield j);else{let j=-1;for(let $ of k)($=T($,++j,k))!=null&&($=+$)>=$&&(yield $)}}(e,r))).length){if((t=+t)<=0||u<2)return sr(e);if(t>=1)return er(e);var u,l=(u-1)*t,d=Math.floor(l),b=er(function k(T,j,$=0,G=T.length-1,te=$n.a){for(;G>$;){if(G-$>600){const Be=G-$+1,ze=j-$+1,Ue=Math.log(Be),st=.5*Math.exp(2*Ue/3),ut=.5*Math.sqrt(Ue*st*(Be-st)/Be)*(ze-Be/2<0?-1:1);k(T,j,Math.max($,Math.floor(j-ze*st/Be+ut)),Math.min(G,Math.floor(j+(Be-ze)*st/Be+ut)),te)}const se=T[j];let he=$,ve=G;for(pr(T,$,j),te(T[G],se)>0&&pr(T,$,G);he<ve;){for(pr(T,he,ve),++he,--ve;te(T[he],se)<0;)++he;for(;te(T[ve],se)>0;)--ve}te(T[$],se)===0?pr(T,$,ve):pr(T,++ve,G),ve<=j&&($=ve+1),j<=ve&&(G=ve-1)}return T}(e,d).subarray(0,d+1));return b+(sr(e.subarray(d+1))-b)*(l-d)}}function Ii(e,t,r=Zr){if(u=e.length){if((t=+t)<=0||u<2)return+r(e[0],0,e);if(t>=1)return+r(e[u-1],u-1,e);var u,l=(u-1)*t,d=Math.floor(l),b=+r(e[d],d,e);return b+(+r(e[d+1],d+1,e)-b)*(l-d)}}var Lo=function(e,t){return Mr(e,.5,t)};function*Ai(e,t){if(t==null)for(let r of e)r!=null&&r!==""&&(r=+r)>=r&&(yield r);else{let r=-1;for(let u of e)(u=t(u,++r,e))!=null&&u!==""&&(u=+u)>=u&&(yield u)}}function ko(e,t,r){const u=Float64Array.from(Ai(e,r));return u.sort($n.a),t.map(l=>Ii(u,l))}function Ji(e,t){return ko(e,[.25,.5,.75],t)}function ai(e,t){const r=e.length,u=function(b,k){const T=function(j,$){let G,te=0,se=0,he=0;if($===void 0)for(let ve of j)ve!=null&&(ve=+ve)>=ve&&(he+=(G=ve-se)*(ve-(se+=G/++te)));else{let ve=-1;for(let Be of j)(Be=$(Be,++ve,j))!=null&&(Be=+Be)>=Be&&(he+=(G=Be-se)*(Be-(se+=G/++te)))}if(te>1)return he/(te-1)}(b,k);return T&&Math.sqrt(T)}(e,t),l=Ji(e,t),d=(l[2]-l[0])/1.34;return 1.06*(Math.min(u,d)||u||Math.abs(l[0])||1)*Math.pow(r,-.2)}function Yr(e){const t=e.maxbins||20,r=e.base||10,u=Math.log(r),l=e.divide||[5,2];let d,b,k,T,j,$,G=e.extent[0],te=e.extent[1];const se=e.span||te-G||Math.abs(G)||1;if(e.step)d=e.step;else if(e.steps){for(T=se/t,j=0,$=e.steps.length;j<$&&e.steps[j]<T;++j);d=e.steps[Math.max(0,j-1)]}else{for(b=Math.ceil(Math.log(t)/u),k=e.minstep||0,d=Math.max(k,Math.pow(r,Math.round(Math.log(se)/u)-b));
7829Math.ceil(se/d)>t;)d*=r;for(j=0,$=l.length;j<$;++j)(T=d/l[j])>=k&&se/T<=t&&(d=T)}const he=(T=Math.log(d))>=0?0:1+~~(-T/u),ve=Math.pow(r,-he-1);return(e.nice||e.nice===void 0)&&(G=G<(T=Math.floor(G/d+ve)*d)?T-d:T,te=Math.ceil(te/d)*d),{start:G,stop:te===G?G+d:te,step:d}}var Hn=Math.random;function ki(e){Hn=e}function lo(e,t,r,u){if(!e.length)return[void 0,void 0];const l=Float64Array.from(Ai(e,u)),d=l.length,b=t;let k,T,j,$;for(j=0,$=Array(b);j<b;++j){for(k=0,T=0;T<d;++T)k+=l[~~(Hn()*d)];$[j]=k/d}return $.sort($n.a),[Mr($,r/2),Mr($,1-r/2)]}function Kr(e,t,r,u){u=u||(te=>te);const l=e.length,d=new Float64Array(l);let b,k=0,T=1,j=u(e[0]),$=j,G=j+t;for(;T<l;++T){if((b=u(e[T]))>=G){for($=(j+$)/2;k<T;++k)d[k]=$;G=b+t,j=b}$=b}for($=(j+$)/2;k<T;++k)d[k]=$;return r?function(te,se){const he=te.length;let ve,Be,ze=0,Ue=1;for(;te[ze]===te[Ue];)++Ue;for(;Ue<he;){for(ve=Ue+1;te[Ue]===te[ve];)++ve;if(te[Ue]-te[Ue-1]<se){for(Be=Ue+(ze+ve-Ue-Ue>>1);Be<Ue;)te[Be++]=te[Ue];for(;Be>Ue;)te[Be--]=te[ze]}ze=Ue,Ue=ve}return te}(d,t+t/4):d}function Io(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}}function Ko(e,t){let r,u,l;t==null&&(t=e,e=0);const d={min(b){return arguments.length?(l=u-(r=b||0),d):r},max(b){return arguments.length?(l=(u=b||0)-r,d):u},sample:()=>r+Math.floor(l*Hn()),pdf:b=>b===Math.floor(b)&&b>=r&&b<u?1/l:0,cdf(b){const k=Math.floor(b);return k<r?0:k>=u?1:(k-r+1)/l},icdf:b=>b>=0&&b<=1?r-1+Math.floor(b*l):NaN};return d.min(e).max(t)}const Eo=Math.sqrt(2*Math.PI),Yo=Math.SQRT2;let vs=NaN;function gu(e,t){e=e||0,t=t??1;let r,u,l=0,d=0;if(vs==vs)l=vs,vs=NaN;else{do r=(l=2*Hn()-1)*l+(d=2*Hn()-1)*d;while(r===0||r>1);l*=u=Math.sqrt(-2*Math.log(r)/r),vs=d*u}return e+l*t}function pp(e,t,r){r=r??1;const u=(e-(t||0))/r;return Math.exp(-.5*u*u)/(r*Eo)}function fo(e,t,r){const u=(e-(t=t||0))/(r=r??1),l=Math.abs(u);let d;if(l>37)d=0;else{const b=Math.exp(-l*l/2);l<7.07106781186547?(d=b*((((((.0352624965998911*l+.700383064443688)*l+6.37396220353165)*l+33.912866078383)*l+112.079291497871)*l+221.213596169931)*l+220.206867912376),d/=((((((.0883883476483184*l+1.75566716318264)*l+16.064177579207)*l+86.7807322029461)*l+296.564248779674)*l+637.333633378831)*l+793.826512519948)*l+440.413735824752):d=b/(l+1/(l+2/(l+3/(l+4/(l+.65)))))/2.506628274631}return u>0?1-d:d}function yl(e,t,r){return e<0||e>1?NaN:(t||0)+(r??1)*Yo*function(u){let l,d=-Math.log((1-u)*(1+u));return d<6.25?l=1.6536545626831027+(l=.24015818242558962+(l=(l=(l=.00018673420803405714+(l=(l=(l=42347877827932404e-23+(l=(l=(l=10512122733215323e-25+(l=(l=(l=26335093153082323e-28+(l=(l=(l=6637638134358324e-30+(l=20972767875968562e-33+(l=(l=11157877678025181e-33+(l=128584807152564e-32+(l=(l=-364441206401782e-35)*(d-=3.125)-16850591381820166e-35)*d)*d)*d-1333171662854621e-31)*d)*d)*d-4054566272975207e-29)*d-8151934197605472e-29)*d)*d-12975133253453532e-27)*d-5415412054294628e-26)*d)*d-4112633980346984e-24)*d-29070369957882005e-24)*d)*d-13654692000834679e-22)*d-13882523362786469e-21)*d)*d-.000740702534166267)*d-.006033670871430149)*d)*d:d<16?(d=Math.sqrt(d)-3.25,l=3.0838856104922208+(l=1.0052589676941592+(l=.005370914553590064+(l=(l=.002491442096107851+(l=(l=.0009532893797373805+(l=(l=24031110387097894e-21+(l=6828485145957318e-20+(l=(l=12475304481671779e-21+(l=29234449089955446e-22+(l=(l=15027403968909828e-22+(l=18239629214389228e-24+(l=(l=9075656193888539e-23+(l=22137376921775787e-25)*d)*d-27517406297064545e-23)*d)*d)*d-4013867526981546e-21)*d)*d)*d-47318229009055734e-21)*d)*d)*d-.0003550375203628475)*d)*d-.0016882755560235047)*d)*d-.003751208507569241)*d)*d)*d):Number.isFinite(d)?(d=Math.sqrt(d)-5,l=4.849906401408584+(l=1.0103004648645344+(l=(l=(l=7599527703001776e-20+(l=(l=4526062597223154e-21+(l=(l=22900482228026655e-23+(l=(l=2914795345090108e-23+(l=(l=761570120807834e-23+(l=(l=15076572693500548e-25+(l=(l=-27109920616438573e-27)*d-2555641816996525e-25)*d)*d-3789465440126737e-24)*d)*d-1496002662714924e-23)*d)*d-6771199775845234e-23)*d)*d-99298272942317e-20)*d)*d-1968177810553167e-20)*d)*d-.00021503011930044477)*d-.00013871931833623122)*d)*d):l=1/0,l*u}(2*e-1)}function Tc(e,t){let r,u;const l={mean(d){return arguments.length?(r=d||0,l):r},stdev(d){return arguments.length?(u=d??1,l):u},sample:()=>gu(r,u),pdf:d=>pp(d,r,u),cdf:d=>fo(d,r,u),icdf:d=>yl(d,r,u)};return l.mean(e).stdev(t)}function Wl(e,t){const r=Tc();let u=0;const l={data(d){return arguments.length?(e=d,u=d?d.length:0,l.bandwidth(t)):e},bandwidth(d){return arguments.length?(!(t=d)&&e&&(t=ai(e)),l):t},sample:()=>e[~~(Hn()*u)]+t*r.sample(),pdf(d){let b=0,k=0;for(;k<u;++k)b+=r.pdf((d-e[k])/t);return b/t/u},cdf(d){let b=0,k=0;for(;k<u;++k)b+=r.cdf((d-e[k])/t);return b/u},icdf(){throw Error("KDE icdf not supported.")}};return l.data(e)}
vendor: 4,708 bytes, line 7829
7829function Jc(e,t){return e=e||0,t=t??1,Math.exp(e+gu()*t)}function Vl(e,t,r){if(e<=0)return 0;t=t||0,r=r??1;const u=(Math.log(e)-t)/r;return Math.exp(-.5*u*u)/(r*Eo*e)}function Sm(e,t,r){return fo(Math.log(e),t,r)}function Qs(e,t,r){return Math.exp(yl(e,t,r))}function Zd(e,t){let r,u;const l={mean(d){return arguments.length?(r=d||0,l):r},stdev(d){return arguments.length?(u=d??1,l):u},sample:()=>Jc(r,u),pdf:d=>Vl(d,r,u),cdf:d=>Sm(d,r,u),icdf:d=>Qs(d,r,u)};return l.mean(e).stdev(t)}function Am(e,t){let r,u=0;const l={weights(d){return arguments.length?(r=function(b){const k=[];let T,j=0;for(T=0;T<u;++T)j+=k[T]=b[T]==null?1:+b[T];for(T=0;T<u;++T)k[T]/=j;return k}(t=d||[]),l):t},distributions(d){return arguments.length?(d?(u=d.length,e=d):(u=0,e=[]),l.weights(t)):e},sample(){const d=Hn();let b=e[u-1],k=r[0],T=0;for(;T<u-1;k+=r[++T])if(d<k){b=e[T];break}return b.sample()},pdf(d){let b=0,k=0;for(;k<u;++k)b+=r[k]*e[k].pdf(d);return b},cdf(d){let b=0,k=0;for(;k<u;++k)b+=r[k]*e[k].cdf(d);return b},icdf(){throw Error("Mixture icdf not supported.")}};return l.distributions(e).weights(t)}function Qc(e,t){return t==null&&(t=e??1,e=0),e+(t-e)*Hn()}function eh(e,t,r){return r==null&&(r=t??1,t=0),e>=t&&e<=r?1/(r-t):0}function mp(e,t,r){return r==null&&(r=t??1,t=0),e<t?0:e>r?1:(e-t)/(r-t)}function $l(e,t,r){return r==null&&(r=t??1,t=0),e>=0&&e<=1?t+e*(r-t):NaN}function nd(e,t){let r,u;const l={min(d){return arguments.length?(r=d||0,l):r},max(d){return arguments.length?(u=d??1,l):u},sample:()=>Qc(r,u),pdf:d=>eh(d,r,u),cdf:d=>mp(d,r,u),icdf:d=>$l(d,r,u)};return t==null&&(t=e??1,e=0),l.min(e).max(t)}function ys(e,t,r,u){const l=u-e*e,d=Math.abs(l)<1e-24?0:(r-e*t)/l;return[t-d*e,d]}function vf(e,t,r,u){e=e.filter(se=>{let he=t(se),ve=r(se);return he!=null&&(he=+he)>=he&&ve!=null&&(ve=+ve)>=ve}),u&&e.sort((se,he)=>t(se)-t(he));const l=e.length,d=new Float64Array(l),b=new Float64Array(l);let k,T,j,$=0,G=0,te=0;for(j of e)d[$]=k=+t(j),b[$]=T=+r(j),G+=(k-G)/++$,te+=(T-te)/$;for($=0;$<l;++$)d[$]-=G,b[$]-=te;return[d,b,G,te]}function Ha(e,t,r,u){let l,d,b=-1;for(const k of e)l=t(k),d=r(k),l!=null&&(l=+l)>=l&&d!=null&&(d=+d)>=d&&u(l,d,++b)}function bl(e,t,r,u,l){let d=0,b=0;return Ha(e,t,r,(k,T)=>{const j=T-l(k),$=T-u;d+=j*j,b+=$*$}),1-d/b}function Zs(e,t,r){let u=0,l=0,d=0,b=0,k=0;Ha(e,t,r,($,G)=>{u+=($-u)/++k,l+=(G-l)/k,d+=($*G-d)/k,b+=($*$-b)/k});const T=ys(u,l,d,b),j=$=>T[0]+T[1]*$;return{coef:T,predict:j,rSquared:bl(e,t,r,l,j)}}function ls(e,t,r){let u=0,l=0,d=0,b=0,k=0;Ha(e,t,r,($,G)=>{++k,$=Math.log($),u+=($-u)/k,l+=(G-l)/k,d+=($*G-d)/k,b+=($*$-b)/k});const T=ys(u,l,d,b),j=$=>T[0]+T[1]*Math.log($);return{coef:T,predict:j,rSquared:bl(e,t,r,l,j)}}function xl(e,t,r){const[u,l,d,b]=vf(e,t,r);let k,T,j,$=0,G=0,te=0,se=0,he=0;Ha(e,t,r,(Ue,st)=>{k=u[he++],T=Math.log(st),$+=(st*T-$)/he,G+=((j=k*st)-G)/he,te+=(j*T-te)/he,se+=(k*j-se)/he});const[ve,Be]=ys(G/b,$/b,te/b,se/b),ze=Ue=>Math.exp(ve+Be*(Ue-d));return{coef:[Math.exp(ve-Be*d),Be],predict:ze,rSquared:bl(e,t,r,b,ze)}}function rd(e,t,r){let u=0,l=0,d=0,b=0,k=0,T=0;Ha(e,t,r,(G,te)=>{const se=Math.log(G),he=Math.log(te);u+=(se-u)/++T,l+=(he-l)/T,d+=(se*he-d)/T,b+=(se*se-b)/T,k+=(te-k)/T});const j=ys(u,l,d,b),$=G=>j[0]*Math.pow(G,j[1]);return j[0]=Math.exp(j[0]),{coef:j,predict:$,rSquared:bl(e,t,r,k,$)}}function wl(e,t,r){const[u,l,d,b]=vf(e,t,r),k=u.length;let T,j,$,G,te=0,se=0,he=0,ve=0,Be=0;for(T=0;T<k;)j=u[T],$=l[T++],te+=((G=j*j)-te)/T,se+=(G*j-se)/T,he+=(G*G-he)/T,ve+=(j*$-ve)/T,Be+=(G*$-Be)/T;const ze=he-te*te,Ue=te*ze-se*se,st=(Be*te-ve*se)/Ue,ut=(ve*ze-Be*se)/Ue,mt=-st*te,pt=Ct=>st*(Ct-=d)*Ct+ut*Ct+mt+b;return{coef:[mt-ut*d+st*d*d+b,ut-2*st*d,st],predict:pt,rSquared:bl(e,t,r,b,pt)}}function vc(e,t,r,u){if(u===1)return Zs(e,t,r);if(u===2)return wl(e,t,r);const[l,d,b,k]=vf(e,t,r),T=l.length,j=[],$=[],G=u+1;let te,se,he,ve,Be;for(te=0;te<G;++te){for(he=0,ve=0;he<T;++he)ve+=Math.pow(l[he],te)*d[he];for(j.push(ve),Be=new Float64Array(G),se=0;se<G;++se){for(he=0,ve=0;he<T;++he)ve+=Math.pow(l[he],te+se);Be[se]=ve}$.push(Be)}$.push(j);const ze=function(st){const ut=st.length-1,mt=[];let pt,Ct,Et,mn,An;for(pt=0;pt<ut;++pt){for(mn=pt,Ct=pt+1;Ct<ut;++Ct)Math.abs(st[pt][Ct])>Math.abs(st[pt][mn])&&(mn=Ct);for(Et=pt;Et<ut+1;++Et)An=st[Et][pt],st[Et][pt]=st[Et][mn],st[Et][mn]=An;for(Ct=pt+1;Ct<ut;++Ct)for(Et=ut;Et>=pt;Et--)st[Et][Ct]-=st[Et][pt]*st[pt][Ct]/st[pt][pt]}for(Ct=ut-1;Ct>=0;--Ct){for(An=0,Et=Ct+1;Et<ut;++Et)An+=st[Et][Ct]*mt[Et];mt[Ct]=(st[ut][Ct]-An)/st[Ct][Ct]}return mt}($),Ue=st=>{st-=b;let ut=k+ze[0]+ze[1]*st+ze[2]*st*st;for(te=3;te<G;++te)ut+=ze[te]*Math.pow(st,te);return ut};return{coef:function(st,ut,mt,pt){const Ct=Array(st);let Et,mn,An,xn;for(Et=0;Et<st;++Et)Ct[Et]=0;for(Et=st-1;Et>=0;
vendor: 4,116 bytes, line 7829
7829--Et)for(An=ut[Et],xn=1,Ct[Et]+=An,mn=1;mn<=Et;++mn)xn*=(Et+1-mn)/mn,Ct[Et-mn]+=An*Math.pow(mt,mn)*xn;return Ct[0]+=pt,Ct}(G,ze,-b,k),predict:Ue,rSquared:bl(e,t,r,k,Ue)}}const gp=2,th=1e-12;function nh(e,t,r,u){const[l,d,b,k]=vf(e,t,r,!0),T=l.length,j=Math.max(2,~~(u*T)),$=new Float64Array(T),G=new Float64Array(T),te=new Float64Array(T).fill(1);for(let se=-1;++se<=gp;){const he=[0,j-1];for(let Be=0;Be<T;++Be){const ze=l[Be],Ue=he[0],st=he[1],ut=ze-l[Ue]>l[st]-ze?Ue:st;let mt=0,pt=0,Ct=0,Et=0,mn=0;const An=1/Math.abs(l[ut]-ze||1);for(let Un=Ue;Un<=st;++Un){const Kn=l[Un],Qn=d[Un],ir=Ja(Math.abs(ze-Kn)*An)*te[Un],Nr=Kn*ir;mt+=ir,pt+=Nr,Ct+=Qn*ir,Et+=Qn*Nr,mn+=Kn*Nr}const[xn,Wn]=ys(pt/mt,Ct/mt,Et/mt,mn/mt);$[Be]=xn+Wn*ze,G[Be]=Math.abs(d[Be]-$[Be]),vp(l,Be+1,he)}if(se===gp)break;const ve=Lo(G);if(Math.abs(ve)<th)break;for(let Be,ze,Ue=0;Ue<T;++Ue)Be=G[Ue]/(6*ve),te[Ue]=Be>=1?th:(ze=1-Be*Be)*ze}return function(se,he,ve,Be){const ze=se.length,Ue=[];let st,ut=0,mt=0,pt=[];for(;ut<ze;++ut)st=se[ut]+ve,pt[0]===st?pt[1]+=(he[ut]-pt[1])/++mt:(mt=0,pt[1]+=Be,pt=[st,he[ut]],Ue.push(pt));return pt[1]+=Be,Ue}(l,$,b,k)}function Ja(e){return(e=1-e*e*e)*e*e}function vp(e,t,r){const u=e[t];let l=r[0],d=r[1]+1;if(!(d>=e.length))for(;t>l&&e[d]-u<=u-e[l];)r[0]=++l,r[1]=d,++d}const Om=.5*Math.PI/180;function rh(e,t,r,u){r=r||25,u=Math.max(r,u||200);const l=ve=>[ve,e(ve)],d=t[0],b=t[1],k=b-d,T=k/u,j=[l(d)],$=[];if(r===u){for(let ve=1;ve<u;++ve)j.push(l(d+ve/r*k));return j.push(l(b)),j}$.push(l(b));for(let ve=r;--ve>0;)$.push(l(d+ve/r*k));let G=j[0],te=$[$.length-1];const se=1/k,he=function(ve,Be){let ze=ve,Ue=ve;const st=Be.length;for(let ut=0;ut<st;++ut){const mt=Be[ut][1];mt<ze&&(ze=mt),mt>Ue&&(Ue=mt)}return 1/(Ue-ze)}(G[1],$);for(;te;){const ve=l((G[0]+te[0])/2);ve[0]-G[0]>=T&&ih(G,ve,te,se,he)>Om?$.push(ve):(G=te,j.push(te),$.pop()),te=$[$.length-1]}return j}function ih(e,t,r,u,l){const d=Math.atan2(l*(r[1]-e[1]),u*(r[0]-e[0])),b=Math.atan2(l*(t[1]-e[1]),u*(t[0]-e[0]));return Math.abs(d-b)}var vu=function(e,t,r){e=+e,t=+t,r=(l=arguments.length)<2?(t=e,e=0,1):l<3?1:+r;for(var u=-1,l=0|Math.max(0,Math.ceil((t-e)/r)),d=new Array(l);++u<l;)d[u]=e+u*r;return d},oh=n(108),gr=n(11);function Nc(e){return e&&e.length?e.length===1?e[0]:function(t){return r=>{const u=t.length;let l=1,d=String(t[0](r));for(;l<u;++l)d+="|"+t[l](r);return d}}(e):function(){return""}}function Rg(e,t,r){return r||e+(t?"_"+t:"")}const Bg=()=>{},ah={init:Bg,add:Bg,rem:Bg,idx:0},id={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.sum,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t<e.min||e.min===void 0)&&(e.min=t)},rem:(e,t)=>
7829{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,r)=>{t<e.min&&(e.argmin=r)},rem:(e,t)=>{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,r)=>{t>e.max&&(e.argmax=r)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3}},Dm=Object.keys(id);function yp(e,t){return id[e](t)}function bp(e,t){return e.idx-t.idx}function eo(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.init(this))}function ca(e,t){e!=null&&e!==""?e==e&&(++this.valid,this._ops.forEach(r=>r.add(this,e,t))):++this.missing}function xp(e,t){e!=null&&e!==""?e==e&&(--this.valid,this._ops.forEach(r=>r.rem(this,e,t))):--this.missing}function N0(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function sh(e,t){const r=t||xe.y,u=function(b){const k={};b.forEach(j=>k[j.name]=j);const T=j=>{j.req&&j.req.forEach($=>{k[$]||T(k[$]=id[$]())})};return b.forEach(T),Object.values(k).sort(bp)}(e),l=e.slice().sort(bp);function d(b){this._ops=u,this._out=l,this.cell=b,this.init()}return d.prototype.init=eo,d.prototype.add=ca,d.prototype.rem=xp,d.prototype.set=N0,d.prototype.get=r,d.fields=e.map(b=>b.out),d}function Tm(e){this._key=e?Object(xe.u)(e):fn,this.reset()}Dm.forEach(e=>{id[e]=function(t,r){return u=>Object(xe.p)({name:t,out:u||t},ah,r)}(e,id[e])});const yu=Tm.prototype;function _l(e){Wt.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}yu.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},yu.add=function(e){this._add.push(e)},yu.rem=function(e){this._rem.push(e)},yu.values=function(){if(this._get=null,this._rem.length===0)return this._add;const e=this._add,t=this._rem,r=this._key,u=e.length,l=t.length,d=Array(u-l),b={};let k,T,j;for(k=0;k<l;++k)b[r(t[k])]=1;for(k=0,T=0;k<u;++k)b[r(j=e[k])]?b[r(j)]=0:d[T++]=j;return this._rem=[],this._add=d},yu.distinct=function(e){const t=this.values(),r={};let u,l=t.length,d=0;for(;--l>=0;)u=e(t[l])+"",Object(xe.w)(r,u)||(r[u]=1,++d);return d},yu.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),r=Object(xe.r)(t,e);this._ext=[t[r[0]],t[r[1]]],this._get=e}return this._ext},yu.argmin=function(e){return this.extent(e)[0]||{}},yu.argmax=function(e){return this.extent(e)[1]||{}},yu.min=function(e){const t=this.extent(e)[0];return t!=null?e(t):void 0},yu.max=function(e){const t=this.extent(e)[1];return t!=null?e(t):void 0},yu.quartile=function(e){return this._get===e&&this._q||(this._q=Ji(this.values(),e),this._get=e),this._q},yu.q1=function(e){return this.quartile(e)[0]},yu.q2=function(e){return this.quartile(e)[1]},yu.q3=function(e){return this.quartile(e)[2]},yu.ci=function(e){return this._get===e&&this._ci||(this._ci=lo(this.values(),1e3,.05,e),this._get=e),this._ci},yu.ci0=function(e){return this.ci(e)[0]},yu.ci1=function(e){return this.ci(e)[1]},_l.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Dm},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},Object(xe.z)(_l,Wt,{transform(e,t){const r=this,u=t.fork(t.NO_SOURCE|t.NO_FIELDS),l=e.modified();return r.stamp=u.stamp,r.value&&(l||t.modified(r._inputs,!0))?(r._prev=r.value,r.value=l?r.init(e):{},t.visit(t.SOURCE,d=>r.add(d))):(r.value=r.value||r.init(e),t.visit(t.REM,d=>r.rem(d)),t.visit(t.ADD,d=>r.add(d))),u.modifies(r._outputs),r._drop=e.drop!==!1,e.cross&&r._dims.length>1&&(r._drop=!1,r.cross()),t.clean()&&r._drop&&u.clean(!0).runAfter(()=>this.clean()),r.changes(u)},cross(){const e=this,t=e.value,r=e._dnames,u=r.map(()=>({})),l=r.length;function d(b){let k,T,j,$;for(k in b)for(j=b[k].tuple,T=0;T<l;++T)u[T][$=j[r[T]]]=$}d(e._prev),d(t),function b(k,T,j){const $=r[j],G=u[j++];for(const te in G){const se=k?k+"|"+te:te;T[$]=G[te],j<l?b(se,T,j):t[se]||e.cell(se,T)}}("",{},0)},init(e){const t=this._inputs=[],r=this._outputs=[],u={};function l(Be){const ze=Object(xe.i)(Object(xe.g)(Be)),Ue=ze.length;let st,ut=0;for(;ut<Ue;++ut)u[st=ze[ut]]||(u[st]=1,t.push(st))}this._dims=Object(xe.i)(e.groupby),this._dnames=this._dims.map(Be=>{const ze=Object(xe.h)(Be);return l(Be),r.push(ze),ze}),this.cellkey=e.key?e.key:Nc(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const d=e.fields||[null],b=e.ops||["count"],k=e.as||[],T=d.length,j={};let $,G,te,se,he,ve;for(T!==b.length&&Object(xe.o)("Unmatched number of fields and aggregate ops."),ve=0;ve<T;
7829++ve)$=d[ve],G=b[ve],$==null&&G!=="count"&&Object(xe.o)("Null aggregate field specified."),he=Rg(G,se=Object(xe.h)($),k[ve]),r.push(he),G!=="count"?((te=j[se])||(l($),(te=j[se]=[]).field=$,this._measures.push(te)),G!=="count"&&(this._countOnly=!1),te.push(yp(G,he))):this._counts.push(he);return this._measures=this._measures.map(Be=>sh(Be,Be.field)),{}},cellkey:Nc(),cell(e,t){let r=this.value[e];return r?r.num===0&&this._drop&&r.stamp<this.stamp?(r.stamp=this.stamp,this._adds[this._alen++]=r):r.stamp<this.stamp&&(r.stamp=this.stamp,this._mods[this._mlen++]=r):(r=this.value[e]=this.newcell(e,t),this._adds[this._alen++]=r),r},newcell(e,t){const r={key:e,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[e]),stamp:this.stamp,store:!1};if(!this._countOnly){const u=this._measures,l=u.length;r.agg=Array(l);for(let d=0;d<l;++d)r.agg[d]=new u[d](r)}return r.store&&(r.data=new Tm),r},newtuple(e,t){const r=this._dnames,u=this._dims,l=u.length,d={};for(let b=0;b<l;++b)d[r[b]]=u[b](e);return t?xr(t.tuple,d):Fn(d)},clean(){const e=this.value;for(const t in e)e[t].num===0&&delete e[t]},add(e){const t=this.cellkey(e),r=this.cell(t,e);if(r.num+=1,this._countOnly)return;r.store&&r.data.add(e);const u=r.agg;for(let l=0,d=u.length;l<d;++l)u[l].add(u[l].get(e),e)},rem(e){const t=this.cellkey(e),r=this.cell(t,e);if(r.num-=1,this._countOnly)return;r.store&&r.data.rem(e);const u=r.agg;for(let l=0,d=u.length;l<d;++l)u[l].rem(u[l].get(e),e)},celltuple(e){const t=e.tuple,r=this._counts;e.store&&e.data.values();for(let u=0,l=r.length;u<l;++u)t[r[u]]=e.num;if(!this._countOnly){const u=e.agg;for(let l=0,d=u.length;l<d;++l)u[l].set(t)}return t},changes(e){const t=this._adds,r=this._mods,u=this._prev,l=this._drop,d=e.add,b=e.rem,k=e.mod;let T,j,$,G;if(u)for(j in u)T=u[j],l&&!T.num||b.push(T.tuple);for($=0,G=this._alen;$<G;++$)d.push(this.celltuple(t[$])),t[$]=null;for($=0,G=this._mlen;$<G;++$)((T=r[$]).num===0&&l?b:k).push(this.celltuple(T)),r[$]=null;return this._alen=this._mlen=0,this._prev=null,e}});function Nm(e){Wt.call(this,null,e)}function Pg(e,t,r){const u=e;let l=t||[],d=r||[],b={},k=0;return{add:T=>d.push(T),remove:T=>b[u(T)]=++k,size:()=>l.length,data:(T,j)=>(k&&(l=l.filter($=>!b[u($)]),b={},k=0),j&&T&&l.sort(T),d.length&&(l=T?Object(xe.O)(T,l,d.sort(T)):l.concat(d),d=[]),l)}}function jg(e){Wt.call(this,[],e)}function I0(e){yi.call(this,null,M0,e)}function M0(e){return this.value&&!e.modified()?this.value:Object(xe.l)(e.fields,e.orders)}function yf(e){Wt.call(this,null,e)}function As(e){Wt.call(this,null,e)}Nm.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},Object(xe.z)(Nm,Wt,{transform(e,t){const r=e.interval!==!1,u=this._bins(e),l=u.start,d=u.step,b=e.as||["bin0","bin1"],k=b[0],T=b[1];let j;return j=e.modified()?(t=t.reflow(!0)).SOURCE:t.modified(Object(xe.g)(e.field))?t.ADD_MOD:t.ADD,t.visit(j,r?$=>{const G=u($);$[k]=G,$[T]=G==null?null:l+d*(1+(G-l)/d)}:$=>$[k]=u($)),t.modifies(r?b:k)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,r=Yr(e),u=r.step;let l,d,b=r.start,k=b+Math.ceil((r.stop-b)/u)*u;(l=e.anchor)!=null&&(d=l-(b+u*Math.floor((l-b)/u)),b+=d,k+=d);const T=function(j){let $=Object(xe.Ea)(t(j));return $==null?null:$<b?-1/0:$>k?1/0:($=Math.max(b,Math.min($,k-u)),b+u*Math.floor(1e-14+($-b)/u))};return T.start=b,T.stop=r.stop,T.step=u,this.value=Object(xe.f)(T,Object(xe.g)(t),e.name||"bin_"+Object(xe.h)(t))}}),jg.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},Object(xe.z)(jg,Wt,{transform(e,t){const r=t.fork(t.ALL),u=Pg(fn,this.value,r.materialize(r.ADD).add),l=e.sort,d=t.changed()||l&&(e.modified("sort")||t.modified(l.fields));return r.visit(r.REM,u.remove),this.modified(d),this.value=r.source=u.data(fi(l),d),t.source&&t.source.root&&(this.value.root=t.source.root),r}}),Object(xe.z)(I0,yi),yf.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},Object(xe.z)(yf,Wt,{transform(e,t){const r=G=>te=>{for(var se,he=function(ze,Ue,st){switch(Ue){case"upper":ze=ze.toUpperCase();break;case"lower":ze=ze.toLowerCase()}return ze.match(st)}(k(te),e.case,d)||[],ve=0,Be=he.length;ve<Be;++ve)b.test(se=he[ve])||G(se)},u=this._parameterCheck(e,t),l=this._counts,d=this._match,b=this._stop,k=e.field,T=e.as||["text","count"],j=r(G=>l[G]=1+(l[G]||0)),$=r(G=>l[G]-=1);return u?t.visit(t.SOURCE,j):(t.visit(t.ADD,j),t.visit(t.REM,$)),this._finish(t,T)},_parameterCheck(e,t){let r=!1;return!e.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),r=!0),!e.modified("pattern")&&this._match||(this._match=new RegExp(e.pattern||"[\\w']+","g"),r=!0),(e.modified("field")||t.modified(e.field.fields))&&(r=!0),r&&(this._counts={}),r},_finish(e,t){const r=this._counts,u=this._tuples||(this._tuples={}),l=t[0],d=t[1],b=e.fork(e.NO_SOURCE|e.NO_FIELDS);let k,T,j;for(k in r)T=u[k],j=r[k]||0,!T&&j?(u[k]=T=Fn({}),T[l]=k,T[d]=j,b.add.push(T)):j===0?(T&&b.rem.push(T),r[k]=null,u[k]=null):T[d]!==j&&(T[d]=j,b.mod.push(T));return b.modifies(t)}}),As.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},Object(xe.z)(As,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE),u=e.as||["a","b"],l=u[0],d=u[1],b=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let k=this.value;return b?(k&&(r.rem=k),k=t.materialize(t.SOURCE).source,r.add=this.value=function(T,j,$,G){for(var te,se,he=[],ve={},Be=T.length,ze=0;ze<Be;++ze)for(ve[j]=se=T[ze],te=0;te<Be;
7829++te)ve[$]=T[te],G(ve)&&(he.push(Fn(ve)),(ve={})[j]=se);return he}(k,l,d,e.filter||xe.Ia)):r.mod=k,r.source=this.value,r.modifies(u)}});const wp={kde:Wl,mixture:Am,normal:Tc,lognormal:Zd,uniform:nd},et="distributions",Zc="function",uh="field";function Im(e){Wt.call(this,null,e)}const ra=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],ia={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:ra},{name:"weights",type:"number",array:!0}]};function Aa(e,t){return e?e.map((r,u)=>t[u]||Object(xe.h)(r)):null}function fs(e,t,r){const u=[],l=G=>G(T);let d,b,k,T,j,$;if(t==null)u.push(e.map(r));else for(d={},b=0,k=e.length;b<k;++b)T=e[b],($=d[j=t.map(l)])||(d[j]=$=[],$.dims=j,u.push($)),$.push(r(T));return u}Im.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:ra.concat(ia)},{name:"as",type:"string",array:!0,default:["value","density"]}]},Object(xe.z)(Im,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const u=function j($,G){const te=$[Zc];Object(xe.w)(wp,te)||Object(xe.o)("Unknown distribution function: "+te);const se=wp[te]();for(const he in $)he===uh?se.data(($.from||G()).map($[he])):he===et?se[he]($[he].map(ve=>j(ve,G))):typeof se[he]===Zc&&se[he]($[he]);return se}(e.distribution,function(j){return()=>j.materialize(j.SOURCE).source}(t)),l=e.steps||e.minsteps||25,d=e.steps||e.maxsteps||200;let b=e.method||"pdf";b!=="pdf"&&b!=="cdf"&&Object(xe.o)("Invalid density method: "+b),e.extent||u.data||Object(xe.o)("Missing density extent parameter."),b=u[b];const k=e.as||["value","density"],T=rh(b,e.extent||Object(xe.q)(u.data()),l,d).map(j=>{const $={};return $[k[0]]=j[0],$[k[1]]=j[1],Fn($)});this.value&&(r.rem=this.value),this.value=r.add=r.source=T}return r}});function Ic(e){Wt.call(this,null,e)}Ic.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function ds(e){yi.call(this,null,Hl,e),this.modified(!0)}function Hl(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:Object(xe.f)(r=>t(r,e),Object(xe.g)(t),Object(xe.h)(t))}function sc(e){Wt.call(this,[void 0,void 0],e)}function Bt(e,t){yi.call(this,e),this.parent=t,this.count=0}function zo(e){Wt.call(this,{},e),this._keys=Object(xe.t)();const t=this._targets=[];t.active=0,t.forEach=r=>{for(let u=0,l=t.active;u<l;++u)r(t[u],u,t)}}function qa(e){yi.call(this,null,Os,e)}function Os(e){return this.value&&!e.modified()?this.value:Object(xe.B)(e.name)?Object(xe.i)(e.name).map(t=>Object(xe.u)(t)):Object(xe.u)(e.name,e.as)}function Qo(e){Wt.call(this,Object(xe.t)(),e)}function bu(e){Wt.call(this,[],e)}function Or(e){Wt.call(this,[],e)}function Vu(e){Wt.call(this,null,e)}function uc(e){Wt.call(this,[],e)}Object(xe.z)(Ic,Wt,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const r=t.materialize(t.SOURCE).source,u=fs(t.source,e.groupby,xe.y),l=e.smooth||!1,d=e.field,b=e.step||((he,ve)=>Object(xe.Z)(Object(xe.q)(he,ve))/30)(r,d),k=fi((he,ve)=>d(he)-d(ve)),T=e.as||"bin",j=u.length;let $,G=1/0,te=-1/0,se=0;for(;se<j;++se){const he=u[se].sort(k);$=-1;for(const ve of Kr(he,b,l,d))ve<G&&(G=ve),ve>te&&(te=ve),he[++$][T]=ve}return this.value={start:G,stop:te,step:b},t.reflow(!0).modifies(T)}}),Object(xe.z)(ds,yi),sc.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},Object(xe.z)(sc,Wt,{transform(e,t){const r=this.value,u=e.field,l=t.changed()||t.modified(u.fields)||e.modified("field");let d=r[0],b=r[1];if((l||d==null)&&(d=1/0,b=-1/0),t.visit(l?t.SOURCE:t.ADD,k=>{const T=Object(xe.Ea)(u(k));T!=null&&(T<d&&(d=T),T>b&&(b=T))}),!Number.isFinite(d)||!Number.isFinite(b)){let k=Object(xe.h)(u);k&&(k=` for field "${k}"`),t.dataflow.warn(`Infinite extent${k}: [${d}, ${b}]`),d=b=void 0}this.value=[d,b]}}),Object(xe.z)(Bt,yi,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),Object(xe.z)(zo,Wt,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,r,u){const l=this.value;let d,b,k=Object(xe.w)(l,e)&&l[e];return k?k.value.stamp<r.stamp&&(k.init(r),this.activate(k)):(b=u||(b=this._group[e])&&b.tuple,d=r.dataflow,k=new Bt(r.fork(r.NO_SOURCE),this),d.add(k).connect(t(d,e,b)),l[e]=k,this.activate(k)),k},clean(){const e=this.value;let t=0;for(const r in e)if(e[r].count===0){const u=e[r].detachSubflow;u&&u(),delete e[r],++t}if(t){const r=this._targets.filter(u=>u&&u.count>0);this.initTargets(r)}},initTargets(e){const t=this._targets,r=t.length,u=e?e.length:0;let l=0;for(;l<u;++l)t[l]=e[l];for(;l<r&&t[l]!=null;++l)t[l]=null;t.active=u},transform(e,t){const r=t.dataflow,u=e.key,l=e.subflow,d=this._keys,b=e.modified("key"),k=T=>this.subflow(T,l,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,T=>{const j=fn(T),$=d.get(j);$!==void 0&&(d.delete(j),k($).rem(T))}),t.visit(t.ADD,T=>{const j=u(T);d.set(fn(T),j),k(j).add(T)}),b||t.modified(u.fields)?t.visit(t.MOD,T=>{const j=fn(T),$=d.get(j),G=u(T);$===G?k(G).mod(T):(d.set(j,G),k($).rem(T),k(G).add(T))}):t.changed(t.MOD)&&t.visit(t.MOD,T=>{k(d.get(fn(T))).mod(T)}),b&&t.visit(t.REFLOW,T=>{const j=fn(T),$=d.get(j),G=u(T);$!==G&&(d.set(j,G),k($).rem(T),k(G).add(T))}),t.clean()?r.runAfter(()=>{this.clean(),d.clean()}):d.empty>r.cleanThreshold&&r.runAfter(d.clean),t}}),Object(xe.z)(qa,yi),Qo.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},Object(xe.z)(Qo,Wt,{transform(e,t){const r=t.dataflow,u=this.value,l=t.fork(),d=l.add,b=l.rem,k=l.mod,T=e.expr;let j=!0;function $(G){const te=fn(G),se=T(G,e),he=u.get(te);se&&he?(u.delete(te),d.push(G)):se||he?j&&se&&!he&&k.push(G):(u.set(te,1),b.push(G))}return t.visit(t.REM,G=>{const te=fn(G);u.has(te)?u.delete(te):b.push(G)}),t.visit(t.ADD,G=>{T(G,e)?d.push(G):u.set(fn(G),1)}),t.visit(t.MOD,$),e.modified()&&(j=!1,t.visit(t.REFLOW,$)),u.empty>r.cleanThreshold&&r.runAfter(u.clean),l}}),bu.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},Object(xe.z)(bu,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE),u=e.fields,l=Aa(u,e.as||[]),d=e.index||null,b=l.length;return r.rem=this.value,t.visit(t.SOURCE,k=>{const T=u.map(he=>he(k)),j=T.reduce((he,ve)=>Math.max(he,ve.length),0);let $,G,te,se=0;for(;se<j;++se){for(G=Ar(k),$=0;$<b;++$)G[l[$]]=(te=T[$][se])==null?null:te;d&&(G[d]=se),r.add.push(G)}}),this.value=r.source=r.add,d&&r.modifies(d),r.modifies(l)}}),Or.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},Object(xe.z)(Or,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE),u=e.fields,l=u.map(xe.h),d=e.as||["key","value"],b=d[0],k=d[1],T=u.length;return r.rem=this.value,t.visit(t.SOURCE,j=>{for(let $,G=0;G<T;++G)($=Ar(j))[b]=l[G],$[k]=u[G](j),r.add.push($)}),this.value=r.source=r.add,r.modifies(d)}}),Vu.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},Object(xe.z)(Vu,Wt,{transform(e,t){const r=e.expr,u=e.as,l=e.modified(),d=e.initonly?t.ADD:l?t.SOURCE:t.modified(r.fields)||t.modified(u)?t.ADD_MOD:t.ADD;return l&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(u),t.visit(d,b=>b[u]=r(b,e))}}),Object(xe.z)(uc,Wt,{transform(e,t){const r=t.fork(t.ALL),u=e.generator;let l,d,b,k=this.value,T=e.size-k.length;if(T>0){for(l=[];--T>=0;)l.push(b=Fn(u(e))),k.push(b);r.add=r.add.length?r.materialize(r.ADD).add.concat(l):l}else d=k.slice(0,-T),r.rem=r.rem.length?r.materialize(r.REM).rem.concat(d):d,k=k.slice(-T);return r.source=this.value=k,r}});const bf={value:"value",median:Lo,mean:function(e,t){let r=0,u=0;if(t===void 0)for(let l of e)l!=null&&(l=+l)>=l&&(++r,u+=l);else{let l=-1;for(let d of e)(d=t(d,++l,e))!=null&&(d=+d)>=d&&(++r,u+=d)}if(r)return u/r},min:sr,max:er},$u=[];function _p(e){Wt.call(this,[],e)}function Mm(e){_l.call(this,e)}function Fm(e){Wt.call(this,null,e)}function yc(e){yi.call(this,null,go,e)}function go(e){return this.value&&!e.modified()?this.value:Object(xe.K)(e.fields,e.flat)}function xu(e){Wt.call(this,[],e),this._pending=null}function kp(e,t,r){r.forEach(Fn);const u=t.fork(t.NO_FIELDS&t.NO_SOURCE);return u.rem=e.value,e.value=u.source=u.add=r,e._pending=null,u.rem.length&&u.clean(!0),u}function kl(e){Wt.call(this,{},e)}function eu(e){yi.call(this,null,Ei,e)}function Ei(e){if(this.value&&!e.modified())return this.value;const t=e.extents,r=t.length;let u,l,d=1/0,b=-1/0;for(u=0;
7829u<r;++u)(l=t[u])[0]<d&&(d=l[0]),l[1]>b&&(b=l[1]);return[d,b]}function va(e){yi.call(this,null,Ep,e)}function Ep(e){return this.value&&!e.modified()?this.value:e.values.reduce((t,r)=>t.concat(r),[])}function Rm(e){Wt.call(this,null,e)}function od(e){_l.call(this,e)}function Cp(e){zo.call(this,e)}function to(e){Wt.call(this,null,e)}function Li(e){Wt.call(this,null,e)}function za(e){Wt.call(this,null,e)}_p.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},Object(xe.z)(_p,Wt,{transform(e,t){var r,u,l,d,b,k,T,j,$,G,te=t.fork(t.ALL),se=function(pt){var Ct,Et=pt.method||bf.value;if(bf[Et]!=null)return Et===bf.value?(Ct=pt.value!==void 0?pt.value:0,()=>Ct):bf[Et];Object(xe.o)("Unrecognized imputation method: "+Et)}(e),he=function(pt){const Ct=pt.field;return Et=>Et?Ct(Et):NaN}(e),ve=Object(xe.h)(e.field),Be=Object(xe.h)(e.key),ze=(e.groupby||[]).map(xe.h),Ue=function(pt,Ct,Et,mn){var An,xn,Wn,Un,Kn,Qn,ir,Nr,Jr=so=>so(Nr),Lr=[],hi=mn?mn.slice():[],Ri={},Pi={};for(hi.forEach((so,Ui)=>Ri[so]=Ui+1),Un=0,ir=pt.length;Un<ir;++Un)Nr=pt[Un],Qn=Et(Nr),Kn=Ri[Qn]||(Ri[Qn]=hi.push(Qn)),xn=(An=Ct?Ct.map(Jr):$u)+"",(Wn=Pi[xn])||(Wn=Pi[xn]=[],Lr.push(Wn),Wn.values=An),Wn[Kn-1]=Nr;return Lr.domain=hi,Lr}(t.source,e.groupby,e.key,e.keyvals),st=[],ut=this.value,mt=Ue.domain.length;for(b=0,j=Ue.length;b<j;++b)for(l=(r=Ue[b]).values,u=NaN,T=0;T<mt;++T)if(r[T]==null){for(d=Ue.domain[T],G={_impute:!0},k=0,$=l.length;k<$;++k)G[ze[k]]=l[k];G[Be]=d,G[ve]=Number.isNaN(u)?u=se(r,he):u,st.push(Fn(G))}return st.length&&(te.add=te.materialize(te.ADD).add.concat(st)),ut.length&&(te.rem=te.materialize(te.REM).rem.concat(ut)),this.value=st,te}}),Mm.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:Dm},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},Object(xe.z)(Mm,_l,{transform(e,t){const r=this,u=e.modified();let l;return r.value&&(u||t.modified(r._inputs,!0))?(l=r.value=u?r.init(e):{},t.visit(t.SOURCE,d=>r.add(d))):(l=r.value=r.value||this.init(e),t.visit(t.REM,d=>r.rem(d)),t.visit(t.ADD,d=>r.add(d))),r.changes(),t.visit(t.SOURCE,d=>{Object(xe.p)(d,l[r.cellkey(d)].tuple)}),t.reflow(u).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let r,u;for(r=0,u=this._alen;r<u;++r)this.celltuple(e[r]),e[r]=null;for(r=0,u=this._mlen;r<u;++r)this.celltuple(t[r]),t[r]=null;this._alen=this._mlen=0}}),Fm.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},Object(xe.z)(Fm,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const u=t.materialize(t.SOURCE).source,l=fs(u,e.groupby,e.field),d=(e.groupby||[]).map(xe.h),b=e.bandwidth,k=e.cumulative?"cdf":"pdf",T=e.as||["value","density"],j=[];let $=e.extent,G=e.steps||e.minsteps||25,te=e.steps||e.maxsteps||200;k!=="pdf"&&k!=="cdf"&&Object(xe.o)("Invalid density method: "+k),e.resolve==="shared"&&($||($=Object(xe.q)(u,e.field)),G=te=e.steps||te),l.forEach(se=>{const he=Wl(se,b)[k],ve=e.counts?se.length:1;rh(he,$||Object(xe.q)(se),G,te).forEach(Be=>{const ze={};for(let Ue=0;Ue<d.length;++Ue)ze[d[Ue]]=se.dims[Ue];ze[T[0]]=Be[0],ze[T[1]]=Be[1]*ve,j.push(Fn(ze))})}),this.value&&(r.rem=this.value),this.value=r.add=r.source=j}return r}}),Object(xe.z)(yc,yi),Object(xe.z)(xu,Wt,{transform(e,t){const r=t.dataflow;return this._pending?kp(this,t,this._pending):function(u){return u.modified("async")&&!(u.modified("values")||u.modified("url")||u.modified("format"))}(e)?t.StopPropagation:e.values?kp(this,t,r.parse(e.values,e.format)):e.async?{async:r.request(e.url,e.format).then(u=>
7829(this._pending=Object(xe.i)(u.data),l=>l.touch(this)))}:r.request(e.url,e.format).then(u=>kp(this,t,Object(xe.i)(u.data)))}}),kl.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},Object(xe.z)(kl,Wt,{transform(e,t){const r=e.fields,u=e.index,l=e.values,d=e.default==null?null:e.default,b=e.modified(),k=r.length;let T,j,$=b?t.SOURCE:t.ADD,G=t,te=e.as;return l?(j=l.length,k>1&&!te&&Object(xe.o)('Multi-field lookup requires explicit "as" parameter.'),te&&te.length!==k*j&&Object(xe.o)('The "as" parameter has too few output field names.'),te=te||l.map(xe.h),T=function(se){for(var he,ve,Be=0,ze=0;Be<k;++Be)if((ve=u.get(r[Be](se)))==null)for(he=0;he<j;++he,++ze)se[te[ze]]=d;else for(he=0;he<j;++he,++ze)se[te[ze]]=l[he](ve)}):(te||Object(xe.o)("Missing output field names."),T=function(se){for(var he,ve=0;ve<k;++ve)he=u.get(r[ve](se)),se[te[ve]]=he??d}),b?G=t.reflow(!0):$|=r.some(se=>t.modified(se.fields))?t.MOD:0,t.visit($,T),G.modifies(te)}}),Object(xe.z)(eu,yi),Object(xe.z)(va,yi),Object(xe.z)(Rm,Wt,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),od.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:Dm,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},Object(xe.z)(od,_l,{_transform:_l.prototype.transform,transform(e,t){return this._transform(function(r,u){const l=r.field,d=r.value,b=(r.op==="count"?"__count__":r.op)||"sum",k=Object(xe.g)(l).concat(Object(xe.g)(d)),T=function(j,$,G){const te={},se=[];return G.visit(G.SOURCE,he=>{const ve=j(he);te[ve]||(te[ve]=1,se.push(ve))}),se.sort(xe.j),$?se.slice(0,$):se}(l,r.limit||0,u);return u.changed()&&r.set("__pivot__",null,null,!0),{key:r.key,groupby:r.groupby,ops:T.map(()=>b),fields:T.map(j=>function($,G,te,se){return Object(xe.f)(he=>G(he)===$?te(he):NaN,se,$+"")}(j,l,d,k)),as:T.map(j=>j+""),modified:r.modified.bind(r)}}(e,t),t)}}),Object(xe.z)(Cp,zo,{transform(e,t){const r=e.subflow,u=e.field,l=d=>this.subflow(fn(d),r,t,d);return(e.modified("field")||u&&t.modified(Object(xe.g)(u)))&&Object(xe.o)("PreFacet does not support field modification."),this.initTargets(),u?(t.visit(t.MOD,d=>{const b=l(d);u(d).forEach(k=>b.mod(k))}),t.visit(t.ADD,d=>{const b=l(d);u(d).forEach(k=>b.add(Fn(k)))}),t.visit(t.REM,d=>{const b=l(d);u(d).forEach(k=>b.rem(k))})):(t.visit(t.MOD,d=>l(d).mod(d)),t.visit(t.ADD,d=>l(d).add(d)),t.visit(t.REM,d=>l(d).rem(d))),t.clean()&&t.runAfter(()=>this.clean()),t}}),to.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},Object(xe.z)(to,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE),u=e.fields,l=Aa(e.fields,e.as||[]),d=u?(k,T)=>function(j,$,G,te){for(let se=0,he=G.length;se<he;++se)$[te[se]]=G[se](j);return $}(k,T,u,l):Dr;let b;return this.value?b=this.value:(t=t.addAll(),b=this.value={}),t.visit(t.REM,k=>{const T=fn(k);r.rem.push(b[T]),b[T]=null}),t.visit(t.ADD,k=>{const T=d(k,Fn({}));b[fn(k)]=T,r.add.push(T)}),t.visit(t.MOD,k=>{r.mod.push(d(k,b[fn(k)]))}),r}}),Object(xe.z)(Li,Wt,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),za.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function Bm(e){Wt.call(this,null,e)}function Pm(e){Wt.call(this,[],e),this.count=0}function jm(e){Wt.call(this,null,e)}function Lg(e){Wt.call(this,null,e),this.modified(!0)}function el(e){Wt.call(this,null,e)}Object(xe.z)(za,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE|t.NO_FIELDS),u=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return r.source=this.value,r;const l=fs(t.materialize(t.SOURCE).source,e.groupby,e.field),d=(e.groupby||[]).map(xe.h),b=[],k=e.step||.01,T=e.probs||vu(k/2,1-1e-14,k),j=T.length;return l.forEach($=>{const G=ko($,T);for(let te=0;te<j;++te){const se={};for(let he=0;he<d.length;++he)se[d[he]]=$.dims[he];se[u[0]]=T[te],se[u[1]]=G[te],b.push(Fn(se))}}),this.value&&(r.rem=this.value),this.value=r.add=r.source=b,r}}),Object(xe.z)(Bm,Wt,{transform(e,t){let r,u;return this.value?u=this.value:(r=t=t.addAll(),u=this.value={}),e.derive&&(r=t.fork(t.NO_SOURCE),t.visit(t.REM,l=>{const d=fn(l);r.rem.push(u[d]),u[d]=null}),t.visit(t.ADD,l=>{const d=Ar(l);u[fn(l)]=d,r.add.push(d)}),t.visit(t.MOD,l=>{const d=u[fn(l)];for(const b in l)d[b]=l[b],r.modifies(b);r.mod.push(d)})),r}}),Pm.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},Object(xe.z)(Pm,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE),u=e.modified("size"),l=e.size,d=this.value.reduce(($,G)=>($[fn(G)]=1,$),{});let b=this.value,k=this.count,T=0;function j($){let G,te;b.length<l?b.push($):(te=~~((k+1)*Hn()))<b.length&&te>=T&&(G=b[te],d[fn(G)]&&r.rem.push(G),b[te]=$),++k}if(t.rem.length&&(t.visit(t.REM,$=>{const G=fn($);d[G]&&(d[G]=-1,r.rem.push($)),--k}),b=b.filter($=>d[fn($)]!==-1)),(t.rem.length||u)&&b.length<l&&t.source&&(T=k=b.length,t.visit(t.SOURCE,$=>{d[fn($)]||j($)}),T=-1),u&&b.length>l){const $=b.length-l;for(let G=0;G<$;++G)d[fn(b[G])]=-1,r.rem.push(b[G]);b=b.slice($)}return t.mod.length&&t.visit(t.MOD,$=>{d[fn($)]&&r.mod.push($)}),t.add.length&&t.visit(t.ADD,j),(t.add.length||T<0)&&(r.add=b.filter($=>!d[fn($)])),this.count=k,this.value=r.source=b,r}}),jm.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},Object(xe.z)(jm,Wt,{transform(e,t){if(this.value&&!e.modified())return;const r=t.materialize().fork(t.MOD),u=e.as||"data";return r.rem=this.value?t.rem.concat(this.value):t.rem,this.value=vu(e.start,e.stop,e.step||1).map(l=>{const d={};return d[u]=l,Fn(d)}),r.add=t.add.concat(this.value),r}}),Object(xe.z)(Lg,Wt,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const wu=["unit0","unit1"];function xf(e){Wt.call(this,Object(xe.t)(),e)}function Iu(e){Wt.call(this,null,e)}el.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:gr.j,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:wu}]},Object(xe.z)(el,Wt,{transform(e,t){const r=e.field,u=e.interval!==!1,l=e.timezone==="utc",d=this._floor(e,t),b=(l?gr.v:gr.p)(d.unit).offset,k=e.as||wu,T=k[0],j=k[1],$=d.step;let G=d.start||1/0,te=d.stop||-1/0,se=t.ADD;return(e.modified()||t.modified(Object(xe.g)(r)))&&(se=(t=t.reflow(!0)).SOURCE,G=1/0,te=-1/0),t.visit(se,he=>{const ve=r(he);let Be,ze;ve==null?(he[T]=null,u&&(he[j]=null)):(he[T]=Be=ze=d(ve),u&&(he[j]=ze=b(Be,$)),Be<G&&(G=Be),ze>te&&(te=ze))}),d.start=G,d.stop=te,t.modifies(u?k:T)},_floor(e,t){const r=e.timezone==="utc",{units:u,step:l}=e.units?{units:e.units,step:e.step||1}:Object(gr.n)({extent:e.extent||Object(xe.q)(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}
7829),d=Object(gr.t)(u),b=this.value||{},k=(r?gr.u:gr.o)(d,l);return k.unit=Object(xe.W)(d),k.units=d,k.step=l,k.start=b.start,k.stop=b.stop,this.value=k}}),Object(xe.z)(xf,Wt,{transform(e,t){const r=t.dataflow,u=e.field,l=this.value,d=k=>l.set(u(k),k);let b=!0;return e.modified("field")||t.modified(u.fields)?(l.clear(),t.visit(t.SOURCE,d)):t.changed()?(t.visit(t.REM,k=>l.delete(u(k))),t.visit(t.ADD,d)):b=!1,this.modified(b),l.empty>r.cleanThreshold&&r.runAfter(l.clean),t.fork()}}),Object(xe.z)(Iu,Wt,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(fi(e.sort)):t.source).map(e.field))}});const cc={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const r=t.index,u=t.data;return r&&t.compare(u[r-1],u[r])?e=r+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const r=t.index,u=t.data;return r&&t.compare(u[r-1],u[r])?++e:e}}},percent_rank:function(){const e=cc.rank(),t=e.next;return{init:e.init,next:r=>(t(r)-1)/(r.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const r=t.data,u=t.compare;let l=t.index;if(e<l){for(;l+1<r.length&&!u(r[l],r[l+1]);)++l;e=l}return(1+e)/r.length}}},ntile:function(e,t){(t=+t)>0||Object(xe.o)("ntile num must be greater than zero.");const r=cc.cume_dist(),u=r.next;return{init:r.init,next:l=>Math.ceil(t*u(l))}},lag:function(e,t){return t=+t||1,{next:r=>{const u=r.index-t;return u>=0?e(r.data[u]):null}}},lead:function(e,t){return t=+t||1,{next:r=>{const u=r.index+t,l=r.data;return u<l.length?e(l[u]):null}}},first_value:function(e){return{next:t=>e(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return(t=+t)>0||Object(xe.o)("nth_value nth must be greater than zero."),{next:r=>{const u=r.i0+(t-1);return u<r.i1?e(r.data[u]):null}}},prev_value:function(e){let t;return{init:()=>t=null,next:r=>{const u=e(r.data[r.index]);return u!=null?t=u:t}}},next_value:function(e){let t,r;return{init:()=>(t=null,r=-1),next:u=>{const l=u.data;return u.index<=r?t:(r=function(d,b,k){for(let T=b.length;k<T;++k)if(d(b[k])!=null)return k;return-1}(e,l,u.index))<0?(r=l.length,t=null):t=e(l[r])}}}},Sp=Object.keys(cc);function Qi(e){const t=Object(xe.i)(e.ops),r=Object(xe.i)(e.fields),u=Object(xe.i)(e.params),l=Object(xe.i)(e.as),d=this.outputs=[],b=this.windows=[],k={},T={},j=[],$=[];let G=!0;function te(se){Object(xe.i)(Object(xe.g)(se)).forEach(he=>k[he]=1)}te(e.sort),t.forEach((se,he)=>{const ve=r[he],Be=Object(xe.h)(ve),ze=Rg(se,Be,l[he]);if(te(ve),d.push(ze),Object(xe.w)(cc,se))b.push(function(Ue,st,ut,mt){const pt=cc[Ue](st,ut);return{init:pt.init||xe.Ma,update:function(Ct,Et){Et[mt]=pt.next(Ct)}}}(se,r[he],u[he],ze));else{if(ve==null&&se!=="count"&&Object(xe.o)("Null aggregate field specified."),se==="count")return void j.push(ze);G=!1;let Ue=T[Be];Ue||((Ue=T[Be]=[]).field=ve,$.push(Ue)),Ue.push(yp(se,ze))}}),(j.length||$.length)&&(this.cell=function(se,he,ve){se=se.map(mt=>sh(mt,mt.field));const Be={num:0,agg:null,store:!1,count:he};if(!ve)for(var ze=se.length,Ue=Be.agg=Array(ze),st=0;st<ze;++st)Ue[st]=new se[st](Be);if(Be.store)var ut=Be.data=new Tm;return Be.add=function(mt){if(Be.num+=1,!ve){ut&&ut.add(mt);for(let pt=0;pt<ze;++pt)Ue[pt].add(Ue[pt].get(mt),mt)}},Be.rem=function(mt){if(Be.num-=1,!ve){ut&&ut.rem(mt);for(let pt=0;pt<ze;++pt)Ue[pt].rem(Ue[pt].get(mt),mt)}},Be.set=function(mt){let pt,Ct;for(ut&&ut.values(),pt=0,Ct=he.length;pt<Ct;++pt)mt[he[pt]]=Be.num;if(!ve)for(pt=0,Ct=Ue.length;pt<Ct;++pt)Ue[pt].set(mt)},Be.init=function(){Be.num=0,ut&&ut.reset();for(let mt=0;mt<ze;++mt)Ue[mt].init()},Be}($,j,G)),this.inputs=Object.keys(k)}const ch=Qi.prototype;function wf(e){Wt.call(this,{},e),this._mlen=0,this._mods=[]}function ad(e,t,r,u){const l=u.sort,d=l&&!u.ignorePeers,b=u.frame||[null,0],k=e.data(r),T=k.length,j=d?Object(oh.a)(l):null,$={i0:0,i1:0,p0:0,p1:0,index:0,data:k,compare:l||Object(xe.m)(-1)};t.init();for(let G=0;G<T;++G)Lm($,b,G,T),d&&zg($,j),t.update($,k[G])}function Lm(e,t,r,u){e.p0=e.i0,e.p1=e.i1,e.i0=t[0]==null?0:Math.max(0,r-Math.abs(t[0])),e.i1=t[1]==null?u:Math.min(u,r+Math.abs(t[1])+1),e.index=r}function zg(e,t){const r=e.i0,u=e.i1-1,l=e.compare,d=e.data,b=d.length-1;r>0&&!l(d[r],d[r-1])&&(e.i0=t.left(d,d[r])),u<b&&!l(d[u],d[u+1])&&(e.i1=t.right(d,d[u]))}function sd(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Ap(e){this._context=e}
vendor: 16,384 bytes, line 7829
7829ch.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()},ch.update=function(e,t){const r=this.cell,u=this.windows,l=e.data,d=u&&u.length;let b;if(r){for(b=e.p0;b<e.i0;++b)r.rem(l[b]);for(b=e.p1;b<e.i1;++b)r.add(l[b]);r.set(t)}for(b=0;b<d;++b)u[b].update(e,t)},wf.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Sp.concat(Dm)},{name:"params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]},Object(xe.z)(wf,Wt,{transform(e,t){this.stamp=t.stamp;const r=e.modified(),u=fi(e.sort),l=Nc(e.groupby),d=k=>this.group(l(k));let b=this.state;b&&!r||(b=this.state=new Qi(e)),r||t.modified(b.inputs)?(this.value={},t.visit(t.SOURCE,k=>d(k).add(k))):(t.visit(t.REM,k=>d(k).remove(k)),t.visit(t.ADD,k=>d(k).add(k)));for(let k=0,T=this._mlen;k<T;++k)ad(this._mods[k],b,u,e);return this._mlen=0,this._mods=[],t.reflow(r).modifies(b.outputs)},group(e){let t=this.value[e];return t||((t=this.value[e]=Pg(fn)).stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}}),Ap.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:sd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:sd(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var ya=function(){};function Op(e){this._context=e}Op.prototype={areaStart:ya,areaEnd:ya,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:sd(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ud(e){this._context=e}ud.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,u=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,u):this._context.moveTo(r,u);break;case 3:this._point=4;default:sd(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Dp(e,t){this._basis=new Ap(e),this._beta=t}Dp.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var u,l=e[0],d=t[0],b=e[r]-l,k=t[r]-d,T=-1;++T<=r;)u=T/r,this._basis.point(this._beta*e[T]+(1-this._beta)*(l+u*b),this._beta*t[T]+(1-this._beta)*(d+u*k));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var cd=function e(t){function r(u){return t===1?new Ap(u):new Dp(u,t)}return r.beta=function(u){return e(+u)},r}(.85);function _f(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function ql(e,t){this._context=e,this._k=(1-t)/6}ql.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:_f(this,this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:_f(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Tp=function e(t){function r(u){return new ql(u,t)}return r.tension=function(u){return e(+u)},r}(0);function lh(e,t){this._context=e,this._k=(1-t)/6}lh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:_f(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var ld=function e(t){function r(u){return new lh(u,t)}return r.tension=function(u){return e(+u)},r}(0);function Gl(e,t){this._context=e,this._k=(1-t)/6}Gl.prototype={areaStart:ya,areaEnd:ya,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:_f(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var F0=function e(t){function r(u){return new Gl(u,t)}return r.tension=function(u){return e(+u)},r}(0),fd=Math.abs,Pa=Math.atan2,hs=Math.cos,bs=Math.max,no=Math.min,_u=Math.sin,Kl=Math.sqrt,xs=1e-12,Yl=Math.PI,tl=Yl/2,fh=2*Yl;function dh(e){return e>=1?tl:e<=-1?-tl:Math.asin(e)}function kf(e,t,r){var u=e._x1,l=e._y1,d=e._x2,b=e._y2;if(e._l01_a>xs){var k=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,T=3*e._l01_a*(e._l01_a+e._l12_a);u=(u*k-e._x0*e._l12_2a+e._x2*e._l01_2a)/T,l=(l*k-e._y0*e._l12_2a+e._y2*e._l01_2a)/T}if(e._l23_a>xs){var j=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,$=3*e._l23_a*(e._l23_a+e._l12_a);d=(d*j+e._x1*e._l23_2a-t*e._l12_2a)/$,b=(b*j+e._y1*e._l23_2a-r*e._l12_2a)/$}e._context.bezierCurveTo(u,l,d,b,e._x2,e._y2)}function zm(e,t){this._context=e,this._alpha=t}zm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,u=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+u*u,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:kf(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var nl=function e(t){function r(u){return t?new zm(u,t):new ql(u,0)}return r.alpha=function(u){return e(+u)},r}(.5);function R0(e,t){this._context=e,this._alpha=t}R0.prototype={areaStart:ya,areaEnd:ya,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,u=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+u*u,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:kf(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Um=function e(t){function r(u){return t?new R0(u,t):new Gl(u,0)}return r.alpha=function(u){return e(+u)},r}(.5);function dd(e,t){this._context=e,this._alpha=t}dd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,u=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+u*u,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:kf(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Ug=function e(t){function r(u){return t?new dd(u,t):new lh(u,0)}return r.alpha=function(u){return e(+u)},r}(.5);function hh(e){this._context=e}hh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};var Ef=function(e){return new hh(e)};function Wm(e){this._context=e}Wm.prototype={areaStart:ya,areaEnd:ya,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Np(e){return e<0?-1:1}function os(e,t,r){var u=e._x1-e._x0,l=t-e._x1,d=(e._y1-e._y0)/(u||l<0&&-0),b=(r-e._y1)/(l||u<0&&-0),k=(d*l+b*u)/(u+l);return(Np(d)+Np(b))*Math.min(Math.abs(d),Math.abs(b),.5*Math.abs(k))||0}function hd(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function ku(e,t,r){var u=e._x0,l=e._y0,d=e._x1,b=e._y1,k=(d-u)/3;e._context.bezierCurveTo(u+k,l+k*t,d-k,b-k*r,d,b)}function pd(e){this._context=e}function ph(e){this._context=new Ip(e)}function Ip(e){this._context=e}function Vm(e){this._context=e}function mh(e){var t,r,u=e.length-1,l=new Array(u),d=new Array(u),b=new Array(u);for(l[0]=0,d[0]=2,b[0]=e[0]+2*e[1],t=1;t<u-1;++t)l[t]=1,d[t]=4,b[t]=4*e[t]+2*e[t+1];for(l[u-1]=2,d[u-1]=7,b[u-1]=8*e[u-1]+e[u],t=1;t<u;++t)r=l[t]/d[t-1],d[t]-=r,b[t]-=r*b[t-1];for(l[u-1]=b[u-1]/d[u-1],t=u-2;t>=0;--t)l[t]=(b[t]-l[t+1])/d[t];for(d[u-1]=(e[u]+l[u-1])/2,t=0;t<u-1;++t)d[t]=2*e[t+1]-l[t+1];return[l,d]}pd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ku(this,this._t0,hd(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ku(this,hd(this,r=os(this,e,t)),r);break;default:ku(this,this._t0,r=os(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}},(ph.prototype=Object.create(pd.prototype)).point=function(e,t){pd.prototype.point.call(this,t,e)},Ip.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,u,l,d){this._context.bezierCurveTo(t,e,u,r,d,l)}},Vm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var u=mh(e),l=mh(t),d=0,b=1;b<r;++d,++b)this._context.bezierCurveTo(u[0][d],l[0][d],u[1][d],l[1][d],e[b],t[b]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function md(e,t){this._context=e,this._t=t}md.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}}this._x=e,this._y=t}};const $m=Math.PI,Hm=2*$m,gn=Hm-1e-6;function Hu(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Yn(){return new Hu}Hu.prototype=Yn.prototype={constructor:Hu,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,r,u){this._+="Q"+ +e+","+ +t+","+(this._x1=+r)+","+(this._y1=+u)},bezierCurveTo:function(e,t,r,u,l,d){this._+="C"+ +e+","+ +t+","+ +r+","+ +u+","+(this._x1=+l)+","+(this._y1=+d)},arcTo:function(e,t,r,u,l){e=+e,t=+t,r=+r,u=+u,l=+l;var d=this._x1,b=this._y1,k=r-e,T=u-t,j=d-e,$=b-t,G=j*j+$*$;if(l<0)throw new Error("negative radius: "+l);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(G>1e-6)if(Math.abs($*k-T*j)>1e-6&&l){var te=r-d,se=u-b,he=k*k+T*T,ve=te*te+se*se,Be=Math.sqrt(he),ze=Math.sqrt(G),Ue=l*Math.tan(($m-Math.acos
7829((he+G-ve)/(2*Be*ze)))/2),st=Ue/ze,ut=Ue/Be;Math.abs(st-1)>1e-6&&(this._+="L"+(e+st*j)+","+(t+st*$)),this._+="A"+l+","+l+",0,0,"+ +($*te>j*se)+","+(this._x1=e+ut*k)+","+(this._y1=t+ut*T)}else this._+="L"+(this._x1=e)+","+(this._y1=t)},arc:function(e,t,r,u,l,d){e=+e,t=+t,d=!!d;var b=(r=+r)*Math.cos(u),k=r*Math.sin(u),T=e+b,j=t+k,$=1^d,G=d?u-l:l-u;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+T+","+j:(Math.abs(this._x1-T)>1e-6||Math.abs(this._y1-j)>1e-6)&&(this._+="L"+T+","+j),r&&(G<0&&(G=G%Hm+Hm),G>gn?this._+="A"+r+","+r+",0,1,"+$+","+(e-b)+","+(t-k)+"A"+r+","+r+",0,1,"+$+","+(this._x1=T)+","+(this._y1=j):G>1e-6&&(this._+="A"+r+","+r+",0,"+ +(G>=$m)+","+$+","+(this._x1=e+r*Math.cos(l))+","+(this._y1=t+r*Math.sin(l))))},rect:function(e,t,r,u){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +r+"v"+ +u+"h"+-r+"Z"},toString:function(){return this._}};var Eu=Yn,Oo=function(e){return function(){return e}};function gd(e){return e.innerRadius}function gh(e){return e.outerRadius}function fr(e){return e.startAngle}function js(e){return e.endAngle}function as(e){return e&&e.padAngle}function ho(e,t,r,u,l,d,b){var k=e-r,T=t-u,j=(b?d:-d)/Kl(k*k+T*T),$=j*T,G=-j*k,te=e+$,se=t+G,he=r+$,ve=u+G,Be=(te+he)/2,ze=(se+ve)/2,Ue=he-te,st=ve-se,ut=Ue*Ue+st*st,mt=l-d,pt=te*ve-he*se,Ct=(st<0?-1:1)*Kl(bs(0,mt*mt*ut-pt*pt)),Et=(pt*st-Ue*Ct)/ut,mn=(-pt*Ue-st*Ct)/ut,An=(pt*st+Ue*Ct)/ut,xn=(-pt*Ue+st*Ct)/ut,Wn=Et-Be,Un=mn-ze,Kn=An-Be,Qn=xn-ze;return Wn*Wn+Un*Un>Kn*Kn+Qn*Qn&&(Et=An,mn=xn),{cx:Et,cy:mn,x01:-$,y01:-G,x11:Et*(l/mt-1),y11:mn*(l/mt-1)}}var Mc=function(e){return typeof e=="object"&&"length"in e?e:Array.from(e)};function El(e){return e[0]}function qu(e){return e[1]}var Cl=function(e,t){var r=Oo(!0),u=null,l=Ef,d=null;function b(k){var T,j,$,G=(k=Mc(k)).length,te=!1;for(u==null&&(d=l($=Eu())),T=0;T<=G;++T)!(T<G&&r(j=k[T],T,k))===te&&((te=!te)?d.lineStart():d.lineEnd()),te&&d.point(+e(j,T,k),+t(j,T,k));if($)return d=null,$+""||null}return e=typeof e=="function"?e:e===void 0?El:Oo(e),t=typeof t=="function"?t:t===void 0?qu:Oo(t),b.x=function(k){return arguments.length?(e=typeof k=="function"?k:Oo(+k),b):e},b.y=function(k){return arguments.length?(t=typeof k=="function"?k:Oo(+k),b):t},b.defined=function(k){return arguments.length?(r=typeof k=="function"?k:Oo(!!k),b):r},b.curve=function(k){return arguments.length?(l=k,u!=null&&(d=l(u)),b):l},b.context=function(k){return arguments.length?(k==null?u=d=null:d=l(u=k),b):u},b},Oa=function(e,t,r){var u=null,l=Oo(!0),d=null,b=Ef,k=null;function T($){var G,te,se,he,ve,Be=($=Mc($)).length,ze=!1,Ue=new Array(Be),st=new Array(Be);for(d==null&&(k=b(ve=Eu())),G=0;G<=Be;++G){if(!(G<Be&&l(he=$[G],G,$))===ze)if(ze=!ze)te=G,k.areaStart(),k.lineStart();else{for(k.lineEnd(),k.lineStart(),se=G-1;se>=te;--se)k.point(Ue[se],st[se]);k.lineEnd(),k.areaEnd()}ze&&(Ue[G]=+e(he,G,$),st[G]=+t(he,G,$),k.point(u?+u(he,G,$):Ue[G],r?+r(he,G,$):st[G]))}if(ve)return k=null,ve+""||null}function j(){return Cl().defined(l).curve(b).context(d)}return e=typeof e=="function"?e:e===void 0?El:Oo(+e),t=typeof t=="function"?t:Oo(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?qu:Oo(+r),T.x=function($){return arguments.length?(e=typeof $=="function"?$:Oo(+$),u=null,T):e},T.x0=function($){return arguments.length?(e=typeof $=="function"?$:Oo(+$),T):e},T.x1=function($){return arguments.length?(u=$==null?null:typeof $=="function"?$:Oo(+$),T):u},T.y=function($){return arguments.length?(t=typeof $=="function"?$:Oo(+$),r=null,T):t},T.y0=function($){return arguments.length?(t=typeof $=="function"?$:Oo(+$),T):t},T.y1=function($){return arguments.length?(r=$==null?null:typeof $=="function"?$:Oo(+$),T):r},T.lineX0=T.lineY0=function(){return j().x(e).y(t)},T.lineY1=function(){return j().x(e).y(r)},T.lineX1=function(){return j().x(u).y(t)},T.defined=function($){return arguments.length?(l=typeof $=="function"?$:Oo(!!$),T):l},T.curve=function($){return arguments.length?(b=$,d!=null&&(k=b(d)),T):b},T.context=function($){return arguments.length?($==null?d=k=null:k=b(d=$),T):d},T},rl={draw:function(e,t){var r=Math.sqrt(t/Yl);e.moveTo(r,0),e.arc(0,0,r,0,fh)}};function Gu(e,t){if(typeof document<"u"&&document.createElement){const r=document.createElement("canvas");if(r&&r.getContext)return r.width=e,r.height=t,r}return null}const Mo=()=>typeof Image<"u"?Image:null,tu=Object(oh.a)($n.a),ps=tu.right,nu=tu.left;Object(oh.a)(Zr).center;var Da=ps;function Ku(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Fc(e,t){switch(arguments.length){case 0:break;case 1:typeof e=="function"?this.interpolator(e):this.range(e);break;default:this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t)}return this}
7829const il=Symbol("implicit");function Sl(){var e=new Map,t=[],r=[],u=il;function l(d){var b=d+"",k=e.get(b);if(!k){if(u!==il)return u;e.set(b,k=t.push(d))}return r[(k-1)%r.length]}return l.domain=function(d){if(!arguments.length)return t.slice();t=[],e=new Map;for(const b of d){const k=b+"";e.has(k)||e.set(k,t.push(b))}return l},l.range=function(d){return arguments.length?(r=Array.from(d),l):r.slice()},l.unknown=function(d){return arguments.length?(u=d,l):u},l.copy=function(){return Sl(t,r).unknown(u)},Ku.apply(l,arguments),l}var Rc=n(45),Cf=n(50);function Sf(e,t,r,u){var l,d=Object(Rc.c)(e,t,r);switch((u=Object(Cf.formatSpecifier)(u??",f")).type){case"s":var b=Math.max(Math.abs(e),Math.abs(t));return u.precision!=null||isNaN(l=Object(Cf.precisionPrefix)(d,b))||(u.precision=l),Object(Cf.formatPrefix)(u,b);case"":case"e":case"g":case"p":case"r":u.precision!=null||isNaN(l=Object(Cf.precisionRound)(d,Math.max(Math.abs(e),Math.abs(t))))||(u.precision=l-(u.type==="e"));break;case"f":case"%":u.precision!=null||isNaN(l=Object(Cf.precisionFixed)(d))||(u.precision=l-2*(u.type==="%"))}return Object(Cf.format)(u)}var Mp=function(e,t,r){e.prototype=t.prototype=r,r.constructor=e};function Af(e,t){var r=Object.create(e.prototype);for(var u in t)r[u]=t[u];return r}function Yu(){}var Bc="\\s*([+-]?\\d+)\\s*",Pc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",lc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Fp=/^#([0-9a-f]{3,8})$/,vh=new RegExp("^rgb\\("+[Bc,Bc,Bc]+"\\)$"),yh=new RegExp("^rgb\\("+[lc,lc,lc]+"\\)$"),vd=new RegExp("^rgba\\("+[Bc,Bc,Bc,Pc]+"\\)$"),bh=new RegExp("^rgba\\("+[lc,lc,lc,Pc]+"\\)$"),ae=new RegExp("^hsl\\("+[Pc,lc,lc]+"\\)$"),ne=new RegExp("^hsla\\("+[Pc,lc,lc,Pc]+"\\)$"),B={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function H(){return this.rgb().formatHex()}function ue(){return this.rgb().formatRgb()}function Le(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Fp.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?Qe(t):r===3?new gt(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):r===8?wt(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):r===4?wt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=vh.exec(e))?new gt(t[1],t[2],t[3],1):(t=yh.exec(e))?new gt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=vd.exec(e))?wt(t[1],t[2],t[3],t[4]):(t=bh.exec(e))?wt(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=ae.exec(e))?Jn(t[1],t[2]/100,t[3]/100,1):(t=ne.exec(e))?Jn(t[1],t[2]/100,t[3]/100,t[4]):B.hasOwnProperty(e)?Qe(B[e]):e==="transparent"?new gt(NaN,NaN,NaN,0):null}function Qe(e){return new gt(e>>16&255,e>>8&255,255&e,1)}function wt(e,t,r,u){return u<=0&&(e=t=r=NaN),new gt(e,t,r,u)}function qt(e){return e instanceof Yu||(e=Le(e)),e?new gt((e=e.rgb()).r,e.g,e.b,e.opacity):new gt}function en(e,t,r,u){return arguments.length===1?qt(e):new gt(e,t,r,u??1)}function gt(e,t,r,u){this.r=+e,this.g=+t,this.b=+r,this.opacity=+u}function Tn(){return"#"+zn(this.r)+zn(this.g)+zn(this.b)}function Pn(){var e=this.opacity;return((e=isNaN(e)?1:Math.max(0,Math.min(1,e)))===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||
vendor: 7,245 bytes, line 7829
78290))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(e===1?")":", "+e+")")}function zn(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Jn(e,t,r,u){return u<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new dr(e,t,r,u)}function Vn(e){if(e instanceof dr)return new dr(e.h,e.s,e.l,e.opacity);if(e instanceof Yu||(e=Le(e)),!e)return new dr;if(e instanceof dr)return e;var t=(e=e.rgb()).r/255,r=e.g/255,u=e.b/255,l=Math.min(t,r,u),d=Math.max(t,r,u),b=NaN,k=d-l,T=(d+l)/2;return k?(b=t===d?(r-u)/k+6*(r<u):r===d?(u-t)/k+2:(t-r)/k+4,k/=T<.5?d+l:2-d-l,b*=60):k=T>0&&T<1?0:b,new dr(b,k,T,e.opacity)}function lr(e,t,r,u){return arguments.length===1?Vn(e):new dr(e,t,r,u??1)}function dr(e,t,r,u){this.h=+e,this.s=+t,this.l=+r,this.opacity=+u}function Tr(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}function Hr(e,t,r,u,l){var d=e*e,b=d*e;return((1-3*e+3*d-b)*t+(4-6*d+3*b)*r+(1+3*e+3*d-3*b)*u+b*l)/6}Mp(Yu,Le,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:H,formatHex:H,formatHsl:function(){return Vn(this).formatHsl()},formatRgb:ue,toString:ue}),Mp(gt,en,Af(Yu,{brighter:function(e){return e=e==null?1/.7:Math.pow(1/.7,e),new gt(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=e==null?.7:Math.pow(.7,e),new gt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Tn,formatHex:Tn,formatRgb:Pn,toString:Pn})),Mp(dr,lr,Af(Yu,{brighter:function(e){return e=e==null?1/.7:Math.pow(1/.7,e),new dr(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=e==null?.7:Math.pow(.7,e),new dr(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,u=r+(r<.5?r:1-r)*t,l=2*r-u;return new gt(Tr(e>=240?e-240:e+120,l,u),Tr(e,l,u),Tr(e<120?e+240:e-120,l,u),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return((e=isNaN(e)?1:Math.max(0,Math.min(1,e)))===1?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(e===1?")":", "+e+")")}}));var oi=function(e){var t=e.length-1;return function(r){var u=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),l=e[u],d=e[u+1],b=u>0?e[u-1]:2*l-d,k=u<t-1?e[u+2]:2*d-l;return Hr((r-u/t)*t,b,l,d,k)}},Br=function(e){var t=e.length;return function(r){var u=Math.floor(((r%=1)<0?++r:r)*t),l=e[(u+t-1)%t],d=e[u%t],b=e[(u+1)%t],k=e[(u+2)%t];return Hr((r-u/t)*t,l,d,b,k)}},ui=e=>()=>e;function ii(e,t){return function(r){return e+r*t}}function Ci(e,t){var r=t-e;return r?ii(e,r>180||r<-180?r-360*Math.round(r/360):r):ui(isNaN(e)?t:e)}function Di(e){return(e=+e)==1?si:function(t,r){return r-t?function(u,l,d){return u=Math.pow(u,d),l=Math.pow(l,d)-u,d=1/d,function(b){return Math.pow(u+b*l,d)}}(t,r,e):ui(isNaN(t)?r:t)}}function si(e,t){var r=t-e;return r?ii(e,r):ui(isNaN(e)?t:e)}var wi=function e(t){var r=Di(t);function u(l,d){var b=r((l=en(l)).r,(d=en(d)).r),k=r(l.g,d.g),T=r(l.b,d.b),j=si(l.opacity,d.opacity);return function($){return l.r=b($),l.g=k($),l.b=T($),l.opacity=j($),l+""}}return u.gamma=e,u}(1);function Co(e){return function(t){var r,u,l=t.length,d=new Array(l),b=new Array(l),k=new Array(l);for(r=0;r<l;++r)u=en(t[r]),d[r]=u.r||0,b[r]=u.g||0,k[r]=u.b||0;return d=e(d),b=e(b),k=e(k),u.opacity=1,function(T){return u.r=d(T),u.g=b(T),u.b=k(T),u+""}}}var _o=Co(oi),ba=Co(Br),ro=function(e,t){t||(t=[]);var r,u=e?Math.min(t.length,e.length):0,l=t.slice();return function(d){for(r=0;r<u;++r)l[r]=e[r]*(1-d)+t[r]*d;return l}};function So(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}var ja=function(e,t){return(So(t)?ro:pa)(e,t)};function pa(e,t){var r,u=t?t.length:0,l=e?Math.min(u,e.length):0,d=new Array(l),b=new Array(u);for(r=0;r<l;++r)d[r]=Ua(e[r],t[r]);for(;r<u;++r)b[r]=t[r];return function(k){for(r=0;r<l;++r)b[r]=d[r](k);return b}}var Ta=function(e,t){var r=new Date;return e=+e,t=+t,function(u){return r.setTime(e*(1-u)+t*u),r}},Zi=function(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}},Xi=function(e,t){var r,u={},l={};for(r in e!==null&&typeof e=="object"||(e={}),t!==null&&typeof t=="object"||(t={}),t)r in e?u[r]=Ua(e[r],t[r]):l[r]=t[r];return function(d){for(r in u)l[r]=u[r](d);return l}},Ho=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ga=new RegExp(Ho.source,"g"),Qa=function(e,t){var r,u,l,d=Ho.lastIndex=Ga.lastIndex=0,b=-1,k=[],T=[];for(e+="",t+="";(r=Ho.exec(e))&&(u=Ga.exec(t));)(l=u.index)>d&&(l=t.slice(d,l),k[b]?k[b]+=l:k[++b]=l),(r=r[0])===(u=u[0])?k[b]?k[b]+=u:k[++b]=u:(k[++b]=null,T.push({i:b,x:Zi(r,u)})),d=Ga.lastIndex;return d<t.length&&(l=t.slice(d),k[b]?k[b]+=l:k[++b]=l),k.length<2?T[0]?function(j){return function($){return j($)+""}}(T[0].x):function(j){return function(){return j}}(t):(t=T.length,function(j){for(var $,G=0;G<t;++G)k[($=T[G]).i]=$.x(j);return k.join("")})},Ua=function(e,t){var r,u=typeof t;return t==null||u==="boolean"?ui(t):(u==="number"?Zi:u==="string"?(r=Le(t))?(t=r,wi):Qa:t instanceof Le?wi:t instanceof Date?Ta:So(t)?ro:Array.isArray(t)?pa:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Xi:Zi)(e,t)},Na=function(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}};function Hs(e){return+e}var Za=[0,1];function qo(e){return e}function ss(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:function(r){return function(){return r}}(isNaN(t)?NaN:.5)}function jc(e,t,r){var u=e[0],l=e[1],d=t[0],b=t[1];return l<u?(u=ss(l,u),d=r(b,d)):(u=ss(u,l),d=r(d,b)),function(k){return d(u(k))}}function ru(e,t,r){var u=Math.min(e.length,t.length)-1,l=new Array(u),d=new Array(u),b=-1;for(e[u]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++b<u;)l[b]=ss(e[b],e[b+1]),d[b]=r(t[b],t[b+1]);return function(k){var T=Da(e,k,1,u)-1;return d[T](l[T](k))}}function ws(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function la(){var e,t,r,u,l,d,b=Za,k=Za,T=Ua,j=qo;function $(){var te=Math.min(b.length,k.length);return j!==qo&&(j=function(se,he){var ve;return se>he&&(ve=se,se=he,he=ve),function(Be){return Math.max(se,Math.min(he,Be))}}(b[0],b[te-1])),u=te>2?ru:jc,l=d=null,G}function G(te){return te==null||isNaN(te=+te)?r:(l||(l=u(b.map(e),k,T)))(e(j(te)))}return G.invert=function(te){return j(t((d||(d=u(k,b.map(e),Zi)))(te)))},G.domain=function(te){return arguments.length?(b=Array.from(te,Hs),$()):b.slice()},G.range=function(te){return arguments.length?(k=Array.from(te),$()):k.slice()},G.rangeRound=function(te){return k=Array.from(te),T=Na,$()},G.clamp=function(te){return arguments.length?(j=!!te||qo,$()):j!==qo},G.interpolate=function(te){return arguments.length?(T=te,$()):T},G.unknown=function(te){return arguments.length?(r=te,G):r},function(te,se){return e=te,t=se,$()}}function Al(){return la()(qo,qo)}function Xu(e){var t=e.domain;return e.ticks=function(r){var u=t();return Object(Rc.a)(u[0],u[u.length-1],r??10)}
7829,e.tickFormat=function(r,u){var l=t();return Sf(l[0],l[l.length-1],r??10,u)},e.nice=function(r){r==null&&(r=10);var u,l,d=t(),b=0,k=d.length-1,T=d[b],j=d[k],$=10;for(j<T&&(l=T,T=j,j=l,l=b,b=k,k=l);$-- >0;){if((l=Object(Rc.b)(T,j,r))===u)return d[b]=T,d[k]=j,t(d);if(l>0)T=Math.floor(T/l)*l,j=Math.ceil(j/l)*l;else{if(!(l<0))break;T=Math.ceil(T*l)/l,j=Math.floor(j*l)/l}u=l}return e},e}function Mu(e,t){var r,u=0,l=(e=e.slice()).length-1,d=e[u],b=e[l];return b<d&&(r=u,u=l,l=r,r=d,d=b,b=r),e[u]=t.floor(d),e[l]=t.ceil(b),e}function Ia(e){return Math.log(e)}function Fu(e){return Math.exp(e)}function fa(e){return-Math.log(-e)}function Cu(e){return-Math.exp(-e)}function iu(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Do(e){return function(t){return-e(-t)}}function Su(e){var t,r,u=e(Ia,Fu),l=u.domain,d=10;function b(){return t=function(k){return k===Math.E?Math.log:k===10&&Math.log10||k===2&&Math.log2||(k=Math.log(k),function(T){return Math.log(T)/k})}(d),r=function(k){return k===10?iu:k===Math.E?Math.exp:function(T){return Math.pow(k,T)}}(d),l()[0]<0?(t=Do(t),r=Do(r),e(fa,Cu)):e(Ia,Fu),u}return u.base=function(k){return arguments.length?(d=+k,b()):d},u.domain=function(k){return arguments.length?(l(k),b()):l()},u.ticks=function(k){var T,j=l(),$=j[0],G=j[j.length-1];(T=G<$)&&(ve=$,$=G,G=ve);var te,se,he,ve=t($),Be=t(G),ze=k==null?10:+k,Ue=[];if(!(d%1)&&Be-ve<ze){if(ve=Math.floor(ve),Be=Math.ceil(Be),$>0){for(;ve<=Be;++ve)for(se=1,te=r(ve);se<d;++se)if(!((he=te*se)<$)){if(he>G)break;Ue.push(he)}}else for(;ve<=Be;++ve)for(se=d-1,te=r(ve);se>=1;--se)if(!((he=te*se)<$)){if(he>G)break;Ue.push(he)}2*Ue.length<ze&&(Ue=Object(Rc.a)($,G,ze))}else Ue=Object(Rc.a)(ve,Be,Math.min(Be-ve,ze)).map(r);return T?Ue.reverse():Ue},u.tickFormat=function(k,T){if(T==null&&(T=d===10?".0e":","),typeof T!="function"&&(T=Object(Cf.format)(T)),k===1/0)return T;k==null&&(k=10);var j=Math.max(1,d*k/u.ticks().length);return function($){var G=$/r(Math.round(t($)));return G*d<d-.5&&(G*=d),G<=j?T($):""}},u.nice=function(){return l(Mu(l(),{floor:function(k){return r(Math.floor(t(k)))},ceil:function(k){return r(Math.ceil(t(k)))}}))},u}function Ls(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Ju(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Xl(e){return e<0?-e*e:e*e}function xa(e){var t=e(qo,qo),r=1;return t.exponent=function(u){return arguments.length?(r=+u)==1?e(qo,qo):r===.5?e(Ju,Xl):e(Ls(r),Ls(1/r)):r},Xu(t)}function qs(){var e=xa(la());return e.copy=function(){return ws(e,qs()).exponent(e.exponent())},Ku.apply(e,arguments),e}function _s(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Ol(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Of(e){var t=1,r=e(_s(t),Ol(t));return r.constant=function(u){return arguments.length?e(_s(t=+u),Ol(t)):t},Xu(r)}var Oi=n(12),qm=n(182),Df=n(69),yd=n(183),Wv=n(184),Vv=n(72),B0=n(40),P0=n(135),$v=n(70),j0=n(180),Hv=n(181),xh=n(71),Gm=n(39),qv=n(134),Gv=n(68);function Kv(e,t,r,u,l,d){const b=[[Df.a,1,Oi.e],[Df.a,5,5*Oi.e],[Df.a,15,15*Oi.e],[Df.a,30,30*Oi.e],[d,1,Oi.c],[d,5,5*Oi.c],[d,15,15*Oi.c],[d,30,30*Oi.c],[l,1,Oi.b],[l,3,3*Oi.b],[l,6,6*Oi.b],[l,12,12*Oi.b],[u,1,Oi.a],[u,2,2*Oi.a],[r,1,Oi.f],[t,1,Oi.d],[t,3,3*Oi.d],[e,1,Oi.g]];function k(T,j,$){const G=Math.abs(j-T)/$,te=Object(oh.a)(([,,ve])=>ve).right(b,G);if(te===b.length)return e.every(Object(Rc.c)(T/Oi.g,j/Oi.g,$));if(te===0)return qm.a.every(Math.max(Object(Rc.c)(T,j,$),1));const[se,he]=b[G/b[te-1][2]<b[te][2]/G?te-1:te];return se.every(he)}return[function(T,j,$){const G=j<T;G&&([T,j]=[j,T]);const te=$&&typeof $.range=="function"?$:k(T,j,$),se=te?te.range(T,+j+1):[];return G?se.reverse():se},k]}const[Jl,wh]=Kv(Gv.a,qv.a,Gm.b,xh.a,Hv.a,j0.a),[Km,L0]=Kv($v.a,P0.a,B0.b,Vv.a,Wv.a,yd.a);var z0=n(100);function g1(e){return new Date(e)}function U0(e){return e instanceof Date?+e:+new Date(+e)}function Rp(e,t,r,u,l,d,b,k,T,j){var $=Al(),G=$.invert,te=$.domain,se=j(".%L"),he=j(":%S"),ve=j("%I:%M"),Be=j("%I %p"),ze=j("%a %d"),Ue=j("%b %d"),st=j("%B"),ut=j("%Y");function mt(pt){return(T(pt)<pt?se:k(pt)<pt?he:b(pt)<pt?ve:d(pt)<pt?Be:u(pt)<pt?l(pt)<pt?ze:Ue:r(pt)<pt?st:ut)(pt)}return $.invert=function(pt){return new Date(G(pt))},$.domain=function(pt){return arguments.length?te(Array.from(pt,U0)):te().map(g1)},$.ticks=function(pt){var Ct=te();return e(Ct[0],Ct[Ct.length-1],pt??10)},$.tickFormat=function(pt,Ct){return Ct==null?mt:j(Ct)},$.nice=function(pt){var Ct=te();return pt&&typeof pt.range=="function"||(pt=t(Ct[0],Ct[Ct.length-1],pt??10)),pt?te(Mu(Ct,pt)):$},$.copy=function(){return ws($,Rp(e,t,r,u,l,d,b,k,T,j))},$}function _h(){var e,t,r,u,l,d=0,b=1,k=qo,T=!1;function j(G){return G==null||isNaN(G=+G)?l:k(r===0?.5:(G=(u(G)-e)*r,T?Math.max(0,Math.min(1,G)):G))}function $(G){return function(te){var se,he;return arguments.length?([se,he]=te,k=G(se,he),j):[k(0),k(1)]}}return j.domain=function(G){return arguments.length?([d,b]=G,e=u(d=+d),t=u(b=+b),r=e===t?0:1/(t-e),j):[d,b]},j.clamp=function(G){return arguments.length?(T=!!G,j):T},j.interpolator=function(G){return arguments.length?(k=G,j):k},j.range=$(Ua),j.rangeRound=$(Na),j.unknown=function(G){return arguments.length?(l=G,j):l},function(G){return u=G,e=G(d),t=G(b),r=e===t?0:1/(t-e),j}}function Ql(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function W0(){var e=Xu(_h()(qo));return e.copy=function(){return Ql(e,W0())},Fc.apply(e,arguments)}function V0(){var e=xa(_h());return e.copy=function(){return Ql(e,V0()).exponent(e.exponent())},Fc.apply(e,arguments)}function Lc(e,t){t===void 0&&(t=e,e=Ua);for(var r=0,u=t.length-1,l=t[0],d=new Array(u<0?0:u);r<u;)d[r]=e(l,l=t[++r]);return function(b){var k=Math.max(0,Math.min(u-1,Math.floor(b*=u)));return d[k](b-k)}}function $0(){var e,t,r,u,l,d,b,k=0,T=.5,j=1,$=1,G=qo,te=!1;function se(ve){return isNaN(ve=+ve)?b:(ve=.5+((ve=+d(ve))-t)*($*ve<$*t?u:l),G(te?Math.max(0,Math.min(1,ve)):ve))}function he(ve){return function(Be){var ze,Ue,st;return arguments.length?([ze,Ue,st]=Be,G=Lc(ve,[ze,Ue,st]),se):[G(0),G(.5),G(1)]}}
vendor: 1,749 bytes, line 7829
7829return se.domain=function(ve){return arguments.length?([k,T,j]=ve,e=d(k=+k),t=d(T=+T),r=d(j=+j),u=e===t?0:.5/(t-e),l=t===r?0:.5/(r-t),$=t<e?-1:1,se):[k,T,j]},se.clamp=function(ve){return arguments.length?(te=!!ve,se):te},se.interpolator=function(ve){return arguments.length?(G=ve,se):G},se.range=he(Ua),se.rangeRound=he(Na),se.unknown=function(ve){return arguments.length?(b=ve,se):b},function(ve){return d=ve,e=ve(k),t=ve(T),r=ve(j),u=e===t?0:.5/(t-e),l=t===r?0:.5/(r-t),$=t<e?-1:1,se}}function Bp(){var e=xa($0());return e.copy=function(){return Ql(e,Bp()).exponent(e.exponent())},Fc.apply(e,arguments)}var Ym,v1=function(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}},Xm=function(e,t){var r=Ci(+e,+t);return function(u){var l=r(u);return l-360*Math.floor(l/360)}},Zl=180/Math.PI,Jm={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Yv=function(e,t,r,u,l,d){var b,k,T;return(b=Math.sqrt(e*e+t*t))&&(e/=b,t/=b),(T=e*r+t*u)&&(r-=e*T,u-=t*T),(k=Math.sqrt(r*r+u*u))&&(r/=k,u/=k,T/=k),e*u<t*r&&(e=-e,t=-t,T=-T,b=-b),{translateX:l,translateY:d,rotate:Math.atan2(t,e)*Zl,skewX:Math.atan(T)*Zl,scaleX:b,scaleY:k}};function Xv(e,t,r,u){function l(d){return d.length?d.pop()+" ":""}return function(d,b){var k=[],T=[];return d=e(d),b=e(b),function(j,$,G,te,se,he){if(j!==G||$!==te){var ve=se.push("translate(",null,t,null,r);he.push({i:ve-4,x:Zi(j,G)},{i:ve-2,x:Zi($,te)})}else(G||te)&&se.push("translate("+G+t+te+r)}(d.translateX,d.translateY,b.translateX,b.translateY,k,T),function(j,$,G,te){j!==$?(j-$>180?$+=360:$-j>180&&(j+=360),te.push({i:G.push(l(G)+"rotate(",null,u)-2,x:Zi(j,$)})):$&&G.push(l(G)+"rotate("+$+u)}(d.rotate,b.rotate,k,T),function(j,$,G,te){j!==$?te.push({i:G.push(l(G)+"skewX(",
vendor: 4,889 bytes, line 7829
7829null,u)-2,x:Zi(j,$)}):$&&G.push(l(G)+"skewX("+$+u)}(d.skewX,b.skewX,k,T),function(j,$,G,te,se,he){if(j!==G||$!==te){var ve=se.push(l(se)+"scale(",null,",",null,")");he.push({i:ve-4,x:Zi(j,G)},{i:ve-2,x:Zi($,te)})}else G===1&&te===1||se.push(l(se)+"scale("+G+","+te+")")}(d.scaleX,d.scaleY,b.scaleX,b.scaleY,k,T),d=b=null,function(j){for(var $,G=-1,te=T.length;++G<te;)k[($=T[G]).i]=$.x(j);return k.join("")}}}var H0=Xv(function(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Jm:Yv(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Db=Xv(function(e){return e==null?Jm:(Ym||(Ym=document.createElementNS("http://www.w3.org/2000/svg","g")),Ym.setAttribute("transform",e),(e=Ym.transform.baseVal.consolidate())?(e=e.matrix,Yv(e.a,e.b,e.c,e.d,e.e,e.f)):Jm)},", ",")",")"),Tb=1e-12;function Fo(e){return((e=Math.exp(e))+1/e)/2}var Jv=function e(t,r,u){function l(d,b){var k,T,j=d[0],$=d[1],G=d[2],te=b[0],se=b[1],he=b[2],ve=te-j,Be=se-$,ze=ve*ve+Be*Be;if(ze<Tb)T=Math.log(he/G)/t,k=function(Ct){return[j+Ct*ve,$+Ct*Be,G*Math.exp(t*Ct*T)]};else{var Ue=Math.sqrt(ze),st=(he*he-G*G+u*ze)/(2*G*r*Ue),ut=(he*he-G*G-u*ze)/(2*he*r*Ue),mt=Math.log(Math.sqrt(st*st+1)-st),pt=Math.log(Math.sqrt(ut*ut+1)-ut);T=(pt-mt)/t,k=function(Ct){var Et=Ct*T,mn=Fo(mt),An=G/(r*Ue)*(mn*function(xn){return((xn=Math.exp(2*xn))-1)/(xn+1)}(t*Et+mt)-function(xn){return((xn=Math.exp(xn))-1/xn)/2}(mt));return[j+An*ve,$+An*Be,G*mn/Fo(t*Et+mt)]}}return k.duration=1e3*T*t/Math.SQRT2,k}return l.rho=function(d){var b=Math.max(.001,+d),k=b*b;return e(b,k,k*k)},l}(Math.SQRT2,2,4);function Qv(e){return function(t,r){var u=e((t=lr(t)).h,(r=lr(r)).h),l=si(t.s,r.s),d=si(t.l,r.l),b=si(t.opacity,r.opacity);return function(k){return t.h=u(k),t.s=l(k),t.l=d(k),t.opacity=b(k),t+""}}}var Wg=Qv(Ci),Zv=Qv(si);const Qm=Math.PI/180,Tf=180/Math.PI,Nf=.96422,ey=1,ty=.82521,Pp=4/29,kh=6/29,jp=3*kh*kh,Nb=kh*kh*kh;function Vg(e){if(e instanceof zc)return new zc(e.l,e.a,e.b,e.opacity);if(e instanceof ol)return ry(e);e instanceof gt||(e=qt(e));var t,r,u=ny(e.r),l=ny(e.g),d=ny(e.b),b=bd((.2225045*u+.7168786*l+.0606169*d)/ey);return u===l&&l===d?t=r=b:(t=bd((.4360747*u+.3850649*l+.1430804*d)/Nf),r=bd((.0139322*u+.0971045*l+.7141733*d)/ty)),new zc(116*b-16,500*(t-b),200*(b-r),e.opacity)}function If(e,t,r,u){return arguments.length===1?Vg(e):new zc(e,t,r,u??1)}function zc(e,t,r,u){this.l=+e,this.a=+t,this.b=+r,this.opacity=+u}function bd(e){return e>Nb?Math.pow(e,1/3):e/jp+Pp}function xd(e){return e>kh?e*e*e:jp*(e-Pp)}function wd(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function ny(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function $g(e){if(e instanceof ol)return new ol(e.h,e.c,e.l,e.opacity);if(e instanceof zc||(e=Vg(e)),e.a===0&&e.b===0)return new ol(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Tf;return new ol(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Uc(e,t,r,u){return arguments.length===1?$g(e):new ol(e,t,r,u??1)}function ol(e,t,r,u){this.h=+e,this.c=+t,this.l=+r,this.opacity=+u}function ry(e){if(isNaN(e.h))return new zc(e.l,0,0,e.opacity);var t=e.h*Qm;return new zc(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}function Zm(e,t){var r=si((e=If(e)).l,(t=If(t)).l),u=si(e.a,t.a),l=si(e.b,t.b),d=si(e.opacity,t.opacity);return function(b){return e.l=r(b),e.a=u(b),e.b=l(b),e.opacity=d(b),e+""}}function q0(e){return function(t,r){var u=e((t=Uc(t)).h,(r=Uc(r)).h),l=si(t.c,r.c),d=si(t.l,r.l),b=si(t.opacity,r.opacity);return function(k){return t.h=u(k),t.c=l(k),t.l=d(k),t.opacity=b(k),t+""}}}Mp(zc,If,Af(Yu,{brighter:function(e){return new zc(this.l+18*(e??1),this.a,this.b,this.opacity)},darker:function(e){return new zc(this.l-18*(e??1),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return new gt(wd(3.1338561*(t=Nf*xd(t))-1.6168667*(e=ey*xd(e))-.4906146*(r=ty*xd(r))),wd(-.9787684*t+1.9161415*e+.033454*r),wd(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}})),Mp(ol,Uc,Af(Yu,{brighter:function(e){return new ol(this.h,this.c,this.l+18*(e??1),this.opacity)},darker:function(e){return new ol(this.h,this.c,this.l-18*(e??1),this.opacity)},rgb:function(){return ry(this).rgb()}}));var Ib=q0(Ci),y1=q0(si),_d=-.29227,Lp=-.90649,Eh=1.97294,Ch=Eh*Lp,iy=1.78277*Eh,G0=1.78277*_d- -.14861*Lp;function Sh(e,t,r,u){return arguments.length===1?function(l){if(l instanceof Ao)return new Ao(l.h,l.s,l.l,l.opacity);l instanceof gt||(l=qt(l));var d=l.r/255,b=l.g/255,k=l.b/255,T=(G0*k+Ch*d-iy*b)/(G0+Ch-iy),j=k-T,$=(Eh*(b-T)-_d*j)/Lp,G=Math.sqrt($*$+j*j)/(Eh*T*(1-T)),te=G?Math.atan2($,j)*Tf-120:NaN;return new Ao(te<0?te+360:te,G,T,l.opacity)}(e):new Ao(e,t,r,u??1)}function Ao(e,t,r,u){this.h=+e,this.s=+t,this.l=+r,this.opacity=+u}function kd(e){return function t(r){function u(l,d){var b=e((l=Sh(l)).h,(d=Sh(d)
7829).h),k=si(l.s,d.s),T=si(l.l,d.l),j=si(l.opacity,d.opacity);return function($){return l.h=b($),l.s=k($),l.l=T(Math.pow($,r)),l.opacity=j($),l+""}}return r=+r,u.gamma=t,u}(1)}Mp(Ao,Sh,Af(Yu,{brighter:function(e){return e=e==null?1/.7:Math.pow(1/.7,e),new Ao(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=e==null?.7:Math.pow(.7,e),new Ao(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*Qm,t=+this.l,r=isNaN(this.s)?0:this.s*t*(1-t),u=Math.cos(e),l=Math.sin(e);return new gt(255*(t+r*(-.14861*u+1.78277*l)),255*(t+r*(_d*u+Lp*l)),255*(t+r*(Eh*u)),this.opacity)}}));var zp=kd(Ci),b1=kd(si),x1=function(e,t){for(var r=new Array(t),u=0;u<t;++u)r[u]=e(u/(t-1));return r};function Hg(e,t,r){const u=e-t+2*r;return e?u>0?u:1:0}const Ed="linear",Mf="log",eg="pow",Up="sqrt",Ah="symlog",Cd="time",Sd="utc",Wc="sequential",Wp="diverging",Oh="quantile",Ff="quantize",ef="threshold",Dh="ordinal",qg="point",Th="band",tf="bin-ordinal",Gs="continuous",Dl="discrete",Vc="discretizing",bc="interpolating",Vp="temporal";function Gg(){const e=Sl().unknown(void 0),t=e.domain,r=e.range;let u,l,d=[0,1],b=!1,k=0,T=0,j=.5;function $(){const G=t().length,te=d[1]<d[0],se=d[1-te],he=Hg(G,k,T);let ve=d[te-0];u=(se-ve)/(he||1),b&&(u=Math.floor(u)),ve+=(se-ve-u*(G-k))*j,l=u*(1-k),b&&(ve=Math.round(ve),l=Math.round(l));const Be=vu(G).map(ze=>ve+u*ze);return r(te?Be.reverse():Be)}return delete e.unknown,e.domain=function(G){return arguments.length?(t(G),$()):t()},e.range=function(G){return arguments.length?(d=[+G[0],+G[1]],$()):d.slice()},e.rangeRound=function(G){return d=[+G[0],+G[1]],b=!0,$()},e.bandwidth=function(){return l},e.step=function(){return u},e.round=function(G){return arguments.length?(b=!!G,$()):b},e.padding=function(G){return arguments.length?(T=Math.max(0,Math.min(1,G)),k=T,$()):k},e.paddingInner=function(G){return arguments.length?(k=Math.max(0,Math.min(1,G)),$()):k},e.paddingOuter=function(G){return arguments.length?(T=Math.max(0,Math.min(1,G)),$()):T},e.align=function(G){return arguments.length?(j=Math.max(0,Math.min(1,G)),$()):j},e.invertRange=function(G){if(G[0]==null||G[1]==null)return;const te=d[1]<d[0],se=te?r().reverse():r(),he=se.length-1;let ve,Be,ze,Ue=+G[0],st=+G[1];return Ue!=Ue||st!=st||(st<Ue&&(ze=Ue,Ue=st,st=ze),st<se[0]||Ue>d[1-te])?void 0:(ve=Math.max(0,ps(se,Ue)-1),Be=Ue===st?ve:ps(se,st)-1,Ue-se[ve]>l+1e-10&&++ve,te&&(ze=ve,ve=he-Be,Be=he-ze),ve>Be?void 0:t().slice(ve,Be+1))},e.invert=function(G){const te=e.invertRange([G,G]);return te&&te[0]},e.copy=function(){return Gg().domain(t()).range(d).round(b).paddingInner(k).paddingOuter(T).align(j)},$()}var K0=Array.prototype.map;const Y0=Array.prototype.slice,tg={};function da(e,t,r){return arguments.length>1?(tg[e]=function(u,l,d){const b=function(){const k=l();return k.invertRange||(k.invertRange=k.invert?function(T){return function(j){let $,G=j[0],te=j[1];return te<G&&($=G,G=te,te=$),[T.invert(G),T.invert(te)]}}(k):k.invertExtent?function(T){return function(j){const $=T.range();let G,te,se,he,ve=j[0],Be=j[1],ze=-1;for(Be<ve&&(te=ve,ve=Be,Be=te),se=0,he=$.length;se<he;++se)$[se]>=ve&&$[se]<=Be&&(ze<0&&(ze=se),G=se);if(!(ze<0))return ve=T.invertExtent($[ze]),Be=T.invertExtent($[G]),[ve[0]===void 0?ve[1]:ve[0],Be[1]===void 0?Be[0]:Be[1]]}}(k):void 0),k.type=u,k};return b.metadata=Object(xe.Fa)(Object(xe.i)(d)),b}(e,t,r),this):ng(e)?tg[e]:void 0}function ng(e){return Object(xe.w)(tg,e)}function Tl(e,t){const r=tg[e];return r&&r.metadata[t]}function Nh(e){return Tl(e,Gs)}function Ih(e){return Tl(e,Dl)}function rg(e){return Tl(e,Vc)}function Kg(e){return Tl(e,Mf)}function Yg(e){return Tl(e,bc)}function Xg(e){return Tl(e,Oh)}da("identity",function e(t){var r;function u(l){return l==null||isNaN(l=+l)?r:l}return u.invert=u,u.domain=u.range=function(l){return arguments.length?(t=Array.from(l,Hs),u):t.slice()},u.unknown=function(l){return arguments.length?(r=l,u):r},u.copy=function(){return e(t).unknown(r)},t=arguments.length?Array.from(t,Hs):[0,1],Xu(u)}),da(Ed,function e(){var t=Al();return t.copy=function(){return ws(t,e())},Ku.apply(t,arguments),Xu(t)}
7829,Gs),da(Mf,function e(){var t=Su(la()).domain([1,10]);return t.copy=function(){return ws(t,e()).base(t.base())},Ku.apply(t,arguments),t},[Gs,Mf]),da(eg,qs,Gs),da(Up,function(){return qs.apply(null,arguments).exponent(.5)},Gs),da(Ah,function e(){var t=Of(la());return t.copy=function(){return ws(t,e()).constant(t.constant())},Ku.apply(t,arguments)},Gs),da(Cd,function(){return Ku.apply(Rp(Km,L0,$v.a,P0.a,B0.b,Vv.a,Wv.a,yd.a,Df.a,z0.a).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},[Gs,Vp]),da(Sd,function(){return Ku.apply(Rp(Jl,wh,Gv.a,qv.a,Gm.b,xh.a,Hv.a,j0.a,Df.a,z0.c).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},[Gs,Vp]),da(Wc,W0,[Gs,bc]),da("".concat(Wc,"-").concat(Ed),W0,[Gs,bc]),da("".concat(Wc,"-").concat(Mf),function e(){var t=Su(_h()).domain([1,10]);return t.copy=function(){return Ql(t,e()).base(t.base())},Fc.apply(t,arguments)},[Gs,bc,Mf]),da("".concat(Wc,"-").concat(eg),V0,[Gs,bc]),da("".concat(Wc,"-").concat(Up),function(){return V0.apply(null,arguments).exponent(.5)},[Gs,bc]),da("".concat(Wc,"-").concat(Ah),function e(){var t=Of(_h());return t.copy=function(){return Ql(t,e()).constant(t.constant())},Fc.apply(t,arguments)},[Gs,bc]),da("".concat(Wp,"-").concat(Ed),function e(){var t=Xu($0()(qo));return t.copy=function(){return Ql(t,e())},Fc.apply(t,arguments)},[Gs,bc]),da("".concat(Wp,"-").concat(Mf),function e(){var t=Su($0()).domain([.1,1,10]);return t.copy=function(){return Ql(t,e()).base(t.base())},Fc.apply(t,arguments)},[Gs,bc,Mf]),da("".concat(Wp,"-").concat(eg),Bp,[Gs,bc]),da("".concat(Wp,"-").concat(Up),function(){return Bp.apply(null,arguments).exponent(.5)},[Gs,bc]),da("".concat(Wp,"-").concat(Ah),function e(){var t=Of($0());return t.copy=function(){return Ql(t,e()).constant(t.constant())},Fc.apply(t,arguments)},[Gs,bc]),da(Oh,function e(){var t,r=[],u=[],l=[];function d(){var k=0,T=Math.max(1,u.length);for(l=new Array(T-1);++k<T;)l[k-1]=Ii(r,k/T);return b}function b(k){return k==null||isNaN(k=+k)?t:u[Da(l,k)]}return b.invertExtent=function(k){var T=u.indexOf(k);return T<0?[NaN,NaN]:[T>0?l[T-1]:r[0],T<l.length?l[T]:r[r.length-1]]},b.domain=function(k){if(!arguments.length)return r.slice();r=[];for(let T of k)T==null||isNaN(T=+T)||r.push(T);return r.sort($n.a),d()},b.range=function(k){return arguments.length?(u=Array.from(k),d()):u.slice()},b.unknown=function(k){return arguments.length?(t=k,b):t},b.quantiles=function(){return l.slice()},b.copy=function(){return e().domain(r).range(u).unknown(t)},Ku.apply(b,arguments)},[Vc,Oh]),da(Ff,function e(){var t,r=0,u=1,l=1,d=[.5],b=[0,1];function k(j){return j!=null&&j<=j?b[Da(d,j,0,l)]:t}function T(){var j=-1;for(d=new Array(l);++j<l;)d[j]=((j+1)*u-(j-l)*r)/(l+1);return k}return k.domain=function(j){return arguments.length?([r,u]=j,r=+r,u=+u,T()):[r,u]},k.range=function(j){return arguments.length?(l=(b=Array.from(j)).length-1,T()):b.slice()},k.invertExtent=function(j){var $=b.indexOf(j);return $<0?[NaN,NaN]:$<1?[r,d[0]]:$>=l?[d[l-1],u]:[d[$-1],d[$]]},k.unknown=function(j){return arguments.length&&(t=j),k},k.thresholds=function(){return d.slice()},k.copy=function(){return e().domain([r,u]).range(b).unknown(t)},Ku.apply(Xu(k),arguments)},Vc),da(ef,function e(){var t,r=[.5],u=[0,1],l=1;function d(b){return b!=null&&b<=b?u[Da(r,b,0,l)]:t}return d.domain=function(b){return arguments.length?(r=Array.from(b),l=Math.min(r.length,u.length-1),d):r.slice()},d.range=function(b){return arguments.length?(u=Array.from(b),l=Math.min(r.length,u.length-1),d):u.slice()},d.invertExtent=function(b){var k=u.indexOf(b);return[r[k-1],r[k]]},d.unknown=function(b){return arguments.length?(t=b,d):t},d.copy=function(){return e().domain(r).range(u).unknown(t)},Ku.apply(d,arguments)},Vc),da(tf,function e(){let t=[],r=[];function u(l){return l==null||l!=l?void 0:r[(Da(t,l)-1)%r.length]}return u.domain=function(l){return arguments.length?(t=function(d){return K0.call(d,xe.Ea)}(l),u):t.slice()},u.range=function(l){return arguments.length?(r=Y0.call(l),u):r.slice()},u.tickFormat=function(l,d){return Sf(t[0],Object(xe.W)(t),l??10,d)},u.copy=function(){return e().domain(u.domain()).range(u.range())},u},[Dl,Vc]),da(Dh,Sl,Dl),da(Th,Gg,Dl),da(qg,function(){return function e(t){const r=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return e(r())},t}(Gg().paddingInner(1))},Dl);const oy=["clamp","base","constant","exponent"];function Jg(e,t){const r=t[0],u=Object(xe.W)(t)-r;return function(l){return e(r+l*u)}}function Ad(e,t,r){return Lc(Zg(t||"rgb",r),e)}function Qg(e,t){const r=new Array(t),u=t+1;for(let l=0;l<t;)r[l]=e(++l/u);return r}function $p(e,t,r){const u=r-t;let l,d,b;return u&&Number.isFinite(u)?(l=(d=e.type).indexOf("-"),d=l<0?d:d.slice(l+1),b=da(d)().domain([t,r]).range([0,1]),oy.forEach(k=>e[k]?b[k](e[k]()):0),b):Object(xe.m)(.5)}function Zg(e,t){const r=g[function(u){return"interpolate"+u.toLowerCase().split("-").map(l=>l[0].toUpperCase()+l.slice(1)).join("")}(e)];return t!=null&&r&&r.gamma?r.gamma(t):r}function X0(e){const t=e.length/6|0,r=new Array(t);for(let u=0;u<t;)r[u]="#"+e.slice(6*u,6*++u);return r}function J0(e,t){for(const r in e)Q0(r,t(e[r]))}const ig={};function Q0(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(ig[e]=t,this):ig[e]}J0({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"}
7829,X0),J0({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",dar
7829kMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},e=>Ad(X0(e)));const e0="symbol",ay="discrete",Rf=e=>Object(xe.B)(e)?e.map(t=>String(t)):String(e),w1=(e,t)=>e[1]-t[1],sy=(e,t)=>t[1]-e[1];function og(e,t,r){let u;return Object(xe.G)(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),r!=null&&(t=Math.min(t,Math.floor(Object(xe.Z)(e.domain())/r||1)))),Object(xe.H)(t)&&(u=t.step,t=t.interval),Object(xe.J)(t)&&(t=e.type===Cd?Object(gr.p)(t):e.type==Sd?Object(gr.v)(t):Object(xe.o)("Only time and utc scales accept interval strings."),u&&(t=t.every(u))),t}function uy(e,t,r){let u=e.range(),l=u[0],d=Object(xe.W)(u),b=w1;if(l>d&&(u=d,d=l,l=u,b=sy),l=Math.floor(l),d=Math.ceil(d),t=t.map(k=>[k,e(k)]).filter(k=>l<=k[1]&&k[1]<=d).sort(b).map(k=>k[0]),r>0&&t.length>1){const k=[t[0],Object(xe.W)(t)];for(;t.length>r&&t.length>=3;)t=t.filter((T,j)=>!(j%2));t.length<3&&(t=k)}return t}function Od(e,t){return e.bins?uy(e,e.bins):e.ticks?e.ticks(t):e.domain()}function cy(e,t,r,u,l,d){const b=t.type;let k=Rf;if(b===Cd||l===Cd)k=e.timeFormat(u);else if(b===Sd||l===Sd)k=e.utcFormat(u);else if(Kg(b)){const T=e.formatFloat(u);if(d||t.bins)k=T;else{const j=ag(t,r,!1);k=$=>j($)?T($):""}}else if(t.tickFormat){const T=t.domain();k=e.formatSpan(T[0],T[T.length-1],r,u)}else u&&(k=e.format(u));return k}function ag(e,t,r){const u=Od(e,t),l=e.base(),d=Math.log(l),b=Math.max(1,l*t/u.length),k=T=>{let j=T/Math.pow(l,Math.round(Math.log(T)/d));return j*l<l-.5&&(j*=l),j<=b};return r?u.filter(k):k}const t0={[Oh]:"quantiles",[Ff]:"thresholds",[ef]:"domain"},ly={[Oh]:"quantiles",[Ff]:"domain"};function fy(e,t){return e.bins?function(r){const u=r.slice(0,-1);return u.max=Object(xe.W)(r),u}(e.bins):e.type===Mf?ag(e,t,!0):t0[e.type]?function(r){const u=[-1/0].concat(r);return u.max=1/0,u}(e[t0[e.type]]()):Od(e,t)}const Z0=e=>t0[e.type]||e.bins;function dy(e,t,r,u,l,d,b){const k=ly[t.type]&&d!==Cd&&d!==Sd?function(T,j,$){const G=j[ly[j.type]](),te=G.length;let se,he=te>1?G[1]-G[0]:G[0];for(se=1;se<te;++se)he=Math.min(he,G[se]-G[se-1]);return T.formatSpan(0,he,30,$)}(e,t,l):cy(e,t,r,l,d,b);return u===e0&&Z0(t)?hy(k):u===ay?_1(k):py(k)}const hy=e=>(t,r,u)=>{const l=Mh(u[r+1],Mh(u.max,1/0)),d=Bf(t,e),b=Bf(l,e);return d&&b?d+" â "+b:b?"< "+b:"⥠"+d},Mh=(e,t)=>e??t,_1=e=>(t,r)=>r?e(t):null,py=e=>t=>e(t),Bf=(e,t)=>Number.isFinite(e)?t(e):null;function ev(e,t,r,u){const l=u||t.type;return Object(xe.J)(r)&&function(d){return Tl(d,Vp)}(l)&&(r=r.replace(/%a/g,"%A").replace(/%b/g,"%B")),r||l!==Cd?r||l!==Sd?dy(e,t,5,null,r,u,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}function my(e,t,r){r=r||{};const u=Math.max(3,r.maxlen||7),l=ev(e,t,r.format,r.formatType);if(rg(t.type)){const d=fy(t).slice(1).map(l),b=d.length;return"".concat(b," boundar").concat(b===1?"y":"ies",": ").concat(d.join(", "))}if(Ih(t.type)){const d=t.domain(),b=d.length,k=b>u?d.slice(0,u-2).map(l).join(", ")+", ending with "+d.slice(-1).map(l):d.map(l).join(", ");return"".concat(b," value").concat(b===1?"":"s",": ").concat(k)}{const d=t.domain();return"values from ".concat(l(d[0])," to ").concat(l(Object(xe.W)(d)))}}let Fh=0;const Pf="p_";function n0(e){return e&&e.gradient}function tv(e,t,r){const u=e.gradient;let l=e.id,d=u==="radial"?Pf:"";return l||(l=e.id="gradient_"+Fh++,u==="radial"?(e.x1=Nl(e.x1,.5),e.y1=Nl(e.y1,.5),e.r1=Nl(e.r1,0),e.x2=Nl(e.x2,.5),e.y2=Nl(e.y2,.5),e.r2=Nl(e.r2,.5),d=Pf):(e.x1=Nl(e.x1,0),e.y1=Nl(e.y1,0),e.x2=Nl(e.x2,1),e.y2=Nl(e.y2,0))),t[l]=e,"url("+(r||"")+"#"+d+l+")"}function Nl(e,t){return e??t}function nv(e,t){var r,u=[];return r={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:u,stop:function(l,d){return u.push({offset:l,color:d}),r}}}const gy={basis:{curve:function(e){return new Ap(e)}},"basis-closed":{curve:function(e){return new Op(e)}},"basis-open":{curve:function(e){return new ud(e)}},bundle:{curve:cd,tension:"beta",value:.85},cardinal:{curve:Tp,tension:"tension",value:0},"cardinal-open":{curve:ld,tension:"tension",value:0},"cardinal-closed":{curve:F0,tension:"tension",value:0}
7829,"catmull-rom":{curve:nl,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Um,tension:"alpha",value:.5},"catmull-rom-open":{curve:Ug,tension:"alpha",value:.5},linear:{curve:Ef},"linear-closed":{curve:function(e){return new Wm(e)}},monotone:{horizontal:function(e){return new ph(e)},vertical:function(e){return new pd(e)}},natural:{curve:function(e){return new Vm(e)}},step:{curve:function(e){return new md(e,.5)}},"step-after":{curve:function(e){return new md(e,1)}},"step-before":{curve:function(e){return new md(e,0)}}};function Dd(e,t,r){var u=Object(xe.w)(gy,e)&&gy[e],l=null;return u&&(l=u.curve||u[t||"vertical"],u.tension&&r!=null&&(l=l[u.tension](r))),l}const k1={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},Hp=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\.\d+)(\.\d)/g,/(\d)([-+])/g,/\s|,|###/];function qp(e){const t=[];let r,u,l,d,b,k,T,j,$,G;const te=e.slice().replace(Hp[0],"###$1").split(Hp[1]).slice(1);for(T=0,$=te.length;T<$;++T){for(u=(r=te[T]).slice(1).trim().replace(Hp[2],"$1###$2").replace(Hp[3],"$1###$2").split(Hp[4]),l=[b=r.charAt(0)],j=0,G=u.length;j<G;++j)(d=+u[j])===d&&l.push(d);if(k=k1[b.toLowerCase()],l.length-1>k){const se=l.length;for(j=1,t.push([b].concat(l.slice(j,j+=k))),b=b==="M"?"L":b==="m"?"l":b;j<se;j+=k)t.push([b].concat(l.slice(j,j+k)))}else t.push(l)}return t}const Td=Math.PI/180,vy=1e-14,Rh=Math.PI/2,Il=2*Math.PI,Gp=Math.sqrt(3)/2;var sg={},r0={},rv=[].join;function yy(e){const t=rv.call(e);if(r0[t])return r0[t];var r=e[0],u=e[1],l=e[2],d=e[3],b=e[4],k=e[5],T=e[6],j=e[7];const $=j*b,G=-T*k,te=T*b,se=j*k,he=Math.cos(l),ve=Math.sin(l),Be=Math.cos(d),ze=Math.sin(d),Ue=.5*(d-l),st=Math.sin(.5*Ue),ut=8/3*st*st/Math.sin(Ue),mt=r+he-ut*ve,pt=u+ve+ut*he,Ct=r+Be,Et=u+ze,mn=Ct+ut*ze,An=Et-ut*Be;return r0[t]=[$*mt+G*pt,te*mt+se*pt,$*mn+G*An,te*mn+se*An,$*Ct+G*Et,te*Ct+se*Et]}const Ks=["l",0,0,0,0,0,0,0];function by(e,t,r){const u=Ks[0]=e[0];if(u==="a"||u==="A")Ks[1]=t*e[1],Ks[2]=r*e[2],Ks[3]=e[3],Ks[4]=e[4],Ks[5]=e[5],Ks[6]=t*e[6],Ks[7]=r*e[7];else if(u==="h"||u==="H")Ks[1]=t*e[1];else if(u==="v"||u==="V")Ks[1]=r*e[1];else for(var l=1,d=e.length;l<d;++l)Ks[l]=(l%2==1?t:r)*e[l];return Ks}function Kp(e,t,r,u,l,d){var b,k,T,j,$,G=null,te=0,se=0,he=0,ve=0;r==null&&(r=0),u==null&&(u=0),l==null&&(l=1),d==null&&(d=l),e.beginPath&&e.beginPath();for(var Be=0,ze=t.length;Be<ze;++Be){switch(b=t[Be],l===1&&d===1||(b=by(b,l,d)),b[0]){case"l":te+=b[1],se+=b[2],e.lineTo(te+r,se+u);break;case"L":te=b[1],se=b[2],e.lineTo(te+r,se+u);break;case"h":te+=b[1],e.lineTo(te+r,se+u);break;case"H":te=b[1],e.lineTo(te+r,se+u);break;case"v":se+=b[1],e.lineTo(te+r,se+u);break;case"V":se=b[1],e.lineTo(te+r,se+u);break;case"m":te+=b[1],se+=b[2],e.moveTo(te+r,se+u);break;case"M":te=b[1],se=b[2],e.moveTo(te+r,se+u);break;case"c":k=te+b[5],T=se+b[6],he=te+b[3],ve=se+b[4],e.bezierCurveTo(te+b[1]+r,se+b[2]+u,he+r,ve+u,k+r,T+u),te=k,se=T;break;case"C":te=b[5],se=b[6],he=b[3],ve=b[4],e.bezierCurveTo(b[1]+r,b[2]+u,he+r,ve+u,te+r,
vendor: 5,104 bytes, line 7829
7829se+u);break;case"s":k=te+b[3],T=se+b[4],he=2*te-he,ve=2*se-ve,e.bezierCurveTo(he+r,ve+u,te+b[1]+r,se+b[2]+u,k+r,T+u),he=te+b[1],ve=se+b[2],te=k,se=T;break;case"S":k=b[3],T=b[4],he=2*te-he,ve=2*se-ve,e.bezierCurveTo(he+r,ve+u,b[1]+r,b[2]+u,k+r,T+u),te=k,se=T,he=b[1],ve=b[2];break;case"q":k=te+b[3],T=se+b[4],he=te+b[1],ve=se+b[2],e.quadraticCurveTo(he+r,ve+u,k+r,T+u),te=k,se=T;break;case"Q":k=b[3],T=b[4],e.quadraticCurveTo(b[1]+r,b[2]+u,k+r,T+u),te=k,se=T,he=b[1],ve=b[2];break;case"t":k=te+b[1],T=se+b[2],G[0].match(/[QqTt]/)===null?(he=te,ve=se):G[0]==="t"?(he=2*te-j,ve=2*se-$):G[0]==="q"&&(he=2*te-he,ve=2*se-ve),j=he,$=ve,e.quadraticCurveTo(he+r,ve+u,k+r,T+u),se=T,he=(te=k)+b[1],ve=se+b[2];break;case"T":k=b[1],T=b[2],he=2*te-he,ve=2*se-ve,e.quadraticCurveTo(he+r,ve+u,k+r,T+u),te=k,se=T;break;case"a":xy(e,te+r,se+u,[b[1],b[2],b[3],b[4],b[5],b[6]+te+r,b[7]+se+u]),te+=b[6],se+=b[7];break;case"A":xy(e,te+r,se+u,[b[1],b[2],b[3],b[4],b[5],b[6]+r,b[7]+u]),te=b[6],se=b[7];break;case"z":case"Z":e.closePath()}G=b}}function xy(e,t,r,u){const l=function(d,b,k,T,j,$,G,te,se){const he=rv.call(arguments);if(sg[he])return sg[he];const ve=G*Td,Be=Math.sin(ve),ze=Math.cos(ve),Ue=ze*(te-d)*.5+Be*(se-b)*.5,st=ze*(se-b)*.5-Be*(te-d)*.5;let ut=Ue*Ue/((k=Math.abs(k))*k)+st*st/((T=Math.abs(T))*T);ut>1&&(k*=ut=Math.sqrt(ut),T*=ut);const mt=ze/k,pt=Be/k,Ct=-Be/T,Et=ze/T,mn=mt*te+pt*se,An=Ct*te+Et*se,xn=mt*d+pt*b,Wn=Ct*d+Et*b;let Un=1/((xn-mn)*(xn-mn)+(Wn-An)*(Wn-An))-.25;Un<0&&(Un=0);let Kn=Math.sqrt(Un);$==j&&(Kn=-Kn);const Qn=.5*(mn+xn)-Kn*(Wn-An),ir=.5*(An+Wn)+Kn*(xn-mn),Nr=Math.atan2(An-ir,mn-Qn);let Jr=Math.atan2(Wn-ir,xn-Qn)-Nr;Jr<0&&$===1?Jr+=Il:Jr>0&&$===0&&(Jr-=Il);const Lr=Math.ceil(Math.abs(Jr/(Rh+.001))),hi=[];for(let Ri=0;Ri<Lr;++Ri){const Pi=Nr+Ri*Jr/Lr,so=Nr+(Ri+1)*Jr/Lr;hi[Ri]=[Qn,ir,Pi,so,k,T,Be,ze]}return sg[he]=hi}(u[5],u[6],u[0],u[1],u[3],u[4],u[2],t,r);for(let d=0;d<l.length;++d){const b=yy(l[d]);e.bezierCurveTo(b[0],b[1],b[2],b[3],b[4],b[5])}}const i0={circle:{draw:function(e,t){const r=Math.sqrt(t)/2;e.moveTo(r,0),e.arc(0,0,r,0,Il)}},cross:{draw:function(e,t){var r=Math.sqrt(t)/2,u=r/2.5;e.moveTo(-r,-u),e.lineTo(-r,u),e.lineTo(-u,u),e.lineTo(-u,r),e.lineTo(u,r),e.lineTo(u,u),e.lineTo(r,u),e.lineTo(r,-u),e.lineTo(u,-u),e.lineTo(u,-r),e.lineTo(-u,-r),e.lineTo(-u,-u),e.closePath()}},diamond:{draw:function(e,t){const r=Math.sqrt(t)/2;e.moveTo(-r,0),e.lineTo(0,-r),e.lineTo(r,0),e.lineTo(0,r),e.closePath()}},square:{draw:function(e,t){var r=Math.sqrt(t),u=-r/2;e.rect(u,u,r,r)}},arrow:{draw:function(e,t){var r=Math.sqrt(t)/2,u=r/7,l=r/2.5,d=r/8;e.moveTo(-u,r),e.lineTo(u,r),e.lineTo(u,-d),e.lineTo(l,-d),e.lineTo(0,-r),e.lineTo(-l,-d),e.lineTo(-u,-d),e.closePath()}},wedge:{draw:function(e,t){var r=Math.sqrt(t)/2,u=Gp*r,l=u-.5773502691896257*r,d=r/4;e.moveTo(0,-u-l),e.lineTo(-d,u-l),e.lineTo(d,u-l),e.closePath()}},triangle:{draw:function(e,t){var r=Math.sqrt(t)/2,u=Gp*r,l=u-.5773502691896257*r;e.moveTo(0,-u-l),e.lineTo(-r,u-l),e.lineTo(r,u-l),e.closePath()}},"triangle-up":{draw:function(e,t){var r=Math.sqrt(t)/2,u=Gp*r;e.moveTo(0,-u),e.lineTo(-r,u),e.lineTo(r,u),e.closePath()}},"triangle-down":{draw:function(e,t){var r=Math.sqrt(t)/2,u=Gp*r;e.moveTo(0,u),e.lineTo(-r,-u),e.lineTo(r,-u),e.closePath()}},"triangle-right":{draw:function(e,t){var r=Math.sqrt(t)/2,u=Gp*r;e.moveTo(u,0),e.lineTo(-u,-r),e.lineTo(-u,r),e.closePath()}},"triangle-left":{draw:function(e,t){var r=Math.sqrt(t)/2,u=Gp*r;e.moveTo(-u,0),e.lineTo(u,-r),e.lineTo(u,r),e.closePath()}},stroke:{draw:function(e,t){const r=Math.sqrt(t)/2;e.moveTo(-r,0),e.lineTo(r,0)}}};function Nd(e){return Object(xe.w)(i0,e)?i0[e]:function(t){if(!Object(xe.w)(ug,t)){const r=qp(t);ug[t]={draw:function(u,l){Kp(u,r,0,0,Math.sqrt(l)/2)}}}return ug[t]}(e)}var ug={};const jf=.448084975506;function wy(e){return e.x}function o0(e){return e.y}function a0(e){return e.width}function iv(e){return e.height}function nf(e){return typeof e=="function"?e:()=>+e}function s0(e,t,r){return Math.max(t,Math.min(e,r))}function _y(){var e=wy,t=o0,r=a0,u=iv,l=nf(0),d=l,b=l,k=l,T=null;function j($,G,te){var se,he=G??+e.call(this,$),ve=te??+t.call(this,$),Be=+r.call(this,$),ze=+u.call(this,$),Ue=Math.min(Be,ze)/2,st=s0(+l.call(this,$),0,Ue),ut=s0(+d.call(this,$),0,Ue),mt=s0(+b.call(this,$),0,Ue),pt=s0(+k.call(this,$),0,Ue);if(T||(T=se=Eu()),st<=0&&ut<=0&&mt<=0&&pt<=0)T.rect(he,ve,Be,ze);else{var Ct=he+Be,Et=ve+ze;T.moveTo(he+st,ve),T.lineTo(Ct-ut,ve),T.bezierCurveTo(Ct-jf*ut,ve,Ct,ve+jf*ut,Ct,ve+ut),T.lineTo(Ct,Et-pt),T.bezierCurveTo(Ct,Et-jf*pt,Ct-jf*pt,Et,Ct-pt,Et),T.lineTo(he+mt,Et),T.bezierCurveTo(he+jf*mt,Et,he,Et-jf*mt,he,Et-mt),T.lineTo(he,ve+st),T.bezierCurveTo(he,ve+jf*st,he+jf*st,ve,he+st,ve),T.closePath()}if(se)return T=null,se+""||null}return j.x=function($){return arguments.length?(e=nf($),j):e},j.y=function($){return arguments.length?(t=nf($),j):t},j.width=function($){return arguments.length?(r=nf($),j):r},j.height=function($){return arguments.length?(u=nf($),j):u},j.cornerRadius=function($,G,te,se){return arguments.length?(l=nf($),d=G!=null?nf(G):l,k=te!=null?nf(te):l,b=se!=null?nf(se):d,j):l}
vendor: 4,347 bytes, line 7829
7829,j.context=function($){return arguments.length?(T=$??null,j):T},j}function Lf(){var e,t,r,u,l,d,b,k,T=null;function j(G,te,se){const he=se/2;if(l){var ve=b-te,Be=G-d;if(ve||Be){var ze=Math.sqrt(ve*ve+Be*Be),Ue=(ve/=ze)*k,st=(Be/=ze)*k,ut=Math.atan2(Be,ve);T.moveTo(d-Ue,b-st),T.lineTo(G-ve*he,te-Be*he),T.arc(G,te,he,ut-Math.PI,ut),T.lineTo(d+Ue,b+st),T.arc(d,b,k,ut,ut+Math.PI)}else T.arc(G,te,he,0,Il);T.closePath()}else l=1;d=G,b=te,k=he}function $(G){var te,se,he,ve=G.length,Be=!1;for(T==null&&(T=he=Eu()),te=0;te<=ve;++te)!(te<ve&&u(se=G[te],te,G))===Be&&(Be=!Be)&&(l=0),Be&&j(+e(se,te,G),+t(se,te,G),+r(se,te,G));if(he)return T=null,he+""||null}return $.x=function(G){return arguments.length?(e=G,$):e},$.y=function(G){return arguments.length?(t=G,$):t},$.size=function(G){return arguments.length?(r=G,$):r},$.defined=function(G){return arguments.length?(u=G,$):u},$.context=function(G){return arguments.length?(T=G??null,$):T},$}function cg(e,t){return e??t}const Bh=e=>e.x||0,lg=e=>e.y||0,Ys=e=>e.defined!==!1,u0=function(){var e=gd,t=gh,r=Oo(0),u=null,l=fr,d=js,b=as,k=null;function T(){var j,$,G=+e.apply(this,arguments),te=+t.apply(this,arguments),se=l.apply(this,arguments)-tl,he=d.apply(this,arguments)-tl,ve=fd(he-se),Be=he>se;if(k||(k=j=Eu()),te<G&&($=te,te=G,G=$),te>xs)if(ve>fh-xs)k.moveTo(te*hs(se),te*_u(se)),k.arc(0,0,te,se,he,!Be),G>xs&&(k.moveTo(G*hs(he),G*_u(he)),k.arc(0,0,G,he,se,Be));else{var ze,Ue,st=se,ut=he,mt=se,pt=he,Ct=ve,Et=ve,mn=b.apply(this,arguments)/2,An=mn>xs&&(u?+u.apply(this,arguments):Kl(G*G+te*te)),xn=no(fd(te-G)/2,+r.apply(this,arguments)),Wn=xn,Un=xn;if(An>xs){var Kn=dh(An/G*_u(mn)),Qn=dh(An/te*_u(mn));(Ct-=2*Kn)>xs?(mt+=Kn*=Be?1:-1,pt-=Kn):(Ct=0,mt=pt=(se+he)/2),(Et-=2*Qn)>xs?(st+=Qn*=Be?1:-1,ut-=Qn):(Et=0,st=ut=(se+he)/2)}var ir=te*hs(st),Nr=te*_u(st),Jr=G*hs(pt),Lr=G*_u(pt);if(xn>xs){var hi,Ri=te*hs(ut),Pi=te*_u(ut),so=G*hs(mt),Ui=G*_u(mt);if(ve<Yl&&(hi=function(is,Is,Tu,Nu,uu,Xf,VD,p5){var U_=Tu-is,ib=Nu-Is,W_=VD-uu,bx=p5-Xf,ip=bx*U_-W_*ib;if(!(ip*ip<xs))return[is+(ip=(W_*(Is-Xf)-bx*(is-uu))/ip)*U_,Is+ip*ib]}(ir,Nr,so,Ui,Ri,Pi,Jr,Lr))){var ji=ir-hi[0],Yi=Nr-hi[1],Go=Ri-hi[0],Ra=Pi-hi[1],uo=1/_u(function(is){return is>1?0:is<-1?Yl:Math.acos(is)}((ji*Go+Yi*Ra)/(Kl(ji*ji+Yi*Yi)*Kl(Go*Go+Ra*Ra)))/2),rs=Kl(hi[0]*hi[0]+hi[1]*hi[1]);Wn=no(xn,(G-rs)/(uo-1)),Un=no(xn,(te-rs)/(uo+1))}}Et>xs?Un>xs?(ze=ho(so,Ui,ir,Nr,te,Un,Be),Ue=ho(Ri,Pi,Jr,Lr,te,Un,Be),k.moveTo(ze.cx+ze.x01,ze.cy+ze.y01),Un<xn?k.arc(ze.cx,ze.cy,Un,Pa(ze.y01,ze.x01),Pa(Ue.y01,Ue.x01),!Be):(k.arc(ze.cx,ze.cy,Un,Pa(ze.y01,ze.x01),Pa(ze.y11,ze.x11),!Be),k.arc(0,0,te,Pa(ze.cy+ze.y11,ze.cx+ze.x11),Pa(Ue.cy+Ue.y11,Ue.cx+Ue.x11),!Be),k.arc(Ue.cx,Ue.cy,Un,Pa(Ue.y11,Ue.x11),Pa(Ue.y01,Ue.x01),!Be))):(k.moveTo(ir,Nr),k.arc(0,0,te,st,ut,!Be)):k.moveTo(ir,Nr),G>xs&&Ct>xs?Wn>xs?(ze=ho(Jr,Lr,Ri,Pi,G,-Wn,Be),Ue=ho(ir,Nr,so,Ui,G,-Wn,Be),k.lineTo(ze.cx+ze.x01,ze.cy+ze.y01),Wn<xn?k.arc(ze.cx,ze.cy,Wn,Pa(ze.y01,ze.x01),Pa(Ue.y01,Ue.x01),!Be):(k.arc(ze.cx,ze.cy,Wn,Pa(ze.y01,ze.x01),Pa(ze.y11,ze.x11),!Be),k.arc(0,0,G,Pa(ze.cy+ze.y11,ze.cx+ze.x11),Pa(Ue.cy+Ue.y11,Ue.cx+Ue.x11),Be),k.arc(Ue.cx,Ue.cy,Wn,Pa(Ue.y11,Ue.x11),Pa(Ue.y01,Ue.x01),!Be))):k.arc(0,0,G,pt,mt,Be):k.lineTo(Jr,Lr)}else k.moveTo(0,0);if(k.closePath(),j)return k=null,j+""||null}return T.centroid=function(){var j=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,$=(+l.apply(this,arguments)+ +d.apply(this,arguments))/2-Yl/2;return[hs($)*j,_u($)*j]},T.innerRadius=function(j){return arguments.length?(e=typeof j=="function"?j:Oo(+j),T):e},T.outerRadius=function(j){return arguments.length?(t=typeof j=="function"?j:Oo(+j),T):t},T.cornerRadius=function(j){return arguments.length?(r=typeof j=="function"?j:Oo(+j),T):r},T.padRadius=function(j){return arguments.length?(u=j==null?null:typeof j=="function"?j:Oo(+j),T):u},T.startAngle=function(j){return arguments.length?(l=typeof j=="function"?j:Oo(+j),T):l},T.endAngle=function(j){return arguments.length?(d=typeof j=="function"?j:Oo(+j),T):d},T.padAngle=function(j){return arguments.length?(b=typeof j=="function"?j:Oo(+j),T):b},T.context=function(j){return arguments.length?(k=j??null,T):k},T}().startAngle(e=>e.startAngle||0).endAngle(e=>e.endAngle||0).padAngle(e=>e.padAngle||0).innerRadius(e=>e.innerRadius||0).outerRadius(e=>e.outerRadius||0).cornerRadius(e=>e.cornerRadius||0),ov=Oa().x(Bh).y1(lg).y0(e=>
7829(e.y||0)+(e.height||0)).defined(Ys),fg=Oa().y(lg).x1(Bh).x0(e=>(e.x||0)+(e.width||0)).defined(Ys),dg=Cl().x(Bh).y(lg).defined(Ys),av=_y().x(Bh).y(lg).width(e=>e.width||0).height(e=>e.height||0).cornerRadius(e=>cg(e.cornerRadiusTopLeft,e.cornerRadius)||0,e=>cg(e.cornerRadiusTopRight,e.cornerRadius)||0,e=>cg(e.cornerRadiusBottomRight,e.cornerRadius)||0,e=>cg(e.cornerRadiusBottomLeft,e.cornerRadius)||0),ky=function(e,t){var r=null;function u(){var l;if(r||(r=l=Eu()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),l)return r=null,l+""||null}return e=typeof e=="function"?e:Oo(e||rl),t=typeof t=="function"?t:Oo(t===void 0?64:+t),u.type=function(l){return arguments.length?(e=typeof l=="function"?l:Oo(l),u):e},u.size=function(l){return arguments.length?(t=typeof l=="function"?l:Oo(+l),u):t},u.context=function(l){return arguments.length?(r=l??null,u):r},u}().type(e=>Nd(e.shape||"circle")).size(e=>cg(e.size,64)),E1=Lf().x(Bh).y(lg).defined(Ys).size(e=>e.size||1);function rf(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Ph(e,t,r,u){return av.context(e)(t,r,u)}var C1=1;function Ey(){C1=1}function of(e,t,r){var u=t.clip,l=e._defs,d=t.clip_id||(t.clip_id="clip"+C1++),b=l.clipping[d]||(l.clipping[d]={id:d});return Object(xe.E)(u)?b.path=u(null):rf(r)?b.path=Ph(null,r,0,0):(b.width=r.width||0,b.height=r.height||0),"url(#"+d+")"}function zs(e){this.clear(),e&&this.union(e)}function Yp(e){this.mark=e,this.bounds=this.bounds||new zs}function hg(e){Yp.call(this,e),this.items=this.items||[]}function c0(e){this._pending=0,this._loader=e||Object(jn.e)()}function Cy(e){e._pending+=1}function l0(e){e._pending-=1}function Id(e,t,r){if(t.stroke&&t.opacity!==0&&t.strokeOpacity!==0){const u=t.strokeWidth!=null?+t.strokeWidth:1;e.expand(u+(r?function(l,d){return l.strokeJoin&&l.strokeJoin!=="miter"?0:d}(t,u):0))}return e}zs.prototype={clone(){return new zs(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,r,u){return r<e?(this.x2=e,this.x1=r):(this.x1=e,this.x2=r),u<t?(this.y2=t,this.y1=u):(this.y1=t,this.y2=u),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,r){const u=this.rotatedPoints(e,t,r);return this.clear().add(u[0],u[1]).add(u[2],u[3]).add(u[4],u[5]).add(u[6],u[7])},rotatedPoints(e,t,r){var{x1:u,y1:l,x2:d,y2:b}=this,k=Math.cos(e),T=Math.sin(e),j=t-t*k+r*T,$=r-t*T-r*k;return[k*u-T*l+j,T*u+k*l+$,k*u-T*b+j,T*u+k*b+$,k*d-T*l+j,T*d+k*l+$,k*d-T*b+j,T*d+k*b+$]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},Object(xe.z)(hg,Yp),c0.prototype={pending(){return this._pending},sanitizeURL(e){const t=this;return Cy(t),t._loader.sanitize(e,{context:"href"}).then(r=>(l0(t),r)).catch(()=>(l0(t),null))},loadImage(e){const t=this,r=Mo();return Cy(t),t._loader.sanitize(e,{context:"image"}).then(u=>{const l=u.href;if(!l||!r)throw{url:l};const d=new r,b=Object(xe.w)(u,"crossOrigin")?u.crossOrigin:"anonymous";return b!=null&&(d.crossOrigin=b),d.onload=()=>l0(t),d.onerror=()=>l0(t),d.src=l,d}).catch(u=>(l0(t),{complete:!1,width:0,height:0,src:u&&u.url||""}))},ready(){const e=this;return new Promise(t=>
vendor: 6,037 bytes, line 7829
7829{(function r(u){e.pending()?setTimeout(()=>{r(!0)},10):t(u)})(!1)})}};const Mb=Il-1e-8;let f0,Ds,pg,jh,d0,mg,sv,uv;const Md=(e,t)=>f0.add(e,t),al=(e,t)=>Md(Ds=e,pg=t),Sy=e=>Md(e,f0.y1),Ay=e=>Md(f0.x1,e),Xp=(e,t)=>d0*e+sv*t,gg=(e,t)=>mg*e+uv*t,S1=(e,t)=>Md(Xp(e,t),gg(e,t)),cv=(e,t)=>al(Xp(e,t),gg(e,t));function h0(e,t){return f0=e,t?(jh=t*Td,d0=uv=Math.cos(jh),mg=Math.sin(jh),sv=-mg):(d0=uv=1,jh=mg=sv=0),Gr}const Gr={beginPath(){},closePath(){},moveTo:cv,lineTo:cv,rect(e,t,r,u){jh?(S1(e+r,t),S1(e+r,t+u),S1(e,t+u),cv(e,t)):(Md(e+r,t+u),al(e,t))},quadraticCurveTo(e,t,r,u){const l=Xp(e,t),d=gg(e,t),b=Xp(r,u),k=gg(r,u);q(Ds,l,b,Sy),q(pg,d,k,Ay),al(b,k)},bezierCurveTo(e,t,r,u,l,d){const b=Xp(e,t),k=gg(e,t),T=Xp(r,u),j=gg(r,u),$=Xp(l,d),G=gg(l,d);R(Ds,b,T,$,Sy),R(pg,k,j,G,Ay),al($,G)},arc(e,t,r,u,l,d){if(u+=jh,l+=jh,Ds=r*Math.cos(l)+e,pg=r*Math.sin(l)+t,Math.abs(l-u)>Mb)Md(e-r,t-r),Md(e+r,t+r);else{const b=j=>Md(r*Math.cos(j)+e,r*Math.sin(j)+t);let k,T;if(b(u),b(l),l!==u)if((u%=Il)<0&&(u+=Il),(l%=Il)<0&&(l+=Il),l<u&&(d=!d,k=u,u=l,l=k),d)for(l-=Il,k=u-u%Rh,T=0;T<4&&k>l;++T,k-=Rh)b(k);else for(k=u-u%Rh+Rh,T=0;T<4&&k<l;++T,k+=Rh)b(k)}}};function q(e,t,r,u){const l=(e-t)/(e+r-2*t);0<l&&l<1&&u(e+(t-e)*l)}function R(e,t,r,u,l){const d=u-e+3*t-3*r,b=e+r-2*t,k=e-t;let T,j=0,$=0;Math.abs(d)>vy?(T=b*b+k*d)>=0&&(j=(-b+(T=Math.sqrt(T)))/d,$=(-b-T)/d):j=.5*k/b,0<j&&j<1&&l(F(j,e,t,r,u)),0<$&&$<1&&l(F($,e,t,r,u))}function F(e,t,r,u,l){const d=1-e,b=d*d,k=e*e;return b*d*t+3*b*e*r+3*d*k*u+k*e*l}var I=(I=Gu(1,1))?I.getContext("2d"):null;const U=new zs;function X(e){return function(t,r){if(!I)return!0;e(I,t),U.clear().union(t.bounds).intersect(r).round();const{x1:u,y1:l,x2:d,y2:b}=U;for(let k=l;k<=b;++k)for(let T=u;T<=d;++T)if(I.isPointInPath(T,k))return!0;return!1}}function oe(e,t){return t.contains(e.x||0,e.y||0)}function me(e,t){const r=e.x||0,u=e.y||0,l=e.width||0,d=e.height||0;return t.intersects(U.set(r,u,r+l,u+d))}function Se(e,t){const r=e.x||0,u=e.y||0;return Me(t,r,u,e.x2!=null?e.x2:r,e.y2!=null?e.y2:u)}function Me(e,t,r,u,l){const{x1:d,y1:b,x2:k,y2:T}=e,j=u-t,$=l-r;let G,te,se,he,ve=0,Be=1;for(he=0;he<4;++he){if(he===0&&(G=-j,te=-(d-t)),he===1&&(G=j,te=k-t),he===2&&(G=-$,te=-(b-r)),he===3&&(G=$,te=T-r),Math.abs(G)<1e-10&&te<0)return!1;if(se=te/G,G<0){if(se>Be)return!1;se>ve&&(ve=se)}else if(G>0){if(se<ve)return!1;se<Be&&(Be=se)}}return!0}function Te(e,t){e.globalCompositeOperation=t.blend||"source-over"}function tt(e,t){return e??t}function at(e,t){const r=t.length;for(let u=0;u<r;++u)e.addColorStop(t[u].offset,t[u].color);return e}function jt(e,t,r){return n0(r)?function(u,l,d){const b=d.width(),k=d.height();let T;if(l.gradient==="radial")T=u.createRadialGradient(d.x1+tt(l.x1,.5)*b,d.y1+tt(l.y1,.5)*k,Math.max(b,k)*tt(l.r1,0),d.x1+tt(l.x2,.5)*b,d.y1+tt(l.y2,.5)*k,Math.max(b,k)*tt(l.r2,.5));else{const j=tt(l.x1,0),$=tt(l.y1,0),G=tt(l.x2,1),te=tt(l.y2,0);if(j!==G&&$!==te&&b!==k){const se=Gu(Math.ceil(b),Math.ceil(k)),he=se.getContext("2d");return he.scale(b,k),he.fillStyle=at(he.createLinearGradient(j,$,G,te),l.stops),he.fillRect(0,0,b,k),u.createPattern(se,"no-repeat")}T=u.createLinearGradient(d.x1+j*b,d.y1+$*k,d.x1+G*b,d.y1+te*k)}return at(T,l.stops)}(e,r,t.bounds):r}function $t(e,t,r){return(r*=t.fillOpacity==null?1:t.fillOpacity)>0&&(e.globalAlpha=r,e.fillStyle=jt(e,t,t.fill),!0)}var vn=[];function wn(e,t,r){var u=(u=t.strokeWidth)!=null?u:1;return!(u<=0)&&(r*=t.strokeOpacity==null?1:t.strokeOpacity)>0&&(e.globalAlpha=r,e.strokeStyle=jt(e,t,t.stroke),e.lineWidth=u,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||vn),e.lineDashOffset=t.strokeDashOffset||0),!0)}function Nn(e,t){return e.zindex-t.zindex||e.index-t.index}function In(e){if(!e.zdirty)return e.zitems;var t,r,u,l=e.items,d=[];for(r=0,u=l.length;r<u;++r)(t=l[r]).index=r,t.zindex&&d.push(t);return e.zdirty=!1,e.zitems=d.sort(Nn)}function Ln(e,t){var r,u,l=e.items;if(!l||!l.length)return;const d=In(e);if(d&&d.length){for(r=0,u=l.length;r<u;++r)l[r].zindex||t(l[r]);l=d}for(r=0,u=l.length;r<u;++r)t(l[r])}function qn(e,t){var r,u,l=e.items;if(!l||!l.length)return null;const d=In(e);for(d&&d.length&&(l=d),u=l.length;--u>=0;)if(r=t(l[u]))return r;if(l===d){for(u=(l=e.items).length;--u>=0;)if(!l[u].zindex&&(r=t(l[u])))return r}return null}function Cn(e){return function(t,r,u){Ln(r,l=>{u&&!u.intersects(l.bounds)||wr(e,t,l,l)})}}function wr(e,t,r,u){var l=r.opacity==null?1:r.opacity;l!==0&&(e(t,u)||(Te(t,r),r.fill&&$t(t,r,l)&&t.fill(),r.stroke&&wn(t,r,l)&&t.stroke()))}function Fr(e){return e=e||xe.Ia,function(t,r,u,l,d,b){return u*=t.pixelRatio,l*=t.pixelRatio,qn(r,k=>{const T=k.bounds;if((!T||T.contains(d,b))&&T)return e(t,k,u,l,d,b)?k:void 0})}}function Rr(e,t){return function(r,u,l,d){var b,k,T=Array.isArray(u)?u[0]:u,j=t??T.fill,$=T.stroke&&r.isPointInStroke;return $&&(b=T.strokeWidth,k=T.strokeCap,r.lineWidth=b??1,r.lineCap=k??"butt"),!e(r,u)&&(j&&r.isPointInPath(l,d)||$&&r.isPointInStroke(l,d))}}function Xr(e){return Fr(Rr(e))}function zr(e,t){return"translate("+e+","+t+")"}function Ti(e){return"rotate("+e+")"}function Wi(e){return zr(e.x||0,e.y||0)}function zi(e,t,r){function u(l,d){var b=d.x||0,k=d.y||0,T=d.angle||0;l.translate(b,k),T&&l.rotate(T*=Td),l.beginPath(),t(l,d),T&&l.rotate(-T),l.translate(-b,-k)}return{type:e,tag:"path",nested:!1,attr:function(l,d){l("transform",function(b){return zr(b.x||0,b.y||0)+(b.angle?" "+Ti(b.angle):"")}(d)),l("d",t(null,d))},bound:function(l,d){return t(h0(l,d.angle),d),Id(l,d).translate(d.x||0,d.y||0)},draw:Cn(u),pick:Xr(u),isect:r||X(u)}}var Xo=zi("arc",function(e,t){return u0.context(e)(t)});function wa(e,t,r){function u(d,b){d.beginPath(),t(d,b)}const l=Rr(u);return{type:e,tag:"path",nested:!0,attr:function(d,b){var k=b.mark.items;k.length&&d("d",t(null,k))},bound:function(d,b){var k=b.items;return k.length===0?d:(t(h0(d),k),Id(d,k[0]))},draw:function(d){return function(b,k,T){!k.items.length||T&&!T.intersects(k.bounds)||wr(d,b,k.items[0],k.items)}}
7829(u),pick:function(d,b,k,T,j,$){var G=b.items,te=b.bounds;return!G||!G.length||te&&!te.contains(j,$)?null:(k*=d.pixelRatio,T*=d.pixelRatio,l(d,G,k,T)?G[0]:null)},isect:oe,tip:r}}var ua=wa("area",function(e,t){const r=t[0],u=r.interpolate||"linear";return(r.orient==="horizontal"?fg:ov).curve(Dd(u,r.orient,r.tension)).context(e)(t)},function(e,t){for(var r,u,l=e[0].orient==="horizontal"?t[1]:t[0],d=e[0].orient==="horizontal"?"y":"x",b=e.length,k=1/0;--b>=0;)e[b].defined!==!1&&(u=Math.abs(e[b][d]-l))<k&&(k=u,r=e[b]);return r});function oa(e,t){e.beginPath(),rf(t)?Ph(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function ha(e){const t=tt(e.strokeWidth,1);return e.strokeOffset!=null?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function Ma(e,t){const r=ha(t);e("d",Ph(null,t,r,r))}function Wa(e,t,r,u){const l=ha(t);e.beginPath(),Ph(e,t,(r||0)+l,(u||0)+l)}const us=Rr(Wa),Qu=Rr(Wa,!1),Hi=Rr(Wa,!0);var Ts={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",Wi(t))},bound:function(e,t){if(!t.clip&&t.items){const r=t.items,u=r.length;for(let l=0;l<u;++l)e.union(r[l].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),Id(e,t),e.translate(t.x||0,t.y||0)},draw:function(e,t,r){Ln(t,u=>{const l=u.x||0,d=u.y||0,b=u.strokeForeground,k=u.opacity==null?1:u.opacity;(u.stroke||u.fill)&&k&&(Wa(e,u,l,d),Te(e,u),u.fill&&$t(e,u,k)&&e.fill(),u.stroke&&!b&&wn(e,u,k)&&e.stroke()),e.save(),e.translate(l,d),u.clip&&oa(e,u),r&&r.translate(-l,-d),Ln(u,T=>{this.draw(e,T,r)}),r&&r.translate(l,d),e.restore(),b&&u.stroke&&k&&(Wa(e,u,l,d),Te(e,u),wn(e,u,k)&&e.stroke())})},pick:function(e,t,r,u,l,d){if(t.bounds&&!t.bounds.contains(l,d)||!t.items)return null;const b=r*e.pixelRatio,k=u*e.pixelRatio;return qn(t,T=>{let j,$,G;const te=T.bounds;if(te&&!te.contains(l,d))return;$=T.x||0,G=T.y||0;const se=$+(T.width||0),he=G+(T.height||0),ve=T.clip;if(ve&&(l<$||l>se||d<G||d>he))return;if(e.save(),e.translate($,G),$=l-$,G=d-G,ve&&rf(T)&&!Hi(e,T,b,k))return e.restore(),null;const Be=T.strokeForeground,ze=t.interactive!==!1;return ze&&Be&&T.stroke&&Qu(e,T,b,k)?(e.restore(),T):(!(j=qn(T,Ue=>function(st,ut,mt){return(st.interactive!==!1||st.marktype==="group")&&st.bounds&&st.bounds.contains(ut,mt)}(Ue,$,G)?this.pick(Ue,r,u,$,G):null))&&ze&&(T.fill||!Be&&T.stroke)&&us(e,T,b,k)&&(j=T),e.restore(),j||null)})},isect:me,content:function(e,t,r){e("clip-path",t.clip?of(r,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Ma(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Ma(e,t):e("d","")}},Us={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Zu(e,t){var r=e.image;return(!r||e.url&&e.url!==r.url)&&(r={complete:!1,width:0,height:0},t.loadImage(e.url).then(u=>{e.image=u,e.image.url=e.url})),r}function Au(e,t){return e.width!=null?e.width:t&&t.width?e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width:0}function xc(e,t){return e.height!=null?e.height:t&&t.height?e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height:0}function wc(e,t){return e==="center"?t/2:e==="right"?t:0}function _c(e,t){return e==="middle"?t/2:e==="bottom"?t:0}var Jp={type:"image",tag:"image",nested:!1,attr:function(e,t,r){const u=Zu(t,r),l=Au(t,u),d=xc(t,u),b=(t.x||0)-wc(t.align,l),k=(t.y||0)-_c(t.baseline,d);e("href",!u.src&&u.toDataURL?u.toDataURL():u.src||"",Us["xmlns:xlink"],"xlink:href"),e("transform",zr(b,k)),e("width",l),e("height",d),e("preserveAspectRatio",t.aspect===!1?"none":"xMidYMid")},bound:function(e,t){const r=t.image,u=Au(t,r),l=xc(t,r),d=(t.x||0)-wc(t.align,u),b=(t.y||0)-_c(t.baseline,l);return e.set(d,b,d+u,b+l)},draw:function(e,t,r){Ln(t,u=>{if(r&&!r.intersects(u.bounds))return;const l=Zu(u,this);let d=Au(u,l),b=xc(u,l);if(d===0||b===0)return;let k,T,j,$,G=(u.x||0)-wc(u.align,d),te=(u.y||0)-_c(u.baseline,b);u.aspect!==!1&&(T=l.width/l.height,j=u.width/u.height,T==T&&j==j&&T!==j&&(j<T?(te+=(b-($=d/T))/2,b=$):(G+=(d-($=b*T))/2,d=$))),(l.complete||l.toDataURL)&&(Te(e,u),e.globalAlpha=(k=u.opacity)!=null?k:1,e.imageSmoothingEnabled=u.smooth!==!1,e.drawImage(l,G,te,d,b))})},pick:Fr(),isect:xe.Ia,get:Zu,xOffset:wc,yOffset:_c},Lh=wa("line",function(e,t){const r=t[0],u=r.interpolate||"linear";return dg.curve(Dd(u,r.orient,r.tension)).context(e)(t)},function(e,t){for(var r,u,l=Math.pow(e[0].strokeWidth||1,2),d=e.length;--d>=0;)if(e[d].defined!==!1&&(r=e[d].x-t[0])*r+(u=e[d].y-t[1])*u<l)return e[d];return null});function zf(e,t){var r=t.path;if(r==null)return!0;var u=t.x||0,l=t.y||0,d=t.scaleX||1,b=t.scaleY||1,k=(t.angle||0)*Td,T=t.pathCache;T&&T.path===r||((t.pathCache=T=qp(r)).path=r),k&&e.rotate&&e.translate?(e.translate(u,l),e.rotate(k),Kp(e,T,0,0,d,b),e.rotate(-k),e.translate(-u,-l)):Kp(e,T,u,l,d,b)}var Fd={type:"path",tag:"path",nested:!1,attr:function(e,t){var r=t.scaleX||1,u=t.scaleY||1;r===1&&u===1||e("vector-effect","non-scaling-stroke"),e("transform",function(l){return zr(l.x||0,l.y||0)+(l.angle?" "+Ti(l.angle):"")+(l.scaleX||l.scaleY?" "+function(d,b){return"scale("+d+","+b+")"}(l.scaleX||1,l.scaleY||1):"")}(t)),e("d",t.path)},bound:function(e,t){return zf(h0(e,t.angle),t)?e.set(0,0,0,0):Id(e,t,!0)},draw:Cn(zf),pick:Xr(zf),isect:X(zf)};function Uf(e,t){e.beginPath(),Ph(e,t)}var sl={type:"rect",tag:"path",nested:!1,attr:function(e,t){e("d",Ph(null,t))},bound:function(e,t){var r,u;return Id(e.set(r=t.x||0,u=t.y||0,r+t.width||0,u+t.height||0),t)},draw:Cn(Uf),pick:Xr(Uf),isect:me};function ks(e,t,r){var u,l,d,b;return!(!t.stroke||!wn(e,t,r))&&(u=t.x||0,l=t.y||0,d=t.x2!=null?t.x2:u,b=t.y2!=null?t.y2:l,e.beginPath(),e.moveTo(u,l),e.lineTo(d,b),!0)}var Rd={type:"rule",tag:"line",nested:!1,attr:function(e,t){e("transform",Wi(t)),e("x2",t.x2!=null?t.x2-(t.x||0):0),e("y2",t.y2!=null?t.y2-(t.y||0):0)},bound:function(e,t){var r,u;return Id(e.set(r=t.x||0,u=t.y||0,t.x2!=null?t.x2:r,t.y2!=null?t.y2:u),t)},draw:function(e,t,r){Ln(t,u=>{if(!r||r.intersects(u.bounds)){var l=u.opacity==null?1:u.opacity;l&&ks(e,u,l)&&(Te(e,u),e.stroke())}})},pick:Fr(function(e,t,r,u){return!!e.isPointInStroke&&ks(e,t,1)&&e.isPointInStroke(r,u)}),isect:Se}
7829,zh=zi("shape",function(e,t){return(t.mark.shape||t.shape).context(e)(t)}),Qp=zi("symbol",function(e,t){return ky.context(e)(t)},oe);const Bd=Object(xe.N)();var ou={height:ul,measureWidth:af,estimateWidth:Zp,width:Zp,canvas:Uh};function Uh(e){ou.width=e&&I?af:Zp}function Zp(e,t){return em(Wf(e,t),ul(e))}function em(e,t){return~~(.8*e.length*t)}function af(e,t){return ul(e)<=0||!(t=Wf(e,t))?0:vg(t,tm(e))}function vg(e,t){const r=`(${t}) ${e}`;let u=Bd.get(r);return u===void 0&&(I.font=t,u=I.measureText(e).width,Bd.set(r,u)),u}function ul(e){return e.fontSize!=null?+e.fontSize||0:11}function Ou(e){return e.lineHeight!=null?e.lineHeight:ul(e)+2}function $c(e){return function(t){return Object(xe.B)(t)?t.length>1?t:t[0]:t}(e.lineBreak&&e.text&&!Object(xe.B)(e.text)?e.text.split(e.lineBreak):e.text)}function au(e){const t=$c(e);return(Object(xe.B)(t)?t.length-1:0)*Ou(e)}function Wf(e,t){const r=t==null?"":(t+"").trim();return e.limit>0&&r.length?function(u,l){var d=+u.limit,b=function(te){if(ou.width===af){const se=tm(te);return he=>vg(he,se)}{const se=ul(te);return he=>em(he,se)}}(u);if(b(l)<d)return l;var k,T=u.ellipsis||"â¦",j=u.dir==="rtl",$=0,G=l.length;if(d-=b(T),j){for(;$<G;)k=$+G>>>1,b(l.slice(k))>d?$=k+1:G=k;return T+l.slice($)}for(;$<G;)k=1+($+G>>>1),b(l.slice(0,k))<d?$=k:G=k-1;return l.slice(0,$)+T}(e,r):r}function Wh(e,t){var r=e.font;return(t&&r?String(r).replace(/"/g,"'"):r)||"sans-serif"}function tm(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+ul
7829(e)+"px "+Wh(e,t)}function Vh(e){var t=e.baseline,r=ul(e);return Math.round(t==="top"?.79*r:t==="middle"?.3*r:t==="bottom"?-.21*r:t==="line-top"?.29*r+.5*Ou(e):t==="line-bottom"?.29*r-.5*Ou(e):0)}Uh(!0);const yg={left:"start",center:"middle",right:"end"},Vf=new zs;function fc(e){var t,r=e.x||0,u=e.y||0,l=e.radius||0;return l&&(t=(e.theta||0)-Rh,r+=l*Math.cos(t),u+=l*Math.sin(t)),Vf.x1=r,Vf.y1=u,Vf}function Fb(e,t,r){var u,l=ou.height(t),d=t.align,b=fc(t),k=b.x1,T=b.y1,j=t.dx||0,$=(t.dy||0)+Vh(t)-Math.round(.8*l),G=$c(t);if(Object(xe.B)(G)?(l+=Ou(t)*(G.length-1),u=G.reduce((te,se)=>Math.max(te,ou.width(t,se)),0)):u=ou.width(t,G),d==="center"?j-=u/2:d==="right"&&(j-=u),e.set(j+=k,$+=T,j+u,$+l),t.angle&&!r)e.rotate(t.angle*Td,k,T);else if(r===2)return e.rotatedPoints(t.angle*Td,k,T);return e}var $f={arc:Xo,area:ua,group:Ts,image:Jp,line:Lh,path:Fd,rect:sl,rule:Rd,shape:zh,symbol:Qp,text:{type:"text",tag:"text",nested:!1,attr:function(e,t){var r,u=t.dx||0,l=(t.dy||0)+Vh(t),d=fc(t),b=d.x1,k=d.y1,T=t.angle||0;e("text-anchor",yg[t.align]||"start"),T?(r=zr(b,k)+" "+Ti(T),(u||l)&&(r+=" "+zr(u,l))):r=zr(b+u,k+l),e("transform",r)},bound:Fb,draw:function(e,t,r){Ln(t,u=>{var l,d,b,k,T,j,$,G=u.opacity==null?1:u.opacity;if(!(r&&!r.intersects(u.bounds)||G===0||u.fontSize<=0||u.text==null||u.text.length===0)){if(e.font=tm(u),e.textAlign=u.align||"left",d=(l=fc(u)).x1,b=l.y1,u.angle&&(e.save(),e.translate(d,b),e.rotate(u.angle*Td),d=b=0),d+=u.dx||0,b+=(u.dy||0)+Vh(u),j=$c(u),Te(e,u),Object(xe.B)(j))for(T=Ou(u),k=0;k<j.length;++k)$=Wf(u,j[k]),u.fill&&$t(e,u,G)&&e.fillText($,d,b),u.stroke&&wn(e,u,G)&&e.strokeText($,d,b),b+=T;else $=Wf(u,j),u.fill&&$t(e,u,G)&&e.fillText($,d,b),u.stroke&&wn(e,u,G)&&e.strokeText($,d,b);u.angle&&e.restore()}})},pick:Fr(function(e,t,r,u,l,d){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var b=fc(t),k=b.x1,T=b.y1,j=Fb(Vf,t,1),$=-t.angle*Td,G=Math.cos($),te=Math.sin($),se=G*l-te*d+(k-G*k+te*T),he=te*l+G*d+(T-te*k-G*T);return j.contains(se,he)}),isect:function(e,t){const r=Fb(Vf,e,2);return Me(t,r[0],r[1],r[2],r[3])||Me(t,r[0],r[1],r[4],r[5])||Me(t,r[4],r[5],r[6],r[7])||Me(t,r[2],r[3],r[6],r[7])}},trail:wa("trail",function(e,t){return E1.context(e)(t)},function(e,t){for(var r,u,l=e.length;--l>=0;)if(e[l].defined!==!1&&(r=e[l].x-t[0])*r+(u=e[l].y-t[1])*u<(r=e[l].size||1)*r)return e[l];return null})};function nm(e,t,r){var u=$f[e.mark.marktype],l=t||u.bound;return u.nested&&(e=e.mark),l(e.bounds||(e.bounds=new zs),e,r)}var Rb={mark:null};function Bb(e,t,r){var u,l,d,b,k=$f[e.marktype],T=k.bound,j=e.items,$=j&&j.length;if(k.nested)return $?d=j[0]:(Rb.mark=e,d=Rb),b=nm(d,T,r),t=t&&t.union(b)||b;if(t=t||e.bounds&&e.bounds.clear()||new zs,$)for(u=0,l=j.length;u<l;++u)t.union(nm(j[u],T,r));return e.bounds=t}const Pb=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function Oy(e,t){return JSON.stringify(e,Pb,t)}function A1(e){return function t(r){var u,l,d,b=r.marktype,k=r.items;if(k)for(l=0,d=k.length;l<d;++l)u=b?"mark":"group",k[l][u]=r,k[l].zindex&&(k[l][u].zdirty=!0),(b||u)==="group"&&t(k[l]);return b&&Bb(r),r}(typeof e=="string"?JSON.parse(e):e)}function Dy(e){arguments.length?this.root=A1(e):(this.root=O1({marktype:"group",name:"root",role:"frame"}),this.root.items=[new hg(this.root)])}function O1(e,t){const r={bounds:new zs,clip:!!e.clip,group:t,interactive:e.interactive!==!1,items:[],marktype:e.marktype,name:e.name||void 0,role:e.role||void 0,zindex:e.zindex||0};return e.aria!=null&&(r.aria=e.aria),e.description&&(r.description=e.description),r}function Ml(e,t,r){return!e&&typeof document<"u"&&document.createElement&&(e=document),e?r?e.createElementNS(r,t):e.createElement(t):null}function jb(e,t){t=t.toLowerCase();for(var r=e.childNodes,u=0,l=r.length;u<l;++u)if(r[u].tagName.toLowerCase()===t)return r[u]}function cl(e,t,r,u){var l,d=e.childNodes[t];return d&&d.tagName.toLowerCase()===r.toLowerCase()||(l=d||null,d=Ml(e.ownerDocument,r,u),e.insertBefore(d,l)),d}function Pd(e,t){for(var r=e.childNodes,u=r.length;u>t;)e.removeChild(r[--u]);return e}function C(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function x(e,t){const r=t.getBoundingClientRect();return[e.clientX-r.left-(t.clientLeft||0),e.clientY-r.top-(t.clientTop||0)]}function p(e,t){this._active=null,this._handlers={},this._loader=e||Object(jn.e)(),this._tooltip=t||w}function w(e,t,r,u){e.element().setAttribute("title",u||"")}function D(e){this._el=null,this._bgcolor=null,this._loader=new c0(e)}Dy.prototype={toJSON(e){return Oy(this.root,e||0)},mark(e,t,r){const u=O1(e,t=t||this.root.items[0]);return t.items[r]=u,u.zindex&&(u.group.zdirty=!0),u}},p.prototype={initialize(e,t,r){return this._el=e,this._obj=r||null,this.origin(t)}
7829,element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},scene(e){return arguments.length?(this._scene=e,this):this._scene},on(){},off(){},_handlerIndex(e,t,r){for(let u=e?e.length:0;--u>=0;)if(e[u].type===t&&(!r||e[u].handler===r))return u;return-1},handlers(e){const t=this._handlers,r=[];if(e)r.push(...t[this.eventName(e)]);else for(const u in t)r.push(...t[u]);return r},eventName(e){const t=e.indexOf(".");return t<0?e:e.slice(0,t)},handleHref(e,t,r){this._loader.sanitize(r,{context:"href"}).then(u=>{const l=new MouseEvent(e.type,e),d=Ml(null,"a");for(const b in u)d.setAttribute(b,u[b]);d.dispatchEvent(l)}).catch(()=>{})},handleTooltip(e,t,r){if(t&&t.tooltip!=null){t=function(l,d,b,k){var T,j,$=l&&l.mark;if($&&(T=$f[$.marktype]).tip){for((j=x(d,b))[0]-=k[0],j[1]-=k[1];l=l.mark.group;)j[0]-=l.x||0,j[1]-=l.y||0;l=T.tip($.items,j)}return l}(t,e,this.canvas(),this._origin);const u=r&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,u)}},getItemBoundingClientRect(e){const t=this.canvas();if(!t)return;const r=t.getBoundingClientRect(),u=this._origin,l=e.bounds,d=l.width(),b=l.height();let k=l.x1+u[0]+r.left,T=l.y1+u[1]+r.top;for(;e.mark&&(e=e.mark.group);)k+=e.x||0,T+=e.y||0;return{x:k,y:T,width:d,height:b,left:k,top:T,right:k+d,bottom:T+b}}},D.prototype={initialize(e,t,r,u,l){return this._el=e,this.resize(t,r,u,l)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(e){return arguments.length===0?this._bgcolor:(this._bgcolor=e,this)},resize(e,t,r,u){return this._width=e,this._height=t,this._origin=r||[0,0],this._scale=u||1,this},dirty(){},render(e){const t=this;return t._call=function(){t._render(e)},t._call(),t._call=null,t},_render(){},renderAsync(e){const t=this.render(e);return this._ready?this._ready.then(()=>t):Promise.resolve(t)},_load(e,t){var r=this,u=r._loader[e](t);if(!r._ready){const l=r._call;r._ready=r._loader.ready().then(d=>{d&&l(),r._ready=null})}return u},sanitizeURL(e){return this._load("sanitizeURL",e)},loadImage(e){return this._load("loadImage",e)}};const W="dragleave",Q="mousedown",ie="mousemove",fe="mouseout",ye="click",Oe=["keydown","keypress","keyup","dragenter",W,"dragover",Q,"mouseup",ie,fe,"mouseover",ye,"dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],Re=ie,Pe=fe,je=ye;function Ge(e,t){p.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}const rt=e=>e==="touchstart"||e==="touchmove"||e==="touchend"?["touchstart","touchmove","touchend"]:[e];function nt(e,t){rt(t).forEach(r=>function(u,l){const d=u.canvas();d&&!u._events[l]&&(u._events[l]=1,d.addEventListener(l,u[l]?b=>u[l](b):b=>u.fire(l,b)))}(e,r))}function lt(e,t,r){return function(u){const l=this._active,d=this.pickEvent(u);d===l?this.fire(e,u):(l&&l.exit||this.fire(r,u),this._active=d,this.fire(t,u),this.fire(e,u))}}function Nt(e){return function(t){this.fire(e,t),this._active=null}}Object(xe.z)(Ge,p,{initialize(e,t,r){return this._canvas=e&&jb(e,"canvas"),[ye,Q,ie,fe,W].forEach(u=>nt(this,u)),p.prototype.initialize.call(this,e,t,r)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:Oe,DOMMouseScroll(e){this.fire("mousewheel",e)},mousemove:lt(ie,"mouseover",fe),dragover:lt("dragover","dragenter",W),mouseout:Nt(fe),dragleave:Nt(W),mousedown(e){this._down=this._active,this.fire(Q,e)},click(e){this._down===this._active&&(this.fire(ye,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",e,!0)},touchmove(e){this.fire("touchmove",e,!0)},touchend(e){this.fire("touchend",e,!0),this._touch=null},fire(e,t,r){const u=r?this._touch:this._active,l=this._handlers[e];if(t.vegaType=e,e===je&&u&&u.href?this.handleHref(t,u,u.href):e!==Re&&e!==Pe||this.handleTooltip(t,u,e!==Pe),l)for(let d=0,b=l.length;d<b;++d)l[d].handler.call(this._obj,t,u)},on(e,t){const r=this.eventName(e),u=this._handlers;return this._handlerIndex(u[r],e,t)<0&&(nt(this,e),(u[r]||(u[r]=[])).push({type:e,handler:t})),this},off(e,t){const r=this.eventName(e),u=this._handlers[r],l=this._handlerIndex(u,e,t);return l>=0&&u.splice(l,1),this},pickEvent(e){const t=x(e,this._canvas),r=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-r[0],t[1]-r[1])},pick(e,t,r,u,l){const d=this.context();return $f[e.marktype].pick.call(this,d,e,t,r,u,l)}});var Rt=typeof window<"u"&&window.devicePixelRatio||1;function Pt(e){D.call(this,e),this._options={},this._redraw=!1,this._dirty=new zs,this._tempb=new zs}const Kt=D.prototype;function dn(e,t){p.call(this,e,t);const r=this;r._hrefHandler=bn(r,(u,l)=>{l&&l.href&&r.handleHref(u,l,l.href)}),r._tooltipHandler=bn(r,(u,l)=>{r.handleTooltip(u,l,u.type!==Pe)})}Object(xe.z)(Pt,D,{initialize(e,t,r,u,l,d){return this._options=d||{},this._canvas=this._options.externalContext?null:Gu(1,1,this._options.type),e&&this._canvas&&(Pd(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Kt.initialize.call(this,e,t,r,u,l)},resize(e,t,r,u){if(Kt.resize.call(this,e,t,r,u),this._canvas)(function(l,d,b,k,T,j){const $=typeof HTMLElement<"u"&&l instanceof HTMLElement&&l.parentNode!=null,G=l.getContext("2d"),te=$?Rt:T;l.width=d*te,l.height=b*te;for(const se in j)G[se]=j[se];$&&te!==1&&(l.style.width=d+"px",l.style.height=b+"px"),G.pixelRatio=te,G.setTransform(te,0,0,te,te*k[0],te*k[1])})(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const l=this._options.externalContext;
7829l||Object(xe.o)("CanvasRenderer is missing a valid canvas or context"),l.scale(this._scale,this._scale),l.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(e){const t=this._tempb.clear().union(e.bounds);let r=e.mark.group;for(;r;)t.translate(r.x||0,r.y||0),r=r.mark.group;this._dirty.union(t)},_render(e){const t=this.context(),r=this._origin,u=this._width,l=this._height,d=this._dirty,b=((T,j,$)=>new zs().set(0,0,j,$).translate(-T[0],-T[1]))(r,u,l);t.save();const k=this._redraw||d.empty()?(this._redraw=!1,b.expand(1)):function(T,j,$){return j.expand(1).round(),T.pixelRatio%1&&j.scale(T.pixelRatio).round().scale(1/T.pixelRatio),j.translate(-$[0]%1,-$[1]%1),T.beginPath(),T.rect(j.x1,j.y1,j.width(),j.height()),T.clip(),j}(t,b.intersect(d),r);return this.clear(-r[0],-r[1],u,l),this.draw(t,e,k),t.restore(),d.clear(),this},draw(e,t,r){const u=$f[t.marktype];t.clip&&function(l,d){var b=d.clip;l.save(),Object(xe.E)(b)?(l.beginPath(),b(l),l.clip()):oa(l,d.group)}(e,t),u.draw.call(this,e,t,r),t.clip&&e.restore()},clear(e,t,r,u){const l=this._options,d=this.context();l.type==="pdf"||l.externalContext||d.clearRect(e,t,r,u),this._bgcolor!=null&&(d.fillStyle=this._bgcolor,d.fillRect(e,t,r,u))}});const bn=(e,t)=>r=>{let u=r.target.__data__;u=Array.isArray(u)?u[0]:u,r.vegaType=r.type,t.call(e._obj,r,u)};Object(xe.z)(dn,p,{initialize(e,t,r){let u=this._svg;return u&&(u.removeEventListener(je,this._hrefHandler),u.removeEventListener(Re,this._tooltipHandler),u.removeEventListener(Pe,this._tooltipHandler)),this._svg=u=e&&jb(e,"svg"),u&&(u.addEventListener(je,this._hrefHandler),u.addEventListener(Re,this._tooltipHandler),u.addEventListener(Pe,this._tooltipHandler)),p.prototype.initialize.call(this,e,t,r)},canvas(){return this._svg},on(e,t){const r=this.eventName(e),u=this._handlers;if(this._handlerIndex(u[r],e,t)<0){const l={type:e,handler:t,listener:bn(this,t)};(u[r]||(u[r]=[])).push(l),this._svg&&this._svg.addEventListener(r,l.listener)}return this},off(e,t){const r=this.eventName(e),u=this._handlers[r],l=this._handlerIndex(u,e,t);return l>=0&&(this._svg&&this._svg.removeEventListener(r,u[l].listener),u.splice(l,1)),this}});const pn="aria-hidden",_n="aria-label",On="role",_="aria-roledescription",m="graphics-object",f="graphics-symbol",y=(e,t,r)=>({[On]:e,[_]:t,[_n]:r||void 0}),E=Object(xe.Fa)(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),z={axis:{desc:"axis",caption:function(e){const t=e.datum,r=e.orient,u=t.title?we(e):null,l=e.context,d=l.scales[t.scale].value,b=l.dataflow.locale(),k=d.type;return`${r==="left"||r==="right"?"Y":"X"}-axis`+(u?` titled '${u}'`:"")+` for a ${Ih(k)?"discrete":k} scale with ${my(b,d,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,r=t.title?we(e):null,u=`${t.type||""} legend`.trim(),l=t.scales,d=Object.keys(l),b=e.context,k=b.scales[l[d[0]]].value,T=b.dataflow.locale();return function(j){return j.length?j[0].toUpperCase()+j.slice(1):j}(u)+(r?` titled '${r}'`:"")+` for ${function(j){return(j=j.map($=>$+($==="fill"||$==="stroke"?" color":""))).length<2?j[0]:j.slice(0,-1).join(", ")+" and "+Object(xe.W)(j)}(d)} with ${my(T,k,e)}`}},"title-text":{desc:"title",caption:e=>`Title text '${de(e)}'`}
7829,"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${de(e)}'`}},Y={ariaRole:On,ariaRoleDescription:_,description:_n};function Z(e,t){const r=t.aria===!1;if(e(pn,r||void 0),r||t.description==null)for(const u in Y)e(Y[u],void 0);else{const u=t.mark.marktype;e(_n,t.description),e(On,t.ariaRole||(u==="group"?m:f)),e(_,t.ariaRoleDescription||`${u} mark`)}}function le(e){return e.aria===!1?{[pn]:!0}:E[e.role]?null:z[e.role]?function(t,r){try{const u=t.items[0],l=r.caption||(()=>"");return y(r.role||f,r.desc,u.description||l(u))}catch{return null}}(e,z[e.role]):function(t){const r=t.marktype,u=r==="group"||r==="text"||t.items.some(l=>l.description!=null&&l.aria!==!1);return y(u?m:f,`${r} mark container`,t.description)}(e)}function de(e){return Object(xe.i)(e.text).join(" ")}function we(e){try{return Object(xe.i)(Object(xe.W)(e.items).items[0].text).join(" ")}catch{return null}}const De=e=>(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Ne=e=>De(e).replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
");function Fe(){let e="",t="",r="";const u=[],l=()=>t=r="",d=(k,T)=>(T!=null&&(t+=` ${k}="${Ne(T)}"`),b),b={open(k,...T){(j=>{t&&(e+=`${t}>${r}`,l()),u.push(j)})(k),t="<"+k;for(const j of T)for(const $ in j)d($,j[$]);return b},close(){const k=u.pop();return e+=t?t+(r?`>${r}</${k}>`:"/>"):`</${k}>`,l(),b},attr:d,text:k=>(r+=De(k),b),toString:()=>e};return b}const Ve=e=>function t(r,u){if(r.open(u.tagName),u.hasAttributes()){const l=u.attributes,d=l.length;for(let b=0;b<d;++b)r.attr(l[b].name,l[b].value)}if(u.hasChildNodes()){const l=u.childNodes,d=l.length;for(let b=0;b<d;b++){const k=l[b];k.nodeType===3?r.text(k.nodeValue):t(r,k)}}return r.close()}(Fe(),e)+"",Je={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity",blend:"mix-blend-mode"},Xe={fill:"none","stroke-miterlimit":10},ot=Us.xmlns;function xt(e){D.call(this,e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}const kt=D.prototype;function At(e,t){for(;e&&e.dirty!==t;e=e.mark.group){if(e.dirty=t,!e.mark||e.mark.dirty===t)return;e.mark.dirty=t}}function Lt(e,t,r){let u,l,d;if(t.gradient==="radial"){let b=cl(e,r++,"pattern",ot);tr(b,{id:Pf+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),tr(b=cl(b,0,"rect",ot),{width:1,height:1,fill:`url(${vr()}#${t.id})`}),tr(e=cl(e,r++,"radialGradient",ot),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else tr(e=cl(e,r++,"linearGradient",ot),{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(u=0,l=t.stops.length;u<l;++u)(d=cl(e,u,"stop",ot)).setAttribute("offset",t.stops[u].offset),d.setAttribute("stop-color",t.stops[u].color);return Pd(e,u),r}function tn(e,t,r){return(e=cl(e,r,"clipPath",ot)).setAttribute("id",t.id),t.path?cl(e,0,"path",ot).setAttribute("d",t.path):tr(cl(e,0,"rect",ot),{x:0,y:0,width:t.width,height:t.height}),Pd(e,1),r+1}function ln(e,t,r,u,l){let d,b=e._svg;if(!b&&(b=Ml(d=t.ownerDocument,u,ot),e._svg=b,e.mark&&(b.__data__=e,b.__values__={fill:"default"},u==="g"))){const k=Ml(d,"path",ot);b.appendChild(k),k.__data__=e;const T=Ml(d,"g",ot);b.appendChild(T),T.__data__=e;const j=Ml(d,"path",ot);b.appendChild(j),j.__data__=e,j.__values__={fill:"default"}}return(b.ownerSVGElement!==l||function(k,T){return k.parentNode&&k.parentNode.childNodes.length>1&&k.previousSibling!=T}(b,r))&&t.insertBefore(b,r?r.nextSibling:t.firstChild),b}Object(xe.z)(xt,D,{initialize(e,t,r,u,l){return this._defs={},this._clearDefs(),e&&(this._svg=cl(e,0,"svg",ot),this._svg.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns",ot),this._svg.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",Us["xmlns:xlink"]),this._svg.setAttribute("version",Us.version),this._svg.setAttribute("class","marks"),Pd(e,1),this._root=cl(this._svg,0,"g",ot),tr(this._root,Xe),Pd(this._svg,1)),this.background(this._bgcolor),kt.initialize.call(this,e,t,r,u,l)},background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),kt.background.apply(this,arguments)},resize(e,t,r,u){return kt.resize.call(this,e,t,r,u),this._svg&&(tr(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this},canvas(){return this._svg},svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let r;t&&(e.removeAttribute("style"),tr(r=cl(e,0,"rect",ot),{width:this._width,height:this._height,fill:t}));const u=Ve(e);return t&&(e.removeChild(r),this._svg.style.setProperty("background-color",t)),u},_render(e){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e),Pd(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},isDirty(e){return this._dirtyAll||!e._svg||e.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let r,u,l,d,b,k,T;for(b=0,k=e.length;b<k;++b)(u=(r=e[b]).mark).marktype!==l&&(l=u.marktype,d=$f[l]),u.zdirty&&u.dirty!==t&&(this._dirtyAll=!1,At(r,t),u.items.forEac
vendor: 5,988 bytes, lines 7829-7830
7829h(j=>{j.dirty=t})),u.zdirty||(r.exit?(d.nested&&u.items.length?(T=u.items[0])._svg&&this._update(d,T._svg,T):r._svg&&(T=r._svg.parentNode)&&T.removeChild(r._svg),r._svg=null):(r=d.nested?u.items[0]:r)._update!==t&&(r._svg&&r._svg.ownerSVGElement?this._update(d,r._svg,r):(this._dirtyAll=!1,At(r,t)),r._update=t));return!this._dirtyAll},mark(e,t,r){if(!this.isDirty(t))return t._svg;const u=this._svg,l=$f[t.marktype],d=t.interactive===!1?"none":null,b=l.tag==="g";let k=null,T=0;const j=ln(t,e,r,"g",u);j.setAttribute("class",C(t));const $=le(t);for(const te in $)ur(j,te,$[te]);b||ur(j,"pointer-events",d),ur(j,"clip-path",t.clip?of(this,t,t.group):null);const G=te=>{const se=this.isDirty(te),he=ln(te,j,k,l.tag,u);se&&(this._update(l,he,te),b&&function(ve,Be,ze){Be=Be.lastChild.previousSibling;let Ue,st=0;Ln(ze,ut=>{Ue=ve.mark(Be,ut,Ue),++st}),Pd(Be,1+st)}(this,he,te)),k=he,++T};return l.nested?t.items.length&&G(t.items[0]):Ln(t,G),Pd(j,T),j},_update(e,t,r){nn=t,cn=t.__values__,Z(Rn,r),e.attr(Rn,r,this);const u=Dn[e.type];u&&u.call(this,e,t,r),nn&&this.style(nn,r)},style(e,t){if(t!=null)for(const r in Je){let u=r==="font"?Wh(t):t[r];if(u===cn[r])continue;const l=Je[r];u==null?e.removeAttribute(l):(n0(u)&&(u=tv(u,this._defs.gradient,vr())),e.setAttribute(l,u+"")),cn[r]=u}},defs(){const e=this._svg,t=this._defs;let r=t.el,u=0;for(const l in t.gradient)r||(t.el=r=cl(e,1,"defs",ot)),u=Lt(r,t.gradient[l],u);for(const l in t.clipping)r||(t.el=r=cl(e,1,"defs",ot)),u=tn(r,t.clipping[l],u);r&&(u===0?(e.removeChild(r),t.el=null):Pd(r,u))},_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}});let nn=null,cn=null;const Dn={group(e,t,r){const u=nn=t.childNodes[2];cn=u.__values__,e.foreground(Rn,r,this),cn=t.__values__,nn=t.childNodes[1],e.content(Rn,r,this);const l=nn=t.childNodes[0];e.background(Rn,r,this);const d=r.mark.interactive===!1?"none":null;if(d!==cn.events&&(ur(u,"pointer-events",d),ur(l,"pointer-events",d),cn.events=d),r.strokeForeground&&r.stroke){const b=r.fill;ur(u,"display",null),this.style(l,r),ur(l,"stroke",null),b&&(r.fill=null),cn=u.__values__,this.style(u,r),b&&(r.fill=b),nn=null}else ur(u,"display","none")},image(e,t,r){r.smooth===!1?(Mn(t,"image-rendering","optimizeSpeed"),Mn(t,"image-rendering","pixelated")):Mn(t,"image-rendering",null)},text(e,t,r){const u=$c(r);let l,d,b,k;Object(xe.B)(u)?(l=(d=u.map(T=>Wf(r,T))).join(` 7830`))!==cn.text&&(Pd(t,0),b=t.ownerDocument,k=Ou(r),d.forEach((T,j)=>{const $=Ml(b,"tspan",ot);$.__data__=r,$.textContent=T,j&&($.setAttribute("x",0),$.setAttribute("dy",k)),t.appendChild($)}),cn.text=l):(d=Wf(r,u))!==cn.text&&(t.textContent=d,cn.text=d),ur(t,"font-family",Wh(r)),ur(t,"font-size",ul(r)+"px"),ur(t,"font-style",r.fontStyle),ur(t,"font-variant",r.fontVariant),ur(t,"font-weight",r.fontWeight)}};function Rn(e,t,r){t!==cn[e]&&(r?function(u,l,d,b){d!=null?u.setAttributeNS(b,l,d):u.removeAttributeNS(b,l)}(nn,e,t,r):ur(nn,e,t),cn[e]=t)}function Mn(e,t,r){r!==cn[t]&&(r==null?e.style.removeProperty(t):e.style.setProperty(t,r+""),cn[t]=r)}function tr(e,t){for(const r in t)ur(e,r,t[r])}function ur(e,t,r){r!=null?e.setAttribute(t,r):e.removeAttribute(t)}function vr(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function kr(e){D.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}Object(xe.z)(kr,D,{svg(){return this._text},_render(e){const t=Fe();t.open("svg",Object(xe.p)({},Us,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const r=this._bgcolor;return r&&r!=="transparent"&&r!=="none"&&t.open("rect",{width:this._width,height:this._height,fill:r}).close(),t.open("g",Xe,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){const r=$f[t.marktype],u=r.tag,l=[Z,r.attr];e.open("g",{class:C(t),"clip-path":t.clip?of(this,t,t.group):null},le(t),{"pointer-events":u!=="g"&&t.interactive===!1?"none":null});const d=b=>{const k=this.href(b);if(k&&e.open("a",k),e.open(u,this.attr(t,b,l,u!=="g"?u:null)),u==="text"){const T=$c(b);if(Object(xe.B)(T)){const j={x:0,dy:Ou(b)};for(let $=0;$<T.length;++$)e.open("tspan",$?j:null).text(Wf(b,T[$])).close()}else e.text(Wf(b,T))}else if(u==="g"){const T=b.strokeForeground,j=b.fill,$=b.stroke;T&&$&&(b.stroke=null),e.open("path",this.attr(t,b,r.background,"bgrect")).close(),e.open("g",this.attr(t,b,r.content)),Ln(b,G=>this.mark(e,G)),e.close(),T&&$?(j&&(b.fill=null),b.stroke=$,e.open("path",this.attr(t,b,r.foreground,"bgrect")).close(),j&&(b.fill=j)):e.open("path",this.attr(t,b,r.foreground,"bgfore")).close()}e.close(),k&&e.close()};return r.nested?t.items&&t.items.length&&d(t.items[0]):Ln(t,d),e.close()},href(e){const t=e.href;let r;if(t){if(r=this._hrefs&&this._hrefs[t])return r;this.sanitizeURL(t).then(u=>{u["xlink:href"]=u.href,u.href=null,(this._hrefs||(this._hrefs={}))[t]=u})}return null},attr(e,t,r,u){const l={},d=(b,k,T,j)=>{l[j||b]=k};return Array.isArray(r)?r.forEach(b=>b(d,t,this)):r(d,t,this),u&&function(b,k,T,j,$){if(k==null||(j==="bgrect"&&T.interactive===!1&&(b["pointer-events"]="none"),j==="bgfore"&&(T.interactive===!1&&(b["pointer-events"]="none"),b.display="none",k.fill!==null)))return b;j==="image"&&k.smooth===!1&&(b.style="image-rendering: optimizeSpeed; image-rendering: pixelated;"),j==="text"&&(b["font-family"]=Wh(k),b["font-size"]=ul(k)+"px",b["font-style"]=k.fontStyle,b["font-variant"]=k.fontVariant,b["font-weight"]=k.fontWeight);for(const G in Je){let te=k[G];const se=Je[G];(te!=="transparent"||se!=="fill"&&se!=="stroke")&&te!=null&&(n0(te)&&(te=tv(te,$.gradient,"")),b[se]=te)}}(l,t,e,u,this._defs),l},defs(e){const t=this._defs.gradient,r=this._defs.clipping;if(Object.keys(t).length+Object.keys(r).length!==0){e.open("defs");for(const u in t){const l=t[u],d=l.stops;l.gradient==="radial"?(e.open("pattern",{id:Pf+u,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}
7830),e.open("rect",{width:"1",height:"1",fill:"url(#"+u+")"}).close(),e.close(),e.open("radialGradient",{id:u,fx:l.x1,fy:l.y1,fr:l.r1,cx:l.x2,cy:l.y2,r:l.r2})):e.open("linearGradient",{id:u,x1:l.x1,x2:l.x2,y1:l.y1,y2:l.y2});for(let b=0;b<d.length;++b)e.open("stop",{offset:d[b].offset,"stop-color":d[b].color}).close();e.close()}for(const u in r){const l=r[u];e.open("clipPath",{id:u}),l.path?e.open("path",{d:l.path}).close():e.open("rect",{x:0,y:0,width:l.width,height:l.height}).close(),e.close()}e.close()}}});const yr={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},mr={};function jr(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(mr[e]=t,this):mr[e]}function Pr(e,t,r){const u=[],l=new zs().union(t),d=e.marktype;return d?ei(e,l,r,u):d==="group"?pi(e,l,r,u):Object(xe.o)("Intersect scene must be mark node or group item.")}function ei(e,t,r,u){if(function(l,d,b){return l.bounds&&d.intersects(l.bounds)&&(l.marktype==="group"||l.interactive!==!1&&(!b||b(l)))}(e,t,r)){const l=e.items,d=e.marktype,b=l.length;let k=0;if(d==="group")for(;k<b;++k)pi(l[k],t,r,u);else for(const T=$f[d].isect;k<b;++k){const j=l[k];Mi(j,t,T)&&u.push(j)}}return u}function pi(e,t,r,u){r&&r(e.mark)&&Mi(e,t,$f.group.isect)&&u.push(e);const l=e.items,d=l&&l.length;if(d){const b=e.x||0,k=e.y||0;t.translate(-b,-k);for(let T=0;T<d;++T)ei(l[T],t,r,u);t.translate(b,k)}return u}function Mi(e,t,r){const u=e.bounds;return t.encloses(u)||t.intersects(u)&&r(e,t)}mr.canvas=mr.png={renderer:Pt,headless:Pt,handler:Ge},mr.svg={renderer:xt,headless:kr,handler:dn},mr.none={};const Ro=new zs;function Bo(e){const t=e.clip;if(Object(xe.E)(t))t(h0(Ro.clear()));else{if(!t)return;Ro.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(Ro)}const Zo=1e-9;function Jo(e,t,r){return e===t||(r==="path"?ma(e,t):e instanceof Date&&t instanceof Date?+e==+t:Object(xe.G)(e)&&Object(xe.G)(t)?Math.abs(e-t)<=Zo:e&&t&&(Object(xe.H)(e)||Object(xe.H)(t))?function(u,l){var d,b,k=Object.keys(u),T=Object.keys(l);if(k.length!==T.length)return!1;for(k.sort(),T.sort(),b=k.length-1;b>=0;b--)if(k[b]!=T[b])return!1;for(b=k.length-1;b>=0;b--)if(d=k[b],!Jo(u[d],l[d],d))return!1;return typeof u==typeof l}(e,t):e==t)}function ma(e,t){return Jo(qp(e),qp(t))}function Fa(){Ey(),Fh=0}const Es="top",vo="left",ea="right",_a="bottom",dc="top-left",Ru="top-right",Bu="bottom-left",rm="bottom-right",im="start",bg="middle",kc="end",lv="x",Ty="y",om="group",Ny="axis",xg="title",MA="frame",Lb="scope",am="legend",X2="row-header",FA="row-footer",RA="row-title",J2="column-header",Q2="column-footer",Z2="column-title",AJ="padding",OJ="symbol",tj="fit",DJ="fit-x",TJ="fit-y",NJ="pad",E4="none",BA="all",C4="each",S4="flush",zb="column",Ub="row";function nj(e){Wt.call(this,null,e)}function PA(e,t,r){return t(e.bounds.clear(),e,r)}Object(xe.z)(nj,Wt,{transform(e,t){const r=t.dataflow,u=e.mark,l=u.marktype,d=$f[l],b=d.bound;let k,T=u.bounds;if(d.nested)u.items.length&&r.dirty(u.items[0]),T=PA(u,b),u.items.forEach(j=>{j.bounds.clear().union(T)});else if(l===om||e.modified())switch(t.visit(t.MOD,j=>r.dirty(j)),T.clear(),u.items.forEach(j=>T.union(PA(j,b))),u.role){case Ny:case am:case xg:t.reflow()}else k=t.changed(t.REM),t.visit(t.ADD,j=>{T.union(PA(j,b))}),t.visit(t.MOD,j=>{k=k||T.alignsWith(j.bounds),r.dirty(j),T.union(PA(j,b))}),k&&(T.clear(),u.items.forEach(j=>T.union(j.bounds)));return Bo(u),t.modifies("bounds")}});const rj=":vega_identifier:";function A4(e){Wt.call(this,0,e)}function ij(e){Wt.call(this,null,e)}function oj(e){Wt.call(this,null,e)}A4.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},Object(xe.z)(A4,Wt,{transform(e,t){const r=function(d){return d._signals[rj]||(d._signals[rj]=d.add(0))}(t.dataflow),u=e.as;let l=r.value;return t.visit(t.ADD,d=>d[u]=d[u]||++l),r.set(this.value=l),t}}),Object(xe.z)(ij,Wt,{transform(e,t){let r=this.value;r||((r=t.dataflow.scenegraph().mark(e.markdef,function(l){const d=l.groups,b=l.parent;return d&&d.size===1?d.get(Object.keys(d.object)[0]):d&&b?d.lookup(b):null}(e),e.index)).group.context=e.context,e.context.group||(e.context.group=r.group),r.source=this.source,r.clip=e.clip,r.interactive=e.interactive,this.value=r);const u=r.marktype===om?hg:Yp;return t.visit(t.ADD,l=>u.call(l,r)),(e.modified("clip")||e.modified("interactive"))&&(r.clip=e.clip,r.interactive=!!e.interactive,r.zdirty=!0,t.reflow()),r.items=t.source,t}});const aj={parity:e=>e.filter((t,r)=>r%2?t.opacity=0:1),greedy:(e,t)=>{let r;return e.filter((u,l)=>
vendor: 5,387 bytes, line 7830
7830l&&sj(r.bounds,u.bounds,t)?u.opacity=0:(r=u,1))}},sj=(e,t,r)=>r>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),uj=(e,t)=>{for(var r,u=1,l=e.length,d=e[0].bounds;u<l;d=r,++u)if(sj(d,r=e[u].bounds,t))return!0},IJ=e=>{const t=e.bounds;return t.width()>1&&t.height()>1},cj=e=>(e.forEach(t=>t.opacity=1),e),lj=(e,t)=>e.reflow(t.modified()).modifies("opacity");function fj(e){Wt.call(this,null,e)}Object(xe.z)(oj,Wt,{transform(e,t){const r=aj[e.method]||aj.parity,u=e.separation||0;let l,d,b=t.materialize(t.SOURCE).source;if(!b||!b.length)return;if(!e.method)return e.modified("method")&&(cj(b),t=lj(t,e)),t;if(!(b=b.filter(IJ)).length)return;if(e.sort&&(b=b.slice().sort(e.sort)),l=cj(b),t=lj(t,e),l.length>=3&&uj(l,u)){do l=r(l,u);while(l.length>=3&&uj(l,u));l.length<3&&!Object(xe.W)(b).opacity&&(l.length>1&&(Object(xe.W)(l).opacity=0),Object(xe.W)(b).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(d=((T,j,$)=>{var G=T.range(),te=new zs;return j===Es||j===_a?te.set(G[0],-1/0,G[1],1/0):te.set(-1/0,G[0],1/0,G[1]),te.expand($||1),se=>te.encloses(se.bounds)})(e.boundScale,e.boundOrient,+e.boundTolerance),b.forEach(T=>{d(T)||(T.opacity=0)}));const k=l[0].mark.bounds.clear();return b.forEach(T=>{T.opacity&&k.union(T.bounds)}),t}}),Object(xe.z)(fj,Wt,{transform(e,t){const r=t.dataflow;if(t.visit(t.ALL,u=>r.dirty(u)),t.fields&&t.fields.zindex){const u=t.source&&t.source[0];u&&(u.mark.zdirty=!0)}}});const jd=new zs;function e_(e,t,r){return e[t]===r?0:(e[t]=r,1)}function MJ(e){var t=e.items[0].orient;return t===vo||t===ea}function FJ(e,t,r,u){var l,d,b=t.items[0],k=b.datum,T=b.translate!=null?b.translate:.5,j=b.orient,$=function(pt){let Ct=+pt.grid;return[pt.ticks?Ct++:-1,pt.labels?Ct++:-1,Ct+ +pt.domain]}(k),G=b.range,te=b.offset,se=b.position,he=b.minExtent,ve=b.maxExtent,Be=k.title&&b.items[$[2]].items[0],ze=b.titlePadding,Ue=b.bounds,st=Be&&au(Be),ut=0,mt=0;switch(jd.clear().union(Ue),Ue.clear(),(l=$[0])>-1&&Ue.union(b.items[l].bounds),(l=$[1])>-1&&Ue.union(b.items[l].bounds),j){case Es:ut=se||0,mt=-te,d=Math.max(he,Math.min(ve,-Ue.y1)),Ue.add(0,-d).add(G,0),Be&&jA(e,Be,d,ze,st,0,-1,Ue);break;case vo:ut=-te,mt=se||0,d=Math.max(he,Math.min(ve,-Ue.x1)),Ue.add(-d,0).add(0,G),Be&&jA(e,Be,d,ze,st,1,-1,Ue);break;case ea:ut=r+te,mt=se||0,d=Math.max(he,Math.min(ve,Ue.x2)),Ue.add(0,0).add(d,G),Be&&jA(e,Be,d,ze,st,1,1,Ue);break;case _a:ut=se||0,mt=u+te,d=Math.max(he,Math.min(ve,Ue.y2)),Ue.add(0,0).add(G,d),Be&&jA(e,Be,d,ze,0,0,1,Ue);break;default:ut=b.x,mt=b.y}return Id(Ue.translate(ut,mt),b),e_(b,"x",ut+T)|e_(b,"y",mt+T)&&(b.bounds=jd,e.dirty(b),b.bounds=Ue,e.dirty(b)),b.mark.bounds.clear().union(Ue)}function jA(e,t,r,u,l,d,b,k){const T=t.bounds;if(t.auto){const j=b*(r+l+u);let $=0,G=0;e.dirty(t),d?$=(t.x||0)-(t.x=j):G=(t.y||0)-(t.y=j),t.mark.bounds.clear().union(T.translate(-$,-G)),e.dirty(t)}k.union(T)}const dj=(e,t)=>Math.floor(Math.min(e,t)),hj=(e,t)=>Math.ceil(Math.max(e,t));function RJ(e){return new zs().set(0,0,e.width||0,e.height||0)}function BJ(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function ec(e,t,r){const u=Object(xe.H)(e)?e[t]:e;return u??(r!==void 0?r:0)}function pj(e){return e<0?Math.ceil(-e):0}function mj(e,t,r){var u,l,d,b,k,T,j,$,G,te,se,he=!r.nodirty,ve=r.bounds===S4?RJ:BJ,Be=jd.set(0,0,0,0),ze=ec(r.align,zb),Ue=ec(r.align,Ub),st=ec(r.padding,zb),ut=ec(r.padding,Ub),mt=r.columns||t.length,pt=mt<=0?1:Math.ceil(t.length/mt),Ct=t.length,Et=Array(Ct),mn=Array(mt),An=0,xn=Array(Ct),Wn=Array(pt),Un=0,Kn=Array(Ct),Qn=Array(Ct),ir=Array(Ct);for(l=0;l<mt;++l)mn[l]=0;for(l=0;l<pt;++l)Wn[l]=0;for(l=0;l<Ct;++l)T=t[l],k=ir[l]=ve(T),T.x=T.x||0,Kn[l]=0,T.y=T.y||0,Qn[l]=0,d=l%mt,b=~~(l/mt),An=Math.max(An,j=Math.ceil(k.x2)),Un=Math.max(Un,$=Math.ceil(k.y2)),mn[d]=Math.max(mn[d],j),Wn[b]=Math.max(Wn[b],$),Et[l]=st+pj(k.x1),xn[l]=ut+pj(k.y1),he&&e.dirty(t[l]);for(l=0;l<Ct;++l)l%mt==0&&(Et[l]=0),l<mt&&(xn[l]=0);if(ze===C4)for(d=1;d<mt;++d){for(se=0,l=d;l<Ct;l+=mt)se<Et[l]&&(se=Et[l]);for(l=d;l<Ct;l+=mt)Et[l]=se+mn[d-1]}else if(ze===BA){for(se=0,l=0;l<Ct;++l)l%mt&&se<Et[l]&&(se=Et[l]);for(l=0;l<Ct;++l)l%mt&&(Et[l]=se+An)}else for(ze=!1,d=1;d<mt;++d)for(l=d;l<Ct;l+=mt)Et[l]+=mn[d-1];if(Ue===C4)for(b=1;b<pt;++b){for(se=0,u=(l=b*mt)+mt;l<u;++l)se<xn[l]&&(se=xn[l]);for(l=b*mt;l<u;++l)xn[l]=se+Wn[b-1]}else if(Ue===BA){for(se=0,l=mt;l<Ct;++l)se<xn[l]&&(se=xn[l]);for(l=mt;l<Ct;++l)xn[l]=se+Un}else for(Ue=!1,b=1;b<pt;++b)for(u=(l=b*mt)+mt;l<u;++l)xn[l]+=Wn[b-1];for(G=0,l=0;l<Ct;++l)G=Et[l]+(l%mt?G:0),Kn[l]+=G-t[l].x;for(d=0;d<mt;++d)for(te=0,l=d;l<Ct;l+=mt)te+=xn[l],Qn[l]+=te-t[l].y;if(ze&&ec(r.center,zb)&&pt>1)for(l=0;l<Ct;++l)(G=(k=ze===BA?An:mn[l%mt])-ir[l].x2-t[l].x-Kn[l])>0&&(Kn[l]+=G/2);if(Ue&&ec(r.center,Ub)&&mt!==1)for(l=0;l<Ct;++l)(te=(k=Ue===BA?Un:Wn[~~(l/mt)])-ir[l].y2-t[l].y-Qn[l])>0&&(Qn[l]+=te/2);for(l=0;l<Ct;++l)Be.union(ir[l].translate(Kn[l],Qn[l]));switch(G=ec(r.anchor,lv),te=ec(r.anchor,Ty),ec(r.anchor,zb)){case kc:G-=Be.width();break;case bg:G-=Be.width()/2}switch(ec(r.anchor,Ub)){case kc:te-=Be.height();break;case bg:te-=Be.height()/2}for(G=Math.round(G),te=Math.round(te),Be.clear(),l=0;l<Ct;++l)t[l].mark.bounds.clear();for(l=0;l<Ct;++l)(T=t[l]).x+=Kn[l]+=G,T.y+=Qn[l]+=te,Be.union(T.mark.bounds.union(T.bounds.translate(Kn[l],Qn[l]))),he&&e.dirty(T);return Be}function PJ(e,t,r){var u,l,d,b,k,T,j,$=function(Ue){var st,ut,mt=Ue.items,pt=mt.length,Ct=0;
vendor: 4,198 bytes, line 7830
7830const Et={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;Ct<pt;++Ct)if(ut=(st=mt[Ct]).items,st.marktype===om)switch(st.role){case Ny:case am:case xg:break;case X2:Et.rowheaders.push(...ut);break;case FA:Et.rowfooters.push(...ut);break;case J2:Et.colheaders.push(...ut);break;case Q2:Et.colfooters.push(...ut);break;case RA:Et.rowtitle=ut[0];break;case Z2:Et.coltitle=ut[0];break;default:Et.marks.push(...ut)}return Et}(t),G=$.marks,te=r.bounds===S4?jJ:LJ,se=r.offset,he=r.columns||G.length,ve=he<=0?1:Math.ceil(G.length/he),Be=ve*he;const ze=mj(e,G,r);ze.empty()&&ze.set(0,0,0,0),$.rowheaders&&(T=ec(r.headerBand,Ub,null),u=LA(e,$.rowheaders,G,he,ve,-ec(se,"rowHeader"),dj,0,te,"x1",0,he,1,T)),$.colheaders&&(T=ec(r.headerBand,zb,null),l=LA(e,$.colheaders,G,he,he,-ec(se,"columnHeader"),dj,1,te,"y1",0,1,he,T)),$.rowfooters&&(T=ec(r.footerBand,Ub,null),d=LA(e,$.rowfooters,G,he,ve,ec(se,"rowFooter"),hj,0,te,"x2",he-1,he,1,T)),$.colfooters&&(T=ec(r.footerBand,zb,null),b=LA(e,$.colfooters,G,he,he,ec(se,"columnFooter"),hj,1,te,"y2",Be-he,1,he,T)),$.rowtitle&&(k=ec(r.titleAnchor,Ub),j=ec(se,"rowTitle"),j=k===kc?d+j:u-j,T=ec(r.titleBand,Ub,.5),gj(e,$.rowtitle,j,0,ze,T)),$.coltitle&&(k=ec(r.titleAnchor,zb),j=ec(se,"columnTitle"),j=k===kc?b+j:l-j,T=ec(r.titleBand,zb,.5),gj(e,$.coltitle,j,1,ze,T))}function jJ(e,t){return t==="x1"?e.x||0:t==="y1"?e.y||0:t==="x2"?(e.x||0)+(e.width||0):t==="y2"?(e.y||0)+(e.height||0):void 0}function LJ(e,t){return e.bounds[t]}function LA(e,t,r,u,l,d,b,k,T,j,$,G,te,se){var he,ve,Be,ze,Ue,st,ut,mt,pt,Ct=r.length,Et=0,mn=0;if(!Ct)return Et;for(he=$;he<Ct;he+=G)r[he]&&(Et=b(Et,T(r[he],j)));if(!t.length)return Et;for(t.length>l&&(e.warn("Grid headers exceed limit: "+l),t=t.slice(0,l)),Et+=d,ve=0,ze=t.length;ve<ze;++ve)e.dirty(t[ve]),t[ve].mark.bounds.clear();for(he=$,ve=0,ze=t.length;ve<ze;++ve,he+=G){for(Ue=(st=t[ve]).mark.bounds,Be=he;Be>=0&&(ut=r[Be])==null;Be-=te);k?(mt=se==null?ut.x:Math.round(ut.bounds.x1+se*ut.bounds.width()),pt=Et):(mt=Et,pt=se==null?ut.y:Math.round(ut.bounds.y1+se*ut.bounds.height())),Ue.union(st.bounds.translate(mt-(st.x||0),pt-(st.y||0))),st.x=mt,st.y=pt,e.dirty(st),mn=b(mn,Ue[j])}return mn}function gj(e,t,r,u,l,d){if(t){e.dirty(t);var b=r,k=r;u?b=Math.round(l.x1+d*l.width()):k=Math.round(l.y1+d*l.height()),t.bounds.translate(b-(t.x||0),k-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=b,t.y=k,e.dirty(t)}}function zJ(e,t,r,u,l,d,b){const k=function(te,se){const he=te[se]||{};return(ve,Be)=>he[ve]!=null?he[ve]:te[ve]!=null?te[ve]:Be}(r,t),T=function(te,se){let he=-1/0;return te.forEach(ve=>{ve.offset!=null&&(he=Math.max(he,ve.offset))}),he>-1/0?he:se}(e,k("offset",0)),j=k("anchor",im),$=j===kc?1:j===bg?.5:0,G={align:C4,bounds:k("bounds",S4),columns:k("direction")==="vertical"?1:e.length,padding:k("margin",8),center:k("center"),nodirty:!0};switch(t){case vo:G.anchor={x:Math.floor(u.x1)-T,column:kc,y:$*(b||u.height()+2*u.y1),row:j};break;case ea:G.anchor={x:Math.ceil(u.x2)+T,y:$*(b||u.height()+2*u.y1),row:j};break;case Es:G.anchor={y:Math.floor(l.y1)-T,row:kc,x:$*(d||l.width()+2*l.x1),column:j};break;case _a:G.anchor={y:Math.ceil(l.y2)+T,x:$*(d||l.width()+2*l.x1),column:j};break;case dc:G.anchor={x:T,y:T};break;case Ru:G.anchor={x:d-T,y:T,column:kc};break;case Bu:G.anchor={x:T,y:b-T,row:kc};break;case rm:G.anchor={x:d-T,y:b-T,column:kc,row:kc}}return G}function UJ(e,t){var r,u,l=t.items[0],d=l.datum,b=l.orient,k=l.bounds,T=l.x,j=l.y;return l._bounds?l._bounds.clear().union(k):l._bounds=k.clone(),k.clear(),function($,G,te){var se=G.padding,he=se-te.x,ve=se-te.y;if(G.datum.title){var Be=G.items[1].items[0],ze=Be.anchor,Ue=G.titlePadding||0,st=se-Be.x,ut=se-Be.y;switch(Be.orient){case vo:he+=Math.ceil(Be.bounds.width())+Ue;break;case ea:case _a:break;default:ve+=Be.bounds.height()+Ue}switch((he||ve)&&oE($,te,he,ve),Be.orient){case vo:ut+=t_(G,te,Be,ze,1,1);break;case ea:st+=t_(G,te,Be,kc,0,0)+Ue,ut+=t_(G,te,Be,ze,1,1);break;case _a:st+=t_(G,te,Be,ze,0,0),ut+=t_(G,te,Be,kc,-1,0,1)+Ue;break;default:st+=t_(G,te,Be,ze,0,0)}(st||ut)&&oE($,Be,st,ut),(st=Math.round(Be.bounds.x1-se))<0&&(oE($,te,-st,0),oE($,Be,-st,0))}else(he||ve)&&oE($,te,he,ve)}
vendor: 4,831 bytes, line 7830
7830(e,l,l.items[0].items[0]),k=function($,G){return $.items.forEach(te=>G.union(te.bounds)),G.x1=$.padding,G.y1=$.padding,G}(l,k),r=2*l.padding,u=2*l.padding,k.empty()||(r=Math.ceil(k.width()+r),u=Math.ceil(k.height()+u)),d.type===OJ&&function($){const G=$.reduce((te,se)=>(te[se.column]=Math.max(se.bounds.x2-se.x,te[se.column]||0),te),{});$.forEach(te=>{te.width=G[te.column],te.height=te.bounds.y2-te.y})}(l.items[0].items[0].items[0].items),b!==E4&&(l.x=T=0,l.y=j=0),l.width=r,l.height=u,Id(k.set(T,j,T+r,j+u),l),l.mark.bounds.clear().union(k),l}function t_(e,t,r,u,l,d,b){const k=e.datum.type!=="symbol",T=r.datum.vgrad,j=(!k||!d&&T||b?t:t.items[0]).bounds[l?"y2":"x2"]-e.padding,$=T&&d?j:0,G=T&&d?0:j,te=l<=0?0:au(r);return Math.round(u===im?$:u===kc?G-te:.5*(j-te))}function oE(e,t,r,u){t.x+=r,t.y+=u,t.bounds.translate(r,u),t.mark.bounds.translate(r,u),e.dirty(t)}function vj(e){Wt.call(this,null,e)}function yj(e,t){let r=0;if(t===void 0)for(let u of e)(u=+u)&&(r+=u);else{let u=-1;for(let l of e)(l=+t(l,++u,e))&&(r+=l)}return r}function bj(e){Wt.call(this,null,e)}function xj(e){Wt.call(this,null,e)}function WJ(){return Fn({})}function wj(e){Wt.call(this,null,e)}function _j(e){Wt.call(this,[],e)}Object(xe.z)(vj,Wt,{transform(e,t){const r=t.dataflow;return e.mark.items.forEach(u=>{e.layout&&PJ(r,u,e.layout),function(l,d,b){var k,T,j,$,G,te=d.items,se=Math.max(0,d.width||0),he=Math.max(0,d.height||0),ve=new zs().set(0,0,se,he),Be=ve.clone(),ze=ve.clone(),Ue=[];for($=0,G=te.length;$<G;++$)switch((T=te[$]).role){case Ny:(MJ(T)?Be:ze).union(FJ(l,T,se,he));break;case xg:k=T;break;case am:Ue.push(UJ(l,T));break;case MA:case Lb:case X2:case FA:case RA:case J2:case Q2:case Z2:Be.union(T.bounds),ze.union(T.bounds);break;default:ve.union(T.bounds)}if(Ue.length){const st={};Ue.forEach(ut=>{(j=ut.orient||ea)!==E4&&(st[j]||(st[j]=[])).push(ut)});for(const ut in st){const mt=st[ut];mj(l,mt,zJ(mt,ut,b.legends,Be,ze,se,he))}Ue.forEach(ut=>{const mt=ut.bounds;if(mt.equals(ut._bounds)||(ut.bounds=ut._bounds,l.dirty(ut),ut.bounds=mt,l.dirty(ut)),b.autosize&&b.autosize.type===tj)switch(ut.orient){case vo:case ea:ve.add(mt.x1,0).add(mt.x2,0);break;case Es:case _a:ve.add(0,mt.y1).add(0,mt.y2)}else ve.union(mt)})}ve.union(Be).union(ze),k&&ve.union(function(st,ut,mt,pt,Ct){var Et,mn=ut.items[0],An=mn.frame,xn=mn.orient,Wn=mn.anchor,Un=mn.offset,Kn=mn.padding,Qn=mn.items[0].items[0],ir=mn.items[1]&&mn.items[1].items[0],Nr=xn===vo||xn===ea?pt:mt,Jr=0,Lr=0,hi=0,Ri=0,Pi=0;if(An!==om?xn===vo?(Jr=Ct.y2,Nr=Ct.y1):xn===ea?(Jr=Ct.y1,Nr=Ct.y2):(Jr=Ct.x1,Nr=Ct.x2):xn===vo&&(Jr=pt,Nr=0),Et=Wn===im?Jr:Wn===kc?Nr:(Jr+Nr)/2,ir&&ir.text){switch(xn){case Es:case _a:Pi=Qn.bounds.height()+Kn;break;case vo:Ri=Qn.bounds.width()+Kn;break;case ea:Ri=-Qn.bounds.width()-Kn}jd.clear().union(ir.bounds),jd.translate(Ri-(ir.x||0),Pi-(ir.y||0)),e_(ir,"x",Ri)|e_(ir,"y",Pi)&&(st.dirty(ir),ir.bounds.clear().union(jd),ir.mark.bounds.clear().union(jd),st.dirty(ir)),jd.clear().union(ir.bounds)}else jd.clear();switch(jd.union(Qn.bounds),xn){case Es:Lr=Et,hi=Ct.y1-jd.height()-Un;break;case vo:Lr=Ct.x1-jd.width()-Un,hi=Et;break;case ea:Lr=Ct.x2+jd.width()+Un,hi=Et;break;case _a:Lr=Et,hi=Ct.y2+Un;break;default:Lr=mn.x,hi=mn.y}return e_(mn,"x",Lr)|e_(mn,"y",hi)&&(jd.translate(Lr,hi),st.dirty(mn),mn.bounds.clear().union(jd),ut.bounds.clear().union(jd),st.dirty(mn)),mn.bounds}(l,k,se,he,ve)),d.clip&&ve.set(0,0,d.width||0,d.height||0),function(st,ut,mt,pt){const Ct=pt.autosize||{},Et=Ct.type;if(st._autosize<1||!Et)return;let mn=st._width,An=st._height,xn=Math.max(0,ut.width||0),Wn=Math.max(0,Math.ceil(-mt.x1)),Un=Math.max(0,ut.height||0),Kn=Math.max(0,Math.ceil(-mt.y1));const Qn=Math.max(0,Math.ceil(mt.x2-xn)),ir=Math.max(0,Math.ceil(mt.y2-Un));if(Ct.contains===AJ){const Nr=st.padding();mn-=Nr.left+Nr.right,An-=Nr.top+Nr.bottom}Et===E4?(Wn=0,Kn=0,xn=mn,Un=An):Et===tj?(xn=Math.max(0,mn-Wn-Qn),Un=Math.max(0,An-Kn-ir)):Et===DJ?(xn=Math.max(0,mn-Wn-Qn),An=Un+Kn+ir):Et===TJ?(mn=xn+Wn+Qn,Un=Math.max(0,An-Kn-ir)):Et===NJ&&(mn=xn+Wn+Qn,An=Un+Kn+ir),st._resizeView(mn,An,xn,Un,[Wn,Kn],Ct.resize)}(l,d,ve,b)}(r,u,e)}),function(u){return u&&u.mark.role!=="legend-entry"}(e.mark.group)?t.reflow():t}}),Object(xe.z)(bj,Wt,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var r=t.dataflow.locale(),u=t.fork(t.NO_SOURCE|t.NO_FIELDS),l=this.value,d=e.scale,b=og(d,e.count==null?e.values?e.values.length:10:e.count,e.minstep),k=e.format||cy(r,d,b,e.formatSpecifier,e.formatType,!!e.values),T=e.values?uy(d,e.values,b):Od(d,b);return l&&(u.rem=l),l=T.map((j,$)=>Fn({index:$/(T.length-1||1),value:j,label:k(j)})),e.extra&&l.length&&l.push(Fn({index:-1,extra:{value:l[0].value},label:""})),u.source=l,u.add=l,this.value=l,u}}),Object(xe.z)(xj,Wt,{transform(e,t){var r=t.dataflow,u=t.fork(t.NO_SOURCE|t.NO_FIELDS),l=e.item||WJ,d=e.ke
7830y||fn,b=this.value;return Object(xe.B)(u.encode)&&(u.encode=null),b&&(e.modified("key")||t.modified(d))&&Object(xe.o)("DataJoin does not support modified key function or fields."),b||(t=t.addAll(),this.value=b=function(k){const T=Object(xe.t)().test(j=>j.exit);return T.lookup=j=>T.get(k(j)),T}(d)),t.visit(t.ADD,k=>{const T=d(k);let j=b.get(T);j?j.exit?(b.empty--,u.add.push(j)):u.mod.push(j):(j=l(k),b.set(T,j),u.add.push(j)),j.datum=k,j.exit=!1}),t.visit(t.MOD,k=>{const T=d(k),j=b.get(T);j&&(j.datum=k,u.mod.push(j))}),t.visit(t.REM,k=>{const T=d(k),j=b.get(T);k!==j.datum||j.exit||(u.rem.push(j),j.exit=!0,++b.empty)}),t.changed(t.ADD_MOD)&&u.modifies("datum"),(t.clean()||e.clean&&b.empty>r.cleanThreshold)&&r.runAfter(b.clean),u}}),Object(xe.z)(wj,Wt,{transform(e,t){var r=t.fork(t.ADD_REM),u=e.mod||!1,l=e.encoders,d=t.encode;if(Object(xe.B)(d)){if(!r.changed()&&!d.every(G=>l[G]))return t.StopPropagation;d=d[0],r.encode=null}var b=d==="enter",k=l.update||xe.s,T=l.enter||xe.s,j=l.exit||xe.s,$=(d&&!b?l[d]:k)||xe.s;if(t.changed(t.ADD)&&(t.visit(t.ADD,G=>{T(G,e),k(G,e)}),r.modifies(T.output),r.modifies(k.output),$!==xe.s&&$!==k&&(t.visit(t.ADD,G=>{$(G,e)}),r.modifies($.output))),t.changed(t.REM)&&j!==xe.s&&(t.visit(t.REM,G=>{j(G,e)}),r.modifies(j.output)),b||$!==xe.s){const G=t.MOD|(e.modified()?t.REFLOW:0);b?(t.visit(G,te=>{const se=T(te,e)||u;($(te,e)||se)&&r.mod.push(te)}),r.mod.length&&r.modifies(T.output)):t.visit(G,te=>{($(te,e)||u)&&r.mod.push(te)}),r.mod.length&&r.modifies($.output)}return r.changed()?r:t.StopPropagation}}),Object(xe.z)(_j,Wt,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var r,u,l,d,b,k=t.dataflow.locale(),T=t.fork(t.NO_SOURCE|t.NO_FIELDS),j=this.value,$=e.type||e0,G=e.scale,te=+e.limit,se=og(G,e.count==null?5:e.count,e.minstep),he=!!e.values||$===e0,ve=e.format||dy(k,G,se,$,e.formatSpecifier,e.formatType,he),Be=e.values||fy(G,se);return j&&(T.rem=j),$===e0?(te&&Be.length>te?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),j=Be.slice(0,te-1),b=!0):j=Be,Object(xe.E)(l=e.size)?(e.values||G(j[0])!==0||(j=j.slice(1)),d=j.reduce((ze,Ue)=>Math.max(ze,l(Ue,e)),0)):l=Object(xe.m)(d=l||8),j=j.map((ze,Ue)=>Fn({index:Ue,label:ve(ze,Ue,j),value:ze,offset:d,size:l(ze,e)})),b&&(b=Be[j.length],j.push(Fn({index:j.length,label:"â¦".concat(Be.length-j.length," entries"),value:b,offset:d,size:l(b,e)}
7830)))):$==="gradient"?(r=G.domain(),u=$p(G,r[0],Object(xe.W)(r)),Be.length<3&&!e.values&&r[0]!==Object(xe.W)(r)&&(Be=[r[0],Object(xe.W)(r)]),j=Be.map((ze,Ue)=>Fn({index:Ue,label:ve(ze,Ue,Be),value:ze,perc:u(ze)}))):(l=Be.length-1,u=function(ze){const Ue=ze.domain(),st=Ue.length-1;let ut=+Ue[0],mt=+Object(xe.W)(Ue),pt=mt-ut;if(ze.type===ef){const Ct=st?pt/st:.1;pt=(mt+=Ct)-(ut-=Ct)}return Ct=>(Ct-ut)/pt}(G),j=Be.map((ze,Ue)=>Fn({index:Ue,label:ve(ze,Ue,Be),value:ze,perc:Ue?u(ze):0,perc2:Ue===l?1:u(Be[Ue+1])}))),T.source=j,T.add=j,this.value=j,T}});const VJ=e=>e.source.x,$J=e=>e.source.y,HJ=e=>e.target.x,qJ=e=>e.target.y;function O4(e){Wt.call(this,{},e)}O4.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},Object(xe.z)(O4,Wt,{transform(e,t){var r=e.sourceX||VJ,u=e.sourceY||$J,l=e.targetX||HJ,d=e.targetY||qJ,b=e.as||"path",k=e.orient||"vertical",T=e.shape||"line",j=Sj.get(T+"-"+k)||Sj.get(T);return j||Object(xe.o)("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,$=>{$[b]=j(r($),u($),l($),d($))}),t.reflow(e.modified()).modifies(b)}});const kj=(e,t,r,u)=>"M"+e+","+t+"L"+r+","+u,Ej=(e,t,r,u)=>{var l=r-e,d=u-t,b=Math.sqrt(l*l+d*d)/2;return"M"+e+","+t+"A"+b+","+b+" "+180*Math.atan2(d,l)/Math.PI+" 0 1 "+r+","+u},Cj=(e,t,r,u)=>{const l=r-e,d=u-t,b=.2*(l+d),k=.2*(d-l);return"M"+e+","+t+"C"+(e+b)+","+(t+k)+" "+(r+k)+","+(u-b)+" "+r+","+u},Sj=Object(xe.t)({line:kj,"line-radial":(e,t,r,u)=>kj(t*Math.cos(e),t*Math.sin(e),u*Math.cos(r),u*Math.sin(r)),arc:Ej,"arc-radial":(e,t,r,u)=>Ej(t*Math.cos(e),t*Math.sin(e),u*Math.cos(r),u*Math.sin(r)),curve:Cj,"curve-radial":(e,t,r,u)=>Cj(t*Math.cos(e),t*Math.sin(e),u*Math.cos(r),u*Math.sin(r)),"orthogonal-horizontal":(e,t,r,u)=>"M"+e+","+t+"V"+u+"H"+r,"orthogonal-vertical":(e,t,r,u)=>"M"+e+","+t+"H"+r+"V"+u,"orthogonal-radial":(e,t,r,u)=>{const l=Math.cos(e),d=Math.sin(e),b=Math.cos(r),k=Math.sin(r);return"M"+t*l+","+t*d+"A"+t+","+t+" 0 0,"+((Math.abs(r-e)>Math.PI?r<=e:r>e)?1:0)+" "+t*b+","+t*k+"L"+u*b+","+u*k},"diagonal-horizontal":(e,t,r,u)=>{const l=(e+r)/2;return"M"+e+","+t+"C"+l+","+t+" "+l+","+u+" "+r+","+u},"diagonal-vertical":(e,t,r,u)=>{const l=(t+u)/2;return"M"+e+","+t+"C"+e+","+l+" "+r+","+l+" "+r+","+u},"diagonal-radial":(e,t,r,u)=>{const l=Math.cos(e),d=Math.sin(e),b=Math.cos(r),k=Math.sin(r),T=(t+u)/2;return"M"+t*l+","+t*d+"C"+T*l+","+T*d+" "+T*b+","+T*k+" "+u*b+","+u*k}});function D4(e){Wt.call(this,null,e)}D4.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},Object(xe.z)(D4,Wt,{transform(e,t){var r,u,l,d=e.as||["startAngle","endAngle"],b=d[0],k=d[1],T=e.field||xe.Q,j=e.startAngle||0,$=e.endAngle!=null?e.endAngle:2*Math.PI,G=t.source,te=G.map(T),se=te.length,he=j,ve=($-j)/yj(te),Be=vu(se);for(e.sort&&Be.sort((ze,Ue)=>te[ze]-te[Ue]),r=0;r<se;++r)l=te[Be[r]],(u=G[Be[r]])[b]=he,u[k]=he+=l*ve;return this.value=te,t.reflow(e.modified()).modifies(d)}});const GJ=5;function Aj(e){return Nh(e)&&e!==Wc}const KJ=Object(xe.Fa)(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function Oj(e){Wt.call(this,null,e),this.modified(!0)}function Dj(e,t,r){return Kg(e)&&Math.abs(t.reduce((u,l)=>u+(l<0?-1:l>0?1:0),0))!==t.length&&r.warn("Log scale domain includes zero: "+Object(xe.Ba)(t)),t}function Tj(e,t,r){return Object(xe.E)(e)&&(t||r)?Jg(e,T4(t||[0,1],r)):e}function T4(e,t){return t?e.slice().reverse():e}function Nj(e){Wt.call(this,null,e)}Object(xe.z)(Oj,Wt,{transform(e,t){var r=t.dataflow,u=this.value,l=function(d){var b,k=d.type,T="";return k===Wc?Wc+"-"+Ed:(function(j){const $=j.type;return Nh($)&&$!==Cd&&$!==Sd&&(j.scheme||j.range&&j.range.length&&j.range.every(xe.J))}(d)&&(b=d.rawDomain?d.rawDomain.length:d.domain?d.domain.length+ +(d.domainMid!=null):0,T=b===2?Wc+"-":b===3?Wp+"-":""),(T+k||Ed).toLowerCase())}(e);for(l in u&&l===u.type||(this.value=u=da(l)()),e)if(!KJ[l]){if(l==="padding"&&Aj(u.type))continue;Object(xe.E)(u[l])?u[l](e[l]):r.warn("Unsupported scale property: "+l)}return function(d,b,k){var T=d.type,j=b.round||!1,$=b.range;if(b.rangeStep!=null)$=function(G,te,se){G!==Th&&G!==qg&&Object(xe.o)("Only band and point scales support rangeStep.");var he=(te.paddingOuter!=null?te.paddingOuter:te.padding)||0,ve=G===qg?1:(te.paddingInner!=null?te.paddingInner:te.padding)||0;return[0,te.rangeStep*Hg(se,ve,he)]}(T,b,k);
7830else if(b.scheme&&($=function(G,te,se){var he,ve,Be=te.schemeExtent;return Object(xe.B)(te.scheme)?ve=Ad(te.scheme,te.interpolate,te.interpolateGamma):(he=te.scheme.toLowerCase(),(ve=Q0(he))||Object(xe.o)("Unrecognized scheme name: ".concat(te.scheme))),se=G===ef?se+1:G===tf?se-1:G===Oh||G===Ff?+te.schemeCount||GJ:se,Yg(G)?Tj(ve,Be,te.reverse):Object(xe.E)(ve)?Qg(Tj(ve,Be),se):G===Dh?ve:ve.slice(0,se)}(T,b,k),Object(xe.E)($))){if(d.interpolator)return d.interpolator($);Object(xe.o)("Scale type ".concat(T," does not support interpolating color schemes."))}if($&&Yg(T))return d.interpolator(Ad(T4($,b.reverse),b.interpolate,b.interpolateGamma));$&&b.interpolate&&d.interpolate?d.interpolate(Zg(b.interpolate,b.interpolateGamma)):Object(xe.E)(d.round)?d.round(j):Object(xe.E)(d.rangeRound)&&d.interpolate(j?Na:Ua),$&&d.range(T4($,b.reverse))}(u,e,function(d,b,k){let T=b.bins;if(T&&!Object(xe.B)(T)){const j=d.domain(),$=j[0],G=Object(xe.W)(j),te=T.step;let se=T.start==null?$:T.start,he=T.stop==null?G:T.stop;te||Object(xe.o)("Scale bins parameter missing step property."),se<$&&(se=te*Math.ceil($/te)),he>G&&(he=te*Math.floor(G/te)),T=vu(se,he+te/2,te)}return T?d.bins=T:d.bins&&delete d.bins,d.type===tf&&(T?b.domain||b.domainRaw||(d.domain(T),k=T.length):d.bins=d.domain()),k}(u,e,function(d,b,k){const T=function(he,ve,Be){return ve?(he.domain(Dj(he.type,ve,Be)),ve.length):-1}(d,b.domainRaw,k);if(T>-1)return T;var j,$,G=b.domain,te=d.type,se=b.zero||b.zero===void 0&&function(he){const ve=he.type;return!he.bins&&(ve===Ed||ve===eg||ve===Up)}(d);if(!G)return 0;if(Aj(te)&&b.padding&&G[0]!==Object(xe.W)(G)&&(G=function(he,ve,Be,ze,Ue,st){var ut=Math.abs(Object(xe.W)(Be)-Be[0]),mt=ut/(ut-2*ze),pt=he===Mf?Object(xe.Oa)(ve,null,mt):he===Up?Object(xe.Pa)(ve,null,mt,.5):he===eg?Object(xe.Pa)(ve,null,mt,Ue||1):he===Ah?Object(xe.Qa)(ve,null,mt,st||1):Object(xe.Na)(ve,null,mt);return(ve=ve.slice())[0]=pt[0],ve[ve.length-1]=pt[1],ve}(te,G,b.range,b.padding,b.exponent,b.constant)),(se||b.domainMin!=null||b.domainMax!=null||b.domainMid!=null)&&(j=(G=G.slice()).length-1||1,se&&(G[0]>0&&(G[0]=0),G[j]<0&&(G[j]=0)),b.domainMin!=null&&(G[0]=b.domainMin),b.domainMax!=null&&(G[j]=b.domainMax),b.domainMid!=null)){const he=($=b.domainMid)>G[j]?j+1:$<G[0]?0:j;he!==j&&k.warn("Scale domainMid exceeds domain min or max.",$),G.splice(he,0,$)}return d.domain(Dj(te,G,k)),te===Dh&&d.unknown(b.domainImplicit?il:void 0),b.nice&&d.nice&&d.nice(b.nice!==!0&&og(d,b.nice)||null),G.length}(u,e,r))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),Object(xe.z)(Nj,Wt,{transform(e,t){const r=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return r&&t.source.sort(fi(e.sort)),this.modified(r),t}});const Ij=["y0","y1"];function N4(e){Wt.call(this,null,e)}function YJ(e,t,r,u,l){for(var d,b=(t-e.sum)/2,k=e.length,T=0;T<k;++T)(d=e[T])[u]=b,d[l]=b+=Math.abs(r(d))}function XJ(e,t,r,u,l){for(var d,b=1/e.sum,k=0,T=e.length,j=0,$=0;j<T;++j)(d=e[j])[u]=k,d[l]=k=b*($+=Math.abs(r(d)))}function JJ(e,t,r,u,l){for(var d,b,k=0,T=0,j=e.length,$=0;$<j;++$)(d=+r(b=e[$]))<0?(b[u]=T,b[l]=T+=d):(b[u]=k,b[l]=k+=d)}N4.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:"zero",values:["zero","center","normalize"]},{name:"as",type:"string",array:!0,length:2,default:Ij}]},Object(xe.z)(N4,Wt,{transform(e,t){var r,u,l,d,b=e.as||Ij,k=b[0],T=b[1],j=fi(e.sort),$=e.field||xe.Q,G=e.offset==="center"?YJ:e.offset==="normalize"?XJ:JJ;for(r=function(te,se,he,ve){var Be,ze,Ue,st,ut,mt,pt,Ct,Et,mn=[],An=xn=>xn(ut);if(se==null)mn.push(te.slice());else for(Be={},ze=0,Ue=te.length;ze<Ue;++ze)ut=te[ze],mt=se.map(An),(pt=Be[mt])||(Be[mt]=pt=[],mn.push(pt)),pt.push(ut);for(mt=0,Et=0,st=mn.length;mt<st;++mt){for(pt=mn[mt],ze=0,Ct=0,Ue=pt.length;ze<Ue;++ze)Ct+=Math.abs(ve(pt[ze]));pt.sum=Ct,Ct>Et&&(Et=Ct),he&&pt.sort(he)}return mn.max=Et,mn}(t.source,e.groupby,j,$),u=0,l=r.length,d=r.max;u<l;++u)G(r[u],d,$,k,T);return t.reflow(e.modified()).modifies(b)}});var aE=e=>e;function zA(e,t){e&&Fj.hasOwnProperty(e.type)&&Fj[e.type](e,t)}var Mj={Feature:function(e,t){zA(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,u=-1,l=r.length;++u<l;)zA(r[u].geometry,t)}},Fj={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var r=e.coordinates,u=-1,l=r.length;++u<l;)e=r[u],t.point(e[0],e[1],e[2])},LineString:function(e,t){I4(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,u=-1,l=r.length;++u<l;)I4(r[u],t,0)},Polygon:function(e,t){Rj(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,u=-1,l=r.length;++u<l;)Rj(r[u],t)},GeometryCollection:function(e,t){for(var r=e.geometries,u=-1,l=r.length;++u<l;)zA(r[u],t)}};function I4(e,t,r){var u,l=-1,d=e.length-r;for(t.lineStart();++l<d;)u=e[l],t.point(u[0],u[1],u[2]);t.lineEnd()}function Rj(e,t){var r=-1,u=e.length;for(t.polygonStart();++r<u;)I4(e[r],t,1);t.polygonEnd()}var D1=function(e,t){e&&Mj.hasOwnProperty(e.type)?Mj[e.type](e,t):zA(e,t)};class $h{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const r=this._partials;let u=0;for(let l=0;l<this._n&&l<32;l++){const d=r[l],b=t+d,k=Math.abs(t)<Math.abs(d)?t-(b-d):d-(b-t);k&&(r[u++]=k),t=b}return r[u]=t,this._n=u+1,this}valueOf(){const t=this._partials;let r,u,l,d=this._n,b=0;if(d>0){for(b=t[--d];d>0&&(r=b,!(l=(u=t[--d])-((b=r+u)-r))););d>0&&(l<0&&t[d-1]<0||l>0&&t[d-1]>0)&&(u=2*l)==(r=b+u)-b&&(b=r)}return b}}var po=1e-6,ka=Math.PI,Ec=ka/2,UA=ka/4,Hh=2*ka,Hc=180/ka,Ea=ka/180,es=Math.abs,n_=Math.atan,p0=Math.atan2,yo=Math.cos,WA=Math.ceil,Bj=Math.exp,M4=Math.hypot,VA=Math.log,F4=Math.pow,io=Math.sin,m0=Math.sign||function(e){return e>0?1:e<0?-1:0},qh=Math.sqrt,R4=Math.tan;function Pj(e){return e>1?0:e<-1?ka:Math.acos(e)}function sm(e){return e>1?Ec:e<-1?-Ec:Math.asin(e)}function Hf(){}var jj,Lj,B4,P4,j4=new $h,L4=new $h,Wb={point:Hf,lineStart:Hf,lineEnd:Hf,polygonStart:function(){Wb.lineStart=QJ,Wb.lineEnd=eQ},polygonEnd:function(){Wb.lineStart=Wb.lineEnd=Wb.point=Hf,j4.add(es(L4)),L4=new $h},result:function(){var e=j4/2;return j4=new $h,e}};function QJ(){Wb.point=ZJ}function ZJ(e,t){Wb.point=zj,jj=B4=e,Lj=P4=t}function zj(e,t){L4.add(P4*e-B4*t),B4=e,P4=t}function eQ(){zj(jj,Lj)}var Uj=Wb,r_=1/0,$A=r_,sE=-r_,HA=sE,Wj,Vj,Iy,My,qA={point:function(e,t){e<r_&&(r_=e),e>sE&&(sE=e),t<$A&&($A=t),t>HA&&(HA=t)},lineStart:Hf,lineEnd:Hf,polygonStart:Hf,polygonEnd:Hf,result:function(){var e=[[r_,$A],[sE,HA]];return sE=HA=-($A=r_=1/0),e}},z4=0,U4=0,uE=0,GA=0,KA=0,i_=0,W4=0,V4=0,cE=0,fv={point:lw,lineStart:$j,lineEnd:Hj,polygonStart:function(){fv.lineStart=rQ,fv.lineEnd=iQ},polygonEnd:function(){fv.point=lw,fv.lineStart=$j,fv.lineEnd=Hj},result:function(){var e=cE?[W4/cE,V4/cE]:i_?[GA/i_,KA/i_]:uE?[z4/uE,U4/uE]:[NaN,NaN];return z4=U4=uE=GA=KA=i_=W4=V4=cE=0,e}};function lw(e,t){z4+=e,U4+=t,++uE}function $j(){fv.point=tQ}function tQ(e,t){fv.point=nQ,lw(Iy=e,My=t)}function nQ(e,t){var r=e-Iy,u=t-My,l=qh(r*r+u*u);GA+=l*(Iy+e)/2,KA+=l*(My+t)/2,i_+=l,lw(Iy=e,My=t)}function Hj(){fv.point=lw}function rQ(){fv.point=oQ}function iQ(){qj(Wj,Vj)}function oQ(e,t){fv.point=qj,lw(Wj=Iy=e,Vj=My=t)}function qj(e,t){var r=e-Iy,u=t-My,l=qh(r*r+u*u);GA+=l*(Iy+e)/2,KA+=l*(My+t)/2,i_+=l,W4+=(l=My*e-Iy*t)*(Iy+e),V4+=l*(My+t),cE+=3*l,lw(Iy=e,My=t)}var Gj=fv;function Kj(e){this._context=e}Kj.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Hh)}},result:Hf};var $4,Yj,Xj,lE,fE,H4=new $h,YA={point:Hf,lineStart:function(){YA.point=aQ},lineEnd:function(){$4&&Jj(Yj,Xj),YA.point=Hf},polygonStart:function(){$4=!0},polygonEnd:function(){$4=null},result:function(){var e=+H4;return H4=new $h,e}};function aQ(e,t){YA.point=Jj,Yj=lE=e,Xj=fE=t}function Jj(e,t){lE-=e,fE-=t,H4.add(qh(lE*lE+fE*fE)),lE=e,fE=t}var Qj=YA;function Zj(){this._string=[]}function e8(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}Zj.prototype={_radius:4.5,_circle:e8(4.5),pointRadius:function(e){return(e=+e)!==this._radius&&(this._radius=e,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._string.push("M",e,",",t),this._point=1;break;case 1:this._string.push("L",e,",",t);break;default:this._circle==null&&(this._circle=e8(this._radius)),this._string.push("M",e,",",t,this._circle)}},result:function(){if(this._string.length){var e=this._string.join("");return this._string=[],e}return null}};var t8=function(e,t){var r,u,l=4.5;function d(b){return b&&(typeof l=="function"&&u.pointRadius(+l.apply(this,arguments)),D1(b,r(u))),u.result()}return d.area=function(b){return D1(b,r(Uj)),Uj.result()},d.measure=function(b){return D1(b,r(Qj)),Qj.result()},d.bounds=function(b){return D1(b,r(qA)),qA.result()},d.centroid=function(b){return D1(b,r(Gj)),Gj.result()},d.projection=function(b){return arguments.length?(r=b==null?(e=null,aE):(e=b).stream,d):e},d.context=function(b){return arguments.length?(u=b==null?(t=null,new Zj):new Kj(t=b),typeof l!="function"&&u.pointRadius(l),d):t},d.pointRadius=function(b){return arguments.length?(l=typeof b=="function"?b:(u.pointRadius(+b),+b),d):l},d.projection(e).context(t)}
vendor: 5,967 bytes, line 7830
7830,n8=function(){var e,t=[];return{point:function(r,u,l){e.push([r,u,l])},lineStart:function(){t.push(e=[])},lineEnd:Hf,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],e=null,r}}},XA=function(e,t){return es(e[0]-t[0])<po&&es(e[1]-t[1])<po};function JA(e,t,r,u){this.x=e,this.z=t,this.o=r,this.e=u,this.v=!1,this.n=this.p=null}var r8=function(e,t,r,u,l){var d,b,k=[],T=[];if(e.forEach(function(he){if(!((ve=he.length-1)<=0)){var ve,Be,ze=he[0],Ue=he[ve];if(XA(ze,Ue)){if(!ze[2]&&!Ue[2]){for(l.lineStart(),d=0;d<ve;++d)l.point((ze=he[d])[0],ze[1]);return void l.lineEnd()}Ue[0]+=2*po}k.push(Be=new JA(ze,he,null,!0)),T.push(Be.o=new JA(ze,null,Be,!1)),k.push(Be=new JA(Ue,he,null,!1)),T.push(Be.o=new JA(Ue,null,Be,!0))}}),k.length){for(T.sort(t),i8(k),i8(T),d=0,b=T.length;d<b;++d)T[d].e=r=!r;for(var j,$,G=k[0];;){for(var te=G,se=!0;te.v;)if((te=te.n)===G)return;j=te.z,l.lineStart();do{if(te.v=te.o.v=!0,te.e){if(se)for(d=0,b=j.length;d<b;++d)l.point(($=j[d])[0],$[1]);else u(te.x,te.n.x,1,l);te=te.n}else{if(se)for(j=te.p.z,d=j.length-1;d>=0;--d)l.point(($=j[d])[0],$[1]);else u(te.x,te.p.x,-1,l);te=te.p}j=(te=te.o).z,se=!se}while(!te.v);l.lineEnd()}}};function i8(e){if(t=e.length){for(var t,r,u=0,l=e[0];++u<t;)l.n=r=e[u],r.p=l,l=r;l.n=r=e[0],r.p=l}}function QA(e){return[p0(e[1],e[0]),sm(e[2])]}function fw(e){var t=e[0],r=e[1],u=yo(r);return[u*yo(t),u*io(t),io(r)]}function ZA(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function o_(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function q4(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function eO(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function tO(e){var t=qh(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function G4(e){return es(e[0])<=ka?e[0]:m0(e[0])*((es(e[0])+ka)%Hh-ka)}function o8(e){return Array.from(function*(t){for(const r of t)yield*r}(e))}var a8=function(e,t,r,u){return function(l){var d,b,k,T=t(l),j=n8(),$=t(j),G=!1,te={point:se,lineStart:ve,lineEnd:Be,polygonStart:function(){te.point=ze,te.lineStart=Ue,te.lineEnd=st,b=[],d=[]},polygonEnd:function(){te.point=se,te.lineStart=ve,te.lineEnd=Be,b=o8(b);var ut=function(mt,pt){var Ct=G4(pt),Et=pt[1],mn=io(Et),An=[io(Ct),-yo(Ct),0],xn=0,Wn=0,Un=new $h;mn===1?Et=Ec+po:mn===-1&&(Et=-Ec-po);for(var Kn=0,Qn=mt.length;Kn<Qn;++Kn)if(Nr=(ir=mt[Kn]).length)for(var ir,Nr,Jr=ir[Nr-1],Lr=G4(Jr),hi=Jr[1]/2+UA,Ri=io(hi),Pi=yo(hi),so=0;so<Nr;++so,Lr=ji,Ri=Go,Pi=Ra,Jr=Ui){var Ui=ir[so],ji=G4(Ui),Yi=Ui[1]/2+UA,Go=io(Yi),Ra=yo(Yi),uo=ji-Lr,rs=uo>=0?1:-1,is=rs*uo,Is=is>ka,Tu=Ri*Go;if(Un.add(p0(Tu*rs*io(is),Pi*Ra+Tu*yo(is))),xn+=Is?uo+rs*Hh:uo,Is^Lr>=Ct^ji>=Ct){var Nu=o_(fw(Jr),fw(Ui));tO(Nu);var uu=o_(An,Nu);tO(uu);var Xf=(Is^uo>=0?-1:1)*sm(uu[2]);(Et>Xf||Et===Xf&&(Nu[0]||Nu[1]))&&(Wn+=Is^uo>=0?1:-1)}}return(xn<-po||xn<po&&Un<-1e-12)^1&Wn}(d,u);b.length?(G||(l.polygonStart(),G=!0),r8(b,uQ,ut,r,l)):ut&&(G||(l.polygonStart(),G=!0),l.lineStart(),r(null,null,1,l),l.lineEnd()),G&&(l.polygonEnd(),G=!1),b=d=null},sphere:function(){l.polygonStart(),l.lineStart(),r(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function se(ut,mt){e(ut,mt)&&l.point(ut,mt)}function he(ut,mt){T.point(ut,mt)}function ve(){te.point=he,T.lineStart()}function Be(){te.point=se,T.lineEnd()}function ze(ut,mt){k.push([ut,mt]),$.point(ut,mt)}function Ue(){$.lineStart(),k=[]}function st(){ze(k[0][0],k[0][1]),$.lineEnd();var ut,mt,pt,Ct,Et=$.clean(),mn=j.result(),An=mn.length;if(k.pop(),d.push(k),k=null,An)if(1&Et){if((mt=(pt=mn[0]).length-1)>0){for(G||(l.polygonStart(),G=!0),l.lineStart(),ut=0;ut<mt;++ut)l.point((Ct=pt[ut])[0],Ct[1]);l.lineEnd()}}else An>1&&2&Et&&mn.push(mn.pop().concat(mn.shift())),b.push(mn.filter(sQ))}return te}};function sQ(e){return e.length>1}function uQ(e,t){return((e=e.x)[0]<0?e[1]-Ec-po:Ec-e[1])-((t=t.x)[0]<0?t[1]-Ec-po:Ec-t[1])}var s8=a8(function(){return!0},function(e){var t,r=NaN,u=NaN,l=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(d,b){var k=d>0?ka:-ka,T=es(d-r);es(T-ka)<po?(e.point(r,u=(u+b)/2>0?Ec:-Ec),e.point(l,u),e.lineEnd(),e.lineStart(),e.point(k,u),e.point(d,u),t=0):l!==k&&T>=ka&&(es(r-l)<po&&(r-=l*po),es(d-k)<po&&(d-=k*po),u=function(j,$,G,te){var se,he,ve=io(j-G);return es(ve)>po?n_((io($)*(he=yo(te))*io(G)-io(te)*(se=yo($))*io(j))/(se*he*ve)):($+te)/2}(r,u,d,b),e.point(l,u),e.lineEnd(),e.lineStart(),e.point(k,u),t=0),e.point(r=d,u=b),l=k},lineEnd:function(){e.lineEnd(),r=u=NaN},clean:function(){return 2-t}}},function(e,t,r,u){var l;if(e==null)l=r*Ec,u.point(-ka,l),u.point(0,l),u.point(ka,l),u.point(ka,0),u.point(ka,-l),u.point(0,-l),u.point(-ka,-l),u.point(-ka,0),u.point(-ka,l);else if(es(e[0]-t[0])>po){var d=e[0]<t[0]?ka:-ka;l=r*d/2,u.point(-d,l),u.point(0,l),u.point(d,l)}else u.point(t[0],t[1])},[-ka,-Ec]),K4=function(e,t){function r(u,l){return u=e(u,l),t(u[0],u[1])}return e.invert&&t.invert&&(r.invert=function(u,l){return(u=t.invert(u,l))&&e.invert(u[0],u[1])}),r};function Y4(e,t){return[es(e)>ka?e+Math.round(-e/Hh)*Hh:e,t]}function u8(e,t,r){return(e%=Hh)?t||r?K4(l8(e),f8(t,r)):l8(e):t||r?f8(t,r):Y4}function c8(e){return function(t,r){return[(t+=e)>ka?t-Hh:t<-ka?t+Hh:t,r]}}function l8(e){var t=c8(e);return t.invert=c8(-e),t}function f8(e,t){var r=yo(e),u=io(e),l=yo(t),d=io(t);function b(k,T){var j=yo(T),$=yo(k)*j,G=io(k)*j,te=io(T),se=te*r+$*u;return[p0(G*l-se*d,$*r-te*u),sm(se*l+G*d)]}return b.invert=function(k,T){var j=yo(T),$=yo(k)*j,G=io(k)*j,te=io(T),se=te*l-G*d;return[p0(G*l+te*d,$*r+se*u),sm(se*r-$*u)]},b}Y4.invert=Y4;var cQ=function(e){function t(r){return(r=e(r[0]*Ea,r[1]*Ea))[0]*=Hc,r[1]*=Hc,r}return e=u8(e[0]*Ea,e[1]*Ea,e.length>2?e[2]*Ea:0),t.invert=function(r){return(r=e.invert(r[0]*Ea,r[1]*Ea))[0]*=Hc,r[1]*=Hc,r},t};function lQ(e,t,r,u,l,d){if(r){var b=yo(t),k=io(t),T=u*r;l==null?(l=t+u*Hh,d=t-T/2):(l=d8(b,l),d=d8(b,d),(u>0?l<d:l>d)&&(l+=u*Hh));for(var j,$=l;u>0?$>d:$<d;$-=T)j=QA([b,-k*yo($),-k*io($)]),e.point(j[0],j[1])}}function d8(e,t){(t=fw(t))[0]-=e,tO(t);var r=Pj(-t[1]);
vendor: 8,783 bytes, line 7830
7830return((-t[2]<0?-r:r)+Hh-po)%Hh}var fQ=function(e){var t=yo(e),r=6*Ea,u=t>0,l=es(t)>po;function d(T,j){return yo(T)*yo(j)>t}function b(T,j,$){var G=[1,0,0],te=o_(fw(T),fw(j)),se=ZA(te,te),he=te[0],ve=se-he*he;if(!ve)return!$&&T;var Be=t*se/ve,ze=-t*he/ve,Ue=o_(G,te),st=eO(G,Be);q4(st,eO(te,ze));var ut=Ue,mt=ZA(st,ut),pt=ZA(ut,ut),Ct=mt*mt-pt*(ZA(st,st)-1);if(!(Ct<0)){var Et=qh(Ct),mn=eO(ut,(-mt-Et)/pt);if(q4(mn,st),mn=QA(mn),!$)return mn;var An,xn=T[0],Wn=j[0],Un=T[1],Kn=j[1];Wn<xn&&(An=xn,xn=Wn,Wn=An);var Qn=Wn-xn,ir=es(Qn-ka)<po;if(!ir&&Kn<Un&&(An=Un,Un=Kn,Kn=An),ir||Qn<po?ir?Un+Kn>0^mn[1]<(es(mn[0]-xn)<po?Un:Kn):Un<=mn[1]&&mn[1]<=Kn:Qn>ka^(xn<=mn[0]&&mn[0]<=Wn)){var Nr=eO(ut,(-mt+Et)/pt);return q4(Nr,st),[mn,QA(Nr)]}}}function k(T,j){var $=u?e:ka-e,G=0;return T<-$?G|=1:T>$&&(G|=2),j<-$?G|=4:j>$&&(G|=8),G}return a8(d,function(T){var j,$,G,te,se;return{lineStart:function(){te=G=!1,se=1},point:function(he,ve){var Be,ze=[he,ve],Ue=d(he,ve),st=u?Ue?0:k(he,ve):Ue?k(he+(he<0?ka:-ka),ve):0;if(!j&&(te=G=Ue)&&T.lineStart(),Ue!==G&&(!(Be=b(j,ze))||XA(j,Be)||XA(ze,Be))&&(ze[2]=1),Ue!==G)se=0,Ue?(T.lineStart(),Be=b(ze,j),T.point(Be[0],Be[1])):(Be=b(j,ze),T.point(Be[0],Be[1],2),T.lineEnd()),j=Be;else if(l&&j&&u^Ue){var ut;st&$||!(ut=b(ze,j,!0))||(se=0,u?(T.lineStart(),T.point(ut[0][0],ut[0][1]),T.point(ut[1][0],ut[1][1]),T.lineEnd()):(T.point(ut[1][0],ut[1][1]),T.lineEnd(),T.lineStart(),T.point(ut[0][0],ut[0][1],3)))}!Ue||j&&XA(j,ze)||T.point(ze[0],ze[1]),j=ze,G=Ue,$=st},lineEnd:function(){G&&T.lineEnd(),j=null},clean:function(){return se|(te&&G)<<1}}},function(T,j,$,G){lQ(G,e,r,$,T,j)},u?[0,-e]:[-ka,e-ka])},dQ=function(e,t,r,u,l,d){var b,k=e[0],T=e[1],j=0,$=1,G=t[0]-k,te=t[1]-T;if(b=r-k,G||!(b>0)){if(b/=G,G<0){if(b<j)return;b<$&&($=b)}else if(G>0){if(b>$)return;b>j&&(j=b)}if(b=l-k,G||!(b<0)){if(b/=G,G<0){if(b>$)return;b>j&&(j=b)}else if(G>0){if(b<j)return;b<$&&($=b)}if(b=u-T,te||!(b>0)){if(b/=te,te<0){if(b<j)return;b<$&&($=b)}else if(te>0){if(b>$)return;b>j&&(j=b)}if(b=d-T,te||!(b<0)){if(b/=te,te<0){if(b>$)return;b>j&&(j=b)}else if(te>0){if(b<j)return;b<$&&($=b)}return j>0&&(e[0]=k+j*G,e[1]=T+j*te),$<1&&(t[0]=k+$*G,t[1]=T+$*te),!0}}}}},dE=1e9,nO=-dE;function h8(e,t,r,u){function l(j,$){return e<=j&&j<=r&&t<=$&&$<=u}function d(j,$,G,te){var se=0,he=0;if(j==null||(se=b(j,G))!==(he=b($,G))||T(j,$)<0^G>0)do te.point(se===0||se===3?e:r,se>1?u:t);while((se=(se+G+4)%4)!==he);else te.point($[0],$[1])}function b(j,$){return es(j[0]-e)<po?$>0?0:3:es(j[0]-r)<po?$>0?2:1:es(j[1]-t)<po?$>0?1:0:$>0?3:2}function k(j,$){return T(j.x,$.x)}function T(j,$){var G=b(j,1),te=b($,1);return G!==te?G-te:G===0?$[1]-j[1]:G===1?j[0]-$[0]:G===2?j[1]-$[1]:$[0]-j[0]}return function(j){var $,G,te,se,he,ve,Be,ze,Ue,st,ut,mt=j,pt=n8(),Ct={point:Et,lineStart:function(){Ct.point=mn,G&&G.push(te=[]),st=!0,Ue=!1,Be=ze=NaN},lineEnd:function(){$&&(mn(se,he),ve&&Ue&&pt.rejoin(),$.push(pt.result())),Ct.point=Et,Ue&&mt.lineEnd()},polygonStart:function(){mt=pt,$=[],G=[],ut=!0},polygonEnd:function(){var An=function(){for(var Un=0,Kn=0,Qn=G.length;Kn<Qn;++Kn)for(var ir,Nr,Jr=G[Kn],Lr=1,hi=Jr.length,Ri=Jr[0],Pi=Ri[0],so=Ri[1];Lr<hi;++Lr)ir=Pi,Nr=so,Ri=Jr[Lr],Pi=Ri[0],so=Ri[1],Nr<=u?so>u&&(Pi-ir)*(u-Nr)>(so-Nr)*(e-ir)&&++Un:so<=u&&(Pi-ir)*(u-Nr)<(so-Nr)*(e-ir)&&--Un;return Un}(),xn=ut&&An,Wn=($=o8($)).length;(xn||Wn)&&(j.polygonStart(),xn&&(j.lineStart(),d(null,null,1,j),j.lineEnd()),Wn&&r8($,k,An,d,j),j.polygonEnd()),mt=j,$=G=te=null}};function Et(An,xn){l(An,xn)&&mt.point(An,xn)}function mn(An,xn){var Wn=l(An,xn);if(G&&te.push([An,xn]),st)se=An,he=xn,ve=Wn,st=!1,Wn&&(mt.lineStart(),mt.point(An,xn));else if(Wn&&Ue)mt.point(An,xn);else{var Un=[Be=Math.max(nO,Math.min(dE,Be)),ze=Math.max(nO,Math.min(dE,ze))],Kn=[An=Math.max(nO,Math.min(dE,An)),xn=Math.max(nO,Math.min(dE,xn))];dQ(Un,Kn,e,t,r,u)?(Ue||(mt.lineStart(),mt.point(Un[0],Un[1])),mt.point(Kn[0],Kn[1]),Wn||mt.lineEnd(),ut=!1):Wn&&(mt.lineStart(),mt.point(An,xn),ut=!1)}Be=An,ze=xn,Ue=Wn}return Ct}}function rO(e){return function(t){var r=new X4;for(var u in e)r[u]=e[u];return r.stream=t,r}}function X4(){}function J4(e,t,r){var u=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),u!=null&&e.clipExtent(null),D1(r,e.stream(qA)),t(qA.result()),u!=null&&e.clipExtent(u),e}function iO(e,t,r){return J4(e,function(u){var l=t[1][0]-t[0][0],d=t[1][1]-t[0][1],b=Math.min(l/(u[1][0]-u[0][0]),d/(u[1][1]-u[0][1])),k=+t[0][0]+(l-b*(u[1][0]+u[0][0]))/2,T=+t[0][1]+(d-b*(u[1][1]+u[0][1]))/2;e.scale(150*b).translate([k,T])},r)}function Q4(e,t,r){return iO(e,[[0,0],t],r)}function Z4(e,t,r){return J4(e,function(u){var l=+t,d=l/(u[1][0]-u[0][0]),b=(l-d*(u[1][0]+u[0][0]))/2,k=-d*u[0][1];e.scale(150*d).translate([b,k])},r)}function eI(e,t,r){return J4(e,function(u){var l=+t,d=l/(u[1][1]-u[0][1]),b=-d*u[0][0],k=(l-d*(u[1][1]+u[0][1]))/2;e.scale(150*d).translate([b,k])},r)}X4.prototype={constructor:X4,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var p8=16,hQ=yo(30*Ea),m8=function(e,t){return+t?function(r,u){function l(d,b,k,T,j,$,G,te,se,he,ve,Be,ze,Ue){var st=G-d,ut=te-b,mt=st*st+ut*ut;if(mt>4*u&&ze--){var pt=T+he,Ct=j+ve,Et=$+Be,mn=qh(pt*pt+Ct*Ct+Et*Et),An=sm(Et/=mn),xn=es(es(Et)-1)<po||es(k-se)<po?(k+se)/2:p0(Ct,pt),Wn=r(xn,An),Un=Wn[0],Kn=Wn[1],Qn=Un-d,ir=Kn-b,Nr=ut*Qn-st*ir;(Nr*Nr/mt>u||es((st*Qn+ut*ir)/mt-.5)>.3||T*he+j*ve+$*Be<hQ)&&(l(d,b,k,T,j,$,Un,Kn,xn,pt/=mn,Ct/=mn,Et,ze,Ue),Ue.point(Un,Kn),l(Un,Kn,xn,pt,Ct,Et,G,te,se,he,ve,Be,ze,Ue))}}return function(d){var b,k,T,j,$,G,te,se,he,ve,Be,ze,Ue={point:st,lineStart:ut,lineEnd:pt,polygonStart:function(){d.polygonStart(),Ue.lineStart=Ct},polygonEnd:function(){d.polygonEnd(),Ue.lineStart=ut}};function st(An,xn){An=r(An,xn),d.point(An[0],An[1])}function ut(){se=NaN,Ue.point=mt,d.lineStart()}function mt(An,xn){var Wn=fw([An,xn]),Un=r(An,xn);l(se,he,te,ve,Be,ze,se=Un[0],he=Un[1],te=An,ve=Wn[0],Be=Wn[1],ze=Wn[2],p8,d),d.point(se,he)}function pt(){Ue.point=st,d.lineEnd()}function Ct(){ut(),Ue.point=Et,Ue.lineEnd=mn}function Et(An,xn){mt(b=An,xn),k=se,T=he,j=ve,$=Be,G=ze,Ue.point=mt}function mn(){l(se,he,te,ve,Be,ze,k,T,b,j,$,G,p8,d),Ue.lineEnd=pt,pt()}return Ue}}(e,t):function(r){return rO({point:function(u,l){u=r(u,l),this.stream.point(u[0],u[1])}})}(e)},pQ=rO({point:function(e,t){this.stream.point(e*Ea,t*Ea)}});function g8(e,t,r,u,l,d){if(!d)return function(ve,Be,ze,Ue,st){function ut(mt,pt){return[Be+ve*(mt*=Ue),ze-ve*(pt*=st)]}return ut.invert=function(mt,pt){return[(mt-Be)/ve*Ue,(ze-pt)/ve*st]},ut}(e,t,r,u,l);var b=yo(d),k=io(d),T=b*e,j=k*e,$=b/e,G=k/e,te=(k*r-b*t)/e,se=(k*t+b*r)/e;function he(ve,Be){return[T*(ve*=u)-j*(Be*=l)+t,r-j*ve-T*Be]}return he.invert=function(ve,Be){return[u*($*ve-G*Be+te),l*(se-G*ve-$*Be)]},he}function Fy(e){return v8(function(){return e})()}function v8(e){var t,r,u,l,d,b,k,T,j,$,G=150,te=480,se=250,he=0,ve=0,Be=0,ze=0,Ue=0,st=0,ut=1,mt=1,pt=null,Ct=s8,Et=null,mn=aE,An=.5;function xn(Qn){return T(Qn[0]*Ea,Qn[1]*Ea)}function Wn(Qn){return(Qn=T.invert(Qn[0],Qn[1]))&&[Qn[0]*Hc,Qn[1]*Hc]}function Un(){var Qn=g8(G,0,0,ut,mt,st).apply(null,t(he,ve)),ir=g8(G,te-Qn[0],se-Qn[1],ut,mt,st);return r=u8(Be,ze,Ue),k=K4(t,ir),T=K4(r,k),b=m8(k,An),Kn()}function Kn(){return j=$=null,xn}return xn.stream=function(Qn){return j&&$===Qn?j:j=pQ(function(ir){return rO({point:function(Nr,Jr){var Lr=ir(Nr,Jr);return this.stream.point(Lr[0],Lr[1])}})}(r)(Ct(b(mn($=Qn)))))},xn.preclip=function(Qn){return arguments.length?(Ct=Qn,pt=void 0,Kn()):Ct},xn.postclip=function(Qn){return arguments.length?(mn=Qn,Et=u=l=d=null,Kn()):mn},xn.clipAngle=function(Qn){return arguments.length?(Ct=+Qn?fQ(pt=Qn*Ea):(pt=null,s8),Kn()):pt*Hc},xn.clipExtent=function(Qn){return arguments.length?(mn=Qn==null?(Et=u=l=d=null,aE):h8(Et=+Qn[0][0],u=+Qn[0][1],l=+Qn[1][0],d=+Qn[1][1]),Kn()):Et==null?null:[[Et,u],[l,d]]},xn.scale=function(Qn){return arguments.length?(G=+Qn,Un()):G},xn.translate=function(Qn){return arguments.length?(te=+Qn[0],se=+Qn[1],Un()):[te,se]},xn.center=function(Qn){return arguments.length?(he=Qn[0]%360*Ea,ve=Qn[1]%360*Ea,Un()):[he*Hc,ve*Hc]},xn.rotate=function(Qn){return arguments.length?(Be=Qn[0]%360*Ea,ze=Qn[1]%360*Ea,Ue=Qn.length>2?Qn[2]%360*Ea:0,Un()):[Be*Hc,ze*Hc,Ue*Hc]},xn.angle=function(Qn){return arguments.length?(st=Qn%360*Ea,Un()):st*Hc},xn.reflectX=function(Qn){return arguments.length?(ut=Qn?-1:1,Un()):ut<0},xn.reflectY=function(Qn){return arguments.length?(mt=Qn?-1:1,Un()):mt<0},xn.precision=function(Qn){return arguments.length?(b=m8(k,An=Qn*Qn),Kn()):qh(An)},xn.fitExtent=function(Qn,ir){return iO(xn,Qn,ir)},xn.fitSize=function(Qn,ir){return Q4(xn,Qn,ir)}
vendor: 4,588 bytes, line 7830
7830,xn.fitWidth=function(Qn,ir){return Z4(xn,Qn,ir)},xn.fitHeight=function(Qn,ir){return eI(xn,Qn,ir)},function(){return t=e.apply(this,arguments),xn.invert=t.invert&&Wn,Un()}}function tI(e){var t=0,r=ka/3,u=v8(e),l=u(t,r);return l.parallels=function(d){return arguments.length?u(t=d[0]*Ea,r=d[1]*Ea):[t*Hc,r*Hc]},l}function mQ(e,t){var r=io(e),u=(r+io(t))/2;if(es(u)<po)return function(k){var T=yo(k);function j($,G){return[$*T,io(G)/T]}return j.invert=function($,G){return[$/T,sm(G*T)]},j}(e);var l=1+r*(2*u-r),d=qh(l)/u;function b(k,T){var j=qh(l-2*u*io(T))/u;return[j*io(k*=u),d-j*yo(k)]}return b.invert=function(k,T){var j=d-T,$=p0(k,es(j))*m0(j);return j*u<0&&($-=ka*m0(k)*m0(j)),[$/u,sm((l-(k*k+j*j)*u*u)/(2*u))]},b}var oO=function(){return tI(mQ).scale(155.424).center([0,33.6442])},y8=function(){return oO().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])};function b8(e){return function(t,r){var u=yo(t),l=yo(r),d=e(u*l);return d===1/0?[2,0]:[d*l*io(t),d*io(r)]}}function hE(e){return function(t,r){var u=qh(t*t+r*r),l=e(u),d=io(l),b=yo(l);return[p0(t*d,u*b),sm(u&&r*d/u)]}}var x8=b8(function(e){return qh(2/(1+e))});x8.invert=hE(function(e){return 2*sm(e/2)});var w8=b8(function(e){return(e=Pj(e))&&e/io(e)});w8.invert=hE(function(e){return e});function aO(e,t){return[e,VA(R4((Ec+t)/2))]}aO.invert=function(e,t){return[e,2*n_(Bj(t))-Ec]};function _8(e){var t,r,u,l=Fy(e),d=l.center,b=l.scale,k=l.translate,T=l.clipExtent,j=null;function $(){var G=ka*b(),te=l(cQ(l.rotate()).invert([0,0]));return T(j==null?[[te[0]-G,te[1]-G],[te[0]+G,te[1]+G]]:e===aO?[[Math.max(te[0]-G,j),t],[Math.min(te[0]+G,r),u]]:[[j,Math.max(te[1]-G,t)],[r,Math.min(te[1]+G,u)]])}return l.scale=function(G){return arguments.length?(b(G),$()):b()},l.translate=function(G){return arguments.length?(k(G),$()):k()},l.center=function(G){return arguments.length?(d(G),$()):d()},l.clipExtent=function(G){return arguments.length?(G==null?j=t=r=u=null:(j=+G[0][0],t=+G[0][1],r=+G[1][0],u=+G[1][1]),$()):j==null?null:[[j,t],[r,u]]},$()}function sO(e){return R4((Ec+e)/2)}function gQ(e,t){var r=yo(e),u=e===t?io(e):VA(r/yo(t))/VA(sO(t)/sO(e)),l=r*F4(sO(e),u)/u;if(!u)return aO;function d(b,k){l>0?k<-Ec+po&&(k=-Ec+po):k>Ec-po&&(k=Ec-po);var T=l/F4(sO(k),u);return[T*io(u*b),l-T*yo(u*b)]}return d.invert=function(b,k){var T=l-k,j=m0(u)*qh(b*b+T*T),$=p0(b,es(T))*m0(T);return T*u<0&&($-=ka*m0(b)*m0(T)),[$/u,2*n_(F4(l/j,1/u))-Ec]},d}function uO(e,t){return[e,t]}uO.invert=uO;function vQ(e,t){var r=yo(e),u=e===t?io(e):(r-yo(t))/(t-e),l=r/u+e;if(es(u)<po)return uO;function d(b,k){var T=l-k,j=u*b;return[T*io(j),l-T*yo(j)]}return d.invert=function(b,k){var T=l-k,j=p0(b,es(T))*m0(T);return T*u<0&&(j-=ka*m0(b)*m0(T)),[j/u,l-m0(u)*qh(b*b+T*T)]},d}var pE=1.340264,mE=-.081106,gE=893e-6,vE=.003796,cO=qh(3)/2;function k8(e,t){var r=sm(cO*io(t)),u=r*r,l=u*u*u;return[e*yo(r)/(cO*(pE+3*mE*u+l*(7*gE+9*vE*u))),r*(pE+mE*u+l*(gE+vE*u))]}k8.invert=function(e,t){for(var r,u=t,l=u*u,d=l*l*l,b=0;b<12&&(d=(l=(u-=r=(u*(pE+mE*l+d*(gE+vE*l))-t)/(pE+3*mE*l+d*(7*gE+9*vE*l)))*u)*l*l,!(es(r)<1e-12));++b);return[cO*e*(pE+3*mE*l+d*(7*gE+9*vE*l))/yo(u),sm(io(u)/cO)]};function E8(e,t){var r=yo(t),u=yo(e)*r;return[r*io(e)/u,io(t)/u]}E8.invert=hE(n_);function C8(e,t){var r=t*t,u=r*r;return[e*(.8707-.131979*r+u*(u*(.003971*r-.001529*u)-.013791)),t*(1.007226+r*(.015085+u*(.028874*r-.044475-.005916*u)))]}C8.invert=function(e,t){var r,u=t,l=25;do{var d=u*u,b=d*d;u-=r=(u*(1.007226+d*(.015085+b*(.028874*d-.044475-.005916*b)))-t)/(1.007226+d*(.045255+b*(.259866*d-.311325-.005916*11*b)))}while(es(r)>po&&--l>0);return[e/(.8707+(d=u*u)*(d*(d*d*d*(.003971-.001529*d)-.013791)-.131979)),u]};function S8(e,t){return[yo(t)*io(e),io(t)]}S8.invert=hE(sm);function A8(e,t){var r=yo(t),u=1+yo(e)*r;return[r*io(e)/u,io(t)/u]}A8.invert=hE(function(e){return 2*n_(e)});function O8(e,t){return[VA(R4((Ec+t)/2)),-e]}O8.invert=function(e,t){return[-t,2*n_(Bj(e))-Ec]};var yQ=Math.abs,nI=Math.cos,lO=Math.sin,bQ=1e-6,D8=Math.PI,rI=D8/2,T8=xQ(2);function N8(e){return e>1?rI:e<-1?-rI:Math.asin(e)}function xQ(e){return e>0?Math.sqrt(e):0}var wQ=function(e,t,r){function u(l,d){return[e*l*nI(d=function(b,k){var T,j=b*lO(k),$=30;do k-=T=(k+lO(k)-j)/(1+nI(k));while(yQ(T)>bQ&&--$>0);return k/2}(r,d)),t*lO(d)]}return u.invert=function(l,d){return d=N8(d/t),[l/(e*nI(d)),N8((2*d+lO(2*d))/r)]},u}(T8/rI,T8,D8);const _Q=t8(),iI=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","t
7830ilt"];function oI(e,t){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(fO[e]=function(r,u){return function l(){const d=u();return d.type=r,d.path=t8().projection(d),d.copy=d.copy||function(){const b=l();return iI.forEach(k=>{d[k]&&b[k](d[k]())}),b.path.pointRadius(d.path.pointRadius()),b},d}}(e,t),this):fO[e]||null}function I8(e){return e&&e.path||_Q}const fO={albers:y8,albersusa:function(){var e,t,r,u,l,d,b=y8(),k=oO().rotate([154,0]).center([-2,58.5]).parallels([55,65]),T=oO().rotate([157,0]).center([-3,19.9]).parallels([8,18]),j={point:function(te,se){d=[te,se]}};function $(te){var se=te[0],he=te[1];return d=null,r.point(se,he),d||(u.point(se,he),d)||(l.point(se,he),d)}function G(){return e=t=null,$}return $.invert=function(te){var se=b.scale(),he=b.translate(),ve=(te[0]-he[0])/se,Be=(te[1]-he[1])/se;return(Be>=.12&&Be<.234&&ve>=-.425&&ve<-.214?k:Be>=.166&&Be<.234&&ve>=-.214&&ve<-.115?T:b).invert(te)},$.stream=function(te){return e&&t===te?e:e=function(se){var he=se.length;return{point:function(ve,Be){for(var ze=-1;++ze<he;)se[ze].point(ve,Be)},sphere:function(){for(var ve=-1;++ve<he;)se[ve].sphere()},lineStart:function(){for(var ve=-1;++ve<he;)se[ve].lineStart()},lineEnd:function(){for(var ve=-1;++ve<he;)se[ve].lineEnd()},polygonStart:function(){for(var ve=-1;++ve<he;)se[ve].polygonStart()},polygonEnd:function(){for(var ve=-1;++ve<he;)se[ve].polygonEnd()}}}([b.stream(t=te),k.stream(te),T.stream(te)])},$.precision=function(te){return arguments.length?(b.precision(te),k.precision(te),T.precision(te),G()):b.precision()},$.scale=function(te){return arguments.length?(b.scale(te),k.scale(.35*te),T.scale(te),$.translate(b.translate())):b.scale()},$.translate=function(te){if(!arguments.length)return b.translate();var se=b.scale(),he=+te[0],ve=+te[1];return r=b.translate(te).clipExtent([[he-.455*se,ve-.238*se],[he+.455*se,ve+.238*se]]).stream(j),u=k.translate([he-.307*se,ve+.201*se]).clipExtent([[he-.425*se+po,ve+.12*se+po],[he-.214*se-po,ve+.234*se-po]]).stream(j),l=T.translate([he-.205*se,ve+.212*se]).clipExtent([[he-.214*se+po,ve+.166*se+po],[he-.115*se-po,ve+.234*se-po]]).stream(j),G()},$.fitExtent=function(te,se){return iO($,te,se)},$.fitSize=function(te,se){return Q4($,te,se)},$.fitWidth=function(te,se){return Z4($,te,se)},$.fitHeight=function(te,se){return eI($,te,se)},$.scale(1070)},azimuthalequalarea:function(){return Fy(x8).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return Fy(w8).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return tI(gQ).scale(109.5).parallels([30,30])},conicequalarea:oO,conicequidistant:function(){return tI(vQ).scale(131.154).center([0,13.9389])},equalEarth:function(){return Fy(k8).scale(177.158)},equirectangular:function(){return Fy(uO).scale(152.63)},gnomonic:function(){return Fy(E8).scale(144.049).clipAngle(60)},identity:function(){var e,t,r,u,l,d,b,k=1,T=0,j=0,$=1,G=1,te=0,se=null,he=1,ve=1,Be=rO({point:function(ut,mt){var pt=st([ut,mt]);this.stream.point(pt[0],pt[1])}}),ze=aE;function Ue(){return he=k*$,ve=k*G,d=b=null,st}function st(ut){var mt=ut[0]*he,pt=ut[1]*ve;if(te){var Ct=pt*e-mt*t;mt=mt*e+pt*t,pt=Ct}return[mt+T,pt+j]}return st.invert=function(ut){var mt=ut[0]-T,pt=ut[1]-j;if(te){var Ct=pt*e+mt*t;mt=mt*e-pt*t,pt=Ct}return[mt/he,pt/ve]},st.stream=function(ut){return d&&b===ut?d:d=Be(ze(b=ut))},st.postclip=function(ut){return arguments.length?(ze=ut,se=r=u=l=null,Ue()):ze},st.clipExtent=function(ut){return arguments.length?(ze=ut==null?(se=r=u=l=null,aE):h8(se=+ut[0][0],r=+ut[0][1],u=+ut[1][0],l=+ut[1][1]),Ue()):se==null?null:[[se,r],[u,l]]},st.scale=function(ut){return arguments.length?(k=+ut,Ue()):k},st.translate=function(ut){return arguments.length?(T=+ut[0],j=+ut[1],Ue()):[T,j]},st.angle=function(ut){return arguments.length?(t=io(te=ut%360*Ea),e=yo(te),Ue()):te*Hc},st.reflectX=function(ut){return arguments.length?($=ut?-1:1,Ue()):$<0},st.reflectY=function(ut){return arguments.length?(G=ut?-1:1,Ue()):G<0},st.fitExtent=function(ut,mt){return iO(st,ut,mt)},st.fitSize=function(ut,mt){return Q4(st,ut,mt)}
vendor: 3,035 bytes, line 7830
7830,st.fitWidth=function(ut,mt){return Z4(st,ut,mt)},st.fitHeight=function(ut,mt){return eI(st,ut,mt)},st},mercator:function(){return _8(aO).scale(961/Hh)},mollweide:function(){return Fy(wQ).scale(169.529)},naturalEarth1:function(){return Fy(C8).scale(175.295)},orthographic:function(){return Fy(S8).scale(249.5).clipAngle(90+po)},stereographic:function(){return Fy(A8).scale(250).clipAngle(142)},transversemercator:function(){var e=_8(O8),t=e.center,r=e.rotate;return e.center=function(u){return arguments.length?t([-u[1],u[0]]):[(u=t())[1],-u[0]]},e.rotate=function(u){return arguments.length?r([u[0],u[1],u.length>2?u[2]+90:90]):[(u=r())[0],u[1],u[2]-90]},r([0,0,90]).scale(159.155)}};for(const e in fO)oI(e,fO[e]);function M8(e,t,r){var u=vu(e,t-po,r).concat(t);return function(l){return u.map(function(d){return[l,d]})}}function F8(e,t,r){var u=vu(e,t-po,r).concat(t);return function(l){return u.map(function(d){return[d,l]})}}function kQ(){var e,t,r,u,l,d,b,k,T,j,$,G,te=10,se=te,he=90,ve=360,Be=2.5;function ze(){return{type:"MultiLineString",coordinates:Ue()}}function Ue(){return vu(WA(u/he)*he,r,he).map($).concat(vu(WA(k/ve)*ve,b,ve).map(G)).concat(vu(WA(t/te)*te,e,te).filter(function(st){return es(st%he)>po}).map(T)).concat(vu(WA(d/se)*se,l,se).filter(function(st){return es(st%ve)>po}).map(j))}return ze.lines=function(){return Ue().map(function(st){return{type:"LineString",coordinates:st}})},ze.outline=function(){return{type:"Polygon",coordinates:[$(u).concat(G(b).slice(1),$(r).reverse().slice(1),G(k).reverse().slice(1))]}},ze.extent=function(st){return arguments.length?ze.extentMajor(st).extentMinor(st):ze.extentMinor()},ze.extentMajor=function(st){return arguments.length?(u=+st[0][0],r=+st[1][0],k=+st[0][1],b=+st[1][1],u>r&&(st=u,u=r,r=st),k>b&&(st=k,k=b,b=st),ze.precision(Be)):[[u,k],[r,b]]},ze.extentMinor=function(st){return arguments.length?(t=+st[0][0],e=+st[1][0],d=+st[0][1],l=+st[1][1],t>e&&(st=t,t=e,e=st),d>l&&(st=d,d=l,l=st),ze.precision(Be)):[[t,d],[e,l]]},ze.step=function(st){return arguments.length?ze.stepMajor(st).stepMinor(st):ze.stepMinor()},ze.stepMajor=function(st){return arguments.length?(he=+st[0],ve=+st[1],ze):[he,ve]},ze.stepMinor=function(st){return arguments.length?(te=+st[0],se=+st[1],ze):[te,se]},ze.precision=function(st){return arguments.length?(Be=+st,T=M8(d,l,90),j=F8(t,e,Be),$=M8(k,b,90),G=F8(u,r,Be),ze):Be},ze.extentMajor([[-180,-90+po],[180,90-po]]).extentMinor([[-180,-80-po],[180,80+po]])}function EQ(){}const T1=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function R8(){var e=1,t=1,r=b;function u(k,T){return T.map(j=>l(k,j))}function l(k,T){var j=[],$=[];return function(G,te,se){var he,ve,Be,ze,Ue,st,ut=new Array,mt=new Array;for(he=ve=-1,ze=G[0]>=te,T1[ze<<1].forEach(pt);++he<e-1;)Be=ze,ze=G[he+1]>
vendor: 5,599 bytes, line 7830
7830=te,T1[Be|ze<<1].forEach(pt);for(T1[ze<<0].forEach(pt);++ve<t-1;){for(he=-1,ze=G[ve*e+e]>=te,Ue=G[ve*e]>=te,T1[ze<<1|Ue<<2].forEach(pt);++he<e-1;)Be=ze,ze=G[ve*e+e+he+1]>=te,st=Ue,Ue=G[ve*e+he+1]>=te,T1[Be|ze<<1|Ue<<2|st<<3].forEach(pt);T1[ze|Ue<<3].forEach(pt)}for(he=-1,Ue=G[ve*e]>=te,T1[Ue<<2].forEach(pt);++he<e-1;)st=Ue,Ue=G[ve*e+he+1]>=te,T1[Ue<<2|st<<3].forEach(pt);function pt(Ct){var Et,mn,An=[Ct[0][0]+he,Ct[0][1]+ve],xn=[Ct[1][0]+he,Ct[1][1]+ve],Wn=d(An),Un=d(xn);(Et=mt[Wn])?(mn=ut[Un])?(delete mt[Et.end],delete ut[mn.start],Et===mn?(Et.ring.push(xn),se(Et.ring)):ut[Et.start]=mt[mn.end]={start:Et.start,end:mn.end,ring:Et.ring.concat(mn.ring)}):(delete mt[Et.end],Et.ring.push(xn),mt[Et.end=Un]=Et):(Et=ut[Un])?(mn=mt[Wn])?(delete ut[Et.start],delete mt[mn.end],Et===mn?(Et.ring.push(xn),se(Et.ring)):ut[mn.start]=mt[Et.end]={start:mn.start,end:Et.end,ring:mn.ring.concat(Et.ring)}):(delete ut[Et.start],Et.ring.unshift(An),ut[Et.start=Wn]=Et):ut[Wn]=mt[Un]={start:Wn,end:Un,ring:[An,xn]}}T1[Ue<<3].forEach(pt)}(k,T,G=>{r(G,k,T),function(te){for(var se=0,he=te.length,ve=te[he-1][1]*te[0][0]-te[he-1][0]*te[0][1];++se<he;)ve+=te[se-1][1]*te[se][0]-te[se-1][0]*te[se][1];return ve}(G)>0?j.push([G]):$.push(G)}),$.forEach(G=>{for(var te,se=0,he=j.length;se<he;++se)if(CQ((te=j[se])[0],G)!==-1)return void te.push(G)}),{type:"MultiPolygon",value:T,coordinates:j}}function d(k){return 2*k[0]+k[1]*(e+1)*4}function b(k,T,j){k.forEach($=>{var G,te=$[0],se=$[1],he=0|te,ve=0|se,Be=T[ve*e+he];te>0&&te<e&&he===te&&(G=T[ve*e+he-1],$[0]=te+(j-G)/(Be-G)-.5),se>0&&se<t&&ve===se&&(G=T[(ve-1)*e+he],$[1]=se+(j-G)/(Be-G)-.5)})}return u.contour=l,u.size=function(k){if(!arguments.length)return[e,t];var T=Math.floor(k[0]),j=Math.floor(k[1]);return T>=0&&j>=0||Object(xe.o)("invalid size"),e=T,t=j,u},u.smooth=function(k){return arguments.length?(r=k?b:EQ,u):r===b},u}function CQ(e,t){for(var r,u=-1,l=t.length;++u<l;)if(r=SQ(e,t[u]))return r;return 0}function SQ(e,t){for(var r=t[0],u=t[1],l=-1,d=0,b=e.length,k=b-1;d<b;k=d++){var T=e[d],j=T[0],$=T[1],G=e[k],te=G[0],se=G[1];if(AQ(T,G,t))return 0;$>u!=se>u&&r<(te-j)*(u-$)/(se-$)+j&&(l=-l)}return l}function AQ(e,t,r){var u;return function(l,d,b){return(d[0]-l[0])*(b[1]-l[1])==(b[0]-l[0])*(d[1]-l[1])}(e,t,r)&&function(l,d,b){return l<=d&&d<=b||b<=d&&d<=l}(e[u=+(e[0]===t[0])],r[u],t[u])}function B8(e,t,r){return function(u){var l=Object(xe.q)(u),d=r?Math.min(l[0],0):l[0],b=l[1],k=b-d,T=t?Object(Rc.c)(d,b,e):k/(e+1);return vu(d+T,b,T)}}function aI(e){Wt.call(this,null,e)}function P8(e,t,r,u,l){const d=e.x1||0,b=e.y1||0,k=t*r<0;function T(G){G.forEach(j)}function j(G){k&&G.reverse(),G.forEach($)}function $(G){G[0]=(G[0]-d)*t+u,G[1]=(G[1]-b)*r+l}return function(G){return G.coordinates.forEach(T),G}}function j8(e,t,r){const u=e>=0?e:ai(t,r);return Math.round((Math.sqrt(4*u*u+1)-1)/2)}function sI(e){return Object(xe.E)(e)?e:Object(xe.m)(+e)}function L8(){var e=T=>T[0],t=T=>T[1],r=xe.Q,u=[-1,-1],l=960,d=500,b=2;function k(T,j){const $=j8(u[0],T,e)>>b,G=j8(u[1],T,t)>>b,te=$?$+2:0,se=G?G+2:0,he=2*te+(l>>b),ve=2*se+(d>>b),Be=new Float32Array(he*ve),ze=new Float32Array(he*ve);let Ue=Be;T.forEach(ut=>{const mt=te+(+e(ut)>>b),pt=se+(+t(ut)>>b);mt>=0&&mt<he&&pt>=0&&pt<ve&&(Be[mt+pt*he]+=+r(ut))}),$>0&&G>0?(a_(he,ve,Be,ze,$),s_(he,ve,ze,Be,G),a_(he,ve,Be,ze,$),s_(he,ve,ze,Be,G),a_(he,ve,Be,ze,$),s_(he,ve,ze,Be,G)):$>0?(a_(he,ve,Be,ze,$),a_(he,ve,ze,Be,$),a_(he,ve,Be,ze,$),Ue=ze):G>0&&(s_(he,ve,Be,ze,G),s_(he,ve,ze,Be,G),s_(he,ve,Be,ze,G),Ue=ze);const st=j?Math.pow(2,-2*b):1/yj(Ue);for(let ut=0,mt=he*ve;ut<mt;++ut)Ue[ut]*=st;return{values:Ue,scale:1<<b,width:he,height:ve,x1:te,y1:se,x2:te+(l>>b),y2:se+(d>>b)}}return k.x=function(T){return arguments.length?(e=sI(T),k):e},k.y=function(T){return arguments.length?(t=sI(T),k):t},k.weight=function(T){return arguments.length?(r=sI(T),k):r},k.size=function(T){if(!arguments.length)return[l,d];var j=+T[0],$=+T[1];return j>=0&&$>=0||Object(xe.o)("invalid size"),l=j,d=$,k},k.cellSize=function(T){return arguments.length?((T=+T)>=1||Object(xe.o)("invalid cell size"),b=Math.floor(Math.log(T)/Math.LN2),k):1<<b},k.bandwidth=function(T){return arguments.length?((T=Object(xe.i)(T)).length===1&&(T=[+T[0],+T[0]]),T.length!==2&&Object(xe.o)("invalid bandwidth"),u=T,k):u},k}function a_(e,t,r,u,l){const d=1+(l<<1);for(let b=0;b<t;++b)for(let k=0,T=0;k<e+l;++k)k<e&&(T+=r[k+b*e]),k>=l&&(k>=d&&(T-=r[k-d+b*e]),u[k-l+b*e]=T/Math.min(k+1,e-1+d-k,d))}function s_(e,t,r,u,l){const d=1+(l<<1);for(let b=0;b<e;++b)for(let k=0,T=0;k<t+l;++k)k<t&&(T+=r[b+k*e]),k>=l&&(k>=d&&(T-=r[b+(k-d)*e]),u[b+(k-l)*e]=T/Math.min(k+1,t-1+d-k,d))}function uI(e){Wt.call(this,null,e)}aI.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},Object(xe.z)(aI,Wt,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var r=t.fork(t.NO_SOURCE|t.NO_FIELDS),u=t.materialize(t.SOURCE).source,l=e.field||xe.y,d=R8().smooth(e.smooth!==!1),b=e.thresholds||function(j,$,G){const te=B8(G.levels||10,G.nice,G.zero!==!1);return G.resolve!=="shared"?te:te(j.map(se=>er($(se).values)))}(u,l,e),k=e.as===null?null:e.as||"contour",T=[];return u.forEach(j=>
7830{const $=l(j),G=d.size([$.width,$.height])($.values,Object(xe.B)(b)?b:b($.values));(function(te,se,he,ve){let Be=ve.scale||se.scale,ze=ve.translate||se.translate;if(Object(xe.E)(Be)&&(Be=Be(he,ve)),Object(xe.E)(ze)&&(ze=ze(he,ve)),(Be===1||Be==null)&&!ze)return;const Ue=(Object(xe.G)(Be)?Be:Be[0])||1,st=(Object(xe.G)(Be)?Be:Be[1])||1,ut=ze&&ze[0]||0,mt=ze&&ze[1]||0;te.forEach(P8(se,Ue,st,ut,mt))})(G,$,j,e),G.forEach(te=>{T.push(Dr(j,Fn(k!=null?{[k]:te}:te)))})}),this.value&&(r.rem=this.value),this.value=r.source=r.add=T,r}}),uI.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const OQ=["x","y","weight","size","cellSize","bandwidth"];function z8(e,t){return OQ.forEach(r=>t[r]!=null?e[r](t[r]):0),e}function cI(e){Wt.call(this,null,e)}Object(xe.z)(uI,Wt,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var r,u=t.fork(t.NO_SOURCE|t.NO_FIELDS),l=function(T,j){var $,G,te,se,he,ve,Be=[],ze=Ue=>Ue(se);if(j==null)Be.push(T);else for($={},G=0,te=T.length;G<te;++G)se=T[G],he=j.map(ze),(ve=$[he])||($[he]=ve=[],ve.dims=he,Be.push(ve)),ve.push(se);return Be}(t.materialize(t.SOURCE).source,e.groupby),d=(e.groupby||[]).map(xe.h),b=z8(L8(),e),k=e.as||"grid";return r=l.map(T=>Fn(function(j,$){for(let G=0;G<d.length;++G)j[d[G]]=$[G];return j}({[k]:b(T,e.counts)},T.dims))),this.value&&(u.rem=this.value),this.value=u.source=u.add=r,u}}),cI.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},Object(xe.z)(cI,Wt,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var r,u,l=t.fork(t.NO_SOURCE|t.NO_FIELDS),d=R8().smooth(e.smooth!==!1),b=e.values,k=e.thresholds||B8(e.count||10,e.nice,!!b),T=e.size;return b||(b=t.materialize(t.SOURCE).source,u=P8(r=z8(L8(),e)(b,!0),r.scale||1,r.scale||1,0,0),T=[r.width,r.height],b=r.values),k=Object(xe.B)(k)?k:k(b),b=d.size(T)(b,k),u&&b.forEach(u),this.value&&(l.rem=this.value),this.value=l.source=l.add=(b||[]).map(Fn),l}});const lI="Feature",fI="FeatureCollection";function dI(e){Wt.call(this,null,e)}function hI(e){Wt.call(this,null,e)}function pI(e){Wt.call(this,null,e)}function mI(e){Wt.call(this,null,e)}function gI(e){Wt.call(this,[],e),this.generator=kQ()}function vI(e){Wt.call(this,null,e)}function U8(e){if(!Object(xe.E)(e))return!1;const t=Object(xe.Fa)(Object(xe.g)(e));return t.$x||t.$y||t.$value||t.$max}function W8(e){Wt.call(this,null,e),this.modified(!0)}function V8(e,t,r){Object(xe.E)(e[t])&&e[t](r)}dI.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},Object(xe.z)(dI,Wt,{transform(e,t){var r,u=this._features,l=this._points,d=e.fields,b=d&&d[0],k=d&&d[1],T=e.geojson||!d&&xe.y,j=t.ADD;r=e.modified()||t.changed(t.REM)||t.modified(Object(xe.g)(T))||b&&t.modified(Object(xe.g)(b))||k&&t.modified(Object(xe.g)(k)),this.value&&!r||(j=t.SOURCE,this._features=u=[],this._points=l=[]),T&&t.visit(j,$=>u.push(T($))),b&&k&&(t.visit(j,$=>{var G=b($),te=k($);G!=null&&te!=null&&(G=+G)===G&&(te=+te)===te&&l.push([G,te])}),u=u.concat({type:lI,geometry:{type:"MultiPoint",coordinates:l}})),this.value={type:fI,features:u}}}),hI.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},Object(xe.z)(hI,Wt,{transform(e,t){var r=t.fork(t.ALL),u=this.value,l=e.field||xe.y,d=e.as||"path",b=r.SOURCE;!u||e.modified()?(this.value=u=I8(e.projection),r.materialize().reflow()):b=l===xe.y||t.modified(l.fields)?r.ADD_MOD:r.ADD;const k=function(T,j){const $=T.pointRadius();return T.context(null),j!=null&&T.pointRadius(j),$}(u,e.pointRadius);return r.visit(b,T=>T[d]=u(l(T))),u.pointRadius(k),r.modifies(d)}}),pI.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},Object(xe.z)(pI,Wt,{transform(e,t){var r,u=e.projection,l=e.fields[0],d=e.fields[1],b=e.as||["x","y"],k=b[0],T=b[1];function j($){const G=u([l($),d($)]);G?($[k]=G[0],$[T]=G[1]):($[k]=void 0,$[T]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,j):(r=t.modified(l.fields)||t.modified(d.fields),t.visit(r?t.ADD_MOD:t.ADD,j)
7830),t.modifies(b)}}),mI.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},Object(xe.z)(mI,Wt,{transform(e,t){var r=t.fork(t.ALL),u=this.value,l=e.as||"shape",d=r.ADD;return u&&!e.modified()||(this.value=u=function(b,k,T){const j=T==null?$=>b(k($)):$=>{var G=b.pointRadius(),te=b.pointRadius(T)(k($));return b.pointRadius(G),te};return j.context=$=>(b.context($),j),j}(I8(e.projection),e.field||Object(xe.u)("datum"),e.pointRadius),r.materialize().reflow(),d=r.SOURCE),r.visit(d,b=>b[l]=u),r.modifies(l)}}),gI.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},Object(xe.z)(gI,Wt,{transform(e,t){var r,u=this.value,l=this.generator;if(!u.length||e.modified())for(const d in e)Object(xe.E)(l[d])&&l[d](e[d]);return r=l(),u.length?t.mod.push(xr(u[0],r)):t.add.push(Fn(r)),u[0]=r,t}}),vI.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]}
7830,Object(xe.z)(vI,Wt,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var r=t.materialize(t.SOURCE).source,u=e.resolve==="shared",l=e.field||xe.y,d=function(j,$){let G;return Object(xe.E)(j)?(G=te=>j(te,$)).dep=U8(j):j?G=Object(xe.m)(j):(G=te=>te.$value/te.$max||0).dep=!0,G}(e.opacity,e),b=function(j,$){let G;return Object(xe.E)(j)?(G=te=>en(j(te,$))).dep=U8(j):G=Object(xe.m)(en(j||"#888")),G}(e.color,e),k=e.as||"image",T={$x:0,$y:0,$value:0,$max:u?er(r.map(j=>er(l(j).values))):0};return r.forEach(j=>{const $=l(j),G=Object(xe.p)({},j,T);u||(G.$max=er($.values||[])),j[k]=function(te,se,he,ve){const Be=te.width,ze=te.height,Ue=te.x1||0,st=te.y1||0,ut=te.x2||Be,mt=te.y2||ze,pt=te.values,Ct=pt?Wn=>pt[Wn]:xe.Ma,Et=Gu(ut-Ue,mt-st),mn=Et.getContext("2d"),An=mn.getImageData(0,0,ut-Ue,mt-st),xn=An.data;for(let Wn=st,Un=0;Wn<mt;++Wn){se.$y=Wn-st;for(let Kn=Ue,Qn=Wn*Be;Kn<ut;++Kn,Un+=4){se.$x=Kn-Ue,se.$value=Ct(Kn+Qn);const ir=he(se);xn[Un+0]=ir.r,xn[Un+1]=ir.g,xn[Un+2]=ir.b,xn[Un+3]=~~(255*ve(se))}}return mn.putImageData(An,0,0),Et}($,G,b.dep?b:Object(xe.m)(b(G)),d.dep?d:Object(xe.m)(d(G)))}),t.reflow(!0).modifies(k)}}),Object(xe.z)(W8,Wt,{transform(e,t){let r=this.value;return!r||e.modified("type")?(this.value=r=function(u){const l=oI((u||"mercator").toLowerCase());return l||Object(xe.o)("Unrecognized projection type: "+u),l()}(e.type),iI.forEach(u=>{e[u]!=null&&V8(r,u,e[u])})):iI.forEach(u=>{e.modified(u)&&V8(r,u,e[u])}),e.pointRadius!=null&&r.path.pointRadius(e.pointRadius),e.fit&&function(u,l){const d=function(b){return(b=Object(xe.i)(b)).length===1?b[0]:{type:fI,features:b.reduce((k,T)=>k.concat(function(j){return j.type===fI?j.features:Object(xe.i)(j).filter($=>$!=null).map($=>$.type===lI?$:{type:lI,geometry:$})}(T)),[])}}(l.fit);l.extent?u.fitExtent(l.extent,d):l.size&&u.fitSize(l.size,d)}(r,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function $8(e,t,r,u){if(isNaN(t)||isNaN(r))return e;var l,d,b,k,T,j,$,G,te,se=e._root,he={data:u},ve=e._x0,Be=e._y0,ze=e._x1,Ue=e._y1;if(!se)return e._root=he,e;for(;se.length;)if((j=t>=(d=(ve+ze)/2))?ve=d:ze=d,($=r>=(b=(Be+Ue)/2))?Be=b:Ue=b,l=se,!(se=se[G=$<<1|j]))return l[G]=he,e;if(k=+e._x.call(null,se.data),T=+e._y.call(null,se.data),t===k&&r===T)return he.next=se,l?l[G]=he:e._root=he,e;do l=l?l[G]=new Array(4):e._root=new Array(4),(j=t>=(d=(ve+ze)/2))?ve=d:ze=d,($=r>=(b=(Be+Ue)/2))?Be=b:Ue=b;while((G=$<<1|j)==(te=(T>=b)<<1|k>=d));return l[te]=se,l[G]=he,e}var Gh=function(e,t,r,u,l){this.node=e,this.x0=t,this.y0=r,this.x1=u,this.y1=l};function DQ(e){return e[0]}function TQ(e){return e[1]}function yI(e,t,r){var u=new bI(t??DQ,r??TQ,NaN,NaN,NaN,NaN);return e==null?u:u.addAll(e)}function bI(e,t,r,u,l,d){this._x=e,this._y=t,this._x0=r,this._y0=u,this._x1=l,this._y1=d,this._root=void 0}function H8(e){for(var t={data:e.data},r=t;e=e.next;)r=r.next={data:e.data};return t}var Kh=yI.prototype=bI.prototype;Kh.copy=function(){var e,t,r=new bI(this._x,this._y,this._x0,this._y0,this._x1,this._y1),u=this._root;if(!u)return r;if(!u.length)return r._root=H8(u),r;for(e=[{source:u,target:r._root=new Array(4)}];u=e.pop();)for(var l=0;l<4;++l)(t=u.source[l])&&(t.length?e.push({source:t,target:u.target[l]=new Array(4)}):u.target[l]=H8(t));return r},Kh.add=function(e){const t=+this._x.call(null,e),r=+this._y.call(null,e);return $8(this.cover(t,r),t,r,e)},Kh.addAll=function(e){var t,r,u,l,d=e.length,b=new Array(d),k=new Array(d),T=1/0,j=1/0,$=-1/0,G=-1/0;for(r=0;r<d;++r)isNaN(u=+this._x.call(null,t=e[r]))||isNaN(l=+this._y.call(null,t))||(b[r]=u,k[r]=l,u<T&&(T=u),u>$&&($=u),l<j&&(j=l),l>G&&(G=l));if(T>$||j>G)return this;for(this.cover(T,j).cover($,G),r=0;r<d;++r)$8(this,b[r],k[r],e[r]);return this},Kh.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var r=this._x0,u=this._y0,l=this._x1,d=this._y1;if(isNaN(r))l=(r=Math.floor(e))+1,d=(u=Math.floor(t))+1;else{for(var b,k,T=l-r||1,j=this._root;r>e||e>=l||u>t||t>=d;)switch(k=(t<u)<<1|e<r,(b=new Array(4))[k]=j,j=b,T*=2,k){case 0:l=r+T,d=u+T;break;case 1:r=l-T,d=u+T;break;case 2:l=r+T,u=d-T;break;case 3:r=l-T,u=d-T}this._root&&this._root.length&&(this._root=j)}return this._x0=r,this._y0=u,this._x1=l,this._y1=d,this},Kh.data=function(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e},Kh.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Kh.find=function(e,t,r){var u,l,d,b,k,T,j,$=this._x0,G=this._y0,te=this._x1,se=this._y1,he=[],ve=this._root;for(ve&&he.push(new Gh(ve,$,G,te,se)),r==null?r=1/0:($=e-r,G=t-r,te=e+r,se=t+r,r*=r);T=he.pop();)if(!(!(ve=T.node)||(l=T.x0)>te||(d=T.y0)>se||(b=T.x1)<$||(k=T.y1)<G))if(ve.length){var Be=(l+b)/2,ze=(d+k)/2;he.push(new Gh(ve[3],Be,ze,b,k),new Gh(ve[2],l,ze,Be,k),new Gh(ve[1],Be,d,b,ze),new Gh(ve[0],l,d,Be,ze)),(j=(t>=ze)<<1|e>=Be)&&(T=he[he.length-1],he[he.length-1]=he[he.length-1-j],he[he.length-1-j]=T)}else{var Ue=e-+this._x.call(null,ve.data),st=t-+this._y.call(null,ve.data),ut=Ue*Ue+st*st;if(ut<r){var mt=Math.sqrt(r=ut);$=e-mt,G=t-mt,te=e+mt,se=t+mt,u=ve.data}}return u},Kh.remove=function(e){if(isNaN(d=+this._x.call(null,e))||isNaN(b=+this._y.call(null,e)))return this;var t,r,u,l,d,b,k,T,j,$,G,te,se=this._root,he=this._x0,ve=this._y0,Be=this._x1,ze=this._y1;if(!se)return this;if(se.length)for(;;){if((j=d>=(k=(he+Be)/2))?he=k:Be=k,($=b>
7830=(T=(ve+ze)/2))?ve=T:ze=T,t=se,!(se=se[G=$<<1|j]))return this;if(!se.length)break;(t[G+1&3]||t[G+2&3]||t[G+3&3])&&(r=t,te=G)}for(;se.data!==e;)if(u=se,!(se=se.next))return this;return(l=se.next)&&delete se.next,u?(l?u.next=l:delete u.next,this):t?(l?t[G]=l:delete t[G],(se=t[0]||t[1]||t[2]||t[3])&&se===(t[3]||t[2]||t[1]||t[0])&&!se.length&&(r?r[te]=se:this._root=se),this):(this._root=l,this)},Kh.removeAll=function(e){for(var t=0,r=e.length;t<r;++t)this.remove(e[t]);return this},Kh.root=function(){return this._root},Kh.size=function(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e},Kh.visit=function(e){var t,r,u,l,d,b,k=[],T=this._root;for(T&&k.push(new Gh(T,this._x0,this._y0,this._x1,this._y1));t=k.pop();)if(!e(T=t.node,u=t.x0,l=t.y0,d=t.x1,b=t.y1)&&T.length){var j=(u+d)/2,$=(l+b)/2;(r=T[3])&&k.push(new Gh(r,j,$,d,b)),(r=T[2])&&k.push(new Gh(r,u,$,j,b)),(r=T[1])&&k.push(new Gh(r,j,l,d,$)),(r=T[0])&&k.push(new Gh(r,u,l,j,$))}return this},Kh.visitAfter=function(e){var t,r=[],u=[];for(this._root&&r.push(new Gh(this._root,this._x0,this._y0,this._x1,this._y1));t=r.pop();){var l=t.node;if(l.length){var d,b=t.x0,k=t.y0,T=t.x1,j=t.y1,$=(b+T)/2,G=(k+j)/2;(d=l[0])&&r.push(new Gh(d,b,k,$,G)),(d=l[1])&&r.push(new Gh(d,$,k,T,G)),(d=l[2])&&r.push(new Gh(d,b,G,$,j)),(d=l[3])&&r.push(new Gh(d,$,G,T,j))}u.push(t)}for(;t=u.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},Kh.x=function(e){return arguments.length?(this._x=e,this):this._x},Kh.y=function(e){return arguments.length?(this._y=e,this):this._y};var Yh=function(e){return function(){return e}},Vb=function(e){return 1e-6*(e()-.5)};function NQ(e){return e.x+e.vx}function IQ(e){return e.y+e.vy}var MQ={value:()=>{}};function q8(){for(var e,t=0,r=arguments.length,u={};t<r;++t){if(!(e=arguments[t]+"")||e in u||/[\s.]/.test(e))throw new Error("illegal type: "+e);u[e]=[]}return new dO(u)}function dO(e){this._=e}function FQ(e,t){for(var r,u=0,l=e.length;u<l;++u)if((r=e[u]).name===t)return r.value}function G8(e,t,r){for(var u=0,l=e.length;u<l;++u)if(e[u].name===t){e[u]=MQ,e=e.slice(0,u).concat(e.slice(u+1));break}return r!=null&&e.push({name:t,value:r}),e}dO.prototype=q8.prototype={constructor:dO,on:function(e,t){var r,u=this._,l=function(k,T){return k.trim().split(/^|\s+/).map(function(j){var $="",G=j.indexOf(".");if(G>=0&&($=j.slice(G+1),j=j.slice(0,G)),j&&!T.hasOwnProperty(j))throw new Error("unknown type: "+j);return{type:j,name:$}})}(e+"",u),d=-1,b=l.length;if(!(arguments.length<2)){if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++d<b;)if(r=(e=l[d]).type)u[r]=G8(u[r],e.name,t);else if(t==null)for(r in u)u[r]=G8(u[r],e.name,null);return this}for(;++d<b;)if((r=(e=l[d]).type)&&(r=FQ(u[r],e.name)))return r},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new dO(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var r,u,l=new Array(r),d=0;d<r;++d)l[d]=arguments[d+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(d=0,r=(u=this._[e]).length;d<r;++d)u[d].value.apply(t,l)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var u=this._[e],l=0,d=u.length;l<d;++l)u[l].value.apply(t,r)}};var hO,yE,RQ=q8,u_=0,bE=0,xE=0,K8=1e3,pO=0,dw=0,mO=0,wE=typeof performance=="object"&&performance.now?performance:Date,Y8=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function xI(){return dw||(Y8(BQ),dw=wE.now()+mO)}function BQ(){dw=0}function gO(){this._call=this._time=this._next=null}function X8(e,t,r){var u=new gO;return u.restart(e,t,r),u}function J8(){dw=(pO=wE.now())+mO,u_=bE=0;try{(function(){xI(),++u_;for(var e,t=hO;t;)(e=dw-t._time)>=0&&t._call.call(null,e),t=t._next;--u_})()}finally{u_=0,function(){for(var e,t,r=hO,u=1/0;r;)r._call?(u>r._time&&(u=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:hO=t);yE=e,wI(u)}(),dw=0}}function PQ(){var e=wE.now(),t=e-pO;t>K8&&(mO-=t,pO=e)}function wI(e){u_||(bE&&(bE=clearTimeout(bE)),e-dw>24?(e<1/0&&(bE=setTimeout(J8,e-wE.now()-mO)),xE&&(xE=clearInterval(xE))):(xE||(pO=wE.now(),xE=setInterval(PQ,K8)),u_=1,Y8(J8)))}gO.prototype=X8.prototype={constructor:gO,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?xI():+r)+(t==null?0:+t),this._next||yE===this||(yE?yE._next=this:hO=this,yE=this),this._call=e,this._time=r,wI()},stop:function(){this._call&&(this._call=null,this._time=1/0,wI())}};function jQ(e){return e.x}function LQ(e){return e.y}var zQ=10,UQ=Math.PI*(3-Math.sqrt(5)),WQ=function(e){var t,r=1,u=.001,l=1-Math.pow(u,1/300),d=0,b=.6,k=new Map,T=X8(G),j=RQ("tick","end"),$=function(){let ve=1;return()=>(ve=(1664525*ve+1013904223)%4294967296)/4294967296}();function G(){te(),j.call("tick",t),r<u&&(T.stop(),j.call("end",t))}function te(ve){var Be,ze,Ue=e.length;ve===void 0&&(ve=1);for(var st=0;st<ve;
vendor: 4,925 bytes, line 7830
7830++st)for(r+=(d-r)*l,k.forEach(function(ut){ut(r)}),Be=0;Be<Ue;++Be)(ze=e[Be]).fx==null?ze.x+=ze.vx*=b:(ze.x=ze.fx,ze.vx=0),ze.fy==null?ze.y+=ze.vy*=b:(ze.y=ze.fy,ze.vy=0);return t}function se(){for(var ve,Be=0,ze=e.length;Be<ze;++Be){if((ve=e[Be]).index=Be,ve.fx!=null&&(ve.x=ve.fx),ve.fy!=null&&(ve.y=ve.fy),isNaN(ve.x)||isNaN(ve.y)){var Ue=zQ*Math.sqrt(.5+Be),st=Be*UQ;ve.x=Ue*Math.cos(st),ve.y=Ue*Math.sin(st)}(isNaN(ve.vx)||isNaN(ve.vy))&&(ve.vx=ve.vy=0)}}function he(ve){return ve.initialize&&ve.initialize(e,$),ve}return e==null&&(e=[]),se(),t={tick:te,restart:function(){return T.restart(G),t},stop:function(){return T.stop(),t},nodes:function(ve){return arguments.length?(e=ve,se(),k.forEach(he),t):e},alpha:function(ve){return arguments.length?(r=+ve,t):r},alphaMin:function(ve){return arguments.length?(u=+ve,t):u},alphaDecay:function(ve){return arguments.length?(l=+ve,t):+l},alphaTarget:function(ve){return arguments.length?(d=+ve,t):d},velocityDecay:function(ve){return arguments.length?(b=1-ve,t):1-b},randomSource:function(ve){return arguments.length?($=ve,k.forEach(he),t):$},force:function(ve,Be){return arguments.length>1?(Be==null?k.delete(ve):k.set(ve,he(Be)),t):k.get(ve)},find:function(ve,Be,ze){var Ue,st,ut,mt,pt,Ct=0,Et=e.length;for(ze==null?ze=1/0:ze*=ze,Ct=0;Ct<Et;++Ct)(ut=(Ue=ve-(mt=e[Ct]).x)*Ue+(st=Be-mt.y)*st)<ze&&(pt=mt,ze=ut);return pt},on:function(ve,Be){return arguments.length>1?(j.on(ve,Be),t):j.on(ve)}}};function VQ(e){return e.index}function Q8(e,t){var r=e.get(t);if(!r)throw new Error("node not found: "+t);return r}const Z8={center:function(e,t){var r,u=1;function l(){var d,b,k=r.length,T=0,j=0;for(d=0;d<k;++d)T+=(b=r[d]).x,j+=b.y;for(T=(T/k-e)*u,j=(j/k-t)*u,d=0;d<k;++d)(b=r[d]).x-=T,b.y-=j}return e==null&&(e=0),t==null&&(t=0),l.initialize=function(d){r=d},l.x=function(d){return arguments.length?(e=+d,l):e},l.y=function(d){return arguments.length?(t=+d,l):t},l.strength=function(d){return arguments.length?(u=+d,l):u},l},collide:function(e){var t,r,u,l=1,d=1;function b(){for(var j,$,G,te,se,he,ve,Be=t.length,ze=0;ze<d;++ze)for($=yI(t,NQ,IQ).visitAfter(k),j=0;j<Be;++j)G=t[j],he=r[G.index],ve=he*he,te=G.x+G.vx,se=G.y+G.vy,$.visit(Ue);function Ue(st,ut,mt,pt,Ct){var Et=st.data,mn=st.r,An=he+mn;if(!Et)return ut>te+An||pt<te-An||mt>se+An||Ct<se-An;if(Et.index>G.index){var xn=te-Et.x-Et.vx,Wn=se-Et.y-Et.vy,Un=xn*xn+Wn*Wn;Un<An*An&&(xn===0&&(Un+=(xn=Vb(u))*xn),Wn===0&&(Un+=(Wn=Vb(u))*Wn),Un=(An-(Un=Math.sqrt(Un)))/Un*l,G.vx+=(xn*=Un)*(An=(mn*=mn)/(ve+mn)),G.vy+=(Wn*=Un)*An,Et.vx-=xn*(An=1-An),Et.vy-=Wn*An)}}}function k(j){if(j.data)return j.r=r[j.data.index];for(var $=j.r=0;$<4;++$)j[$]&&j[$].r>j.r&&(j.r=j[$].r)}function T(){if(t){var j,$,G=t.length;for(r=new Array(G),j=0;j<G;++j)$=t[j],r[$.index]=+e($,j,t)}}return typeof e!="function"&&(e=Yh(e==null?1:+e)),b.initialize=function(j,$){t=j,u=$,T()},b.iterations=function(j){return arguments.length?(d=+j,b):d},b.strength=function(j){return arguments.length?(l=+j,b):l},b.radius=function(j){return arguments.length?(e=typeof j=="function"?j:Yh(+j),T(),b):e},b},nbody:function(){var e,t,r,u,l,d=Yh(-30),b=1,k=1/0,T=.81;function j(se){var he,ve=e.length,Be=yI(e,jQ,LQ).visitAfter(G);for(u=se,he=0;he<ve;++he)t=e[he],Be.visit(te)}function $(){if(e){var se,he,ve=e.length;for(l=new Array(ve),se=0;se<ve;++se)he=e[se],l[he.index]=+d(he,se,e)}}function G(se){var he,ve,Be,ze,Ue,st=0,ut=0;if(se.length){for(Be=ze=Ue=0;Ue<4;++Ue)(he=se[Ue])&&(ve=Math.abs(he.value))&&(st+=he.value,ut+=ve,Be+=ve*he.x,ze+=ve*he.y);se.x=Be/ut,se.y=ze/ut}else{(he=se).x=he.data.x,he.y=he.data.y;do st+=l[he.data.index];while(he=he.next)}se.value=st}function te(se,he,ve,Be){if(!se.value)return!0;var ze=se.x-t.x,Ue=se.y-t.y,st=Be-he,ut=ze*ze+Ue*Ue;if(st*st/T<ut)return ut<k&&(ze===0&&(ut+=(ze=Vb(r))*ze),Ue===0&&(ut+=(Ue=Vb(r))*Ue),ut<b&&(ut=Math.sqrt(b*ut)),t.vx+=ze*se.value*u/ut,t.vy+=Ue*se.value*u/ut),!0;if(!(se.length||ut>=k)){(se.data!==t||se.next)&&(ze===0&&(ut+=(ze=Vb(r))*ze),Ue===0&&(ut+=(Ue=Vb(r))*Ue),ut<b&&(ut=Math.sqrt(b*ut)));do se.data!==t&&(st=l[se.data.index]*u/ut,t.vx+=ze*st,t.vy+=Ue*st);while(se=se.next)}}return j.initialize=function(se,he){e=se,r=he,$()},j.strength=function(se){return arguments.length?(d=typeof se=="function"?se:Yh(+se),$(),j):d},j.distanceMin=function(se){return arguments.length?(b=se*se,j):Math.sqrt(b)},j.distanceMax=function(se){return arguments.length?(k=se*se,j):Math.sqrt(k)},j.theta=function(se){return arguments.length?(T=se*se,j):Math.sqrt(T)},j},link:function(e){var t,r,u,l,d,b,k=VQ,T=function(ve){return 1/Math.min(l[ve.source.index],l[ve.target.index])},j=Yh(30),$=1;function G(ve){for(var Be=0,ze=e.length;Be<$;++Be)for(var Ue,st,ut,mt,pt,Ct,Et,mn=0;mn<ze;++mn)st=(Ue=e[mn]).source,mt=(ut=Ue.target).x+ut.vx-st.x-st.vx||Vb(b),pt=ut.y+ut.vy-st.y-st.vy||Vb(b),mt*=Ct=((Ct=Math.sqrt(mt*mt+pt*pt))-r[mn])/Ct*ve*t[mn],pt*=Ct,ut.vx-=mt*(Et=d[mn]),ut.vy-=pt*Et,st.vx+=mt*(Et=1-Et),st.vy+=pt*Et}
7830function te(){if(u){var ve,Be,ze=u.length,Ue=e.length,st=new Map(u.map((ut,mt)=>[k(ut,mt,u),ut]));for(ve=0,l=new Array(ze);ve<Ue;++ve)(Be=e[ve]).index=ve,typeof Be.source!="object"&&(Be.source=Q8(st,Be.source)),typeof Be.target!="object"&&(Be.target=Q8(st,Be.target)),l[Be.source.index]=(l[Be.source.index]||0)+1,l[Be.target.index]=(l[Be.target.index]||0)+1;for(ve=0,d=new Array(Ue);ve<Ue;++ve)Be=e[ve],d[ve]=l[Be.source.index]/(l[Be.source.index]+l[Be.target.index]);t=new Array(Ue),se(),r=new Array(Ue),he()}}function se(){if(u)for(var ve=0,Be=e.length;ve<Be;++ve)t[ve]=+T(e[ve],ve,e)}function he(){if(u)for(var ve=0,Be=e.length;ve<Be;++ve)r[ve]=+j(e[ve],ve,e)}return e==null&&(e=[]),G.initialize=function(ve,Be){u=ve,b=Be,te()},G.links=function(ve){return arguments.length?(e=ve,te(),G):e},G.id=function(ve){return arguments.length?(k=ve,G):k},G.iterations=function(ve){return arguments.length?($=+ve,G):$},G.strength=function(ve){return arguments.length?(T=typeof ve=="function"?ve:Yh(+ve),se(),G):T},G.distance=function(ve){return arguments.length?(j=typeof ve=="function"?ve:Yh(+ve),he(),G):j},G},x:function(e){var t,r,u,l=Yh(.1);function d(k){for(var T,j=0,$=t.length;j<$;++j)(T=t[j]).vx+=(u[j]-T.x)*r[j]*k}function b(){if(t){var k,T=t.length;for(r=new Array(T),u=new Array(T),k=0;k<T;++k)r[k]=isNaN(u[k]=+e(t[k],k,t))?0:+l(t[k],k,t)}}return typeof e!="function"&&(e=Yh(e==null?0:+e)),d.initialize=function(k){t=k,b()},d.strength=function(k){return arguments.length?(l=typeof k=="function"?k:Yh(+k),b(),d):l},d.x=function(k){return arguments.length?(e=typeof k=="function"?k:Yh(+k),b(),d):e},d},y:function(e){var t,r,u,l=Yh(.1);function d(k){for(var T,j=0,$=t.length;j<$;++j)(T=t[j]).vy+=(u[j]-T.y)*r[j]*k}function b(){if(t){var k,T=t.length;for(r=new Array(T),u=new Array(T),k=0;k<T;++k)r[k]=isNaN(u[k]=+e(t[k],k,t))?0:+l(t[k],k,t)}}return typeof e!="function"&&(e=Yh(e==null?0:+e)),d.initialize=function(k){t=k,b()},d.strength=function(k){return arguments.length?(l=typeof k=="function"?k:Yh(+k),b(),d):l},d.y=function(k){return arguments.length?(e=typeof k=="function"?k:Yh(+k),b(),d):e},d}},_E="forces",_I=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],$Q=["static","iterations"],eL=["x","y","vx","vy"];function kI(e){Wt.call(this,null,e)}function tL(e,t,r,u){var l,d,b,k,T=Object(xe.i)(t.forces);for(l=0,d=_I.length;l<d;++l)(b=_I[l])!==_E&&t.modified(b)&&e[b](t[b]);for(l=0,d=T.length;l<d;++l)k=_E+l,(b=r||t.modified(_E,l)?qQ(T[l]):u&&HQ(T[l],u)?e.force(k):null)&&e.force(k,b);for(d=e.numForces||0;l<d;++l)e.force(_E+l,null);return e.numForces=T.length,e}function HQ(e,t){var r,u;for(r in e)if(Object(xe.E)(u=e[r])&&t.modified(Object(xe.g)(u)))return 1;return 0}function qQ(e){var t,r;for(r in Object(xe.w)(Z8,e.force)||Object(xe.o)("Unrecognized force: "+e.force),t=Z8[e.force](),e)Object(xe.E)(t[r])&&GQ(t[r],e[r],e);return t}function GQ(e,t,r){e(Object(xe.E)(t)?u=>t(u,r):t)}function KQ(e){var t=0,r=e.children,u=r&&r.length;if(u)for(;--u>=0;)t+=r[u].value;else t=1;e.value=t}kI.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:eL}]},Object(xe.z)(kI,Wt,{transform(e,t){var r=this.value,u=t.changed(t.ADD_REM),l=e.modified(_I),d=e.iterations||300;if(r?(u&&(t.modifies("index"),r.nodes(t.source)),(l||t.changed(t.MOD))&&tL(r,e,0,t)):(this.value=r=function(b,k){const T=WQ(b),j=T.stop,$=T.restart;let G=!1;
vendor: 7,234 bytes, line 7830
7830return T.stopped=()=>G,T.restart=()=>(G=!1,$()),T.stop=()=>(G=!0,j()),tL(T,k,!0).on("end",()=>G=!0)}(t.source,e),r.on("tick",function(b,k){return()=>b.touch(k).run()}(t.dataflow,this)),e.static||(u=!0,r.tick()),t.modifies("index")),l||u||e.modified($Q)||t.changed()&&e.restart){if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/d)),e.static)for(r.stop();--d>=0;)r.tick();else if(r.stopped()&&r.restart(),!u)return t.StopPropagation}return this.finish(e,t)},finish(e,t){const r=t.dataflow;for(let k,T=this._argops,j=0,$=T.length;j<$;++j)if((k=T[j]).name===_E&&k.op._argval.force==="link"){for(var u,l=k.op._argops,d=0,b=l.length;d<b;++d)if(l[d].name==="links"&&(u=l[d].op.source)){r.pulse(u,r.changeset().reflow());break}}return t.reflow(e.modified()).modifies(eL)}});function EI(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=XQ)):t===void 0&&(t=YQ);for(var r,u,l,d,b,k=new c_(e),T=[k];r=T.pop();)if((l=t(r.data))&&(b=(l=Array.from(l)).length))for(r.children=l,d=b-1;d>=0;--d)T.push(u=l[d]=new c_(l[d])),u.parent=r,u.depth=r.depth+1;return k.eachBefore(nL)}function YQ(e){return e.children}function XQ(e){return Array.isArray(e)?e[1]:null}function JQ(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function nL(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function c_(e){this.data=e,this.depth=this.height=0,this.parent=null}c_.prototype=EI.prototype={constructor:c_,count:function(){return this.eachAfter(KQ)},each:function(e,t){let r=-1;for(const u of this)e.call(t,u,++r,this);return this},eachAfter:function(e,t){for(var r,u,l,d=this,b=[d],k=[],T=-1;d=b.pop();)if(k.push(d),r=d.children)for(u=0,l=r.length;u<l;++u)b.push(r[u]);for(;d=k.pop();)e.call(t,d,++T,this);return this},eachBefore:function(e,t){for(var r,u,l=this,d=[l],b=-1;l=d.pop();)if(e.call(t,l,++b,this),r=l.children)for(u=r.length-1;u>=0;--u)d.push(r[u]);return this},find:function(e,t){let r=-1;for(const u of this)if(e.call(t,u,++r,this))return u},sum:function(e){return this.eachAfter(function(t){for(var r=+e(t.data)||0,u=t.children,l=u&&u.length;--l>=0;)r+=u[l].value;t.value=r})},sort:function(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})},path:function(e){for(var t=this,r=function(d,b){if(d===b)return d;var k=d.ancestors(),T=b.ancestors(),j=null;for(d=k.pop(),b=T.pop();d===b;)j=d,d=k.pop(),b=T.pop();return j}(t,e),u=[t];t!==r;)t=t.parent,u.push(t);for(var l=u.length;e!==r;)u.splice(l,0,e),e=e.parent;return u},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e},links:function(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t},copy:function(){return EI(this).eachBefore(JQ)},[Symbol.iterator]:function*(){var e,t,r,u,l=this,d=[l];do for(e=d.reverse(),d=[];l=e.pop();)if(yield l,t=l.children)for(r=0,u=t.length;r<u;++r)d.push(t[r]);while(d.length)}};var QQ=function(e){return typeof e=="object"&&"length"in e?e:Array.from(e)},ZQ=function(e){for(var t,r,u=0,l=(e=function(b){for(var k,T,j=b.length;j;)T=Math.random()*j--|0,k=b[j],b[j]=b[T],b[T]=k;return b}(Array.from(e))).length,d=[];u<l;)t=e[u],r&&rL(r,t)?++u:(r=tZ(d=eZ(d,t)),u=0);return r};function eZ(e,t){var r,u;if(CI(t,e))return[t];for(r=0;r<e.length;++r)if(vO(t,e[r])&&CI(kE(e[r],t),e))return[e[r],t];for(r=0;r<e.length-1;++r)for(u=r+1;u<e.length;++u)if(vO(kE(e[r],e[u]),t)&&vO(kE(e[r],t),e[u])&&vO(kE(e[u],t),e[r])&&CI(iL(e[r],e[u],t),e))return[e[r],e[u],t];throw new Error}function vO(e,t){var r=e.r-t.r,u=t.x-e.x,l=t.y-e.y;return r<0||r*r<u*u+l*l}function rL(e,t){var r=e.r-t.r+1e-9*Math.max(e.r,t.r,1),u=t.x-e.x,l=t.y-e.y;return r>0&&r*r>u*u+l*l}function CI(e,t){for(var r=0;r<t.length;++r)if(!rL(e,t[r]))return!1;return!0}function tZ(e){switch(e.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(e[0]);case 2:return kE(e[0],e[1]);case 3:return iL(e[0],e[1],e[2])}}function kE(e,t){var r=e.x,u=e.y,l=e.r,d=t.x,b=t.y,k=t.r,T=d-r,j=b-u,$=k-l,G=Math.sqrt(T*T+j*j);return{x:(r+d+T/G*$)/2,y:(u+b+j/G*$)/2,r:(G+l+k)/2}}function iL(e,t,r){var u=e.x,l=e.y,d=e.r,b=t.x,k=t.y,T=t.r,j=r.x,$=r.y,G=r.r,te=u-b,se=u-j,he=l-k,ve=l-$,Be=T-d,ze=G-d,Ue=u*u+l*l-d*d,st=Ue-b*b-k*k+T*T,ut=Ue-j*j-$*$+G*G,mt=se*he-te*ve,pt=(he*ut-ve*st)/(2*mt)-u,Ct=(ve*Be-he*ze)/mt,Et=(se*st-te*ut)/(2*mt)-l,mn=(te*ze-se*Be)/mt,An=Ct*Ct+mn*mn-1,xn=2*(d+pt*Ct+Et*mn),Wn=pt*pt+Et*Et-d*d,Un=-(An?(xn+Math.sqrt(xn*xn-4*An*Wn))/(2*An):Wn/xn);return{x:u+pt+Ct*Un,y:l+Et+mn*Un,r:Un}}function oL(e,t,r){var u,l,d,b,k=e.x-t.x,T=e.y-t.y,j=k*k+T*T;j?(l=t.r+r.r,l*=l,b=e.r+r.r,l>(b*=b)?(u=(j+b-l)/(2*j),d=Math.sqrt(Math.max(0,b/j-u*u)),r.x=e.x-u*k-d*T,r.y=e.y-u*T+d*k):(u=(j+l-b)/(2*j),d=Math.sqrt(Math.max(0,l/j-u*u)),r.x=t.x+u*k-d*T,r.y=t.y+u*T+d*k)):(r.x=t.x+r.r,r.y=t.y)}function aL(e,t){var r=e.r+t.r-1e-6,u=t.x-e.x,l=t.y-e.y;return r>0&&r*r>u*u+l*l}function sL(e){var t=e._,r=e.next._,u=t.r+r.r,l=(t.x*r.r+r.x*t.r)/u,d=(t.y*r.r+r.y*t.r)/u;return l*l+d*d}function yO(e){this._=e,this.next=null,this.previous=null}function nZ(e){if(!(l=(e=QQ(e)).length))return 0;var t,r,u,l,d,b,k,T,j,$,G;if((t=e[0]).x=0,t.y=0,!(l>1))return t.r;if(r=e[1],t.x=-r.r,r.x=t.r,r.y=0,!(l>2))return t.r+r.r;oL(r,t,u=e[2]),t=new yO(t),r=new yO(r),u=new yO(u),t.next=u.previous=r,r.next=t.previous=u,u.next=r.previous=t;e:for(k=3;k<l;++k){oL(t._,r._,u=e[k]),u=new yO(u),T=r.next,j=t.previous,$=r._.r,G=t._.r;do if($<=G){if(aL(T._,u._)){r=T,t.next=r,r.previous=t,--k;continue e}$+=T._.r,T=T.next}else{if(aL(j._,u._)){(t=j).next=r,r.previous=t,--k;continue e}G+=j._.r,j=j.previous}while(T!==j.next);for(u.previous=t,u.next=r,t.next=r.previous=r=u,d=sL(t);(u=u.next)!==r;)(b=sL(u))<d&&(t=u,d=b);r=t.next}for(t=[r._],u=r;(u=u.next)!==r;)t.push(u._);for(u=ZQ(t),k=0;k<l;++k)(t=e[k]).x-=u.x,t.y-=u.y;return u.r}function bO(e){if(typeof e!="function")throw new Error;return e}function hw(){return 0}var l_=function(e){return function(){return e}};function rZ(e){return Math.sqrt(e.value)}function uL(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function SI(e,t){return function(r){if(u=r.children){var u,l,d,b=u.length,k=e(r)*t||0;if(k)for(l=0;l<b;++l)u[l].r+=k;if(d=nZ(u),k)for(l=0;l<b;++l)u[l].r-=k;r.r=d+k}}}function cL(e){return function(t){var r=t.parent;t.r*=e,r&&(t.x=r.x+e*t.x,t.y=r.y+e*t.y)}}var lL=function(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)},EE=function(e,t,r,u,l){for(var d,b=e.children,k=-1,T=b.length,j=e.value&&(u-t)/e.value;++k<T;)(d=b[k]).y0=r,d.y1=l,d.x0=t,d.x1=t+=d.value*j},iZ={depth:-1},fL={};function oZ(e){return e.id}function aZ(e){return e.parentId}var dL=function(){var e=oZ,t=aZ;function r(u){var l,d,b,k,T,j,$,G=Array.from(u),te=G.length,se=new Map;for(d=0;d<te;++d)l=G[d],T=G[d]=new c_(l),(j=e(l,d,u))!=null&&(j+="")&&($=T.id=j,se.set($,se.has($)?fL:T)),(j=t(l,d,u))!=null&&(j+="")&&(T.parent=j);for(d=0;d<te;++d)if(j=(T=G[d]).parent){if(!(k=se.get(j)))throw new Error("missing: "+j);if(k===fL)throw new Error("ambiguous: "+j);k.children?k.children.push(T):k.children=[T],T.parent=k}else{if(b)throw new Error("multiple roots");b=T}if(!b)throw new Error("no root");
7830if(b.parent=iZ,b.eachBefore(function(he){he.depth=he.parent.depth+1,--te}).eachBefore(nL),b.parent=null,te>0)throw new Error("cycle");return b}return r.id=function(u){return arguments.length?(e=bO(u),r):e},r.parentId=function(u){return arguments.length?(t=bO(u),r):t},r};function sZ(e,t){return e.parent===t.parent?1:2}function AI(e){var t=e.children;return t?t[0]:e.t}function OI(e){var t=e.children;return t?t[t.length-1]:e.t}function uZ(e,t,r){var u=r/(t.i-e.i);t.c-=u,t.s+=r,e.c+=u,t.z+=r,t.m+=r}function cZ(e,t,r){return e.a.parent===t.parent?e.a:r}function xO(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}xO.prototype=Object.create(c_.prototype);function lZ(e,t){return e.parent===t.parent?1:2}function fZ(e,t){return e+t.x}function dZ(e,t){return Math.max(e,t.y)}var wO=function(e,t,r,u,l){for(var d,b=e.children,k=-1,T=b.length,j=e.value&&(l-r)/e.value;++k<T;)(d=b[k]).x0=t,d.x1=u,d.y0=r,d.y1=r+=d.value*j},hL=(1+Math.sqrt(5))/2;function pL(e,t,r,u,l,d){for(var b,k,T,j,$,G,te,se,he,ve,Be,ze=[],Ue=t.children,st=0,ut=0,mt=Ue.length,pt=t.value;st<mt;){T=l-r,j=d-u;do $=Ue[ut++].value;while(!$&&ut<mt);for(G=te=$,Be=$*$*(ve=Math.max(j/T,T/j)/(pt*e)),he=Math.max(te/Be,Be/G);ut<mt;++ut){if($+=k=Ue[ut].value,k<G&&(G=k),k>te&&(te=k),Be=$*$*ve,(se=Math.max(te/Be,Be/G))>he){$-=k;break}he=se}ze.push(b={value:$,dice:T<j,children:Ue.slice(st,ut)}),b.dice?EE(b,r,u,l,pt?u+=j*$/pt:d):wO(b,r,u,pt?r+=T*$/pt:l,d),pt-=$,st=ut}return ze}var mL=function e(t){function r(u,l,d,b,k){pL(t,u,l,d,b,k)}return r.ratio=function(u){return e((u=+u)>1?u:1)},r}(hL),hZ=function e(t){function r(u,l,d,b,k){if((T=u._squarify)&&T.ratio===t)for(var T,j,$,G,te,se=-1,he=T.length,ve=u.value;++se<he;){for($=(j=T[se]).children,G=j.value=0,te=$.length;G<te;++G)j.value+=$[G].value;j.dice?EE(j,l,d,b,ve?d+=(k-d)*j.value/ve:k):wO(j,l,d,ve?l+=(b-l)*j.value/ve:b,k),ve-=j.value}else u._squarify=T=pL(t,u,l,d,b,k),T.ratio=t}return r.ratio=function(u){return e((u=+u)>1?u:1)},r}(hL);function DI(e,t,r){const u={};return e.each(l=>{const d=l.data;r(d)&&(u[t(d)]=l)}),e.lookup=u,e}function TI(e){Wt.call(this,null,e)}TI.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const pZ=e=>e.values;function N1(e){Wt.call(this,null,e)}Object(xe.z)(TI,Wt,{transform(e,t){t.source||Object(xe.o)("Nest transform requires an upstream data source.");var r=e.generate,u=e.modified(),l=t.clone(),d=this.value;return(!d||u||t.changed())&&(d&&d.each(b=>{b.children&&rn(b.data)&&l.rem.push(b.data)}),this.value=d=EI({values:Object(xe.i)(e.keys).reduce((b,k)=>(b.key(k),b),function(){const b=[],k={entries:T=>function j($,G){if(++G>b.length)return $;const te=[];for(const se in $)te.push({key:se,values:j($[se],G)});return te}(function j($,G){if(G>=b.length)return $;const te=$.length,se=b[G++],he={},ve={};let Be,ze,Ue,st=-1;for(;++st<te;)Be=se(ze=$[st])+"",(Ue=he[Be])?Ue.push(ze):he[Be]=[ze];for(Be in he)ve[Be]=j(he[Be],G);return ve}(T,0),0),key:T=>(b.push(T),k)};return k}()).entries(l.source)},pZ),r&&d.each(b=>
7830{b.children&&(b=Fn(b.data),l.add.push(b),l.source.push(b))}),DI(d,fn,fn)),l.source.root=d,l}});const mZ=(e,t)=>e.parent===t.parent?1:2;Object(xe.z)(N1,Wt,{transform(e,t){t.source&&t.source.root||Object(xe.o)(this.constructor.name+" transform requires a backing tree data source.");const r=this.layout(e.method),u=this.fields,l=t.source.root,d=e.as||u;e.field?l.sum(e.field):l.count(),e.sort&&l.sort(fi(e.sort,b=>b.data)),function(b,k,T){for(let j,$=0,G=k.length;$<G;++$)(j=k[$])in T&&b[j](T[j])}(r,this.params,e),r.separation&&r.separation(e.separation!==!1?mZ:xe.Q);try{this.value=r(l)}catch(b){Object(xe.o)(b)}return l.each(b=>function(k,T,j){const $=k.data,G=T.length-1;for(let te=0;te<G;++te)$[j[te]]=k[T[te]];$[j[G]]=k.children?k.children.length:0}(b,u,d)),t.reflow(e.modified()).modifies(d).modifies("leaf")}});const NI=["x","y","r","depth","children"];function II(e){N1.call(this,e)}II.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:NI.length,default:NI}]},Object(xe.z)(II,N1,{layout:function(){var e=null,t=1,r=1,u=hw;function l(d){return d.x=t/2,d.y=r/2,e?d.eachBefore(uL(e)).eachAfter(SI(u,.5)).eachBefore(cL(1)):d.eachBefore(uL(rZ)).eachAfter(SI(hw,1)).eachAfter(SI(u,d.r/Math.min(t,r))).eachBefore(cL(Math.min(t,r)/(2*d.r))),d}return l.radius=function(d){return arguments.length?(e=function(b){return b==null?null:bO(b)}(d),l):e},l.size=function(d){return arguments.length?(t=+d[0],r=+d[1],l):[t,r]},l.padding=function(d){return arguments.length?(u=typeof d=="function"?d:l_(+d),l):u},l},params:["radius","size","padding"],fields:NI});const MI=["x0","y0","x1","y1","depth","children"];function FI(e){N1.call(this,e)}function RI(e){Wt.call(this,null,e)}FI.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:MI.length,default:MI}]},Object(xe.z)(FI,N1,{layout:function(){var e=1,t=1,r=0,u=!1;function l(d){var b=d.height+1;return d.x0=d.y0=r,d.x1=e,d.y1=t/b,d.eachBefore(function(k,T){return function(j){j.children&&EE(j,j.x0,k*(j.depth+1)/T,j.x1,k*(j.depth+2)/T);var $=j.x0,G=j.y0,te=j.x1-r,se=j.y1-r;te<$&&($=te=($+te)/2),se<G&&(G=se=(G+se)/2),j.x0=$,j.y0=G,j.x1=te,j.y1=se}}(t,b)),u&&d.eachBefore(lL),d}return l.round=function(d){return arguments.length?(u=!!d,l):u},l.size=function(d){return arguments.length?(e=+d[0],t=+d[1],l):[e,t]},l.padding=function(d){return arguments.length?(r=+d,l):r},l},params:["size","round","padding"],fields:MI}),RI.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},Object(xe.z)(RI,Wt,{transform(e,t){t.source||Object(xe.o)("Stratify transform requires an upstream data source.");let r=this.value;const u=e.modified(),l=t.fork(t.ALL).materialize(t.SOURCE),d=!r||u||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return l.source=l.source.slice(),d&&(r=l.source.length?DI(dL().id(e.key).parentId(e.parentKey)(l.source),e.key,xe.Ia):DI(dL()([{}]),e.key,e.key)),l.source.root=this.value=r,l}});const gL={tidy:function(){var e=sZ,t=1,r=1,u=null;function l(T){var j=function(ze){for(var Ue,st,ut,mt,pt,Ct=new xO(ze,0),Et=[Ct];Ue=Et.pop();)if(ut=Ue._.children)for(Ue.children=new Array(pt=ut.length),mt=pt-1;mt>=0;--mt)Et.push(st=Ue.children[mt]=new xO(ut[mt],mt)),st.parent=Ue;return(Ct.parent=new xO(null,0)).children=[Ct],Ct}(T);if(j.eachAfter(d),j.parent.m=-j.z,j.eachBefore(b),u)T.eachBefore(k);else{var $=T,G=T,te=T;T.eachBefore(function(ze){ze.x<$.x&&($=ze),ze.x>G.x&&(G=ze),ze.depth>te.depth&&(te=ze)});var se=$===G?1:e($,G)/2,he=se-$.x,ve=t/(G.x+se+he),Be=r/(te.depth||1);T.eachBefore(function(ze){ze.x=(ze.x+he)*ve,ze.y=ze.depth*Be})}return T}function d(T){var j=T.children,$=T.parent.children,G=T.i?$[T.i-1]:null;if(j){(function(se){for(var he,ve=0,Be=0,ze=se.children,Ue=ze.length;--Ue>=0;)(he=ze[Ue]).z+=ve,he.m+=ve,ve+=he.s+(Be+=he.c)})(T);var te=(j[0].z+j[j.length-1].z)/2;G?(T.z=G.z+e(T._,G._),T.m=T.z-te):T.z=te}else G&&(T.z=G.z+e(T._,G._));T.parent.A=function(se,he,ve){if(he){for(var Be,ze=se,Ue=se,st=he,ut=ze.parent.children[0],mt=ze.m,pt=Ue.m,Ct=st.m,
vendor: 4,192 bytes, line 7830
7830Et=ut.m;st=OI(st),ze=AI(ze),st&&ze;)ut=AI(ut),(Ue=OI(Ue)).a=se,(Be=st.z+Ct-ze.z-mt+e(st._,ze._))>0&&(uZ(cZ(st,se,ve),se,Be),mt+=Be,pt+=Be),Ct+=st.m,mt+=ze.m,Et+=ut.m,pt+=Ue.m;st&&!OI(Ue)&&(Ue.t=st,Ue.m+=Ct-pt),ze&&!AI(ut)&&(ut.t=ze,ut.m+=mt-Et,ve=se)}return ve}(T,G,T.parent.A||$[0])}function b(T){T._.x=T.z+T.parent.m,T.m+=T.parent.m}function k(T){T.x*=t,T.y=T.depth*r}return l.separation=function(T){return arguments.length?(e=T,l):e},l.size=function(T){return arguments.length?(u=!1,t=+T[0],r=+T[1],l):u?null:[t,r]},l.nodeSize=function(T){return arguments.length?(u=!0,t=+T[0],r=+T[1],l):u?[t,r]:null},l},cluster:function(){var e=lZ,t=1,r=1,u=!1;function l(d){var b,k=0;d.eachAfter(function(te){var se=te.children;se?(te.x=function(he){return he.reduce(fZ,0)/he.length}(se),te.y=function(he){return 1+he.reduce(dZ,0)}(se)):(te.x=b?k+=e(te,b):0,te.y=0,b=te)});var T=function(te){for(var se;se=te.children;)te=se[0];return te}(d),j=function(te){for(var se;se=te.children;)te=se[se.length-1];return te}(d),$=T.x-e(T,j)/2,G=j.x+e(j,T)/2;return d.eachAfter(u?function(te){te.x=(te.x-d.x)*t,te.y=(d.y-te.y)*r}:function(te){te.x=(te.x-$)/(G-$)*t,te.y=(1-(d.y?te.y/d.y:1))*r})}return l.separation=function(d){return arguments.length?(e=d,l):e},l.size=function(d){return arguments.length?(u=!1,t=+d[0],r=+d[1],l):u?null:[t,r]},l.nodeSize=function(d){return arguments.length?(u=!0,t=+d[0],r=+d[1],l):u?[t,r]:null},l}},BI=["x","y","depth","children"];function PI(e){N1.call(this,e)}function jI(e){Wt.call(this,[],e)}PI.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:BI.length,default:BI}]},Object(xe.z)(PI,N1,{layout(e){const t=e||"tidy";if(Object(xe.w)(gL,t))return gL[t]();Object(xe.o)("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:BI}),jI.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},Object(xe.z)(jI,Wt,{transform(e,t){const r=this.value,u=t.source&&t.source.root,l=t.fork(t.NO_SOURCE),d={};return u||Object(xe.o)("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(l.rem=r,t.visit(t.SOURCE,b=>d[fn(b)]=1),u.each(b=>{const k=b.data,T=b.parent&&b.parent.data;T&&d[fn(k)]&&d[fn(T)]&&l.add.push(Fn({source:T,target:k}))}),this.value=l.add):t.changed(t.MOD)&&(t.visit(t.MOD,b=>d[fn(b)]=1),r.forEach(b=>{(d[fn(b.source)]||d[fn(b.target)])&&l.mod.push(b)})),l}});const vL={binary:function(e,t,r,u,l){var d,b,k=e.children,T=k.length,j=new Array(T+1);for(j[0]=b=d=0;d<T;++d)j[d+1]=b+=k[d].value;(function $(G,te,se,he,ve,Be,ze){if(G>=te-1){var Ue=k[G];return Ue.x0=he,Ue.y0=ve,Ue.x1=Be,void(Ue.y1=ze)}for(var st=j[G],ut=se/2+st,mt=G+1,pt=te-1;mt<pt;){var Ct=mt+pt>>>1;j[Ct]<ut?mt=Ct+1:pt=Ct}ut-j[mt-1]<j[mt]-ut&&G+1<mt&&--mt;var Et=j[mt]-st,mn=se-Et;if(Be-he>ze-ve){var An=se?(he*mn+Be*Et)/se:Be;$(G,mt,Et,he,ve,An,ze),$(mt,te,mn,An,ve,Be,ze)}else{var xn=se?(ve*mn+ze*Et)/se:ze;$(G,mt,Et,he,ve,Be,xn),$(mt,te,mn,he,xn,Be,ze)}})(0,T,e.value,t,r,u,l)},dice:EE,slice:wO,slicedice:function(e,t,r,u,l){(1&e.depth?wO:EE)(e,t,r,u,l)},squarify:mL,resquarify:hZ},LI=["x0","y0","x1","y1","depth","children"];function zI(e){N1.call(this,e)}zI.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:LI.length,default:LI}]}
7830,Object(xe.z)(zI,N1,{layout(){const e=function(){var t=mL,r=!1,u=1,l=1,d=[0],b=hw,k=hw,T=hw,j=hw,$=hw;function G(se){return se.x0=se.y0=0,se.x1=u,se.y1=l,se.eachBefore(te),d=[0],r&&se.eachBefore(lL),se}function te(se){var he=d[se.depth],ve=se.x0+he,Be=se.y0+he,ze=se.x1-he,Ue=se.y1-he;ze<ve&&(ve=ze=(ve+ze)/2),Ue<Be&&(Be=Ue=(Be+Ue)/2),se.x0=ve,se.y0=Be,se.x1=ze,se.y1=Ue,se.children&&(he=d[se.depth+1]=b(se)/2,ve+=$(se)-he,Be+=k(se)-he,ze-=T(se)-he,Ue-=j(se)-he,ze<ve&&(ve=ze=(ve+ze)/2),Ue<Be&&(Be=Ue=(Be+Ue)/2),t(se,ve,Be,ze,Ue))}return G.round=function(se){return arguments.length?(r=!!se,G):r},G.size=function(se){return arguments.length?(u=+se[0],l=+se[1],G):[u,l]},G.tile=function(se){return arguments.length?(t=bO(se),G):t},G.padding=function(se){return arguments.length?G.paddingInner(se).paddingOuter(se):G.paddingInner()},G.paddingInner=function(se){return arguments.length?(b=typeof se=="function"?se:l_(+se),G):b},G.paddingOuter=function(se){return arguments.length?G.paddingTop(se).paddingRight(se).paddingBottom(se).paddingLeft(se):G.paddingTop()},G.paddingTop=function(se){return arguments.length?(k=typeof se=="function"?se:l_(+se),G):k},G.paddingRight=function(se){return arguments.length?(T=typeof se=="function"?se:l_(+se),G):T},G.paddingBottom=function(se){return arguments.length?(j=typeof se=="function"?se:l_(+se),G):j},G.paddingLeft=function(se){return arguments.length?($=typeof se=="function"?se:l_(+se),G):$},G}();return e.ratio=t=>{const r=e.tile();r.ratio&&e.tile(r.ratio(t))},e.method=t=>{Object(xe.w)(vL,t)?e.tile(vL[t]):Object(xe.o)("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:LI});const gZ=4278190080,vZ=268435456,yZ=.0625;function bZ(e,t,r,u){const l=e.width,d=e.height,b=r||u,k=Gu(l,d).getContext("2d");t.forEach(Be=>function ze(Ue,st,ut){if(!st.length)return;const mt=st[0].mark.marktype;mt==="group"?st.forEach(pt=>{pt.items.forEach(Ct=>ze(Ue,Ct.items,ut))}):$f[mt].draw(Ue,{items:ut?st.map(xZ):st})}(k,Be,b));const T=new Uint32Array(k.getImageData(0,0,l,d).data.buffer),j=e.bitmap(),$=b&&e.bitmap();let G,te,se,he,ve;for(te=0;te<d;++te)for(G=0;G<l;++G)(ve=T[te*l+G]&gZ)&&(se=e(G),he=e(te),u||j.set(se,he),b&&ve^vZ&&$.set(se,he));return[j,$]}function xZ(e){const t=Dr(e,{});return t.stroke&&(t.strokeOpacity=1),t.fill&&(t.fillOpacity=yZ,t.stroke="#000",t.strokeOpacity=1,t.strokeWidth=2),t}const I1=5,Xh=31,CE=32,$b=new Uint32Array(CE+1),dv=new Uint32Array(CE+1);dv[0]=0,$b[0]=~dv[0];for(let e=1;e<=CE;++e)dv[e]=dv[e-1]<<1|1,$b[e]=~dv[e];function wZ(e,t,r){const u=Math.max(1,Math.sqrt(e*t/1e6)),l=~~((e+2*r+u)/u),d=~~((t+2*r+u)/u),b=k=>~~((k+r)/u);return b.invert=k=>k*u-r,b.bitmap=()=>function(k,T){const j=new Uint32Array(~~((k*T+CE)/CE));function $(te,se){j[te]|=se}function G(te,se){j[te]&=se}return{array:j,get:(te,se)=>{const he=se*k+te;return j[he>>>I1]&1<<(he&Xh)},set:(te,se)=>{const he=se*k+te;$(he>>>I1,1<<(he&Xh))},clear:(te,se)=>{const he=se*k+te;G(he>>>I1,~(1<<(he&Xh)))},getRange:(te,se,he,ve)=>{let Be,ze,Ue,st,ut=ve;for(;ut>=se;--ut)if((Ue=(Be=ut*k+te)>>>I1)==(st=(ze=ut*k+he)>>>I1)){if(j[Ue]&$b[Be&Xh]&dv[1+(ze&Xh)])return!0}else{if(j[Ue]&$b[Be&Xh]||j[st]&dv[1+(ze&Xh)])return!0;for(let mt=Ue+1;mt<st;++mt)if(j[mt])return!0}return!1},setRange:(te,se,he,ve)=>{let Be,ze,Ue,st,ut;for(;se<=ve;++se)if((Ue=(Be=se*k+te)>>>I1)==(st=(ze=se*k+he)>>>I1))$(Ue,$b[Be&Xh]&dv[1+(ze&Xh)]);else for($(Ue,$b[Be&Xh]),$(st,dv[1+(ze&Xh)]),ut=Ue+1;ut<st;++ut)$(ut,4294967295)},clearRange:(te,se,he,ve)=>{let Be,ze,Ue,st,ut;for(;se<=ve;++se)if((Ue=(Be=se*k+te)>>>I1)==(st=(ze=se*k+he)>>>I1))G(Ue,dv[Be&Xh]|$b[1+(ze&Xh)]);else for(G(Ue,dv[Be&Xh]),G(st,$b[1+(ze&Xh)]),ut=Ue+1;ut<st;++ut)G(ut,0)},outOfBounds:(te,se,he,ve)=>te<0||se<0||ve>=T||he>=k}}(l,d),b.ratio=u,b.padding=r,b.width=e,b.height=t,b}function _O(e,t,r,u,l,d){let b=r/2;return e-b<0||e+b>l||t-(b=u/2)<0||t+b>d}function Hb(e,t,r,u,l,d,b,k){const T=l*d/(2*u),j=e(t-T),$=e(t+T),G=e(r-(d/=2)),te=e(r+d);return b.outOfBounds(j,G,$,te)||b.getRange(j,G,$,te)||k&&k.getRange(j,G,$,te)}const _Z=[-1,-1,1,1],kZ=[-1,1,-1,1],EZ=["right","center","left"],CZ=["bottom","middle","top"];function yL(e,t,r,u,l,d,b,k,T,j,$,G){return!(l.outOfBounds(e,r,t,u)||(G&&d?d.getRange(e,r,t,u)||!function(te,se,he,ve,Be){return Be[0]<=te&&he<=Be[2]&&Be[3]<=se&&ve<=Be[5]}(b,T,k,j,$):l.getRange(e,r,t,u)))}const SZ={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},AZ={naive:function(e,t,r,u){const l=e.width,d=e.height;return function(b){const k=b.datum.datum.items[u].items,T=k.length,j=b.datum.fontSize,$=ou.width(b.datum,b.datum.text);let G,te,se,he,ve,Be,ze,Ue=0;for(let st=0;st<T;++st)G=k[st].x,se=k[st].y,ve=(G+(te=k[st].x2===void 0?G:k[st].x2))/2,Be=(se+(he=k[st].y2===void 0?se:k[st].y2))/2,(ze=Math.abs(te-G+he-se))>=Ue&&(Ue=ze,b.x=ve,b.y=Be);return ve=$/2,Be=j/2,G=b.x-ve,te=b.x+ve,se=b.y-Be,he=b.y+Be,b.align="center",G<0&&te<=l?b.align="left":0<=G&&l<te&&(b.align="right"),b.baseline="middle",se<0&&he<=d?b.baseline="top":0<=se&&d<he&&(b.baseline="bottom"),!0}},"reduced-search":function(e,t,r,u){const l=e.width,d=e.height,b=t[0],k=t[1];function T(j,$,G,te,se){const he=e.invert(j),ve=e.invert($);let Be,ze=G,Ue=d;if(!_O(he,ve,te,se,l,d)&&!Hb(e,he,ve,se,te,ze,b,k)&&!Hb(e,he,ve,se,te,se,b,null)){for(;Ue-ze>=1;)Hb(e,he,ve,se,te,Be=(ze+Ue)/2,b,k)?Ue=Be:ze=Be;if(ze>G)return[he,ve,ze,!0]}}return function(j){const $=j.datum.datum.items[u].items,G=$.length,te=j.datum.fontSize,se=ou.width(j.datum,
7830j.datum.text);let he,ve,Be,ze,Ue,st,ut,mt,pt,Ct,Et,mn,An,xn,Wn,Un,Kn,Qn=r?te:0,ir=!1,Nr=!1,Jr=0;for(let Lr=0;Lr<G;++Lr){for(he=$[Lr].x,Be=$[Lr].y,ve=$[Lr].x2===void 0?he:$[Lr].x2,ze=$[Lr].y2===void 0?Be:$[Lr].y2,he>ve&&(Kn=he,he=ve,ve=Kn),Be>ze&&(Kn=Be,Be=ze,ze=Kn),Ct=~~(((pt=e(he))+(Et=e(ve)))/2),An=~~(((mn=e(Be))+(xn=e(ze)))/2),ut=Ct;ut>=pt;--ut)for(mt=An;mt>=mn;--mt)(Un=T(ut,mt,Qn,se,te))&&([j.x,j.y,Qn,ir]=Un);for(ut=Ct;ut<=Et;++ut)for(mt=An;mt<=xn;++mt)(Un=T(ut,mt,Qn,se,te))&&([j.x,j.y,Qn,ir]=Un);ir||r||(Ue=(he+ve)/2,st=(Be+ze)/2,(Wn=Math.abs(ve-he+ze-Be))>=Jr&&!_O(Ue,st,se,te,l,d)&&!Hb(e,Ue,st,te,se,te,b,null)&&(Jr=Wn,j.x=Ue,j.y=st,Nr=!0))}return!(!ir&&!Nr||(Ue=se/2,st=te/2,b.setRange(e(j.x-Ue),e(j.y-st),e(j.x+Ue),e(j.y+st)),j.align="center",j.baseline="middle",0))}},floodfill:function(e,t,r,u){const l=e.width,d=e.height,b=t[0],k=t[1],T=e.bitmap();return function(j){const $=j.datum.datum.items[u].items,G=$.length,te=j.datum.fontSize,se=ou.width(j.datum,j.datum.text),he=[];let ve,Be,ze,Ue,st,ut,mt,pt,Ct,Et,mn,An,xn=r?te:0,Wn=!1,Un=!1,Kn=0;for(let Qn=0;Qn<G;++Qn){for(ve=$[Qn].x,ze=$[Qn].y,Be=$[Qn].x2===void 0?ve:$[Qn].x2,Ue=$[Qn].y2===void 0?ze:$[Qn].y2,he.push([e((ve+Be)/2),e((ze+Ue)/2)]);he.length;)if([mt,pt]=he.pop(),!(b.get(mt,pt)||k.get(mt,pt)||T.get(mt,pt))){T.set(mt,pt);for(let ir=0;ir<4;++ir)st=mt+_Z[ir],ut=pt+kZ[ir],T.outOfBounds(st,ut,st,ut)||he.push([st,ut]);if(st=e.invert(mt),ut=e.invert(pt),Ct=xn,Et=d,!_O(st,ut,se,te,l,d)&&!Hb(e,st,ut,te,se,Ct,b,k)&&!Hb(e,st,ut,te,se,te,b,null)){for(;Et-Ct>=1;)Hb(e,st,ut,te,se,mn=(Ct+Et)/2,b,k)?Et=mn:Ct=mn;Ct>xn&&(j.x=st,j.y=ut,xn=Ct,Wn=!0)}}Wn||r||(st=(ve+Be)/2,ut=(ze+Ue)/2,(An=Math.abs(Be-ve+Ue-ze))>=Kn&&!_O(st,ut,se,te,l,d)&&!Hb(e,st,ut,te,se,te,b,null)&&(Kn=An,j.x=st,j.y=ut,Un=!0))}return!(!Wn&&!Un||(st=se/2,ut=te/2,b.setRange(e(j.x-st),e(j.y-ut),e(j.x+st),e(j.y+ut)),j.align="center",j.baseline="middle",0))}}};function OZ(e,t,r,u,l,d,b,k,T,j,$){if(!e.length)return e;const G=Math.max(u.length,l.length),te=function(Ct,Et){const mn=new Float64Array(Et),An=Ct.length;for(let xn=0;xn<An;++xn)mn[xn]=Ct[xn]||0;for(let xn=An;xn<Et;++xn)mn[xn]=mn[An-1];return mn}(u,G),se=function(Ct,Et){const mn=new Int8Array(Et),An=Ct.length;for(let xn=0;xn<An;++xn)mn[xn]|=SZ[Ct[xn]];for(let xn=An;xn<Et;++xn)mn[xn]=mn[An-1];return mn}(l,G),he=function(Ct){return Ct&&Ct.mark&&Ct.mark.marktype}(e[0].datum),ve=he==="group"&&e[0].datum.items[T].marktype,Be=ve==="area",ze=function(Ct,Et,mn,An){const xn=Wn=>[Wn.x,Wn.x,Wn.x,Wn.y,Wn.y,Wn.y];return Ct?Ct==="line"||Ct==="area"?Wn=>xn(Wn.datum):Et==="line"?Wn=>{const Un=Wn.datum.items[An].items;return xn(Un.length?Un[mn==="start"?0:Un.length-1]:{x:NaN,y:NaN})}:Wn=>{const Un=Wn.datum.bounds;return[Un.x1,(Un.x1+Un.x2)/2,Un.x2,Un.y1,(Un.y1+Un.y2)/2,Un.y2]}:xn}(he,ve,k,T),Ue=wZ(t[0],t[1],j),st=Be&&$==="naive",ut=e.map(Ct=>({datum:Ct,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:ze(Ct)}));let mt;if(!st){r&&ut.sort((Et,mn)=>r(Et.datum,mn.datum));let Ct=!1;for(let Et=0;Et<se.length&&!Ct;++Et)Ct=se[Et]===5||te[Et]<0;he&&(b||Be)&&(d=[e.map(Et=>Et.datum)].concat(d)),mt=d.length?bZ(Ue,d,Ct,Be):function(Et,mn){const An=Et.bitmap();return(mn||[]).forEach(xn=>An.set(Et(xn.boundary[0]),Et(xn.boundary[3]))),[An,void 0]}(Ue,b&&ut)}const pt=Be?AZ[$](Ue,mt,b,T):function(Ct,Et,mn,An){const xn=Ct.width,Wn=Ct.height,Un=Et[0],Kn=Et[1],Qn=An.length;
7830return function(ir){const Nr=ir.boundary,Jr=ir.datum.fontSize;if(Nr[2]<0||Nr[5]<0||Nr[0]>xn||Nr[3]>Wn)return!1;let Lr,hi,Ri,Pi,so,Ui,ji,Yi,Go,Ra,uo,rs,is,Is,Tu,Nu=0;for(let uu=0;uu<Qn;++uu){if(Lr=(3&mn[uu])-1,hi=(mn[uu]>>>2&3)-1,Ri=Lr===0&&hi===0||An[uu]<0,Pi=Lr&&hi?Math.SQRT1_2:1,so=An[uu]<0?-1:1,Ui=Nr[1+Lr]+An[uu]*Lr*Pi,Yi=(uo=Nr[4+hi]+so*Jr*hi/2+An[uu]*hi*Pi)-Jr/2,Go=uo+Jr/2,rs=Ct(Ui),Is=Ct(Yi),Tu=Ct(Go),!Nu){if(!yL(rs,rs,Is,Tu,Un,Kn,Ui,Ui,Yi,Go,Nr,Ri))continue;Nu=ou.width(ir.datum,ir.datum.text)}if(ji=(Ra=Ui+so*Nu*Lr/2)+Nu/2,yL(rs=Ct(Ui=Ra-Nu/2),is=Ct(ji),Is,Tu,Un,Kn,Ui,ji,Yi,Go,Nr,Ri))return ir.x=Lr?Lr*so<0?ji:Ui:Ra,ir.y=hi?hi*so<0?Go:Yi:uo,ir.align=EZ[Lr*so+1],ir.baseline=CZ[hi*so+1],Un.setRange(rs,Is,is,Tu),!0}return!1}}(Ue,mt,se,te);return ut.forEach(Ct=>Ct.opacity=+pt(Ct)),ut}const UI=["x","y","opacity","align","baseline"],bL=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function WI(e){Wt.call(this,null,e)}function xL(e,t){var r,u,l,d,b,k,T=[],j=function($){return $(d)};if(t==null)T.push(e);else for(r={},u=0,l=e.length;u<l;++u)d=e[u],(k=r[b=t.map(j)])||(r[b]=k=[],k.dims=b,T.push(k)),k.push(d);return T}function VI(e){Wt.call(this,null,e)}WI.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:bL},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:UI.length,default:UI}]},Object(xe.z)(WI,Wt,{transform(e,t){const r=e.modified();if(!(r||t.changed(t.ADD_REM)||function(l){const d=e[l];return Object(xe.E)(d)&&t.modified(d.fields)}("sort")))return;e.size&&e.size.length===2||Object(xe.o)("Size parameter should be specified as a [width, height] array.");const u=e.as||UI;return OZ(t.materialize(t.SOURCE).source,e.size,e.sort,Object(xe.i)(e.offset||1),Object(xe.i)(e.anchor||bL),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||"end",e.markIndex||0,e.padding||0,e.method||"naive").forEach(l=>{const d=l.datum;d[u[0]]=l.x,d[u[1]]=l.y,d[u[2]]=l.opacity,d[u[3]]=l.align,d[u[4]]=l.baseline}),t.reflow(r).modifies(u)}}),VI.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},Object(xe.z)(VI,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const u=xL(t.materialize(t.SOURCE).source,e.groupby),l=(e.groupby||[]).map(xe.h),d=l.length,b=e.as||[Object(xe.h)(e.x),Object(xe.h)(e.y)],k=[];u.forEach(T=>{nh(T,e.x,e.y,e.bandwidth||.3).forEach(j=>{const $={};for(let G=0;G<d;++G)$[l[G]]=T.dims[G];$[b[0]]=j[0],$[b[1]]=j[1],k.push(Fn($))})}),this.value&&(r.rem=this.value),this.value=r.add=r.source=k}return r}});const $I={linear:Zs,log:ls,exp:xl,pow:rd,quad:wl,poly:vc};function HI(e){Wt.call(this,null,e)}HI.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys($I)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},Object(xe.z)(HI,Wt,{transform(e,t){const r=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const u=xL(t.materialize(t.SOURCE).source,e.groupby),l=(e.groupby||[]).map(xe.h),d=e.method||"linear",b=e.order||3,k=((te,se)=>te==="poly"?se:te==="quad"?2:1)(d,b),T=e.as||[Object(xe.h)(e.x),Object(xe.h)(e.y)],j=$I[d],$=[];let G=e.extent;Object(xe.w)($I,d)||Object(xe.o)("Invalid regression method: "+d),G!=null&&d==="log"&&G[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),G=null),u.forEach(te=>{if(te.length<=k)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const se=j(te,e.x,e.y,b);if(e.params)return void $.push(Fn({keys:te.dims,coef:se.coef,rSquared:se.rSquared}));const he=G||Object(xe.q)(te,e.x),ve=Be=>{const ze={};for(let Ue=0;Ue<l.length;++Ue)ze[l[Ue]]=te.dims[Ue];ze[T[0]]=Be[0],ze[T[1]]=Be[1],$.push(Fn(ze))};d==="linear"?he.forEach(Be=>
vendor: 9,710 bytes, line 7830
7830ve([Be,se.predict(Be)])):rh(se.predict,he,25,200).forEach(ve)}),this.value&&(r.rem=this.value),this.value=r.add=r.source=$}return r}});const wL=Math.pow(2,-52),kO=new Uint32Array(512);class EO{static from(t,r=function(l){return l[0]},u=function(l){return l[1]}){const l=t.length,d=new Float64Array(2*l);for(let b=0;b<l;b++){const k=t[b];d[2*b]=r(k),d[2*b+1]=u(k)}return new EO(d)}constructor(t){const r=t.length>>1;if(r>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const u=Math.max(2*r-5,0);this._triangles=new Uint32Array(3*u),this._halfedges=new Int32Array(3*u),this._hashSize=Math.ceil(Math.sqrt(r)),this._hullPrev=new Uint32Array(r),this._hullNext=new Uint32Array(r),this._hullTri=new Uint32Array(r),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(r),this._dists=new Float64Array(r),this.update()}update(){const{coords:t,_hullPrev:r,_hullNext:u,_hullTri:l,_hullHash:d}=this,b=t.length>>1;let k=1/0,T=1/0,j=-1/0,$=-1/0;for(let An=0;An<b;An++){const xn=t[2*An],Wn=t[2*An+1];xn<k&&(k=xn),Wn<T&&(T=Wn),xn>j&&(j=xn),Wn>$&&($=Wn),this._ids[An]=An}const G=(k+j)/2,te=(T+$)/2;let se,he,ve,Be=1/0;for(let An=0;An<b;An++){const xn=qI(G,te,t[2*An],t[2*An+1]);xn<Be&&(se=An,Be=xn)}const ze=t[2*se],Ue=t[2*se+1];Be=1/0;for(let An=0;An<b;An++){if(An===se)continue;const xn=qI(ze,Ue,t[2*An],t[2*An+1]);xn<Be&&xn>0&&(he=An,Be=xn)}let st=t[2*he],ut=t[2*he+1],mt=1/0;for(let An=0;An<b;An++){if(An===se||An===he)continue;const xn=TZ(ze,Ue,st,ut,t[2*An],t[2*An+1]);xn<mt&&(ve=An,mt=xn)}let pt=t[2*ve],Ct=t[2*ve+1];if(mt===1/0){for(let Wn=0;Wn<b;Wn++)this._dists[Wn]=t[2*Wn]-t[0]||t[2*Wn+1]-t[1];f_(this._ids,this._dists,0,b-1);const An=new Uint32Array(b);let xn=0;for(let Wn=0,Un=-1/0;Wn<b;Wn++){const Kn=this._ids[Wn];this._dists[Kn]>Un&&(An[xn++]=Kn,Un=this._dists[Kn])}return this.hull=An.subarray(0,xn),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(CO(ze,Ue,st,ut,pt,Ct)){const An=he,xn=st,Wn=ut;he=ve,st=pt,ut=Ct,ve=An,pt=xn,Ct=Wn}const Et=function(An,xn,Wn,Un,Kn,Qn){const ir=Wn-An,Nr=Un-xn,Jr=Kn-An,Lr=Qn-xn,hi=ir*ir+Nr*Nr,Ri=Jr*Jr+Lr*Lr,Pi=.5/(ir*Lr-Nr*Jr);return{x:An+(Lr*hi-Nr*Ri)*Pi,y:xn+(ir*Ri-Jr*hi)*Pi}}(ze,Ue,st,ut,pt,Ct);this._cx=Et.x,this._cy=Et.y;for(let An=0;An<b;An++)this._dists[An]=qI(t[2*An],t[2*An+1],Et.x,Et.y);f_(this._ids,this._dists,0,b-1),this._hullStart=se;let mn=3;u[se]=r[ve]=he,u[he]=r[se]=ve,u[ve]=r[he]=se,l[se]=0,l[he]=1,l[ve]=2,d.fill(-1),d[this._hashKey(ze,Ue)]=se,d[this._hashKey(st,ut)]=he,d[this._hashKey(pt,Ct)]=ve,this.trianglesLen=0,this._addTriangle(se,he,ve,-1,-1,-1);for(let An,xn,Wn=0;Wn<this._ids.length;Wn++){const Un=this._ids[Wn],Kn=t[2*Un],Qn=t[2*Un+1];if(Wn>0&&Math.abs(Kn-An)<=wL&&Math.abs(Qn-xn)<=wL||(An=Kn,xn=Qn,Un===se||Un===he||Un===ve))continue;let ir=0;for(let Ri=0,Pi=this._hashKey(Kn,Qn);Ri<this._hashSize&&((ir=d[(Pi+Ri)%this._hashSize])===-1||ir===u[ir]);Ri++);let Nr,Jr=ir=r[ir];for(;Nr=u[Jr],!CO(Kn,Qn,t[2*Jr],t[2*Jr+1],t[2*Nr],t[2*Nr+1]);)if((Jr=Nr)===ir){Jr=-1;break}if(Jr===-1)continue;let Lr=this._addTriangle(Jr,Un,u[Jr],-1,-1,l[Jr]);l[Un]=this._legalize(Lr+2),l[Jr]=Lr,mn++;let hi=u[Jr];for(;Nr=u[hi],CO(Kn,Qn,t[2*hi],t[2*hi+1],t[2*Nr],t[2*Nr+1]);)Lr=this._addTriangle(hi,Un,Nr,l[Un],-1,l[hi]),l[Un]=this._legalize(Lr+2),u[hi]=hi,mn--,hi=Nr;if(Jr===ir)for(;CO(Kn,Qn,t[2*(Nr=r[Jr])],t[2*Nr+1],t[2*Jr],t[2*Jr+1]);)Lr=this._addTriangle(Nr,Un,Jr,-1,l[Jr],l[Nr]),this._legalize(Lr+2),l[Nr]=Lr,u[Jr]=Jr,mn--,Jr=Nr;this._hullStart=r[Un]=Jr,u[Jr]=r[hi]=Un,u[Un]=hi,d[this._hashKey(Kn,Qn)]=Un,d[this._hashKey(t[2*Jr],t[2*Jr+1])]=Jr}this.hull=new Uint32Array(mn);for(let An=0,xn=this._hullStart;An<mn;An++)this.hull[An]=xn,xn=u[xn];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,r){return Math.floor(function(u,l){const d=u/(Math.abs(u)+Math.abs(l));return(l>0?3-d:1+d)/4}(t-this._cx,r-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:r,_halfedges:u,coords:l}=this;let d=0,b=0;for(;;){const k=u[t],T=t-t%3;if(b=T+(t+2)%3,k===-1){if(d===0)break;t=kO[--d];continue}const j=k-k%3,$=T+(t+1)%3,G=j+(k+2)%3,te=r[b],se=r[t],he=r[$],ve=r[G];if(DZ(l[2*te],l[2*te+1],l[2*se],l[2*se+1],l[2*he],l[2*he+1],l[2*ve],l[2*ve+1])){r[t]=ve,r[k]=te;const Be=u[G];if(Be===-1){let Ue=this._hullStart;do{if(this._hullTri[Ue]===G){this._hullTri[Ue]=t;break}Ue=this._hullPrev[Ue]}while(Ue!==this._hullStart)}this._link(t,Be),this._link(k,u[b]),this._link(b,G);const ze=j+(k+1)%3;d<kO.length&&(kO[d++]=ze)}else{if(d===0)break;t=kO[--d]}}return b}_link(t,r){this._halfedges[t]=r,r!==-1&&(this._halfedges[r]=t)}_addTriangle(t,r,u,l,d,b){const k=this.trianglesLen;return this._triangles[k]=t,this._triangles[k+1]=r,this._triangles[k+2]=u,this._link(k,l),this._link(k+1,d),this._link(k+2,b),this.trianglesLen+=3,k}}function qI(e,t,r,u){const l=e-r,d=t-u;return l*l+d*d}function GI(e,t,r,u,l,d){const b=(u-t)*(l-e),k=(r-e)*(d-t);return Math.abs(b-k)>=33306690738754716e-32*Math.abs(b+k)?b-k:0}function CO(e,t,r,u,l,d){return(GI(l,d,e,t,r,u)||GI(e,t,r,u,l,d)||GI(r,u,l,d,e,t))<0}function DZ(e,t,r,u,l,d,b,k){const T=e-b,j=t-k,$=r-b,G=u-k,te=l-b,se=d-k,he=$*$+G*G,ve=te*te+se*se;return T*(G*ve-he*se)-j*($*ve-he*te)+(T*T+j*j)*($*se-G*te)<0}function TZ(e,t,r,u,l,d){const b=r-e,k=u-t,T=l-e,j=d-t,$=b*b+k*k,G=T*T+j*j,te=.5/(b*j-k*T),se=(j*$-k*G)*te,he=(b*G-T*$)*te;return se*se+he*he}function f_(e,t,r,u){if(u-r<=20)for(let l=r+1;l<=u;l++){const d=e[l],b=t[d];let k=l-1;for(;k>=r&&t[e[k]]>b;)e[k+1]=e[k--];e[k+1]=d}else{let l=r+1,d=u;SE(e,r+u>>1,l),t[e[r]]>t[e[u]]&&SE(e,r,u),t[e[l]]>t[e[u]]&&SE(e,l,u),t[e[r]]>t[e[l]]&&SE(e,r,l);const b=e[l],k=t[b];for(;;){do l++;while(t[e[l]]<k);do d--;while(t[e[d]]>k);if(d<l)break;SE(e,l,d)}e[r+1]=e[d],e[d]=b,u-l+1>=d-r?(f_(e,t,l,u),f_(e,t,r,d-1)):(f_(e,t,r,d-1),f_(e,t,l,u))}}function SE(e,t,r){const u=e[t];e[t]=e[r],e[r]=u}const _L=1e-6;class pw{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,r){this._+=`L${this._x1=+t},${this._y1=+r}`}arc(t,r,u){const l=(t=+t)+(u=+u),d=r=+r;if(u<0)throw new Error("negative radius");this._x1===null?this._+=`M${l},${d}`:(Math.abs(this._x1-l)>_L||Math.abs(this._y1-d)>_L)&&(this._+="L"+l+","+d),u&&(this._+=`A${u},${u},0,1,1,${t-u},${r}A${u},${u},0,1,1,${this._x1=l},${this._y1=d}`)}rect(t,r,u,l){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${+u}v${+l}h${-u}Z`}value(){return this._||null}}class KI{constructor(){this._=[]}moveTo(t,r){this._.push([t,r])}closePath(){this._.push(this._[0].slice())}lineTo(t,r){this._.push([t,r])}value(){return this._.length?this._:null}}class NZ{constructor(t,[r,u,l,d]=[0,0,960,500]){if(!((l=+l)>=(r=+r)&&(d=+d)>=(u=+u)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=l,this.xmin=r,this.ymax=d,this.ymin=u,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:r,triangles:u},vectors:l}=this,d=this.circumcenters=this._circumcenters.subarray(0,u.length/3*2);for(let se,he,ve=0,Be=0,ze=u.length;ve<ze;ve+=3,Be+=2){const Ue=2*u[ve],st=2*u[ve+1],ut=2*u[ve+2],mt=t[Ue],pt=t[Ue+1],Ct=t[st],Et=t[st+1],mn=t[ut],An=t[ut+1],xn=Ct-mt,Wn=Et-pt,Un=mn-mt,Kn=An-pt,Qn=xn*xn+Wn*Wn,ir=Un*Un+Kn*Kn,Nr=2*(xn*Kn-Wn*Un);if(Nr)if(Math.abs(Nr)<1e-8)se=(mt+mn)/2,he=(pt+An)/2;else{const Jr=1/Nr;se=mt+(Kn*Qn-Wn*ir)*Jr,he=pt+(xn*ir-Un*Qn)*Jr}else se=(mt+mn)/2-1e8*Kn,he=(pt+An)/2+1e8*Un;d[Be]=se,d[Be+1]=he}let b,k,T,j=r[r.length-1],$=4*j,G=t[2*j],te=t[2*j+1];l.fill(0);for(let se=0;se<r.length;++se)b=$,k=G,T=te,$=4*(j=r[se]),G=t[2*j],te=t[2*j+1],l[b+2]=l[$]=T-te,l[b+3]=l[$+1]=G-k}render(t){const r=t==null?t=new pw:void 0,{delaunay:{halfedges:u,inedges:l,hull:d},circumcenters:b,vectors:k}=this;if(d.length<=1)return null;for(let $=0,G=u.length;$<G;++$){const te=u[$];if(te<$)continue;const se=2*Math.floor($/3),he=2*Math.floor(te/3),ve=b[se],Be=b[se+1],ze=b[he],Ue=b[he+1];this._renderSegment(ve,Be,ze,Ue,t)}let T,j=d[d.length-1];for(let $=0;$<d.length;++$){T=j,j=d[$];const G=2*Math.floor(l[j]/3),te=b[G],se=b[G+1],he=4*T,ve=this._project(te,se,k[he+2],k[he+3]);ve&&this._renderSegment(te,se,ve[0],ve[1],t)}return r&&r.value()}renderBounds(t){const r=t==null?t=new pw:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),r&&r.value()}renderCell(t,r){const u=r==null?r=new pw:void 0,l=this._clip(t);if(l===null||!l.length)return;r.moveTo(l[0],l[1]);let d=l.length;for(;l[0]===l[d-2]&&l[1]===l[d-1]&&d>1;)d-=2;for(let b=2;b<d;b+=2)l[b]===l[b-2]&&l[b+1]===l[b-1]||r.lineTo(l[b],l[b+1]);return r.closePath(),u&&u.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let r=0,u=t.length/2;r<u;++r){const l=this.cellPolygon(r);l&&(l.index=r,yield l)}}cellPolygon(t){const r=new KI;return this.renderCell(t,r),r.value()}_renderSegment(t,r,u,l,d){let b;const k=this._regioncode(t,r),T=this._regioncode(u,l);k===0&&T===0?(d.moveTo(t,r),d.lineTo(u,l)):(b=this._clipSegment(t,r,u,l,k,T))&&(d.moveTo(b[0],b[1]),d.lineTo(b[2],b[3]))}contains(t,r,u){return(r=+r)==r&&(u=+u)==u&&this.delaunay._step(t,r,u)===t}*neighbors(t){const r=this._clip(t);if(r)for(const u of this.delaunay.neighbors(t)){const l=this._clip(u);if(l){e:for(let d=0,b=r.length;d<b;d+=2)for(let k=0,T=l.length;k<T;k+=2)if(r[d]==l[k]&&r[d+1]==l[k+1]&&r[(d+2)%b]==l[(k+T-2)%T]&&r[(d+3)%b]==l[(k+T-1)%T]){yield u;break e}}}}_cell(t){const{circumcenters:r,delaunay:{inedges:u,halfedges:l,triangles:d}}=this,b=u[t];if(b===-1)return null;
7830const k=[];let T=b;do{const j=Math.floor(T/3);if(k.push(r[2*j],r[2*j+1]),d[T=T%3==2?T-2:T+1]!==t)break;T=l[T]}while(T!==b&&T!==-1);return k}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const r=this._cell(t);if(r===null)return null;const{vectors:u}=this,l=4*t;return u[l]||u[l+1]?this._clipInfinite(t,r,u[l],u[l+1],u[l+2],u[l+3]):this._clipFinite(t,r)}_clipFinite(t,r){const u=r.length;let l,d,b,k,T,j=null,$=r[u-2],G=r[u-1],te=this._regioncode($,G);for(let se=0;se<u;se+=2)if(l=$,d=G,$=r[se],G=r[se+1],b=te,te=this._regioncode($,G),b===0&&te===0)k=T,T=0,j?j.push($,G):j=[$,G];else{let he,ve,Be,ze,Ue;if(b===0){if((he=this._clipSegment(l,d,$,G,b,te))===null)continue;[ve,Be,ze,Ue]=he}else{if((he=this._clipSegment($,G,l,d,te,b))===null)continue;[ze,Ue,ve,Be]=he,k=T,T=this._edgecode(ve,Be),k&&T&&this._edge(t,k,T,j,j.length),j?j.push(ve,Be):j=[ve,Be]}k=T,T=this._edgecode(ze,Ue),k&&T&&this._edge(t,k,T,j,j.length),j?j.push(ze,Ue):j=[ze,Ue]}if(j)k=T,T=this._edgecode(j[0],j[1]),k&&T&&this._edge(t,k,T,j,j.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return j}_clipSegment(t,r,u,l,d,b){for(;;){if(d===0&&b===0)return[t,r,u,l];
vendor: 4,642 bytes, line 7830
7830if(d&b)return null;let k,T,j=d||b;8&j?(k=t+(u-t)*(this.ymax-r)/(l-r),T=this.ymax):4&j?(k=t+(u-t)*(this.ymin-r)/(l-r),T=this.ymin):2&j?(T=r+(l-r)*(this.xmax-t)/(u-t),k=this.xmax):(T=r+(l-r)*(this.xmin-t)/(u-t),k=this.xmin),d?(t=k,r=T,d=this._regioncode(t,r)):(u=k,l=T,b=this._regioncode(u,l))}}_clipInfinite(t,r,u,l,d,b){let k,T=Array.from(r);if((k=this._project(T[0],T[1],u,l))&&T.unshift(k[0],k[1]),(k=this._project(T[T.length-2],T[T.length-1],d,b))&&T.push(k[0],k[1]),T=this._clipFinite(t,T))for(let j,$=0,G=T.length,te=this._edgecode(T[G-2],T[G-1]);$<G;$+=2)j=te,te=this._edgecode(T[$],T[$+1]),j&&te&&($=this._edge(t,j,te,T,$),G=T.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(T=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return T}_edge(t,r,u,l,d){for(;r!==u;){let b,k;switch(r){case 5:r=4;continue;case 4:r=6,b=this.xmax,k=this.ymin;break;case 6:r=2;continue;case 2:r=10,b=this.xmax,k=this.ymax;break;case 10:r=8;continue;case 8:r=9,b=this.xmin,k=this.ymax;break;case 9:r=1;continue;case 1:r=5,b=this.xmin,k=this.ymin}l[d]===b&&l[d+1]===k||!this.contains(t,b,k)||(l.splice(d,0,b,k),d+=2)}if(l.length>4)for(let b=0;b<l.length;b+=2){const k=(b+2)%l.length,T=(b+4)%l.length;(l[b]===l[k]&&l[k]===l[T]||l[b+1]===l[k+1]&&l[k+1]===l[T+1])&&(l.splice(k,2),b-=2)}return d}_project(t,r,u,l){let d,b,k,T=1/0;if(l<0){if(r<=this.ymin)return null;(d=(this.ymin-r)/l)<T&&(k=this.ymin,b=t+(T=d)*u)}else if(l>0){if(r>=this.ymax)return null;(d=(this.ymax-r)/l)<T&&(k=this.ymax,b=t+(T=d)*u)}if(u>0){if(t>=this.xmax)return null;(d=(this.xmax-t)/u)<T&&(b=this.xmax,k=r+(T=d)*l)}else if(u<0){if(t<=this.xmin)return null;(d=(this.xmin-t)/u)<T&&(b=this.xmin,k=r+(T=d)*l)}return[b,k]}_edgecode(t,r){return(t===this.xmin?1:t===this.xmax?2:0)|(r===this.ymin?4:r===this.ymax?8:0)}_regioncode(t,r){return(t<this.xmin?1:t>this.xmax?2:0)|(r<this.ymin?4:r>this.ymax?8:0)}}const IZ=2*Math.PI,d_=Math.pow;function MZ(e,t,r){return[e+Math.sin(e+t)*r,t+Math.cos(e-t)*r]}class YI{static from(t,r=function(d){return d[0]},u=function(d){return d[1]},l){return new YI("length"in t?function(d,b,k,T){const j=d.length,$=new Float64Array(2*j);for(let G=0;G<j;++G){const te=d[G];$[2*G]=b.call(T,te,G,d),$[2*G+1]=k.call(T,te,G,d)}return $}(t,r,u,l):Float64Array.from(function*(d,b,k,T){let j=0;for(const $ of d)yield b.call(T,$,j,d),yield k.call(T,$,j,d),++j}(t,r,u,l)))}constructor(t){this._delaunator=new EO(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,r=this.points;if(t.hull&&t.hull.length>2&&function(T){const{triangles:j,coords:$}=T;for(let G=0;G<j.length;G+=3){const te=2*j[G],se=2*j[G+1],he=2*j[G+2];if(($[he]-$[te])*($[se+1]-$[te+1])-($[se]-$[te])*($[he+1]-$[te+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:r.length/2},(te,se)=>se).sort((te,se)=>r[2*te]-r[2*se]||r[2*te+1]-r[2*se+1]);const T=this.collinear[0],j=this.collinear[this.collinear.length-1],$=[r[2*T],r[2*T+1],r[2*j],r[2*j+1]],G=1e-8*Math.hypot($[3]-$[1],$[2]-$[0]);for(let te=0,se=r.length/2;te<se;++te){const he=MZ(r[2*te],r[2*te+1],G);r[2*te]=he[0],r[2*te+1]=he[1]}this._delaunator=new EO(r)}else delete this.collinear;const u=this.halfedges=this._delaunator.halfedges,l=this.hull=this._delaunator.hull,d=this.triangles=this._delaunator.triangles,b=this.inedges.fill(-1),k=this._hullIndex.fill(-1);for(let T=0,j=u.length;T<j;++T){const $=d[T%3==2?T-2:T+1];u[T]!==-1&&b[$]!==-1||(b[$]=T)}for(let T=0,j=l.length;T<j;++T)k[l[T]]=T;l.length<=2&&l.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=l[0],this.triangles[1]=l[1],this.triangles[2]=l[1],b[l[0]]=1,l.length===2&&(b[l[1]]=0))}voronoi(t){return new NZ(this,t)}*neighbors(t){const{inedges:r,hull:u,_hullIndex:l,halfedges:d,triangles:b,collinear:k}=this;if(k){const G=k.indexOf(t);return G>0&&(yield k[G-1]),void(G<k.length-1&&(yield k[G+1]))}const T=r[t];if(T===-1)return;let j=T,$=-1;do{if(yield $=b[j],b[j=j%3==2?j-2:j+1]!==t)return;if((j=d[j])===-1){const G=u[(l[t]+1)%u.length];return void(G!==$&&(yield G))}}while(j!==T)}find(t,r,u=0){if((t=+t)!=t||(r=+r)!=r)return-1;const l=u;let d;for(;(d=this._step(u,t,r))>=0&&d!==u&&d!==l;)u=d;return d}_step(t,r,u){const{inedges:l,hull:d,_hullIndex:b,halfedges:k,triangles:T,points:j}=this;if(l[t]===-1||!j.length)return(t+1)%(j.length>>1);let $=t,G=d_(r-j[2*t],2)+d_(u-j[2*t+1],2);const te=l[t];let se=te;do{let he=T[se];const ve=d_(r-j[2*he],2)+d_(u-j[2*he+1],2);
vendor: 16,800 bytes, line 7830
7830if(ve<G&&(G=ve,$=he),T[se=se%3==2?se-2:se+1]!==t)break;if((se=k[se])===-1){if((se=d[(b[t]+1)%d.length])!==he&&d_(r-j[2*se],2)+d_(u-j[2*se+1],2)<G)return se;break}}while(se!==te);return $}render(t){const r=t==null?t=new pw:void 0,{points:u,halfedges:l,triangles:d}=this;for(let b=0,k=l.length;b<k;++b){const T=l[b];if(T<b)continue;const j=2*d[b],$=2*d[T];t.moveTo(u[j],u[j+1]),t.lineTo(u[$],u[$+1])}return this.renderHull(t),r&&r.value()}renderPoints(t,r=2){const u=t==null?t=new pw:void 0,{points:l}=this;for(let d=0,b=l.length;d<b;d+=2){const k=l[d],T=l[d+1];t.moveTo(k+r,T),t.arc(k,T,r,0,IZ)}return u&&u.value()}renderHull(t){const r=t==null?t=new pw:void 0,{hull:u,points:l}=this,d=2*u[0],b=u.length;t.moveTo(l[d],l[d+1]);for(let k=1;k<b;++k){const T=2*u[k];t.lineTo(l[T],l[T+1])}return t.closePath(),r&&r.value()}hullPolygon(){const t=new KI;return this.renderHull(t),t.value()}renderTriangle(t,r){const u=r==null?r=new pw:void 0,{points:l,triangles:d}=this,b=2*d[t*=3],k=2*d[t+1],T=2*d[t+2];return r.moveTo(l[b],l[b+1]),r.lineTo(l[k],l[k+1]),r.lineTo(l[T],l[T+1]),r.closePath(),u&&u.value()}*trianglePolygons(){const{triangles:t}=this;for(let r=0,u=t.length/3;r<u;++r)yield this.trianglePolygon(r)}trianglePolygon(t){const r=new KI;return this.renderTriangle(t,r),r.value()}}function XI(e){Wt.call(this,null,e)}XI.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const FZ=[-1e5,-1e5,1e5,1e5];function RZ(e){const t=e[0][0],r=e[0][1];let u=e.length-1;for(;e[u][0]===t&&e[u][1]===r;--u);return"M"+e.slice(0,u+1).join("L")+"Z"}Object(xe.z)(XI,Wt,{transform(e,t){const r=e.as||"path",u=t.source;if(!u||!u.length)return t;let l=e.size;l=l?[0,0,l[0],l[1]]:(l=e.extent)?[l[0][0],l[0][1],l[1][0],l[1][1]]:FZ;const d=this.value=YI.from(u,e.x,e.y).voronoi(l);for(let b=0,k=u.length;b<k;++b){const T=d.cellPolygon(b);u[b][r]=T?RZ(T):null}return t.reflow(e.modified()).modifies(r)}});var JI=Math.PI/180,AE=64,SO=2048;function BZ(){var e,t,r,u,l,d,b,k=[256,256],T=kL,j=[],$=Math.random,G={};function te(se,he,ve){for(var Be,ze,Ue,st=he.x,ut=he.y,mt=Math.sqrt(k[0]*k[0]+k[1]*k[1]),pt=T(k),Ct=$()<.5?1:-1,Et=-Ct;(Be=pt(Et+=Ct))&&(ze=~~Be[0],Ue=~~Be[1],!(Math.min(Math.abs(ze),Math.abs(Ue))>=mt));)if(he.x=st+ze,he.y=ut+Ue,!(he.x+he.x0<0||he.y+he.y0<0||he.x+he.x1>k[0]||he.y+he.y1>k[1])&&(!ve||!jZ(he,se,k[0]))&&(!ve||zZ(he,ve))){for(var mn,An=he.sprite,xn=he.width>>5,Wn=k[0]>>5,Un=he.x-(xn<<4),Kn=127&Un,Qn=32-Kn,ir=he.y1-he.y0,Nr=(he.y+he.y0)*Wn+(Un>>5),Jr=0;Jr<ir;Jr++){mn=0;for(var Lr=0;Lr<=xn;Lr++)se[Nr+Lr]|=mn<<Qn|(Lr<xn?(mn=An[Jr*xn+Lr])>>>Kn:0);Nr+=Wn}return he.sprite=null,!0}return!1}return G.layout=function(){for(var se=function(mt){mt.width=mt.height=1;var pt=Math.sqrt(mt.getContext("2d").getImageData(0,0,1,1).data.length>>2);mt.width=(AE<<5)/pt,mt.height=SO/pt;var Ct=mt.getContext("2d");return Ct.fillStyle=Ct.strokeStyle="red",Ct.textAlign="center",{context:Ct,ratio:pt}}(Gu()),he=function(mt){for(var pt=[],Ct=-1;++Ct<mt;)pt[Ct]=0;return pt}((k[0]>>5)*k[1]),ve=null,Be=j.length,ze=-1,Ue=[],st=j.map(mt=>({text:e(mt),font:t(mt),style:u(mt),weight:l(mt),rotate:d(mt),size:~~(r(mt)+1e-14),padding:b(mt),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:mt})).sort((mt,pt)=>pt.size-mt.size);++ze<Be;){var ut=st[ze];ut.x=k[0]*($()+.5)>>1,ut.y=k[1]*($()+.5)>>1,PZ(se,ut,st,ze),ut.hasText&&te(he,ut,ve)&&(Ue.push(ut),ve?LZ(ve,ut):ve=[{x:ut.x+ut.x0,y:ut.y+ut.y0},{x:ut.x+ut.x1,y:ut.y+ut.y1}],ut.x-=k[0]>>1,ut.y-=k[1]>>1)}return Ue},G.words=function(se){return arguments.length?(j=se,G):j},G.size=function(se){return arguments.length?(k=[+se[0],+se[1]],G):k},G.font=function(se){return arguments.length?(t=mw(se),G):t},G.fontStyle=function(se){return arguments.length?(u=mw(se),G):u},G.fontWeight=function(se){return arguments.length?(l=mw(se),G):l},G.rotate=function(se){return arguments.length?(d=mw(se),G):d},G.text=function(se){return arguments.length?(e=mw(se),G):e},G.spiral=function(se){return arguments.length?(T=UZ[se]||se,G):T},G.fontSize=function(se){return arguments.length?(r=mw(se),G):r},G.padding=function(se){return arguments.length?(b=mw(se),G):b},G.random=function(se){return arguments.length?($=se,G):$},G}function PZ(e,t,r,u){if(!t.sprite){var l=e.context,d=e.ratio;l.clearRect(0,0,(AE<<5)/d,SO/d);var b,k,T,j,$,G=0,te=0,se=0,he=r.length;for(--u;++u<he;){if(t=r[u],l.save(),l.font=t.style+" "+t.weight+" "+~~((t.size+1)/d)+"px "+t.font,b=l.measureText(t.text+"m").width*d,T=t.size<<1,t.rotate){var ve=Math.sin(t.rotate*JI),Be=Math.cos(t.rotate*JI),ze=b*Be,Ue=b*ve,st=T*Be,ut=T*ve;b=Math.max(Math.abs(ze+ut),Math.abs(ze-ut))+31>>5<<5,T=~~Math.max(Math.abs(Ue+st),Math.abs(Ue-st))}else b=b+31>>5<<5;if(T>se&&(se=T),G+b>=AE<<5&&(G=0,te+=se,se=0),te+T>=SO)break;l.translate((G+(b>>1))/d,(te+(T>>1))/d),t.rotate&&l.rotate(t.rotate*JI),l.fillText(t.text,0,0),t.padding&&(l.lineWidth=2*t.padding,l.strokeText(t.text,0,0)),l.restore(),t.width=b,t.height=T,t.xoff=G,t.yoff=te,t.x1=b>>1,t.y1=T>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,G+=b}for(var mt=l.getImageData(0,0,(AE<<5)/d,SO/d).data,pt=[];--u>=0;)if((t=r[u]).hasText){for(k=(b=t.width)>>5,T=t.y1-t.y0,j=0;j<T*k;j++)pt[j]=0;if((G=t.xoff)==null)return;te=t.yoff;var Ct=0,Et=-1;for($=0;$<T;$++){for(j=0;j<b;j++){var mn=k*$+(j>>5),An=mt[(te+$)*(AE<<5)+(G+j)<<2]?1<<31-j%32:0;pt[mn]|=An,Ct|=An}Ct?Et=$:(t.y0++,T--,$--,te++)}t.y1=t.y0+Et,t.sprite=pt.slice(0,(t.y1-t.y0)*k)}}}function jZ(e,t,r){r>>=5;for(var u,l=e.sprite,d=e.width>>5,b=e.x-(d<<4),k=127&b,T=32-k,j=e.y1-e.y0,$=(e.y+e.y0)*r+(b>>5),G=0;G<j;G++){u=0;for(var te=0;te<=d;te++)if((u<<T|(te<d?(u=l[G*d+te])>>>k:0))&t[$+te])return!0;$+=r}return!1}function LZ(e,t){var r=e[0],u=e[1];t.x+t.x0<r.x&&(r.x=t.x+t.x0),t.y+t.y0<r.y&&(r.y=t.y+t.y0),t.x+t.x1>u.x&&(u.x=t.x+t.x1),t.y+t.y1>u.y&&(u.y=t.y+t.y1)}function zZ(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function kL(e){var t=e[0]/e[1];return function(r){return[t*(r*=.1)*Math.cos(r),r*Math.sin(r)]}}function mw(e){return typeof e=="function"?e:function(){return e}}var UZ={archimedean:kL,rectangular:function(e){var t=4*e[0]/e[1],r=0,u=0;return function(l){var d=l<0?-1:1;switch(Math.sqrt(1+4*d*l)-d&3){case 0:r+=t;break;case 1:u+=4;break;case 2:r-=t;break;default:u-=4}return[r,u]}}};const EL=["x","y","font","fontSize","fontStyle","fontWeight","angle"],WZ=["text","font","rotate","fontSize","fontStyle","fontWeight"];function QI(e){Wt.call(this,BZ(),e)}QI.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:EL}]},Object(xe.z)(QI,Wt,{transform(e,t){!e.size||e.size[0]&&e.size[1]||Object(xe.o)("Wordcloud size dimensions must be non-zero.");const r=e.modified();if(!(r||t.changed(t.ADD_REM)||WZ.some(function(se){const he=e[se];return Object(xe.E)(he)&&t.modified(he.fields)})))return;const u=t.materialize(t.SOURCE).source,l=this.value,d=e.as||EL;let b,k=e.fontSize||14;if(Object(xe.E)(k)?b=e.fontSizeRange:k=Object(xe.m)(k),b){const se=k,he=da("sqrt")().domain(Object(xe.q)(u,se)).range(b);k=ve=>he(se(ve))}u.forEach(se=>{se[d[0]]=NaN,se[d[1]]=NaN,se[d[3]]=0});const T=l.words(u).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(k).random(Hn).layout(),j=l.size(),$=j[0]>>1,G=j[1]>>1,te=T.length;for(let se,he,ve=0;ve<te;++ve)(he=(se=T[ve]).datum)[d[0]]=se.x+$,he[d[1]]=se.y+G,he[d[2]]=se.font,he[d[3]]=se.size,he[d[4]]=se.style,he[d[5]]=se.weight,he[d[6]]=se.rotate;return t.reflow(r).modifies(d)}});var VZ=function(e,t){return Array.from(t,r=>e[r])};const $Z=e=>new Uint8Array(e),HZ=e=>new Uint16Array(e),OE=e=>new Uint32Array(e);function AO(e,t,r){const u=(t<257?$Z:t<65537?HZ:OE)(e);return r&&u.set(r),u}function CL(e,t,r){const u=1<<t;return{one:u,zero:~u,range:r.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(l,d){const b=this.bisect(this.range,l.value),k=l.index,T=b[0],j=b[1],$=k.length;let G;for(G=0;G<T;++G)d[k[G]]|=u;for(G=j;G<$;++G)d[k[G]]|=u;return this}}}function SL(){let e=OE(0),t=[],r=0;return{insert:function(u,l,d){if(!l.length)return[];const b=r,k=l.length,T=OE(k);let j,$,G,te=Array(k);for(G=0;G<k;++G)te[G]=u(l[G]),T[G]=G;if(te=function(se,he){return se.sort.call(he,(ve,Be)=>{const ze=se[ve],Ue=se[Be];return ze<Ue?-1:ze>Ue?1:0}),VZ(se,he)}(te,T),b)j=t,$=e,t=Array(b+k),e=OE(b+k),function(se,he,ve,Be,ze,Ue,st,ut,mt){let pt,Ct=0,Et=0;for(pt=0;Ct<Be&&Et<st;++pt)he[Ct]<ze[Et]?(ut[pt]=he[Ct],mt[pt]=ve[Ct++]):(ut[pt]=ze[Et],mt[pt]=Ue[Et++]+se);for(;Ct<Be;++Ct,++pt)ut[pt]=he[Ct],mt[pt]=ve[Ct];for(;Et<st;++Et,++pt)ut[pt]=ze[Et],mt[pt]=Ue[Et]+se}(d,j,$,b,te,T,k,t,e);else{if(d>0)for(G=0;G<k;++G)T[G]+=d;t=te,e=T}return r=b+k,{index:T,value:te}},remove:function(u,l){const d=r;let b,k,T;for(k=0;!l[e[k]]&&k<d;++k);for(T=k;k<d;++k)l[b=e[k]]||(e[T]=b,t[T]=t[k],++T);r=d-u},bisect:function(u,l){let d;return l?d=l.length:(l=t,d=r),[nu(l,u[0],0,d),ps(l,u[1],0,d)]},reindex:function(u){for(let l=0,d=r;l<d;++l)e[l]=u[e[l]]},index:()=>e,size:()=>r}}function ZI(e){Wt.call(this,function(){let t=8,r=[],u=OE(0),l=AO(0,t),d=AO(0,t);return{data:()=>r,seen:()=>u=function(b,k,T){return b.length>=k?b:((T=T||new b.constructor(k)).set(b),T)}(u,r.length),add(b){for(let k,T=0,j=r.length,$=b.length;T<$;++T)(k=b[T])._index=j++,r.push(k)},remove(b,k){const T=r.length,j=Array(T-b),$=r;let G,te,se;for(te=0;!k[te]&&te<T;++te)j[te]=r[te],$[te]=te;for(se=te;te<T;++te)G=r[te],k[te]?$[te]=-1:($[te]=se,l[se]=l[te],d[se]=d[te],j[se]=G,G._index=se++),l[te]=0;return r=j,$},size:()=>r.length,curr:()=>l,prev:()=>d,reset:b=>d[b]=l[b],all:()=>t<257?255:t<65537?65535:4294967295,set(b,k){l[b]|=k},clear(b,k){l[b]&=~k},resize(b,k){(b>l.length||k>t)&&(t=Math.max(k,t),l=AO(b,t,l),d=AO(b,t))}}}(),e),this._indices=null,this._dims=null}function eM(e){Wt.call(this,null,e)}ZI.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},Object(xe.z)(ZI,Wt,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some(r=>t.modified(r.fields))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){const r=e.fields,u=e.query,l=this._indices={},d=this._dims=[],b=u.length;let k,T,j=0;for(;j<b;++j)T=l[k=r[j].fname]||(l[k]=SL()),d.push(CL(T,j,u[j]));return this.eval(e,t)},reinit(e,t){const r=t.materialize().fork(),u=e.fields,l=e.query,d=this._indices,b=this._dims,k=this.value,T=k.curr(),j=k.prev(),$=k.all(),G=r.rem=r.add,te=r.mod,se=l.length,he={};let ve,Be,ze,Ue,st,ut,mt,pt,Ct;if(j.set(T),t.rem.length&&(st=this.remove(e,t,r)),t.add.length&&k.add(t.add),t.mod.length)for(ut={},mt=0,pt=(Ue=t.mod).length;mt<pt;++mt)ut[Ue[mt]._index]=1;for(mt=0;mt<se;++mt)Ct=u[mt],(!b[mt]||e.modified("fields",mt)||t.modified(Ct.fields))&&((ve=he[ze=Ct.fname])||(d[ze]=Be=SL(),he[ze]=ve=Be.insert(Ct,t.source,0)),b[mt]=CL(Be,mt,l[mt]).onAdd(ve,T));for(mt=0,pt=k.data().length;mt<pt;++mt)st[mt]||(j[mt]!==T[mt]?G.push(mt):ut[mt]&&T[mt]!==$&&te.push(mt));return k.mask=(1<<se)-1,r},eval(e,t){const r=t.materialize().fork(),u=this._dims.length;let l=0;return t.rem.length&&(this.remove(e,t,r),l|=(1<<u)-1),e.modified("query")&&!e.modified("fields")&&(l|=this.update(e,t,r)),t.add.length&&(this.insert(e,t,r),l|=(1<<u)-1),t.mod.length&&(this.modify(t,r),l|=(1<<u)-1),this.value.mask=l,r},insert(e,t,r){const u=t.add,l=this.value,d=this._dims,b=this._indices,k=e.fields,T={},j=r.add,$=l.size()+u.length,G=d.length;let te,se,he,ve=l.size();l.resize($,G),l.add(u);const Be=l.curr(),ze=l.prev(),Ue=l.all();for(te=0;te<G;++te)he=T[se=k[te].fname]||(T[se]=b[se].insert(k[te],u,ve)),d[te].onAdd(he,Be);for(;ve<$;++ve)ze[ve]=Ue,Be[ve]!==Ue&&j.push(ve)},modify(e,t){const r=t.mod,u=this.value,l=u.curr(),d=u.all(),b=e.mod;let k,T,j;for(k=0,T=b.length;k<T;++k)l[j=b[k]._index]!==d&&r.push(j)},remove(e,t,r){const u=this._indices,l=this.value,d=l.curr(),b=l.prev(),k=l.all(),T={},j=r.rem,$=t.rem;let G,te,se,he;for(G=0,te=$.length;G<te;++G)T[se=$[G]._index]=1,b[se]=he=d[se],d[se]=k,he!==k&&j.push(se);for(se in u)u[se].remove(te,T);return this.reindex(t,te,T),T},reindex(e,t,r){const u=this._indices,l=this.value;e.runAfter(()=>{const d=l.remove(t,r);for(const b in u)u[b].reindex(d)})},update(e,t,r){const u=this._dims,l=e.query,d=t.stamp,b=u.length;let k,T,j=0;for(r.filters=0,T=0;T<b;++T)e.modified("query",T)&&(k=T,++j);if(j===1)j=u[k].one,this.incrementOne(u[k],l[k],r.add,r.rem);else for(T=0,j=0;T<b;++T)e.modified("query",T)&&(j|=u[T].one,this.incrementAll(u[T],l[T],d,r.add),r.rem=r.add);return j},incrementAll(e,t,r,u){const l=this.value,d=l.seen(),b=l.curr(),k=l.prev(),T=e.index(),j=e.bisect(e.range),$=e.bisect(t),G=$[0],te=$[1],se=j[0],he=j[1],ve=e.one;let Be,ze,Ue;if(G<se)for(Be=G,ze=Math.min(se,te);Be<ze;++Be)d[Ue=T[Be]]!==r&&(k[Ue]=b[Ue],d[Ue]=r,u.push(Ue)),b[Ue]^=ve;else if(G>se)for(Be=se,ze=Math.min(G,he);Be<ze;++Be)d[Ue=T[Be]]!==r&&(k[Ue]=b[Ue],d[Ue]=r,u.push(Ue)),b[Ue]^=ve;if(te>he)for(Be=Math.max(G,he),ze=te;Be<ze;++Be)d[Ue=T[Be]]!==r&&(k[Ue]=b[Ue],d[Ue]=r,u.push(Ue)),b[Ue]^=ve;else if(te<he)for(Be=Math.max(se,te),ze=he;Be<ze;++Be)d[Ue=T[Be]]!==r&&(k[Ue]=b[Ue],d[Ue]=r,u.push(Ue)),b[Ue]^=ve;e.range=t.slice()},incrementOne(e,t,r,u){const l=this.value.curr(),d=e.index(),b=e.bisect(e.range),k=e.bisect(t),T=k[0],j=k[1],$=b[0],G=b[1],te=e.one;let se,he,ve;if(T<$)for(se=T,he=Math.min($,j);se<he;++se)l[ve=d[se]]^=te,r.push(ve);else if(T>$)for(se=$,he=Math.min(T,G);se<he;++se)l[ve=d[se]]^=te,u.push(ve);if(j>G)for(se=Math.max(T,G),he=j;se<he;++se)l[ve=d[se]]^=te,r.push(ve);else if(j<G)for(se=Math.max($,j),he=G;se<he;++se)l[ve=d[se]]^=te,u.push(ve);e.range=t.slice()}}),eM.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},Object(xe.z)(eM,Wt,{transform(e,t){const r=~(e.ignore||0),u=e.filter,l=u.mask;if(!(l&r))return t.StopPropagation;const d=t.fork(t.ALL),b=u.data(),k=u.curr(),T=u.prev(),j=$=>k[$]&r?null:b[$];return d.filter(d.MOD,j),l&l-1?(d.filter(d.ADD,$=>{const G=k[$]&r;return!G&&G^T[$]&r?b[$]:null}),d.filter(d.REM,$=>{const G=k[$]&r;return G&&!(G^G^T[$]&r)?b[$]:null})):(d.filter(d.ADD,j),d.filter(d.REM,$=>(k[$]&r)===l?b[$]:null)),d.filter(d.SOURCE,$=>j($._index))}});const qZ="RawCode",h_="Literal",GZ="Property",KZ="Identifier",YZ="ArrayExpression",XZ="BinaryExpression",AL="CallExpression",JZ="ConditionalExpression",QZ="LogicalExpression",ZZ="MemberExpression",eee="ObjectExpression",tee="UnaryExpression";function hv(e){this.type=e}var M1,qi,Wr,Ld,Ws;hv.prototype.visit=function(e){let t,r,u;if(e(this))return 1;for(r=0,u=(t=function(l){switch(l.type){case YZ:return l.elements;case XZ:case QZ:return[l.left,l.right];case AL:return[l.callee].concat(l.arguments);case JZ:return[l.test,l.consequent,l.alternate];case ZZ:return[l.object,l.property];case eee:return l.properties;case GZ:return[l.key,l.value];case tee:return[l.argument];case KZ:case h_:case qZ:default:return[]}}(this)).length;r<u;++r)if(t[r].visit(e))return 1};var OO=1,DE=2,gw=3,qb=4,DO=5,vw=6,um=7,TE=8;(M1={})[OO]="Boolean",M1[DE]="<end>",M1[gw]="Identifier",M1[qb]="Keyword",M1[DO]="Null",M1[vw]="Numeric",M1[um]="Punctuator",M1[TE]="String",M1[9]="RegularExpression";var nee="ArrayExpression",ree="BinaryExpression",iee="CallExpression",oee="ConditionalExpression",OL="Identifier",aee="Literal",see="LogicalExpression",uee="MemberExpression",cee="ObjectExpression",lee="Property",fee="UnaryExpression",sf="Unexpected token %0",dee="Unexpected number",hee="Unexpected string",pee="Unexpected identifier",mee="Unexpected reserved word",gee="Unexpected end of input",tM="Invalid regular expression",nM="Invalid regular expression: missing /",DL="Octal literals are not allowed in strict mode.",vee="Duplicate data property in object literal not allowed in strict mode",qf="ILLEGAL",NE="Disabled.",yee
vendor: 4,932 bytes, line 7830
7830=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),
7830bee=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC
78307\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function TO(e,t){if(!e)throw new Error("ASSERT: "+t)}function F1(e){return e>=48&&e<=57}function rM(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function IE(e){return"01234567".indexOf(e)>=0}function xee(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function ME(e){return e===10||e===13||e===8232||e===8233}function FE(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&yee.test(String.fromCharCode(e))}function NO(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&bee.test(String.fromCharCode(e))}const wee={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function TL(){for(;Wr<Ld;){const e=qi.charCodeAt(Wr);if(!xee(e)&&!ME(e))break;++Wr}}function iM(e){var t,r,u,l=0;for(r=e==="u"?4:2,t=0;t<r;++t)Wr<Ld&&rM(qi[Wr])?(u=qi[Wr++],l=16*l+"0123456789abcdef".indexOf(u.toLowerCase())):ms({},sf,qf);return String.fromCharCode(l)}function _ee(){var e,t,r,u;for(t=0,(e=qi[Wr])==="}"&&ms({},sf,qf);Wr<Ld&&rM(e=qi[Wr++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||e!=="}")&&ms({},sf,qf),t<=65535?String.fromCharCode(t):(r=55296+(t-65536>>10),u=56320+(t-65536&1023),String.fromCharCode(r,u))}function NL(){var e,t;for(e=qi.charCodeAt(Wr++),t=String.fromCharCode(e),e===92&&(qi.charCodeAt(Wr)!==117&&ms({},sf,qf),++Wr,(e=iM("u"))&&e!=="\\"&&FE(e.charCodeAt(0))||ms({},sf,qf),t=e);Wr<Ld&&NO(e=qi.charCodeAt(Wr));)++Wr,t+=String.fromCharCode(e),e===92&&(t=t.substr(0,t.length-1),qi.charCodeAt(Wr)!==117&&ms({},sf,qf),++Wr,(e=iM("u"))&&e!=="\\"&&NO(e.charCodeAt(0))||ms({},sf,qf),t+=e);return t}function kee(){var e,t;return e=Wr,{type:(t=qi.charCodeAt(Wr)===92?NL():function(){var r,u;for(r=Wr++;Wr<Ld;
7830){if((u=qi.charCodeAt(Wr))===92)return Wr=r,NL();if(!NO(u))break;++Wr}return qi.slice(r,Wr)}()).length===1?gw:wee.hasOwnProperty(t)?qb:t==="null"?DO:t==="true"||t==="false"?OO:gw,value:t,start:e,end:Wr}}function oM(){var e,t,r,u,l=Wr,d=qi.charCodeAt(Wr),b=qi[Wr];switch(d){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++Wr,{type:um,value:String.fromCharCode(d),start:l,end:Wr};default:if((e=qi.charCodeAt(Wr+1))===61)switch(d){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Wr+=2,{type:um,value:String.fromCharCode(d)+String.fromCharCode(e),start:l,end:Wr};case 33:case 61:return Wr+=2,qi.charCodeAt(Wr)===61&&++Wr,{type:um,value:qi.slice(l,Wr),start:l,end:Wr}}}return(u=qi.substr(Wr,4))===">>>="?{type:um,value:u,start:l,end:Wr+=4}:(r=u.substr(0,3))===">>>"||r==="<<="||r===">>="?{type:um,value:r,start:l,end:Wr+=3}:b===(t=r.substr(0,2))[1]&&"+-<>&|".indexOf(b)>=0||t==="=>"?{type:um,value:t,start:l,end:Wr+=2}:(t==="//"&&ms({},sf,qf),"<>=!+-*%&|^/".indexOf(b)>=0?{type:um,value:b,start:l,end:++Wr}:void ms({},sf,qf))}function IL(){var e,t,r;if(TO(F1((r=qi[Wr]).charCodeAt(0))||r===".","Numeric literal must start with a decimal digit or a decimal point"),t=Wr,e="",r!=="."){if(e=qi[Wr++],r=qi[Wr],e==="0"){if(r==="x"||r==="X")return++Wr,function(u){let l="";for(;Wr<Ld&&rM(qi[Wr]);)l+=qi[Wr++];return l.length===0&&ms({},sf,qf),FE(qi.charCodeAt(Wr))&&ms({},sf,qf),{type:vw,value:parseInt("0x"+l,16),start:u,end:Wr}}(t);if(IE(r))return function(u){let l="0"+qi[Wr++];for(;Wr<Ld&&IE(qi[Wr]);)l+=qi[Wr++];return(FE(qi.charCodeAt(Wr))||F1(qi.charCodeAt(Wr)))&&ms({},sf,qf),{type:vw,value:parseInt(l,8),octal:!0,start:u,end:Wr}}(t);r&&F1(r.charCodeAt(0))&&ms({},sf,qf)}for(;F1(qi.charCodeAt(Wr));)e+=qi[Wr++];r=qi[Wr]}if(r==="."){for(e+=qi[Wr++];F1(qi.charCodeAt(Wr));)e+=qi[Wr++];r=qi[Wr]}if(r==="e"||r==="E")if(e+=qi[Wr++],(r=qi[Wr])!=="+"&&r!=="-"||(e+=qi[Wr++]),F1(qi.charCodeAt(Wr)))for(;F1(qi.charCodeAt(Wr));)e+=qi[Wr++];else ms({},sf,qf);return FE(qi.charCodeAt(Wr))&&ms({},sf,qf),{type:vw,value:parseFloat(e),start:t,end:Wr}}function Eee(){var e,t,r,u;return Ws=null,TL(),e=Wr,t=function(){var l,d,b,k;for(TO((l=qi[Wr])==="/","Regular expression literal must start with a slash"),d=qi[Wr++],b=!1,k=!1;Wr<Ld;
7830)if(d+=l=qi[Wr++],l==="\\")ME((l=qi[Wr++]).charCodeAt(0))&&ms({},nM),d+=l;else if(ME(l.charCodeAt(0)))ms({},nM);else if(b)l==="]"&&(b=!1);else{if(l==="/"){k=!0;break}l==="["&&(b=!0)}return k||ms({},nM),{value:d.substr(1,d.length-2),literal:d}}(),r=function(){var l,d,b;for(d="",b="";Wr<Ld&&NO((l=qi[Wr]).charCodeAt(0));)++Wr,l==="\\"&&Wr<Ld?ms({},sf,qf):(b+=l,d+=l);return b.search(/[^gimuy]/g)>=0&&ms({},tM,b),{value:b,literal:d}}(),u=function(l,d){let b=l;d.indexOf("u")>=0&&(b=b.replace(/\\u\{([0-9a-fA-F]+)\}/g,(k,T)=>{if(parseInt(T,16)<=1114111)return"x";ms({},tM)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(b)}catch{ms({},tM)}try{return new RegExp(l,d)}catch{return null}}(t.value,r.value),{literal:t.literal+r.literal,value:u,regex:{pattern:t.value,flags:r.value},start:e,end:Wr}}function ML(){if(TL(),Wr>=Ld)return{type:DE,start:Wr,end:Wr};const e=qi.charCodeAt(Wr);return FE(e)?kee():e===40||e===41||e===59?oM():e===39||e===34?function(){var t,r,u,l,d="",b=!1;for(TO((t=qi[Wr])==="'"||t==='"',"String literal must starts with a quote"),r=Wr,++Wr;Wr<Ld;){if((u=qi[Wr++])===t){t="";break}if(u==="\\")if((u=qi[Wr++])&&ME(u.charCodeAt(0)))u==="\r"&&qi[Wr]===` 7831`&&++Wr;else switch(u){case"u":case"x":qi[Wr]==="{"?(++Wr,d+=_ee()):d+=iM(u);break;case"n":d+=` 7832`;break;case"r":d+="\r";break;case"t":d+=" ";break;case"b":d+="\b";break;case"f":d+="\f";break;case"v":d+="\v";break;default:IE(u)?((l="01234567".indexOf(u))!==0&&(b=!0),Wr<Ld&&IE(qi[Wr])&&(b=!0,l=8*l+"01234567".indexOf(qi[Wr++]),"0123".indexOf(u)>=0&&Wr<Ld&&IE(qi[Wr])&&(l=8*l+"01234567".indexOf(qi[Wr++]))),d+=String.fromCharCode(l)):d+=u}else{if(ME(u.charCodeAt(0)))break;d+=u}}return t!==""&&ms({},sf,qf),{type:TE,value:d,octal:b,start:r,end:Wr}}():e===46?F1(qi.charCodeAt(Wr+1))?IL():oM():F1(e)?IL():oM()}function cm(){const e=Ws;return Wr=e.end,Ws=ML(),Wr=e.end,e}function FL(){const e=Wr;Ws=ML(),Wr=e}function RL(e,t,r){const u=new hv(e==="||"||e==="&&"?see:ree);return u.operator=e,u.left=t,u.right=r,u}function Cee(e,t){const r=new hv(iee);return r.callee=e,r.arguments=t,r}function aM(e){const t=new hv(OL);return t.name=e,t}function RE(e){const t=new hv(aee);return t.value=e.value,t.raw=qi.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function BL(e,t,r){const u=new hv(uee);return u.computed=e==="[",u.object=t,u.property=r,u.computed||(r.member=!0),u}function PL(e,t,r){const u=new hv(lee);return u.key=t,u.value=r,u.kind=e,u}function ms(e,t){var r,u=Array.prototype.slice.call(arguments,2),l=t.replace(/%(\d)/g,(d,b)=>(TO(b<u.length,"Message reference must be in range"),u[b]));throw(r=new Error(l)).index=Wr,r.description=l,r}function IO(e){e.type===DE&&ms(e,gee),e.type===vw&&ms(e,dee),e.type===TE&&ms(e,hee),e.type===gw&&ms(e,pee),e.type===qb&&ms(e,mee),ms(e,sf,e.value)}function zd(e){const t=cm();t.type===um&&t.value===e||IO(t)}function Pu(e){return Ws.type===um&&Ws.value===e}function sM(e){return Ws.type===qb&&Ws.value===e}function See(){const e=[];for(Wr=Ws.start,zd("[");!Pu("]");)Pu(",")?(cm(),e.push(null)):(e.push(yw()),Pu("]")||zd(","));return cm(),function(t){const r=new hv(nee);return r.elements=t,r}(e)}function jL(){Wr=Ws.start;const e=cm();return e.type===TE||e.type===vw?(e.octal&&ms(e,DL),RE(e)):aM(e.value)}function Aee(){var e,t,r;return Wr=Ws.start,(e=Ws).type===gw?(r=jL(),zd(":"),PL("init",r,yw())):e.type!==DE&&e.type!==um?(t=jL(),zd(":"),PL("init",t,yw())):void IO(e)}function Oee(){var e,t,r=[],u={},l=String;for(Wr=Ws.start,zd("{");!Pu("}");)t="$"+((e=Aee()).key.type===OL?e.key.name:l(e.key.value)),Object.prototype.hasOwnProperty.call(u,t)?ms({},vee):u[t]=!0,r.push(e),Pu("}")||zd(",");return zd("}"),function(d){const b=new hv(cee);return b.properties=d,b}(r)}const Dee={if:1};function Tee(){var e,t,r;if(Pu("("))return function(){zd("(");const u=uM();return zd(")"),u}();if(Pu("["))return See();if(Pu("{"))return Oee();if(e=Ws.type,Wr=Ws.start,e===gw||Dee[Ws.value])r=aM(cm().value);else if(e===TE||e===vw)Ws.octal&&ms(Ws,DL),r=RE(cm());else{if(e===qb)throw new Error(NE);e===OO?((t=cm()).value=t.value==="true",r=RE(t)):e===DO?((t=cm()).value=null,r=RE(t)):Pu("/")||Pu("/=")?(r=RE(Eee()),FL()):IO(cm())}return r}function Nee(){const e=[];
vendor: 6,056 bytes, line 7832
7832if(zd("("),!Pu(")"))for(;Wr<Ld&&(e.push(yw()),!Pu(")"));)zd(",");return zd(")"),e}function Iee(){Wr=Ws.start;const e=cm();return function(t){return t.type===gw||t.type===qb||t.type===OO||t.type===DO}(e)||IO(e),aM(e.value)}function Mee(){zd("[");const e=uM();return zd("]"),e}function LL(){const e=function(){var t;for(t=Tee();;)if(Pu("."))zd("."),t=BL(".",t,Iee());else if(Pu("("))t=Cee(t,Nee());else{if(!Pu("["))break;t=BL("[",t,Mee())}return t}();if(Ws.type===um&&(Pu("++")||Pu("--")))throw new Error(NE);return e}function MO(){var e,t;if(Ws.type!==um&&Ws.type!==qb)t=LL();else{if(Pu("++")||Pu("--"))throw new Error(NE);if(Pu("+")||Pu("-")||Pu("~")||Pu("!"))e=cm(),t=MO(),t=function(r,u){const l=new hv(fee);return l.operator=r,l.argument=u,l.prefix=!0,l}(e.value,t);else{if(sM("delete")||sM("void")||sM("typeof"))throw new Error(NE);t=LL()}}return t}function zL(e){let t=0;if(e.type!==um&&e.type!==qb)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function yw(){var e,t;return e=function(){var r,u,l,d,b,k,T,j,$,G;if(r=Ws,$=MO(),(b=zL(d=Ws))===0)return $;for(d.prec=b,cm(),u=[r,Ws],k=[$,d,T=MO()];(b=zL(Ws))>0;){for(;k.length>2&&b<=k[k.length-2].prec;)T=k.pop(),j=k.pop().value,$=k.pop(),u.pop(),l=RL(j,$,T),k.push(l);(d=cm()).prec=b,k.push(d),u.push(Ws),l=MO(),k.push(l)}for(l=k[G=k.length-1],u.pop();G>1;)u.pop(),l=RL(k[G-1].value,k[G-2],l),G-=2;return l}(),Pu("?")&&(cm(),t=yw(),zd(":"),e=function(r,u,l){const d=new hv(oee);return d.test=r,d.consequent=u,d.alternate=l,d}(e,t,yw())),e}function uM(){const e=yw();if(Pu(","))throw new Error(NE);return e}var UL={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function WL(e){function t(u,l,d){return b=>function(k,T,j,$){let G=e(T[0]);return j&&(G=j+"("+G+")",j.lastIndexOf("new ",0)===0&&(G="("+G+")")),G+"."+k+($<0?"":$===0?"()":"("+T.slice(1).map(e).join(",")+")")}(u,b,l,d)}const r="new Date";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(u){u.length<3&&Object(xe.o)("Missing arguments to clamp function."),u.length>3&&Object(xe.o)("Too many arguments to clamp function.");const l=u.map(e);return"Math.max("+l[1]+", Math.min("+l[2]+","+l[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:r,date:t("getDate",r,0),day:t("getDay",r,0),year:t("getFullYear",r,0),month:t("getMonth",r,0),hours:t("getHours",r,0),minutes:t("getMinutes",r,0),seconds:t("getSeconds",r,0),milliseconds:t("getMilliseconds",r,0),time:t("getTime",r,0),timezoneoffset:t("getTimezoneOffset",r,0),utcdate:t("getUTCDate",r,0),utcday:t("getUTCDay",r,0),utcyear:t("getUTCFullYear",r,0),utcmonth:t("getUTCMonth",r,0),utchours:t("getUTCHours",r,0),utcminutes:t("getUTCMinutes",r,0),utcseconds:t("getUTCSeconds",r,0),utcmilliseconds:t("getUTCMilliseconds",r,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase","String",0),lower:t("toLowerCase","String",0),substring:t("substring","String"),split:t("split","String"),trim:t("trim","String",0),regexp:"RegExp",test:t("test","RegExp"),if:function(u){u.length<3&&Object(xe.o)("Missing arguments to if function."),u.length>3&&Object(xe.o)("Too many arguments to if function.");const l=u.map(e);return"("+l[0]+"?"+l[1]+":"+l[2]+")"}}}var VL,$L,cM,lM,fM,FO=new $h,RO=new $h,Ry={point:Hf,lineStart:Hf,lineEnd:Hf,polygonStart:function(){FO=new $h,Ry.lineStart=Fee,Ry.lineEnd=Ree},polygonEnd:function(){var e=+FO;RO.add(e<0?Hh+e:e),this.lineStart=this.lineEnd=this.point=Hf},sphere:function(){RO.add(Hh)}};function Fee(){Ry.point=Bee}function Ree(){HL(VL,$L)}function Bee(e,t){Ry.point=HL,VL=e,$L=t,cM=e*=Ea,lM=yo(t=(t*=Ea)/2+UA),fM=io(t)}function HL(e,t){t=(t*=Ea)/2+UA;var r=(e*=Ea)-cM,u=r>=0?1:-1,l=u*r,d=yo(t),b=io(t),k=fM*b,T=lM*d+k*yo(l),j=k*u*io(l);FO.add(p0(j,T)),cM=e,lM=d,fM=b}var hc,lm,Cc,wg,bw,qL,GL,p_,BE,Gb,R1,B1={point:dM,lineStart:YL,lineEnd:XL,polygonStart:function(){B1.point=JL,B1.lineStart=Pee,B1.lineEnd=jee,BE=new $h,Ry.polygonStart()},polygonEnd:function(){Ry.polygonEnd(),B1.point=dM,B1.lineStart=YL,B1.lineEnd=XL,FO<0?(hc=-(Cc=180),lm=-(wg=90)):BE>po?wg=90:BE<-po&&(lm=-90),R1[0]=hc,R1[1]=Cc},sphere:function(){hc=-(Cc=180),lm=-(wg=90)}};function dM(e,t){Gb.push(R1=[hc=e,Cc=e]),t<lm&&(lm=t),t>wg&&(wg=t)}function KL(e,t){var r=fw([e*Ea,t*Ea]);if(p_){var u=o_(p_,r),l=o_([u[1],-u[0],0],u);tO(l),l=QA(l);var d,b=e-bw,k=b>0?1:-1,T=l[0]*Hc*k,j=es(b)>180;j^(k*bw<T&&T<k*e)?(d=l[1]*Hc)>wg&&(wg=d):j^(k*bw<(T=(T+360)%360-180)&&T<k*e)?(d=-l[1]*Hc)<lm&&(lm=d):(t<lm&&(lm=t),t>wg&&(wg=t)),j?e<bw?_g(hc,e)>_g(hc,Cc)&&(Cc=e):_g(e,Cc)>_g(hc,Cc)&&(hc=e):Cc>=hc?(e<hc&&(hc=e),e>Cc&&(Cc=e)):e>bw?_g(hc,e)>_g(hc,Cc)&&(Cc=e):_g(e,Cc)>_g(hc,Cc)&&(hc=e)}else Gb.push(R1=[hc=e,Cc=e]);t<lm&&(lm=t),t>wg&&(wg=t),p_=r,bw=e}function YL(){B1.point=KL}function XL(){R1[0]=hc,R1[1]=Cc,B1.point=dM,p_=null}function JL(e,t){if(p_){var r=e-bw;BE.add(es(r)>180?r+(r>0?360:-360):r)}else qL=e,GL=t;Ry.point(e,t),KL(e,t)}function Pee(){Ry.lineStart()}function jee(){JL(qL,GL),Ry.lineEnd(),es(BE)>po&&(hc=-(Cc=180)),R1[0]=hc,R1[1]=Cc,p_=null}function _g(e,t){return(t-=e)<0?t+360:t}function Lee(e,t){return e[0]-t[0]}function QL(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var BO,PO,jO,LO,zO,UO,WO,VO,hM,pM,mM,ZL,e9,Jh,Qh,Zh,pv={sphere:Hf,point:gM,lineStart:t9,lineEnd:n9,polygonStart:function(){pv.lineStart=Wee,pv.lineEnd=Vee},polygonEnd:function(){pv.lineStart=t9,pv.lineEnd=n9}}
7832;function gM(e,t){e*=Ea;var r=yo(t*=Ea);PE(r*yo(e),r*io(e),io(t))}function PE(e,t,r){jO+=(e-jO)/++BO,LO+=(t-LO)/BO,zO+=(r-zO)/BO}function t9(){pv.point=zee}function zee(e,t){e*=Ea;var r=yo(t*=Ea);Jh=r*yo(e),Qh=r*io(e),Zh=io(t),pv.point=Uee,PE(Jh,Qh,Zh)}function Uee(e,t){e*=Ea;var r=yo(t*=Ea),u=r*yo(e),l=r*io(e),d=io(t),b=p0(qh((b=Qh*d-Zh*l)*b+(b=Zh*u-Jh*d)*b+(b=Jh*l-Qh*u)*b),Jh*u+Qh*l+Zh*d);PO+=b,UO+=b*(Jh+(Jh=u)),WO+=b*(Qh+(Qh=l)),VO+=b*(Zh+(Zh=d)),PE(Jh,Qh,Zh)}function n9(){pv.point=gM}function Wee(){pv.point=$ee}function Vee(){r9(ZL,e9),pv.point=gM}function $ee(e,t){ZL=e,e9=t,e*=Ea,t*=Ea,pv.point=r9;var r=yo(t);Jh=r*yo(e),Qh=r*io(e),Zh=io(t),PE(Jh,Qh,Zh)}function r9(e,t){e*=Ea;var r=yo(t*=Ea),u=r*yo(e),l=r*io(e),d=io(t),b=Qh*d-Zh*l,k=Zh*u-Jh*d,T=Jh*l-Qh*u,j=M4(b,k,T),$=sm(j),G=j&&-$/j;hM.add(G*b),pM.add(G*k),mM.add(G*T),PO+=$,UO+=$*(Jh+(Jh=u)),WO+=$*(Qh+(Qh=l)),VO+=$*(Zh+(Zh=d)),PE(Jh,Qh,Zh)}const Hee="Literal";var P1,qee=1,Gee=2,Kee=3,Yee=4,Xee=5,Jee=6,Qee=7,Zee=8;(P1={})[qee]="Boolean",P1[Gee]="<end>",P1[Kee]="Identifier",P1[Yee]="Keyword",P1[Xee]="Null",P1[Jee]="Numeric",P1[Qee]="Punctuator",P1[Zee]="String",P1[9]="RegularExpression";const vM="intersect",i9="union",ete="vlMulti",tte="vlPoint",o9="or",nte="and",rte="E",ite="R",ote="R-E",ate="R-LE",ste="R-RE",$O="index:unit";function a9(e,t){for(var r,u,l=t.fields,d=t.values,b=l.length,k=0;k<b;++k)if((u=l[k]).getter=xe.u.getter||Object(xe.u)(u.field),r=u.getter(e),Object(xe.D)(r)&&(r=Object(xe.Ea)(r)),Object(xe.D)(d[k])&&(d[k]=Object(xe.Ea)(d[k])),Object(xe.D)(d[k][0])&&(d[k]=d[k].map(xe.Ea)),u.type===rte){if(Object(xe.B)(d[k])?d[k].indexOf(r)<0:r!==d[k])return!1}else if(u.type===ite){if(!Object(xe.A)(r,d[k]))return!1}else if(u.type===ste){if(!Object(xe.A)(r,d[k],!0,!1))return!1}else if(u.type===ote){if(!Object(xe.A)(r,d[k],!1,!1))return!1}else if(u.type===ate&&!Object(xe.A)(r,d[k],!1,!0))return!1;return!0}const yM=Object(xe.u)("_vgsid_"),s9=function(e){let t=e,r=e;function u(l,d,b,k){for(b==null&&(b=0),k==null&&(k=l.length);b<k;){const T=b+k>>>1;r(l[T],d)<0?b=T+1:k=T}return b}return e.length===1&&(t=(l,d)=>e(l)-d,r=function(l){return(d,b)=>function(k,T){return k<T?-1:k>T?1:k>=T?0:NaN}(l(d),b)}(e)),{left:u,center:function(l,d,b,k){b==null&&(b=0),k==null&&(k=l.length);const T=u(l,d,b,k-1);return T>b&&t(l[T-1],d)>-t(l[T],d)?T-1:T},right:function(l,d,b,k){for(b==null&&(b=0),k==null&&(k=l.length);b<k;){const T=b+k>>>1;r(l[T],d)>0?k=T:b=T+1}return b}}}(yM),ute=s9.left,cte=s9.right;var u9={E_union:function(e,t){if(!e.length)return t;for(var r=0,u=t.length;r<u;++r)e.indexOf(t[r])<0&&e.push(t[r]);return e},E_intersect:function(e,t){return e.length?e.filter(r=>t.indexOf(r)>=0):t},R_union:function(e,t){var r=Object(xe.Ea)(t[0]),u=Object(xe.Ea)(t[1]);return r>u&&(r=t[1],u=t[0]),e.length?(e[0]>r&&(e[0]=r),e[1]<u&&(e[1]=u),e):[r,u]},R_intersect:function(e,t){var r=Object(xe.Ea)(t[0]),u=Object(xe.Ea)(t[1]);return r>u&&(r=t[1],u=t[0]),e.length?u<e[0]||e[1]<r?[]:(e[0]<r&&(e[0]=r),e[1]>u&&(e[1]=u),e):[r,u]}};const lte=":",fte="@";function bM(e,t,r,u){t[0].type!==Hee&&Object(xe.o)("First argument to selection functions must be a string literal.");const l=t[0].value,d=t.length>=2&&Object(xe.W)(t).value,b=fte+"unit",k=lte+l;d!==vM||Object(xe.w)(u,b)||(u[b]=r.getData(l).indataRef(r,"unit")),Object(xe.w)(u,k)||(u[k]=r.getData(l).tuplesRef())}function c9(e){const t=this.context.data[e];return t?t.values.value:[]}const jE=e=>function(t,r){return this.context.dataflow.locale()[e](r)(t)},dte=jE("format"),l9=jE("timeFormat"),hte=jE("utcFormat"),pte=jE("timeParse"),mte=jE("utcParse"),HO=new Date(2e3,0,1);function qO(e,t,r){return Number.isInteger(e)&&Number.isInteger(t)?(HO.setYear(2e3),HO.setMonth(e),HO.setDate(t),l9.call(this,HO,r)):""}const gte=":",vte="@",xM="%",f9="$";function wM(e,t,r,u){t[0].type!==h_&&Object(xe.o)("First argument to data functions must be a string literal.");const l=t[0].value,d=gte+l;if(!Object(xe.w)(d,u))try{u[d]=r.getData(l).tuplesRef()}catch{}}function fm(e,t,r,u){if(t[0].type===h_)d9(r,u,t[0].value);else for(e in r.scales)d9(r,u,e)}function d9(e,t,r){const u=xM+r;if(!Object(xe.w)(t,u))try{t[u]=e.scaleRef(r)}catch{}}function j1(e,t){let r;return Object(xe.E)(e)?e:Object(xe.J)(e)?(r=t.scales[e])&&r.value:void 0}function _M(e,t){return function(r,u,l){if(r){const d=j1(r,(l||this).context);return d&&d.path[e](u)}return t(u)}}const yte=_M("area",function(e){return RO=new $h,D1(e,Ry),2*RO}),bte=_M("bounds",function(e){var t,r,u,l,d,b,k;if(wg=Cc=-(hc=lm=1/0),Gb=[],D1(e,B1),r=Gb.length){for(Gb.sort(Lee),t=1,d=[u=Gb[0]];t<r;++t)QL(u,(l=Gb[t])[0])||QL(u,l[1])?(_g(u[0],l[1])>_g(u[0],u[1])&&(u[1]=l[1]),_g(l[0],u[1])>_g(u[0],u[1])&&(u[0]=l[0])):d.push(u=l);for(b=-1/0,t=0,u=d[r=d.length-1];t<=r;u=l,++t)l=d[t],(k=_g(u[1],l[0]))>b&&(b=k,hc=l[0],Cc=u[1])}return Gb=R1=null,hc===1/0||lm===1/0?[[NaN,NaN],[NaN,NaN]]:[[hc,lm],[Cc,wg]]}),xte=_M("centroid",function(e){BO=PO=jO=LO=zO=UO=WO=VO=0,hM=new $h,pM=new $h,mM=new $h,D1(e,pv);var t=+hM,r=+pM,u=+mM,l=M4(t,r,u);return l<1e-12&&(t=UO,r=WO,u=VO,PO<po&&(t=jO,r=LO,u=zO),(l=M4(t,r,u))<1e-12)?[NaN,NaN]:[p0(r,t)*Hc,sm(u/l)*Hc]});function kM(e,t,r){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(r)))}catch(u){e.warn(u)}return r[r.length-1]}function EM(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function CM(e){const t=en(e);
7832return .2126*EM(t.r)+.7152*EM(t.g)+.0722*EM(t.b)}function h9(e,t){return e===t||e!=e&&t!=t||(Object(xe.B)(e)?!(!Object(xe.B)(t)||e.length!==t.length)&&function(r,u){for(let l=0,d=r.length;l<d;++l)if(!h9(r[l],u[l]))return!1;return!0}(e,t):!(!Object(xe.H)(e)||!Object(xe.H)(t))&&p9(e,t))}function p9(e,t){for(const r in e)if(!h9(e[r],t[r]))return!1;return!0}function m9(e){return t=>p9(e,t)}const g9={};function SM(e){return Object(xe.B)(e)||ArrayBuffer.isView(e)?e:null}function AM(e){return SM(e)||(Object(xe.J)(e)?e:null)}const v9=e=>e.data;function y9(e,t){const r=c9.call(t,e);return r.root&&r.root.lookup||{}}const b9=()=>typeof window<"u"&&window||null,LE={random:()=>Hn(),cumulativeNormal:fo,cumulativeLogNormal:Sm,cumulativeUniform:mp,densityNormal:pp,densityLogNormal:Vl,densityUniform:eh,quantileNormal:yl,quantileLogNormal:Qs,quantileUniform:$l,sampleNormal:gu,sampleLogNormal:Jc,sampleUniform:Qc,isArray:xe.B,isBoolean:xe.C,isDate:xe.D,isDefined:e=>e!==void 0,isNumber:xe.G,isObject:xe.H,isRegExp:xe.I,isString:xe.J,isTuple:rn,isValid:e=>e!=null&&e==e,toBoolean:xe.Ca,toDate:xe.Da,toNumber:xe.Ea,toString:xe.Ga,indexof:function(e,...t){return AM(e).indexOf(...t)},join:function(e,...t){return SM(e).join(...t)},lastindexof:function(e,...t){return AM(e).lastIndexOf(...t)},replace:function(e,t,r){return Object(xe.E)(r)&&Object(xe.o)("Function argument passed to replace."),String(e).replace(t,r)},reverse:function(e){return SM(e).slice().reverse()},slice:function(e,...t){return AM(e).slice(...t)},flush:xe.v,lerp:xe.L,merge:function(){const e=[].slice.call(arguments);return e.unshift({}),Object(xe.p)(...e)},pad:xe.R,peek:xe.W,pluck:function(e,t){const r=g9[t]||(g9[t]=Object(xe.u)(t));return Object(xe.B)(e)?e.map(r):r(e)},span:xe.Z,inrange:xe.A,truncate:xe.Ha,rgb:en,lab:If,hcl:Uc,hsl:lr,luminance:CM,contrast:function(e,t){const r=CM(e),u=CM(t);return(Math.max(r,u)+.05)/(Math.min(r,u)+.05)},sequence:vu,format:dte,utcFormat:hte,utcParse:mte,utcOffset:gr.w,utcSequence:gr.x,timeFormat:l9,timeParse:pte,timeOffset:gr.q,timeSequence:gr.r,timeUnitSpecifier:gr.s,monthFormat:function(e){return qO.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return qO.call(this,e,1,"%b")},dayFormat:function(e){return qO.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return qO.call(this,0,2+e,"%a")},quarter:xe.X,utcquarter:xe.Ja,week:gr.A,utcweek:gr.z,dayofyear:gr.m,utcdayofyear:gr.y,warn:function(){return kM(this.context.dataflow,"warn",arguments)},info:function(){return kM(this.context.dataflow,"info",arguments)},debug:function(){return kM(this.context.dataflow,"debug",arguments)},extent:xe.q,inScope:function(e){const t=this.context.group;let r=!1;if(t)for(;e;){if(e===t){r=!0;break}e=e.mark.group}return r},intersect:function(e,t,r){if(!e)return[];const[u,l]=e,d=new zs().set(u[0],u[1],l[0],l[1]);return Pr(r||this.context.dataflow.scenegraph().root,d,function(b){let k=null;if(b){const T=Object(xe.i)(b.marktype),j=Object(xe.i)(b.markname);k=$=>(!T.length||T.some(G=>$.marktype===G))&&(!j.length||j.some(G=>$.name===G))}return k}(t))},clampRange:xe.k,pinchDistance:function(e){const t=e.touches,r=t[0].clientX-t[1].clientX,u=t[0].clientY-t[1].clientY;return Math.sqrt(r*r+u*u)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){const e=b9();return e?e.screen:{}},containerSize:function(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){const e=b9();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,r){return Hg(e||0,t||0,r||0)},setdata:function(e,t){const r=this.context.dataflow,u=this.context.data[e].input;return r.pulse(u,r.changeset().remove(xe.Ia).insert(t)),1},pathShape:function(e){let t=null;return function(r){return r?Kp(r,t=t||qp(e)):e}},panLinear:xe.S,panLog:xe.T,panPow:xe.U,panSymlog:xe.V,zoomLinear:xe.Na,zoomLog:xe.Oa,zoomPow:xe.Pa,zoomSymlog:xe.Qa,encode:function(e,t,r){if(e){const u=this.context.dataflow,l=e.mark.source;u.pulse(l,u.changeset().encode(e,t))}return r!==void 0?r:e},modify:function(e,t,r,u,l,d){const b=this.context.dataflow,k=this.context.data[e],T=k.input,j=b.stamp();let $,G,te=k.changes;if(b._trigger===!1||!(T.value.length||t||u))return 0;if((!te||te.stamp<j)&&(k.changes=te=b.changeset(),te.stamp=j,b.runAfter(()=>{k.modified=!0,b.pulse(T,te).run()},!0,1)),r&&($=r===!0?xe.Ia:Object(xe.B)(r)||rn(r)?r:m9(r),te.remove($)),t&&te.insert(t),u&&($=m9(u),T.value.some($)?te.remove($):te.insert(u)),l)for(G in d)te.modify(l,G,d[G]);return 1}},wte=["view","item","group","xy","x","y"],_te="event.vega.",x9="this.",OM={},w9={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${Object(xe.Ba)(f9+e)}]`,functions:function(e){const t=WL(e);wte.forEach(r=>t[r]=_te+r);for(const r in LE)t[r]=x9+r;return Object(xe.p)(t,function(r,u,l){u.__bandwidth=b=>b&&b.bandwidth?b.bandwidth():0,l._bandwidth=fm,l._range=fm,l._scale=fm;const d=b=>"_["+(b.type===h_?Object(xe.Ba)(xM+b.value):Object(xe.Ba)(xM)+"+"+r(b))+"]";return{_bandwidth:b=>`this.__bandwidth(${d(b[0])})`,_range:b=>`${d(b[0])}.range()`,_scale:b=>`${d(b[0])}(${r(b[1])})`}}(e,LE,OM)),t},constants:UL,visitors:OM},DM=function(e){const t=(e=e||{}).allowed?Object(xe.Fa)(e.allowed):{},r=e.forbidden?Object(xe.Fa)(e.forbidden):{},u=e.constants||UL,l=(e.functions||WL)(G),d=e.globalvar,b=e.fieldvar,k=Object(xe.E)(d)?d:he=>`${d}["${he}"]`;let T={},j={},$=0;function G(he){if(Object(xe.J)(he))return he;const ve=te[he.type];return ve==null&&Object(xe.o)("Unsupported type: "+he.type),ve(he)}const te={Literal:he=>he.raw,Identifier:he=>{const ve=he.name;return $>0?ve:Object(xe.w)(r,ve)?Object(xe.o)("Illegal identifier: "+ve):Object(xe.w)(u,ve)?u[ve]:Object(xe.w)(t,ve)?ve:(T[ve]=1,k(ve))},MemberExpression:he=>{const ve=!he.computed,Be=G(he.object);ve&&($+=1);const ze=G(he.property);return Be===b&&(j[function(Ue){const st=Ue&&Ue.length-1;return st&&(Ue[0]==='"'&&Ue[st]==='"'||Ue[0]==="'"&&Ue[st]==="'")?Ue.slice(1,-1):Ue}(ze)]=1),ve&&($-=1),Be+(ve?"."+ze:"["+ze+"]")},CallExpression:he=>{he.callee.type!=="Identifier"&&Object(xe.o)("Illegal callee type: "+he.callee.type);const ve=he.callee.name,Be=he.arguments,ze=Object(xe.w)(l,ve)&&l[ve];return ze||Object(xe.o)("Unrecognized function: "+ve),Object(xe.E)(ze)?ze(Be):ze+"("+Be.map(G).join(",")+")"},ArrayExpression:he=>"["+he.elements.map(G).join(",")+"]",BinaryExpression:he=>
7832"("+G(he.left)+" "+he.operator+" "+G(he.right)+")",UnaryExpression:he=>"("+he.operator+G(he.argument)+")",ConditionalExpression:he=>"("+G(he.test)+"?"+G(he.consequent)+":"+G(he.alternate)+")",LogicalExpression:he=>"("+G(he.left)+he.operator+G(he.right)+")",ObjectExpression:he=>"{"+he.properties.map(G).join(",")+"}",Property:he=>{$+=1;const ve=G(he.key);return $-=1,ve+":"+G(he.value)}};function se(he){const ve={code:G(he),globals:Object.keys(T),fields:Object.keys(j)};return T={},j={},ve}return se.functions=l,se.constants=u,se}(w9);function ll(e,t,r){return arguments.length===1?LE[e]:(LE[e]=t,r&&(OM[e]=r),DM&&(DM.functions[e]=x9+e),this)}function By(e,t){const r={};let u;try{u=function(d){Wr=0,Ld=(qi=d).length,Ws=null,FL();const b=uM();if(Ws.type!==DE)throw new Error("Unexpect token after expression.");return b}(e=Object(xe.J)(e)?e:Object(xe.Ba)(e)+"")}catch{Object(xe.o)("Expression parse error: "+e)}u.visit(d=>{if(d.type!==AL)return;const b=d.callee.name,k=w9.visitors[b];k&&k(b,d.arguments,t,r)});const l=DM(u);return l.globals.forEach(d=>{const b=f9+d;!Object(xe.w)(r,b)&&t.getSignal(d)&&(r[b]=t.signalRef(d))}),{$expr:Object(xe.p)({code:l.code},t.options.ast?{ast:u}:null),$fields:l.fields,$params:r}}ll("bandwidth",function(e,t){const r=j1(e,(t||this).context);return r&&r.bandwidth?r.bandwidth():0},fm),ll("copy",function(e,t){const r=j1(e,(t||this).context);return r?r.copy():void 0},fm),ll("domain",function(e,t){const r=j1(e,(t||this).context);return r?r.domain():[]},fm),ll("range",function(e,t){const r=j1(e,(t||this).context);return r&&r.range?r.range():[]},fm),ll("invert",function(e,t,r){const u=j1(e,(r||this).context);return u?Object(xe.B)(t)?(u.invertRange||u.invert)(t):(u.invert||u.invertExtent)(t):void 0},fm),ll("scale",function(e,t,r){const u=j1(e,(r||this).context);return u?u(t):void 0},fm),ll("gradient",function(e,t,r,u,l){e=j1(e,(l||this).context);const d=nv(t,r);let b=e.domain(),k=b[0],T=Object(xe.W)(b),j=xe.y;return T-k?j=$p(e,k,T):e=(e.interpolator?da("sequential")().interpolator(e.interpolator()):da("linear")().interpolate(e.interpolate()).range(e.range())).domain([k=0,T=1]),e.ticks&&(k!==(b=e.ticks(+u||15))[0]&&b.unshift(k),T!==Object(xe.W)(b)&&b.push(T)),b.forEach($=>d.stop(j($),e($))),d},fm),ll("geoArea",yte,fm),ll("geoBounds",bte,fm),ll("geoCentroid",xte,fm),ll("geoShape",function(e,t,r){const u=j1(e,(r||this).context);return function(l){return u?u.path.context(l)(t):""}},fm),ll("indata",function(e,t,r){const u=this.context.data[e]["index:"+t],l=u?u.value.get(r):void 0;return l&&l.count},function(e,t,r,u){t[0].type!==h_&&Object(xe.o)("First argument to indata must be a string literal."),t[1].type!==h_&&Object(xe.o)("Second argument to indata must be a string literal.");const l=t[0].value,d=t[1].value,b=vte+d;Object(xe.w)(b,u)||(u[b]=r.getData(l).indataRef(r,d))}),ll("data",c9,wM),ll("treePath",function(e,t,r){const u=y9(e,this),l=u[t],d=u[r];return l&&d?l.path(d).map(v9):void 0},wM),ll("treeAncestors",function(e,t){const r=y9(e,this)[t];return r?r.ancestors().map(v9):void 0},wM),ll("vlSelectionTest",function(e,t,r){for(var u,l,d,b,k,T=this.context.data[e],j=T?T.values.value:[],$=T?T[$O]&&T[$O].value:void 0,G=r===vM,te=j.length,se=0;se<te;++se)if(u=j[se],$&&G){if((d=(l=l||{})[b=u.unit]||0)===-1)continue;if(k=a9(t,u),l[b]=k?-1:++d,k&&$.size===1)return!0;if(!k&&d===$.get(b).count)return!1}else if(G^(k=a9(t,u)))return k;return te&&G},bM),ll("vlSelectionIdTest",function(e,t,r){const u=this.context.data[e],l=u?u.values.value:[],d=u?u[$O]&&u[$O].value:void 0,b=r===vM,k=yM(t),T=ute(l,k);if(T===l.length||yM(l[T])!==k)return!1;if(d&&b){if(d.size===1)return!0;if(cte(l,k)-T<d.size)return!1}return!0},bM),ll("vlSelectionResolve",function(e,t,r,u){for(var l,d,b,k,T,j,$,G,te,se,he,ve=this.context.data[e],Be=ve?ve.values.value:[],ze={},Ue={},st={},ut=Be.length,mt=0;mt<ut;++mt){for(k=(l=Be[mt]).unit,d=l.fields,b=l.values,se=0,he=d.length;se<he;++se)T=d[se],$=(j=ze[T.field]||(ze[T.field]={}))[k]||(j[k]=[]),st[T.field]=G=T.type.charAt(0),te=u9[G+"_union"],j[k]=te($,Object(xe.i)(b[se]));r&&($=Ue[k]||(Ue[k]=[])).push(Object(xe.i)(b).reduce((pt,Ct,Et)=>(pt[d[Et].field]=Ct,pt),{}))}return t=t||i9,Object.keys(ze).forEach(pt=>{ze[pt]=Object.keys(ze[pt]).map(Ct=>ze[pt][Ct]).reduce((Ct,Et)=>Ct===void 0?Et:u9[st[pt]+"_"+t](Ct,Et))}),Be=Object.keys(Ue),r&&Be.length&&(ze[u?tte:ete]=t===i9?{[o9]:Be.reduce((pt,Ct)=>(pt.push(...Ue[Ct]),pt),[])}:{[nte]:Be.map(pt=>({[o9]:Ue[pt]}))}),ze},bM),ll("vlSelectionTuples",function(e,t){return e.map(r=>Object(xe.p)({values:t.fields.map(u=>(u.getter||(u.getter=Object(xe.u)(u.field)))(r.datum))},t))});const kte=Object(xe.Fa)(["rule"]),_9=Object(xe.Fa)(["group","image","rect"]);function TM(e){return(e+"").toLowerCase()}function zE(e,t,r){r[r.length-1]!==";"&&(r="return("+r+");");const u=Function(...t.concat(r));return e&&e.functions?u.bind(e.functions):u}var Ete={operator:(e,t)=>
7832zE(e,["_"],t.code),parameter:(e,t)=>zE(e,["datum","_"],t.code),event:(e,t)=>zE(e,["event"],t.code),handler:(e,t)=>zE(e,["_","event"],"var datum=event.item&&event.item.datum;return ".concat(t.code,";")),encode:(e,t)=>{const{marktype:r,channels:u}=t;let l="var o=item,datum=o.datum,m=0,$;";for(const d in u){const b="o["+Object(xe.Ba)(d)+"]";l+="$=".concat(u[d].code,";if(").concat(b,"!==$)").concat(b,"=$,m=1;")}return l+=function(d,b){let k="";return kte[b]||(d.x2&&(d.x?(_9[b]&&(k+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),k+="o.width=o.x2-o.x;"):k+="o.x=o.x2-(o.width||0);"),d.xc&&(k+="o.x=o.xc-(o.width||0)/2;"),d.y2&&(d.y?(_9[b]&&(k+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),k+="o.height=o.y2-o.y;"):k+="o.y=o.y2-(o.height||0);"),d.yc&&(k+="o.y=o.yc-(o.height||0)/2;")),k}(u,r),zE(e,["item","_"],l+="return m;")},codegen:{get(e){const t="[".concat(e.map(xe.Ba).join("]["),"]"),r=Function("_","return _".concat(t,";"));return r.path=t,r},comparator(e,t){let r;const u=Function("a","b","var u, v; return "+e.map((l,d)=>{const b=t[d];let k,T;return l.path?(k="a".concat(l.path),T="b".concat(l.path)):((r=r||{})["f"+d]=l,k="this.f".concat(d,"(a)"),T="this.f".concat(d,"(b)")),function(j,$,G,te){return"((u = ".concat(j,") < (v = ").concat($,") || u == null) && v != null ? ").concat(G,` 7833 : (u > v || v == null) && u != null ? `).concat(te,` 7834 : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? `).concat(G,` 7835 : v !== v && u === u ? `).concat(te," : ")}(k,T,-b,b)}).join("")+"0;");return r?u.bind(r):u}}};function k9(e,t,r){if(!e||!Object(xe.H)(e))return e;for(let u,l=0,d=E9.length;l<d;++l)if(u=E9[l],Object(xe.w)(e,u.key))return u.parse(e,t,r);return e}var E9=[{key:"$ref",parse:function(e,t){return t.get(e.$ref)||Object(xe.o)("Operator not defined: "+e.$ref)}},{key:"$key",parse:function(e,t){const r="k:"+e.$key+"_"+!!e.$flat;return t.fn[r]||(t.fn[r]=Object(xe.K)(e.$key,e.$flat,t.expr.codegen))}},{key:"$expr",parse:function(e,t,r){e.$params&&t.parseParameters(e.$params,r);const u="e:"+e.$expr.code+"_"+e.$name;return t.fn[u]||(t.fn[u]=Object(xe.f)(t.parameterExpression(e.$expr),e.$fields,e.$name))}},{key:"$field",parse:function(e,t){if(!e.$field)return null;const r="f:"+e.$field+"_"+e.$name;return t.fn[r]||(t.fn[r]=Object(xe.u)(e.$field,e.$name,t.expr.codegen))}},{key:"$encode",parse:function(e,t){const r=e.$encode,u={};for(const l in r){const d=r[l];u[l]=Object(xe.f)(t.encodeExpression(d.$expr),d.$fields),u[l].output=d.$output}return u}},{key:"$compare",parse:function(e,t){const r="c:"+e.$compare+"_"+e.$order,u=Object(xe.i)(e.$compare).map(l=>l&&l.$tupleid?fn:l);return t.fn[r]||(t.fn[r]=Object(xe.l)(u,e.$order,t.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const r=e.$subflow;return function(u,l,d){const b=t.fork().parse(r),k=b.get(r.operators[0].id),T=b.signals.parent;return T&&T.set(d),k.detachSubflow=()=>t.detach(b),k}}},{key:"$tupleid",parse:function(){return fn}}];const Cte={skip:!0};function C9(e,t,r,u){return new S9(e,t,r,u)}function S9(e,t,r,u){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=u||Ete,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},r&&(this.functions=Object.create(r),this.functions.context=this)}function A9(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}S9.prototype=A9.prototype={fork(){const e=new A9(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(r=>r!==e);const t=Object.keys(e.nodes);for(const r of t)e.nodes[r]._targets=null;for(const r of t)e.nodes[r].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const r=this,u=r.dataflow,l=e.value;if(r.set(e.id,t),function(d){return TM(d)==="collect"}(e.type)&&l&&(l.$ingest?u.ingest(t,l.$ingest,l.$format):l.$request?u.preload(t,l.$request,l.$format):u.pulse(t,u.changeset().insert(l))),e.root&&(r.root=t),e.parent){let d=r.get(e.parent.$ref);d?(u.connect(d,[t]),t.targets().add(d)):(r.unresolved=r.unresolved||[]).push(()=>{d=r.get(e.parent.$ref),u.connect(d,[t]),t.targets().add(d)})}if(e.signal&&(r.signals[e.signal]=t),e.scale&&(r.scales[e.scale]=t),e.data)for(const d in e.data){const b=r.data[d]||(r.data[d]={});
7835e.data[d].forEach(k=>b[k]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[TM(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,r,u,l){this.dataflow.on(t,r,u,l,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,r=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),r.forEach(u=>t.parseOperator(u)),r.forEach(u=>t.parseOperatorParameters(u)),(e.streams||[]).forEach(u=>t.parseStream(u)),(e.updates||[]).forEach(u=>t.parseUpdate(u)),t.resolve()},parseOperator:function(e){const t=this;!function(r){return TM(r)==="operator"}(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const t=this;if(e.params){const r=t.get(e.id);r||Object(xe.o)("Invalid operator id: "+e.id),t.dataflow.connect(r,r.parameters(t.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,t){t=t||{};const r=this;for(const u in e){const l=e[u];t[u]=Object(xe.B)(l)?l.map(d=>k9(d,r,t)):k9(l,r,t)}return t},parseStream:function(e){var t,r=this,u=e.filter!=null?r.eventExpression(e.filter):void 0,l=e.stream!=null?r.get(e.stream):void 0;e.source?l=r.events(e.source,e.type,u):e.merge&&(l=(t=e.merge.map(d=>r.get(d)))[0].merge.apply(t[0],t.slice(1))),e.between&&(t=e.between.map(d=>r.get(d)),l=l.between(t[0],t[1])),e.filter&&(l=l.filter(u)),e.throttle!=null&&(l=l.throttle(+e.throttle)),e.debounce!=null&&(l=l.debounce(+e.debounce)),l==null&&Object(xe.o)("Invalid stream definition: "+JSON.stringify(e)),e.consume&&l.consume(!0),r.stream(e,l)},parseUpdate:function(e){var t,r=Object(xe.H)(r=e.source)?r.$ref:r,u=this.get(r),l=e.update,d=void 0;u||Object(xe.o)("Source not defined: "+e.source),t=e.target&&e.target.$expr?this.eventExpression(e.target.$expr):this.get(e.target),l&&l.$expr&&(l.$params&&(d=this.parseParameters(l.$params)),l=this.handlerExpression(l.$expr)),this.update(e,u,t,l,d)},getState:function(e){var t=this,r={};if(e.signals){var u=r.signals={};Object.keys(t.signals).forEach(d=>{const b=t.signals[d];e.signals(d,b)&&(u[d]=b.value)})}if(e.data){var l=r.data={};Object.keys(t.data).forEach(d=>{const b=t.data[d];e.data(d,b)&&(l[d]=b.input.value)})}return t.subcontext&&e.recurse!==!1&&(r.subcontext=t.subcontext.map(d=>d.getState(e))),r},setState:function(e){var t=this,r=t.dataflow,u=e.data,l=e.signals;Object.keys(l||{}).forEach(d=>{r.update(t.signals[d],l[d],Cte)}),Object.keys(u||{}).forEach(d=>{r.pulse(t.data[d].input,r.changeset().remove(xe.Ia).insert(u[d]))}),(e.subcontext||[]).forEach((d,b)=>{const k=t.subcontext[b];k&&k.setState(d)})}};var Ste=function(e,t,r){var u=new gO,l=t;return t==null?(u.restart(e,t,r),u):(u._restart=u.restart,u.restart=function(d,b,k){b=+b,k=k==null?xI():+k,u._restart(function T(j){j+=l,u._restart(T,l+=b,k),d(j)},b,k)},u.restart(e,t,r),u)};function O9(e,t){e&&(t==null?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}const NM="default";function IM(e,t){const r=e.globalCursor()?typeof document<"u"&&document.body:e.container();if(r)return t==null?r.style.removeProperty("cursor"):r.style.cursor=t}function GO(e,t){var r=e._runtime.data;return Object(xe.w)(r,t)||Object(xe.o)("Unrecognized data set: "+t),r[t]}function KO(e,t){ci(t)||Object(xe.o)("Second argument to changes must be a changeset.");const r=GO(this,e);return r.modified=!0,this.pulse(r.input,t)}function D9(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function T9(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function YO(e){var t=e.padding(),r=e._origin;return[t.left+r[0],t.top+r[1]]}function Ate(e,t,r){var u,l,d=e._renderer,b=d&&d.canvas();return b&&(l=YO(e),(u=x(t.changedTouches?t.changedTouches[0]:t,b))[0]-=l[0],u[1]-=l[1]),t.dataflow=e,t.item=r,t.vega=function(k,T,j){const $=T?T.mark.marktype==="group"?T:T.mark.group:null;function G(se){var he,ve=$;if(se){for(he=T;he;he=he.mark.group)if(he.mark.name===se){ve=he;break}}return ve&&ve.mark&&ve.mark.interactive?ve:{}}function te(se){if(!se)return j;Object(xe.J)(se)&&(se=G(se));const he=j.slice();for(;se;)he[0]-=se.x||0,he[1]-=se.y||0,se=se.mark&&se.mark.group;return he}return{view:Object(xe.m)(k),item:Object(xe.m)(T||{}),group:G,xy:te,x:se=>te(se)[0],y:se=>te(se)[1]}}(e,r,u),t}const N9="view",Ote="timer",Dte="window",Tte={trap:!1};function I9(e,t,r,u){e._eventListeners.push({type:r,sources:Object(xe.i)(t),handler:u})}function XO(e,t,r){const u=e._eventConfig&&e._eventConfig[t];return!(u===!1||Object(xe.H)(u)&&!u[r])||(e.warn(`Blocked ${t} ${r} event listener.`),!1)}function M9(e){return e.item}function F9(e){return e.item.mark.source}function R9(e){return function(t,r){return r.vega.view().changeset().encode(r.item,e)}}function kg(e,t,r){const u=document.createElement(e);for(const l in t)u.setAttribute(l,t[l]);return r!=null&&(u.textContent=r),u}const Nte="vega-bind",Ite="vega-bind-name",Mte="vega-bind-radio";function Fte(e,t,r,u){const l=r.event||"input",d=()=>e.update(t.value);u.signal(r.signal,t.value),t.addEventListener(l,d),I9(u,t,l,d),e.set=b=>{t.value=b,t.dispatchEvent(function(k){return typeof Event<"u"?new Event(k):{type:k}}(l))}}function Rte(e,t,r,u){const l=u.signal(r.signal),d=kg("div",{class:Nte}),b=r.input==="radio"?d:d.appendChild(kg("label"));b.appendChild(kg("span",{class:Ite},r.name||r.signal)),t.appendChild(d);let k=Bte;switch(r.input){case"checkbox":k=Pte;break;case"select":k=jte;break;case"radio":k=Lte;break;case"range":k=zte}k(e,b,r,l)}function Bte(e,t,r,u){const l=kg("input");for(const d in r)d!=="signal"&&d!=="element"&&l.setAttribute(d==="input"?"type":d,r[d]);l.setAttribute("name",r.signal),l.value=u,t.appendChild(l),l.addEventListener("input",()=>e.update(l.value)),e.elements=[l],e.set=d=>l.value=d}function Pte(e,t,r,u){const l={type:"checkbox",name:r.signal};u&&(l.checked=!0);const d=kg("input",l);t.appendChild(d),d.addEventListener("change",()=>e.update(d.checked)),e.elements=[d],e.set=b=>d.checked=!!b||null}function jte(e,t,r,u){const l=kg("select",{name:r.signal}),d=r.labels||[];r.options.forEach((b,k)=>{const T={value:b};JO(b,u)&&(T.selected=!0),l.appendChild(kg("option",T,(d[k]||b)+""))}),t.appendChild(l),l.addEventListener("change",()=>{e.update(r.options[l.selectedIndex])}),e.elements=[l],e.set=b=>{for(let k=0,T=r.options.length;k<T;++k)if(JO(r.options[k],b))return void(l.selectedIndex=k)}}function Lte(e,t,r,u){const l=kg("span",{class:Mte}),d=r.labels||[];t.appendChild(l),e.elements=r.options.map((b,k)=>{const T={type:"radio",name:r.signal,value:b};JO(b,u)&&(T.checked=!0);const j=kg("input",T);j.addEventListener("change",()=>e.update(b));const $=kg("label",{},(d[k]||b)+"");return $.prepend(j),l.appendChild($),j}),e.set=b=>{const k=e.elements,T=k.length;for(let j=0;j<T;++j)JO(k[j].value,b)&&(k[j].checked=!0)}}function zte(e,t,r,u){u=u!==void 0?u:(+r.max+ +r.min)/2;const l=r.max!=null?r.max:Math.max(100,+u)||100,d=r.min||Math.min(0,l,+u)||0,b=r.step||Object(Rc.c)(d,l,100),k=kg("input",{type:"range",name:r.signal,min:d,max:l,step:b});k.value=u;const T=kg("span",{},+u);t.appendChild(k),t.appendChild(T);const j=()=>{T.textContent=k.value,e.update(+k.value)};k.addEventListener("input",j),k.addEventListener("change",j),e.elements=[k],e.set=$=>{k.value=$,T.textContent=$}}function JO(e,t){return e===t||e+""==t+""}function B9(e,t,r,u,l,d){return(t=t||new u(e.loader())).initialize(r,D9(e),T9(e),YO(e),l,d).background(e.background())}function MM(e,t){return t?function(){try{t.apply(this,arguments)}catch(r){e.error(r)}}:null}function FM(e,t,r){if(typeof t=="string"){if(typeof document>"u")return e.error("DOM document instance not found."),null;if(!(t=document.querySelector(t)))return e.error("Signal bind element not found: "+t),null}if(t&&r)try{t.innerHTML=""}catch(u){t=null,e.error(u)}return t}const UE=e=>+e||0,Ute=e=>({top:e,bottom:e,left:e,right:e});function P9(e){return Object(xe.H)(e)?{top:UE(e.top),bottom:UE(e.bottom),left:UE(e.left),right:UE(e.right)}:Ute(UE(e))}async function RM(e,t,r,u){const l=jr(t),d=l&&l.headless;return d||Object(xe.o)("Unrecognized renderer type: "+t),await e.runAsync(),B9(e,null,null,d,r,u).renderAsync(e._scenegraph.root)}var j9="width",L9="height",BM="padding",z9={skip:!0};function U9(e,t){var r=e.autosize(),u=e.padding();return t-(r&&r.contains===BM?u.left+u.right:0)}function W9(e,t){var r=e.autosize(),u=e.padding();return t-(r&&r.contains===BM?u.top+u.bottom:0)}function Wte(e,t){return t.modified&&Object(xe.B)(t.input.value)&&e.indexOf("_:vega:_")}function Vte(e,t){return!(e==="parent"||t instanceof Sn.proxy)}function $te(e,t,r,u){const l=e.element();l&&l.setAttribute("title",function(d){return d==null?"":Object(xe.B)(d)?V9(d):Object(xe.H)(d)&&!Object(xe.D)(d)?function(b){return Object.keys(b).map(k=>{const T=b[k];return k+": "+(Object(xe.B)(T)?V9(T):$9(T))}).join(` 7836`)}(d):d+""}(u))}function V9(e){return"["+e.map($9).join(", ")+"]"}function $9(e){return Object(xe.B)(e)?"[â¦]":Object(xe.H)(e)&&!Object(xe.D)(e)?"{â¦}":e}function H9(e,t){const r=this;if(t=t||{},Zn.call(r),t.loader&&r.loader(t.loader),t.logger&&r.logger(t.logger),t.logLevel!=null&&r.logLevel(t.logLevel),t.locale||e.locale){const d=Object(xe.p)({},e.locale,t.locale);r.locale(Object(nr.b)(d.number,d.time))}r._el=null,r._elBind=null,r._renderType=t.renderer||yr.Canvas,r._scenegraph=new Dy;const u=r._scenegraph.root;r._renderer=null,r._tooltip=t.tooltip||$te,r._redraw=!0,r._handler=new Ge().scene(u),r._globalCursor=!1,r._preventDefault=!1,r._timers=[],r._eventListeners=[],r._resizeListeners=[],r._eventConfig=function(d){const b=Object(xe.p)({defaults:{}}
7836,d),k=(T,j)=>{j.forEach($=>{Object(xe.B)(T[$])&&(T[$]=Object(xe.Fa)(T[$]))})};return k(b.defaults,["prevent","allow"]),k(b,["view","window","selector"]),b}(e.eventConfig),r.globalCursor(r._eventConfig.globalCursor);const l=function(d,b,k){return C9(d,Sn,LE,k).parse(b)}(r,e,t.expr);r._runtime=l,r._signals=l.signals,r._bind=(e.bindings||[]).map(d=>({state:null,param:Object(xe.p)({},d)})),l.root&&l.root.set(u),u.source=l.data.root.input,r.pulse(l.data.root.input,r.changeset().insert(u.items)),r._width=r.width(),r._height=r.height(),r._viewWidth=U9(r,r._width),r._viewHeight=W9(r,r._height),r._origin=[0,0],r._resize=0,r._autosize=1,function(d){var b=d._signals,k=b[j9],T=b[L9],j=b[BM];function $(){d._autosize=d._resize=1}d._resizeWidth=d.add(null,te=>{d._width=te.size,d._viewWidth=U9(d,te.size),$()},{size:k}),d._resizeHeight=d.add(null,te=>{d._height=te.size,d._viewHeight=W9(d,te.size),$()},{size:T});const G=d.add(null,$,{pad:j});d._resizeWidth.rank=k.rank+1,d._resizeHeight.rank=T.rank+1,G.rank=j.rank+1}(r),function(d){d.add(null,b=>(d._background=b.bg,d._resize=1,b.bg),{bg:d._signals.background})}(r),function(d){const b=d._signals.cursor||(d._signals.cursor=d.add({user:NM,item:null}));d.on(d.events("view","mousemove"),b,(k,T)=>{const j=b.value,$=j?Object(xe.J)(j)?j:j.user:NM,G=T.item&&T.item.cursor||null;return j&&$===j.user&&G==j.item?j:{user:$,item:G}}),d.add(null,function(k){let T=k.cursor,j=this.value;return Object(xe.J)(T)||(j=T.item,T=T.user),IM(d,T&&T!==NM?T:j||T),j},{cursor:b})}(r),r.description(e.description),t.hover&&r.hover(),t.container&&r.initialize(t.container,t.bind)}function QO(e,t){return Object(xe.w)(e._signals,t)?e._signals[t]:Object(xe.o)("Unrecognized signal name: "+Object(xe.Ba)(t))}function q9(e,t){const r=(e._targets||[]).filter(u=>u._update&&u._update.handler===t);return r.length?r[0]:null}function G9(e,t,r,u){let l=q9(r,u);return l||((l=MM(e,()=>u(t,r.value))).handler=u,e.on(r,null,l)),e}function K9(e,t,r){const u=q9(t,r);return u&&t._targets.remove(u),e}Object(xe.z)(H9,Zn,{async evaluate(e,t,r){if(await Zn.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(u){var l=YO(u),d=D9(u),b=T9(u);u._renderer.background(u.background()),u._renderer.resize(d,b,l),u._handler.origin(l),u._resizeListeners.forEach(k=>{try{k(d,b)}catch(T){u.error(T)}})}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(u){this.error(u)}return r&&cr(this,r),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=e!=null?e+"":null;return t!==this._desc&&O9(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,r){const u=QO(this,e);return arguments.length===1?u.value:this.update(u,t,r)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",P9(e)):P9(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(jr(e)||Object(xe.o)("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(Zn.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(QO(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,r,u,l,d){this.runAfter(b=>{let k=0;b._autosize=0,b.width()!==r&&(k=1,b.signal(j9,r,z9),b._resizeWidth.skip(!0)),b.height()!==u&&(k=1,b.signal(L9,u,z9),b._resizeHeight.skip(!0)),b._viewWidth!==e&&(b._resize=1,b._viewWidth=e),b._viewHeight!==t&&(b._resize=1,b._viewHeight=t),b._origin[0]===l[0]&&b._origin[1]===l[1]||(b._resize=1,b._origin=l),k&&b.run("enter"),d&&b.runAfter(T=>T.resize())},!1,1)},addEventListener(e,t,r){let u=t;return r&&r.trap===!1||((u=MM(this,t)).raw=t),this._handler.on(e,u),this},removeEventListener(e,t){for(var r,u,l=this._handler.handlers(e),d=l.length;--d>=0;)if(u=l[d].type,r=l[d].handler,e===u&&(t===r||t===r.raw)){this._handler.off(u,r);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this}
7836,removeResizeListener(e){var t=this._resizeListeners,r=t.indexOf(e);return r>=0&&t.splice(r,1),this},addSignalListener(e,t){return G9(this,e,QO(this,e),t)},removeSignalListener(e,t){return K9(this,QO(this,e),t)},addDataListener(e,t){return G9(this,e,GO(this,e).values,t)},removeDataListener(e,t){return K9(this,GO(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=IM(this,null);this._globalCursor=!!e,t&&IM(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push(Ste(function(r){e({timestamp:Date.now(),elapsed:r})},t))},events:function(e,t,r){var u,l=this,d=new $i(r),b=function(j,$){l.runAsync(null,()=>{e===N9&&function(G,te){var se=G._eventConfig.defaults,he=se.prevent,ve=se.allow;return he!==!1&&ve!==!0&&(he===!0||ve===!1||(he?he[te]:ve?!ve[te]:G.preventDefault()))}(l,t)&&j.preventDefault(),d.receive(Ate(l,j,$))})};if(e===Ote)XO(l,"timer",t)&&l.timer(b,t);else if(e===N9)XO(l,"view",t)&&l.addEventListener(t,b,Tte);else if(e===Dte?XO(l,"window",t)&&typeof window<"u"&&(u=[window]):typeof document<"u"&&XO(l,"selector",t)&&(u=document.querySelectorAll(e)),u){for(var k=0,T=u.length;k<T;++k)u[k].addEventListener(t,b);I9(l,u,t,b)}else l.warn("Can not resolve event source: "+e);return d},finalize:function(){var e,t,r,u=this._tooltip,l=this._timers,d=this._eventListeners;for(e=l.length;--e>=0;)l[e].stop();for(e=d.length;--e>=0;)for(t=(r=d[e]).sources.length;--t>=0;)r.sources[t].removeEventListener(r.type,r.handler);return u&&u.call(this,this._handler,null,null,null),this},hover:function(e,t){return e=[e||"hover"],t=[t||"update",e[0]],this.on(this.events("view","mouseover",M9),F9,R9(e)),this.on(this.events("view","mouseout",M9),F9,R9(t)),this},data:function(e,t){return arguments.length<2?GO(this,e).values.value:KO.call(this,e,qr().remove(xe.Ia).insert(t))},change:KO,insert:function(e,t){return KO.call(this,e,qr().insert(t))},remove:function(e,t){return KO.call(this,e,qr().remove(t))},scale:function(e){var t=this._runtime.scales;return Object(xe.w)(t,e)||Object(xe.o)("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const r=this,u=r._renderType,l=r._eventConfig.bind,d=jr(u);e=r._el=e?FM(r,e,!0):null,function(T){const j=T.container();j&&(j.setAttribute("role","graphics-document"),j.setAttribute("aria-roleDescription","visualization"),O9(j,T.description()))}(r),d||r.error("Unrecognized renderer type: "+u);const b=d.handler||Ge,k=e?d.renderer:d.headless;return r._renderer=k?B9(r,r._renderer,e,k):null,r._handler=function(T,j,$,G){const te=new G(T.loader(),MM(T,T.tooltip())).scene(T.scenegraph().root).initialize($,YO(T),T);return j&&j.handlers().forEach(se=>{te.on(se.type,se.handler)}),te}(r,r._handler,e,b),r._redraw=!0,e&&l!=="none"&&(t=t?r._elBind=FM(r,t,!0):e.appendChild(kg("form",{class:"vega-bindings"})),r._bind.forEach(T=>{T.param.element&&l!=="container"&&(T.element=FM(r,T.param.element,!!T.param.input))}),r._bind.forEach(T=>{(function(j,$,G){if(!$)return;const te=G.param;let se=G.state;se||(se=G.state={elements:null,active:!1,set:null,update:he=>{he!=j.signal(te.signal)&&j.runAsync(null,()=>{se.source=!0,j.signal(te.signal,he)})}},te.debounce&&(se.update=Object(xe.n)(te.debounce,se.update))),(te.input==null&&te.element?Fte:Rte)(se,$,te,j),se.active||(j.on(j._signals[te.signal],null,()=>{se.source?se.source=!1:se.set(j.signal(te.signal))}),se.active=!0)})(r,T.element||t,T)})),r},toImageURL:async function(e,t){e!==yr.Canvas&&e!==yr.SVG&&e!==yr.PNG&&Object(xe.o)("Unrecognized image type: "+e);const r=await RM(this,e,t);return e===yr.SVG?function(u,l){const d=new Blob([u],{type:l});return window.URL.createObjectURL(d)}(r.svg(),"image/svg+xml"):r.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await RM(this,yr.Canvas,e,t)).canvas()},toSVG:async function(e){return(await RM(this,yr.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:Wte,signals:Vte,recurse:!0})},setState:function(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},t=>{t._trigger=!0}),this}});const Hte="view",ZO="[",e3="]",Y9="{",X9="}",qte=":",J9=",",Gte="@",Kte=">",Yte=/[[\]{}]/,Xte={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let Q9,Z9;function WE(e,t,r,u,l){const d=e.length;let b,k=0;for(;t<d;++t){if(b=e[t],!k&&b===r)return t;l&&l.indexOf(b)>=0?--k:u&&u.indexOf(b)>=0&&++k}return t}function e7(e){const t=[],r=e.length;let u=0,l=0;for(;l<r;
7836)l=WE(e,l,J9,ZO+Y9,e3+X9),t.push(e.substring(u,l).trim()),u=++l;if(t.length===0)throw"Empty event selector: "+e;return t}function PM(e){return e[0]==="["?function(t){const r=t.length;let u,l=1;if((l=WE(t,l,e3,ZO,e3))===r)throw"Empty between selector: "+t;if((u=e7(t.substring(1,l))).length!==2)throw"Between selector must have two elements: "+t;if((t=t.slice(l+1).trim())[0]!==Kte)throw"Expected '>' after between selector: "+t;u=u.map(PM);const d=PM(t.slice(1).trim());return d.between?{between:u,stream:d}:(d.between=u,d)}(e):function(t){const r={source:Q9},u=[];let l,d,b=[0,0],k=0,T=0,j=t.length,$=0;if(t[j-1]===X9){if(!(($=t.lastIndexOf(Y9))>=0))throw"Unmatched right brace: "+t;try{b=function(G){const te=G.split(J9);if(!G.length||te.length>2)throw G;return te.map(se=>{const he=+se;if(he!=he)throw G;return he})}(t.substring($+1,j-1))}catch{throw"Invalid throttle specification: "+t}t=t.slice(0,$).trim(),j=t.length,$=0}if(!j)throw t;if(t[0]===Gte&&(k=++$),(l=WE(t,$,qte))<j&&(u.push(t.substring(T,l).trim()),T=$=++l),($=WE(t,$,ZO))===j)u.push(t.substring(T,j).trim());else if(u.push(t.substring(T,$).trim()),d=[],(T=++$)===j)throw"Unmatched left bracket: "+t;for(;$<j;){if(($=WE(t,$,e3))===j)throw"Unmatched left bracket: "+t;if(d.push(t.substring(T,$).trim()),$<j-1&&t[++$]!==ZO)throw"Expected left bracket: "+t;T=++$}if(!(j=u.length)||Yte.test(u[j-1]))throw"Invalid event selector: "+t;return j>1?(r.type=u[1],k?r.markname=u[0].slice(1):function(G){return Z9[G]}(u[0])?r.marktype=u[0]:r.source=u[0]):r.type=u[0],r.type.slice(-1)==="!"&&(r.consume=!0,r.type=r.type.slice(0,-1)),d!=null&&(r.filter=d),b[0]&&(r.throttle=b[0]),b[1]&&(r.debounce=b[1]),r}(e)}const VE=e=>+e||0,Jte=e=>({top:e,bottom:e,left:e,right:e}),uf=e=>Object(xe.H)(e)&&!Object(xe.B)(e)?Object(xe.p)({},e):{value:e};function t7(e,t,r,u){return r!=null?(Object(xe.H)(r)&&!Object(xe.B)(r)||Object(xe.B)(r)&&r.length&&Object(xe.H)(r[0])?e.update[t]=r:e[u||"enter"][t]={value:r},1):0}function Gf(e,t,r){for(const u in t)t7(e,u,t[u]);for(const u in r)t7(e,u,r[u],"update")}function m_(e,t,r){for(const u in t)r&&Object(xe.w)(r,u)||(e[u]=Object(xe.p)(e[u]||{},t[u]));return e}function g_(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const jM="mark",LM="frame",zM="scope",Qte="axis",Zte="axis-domain",ene="axis-grid",tne="axis-label",nne="axis-tick",rne="axis-title",ine="legend",one="legend-band",ane="legend-entry",sne="legend-gradient",n7="legend-label",une="legend-symbol",cne="legend-title",lne="title",fne="title-text",dne="title-subtitle";function UM(e,t,r){e[t]=r&&r.signal?{signal:r.signal}:{value:r}}const r7=e=>Object(xe.J)(e)?Object(xe.Ba)(e):e.signal?`(${e.signal})`:i7(e);function t3(e){if(e.gradient!=null)return function(r){const u=[r.start,r.stop,r.count].map(l=>l==null?null:Object(xe.Ba)(l));for(;u.length&&Object(xe.W)(u)==null;)u.pop();return u.unshift(r7(r.gradient)),`gradient(${u.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(r){return r.c?n3("hcl",r.h,r.c,r.l):r.h||r.s?n3("hsl",r.h,r.s,r.l):r.l||r.a?n3("lab",r.l,r.a,r.b):r.r||r.g||r.b?n3("rgb",r.r,r.g,r.b):null}(e.color):e.field!=null?i7(e.field):e.value!==void 0?Object(xe.Ba)(e.value):void 0;return e.scale!=null&&(t=function(r,u){const l=r7(r.scale);return r.range!=null?u=`lerp(_range(${l}), ${+r.range})`:(u!==void 0&&(u=`_scale(${l}, ${u})`),r.band&&(u=(u?u+"+":"")+`_bandwidth(${l})`+(+r.band==1?"":"*"+r3(r.band)),r.extra&&(u=`(datum.extra ? _scale(${l}, datum.extra.value) : ${u})`)),u==null&&(u="0")),u}(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${r3(e.exponent)})`),e.mult!=null&&(t+=`*${r3(e.mult)}`),e.offset!=null&&(t+=`+${r3(e.offset)}`),e.round&&(t=`round(${t})`),t}const n3=(e,t,r,u)=>`(${e}(${[t,r,u].map(t3).join(",")})+'')`;function r3(e){return Object(xe.H)(e)?"("+t3(e)+")":e}function i7(e){return function t(r){let u,l,d;if(r.signal)u="datum",d=r.signal;else if(r.group||r.parent){for(l=Math.max(1,r.level||1),u="item";l-- >0;)u+=".mark.group";r.parent?(d=r.parent,u+=".datum"):d=r.group}else r.datum?(u="datum",d=r.datum):Object(xe.o)("Invalid field reference: "+Object(xe.Ba)(r));return r.signal||(d=Object(xe.J)(d)?Object(xe.Aa)(d).map(xe.Ba).join("]["):t(d)),u+"["+d+"]"}(Object(xe.H)(e)?e:{datum:e})}function o7(e,t,r,u,l,d){const b={};(d=d||{}).encoders={$encode:b},e=function(k,T,j,$,G){const te={},se={};let he,ve,Be;for(ve in ve="lineBreak",T!=="text"||G[ve]==null||g_(ve,k)||UM(te,ve,G[ve]),(j=="legend"||String(j).startsWith("axis"))&&(j=null),Be=j===LM?G.group:j===jM?Object(xe.p)({}
7836,G.mark,G[T]):null)g_(ve,k)||(ve==="fill"||ve==="stroke")&&(g_("fill",k)||g_("stroke",k))||UM(te,ve,Be[ve]);for(ve in Object(xe.i)($).forEach(ze=>{const Ue=G.style&&G.style[ze];for(const st in Ue)g_(st,k)||UM(te,st,Ue[st])}),k=Object(xe.p)({},k),te)(Be=te[ve]).signal?(he=he||{})[ve]=Be:se[ve]=Be;return k.enter=Object(xe.p)(se,k.enter),he&&(k.update=Object(xe.p)(he,k.update)),k}(e,t,r,u,l.config);for(const k in e)b[k]=hne(e[k],t,d,l);return d}function hne(e,t,r,u){const l={},d={};for(const b in e)e[b]!=null&&(l[b]=mne(pne(e[b]),u,r,d));return{$expr:{marktype:t,channels:l},$fields:Object.keys(d),$output:Object.keys(e)}}function pne(e){return Object(xe.B)(e)?function(t){let r="";return t.forEach(u=>{const l=t3(u);r+=u.test?`(${u.test})?${l}:`:l}),Object(xe.W)(r)===":"&&(r+="null"),r}(e):t3(e)}function mne(e,t,r,u){const l=By(e,t);return l.$fields.forEach(d=>u[d]=1),Object(xe.p)(r,l.$params),l.$expr}const gne="outer",vne=["value","update","init","react","bind"];function a7(e,t){Object(xe.o)(e+' for "outer" push: '+Object(xe.Ba)(t))}function s7(e,t){const r=e.name;if(e.push===gne)t.signals[r]||a7("No prior signal definition",r),vne.forEach(u=>{e[u]!==void 0&&a7("Invalid property ",u)});else{const u=t.addSignal(r,e.value);e.react===!1&&(u.react=!1),e.bind&&t.addBinding(r,e.bind)}}function WM(e,t,r,u){this.id=-1,this.type=e,this.value=t,this.params=r,u&&(this.parent=u)}function i3(e,t,r,u){return new WM(e,t,r,u)}function o3(e,t){return i3("operator",e,t)}function oo(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function $E(e,t){return t?{$field:e,$name:t}:{$field:e}}const VM=$E("key");function u7(e,t){return{$compare:e,$order:t}}const yne="descending";function a3(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const $M="scope",HM="view";function Fl(e){return e&&e.signal}function s3(e){if(Fl(e))return!0;if(Object(xe.H)(e)){for(const t in e)if(s3(e[t]))return!0}return!1}function mv(e,t){return e??t}function xw(e){return e&&e.signal||e}const c7="timer";function HE(e,t){return(e.merge?bne:e.stream?xne:e.type?wne:Object(xe.o)("Invalid stream specification: "+Object(xe.Ba)(e)))(e,t)}function bne(e,t){const r=qM({merge:e.merge.map(u=>HE(u,t))},e,t);return t.addStream(r).id}function xne(e,t){const r=qM({stream:HE(e.stream,t)},e,t);return t.addStream(r).id}function wne(e,t){let r;e.type===c7?(r=t.event(c7,e.throttle),e={between:e.between,filter:e.filter}):r=t.event(function(l){return l===$M?HM:l||HM}(e.source),e.type);const u=qM({stream:r},e,t);return Object.keys(u).length===1?r:t.addStream(u).id}function qM(e,t,r){let u=t.between;return u&&(u.length!==2&&Object(xe.o)('Stream "between" parameter must have 2 entries: '+Object(xe.Ba)(t)),e.between=[HE(u[0],r),HE(u[1],r)]),u=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&u.push(function(l,d,b){const k="event.item";return k+(l&&l!=="*"?"&&"+k+".mark.marktype==='"+l+"'":"")+(b?"&&"+k+".mark.role==='"+b+"'":"")+(d?"&&"+k+".mark.name==='"+d+"'":"")}(t.marktype,t.markname,t.markrole)),t.source===$M&&u.push("inScope(event.item)"),u.length&&(e.filter=By("("+u.join(")&&(")+")",r).$expr),(u=t.throttle)!=null&&(e.throttle=+u),(u=t.debounce)!=null&&(e.debounce=+u),t.consume&&(e.consume=!0),e}const _ne={code:"_.$value",ast:{type:"Identifier",value:"value"}};function kne(e,t,r){const u=e.encode,l={target:r};let d=e.events,b=e.update,k=[];d||Object(xe.o)("Signal update missing events specification."),Object(xe.J)(d)&&(d=function(T,j,$){return Q9=j||Hte,Z9=$||Xte,e7(T.trim()).map(PM)}(d,t.isSubscope()?$M:HM)),d=Object(xe.i)(d).filter(T=>T.signal||T.scale?(k.push(T),0):1),k.length>1&&(k=[function(T){return{signal:"["+T.map(j=>j.scale?'scale("'+j.scale+'")':j.signal)+"]"}}(k)]),d.length&&k.push(d.length>1?{merge:d}:d[0]),u!=null&&(b&&Object(xe.o)("Signal encode and update are mutually exclusive."),b="encode(item(),"+Object(xe.Ba)(u)+")"),l.update=Object(xe.J)(b)?By(b,t):b.expr!=null?By(b.expr,t):b.value!=null?b.value:b.signal!=null?{$expr:_ne,$params:{$value:t.signalRef(b.signal)}}:Object(xe.o)("Invalid signal update specification."),e.force&&(l.options={force:!0}
7836),k.forEach(T=>t.addUpdate(Object(xe.p)(function(j,$){return{source:j.signal?$.signalRef(j.signal):j.scale?$.scaleRef(j.scale):HE(j,$)}}(T,t),l)))}const Xs=e=>(t,r,u)=>i3(e,r,t||void 0,u),l7=Xs("aggregate"),Ene=Xs("axisticks"),f7=Xs("bound"),gv=Xs("collect"),d7=Xs("compare"),Cne=Xs("datajoin"),h7=Xs("encode"),Sne=Xs("expression"),Ane=Xs("facet"),One=Xs("field"),Dne=Xs("key"),Tne=Xs("legendentries"),Nne=Xs("load"),Ine=Xs("mark"),Mne=Xs("multiextent"),Fne=Xs("multivalues"),Rne=Xs("overlap"),Bne=Xs("params"),p7=Xs("prefacet"),Pne=Xs("projection"),jne=Xs("proxy"),Lne=Xs("relay"),m7=Xs("render"),zne=Xs("scale"),ww=Xs("sieve"),Une=Xs("sortitems"),g7=Xs("viewlayout"),Wne=Xs("values");let Vne=0;const v7={min:"min",max:"max",count:"sum"};function $ne(e,t){const r=t.getScale(e.name).params;let u;for(u in r.domain=y7(e.domain,e,t),e.range!=null&&(r.range=function l(d,b,k){const T=b.config.range;let j=d.range;if(j.signal)return b.signalRef(j.signal);if(Object(xe.J)(j)){if(T&&Object(xe.w)(T,j))return d=Object(xe.p)({},d,{range:T[j]}),l(d,b,k);j==="width"?j=[0,{signal:"width"}]:j==="height"?j=Ih(d.type)?[0,{signal:"height"}]:[{signal:"height"},0]:Object(xe.o)("Unrecognized scale range value: "+Object(xe.Ba)(j))}else{if(j.scheme)return k.scheme=Object(xe.B)(j.scheme)?u3(j.scheme,b):g0(j.scheme,b),j.extent&&(k.schemeExtent=u3(j.extent,b)),void(j.count&&(k.schemeCount=g0(j.count,b)));if(j.step)return void(k.rangeStep=g0(j.step,b));if(Ih(d.type)&&!Object(xe.B)(j))return y7(j,d,b);Object(xe.B)(j)||Object(xe.o)("Unsupported range type: "+Object(xe.Ba)(j))}return j.map($=>(Object(xe.B)($)?u3:g0)($,b))}(e,t,r)),e.interpolate!=null&&function(l,d){d.interpolate=g0(l.type||l),l.gamma!=null&&(d.interpolateGamma=g0(l.gamma))}(e.interpolate,r),e.nice!=null&&(r.nice=function(l){return Object(xe.H)(l)?{interval:g0(l.interval),step:g0(l.step)}:g0(l)}(e.nice)),e.bins!=null&&(r.bins=function(l,d){return l.signal||Object(xe.B)(l)?u3(l,d):d.objectProperty(l)}(e.bins,t)),e)Object(xe.w)(r,u)||u==="name"||(r[u]=g0(e[u],t))}function g0(e,t){return Object(xe.H)(e)?e.signal?t.signalRef(e.signal):Object(xe.o)("Unsupported object: "+Object(xe.Ba)(e)):e}function u3(e,t){return e.signal?t.signalRef(e.signal):e.map(r=>g0(r,t))}function c3(e){Object(xe.o)("Can not find data set: "+Object(xe.Ba)(e))}function y7(e,t,r){if(e)return e.signal?r.signalRef(e.signal):(Object(xe.B)(e)?function(u,l,d){return u.map(b=>g0(b,d))}:e.fields?function(u,l,d){const b=u.data,k=u.fields.reduce((T,j)=>(j=Object(xe.J)(j)?{data:b,field:j}:Object(xe.B)(j)||j.signal?function($,G){const te="_:vega:_"+Vne++,se=gv({});if(Object(xe.B)($))se.value={$ingest:$};else if($.signal){const he="setdata("+Object(xe.Ba)(te)+","+$.signal+")";se.params.input=G.signalRef(he)}return G.addDataPipeline(te,[se,ww({})]),{data:te,field:"data"}}(j,d):j,T.push(j),T),[]);return(Ih(l.type)?function(T,j,$){const G=b7(T.sort,!0);let te,se;const he=$.map(ze=>{const Ue=j.getData(ze.data);return Ue||c3(ze.data),Ue.countsRef(j,ze.field,G)}),ve={groupby:VM,pulse:he};G&&(te=G.op||"count",se=G.field?a3(te,G.field):"count",ve.ops=[v7[te]],ve.fields=[j.fieldRef(se)],ve.as=[se]),te=j.add(l7(ve));const Be=j.add(gv({pulse:oo(te)}));return oo(se=j.add(Wne({field:VM,sort:j.sortRef(G),pulse:oo(Be)})))}:Xg(l.type)?function(T,j,$){const G=$.map(te=>{const se=j.getData(te.data);return se||c3(te.data),se.domainRef(j,te.field)});return oo(j.add(Fne({values:G})))}:function(T,j,$){const G=$.map(te=>{const se=j.getData(te.data);return se||c3(te.data),se.extentRef(j,te.field)});return oo(j.add(Mne({extents:G})))})(u,d,k)}:function(u,l,d){const b=d.getData(u.data);return b||c3(u.data),Ih(l.type)?b.valuesRef(d,u.field,b7(u.sort,!1)):Xg(l.type)?b.domainRef(d,u.field):b.extentRef(d,u.field)})(e,t,r);t.domainMin==null&&t.domainMax==null||Object(xe.o)("No scale domain defined for domainMin/domainMax to override.")}function b7(e,t){return e&&(e.field||e.op?e.field||e.op==="count"?t&&e.field&&e.op&&!v7[e.op]&&Object(xe.o)("Multiple domain scales can not be sorted using "+e.op):Object(xe.o)("No field provided for sort aggregate op: "+e.op):Object(xe.H)(e)?e.field="
7836key":e={field:"key"}),e}function GM(e,t,r){return Object(xe.B)(e)?e.map(u=>GM(u,t,r)):Object(xe.H)(e)?e.signal?r.signalRef(e.signal):t==="fit"?e:Object(xe.o)("Unsupported parameter object: "+Object(xe.Ba)(e)):e}const vv="top",Kb="bottom",Hne="vertical",qne="start",Gne="end",KM="index",YM="label",Kne="offset",v_="perc",Yne="perc2",v0="value",qE="guide-label",XM="guide-title",Xne="group-title",Jne="group-subtitle",x7="symbol",l3="gradient",JM="discrete",QM="size",ZM=[QM,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],GE={name:1,style:1,interactive:1},ts={value:0},y0={value:1},f3="group",w7="rect",eF="rule",Qne="symbol",_w="text";function KE(e){return e.type=f3,e.interactive=e.interactive||!1,e}function dm(e,t){const r=(u,l)=>mv(e[u],mv(t[u],l));return r.isVertical=u=>Hne===mv(e.direction,t.direction||(u?t.symbolDirection:t.gradientDirection)),r.gradientLength=()=>mv(e.gradientLength,t.gradientLength||t.gradientWidth),r.gradientThickness=()=>mv(e.gradientThickness,t.gradientThickness||t.gradientHeight),r.entryColumns=()=>mv(e.columns,mv(t.columns,+r.isVertical(!0))),r}function _7(e,t){const r=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return r&&r.signal?r:r?r.value:null}function d3(e,t,r){return`item.anchor === '${qne}' ? ${e} : item.anchor === '${Gne}' ? ${t} : ${r}`}const tF=d3(Object(xe.Ba)("left"),Object(xe.Ba)("right"),Object(xe.Ba)("center"));function Eg(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=m_(e.encode,t,GE)):e.interactive=!1,e}const Zne=`datum.${v_}<=0?"left":datum.${v_}>=1?"right":"center"`,ere=`datum.${v_}<=0?"${Kb}":datum.${v_}>=1?"${vv}":"middle"`;function k7(e,t,r,u){const l=dm(e,t),d=l.isVertical(),b=uf(l.gradientThickness()),k=l.gradientLength();let T,j,$,G,te=l("labelOverlap"),se="";const he={enter:T={opacity:ts},update:j={opacity:y0,text:{field:YM}},exit:{opacity:ts}};return Gf(he,{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:mv(e.labelLimit,t.gradientLabelLimit)}),d?(T.align={value:"left"},T.baseline=j.baseline={signal:ere},$="y",G="x",se="1-"):(T.align=j.align={signal:Zne},T.baseline={value:"top"},$="x",G="y"),T[$]=j[$]={signal:se+"datum."+v_,mult:k},T[G]=j[G]=b,b.offset=mv(e.labelOffset,t.gradientLabelOffset)||0,te=te?{separation:l("labelSeparation"),method:te,order:"datum."+KM}:void 0,Eg({type:_w,role:n7,style:qE,key:v0,from:u,encode:he,overlap:te},r)}const h3='(item.orient === "left" || item.orient === "right")',tre=`datum.vgrad && ${h3}`,nre=d3('"top"','"bottom"','"middle"'),rre=`datum.vgrad && item.orient === "right" ? (${d3('"right"','"left"','"center"')}) : (${h3} && !(datum.vgrad && item.orient === "left")) ? "left" : ${tF}`,ire=`item._anchor || (${h3} ? "middle" : "start")`,ore=`${tre} ? (item.orient === "left" ? -90 : 90) : 0`,are=`${h3} ? (datum.vgrad ? (item.orient === "right" ? "bottom" : "top") : ${nre}) : "top"`;function E7(e){return Object(xe.H)(e)&&e.signal?e.signal:Object(xe.Ba)(e)}function C7(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===f3?zM:t||jM:t}function nF(e,t){const r=un(e.type);r||Object(xe.o)("Unrecognized transform type: "+Object(xe.Ba)(e.type));const u=i3(r.type.toLowerCase(),null,S7(r,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(u)),u.metadata=r.metadata||{},u}function S7(e,t,r){const u={},l=e.params.length;for(let d=0;d<l;++d){const b=e.params[d];u[b.name]=sre(b,t,r)}return u}function sre(e,t,r){const u=e.type,l=t[e.name];return u==="index"?function(d,b,k){return Object(xe.J)(b.from)||Object(xe.o)('Lookup "from" parameter must be a string literal.'),k.getData(b.from).lookupRef(k,b.key)}(0,t,r):l!==void 0?u==="param"?function(d,b,k){const T=b[d.name];return d.array?(Object(xe.B)(T)||Object(xe.o)("Expected an array of sub-parameters. Instead: "+Object(xe.Ba)(T)),T.map(j=>O7(d,j,k))):O7(d,T,k)}(e,t,r):u==="projection"?r.projectionRef(t[e.name]):e.array&&!Fl(l)?l.map(d=>A7(e,d,r)):A7(e,l,r):void(e.required&&Object(xe.o)("Missing required "+Object(xe.Ba)(t.type)+" parameter: "+Object(xe.Ba)(e.name)))}function A7(e,t,r){const u=e.type;if(Fl(t))return D7(u)?Object(xe.o)("Expression references can not be signals."):rF(u)?r.fieldRef(t):T7(u)?r.compareRef(t):r.signalRef(t.signal);{const l=e.expr||rF(u);
7836return l&&ure(t)?r.exprRef(t.expr,t.as):l&&cre(t)?$E(t.field,t.as):D7(u)?By(t,r):lre(u)?oo(r.getData(t).values):rF(u)?$E(t):T7(u)?r.compareRef(t):t}}function O7(e,t,r){const u=e.params.length;let l;for(let b=0;b<u;++b){l=e.params[b];for(const k in l.key)if(l.key[k]!==t[k]){l=null;break}if(l)break}l||Object(xe.o)("Unsupported parameter: "+Object(xe.Ba)(t));const d=Object(xe.p)(S7(l,t,r),l.key);return oo(r.add(Bne(d)))}const ure=e=>e&&e.expr,cre=e=>e&&e.field,lre=e=>e==="data",D7=e=>e==="expr",rF=e=>e==="field",T7=e=>e==="compare";function p3(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:oo(t.getData(e.data).output)}function kw(e,t,r,u,l){this.scope=e,this.input=t,this.output=r,this.values=u,this.aggregate=l,this.index={}}function N7(e){return Object(xe.J)(e)?e:null}function I7(e,t,r){const u=a3(r.op,r.field);let l;if(t.ops){for(let d=0,b=t.as.length;d<b;++d)if(t.as[d]===u)return}else t.ops=["count"],t.fields=[null],t.as=["count"];r.op&&(t.ops.push((l=r.op.signal)?e.signalRef(l):r.op),t.fields.push(e.fieldRef(r.field)),t.as.push(u))}function YE(e,t,r,u,l,d,b){const k=t[r]||(t[r]={}),T=function(te){return Object(xe.H)(te)?(te.order===yne?"-":"+")+a3(te.op,te.field):""}(d);let j,$,G=N7(l);if(G!=null&&(e=t.scope,j=k[G+=T?"|"+T:""]),!j){const te=d?{field:VM,pulse:t.countsRef(e,l,d)}:{field:e.fieldRef(l),pulse:oo(t.output)};T&&(te.sort=e.sortRef(d)),$=e.add(i3(u,void 0,te)),b&&(t.index[l]=$),j=oo($),G!=null&&(k[G]=j)}return j}function M7(e,t,r){const u=e.remove,l=e.insert,d=e.toggle,b=e.modify,k=e.values,T=t.add(o3()),j=By("if("+e.trigger+',modify("'+r+'",'+[l,u,d,b,k].map($=>$??"null").join(",")+"),0)",t);T.update=j.$expr,T.params=j.$params}function m3(e,t){const r=C7(e),u=e.type===f3,l=e.from&&e.from.facet,d=e.overlap;let b,k,T,j,$,G,te,se=e.layout||r===zM||r===LM;const he=r===jM||se||l,ve=function(pt,Ct,Et){let mn,An,xn,Wn,Un;return pt?(mn=pt.facet)&&(Ct||Object(xe.o)("Only group marks can be faceted."),mn.field!=null?Wn=Un=p3(mn,Et):(pt.data?Un=oo(Et.getData(pt.data).aggregate):((xn=nF(Object(xe.p)({type:"aggregate",groupby:Object(xe.i)(mn.groupby)},mn.aggregate),Et)).params.key=Et.keyRef(mn.groupby),xn.params.pulse=p3(mn,Et),Wn=Un=oo(Et.add(xn))),An=Et.keyRef(mn.groupby,!0))):Wn=oo(Et.add(gv(null,[{}]))),Wn||(Wn=p3(pt,Et)),{key:An,pulse:Wn,parent:Un}}
7836(e.from,u,t),Be=oo(k=t.add(Cne({key:ve.key||(e.key?$E(e.key):void 0),pulse:ve.pulse,clean:!u})));k=T=t.add(gv({pulse:Be}));const ze=oo(k=t.add(Ine({markdef:function(pt){return{marktype:pt.type,name:pt.name||void 0,role:pt.role||C7(pt),zindex:+pt.zindex||void 0,aria:pt.aria,description:pt.description}}(e),interactive:function(pt,Ct){return pt&&pt.signal?Ct.signalRef(pt.signal):pt!==!1}(e.interactive,t),clip:function(pt,Ct){let Et;return Object(xe.H)(pt)&&(pt.signal?Et=pt.signal:pt.path?Et="pathShape("+E7(pt.path)+")":pt.sphere&&(Et="geoShape("+E7(pt.sphere)+', {type: "Sphere"})')),Et?Ct.signalRef(Et):!!pt}(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:oo(k)})));(k=j=t.add(h7(o7(e.encode,e.type,r,e.style,t,{mod:!1,pulse:ze})))).params.parent=t.encode(),e.transform&&e.transform.forEach(pt=>{const Ct=nF(pt,t),Et=Ct.metadata;(Et.generates||Et.changes)&&Object(xe.o)("Mark transforms should not generate new data."),Et.nomod||(j.params.mod=!0),Ct.params.pulse=oo(k),t.add(k=Ct)}),e.sort&&(k=t.add(Une({sort:t.compareRef(e.sort),pulse:oo(k)})));const Ue=oo(k);(l||se)&&(G=oo(se=t.add(g7({layout:t.objectProperty(e.layout),legends:t.legends,mark:ze,pulse:Ue}))));const st=t.add(f7({mark:ze,pulse:G||Ue}));te=oo(st),u&&(he&&((b=t.operators).pop(),se&&b.pop()),t.pushState(Ue,G||te,Be),l?function(pt,Ct,Et){const mn=pt.from.facet,An=mn.name,xn=p3(mn,Ct);let Wn;mn.name||Object(xe.o)("Facet must have a name: "+Object(xe.Ba)(mn)),mn.data||Object(xe.o)("Facet must reference a data set: "+Object(xe.Ba)(mn)),mn.field?Wn=Ct.add(p7({field:Ct.fieldRef(mn.field),pulse:xn})):mn.groupby?Wn=Ct.add(Ane({key:Ct.keyRef(mn.groupby),group:oo(Ct.proxy(Et.parent)),pulse:xn})):Object(xe.o)("Facet must specify groupby or field: "+Object(xe.Ba)(mn));const Un=Ct.fork(),Kn=Un.add(gv()),Qn=Un.add(ww({pulse:oo(Kn)}));Un.addData(An,new kw(Un,Kn,Kn,Qn)),Un.addSignal("parent",null),Wn.params.subflow={$subflow:Un.parse(pt).toRuntime()}}(e,t,ve):he?function(pt,Ct,Et){const mn=Ct.add(p7({pulse:Et.pulse})),An=Ct.fork();An.add(ww()),An.addSignal("parent",null),mn.params.subflow={$subflow:An.parse(pt).toRuntime()}}(e,t,ve):t.parse(e),t.popState(),he&&(se&&b.push(se),b.push(st))),d&&(te=function(pt,Ct,Et){const mn=pt.method,An=pt.bound,xn=pt.separation,Wn={separation:Fl(xn)?Et.signalRef(xn.signal):xn,method:Fl(mn)?Et.signalRef(mn.signal):mn,pulse:Ct};if(pt.order&&(Wn.sort=Et.compareRef({field:pt.order})),An){const Un=An.tolerance;Wn.boundTolerance=Fl(Un)?Et.signalRef(Un.signal):+Un,Wn.boundScale=Et.scaleRef(An.scale),Wn.boundOrient=An.orient}return oo(Et.add(Rne(Wn)))}(d,te,t));const ut=t.add(m7({pulse:te})),mt=t.add(ww({pulse:oo(ut)},void 0,t.parent()));e.name!=null&&($=e.name,t.addData($,new kw(t,T,ut,mt)),e.on&&e.on.forEach(pt=>{(pt.insert||pt.remove||pt.toggle)&&Object(xe.o)("Marks only support modify triggers."),M7(pt,t,$)}))}function fre(e,t){const r=t.config.legend,u=e.encode||{},l=dm(e,r),d=u.legend||{},b=d.name||void 0,k=d.interactive,T=d.style,j={};let $,G,te,se=0;ZM.forEach(Ue=>e[Ue]?(j[Ue]=e[Ue],se=se||e[Ue]):0),se||Object(xe.o)("Missing valid scale for legend.");const he=function(Ue,st){let ut=Ue.type||x7;return Ue.type||function(mt){return ZM.reduce((pt,Ct)=>pt+(mt[Ct]?1:0),0)}(Ue)!==1||!Ue.fill&&!Ue.stroke||(ut=Nh(st)?l3:rg(st)?JM:x7),ut!==l3?ut:rg(st)?JM:l3}(e,t.scaleType(se)),ve={title:e.title!=null,scales:j,type:he,vgrad:he!=="symbol"&&l.isVertical()},Be=oo(t.add(gv(null,[ve]))),ze=oo(t.add(Tne(G={type:he,scale:t.scaleRef(se),count:t.objectProperty(l("tickCount")),limit:t.property(l("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return he===l3?(te=[function(Ue,st,ut,mt){const pt=dm(Ue,ut),Ct=pt.isVertical(),Et=pt.gradientThickness(),mn=pt.gradientLength();let An,xn,Wn,Un,Kn;Ct?(xn=[0,1],Wn=[0,0],Un=Et,Kn=mn):(xn=[0,0],Wn=[1,0],Un=mn,Kn=Et);const Qn={enter:An={opacity:ts,x:ts,y:ts,width:uf(Un),height:uf(Kn)},update:Object(xe.p)({},An,{opacity:y0,fill:{gradient:st,start:xn,stop:Wn}}),exit:{opacity:ts}};return Gf(Qn,{stroke:pt("gradientStrokeColor"),strokeWidth:pt("gradientStrokeWidth")},{opacity:pt("gradientOpacity")}),Eg({type:w7,role:sne,encode:Qn},mt)}(e,se,r,u.gradient),k7(e,r,u.labels,ze)],G.count=G.count||t.signalRef(`max(2,2*floor((${xw(l.gradientLength())})/100))`)):he===JM?te=[function(Ue,st,ut,mt,pt){const Ct=dm(Ue,ut),Et=Ct.isVertical(),mn=Ct.gradientThickness(),An=Ct.gradientLength();let xn,Wn,Un,Kn,Qn="";Et?(xn="y",Un="y2",Wn="x",Kn="width",Qn="1-"):(xn="x",Un="x2",Wn="y",Kn="height");
vendor: 2,693 bytes, line 7836
7836const ir={opacity:ts,fill:{scale:st,field:v0}};ir[xn]={signal:Qn+"datum."+v_,mult:An},ir[Wn]=ts,ir[Un]={signal:Qn+"datum."+Yne,mult:An},ir[Kn]=uf(mn);const Nr={enter:ir,update:Object(xe.p)({},ir,{opacity:y0}),exit:{opacity:ts}};return Gf(Nr,{stroke:Ct("gradientStrokeColor"),strokeWidth:Ct("gradientStrokeWidth")},{opacity:Ct("gradientOpacity")}),Eg({type:w7,role:one,key:v0,from:pt,encode:Nr},mt)}(e,se,r,u.gradient,ze),k7(e,r,u.labels,ze)]:($=function(Ue,st){const ut=dm(Ue,st);return{align:ut("gridAlign"),columns:ut.entryColumns(),center:{row:!0,column:!1},padding:{row:ut("rowPadding"),column:ut("columnPadding")}}}(e,r),te=[function(Ue,st,ut,mt,pt){const Ct=dm(Ue,st),Et=ut.entries,mn=!(!Et||!Et.interactive),An=Et?Et.name:void 0,xn=Ct("clipHeight"),Wn=Ct("symbolOffset"),Un={data:"value"},Kn=`(${pt}) ? datum.${Kne} : datum.${QM}`,Qn=xn?uf(xn):{field:QM},ir=`datum.${KM}`,Nr=`max(1, ${pt})`;let Jr,Lr,hi,Ri,Pi;Qn.mult=.5,Jr={enter:Lr={opacity:ts,x:{signal:Kn,mult:.5,offset:Wn},y:Qn},update:hi={opacity:y0,x:Lr.x,y:Lr.y},exit:{opacity:ts}};let so=null,Ui=null;Ue.fill||(so=st.symbolBaseFillColor,Ui=st.symbolBaseStrokeColor),Gf(Jr,{fill:Ct("symbolFillColor",so),shape:Ct("symbolType"),size:Ct("symbolSize"),stroke:Ct("symbolStrokeColor",Ui),strokeDash:Ct("symbolDash"),strokeDashOffset:Ct("symbolDashOffset"),strokeWidth:Ct("symbolStrokeWidth")},{opacity:Ct("symbolOpacity")}),ZM.forEach(Ra=>{Ue[Ra]&&(hi[Ra]=Lr[Ra]={scale:Ue[Ra],field:v0})});const ji=Eg({type:Qne,role:une,key:v0,from:Un,clip:!!xn||void 0,encode:Jr},ut.symbols),Yi=uf(Wn);Yi.offset=Ct("labelOffset"),Gf(Jr={enter:Lr={opacity:ts,x:{signal:Kn,offset:Yi},y:Qn},update:hi={opacity:y0,text:{field:YM},x:Lr.x,y:Lr.y},exit:{opacity:ts}},{align:Ct("labelAlign"),baseline:Ct("labelBaseline"),fill:Ct("labelColor"),fillOpacity:Ct("labelOpacity"),font:Ct("labelFont"),fontSize:Ct("labelFontSize"),fontStyle:Ct("labelFontStyle"),fontWeight:Ct("labelFontWeight"),limit:Ct("labelLimit")});const Go=Eg({type:_w,role:n7,style:qE,key:v0,from:Un,encode:Jr},ut.labels);return Jr={enter:{noBound:{value:!xn},width:ts,height:xn?uf(xn):ts,opacity:ts},exit:{opacity:ts},update:hi={opacity:y0,row:{signal:null},column:{signal:null}}},Ct.isVertical(!0)?(Ri=`ceil(item.mark.items.length / ${Nr})`,hi.row.signal=`${ir}%${Ri}`,hi.column.signal=`floor(${ir} / ${Ri})`,Pi={field:["row",ir]}):(hi.row.signal=`floor(${ir} / ${Nr})`,hi.column.signal=`${ir} % ${Nr}`,Pi={field:ir}),hi.column.signal=`(${pt})?${hi.column.signal}:${ir}`,KE({role:zM,from:mt={facet:{data:mt,name:"value",groupby:KM}},encode:m_(Jr,Et,GE),marks:[ji,Go],name:An,interactive:mn,sort:Pi})}(e,r,u,ze,xw($.columns))],G.size=function(Ue,st,ut){const mt=xw(F7("size",Ue,ut)),pt=xw(
7836F7("strokeWidth",Ue,ut)),Ct=xw(function(Et,mn,An){return _7("fontSize",Et)||function(xn,Wn,Un){const Kn=Wn.config.style[Un];return Kn&&Kn[xn]}("fontSize",mn,An)}(ut[1].encode,st,qE));return By(`max(ceil(sqrt(${mt})+${pt}),${Ct})`,st)}(e,t,te[0].marks)),te=[KE({role:ane,from:Be,encode:{enter:{x:{value:0},y:{value:0}}},marks:te,layout:$,interactive:k})],ve.title&&te.push(function(Ue,st,ut,mt){const pt=dm(Ue,st),Ct={enter:{opacity:ts},update:{opacity:y0,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:ts}};return Gf(Ct,{orient:pt("titleOrient"),_anchor:pt("titleAnchor"),anchor:{signal:ire},angle:{signal:ore},align:{signal:rre},baseline:{signal:are},text:Ue.title,fill:pt("titleColor"),fillOpacity:pt("titleOpacity"),font:pt("titleFont"),fontSize:pt("titleFontSize"),fontStyle:pt("titleFontStyle"),fontWeight:pt("titleFontWeight"),limit:pt("titleLimit"),lineHeight:pt("titleLineHeight")},{align:pt("titleAlign"),baseline:pt("titleBaseline")}),Eg({type:_w,role:cne,style:XM,from:mt,encode:Ct},ut)}(e,r,u.title,Be)),m3(KE({role:ine,from:Be,encode:m_(function(Ue,st,ut){const mt={enter:{},update:{}};return Gf(mt,{orient:Ue("orient"),offset:Ue("offset"),padding:Ue("padding"),titlePadding:Ue("titlePadding"),cornerRadius:Ue("cornerRadius"),fill:Ue("fillColor"),stroke:Ue("strokeColor"),strokeWidth:ut.strokeWidth,strokeDash:ut.strokeDash,x:Ue("legendX"),y:Ue("legendY"),format:st.format,formatType:st.formatType}),mt}(l,e,r),d,GE),marks:te,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:b,interactive:k,style:T}),t)}function F7(e,t,r){return t[e]?`scale("${t[e]}",datum)`:_7(e,r[0].encode)}kw.fromEntries=function(e,t){const r=t.length,u=t[r-1],l=t[r-2];let d=t[0],b=null,k=1;for(d&&d.type==="load"&&(d=t[1]),e.add(t[0]);k<r;++k)t[k].params.pulse=oo(t[k-1]),e.add(t[k]),t[k].type==="aggregate"&&(b=t[k]);return new kw(e,d,l,u,b)},kw.prototype={countsRef(e,t,r){const u=this,l=u.counts||(u.counts={}),d=N7(t);let b,k,T;return d!=null&&(e=u.scope,b=l[d]),b?r&&r.field&&I7(e,b.agg.params,r):(T={groupby:e.fieldRef(t,"key"),pulse:oo(u.output)},r&&r.field&&I7(e,T,r),b={agg:k=e.add(l7(T)),ref:oo(b=e.add(gv({pulse:oo(k)})))},d!=null&&(l[d]=b)),b.ref},tuplesRef(){return oo(this.values)},extentRef(e,t){return YE(e,this,"extent","extent",t,!1)},domainRef(e,t){return YE(e,this,"domain","values",t,!1)},valuesRef(e,t,r){return YE(e,this,"vals","values",t,r||!0)},lookupRef(e,t){return YE(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return YE(e,this,"indata","tupleindex",t,!0,!0)}};const dre='item.orient==="left"?-90:item.orient==="right"?90:0';function hre(e,t){const r=dm(e=Object(xe.J)(e)?{text:e}:e,t.config.title),u=e.encode||{},l=u.group||{},d=l.name||void 0,b=l.interactive,k=l.style,T=[],j=oo(t.add(gv(null,[{}])));return T.push(function($,G,te,se){const he={value:0},ve=$.text,Be={enter:{opacity:he},update:{opacity:{value:1}},exit:{opacity:he}};return Gf(Be,{text:ve,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:G("dx"),dy:G("dy"),fill:G("color"),font:G("font"),fontSize:G("fontSize"),fontStyle:G("fontStyle"),fontWeight:G("fontWeight"),lineHeight:G("lineHeight")},{align:G("align"),angle:G("angle"),baseline:G("baseline")}),Eg({type:_w,role:fne,style:Xne,from:se,encode:Be},te)}(e,r,function($){const G=$.encode;return G&&G.title||Object(xe.p)({name:$.name,interactive:$.interactive,style:$.style},G)}(e),j)),e.subtitle&&T.push(function($,G,te,se){const he={value:0},ve=$.subtitle,Be={enter:{opacity:he},update:{opacity:{value:1}},exit:{opacity:he}};return Gf(Be,{text:ve,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:G("dx"),dy:G("dy"),fill:G("subtitleColor"),font:G("subtitleFont"),fontSize:G("subtitleFontSize"),fontStyle:G("subtitleFontStyle"),fontWeight:G("subtitleFontWeight"),lineHeight:G("subtitleLineHeight")},{align:G("align"),angle:G("angle"),baseline:G("baseline")}),Eg({type:_w,role:dne,style:Jne,from:se,encode:Be},te)}(e,r,u.subtitle,j)),m3(KE({role:lne,from:j,encode:function($,G){const te={enter:{},update:{}};return Gf(te,{orient:$("orient"),anchor:$("anchor"),align:{signal:tF},angle:{signal:dre},limit:$("limit"),frame:$("frame"),offset:$("offset")||0,padding:$("subtitlePadding")}),m_(te,G,GE)}(r,l),marks:T,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:d,interactive:b,style:k}),t)}function pre(e,t){const r=[];e.transform&&e.transform.forEach(u=>{r.push(nF(u,t))}),e.on&&e.on.forEach(u=>{M7(u,t,e.name)}),t.addDataPipeline(e.name,function(u,l,d){const b=[];let k,T,j,$,G,te=null,se=!1,he=!1;for(u.values?Fl(u.values)||s3(u.format)?(b.push(R7(l,u)),b.push(te=Ew())):b.push(te=Ew({$ingest:u.values,$format:u.format})):u.url?s3(u.url)||s3(u.format)?(b.push(R7(l,u)),b.push(te=Ew())):b.push(te=Ew({$request:u.url,$format:u.format})):u.source&&(te=k=Object(xe.i)(u.source).map(ve=>oo(l.getData(ve).output)),b.push(null)),T=0,j=d.length;T<j;++T)$=d[T],G=$.metadata,te||G.source||b.push(te=Ew()),b.push($),G.generates&&(he=!0),G.modifies&&!he&&(se=!0),G.source?te=$:G.changes&&(te=null);return k&&(j=k.length-1,b[0]=Lne({derive:se,pulse:j?k:k[0]}),(se||j)&&b.splice(1,0,Ew())),te||b.push(Ew()),b.push(ww({})),b}(e,t,r))}function Ew(e){const t=gv({},e);return t.metadata={source:!0},t}function R7(e,t){return Nne({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const B7=e=>e===Kb||e===vv,g3=(e,t,r)=>Fl(e)?yre(e.signal,t,r):e==="left"||e===vv?t:r,cf=(e,t,r)=>Fl(e)?gre(e.signal,t,r):B7(e)?t:r,yv=(e,t,r)=>Fl(e)?vre(e.signal,t,r):B7(e)?r:t,P7=(e,t,r)=>Fl(e)?bre(e.signal,t,r):e===vv?{value:t}:{value:r},mre=(e,t,r)=>Fl(e)?xre(e.signal,t,r):e==="right"?{value:t}:{value:r},gre=(e,t,r)=>j7(`${e} === '${vv}' || ${e} === '${Kb}'`,t,r),vre=(e,t,r)=>j7(`${e} !== '${vv}' && ${e} !== '${Kb}'`,t,r),yre=(e,t,r)=>iF(`${e} === 'left' || ${e} === '${vv}'`,t,r),bre=(e,t,r)=>iF(`${e} === '${vv}'`,t,r),xre=(e,t,r)=>iF(`${e} === 'right'`,t,r),j7=(e,t,r)=>(t=t!=null?uf(t):t,r=r!=null?uf(r):r,L7(t)&&L7(r)?{signal:`${e} ? (${t=t?t.signal||Object(xe.Ba)(t.value):null}) : (${r=r?r.signal||Object(xe.Ba)(r.value):null})`}:[Object(xe.p)({test:e},t)].concat(r||[])),L7=e=>e==null||Object.keys(e).length===1,iF=(e,t,r)=>({signal:`${e} ? (${y_(t)}) : (${y_(r)})`}),wre=(e,t,r,u,l)=>({signal:(u!=null?`${e} === 'left' ? (${y_(u)}) : `:"")+(r!=null?`${e} === '${Kb}' ? (${y_(r)}) : `:"")+(l!=null?`${e} === 'right' ? (${y_(l)}) : `:"")+(t!=null?`${e} === '${vv}' ? (${y_(t)}) : `:"")+"(null)"}),y_=e=>Fl(e)?e.signal:e==null?null:Object(xe.Ba)(e),_re=(e,t)=>
vendor: 4,731 bytes, line 7836
7836t===0?0:Fl(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},b_=(e,t)=>{const r=e.signal;return r&&r.endsWith("(null)")?{signal:r.slice(0,-6)+t.signal}:e};function x_(e,t,r,u){let l;if(t&&Object(xe.w)(t,e))return t[e];if(Object(xe.w)(r,e))return r[e];if(e.startsWith("title")){switch(e){case"titleColor":l="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":l=e[5].toLowerCase()+e.slice(6)}return u[XM][l]}if(e.startsWith("label")){switch(e){case"labelColor":l="fill";break;case"labelFont":case"labelFontSize":l=e[5].toLowerCase()+e.slice(6)}return u[qE][l]}return null}function z7(e){const t={};for(const r of e)if(r)for(const u in r)t[u]=1;return Object.keys(t)}function U7(e,t){return{scale:e.scale,range:t}}function kre(e,t,r,u,l){const d=dm(e,t),b=e.orient,k=e.gridScale,T=g3(b,1,-1),j=function(Ue,st){if(st!==1)if(Object(xe.H)(Ue)){let ut=Ue=Object(xe.p)({},Ue);for(;ut.mult!=null;){if(!Object(xe.H)(ut.mult))return ut.mult=Fl(st)?{signal:`(${ut.mult}) * (${st.signal})`}:ut.mult*st,Ue;ut=ut.mult=Object(xe.p)({},ut.mult)}ut.mult=st}else Ue=Fl(st)?{signal:`(${st.signal}) * (${Ue||0})`}:st*(Ue||0);return Ue}(e.offset,T);let $,G,te;const se={enter:$={opacity:ts},update:te={opacity:y0},exit:G={opacity:ts}};Gf(se,{stroke:d("gridColor"),strokeCap:d("gridCap"),strokeDash:d("gridDash"),strokeDashOffset:d("gridDashOffset"),strokeOpacity:d("gridOpacity"),strokeWidth:d("gridWidth")});const he={scale:e.scale,field:v0,band:l.band,extra:l.extra,offset:l.offset,round:d("tickRound")},ve=cf(b,{signal:"height"},{signal:"width"}),Be=k?{scale:k,range:0,mult:T,offset:j}:{value:0,offset:j},ze=k?{scale:k,range:1,mult:T,offset:j}:Object(xe.p)(ve,{mult:T,offset:j});return $.x=te.x=cf(b,he,Be),$.y=te.y=yv(b,he,Be),$.x2=te.x2=yv(b,ze),$.y2=te.y2=cf(b,ze),G.x=cf(b,he),G.y=yv(b,he),Eg({type:eF,role:ene,key:v0,from:u,encode:se},r)}function oF(e,t,r,u,l){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+r+","+u+","+l+")"}}function Ere(e,t,r,u,l,d){const b=dm(e,t),k=e.orient,T=e.scale,j=g3(k,-1,1),$=xw(b("labelFlush")),G=xw(b("labelFlushOffset")),te=b("labelAlign"),se=b("labelBaseline");let he,ve=$===0||!!$;const Be=uf(l);Be.mult=j,Be.offset=uf(b("labelPadding")||0),Be.offset.mult=j;const ze={scale:T,field:v0,band:.5,offset:function mn(An,xn){return xn?An?Object(xe.H)(An)?Object.assign({},An,{offset:mn(An.offset,xn)}):{value:An,offset:xn}:xn:An}(d.offset,b("labelOffset"))},Ue=cf(k,ve?oF(T,$,'"left"','"right"','"center"'):{value:"center"},mre(k,"left","right")),st=cf(k,P7(k,"bottom","top"),ve?oF(T,$,'"top"','"bottom"','"middle"'):{value:"middle"}),ut=oF(T,$,`-(${G})`,G,0);ve=ve&&G;const mt={opacity:ts,x:cf(k,ze,Be),y:yv(k,ze,Be)},pt={enter:mt,update:he={opacity:y0,text:{field:YM},x:mt.x,y:mt.y,align:Ue,baseline:st},exit:{opacity:ts,x:mt.x,y:mt.y}};Gf(pt,{dx:!te&&ve?cf(k,ut):null,dy:!se&&ve?yv(k,ut):null}),Gf(pt,{angle:b("labelAngle"),fill:b("labelColor"),fillOpacity:b("labelOpacity"),font:b("labelFont"),fontSize:b("labelFontSize"),fontWeight:b("labelFontWeight"),fontStyle:b("labelFontStyle"),limit:b("labelLimit"),lineHeight:b("labelLineHeight")},{align:te,baseline:se});const Ct=b("labelBound");let Et=b("labelOverlap");return Et=Et||Ct?{separation:b("labelSeparation"),method:Et,order:"datum.index",bound:Ct?{scale:T,orient:k,tolerance:Ct}:null}:void 0,he.align!==Ue&&(he.align=b_(he.align,Ue)),he.baseline!==st&&(he.baseline=b_(he.baseline,st)),Eg({type:_w,role:tne,style:qE,key:v0,from:u,encode:pt,overlap:Et},r)}function Cre(e,t,r,u){const l=dm(e,t),d=e.orient,b=g3(d,-1,1);let k,T;const j={enter:k={opacity:ts,anchor:uf(l("titleAnchor",null)),align:{signal:tF}},update:T=Object(xe.p)({},k,{opacity:y0,text:uf(e.title)}),exit:{opacity:ts}},$={signal:`lerp(range("${e.scale}"), ${d3(0,1,.5)})`};return T.x=cf(d,$),T.y=yv(d,$),k.angle=cf(d,ts,_re(b,90)),k.baseline=cf(d,P7(d,Kb,vv),{value:Kb}),T.angle=k.angle,T.baseline=k.baseline,Gf(j,{fill:l("titleColor"),fillOpacity:l("titleOpacity"),font:l("titleFont"),fontSize:l("titleFontSize"),fontStyle:l("titleFontStyle"),fontWeight:l("titleFontWeight"),limit:l("titleLimit"),lineHeight:l("titleLineHeight")},{align:l("titleAlign"),angle:l("titleAngle"),baseline:l("titleBaseline")}),function(G,te,se,he){const ve=(Ue,st)=>Ue!=null?(se.update[st]=b_(uf(Ue),se.update[st]),!1):!g_(st,he),Be=ve(G("titleX"),"x"),ze=ve(G("titleY"),"y");se.enter.auto=ze===Be?uf(ze):cf(te,uf(ze),uf(Be))}(l,d,j,r),j.update.align=b_(j.update.align,k.align),j.update.angle=b_(j.update.angle,k.angle),j.update.baseline=b_(j.update.baseline,k.baseline),Eg({type:_w,role:rne,style:XM,from:u,encode:j},r)}function Sre(e,t){const r=function(ve,Be){var ze,Ue,st,ut=Be.config,mt=ut.style,pt=ut.axis,Ct=Be.scaleType(ve.scale)==="band"&&ut.axisBand,Et=ve.orient;
7836if(Fl(Et)){const mn=z7([ut.axisX,ut.axisY]),An=z7([ut.axisTop,ut.axisBottom,ut.axisLeft,ut.axisRight]);for(st of(ze={},mn))ze[st]=cf(Et,x_(st,ut.axisX,pt,mt),x_(st,ut.axisY,pt,mt));for(st of(Ue={},An))Ue[st]=wre(Et.signal,x_(st,ut.axisTop,pt,mt),x_(st,ut.axisBottom,pt,mt),x_(st,ut.axisLeft,pt,mt),x_(st,ut.axisRight,pt,mt))}else ze=Et===vv||Et===Kb?ut.axisX:ut.axisY,Ue=ut["axis"+Et[0].toUpperCase()+Et.slice(1)];return ze||Ue||Ct?Object(xe.p)({},pt,ze,Ue,Ct):pt}(e,t),u=e.encode||{},l=u.axis||{},d=l.name||void 0,b=l.interactive,k=l.style,T=dm(e,r),j=function(ve){const Be=ve("tickBand");let ze,Ue,st=ve("tickOffset");return Be?Be.signal?(ze={signal:`(${Be.signal}) === 'extent' ? 1 : 0.5`},Ue={signal:`(${Be.signal}) === 'extent'`},Object(xe.H)(st)||(st={signal:`(${Be.signal}) === 'extent' ? 0 : ${st}`})):Be==="extent"?(ze=1,Ue=!0,st=0):(ze=.5,Ue=!1):(ze=ve("bandPosition"),Ue=ve("tickExtra")),{extra:Ue,band:ze,offset:st}}(T),$={scale:e.scale,ticks:!!T("ticks"),labels:!!T("labels"),grid:!!T("grid"),domain:!!T("domain"),title:e.title!=null},G=oo(t.add(gv({},[$]))),te=oo(t.add(Ene({scale:t.scaleRef(e.scale),extra:t.property(j.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),se=[];let he;return $.grid&&se.push(kre(e,r,u.grid,te,j)),$.ticks&&(he=T("tickSize"),se.push(function(ve,Be,ze,Ue,st,ut){const mt=dm(ve,Be),pt=ve.orient,Ct=g3(pt,-1,1);let Et,mn,An;const xn={enter:Et={opacity:ts},update:An={opacity:y0},exit:mn={opacity:ts}};Gf(xn,{stroke:mt("tickColor"),strokeCap:mt("tickCap"),strokeDash:mt("tickDash"),strokeDashOffset:mt("tickDashOffset"),strokeOpacity:mt("tickOpacity"),strokeWidth:mt("tickWidth")});const Wn=uf(st);Wn.mult=Ct;const Un={scale:ve.scale,field:v0,band:ut.band,extra:ut.extra,offset:ut.offset,round:mt("tickRound")};return An.y=Et.y=cf(pt,ts,Un),An.y2=Et.y2=cf(pt,Wn),mn.x=cf(pt,Un),An.x=Et.x=yv(pt,ts,Un),An.x2=Et.x2=yv(pt,Wn),mn.y=yv(pt,Un),Eg({type:eF,role:nne,key:v0,from:Ue,encode:xn},ze)}(e,r,u.ticks,te,he,j))),$.labels&&(he=$.ticks?he:0,se.push(Ere(e,r,u.labels,te,he,j))),$.domain&&se.push(function(ve,Be,ze,Ue){const st=dm(ve,Be),ut=ve.orient;let mt,pt;const Ct={enter:mt={opacity:ts},update:pt={opacity:y0},exit:{opacity:ts}};Gf(Ct,{stroke:st("domainColor"),strokeCap:st("domainCap"),strokeDash:st("domainDash"),strokeDashOffset:st("domainDashOffset"),strokeWidth:st("domainWidth"),strokeOpacity:st("domainOpacity")});const Et=U7(ve,0),mn=U7(ve,1);return mt.x=pt.x=cf(ut,Et,ts),mt.x2=pt.x2=cf(ut,mn),mt.y=pt.y=yv(ut,Et,ts),mt.y2=pt.y2=yv(ut,mn),Eg({type:eF,role:Zte,from:Ue,encode:Ct},ze)}(e,r,u.domain,G)),$.title&&se.push(Cre(e,r,u.title,G)),m3(KE({role:Qte,from:G,encode:m_(function(ve,Be){const ze={enter:{},update:{}};return Gf(ze,{orient:ve("orient"),offset:ve("offset")||0,position:mv(Be.position,0),titlePadding:ve("titlePadding"),minExtent:ve("minExtent"),maxExtent:ve("maxExtent"),range:{signal:`abs(span(range("${Be.scale}")))`},translate:ve("translate"),format:Be.format,formatType:Be.formatType}),ze}(T,e),l,GE),marks:se,aria:T("aria"),description:T("description"),zindex:T("zindex"),name:d,interactive:b,style:k}),t)}function W7(e,t,r){const u=Object(xe.i)(e.signals),l=Object(xe.i)(e.scales);return r||u.forEach(d=>s7(d,t)),Object(xe.i)(e.projections).forEach(d=>function(b,k){const T=k.config.projection||{},j={};for(const $ in b)$!=="name"&&(j[$]=GM(b[$],$,k));for(const $ in T)j[$]==null&&(j[$]=GM(T[$],$,k));k.addProjection(b.name,j)}(d,t)),l.forEach(d=>function(b,k){const T=b.type||"linear";ng(T)||Object(xe.o)("Unrecognized scale type: "+Object(xe.Ba)(T)),k.addScale(b.name,{type:T,domain:void 0})}(d,t)),Object(xe.i)(e.data).forEach(d=>pre(d,t)),l.forEach(d=>$ne(d,t)),(r||u).forEach(d=>function(b,k){const T=k.getSignal(b.name);let j=b.update;b.init&&(j?Object(xe.o)("Signals can not include both init and update expressions."):(j=b.init,T.initonly=!0)),j&&(j=By(j,k),T.update=j.$expr,T.params=j.$params),b.on&&b.on.forEach($=>kne($,k,T.id))}(d,t)),Object(xe.i)(e.axes).forEach(d=>
7836Sre(d,t)),Object(xe.i)(e.marks).forEach(d=>m3(d,t)),Object(xe.i)(e.legends).forEach(d=>fre(d,t)),e.title&&hre(e.title,t),t.parseLambdas(),t}const Are=e=>m_({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function Ore(e,t){const r=t.config,u=oo(t.root=t.add(o3())),l=function(j,$){const G=ve=>mv(j[ve],$[ve]),te=[XE("background",G("background")),XE("autosize",function(ve){return Object(xe.H)(ve)?ve:{type:ve||"pad"}}(G("autosize"))),XE("padding",function(ve){return Object(xe.H)(ve)?ve.signal?ve:{top:VE(ve.top),bottom:VE(ve.bottom),left:VE(ve.left),right:VE(ve.right)}:Jte(VE(ve))}(G("padding"))),XE("width",G("width")||0),XE("height",G("height")||0)],se=te.reduce((ve,Be)=>(ve[Be.name]=Be,ve),{}),he={};return Object(xe.i)(j.signals).forEach(ve=>{Object(xe.w)(se,ve.name)?ve=Object(xe.p)(se[ve.name],ve):te.push(ve),he[ve.name]=ve}),Object(xe.i)($.signals).forEach(ve=>{Object(xe.w)(he,ve.name)||Object(xe.w)(se,ve.name)||te.push(ve)}),te}(e,r);l.forEach(j=>s7(j,t)),t.description=e.description||r.description,t.eventConfig=r.events,t.legends=t.objectProperty(r.legend&&r.legend.layout),t.locale=r.locale;const d=t.add(gv()),b=t.add(h7(o7(Are(e.encode),f3,LM,e.style,t,{pulse:oo(d)}))),k=t.add(g7({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:u,pulse:oo(b)}));t.operators.pop(),t.pushState(oo(b),oo(k),null),W7(e,t,l),t.operators.push(k);let T=t.add(f7({mark:u,pulse:oo(k)}));return T=t.add(m7({pulse:oo(T)})),T=t.add(ww({pulse:oo(T)})),t.addData("root",new kw(t,d,d,T)),t}function XE(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function V7(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function $7(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function aF(e){return(Object(xe.B)(e)?function(t){const r=t.length;let u="[";for(let l=0;l<r;++l){const d=t[l];u+=(l>0?",":"")+(Object(xe.H)(d)?d.signal||aF(d):Object(xe.Ba)(d))}return u+"]"}:function(t){let r,u,l="{",d=0;for(r in t)u=t[r],l+=(++d>1?",":"")+Object(xe.Ba)(r)+":"+(Object(xe.H)(u)?u.signal||aF(u):Object(xe.Ba)(u));return l+"}"})(e)}function Dre(e,t,r){return Object(xe.H)(e)||Object(xe.o)("Input Vega specification must be an object."),Ore(e,new V7(t=Object(xe.P)({description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:"#4c78a8"},area:{fill:"#4c78a8"},image:null,line:{stroke:"#4c78a8",strokeWidth:2},path:{stroke:"#4c78a8"},rect:{fill:"#4c78a8"},rule:{stroke:"#000"},shape:{stroke:"#4c78a8"},symbol:{fill:"#4c78a8",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11},trail:{fill:"#4c78a8",size:2},style:{"guide-label":{fill:"#000",font:"sans-serif",fontSize:10},"guide-title":{fill:"#000",font:"sans-serif",fontSize:11,fontWeight:"bold"},"group-title":{fill:"#000",font:"sans-serif",fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:"#000",font:"sans-serif",fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:"#ddd"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:"#888",grid:!1,gridWidth:1,gridColor:"#ddd",labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:"#888",tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:"#888",titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}},t,e.config),r)).toRuntime()}V7.prototype=$7.prototype={parse(e){return W7(e,this)},fork(){return new $7(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEac
7836h(t=>{t.$ref=e.id}),e.refs=null),e},proxy(e){const t=e instanceof WM?oo(e):e;return this.add(jne({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function r(u,l,d){let b;u&&((b=u.data||(u.data={}))[l]||(b[l]=[])).push(d)}for(e in this.data){r((t=this.data[e]).input,e,"input"),r(t.output,e,"output"),r(t.values,e,"values");for(const u in t.index)r(t.index[u],e,"index:"+u)}return this},pushState(e,t,r){this._encode.push(oo(this.add(ww({pulse:e})))),this._parent.push(t),this._lookup.push(r?oo(this.proxy(r)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Object(xe.W)(this._parent)},encode(){return Object(xe.W)(this._encode)},lookup(){return Object(xe.W)(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(Object(xe.J)(e))return $E(e,t);e.signal||Object(xe.o)("Unsupported field reference: "+Object(xe.Ba)(e));const r=e.signal;let u=this.field[r];if(!u){const l={name:this.signalRef(r)};t&&(l.as=t),this.field[r]=u=oo(this.add(One(l)))}return u},compareRef(e){let t=!1;const r=d=>Fl(d)?(t=!0,this.signalRef(d.signal)):function(b){return b&&b.expr}(d)?(t=!0,this.exprRef(d.expr)):d,u=Object(xe.i)(e.field).map(r),l=Object(xe.i)(e.order).map(r);return t?oo(this.add(d7({fields:u,orders:l}))):u7(u,l)},keyRef(e,t){let r=!1;const u=this.signals;return e=Object(xe.i)(e).map(l=>Fl(l)?(r=!0,oo(u[l.signal])):l),r?oo(this.add(Dne({fields:e,flat:t}))):function(l,d){const b={$key:l};return d&&(b.$flat=!0),b}(e,t)},sortRef(e){if(!e)return e;const t=a3(e.op,e.field),r=e.order||"ascending";return r.signal?oo(this.add(d7({fields:t,orders:this.signalRef(r.signal)}))):u7(t,r)},event(e,t){const r=e+":"+t;if(!this.events[r]){const u=this.id();this.streams.push({id:u,source:e,type:t}),this.events[r]=u}return this.events[r]},hasOwnSignal(e){return Object(xe.w)(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&Object(xe.o)("Duplicate signal name: "+Object(xe.Ba)(e));const r=t instanceof WM?t:this.add(o3(t));return this.signals[e]=r},getSignal(e){return this.signals[e]||Object(xe.o)("Unrecognized signal name: "+Object(xe.Ba)(e)),this.signals[e]},signalRef(e){return this.signals[e]?oo(this.signals[e]):(Object(xe.w)(this.lambdas,e)||(this.lambdas[e]=this.add(o3(null))),oo(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,r=e.length;t<r;++t){const u=e[t],l=By(u,this),d=this.lambdas[u];d.params=l.$params,d.update=l.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&Object(xe.H)(e)?this.signalRef(e.signal||aF(e)):e},exprRef(e,t){const r={expr:By(e,this)};return t&&(r.expr.$name=t),oo(this.add(Sne(r)))},addBinding(e,t){this.bindings||Object(xe.o)("Nested signals do not support binding: "+Object(xe.Ba)(e)),this.bindings.push(Object(xe.p)({signal:e},t))},addScaleProj(e,t){Object(xe.w)(this.scales,e)&&Object(xe.o)("Duplicate scale or projection name: "+Object(xe.Ba)(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,zne(t))},addProjection(e,t){this.addScaleProj(e,Pne(t))},getScale(e){return this.scales[e]||Object(xe.o)("Unrecognized scale name: "+Object(xe.Ba)(e)),this.scales[e]},scaleRef(e){return oo(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return Object(xe.w)(this.data,e)&&Object(xe.o)("Duplicate data set name: "+Object(xe.Ba)(e)),this.data[e]=t},getData(e){return this.data[e]||Object(xe.o)("Undefined data set name: "+Object(xe.Ba)(e)),this.data[e]},addDataPipeline(e,t){return Object(xe.w)(this.data,e)&&Object(xe.o)("Duplicate data set name: "+Object(xe.Ba)(e)),this.addData(e,kw.fromEntries(this,t))}};const Tre="RawCode",Nre="Literal",Ire="Property",Mre="Identifier",Fre="ArrayExpression",Rre="BinaryExpression",Bre="CallExpression",Pre="ConditionalExpression",jre="LogicalExpression",Lre="MemberExpression",zre="ObjectExpression",Ure="UnaryExpression";function bv(e){this.type=e}var L1,Gi,Vr,Ud,Vs;bv.prototype.visit=function(e){let t,r,u;if(e(this))return 1;for(r=0,u=(t=function(l){switch(l.type){case Fre:return l.elements;case Rre:case jre:return[l.left,l.right];case Bre:return[l.callee].concat(l.arguments);case Pre:return[l.test,l.consequent,l.alternate];case Lre:return[l.object,l.property];case zre:return l.properties;case Ire:return[l.key,l.value];case Ure:return[l.argument];case Mre:case Nre:case Tre:default:return[]}}(this)).length;r<u;++r)if(t[r].visit(e))return 1};var v3=1,JE=2,Cw=3,Yb=4,y3=5,Sw=6,hm=7,QE=8;(L1={})[v3]="Boolean",L1[JE]="<end>",L1[Cw]="Identifier",L1[Yb]="Keyword",L1[y3]="Null",L1[Sw]="Numeric",L1[hm]="Punctuator",L1[QE]="String",L1[9]="RegularExpression";var Wre="ArrayExpression",Vre="BinaryExpression",$re="CallExpression",Hre="ConditionalExpression",H7="Identifier",qre="Literal",Gre="LogicalExpression",Kre="MemberExpression",Yre="ObjectExpression",Xre="Property",Jre="UnaryExpression",lf="Unexpected token %0",Qre="Unexpected number",Zre="Unexpected string",eie="Unexpected identifier",tie="Unexpected reserved word",nie="Unexpected end of input",sF="Invalid regular expression",uF="Invalid regular expression: missing /",q7="Octal literals are not allowed in strict mode.",rie="Duplicate data property in object literal not allowed in strict mode",Kf="ILLEGAL",ZE="Disabled.",iie
vendor: 4,932 bytes, line 7836
7836=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),
7836oie=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC
78367\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function b3(e,t){if(!e)throw new Error("ASSERT: "+t)}function z1(e){return e>=48&&e<=57}function cF(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function eC(e){return"01234567".indexOf(e)>=0}function aie(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function tC(e){return e===10||e===13||e===8232||e===8233}function nC(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&iie.test(String.fromCharCode(e))}function x3(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&oie.test(String.fromCharCode(e))}const sie={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function G7(){for(;Vr<Ud;){const e=Gi.charCodeAt(Vr);if(!aie(e)&&!tC(e))break;++Vr}}function lF(e){var t,r,u,l=0;for(r=e==="u"?4:2,t=0;t<r;++t)Vr<Ud&&cF(Gi[Vr])?(u=Gi[Vr++],l=16*l+"0123456789abcdef".indexOf(u.toLowerCase())):gs({},lf,Kf);return String.fromCharCode(l)}function uie(){var e,t,r,u;for(t=0,(e=Gi[Vr])==="}"&&gs({},lf,Kf);Vr<Ud&&cF(e=Gi[Vr++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||e!=="}")&&gs({},lf,Kf),t<=65535?String.fromCharCode(t):(r=55296+(t-65536>>10),u=56320+(t-65536&1023),String.fromCharCode(r,u))}function K7(){var e,t;for(e=Gi.charCodeAt(Vr++),t=String.fromCharCode(e),e===92&&(Gi.charCodeAt(Vr)!==117&&gs({},lf,Kf),++Vr,(e=lF("u"))&&e!=="\\"&&nC(e.charCodeAt(0))||gs({},lf,Kf),t=e);Vr<Ud&&x3(e=Gi.charCodeAt(Vr));)++Vr,t+=String.fromCharCode(e),e===92&&(t=t.substr(0,t.length-1),Gi.charCodeAt(Vr)!==117&&gs({},lf,Kf),++Vr,(e=lF("u"))&&e!=="\\"&&x3(e.charCodeAt(0))||gs({},lf,Kf),t+=e);return t}function cie(){var e,t;return e=Vr,{type:(t=Gi.charCodeAt(Vr)===92?K7():function(){var r,u;for(r=Vr++;Vr<Ud;){if((u=Gi.charCodeAt(Vr))===92)return Vr=r,K7();if(!x3(u))break;++Vr}return Gi.slice(r,Vr)}()).length===1?Cw:sie.hasOwnProperty(t)?Yb:t==="null"?y3:t==="true"||t==="false"?v3:Cw,value:t,start:e,end:Vr}}function fF(){var e,t,r,u,l=Vr,d=Gi.charCodeAt(Vr),b=Gi[Vr];switch(d){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++Vr,{type:hm,value:String.fromCharCode(d),start:l,end:Vr};default:if((e=Gi.charCodeAt(Vr+1))===61)switch(d){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Vr+=2,{type:hm,value:String.fromCharCode(d)+String.fromCharCode(e),start:l,end:Vr};case 33:case 61:return Vr+=2,Gi.charCodeAt(Vr)===61&&++Vr,{type:hm,value:Gi.slice(l,Vr),start:l,end:Vr}}}return(u=Gi.substr(Vr,4))===">>>="?{type:hm,value:u,start:l,end:Vr+=4}:(r=u.substr(0,3))===">>>"||r==="<<="||r===">>="?{type:hm,value:r,start:l,end:Vr+=3}:b===(t=r.substr(0,2))[1]&&"+-<>&|".indexOf(b)>=0||t==="=>"?{type:hm,value:t,start:l,end:Vr+=2}:(t==="//"&&gs({},lf,Kf),"<>=!+-*%&|^/".indexOf(b)>=0?{type:hm,value:b,start:l,end:++Vr}:void gs({},lf,Kf))}function Y7(){var e,t,r;if(b3(z1((r=Gi[Vr]).charCodeAt(0))||r===".","Numeric literal must start with a decimal digit or a decimal point"),t=Vr,e="",r!=="."){if(e=Gi[Vr++],r=Gi[Vr],e==="0"){if(r==="x"||r==="X")return++Vr,function(u){let l="";for(;Vr<Ud&&cF(Gi[Vr]);)l+=Gi[Vr++];return l.length===0&&gs({},lf,Kf),nC(Gi.charCodeAt(Vr))&&gs({},lf,Kf),{type:Sw,value:parseInt("0x"+l,16),start:u,end:Vr}}(t);if(eC(r))return function(u){let l="0"+Gi[Vr++];for(;Vr<Ud&&eC(Gi[Vr]);)l+=Gi[Vr++];return(nC(Gi.charCodeAt(Vr))||z1(Gi.charCodeAt(Vr)))&&gs({},lf,Kf),{type:Sw,value:parseInt(l,8),octal:!0,start:u,end:Vr}}(t);r&&z1(r.charCodeAt(0))&&gs({},lf,Kf)}for(;
7836z1(Gi.charCodeAt(Vr));)e+=Gi[Vr++];r=Gi[Vr]}if(r==="."){for(e+=Gi[Vr++];z1(Gi.charCodeAt(Vr));)e+=Gi[Vr++];r=Gi[Vr]}if(r==="e"||r==="E")if(e+=Gi[Vr++],(r=Gi[Vr])!=="+"&&r!=="-"||(e+=Gi[Vr++]),z1(Gi.charCodeAt(Vr)))for(;z1(Gi.charCodeAt(Vr));)e+=Gi[Vr++];else gs({},lf,Kf);return nC(Gi.charCodeAt(Vr))&&gs({},lf,Kf),{type:Sw,value:parseFloat(e),start:t,end:Vr}}function lie(){var e,t,r,u;return Vs=null,G7(),e=Vr,t=function(){var l,d,b,k;for(b3((l=Gi[Vr])==="/","Regular expression literal must start with a slash"),d=Gi[Vr++],b=!1,k=!1;Vr<Ud;)if(d+=l=Gi[Vr++],l==="\\")tC((l=Gi[Vr++]).charCodeAt(0))&&gs({},uF),d+=l;else if(tC(l.charCodeAt(0)))gs({},uF);else if(b)l==="]"&&(b=!1);else{if(l==="/"){k=!0;break}l==="["&&(b=!0)}return k||gs({},uF),{value:d.substr(1,d.length-2),literal:d}}(),r=function(){var l,d,b;for(d="",b="";Vr<Ud&&x3((l=Gi[Vr]).charCodeAt(0));)++Vr,l==="\\"&&Vr<Ud?gs({},lf,Kf):(b+=l,d+=l);return b.search(/[^gimuy]/g)>=0&&gs({},sF,b),{value:b,literal:d}}(),u=function(l,d){let b=l;d.indexOf("u")>=0&&(b=b.replace(/\\u\{([0-9a-fA-F]+)\}/g,(k,T)=>{if(parseInt(T,16)<=1114111)return"x";gs({},sF)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(b)}catch{gs({},sF)}try{return new RegExp(l,d)}catch{return null}}(t.value,r.value),{literal:t.literal+r.literal,value:u,regex:{pattern:t.value,flags:r.value},start:e,end:Vr}}function X7(){if(G7(),Vr>=Ud)return{type:JE,start:Vr,end:Vr};const e=Gi.charCodeAt(Vr);return nC(e)?cie():e===40||e===41||e===59?fF():e===39||e===34?function(){var t,r,u,l,d="",b=!1;for(b3((t=Gi[Vr])==="'"||t==='"',"String literal must starts with a quote"),r=Vr,++Vr;Vr<Ud;){if((u=Gi[Vr++])===t){t="";break}if(u==="\\")if((u=Gi[Vr++])&&tC(u.charCodeAt(0)))u==="\r"&&Gi[Vr]===` 7837`&&++Vr;else switch(u){case"u":case"x":Gi[Vr]==="{"?(++Vr,d+=uie()):d+=lF(u);break;case"n":d+=` 7838`;break;case"r":d+="\r";break;case"t":d+=" ";break;case"b":d+="\b";break;case"f":d+="\f";break;case"v":d+="\v";break;default:eC(u)?((l="01234567".indexOf(u))!==0&&(b=!0),Vr<Ud&&eC(Gi[Vr])&&(b=!0,l=8*l+"01234567".indexOf(Gi[Vr++]),"0123".indexOf(u)>=0&&Vr<Ud&&eC(Gi[Vr])&&(l=8*l+"01234567".indexOf(Gi[Vr++]))),d+=String.fromCharCode(l)):d+=u}else{if(tC(u.charCodeAt(0)))break;d+=u}}return t!==""&&gs({},lf,Kf),{type:QE,value:d,octal:b,start:r,end:Vr}}():e===46?z1(Gi.charCodeAt(Vr+1))?Y7():fF():z1(e)?Y7():fF()}function pm(){const e=Vs;return Vr=e.end,Vs=X7(),Vr=e.end,e}function J7(){const e=Vr;Vs=X7(),Vr=e}function Q7(e,t,r){const u=new bv(e==="||"||e==="&&"?Gre:Vre);return u.operator=e,u.left=t,u.right=r,u}function fie(e,t){const r=new bv($re);return r.callee=e,r.arguments=t,r}function dF(e){const t=new bv(H7);return t.name=e,t}function rC(e){const t=new bv(qre);return t.value=e.value,t.raw=Gi.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function Z7(e,t,r){const u=new bv(Kre);return u.computed=e==="[",u.object=t,u.property=r,u.computed||(r.member=!0),u}function ez(e,t,r){const u=new bv(Xre);return u.key=t,u.value=r,u.kind=e,u}function gs(e,t){var r,u=Array.prototype.slice.call(arguments,2),l=t.replace(/%(\d)/g,(d,b)=>(b3(b<u.length,"Message reference must be in range"),u[b]));throw(r=new Error(l)).index=Vr,r.description=l,r}function w3(e){e.type===JE&&gs(e,nie),e.type===Sw&&gs(e,Qre),e.type===QE&&gs(e,Zre),e.type===Cw&&gs(e,eie),e.type===Yb&&gs(e,tie),gs(e,lf,e.value)}function Wd(e){const t=pm();t.type===hm&&t.value===e||w3(t)}function ju(e){return Vs.type===hm&&Vs.value===e}function hF(e){return Vs.type===Yb&&Vs.value===e}function die(){const e=[];for(Vr=Vs.start,Wd("[");!ju("]");)ju(",")?(pm(),e.push(null)):(e.push(Aw()),ju("]")||Wd(","));return pm(),function(t){const r=new bv(Wre);return r.elements=t,r}(e)}function tz(){Vr=Vs.start;const e=pm();return e.type===QE||e.type===Sw?(e.octal&&gs(e,q7),rC(e)):dF(e.value)}function hie(){var e,t,r;return Vr=Vs.start,(e=Vs).type===Cw?(r=tz(),Wd(":"),ez("init",r,Aw())):e.type!==JE&&e.type!==hm?(t=tz(),Wd(":"),ez("init",t,Aw())):void w3(e)}function pie(){var e,t,r=[],u={},l=String;for(Vr=Vs.start,Wd("{");!ju("}");)t="$"+((e=hie()).key.type===H7?e.key.name:l(e.key.value)),Object.prototype.hasOwnProperty.call(u,t)?gs({},rie):u[t]=!0,r.push(e),ju("}")||Wd(",");return Wd("}"),function(d){const b=new bv(Yre);return b.properties=d,b}(r)}const mie={if:1};function gie(){var e,t,r;if(ju("("))return function(){Wd("(");const u=pF();return Wd(")"),u}();if(ju("["))return die();if(ju("{"))return pie();if(e=Vs.type,Vr=Vs.start,e===Cw||mie[Vs.value])r=dF(pm().value);else if(e===QE||e===Sw)Vs.octal&&gs(Vs,q7),r=rC(pm());else{if(e===Yb)throw new Error(ZE);e===v3?((t=pm()).value=t.value==="true",r=rC(t)):e===y3?((t=pm()).value=null,r=rC(t)):ju("/")||ju("/=")?(r=rC(lie()),J7()):w3(pm())}return r}function vie(){const e=[];
7838if(Wd("("),!ju(")"))for(;Vr<Ud&&(e.push(Aw()),!ju(")"));)Wd(",");return Wd(")"),e}function yie(){Vr=Vs.start;const e=pm();return function(t){return t.type===Cw||t.type===Yb||t.type===v3||t.type===y3}(e)||w3(e),dF(e.value)}function bie(){Wd("[");const e=pF();return Wd("]"),e}function nz(){const e=function(){var t;for(t=gie();;)if(ju("."))Wd("."),t=Z7(".",t,yie());else if(ju("("))t=fie(t,vie());else{if(!ju("["))break;t=Z7("[",t,bie())}return t}();if(Vs.type===hm&&(ju("++")||ju("--")))throw new Error(ZE);return e}function _3(){var e,t;if(Vs.type!==hm&&Vs.type!==Yb)t=nz();else{if(ju("++")||ju("--"))throw new Error(ZE);if(ju("+")||ju("-")||ju("~")||ju("!"))e=pm(),t=_3(),t=function(r,u){const l=new bv(Jre);return l.operator=r,l.argument=u,l.prefix=!0,l}(e.value,t);else{if(hF("delete")||hF("void")||hF("typeof"))throw new Error(ZE);t=nz()}}return t}function rz(e){let t=0;if(e.type!==hm&&e.type!==Yb)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function Aw(){var e,t;return e=function(){var r,u,l,d,b,k,T,j,$,G;if(r=Vs,$=_3(),(b=rz(d=Vs))===0)return $;for(d.prec=b,pm(),u=[r,Vs],k=[$,d,T=_3()];(b=rz(Vs))>0;){for(;k.length>2&&b<=k[k.length-2].prec;)T=k.pop(),j=k.pop().value,$=k.pop(),u.pop(),l=Q7(j,$,T),k.push(l);(d=pm()).prec=b,k.push(d),u.push(Vs),l=_3(),k.push(l)}for(l=k[G=k.length-1],u.pop();G>1;)u.pop(),l=Q7(k[G-1].value,k[G-2],l),G-=2;return l}(),ju("?")&&(pm(),t=Aw(),Wd(":"),e=function(r,u,l){const d=new bv(Hre);return d.test=r,d.consequent=u,d.alternate=l,d}(e,t,Aw())),e}function pF(){const e=Aw();if(ju(","))throw new Error(ZE);return e}function xie(e){Vr=0,Ud=(Gi=e).length,Vs=null,J7();const t=pF();if(Vs.type!==JE)throw new Error("Unexpect token after expression.");return t}var wie={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function _ie(e){function t(u,l,d){return b=>function(k,T,j,$){let G=e(T[0]);return j&&(G=j+"("+G+")",j.lastIndexOf("new ",0)===0&&(G="("+G+")")),G+"."+k+($<0?"":$===0?"()":"("+T.slice(1).map(e).join(",")+")")}(u,b,l,d)}const r="new Date";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(u){u.length<3&&Object(xe.o)("Missing arguments to clamp function."),u.length>3&&Object(xe.o)("Too many arguments to clamp function.");const l=u.map(e);return"Math.max("+l[1]+", Math.min("+l[2]+","+l[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:r,date:t("getDate",r,0),day:t("getDay",r,0),year:t("getFullYear",r,0),month:t("getMonth",r,0),hours:t("getHours",r,0),minutes:t("getMinutes",r,0),seconds:t("getSeconds",r,0),milliseconds:t("getMilliseconds",r,0),time:t("getTime",r,0),timezoneoffset:t("getTimezoneOffset",r,0),utcdate:t("getUTCDate",r,0),utcday:t("getUTCDay",r,0),utcyear:t("getUTCFullYear",r,0),utcmonth:t("getUTCMonth",r,0),utchours:t("getUTCHours",r,0),utcminutes:t("getUTCMinutes",r,0),utcseconds:t("getUTCSeconds",r,0),utcmilliseconds:t("getUTCMilliseconds",r,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase","String",0),lower:t("toLowerCase","String",0),substring:t("substring","String"),split:t("split","String"),trim:t("trim","String",0),regexp:"RegExp",test:t("test","RegExp"),if:function(u){u.length<3&&Object(xe.o)("Missing arguments to if function."),u.length>3&&Object(xe.o)("Too many arguments to if function.");const l=u.map(e);return"("+l[0]+"?"+l[1]+":"+l[2]+")"}}}function kie(e){const t=(e=e||{}).allowed?Object(xe.Fa)(e.allowed):{},r=e.forbidden?Object(xe.Fa)(e.forbidden):{},u=e.constants||wie,l=(e.functions||_ie)(G),d=e.globalvar,b=e.fieldvar,k=Object(xe.E)(d)?d:he=>"".concat(d,'["').concat(he,'"]');let T={},j={},$=0;function G(he){if(Object(xe.J)(he))return he;const ve=te[he.type];return ve==null&&Object(xe.o)("Unsupported type: "+he.type),ve(he)}const te={Literal:he=>he.raw,Identifier:he=>{const ve=he.name;return $>0?ve:Object(xe.w)(r,ve)?Object(xe.o)("Illegal identifier: "+ve):Object(xe.w)(u,ve)?u[ve]:Object(xe.w)(t,ve)?ve:(T[ve]=1,k(ve))},MemberExpression:he=>{const ve=!he.computed,Be=G(he.object);ve&&($+=1);const ze=G(he.property);return Be===b&&(j[function(Ue){const st=Ue&&Ue.length-1;return st&&(Ue[0]==='"'&&Ue[st]==='"'||Ue[0]==="'"&&Ue[st]==="'")?Ue.slice(1,-1):Ue}(ze)]=1),ve&&($-=1),Be+(ve?"."+ze:"["+ze+"]")},CallExpression:he=>{he.callee.type!=="Identifier"&&Object(xe.o)("Illegal callee type: "+he.callee.type);const ve=he.callee.name,Be=he.arguments,ze=Object(xe.w)(l,ve)&&l[ve];return ze||Object(xe.o)("Unrecognized function: "+ve),Object(xe.E)(ze)?ze(Be):ze+"("+Be.map(G).join(",")+")"},ArrayExpression:he=>"["+he.elements.map(G).join(",")+"]",BinaryExpression:he=>
7838"("+G(he.left)+" "+he.operator+" "+G(he.right)+")",UnaryExpression:he=>"("+he.operator+G(he.argument)+")",ConditionalExpression:he=>"("+G(he.test)+"?"+G(he.consequent)+":"+G(he.alternate)+")",LogicalExpression:he=>"("+G(he.left)+he.operator+G(he.right)+")",ObjectExpression:he=>"{"+he.properties.map(G).join(",")+"}",Property:he=>{$+=1;const ve=G(he.key);return $-=1,ve+":"+G(he.value)}};function se(he){const ve={code:G(he),globals:Object.keys(T),fields:Object.keys(j)};return T={},j={},ve}return se.functions=l,se.constants=u,se}const Eie="view",k3="[",E3="]",iz="{",oz="}",Cie=":",az=",",Sie="@",Aie=">",Oie=/[[\]{}]/,Die={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let sz,uz;function Ow(e,t,r){return sz=t||Eie,uz=r||Die,cz(e.trim()).map(mF)}function iC(e,t,r,u,l){const d=e.length;let b,k=0;for(;t<d;++t){if(b=e[t],!k&&b===r)return t;l&&l.indexOf(b)>=0?--k:u&&u.indexOf(b)>=0&&++k}return t}function cz(e){const t=[],r=e.length;let u=0,l=0;for(;l<r;)l=iC(e,l,az,k3+iz,E3+oz),t.push(e.substring(u,l).trim()),u=++l;if(t.length===0)throw"Empty event selector: "+e;return t}function mF(e){return e[0]==="["?function(t){const r=t.length;let u,l=1;if((l=iC(t,l,E3,k3,E3))===r)throw"Empty between selector: "+t;if((u=cz(t.substring(1,l))).length!==2)throw"Between selector must have two elements: "+t;if((t=t.slice(l+1).trim())[0]!==Aie)throw"Expected '>' after between selector: "+t;u=u.map(mF);const d=mF(t.slice(1).trim());return d.between?{between:u,stream:d}:(d.between=u,d)}(e):function(t){const r={source:sz},u=[];let l,d,b=[0,0],k=0,T=0,j=t.length,$=0;if(t[j-1]===oz){if(!(($=t.lastIndexOf(iz))>=0))throw"Unmatched right brace: "+t;try{b=function(G){const te=G.split(az);if(!G.length||te.length>2)throw G;return te.map(se=>{const he=+se;if(he!=he)throw G;return he})}(t.substring($+1,j-1))}catch{throw"Invalid throttle specification: "+t}t=t.slice(0,$).trim(),j=t.length,$=0}if(!j)throw t;if(t[0]===Sie&&(k=++$),(l=iC(t,$,Cie))<j&&(u.push(t.substring(T,l).trim()),T=$=++l),($=iC(t,$,k3))===j)u.push(t.substring(T,j).trim());else if(u.push(t.substring(T,$).trim()),d=[],(T=++$)===j)throw"Unmatched left bracket: "+t;for(;$<j;){if(($=iC(t,$,E3))===j)throw"Unmatched left bracket: "+t;if(d.push(t.substring(T,$).trim()),$<j-1&&t[++$]!==k3)throw"Expected left bracket: "+t;T=++$}if(!(j=u.length)||Oie.test(u[j-1]))throw"Invalid event selector: "+t;return j>1?(r.type=u[1],k?r.markname=u[0].slice(1):function(G){return uz[G]}(u[0])?r.marktype=u[0]:r.source=u[0]):r.type=u[0],r.type.slice(-1)==="!"&&(r.consume=!0,r.type=r.type.slice(0,-1)),d!=null&&(r.filter=d),b[0]&&(r.throttle=b[0]),b[1]&&(r.debounce=b[1]),r}(e)}var Tie="5.20.0";Object(xe.p)(Sn,v,O,A,S,M,L,P,V,N,ee,J);const Nie=Tie;var Iie=n(245),w_=function(e,t,r){return e.fields=t||[],e.fname=r,e},Mie=function(e){return e.length===1?Fie(e[0]):Rie(e)};const Fie=e=>function(t){return t[e]},Rie=e=>{const t=e.length;return function(r){for(let u=0;u<t;++u)r=r[e[u]];return r}};var gF=function(e){throw Error(e)},Dw=function(e){var t,r,u,l=[],d=null,b=0,k=e.length,T="";function j(){l.push(T+e.substring(t,r)),T="",t=r+1}for(e+="",t=r=0;r<k;++r)if((u=e[r])==="\\")T+=e.substring(t,r),T+=e.substring(++r,++r),t=r;else if(u===d)j(),d=null,b=-1;else{if(d)continue;t===b&&u==='"'||t===b&&u==="'"?(t=r+1,d=u):u!=="."||b?u==="["?(r>t&&j(),b=t=r+1):u==="]"&&(b||gF("Access path missing open bracket: "+e),b>0&&j(),b=0,t=r+1):r>t?j():t=r+1}return b&&gF("Access path missing closing bracket: "+e),d&&gF("Access path missing closing quote: "+e),r>t&&(r++,j()),l},Bie=function(e,t,r){const u=Dw(e);return e=u.length===1?u[0]:e,w_((r&&r.get||Mie)(u),[e],t||e)},oC=[],Pie=(Bie("id"),w_(function(e){return e},oC,"identity"));w_(function(){return 0},oC,"zero"),w_(function(){return 1},oC,"one"),w_(function(){return!0},oC,"true"),w_(function(){return!1},oC,"false");function C3(e,t,r){var u=[t].concat([].slice.call(r));console[e].apply(console,u)}var mo=Array.isArray,ff=function(e){return e===Object(e)};const lz=e=>e!=="__proto__";function fz(...e){return e.reduce((t,r)=>{for(var u in r)if(u==="signals")t.signals=jie(t.signals,r.signals);else{var l=u==="legend"?{layout:1}:u==="style"||null;vF(t,u,r[u],l)}return t},{})}function vF(e,t,r,u){var l,d;if(lz(t))if(ff(r)&&!mo(r))for(l in d=ff(e[t])?e[t]:e[t]={},r)u&&(u===!0||u[l])?vF(d,l,r[l]):lz(l)&&(d[l]=r[l]);else e[t]=r}function jie(e,t){if(e==null)return t;const r={},u=[];function l(d){r[d.name]||(r[d.name]=1,u.push(d))}return t.forEach(l),e.forEach(l),u}var qc=function(e){return e!=null?mo(e)?e:[e]:[]},Lie=function(e){return typeof e=="function"};const zie=Object.prototype.hasOwnProperty;var Tw=function(e,t){return zie.call(e,t)},aC=function(e){return typeof e=="boolean"},fl=function(e){return typeof e=="number"},Ca=function(e){return typeof e=="string"};function ns(e){return mo(e)?"["+e.map(ns)+"]":ff(e)||Ca(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}var Nw=function(e){for(var t={},r=0,u=e.length;r<u;++r)t[e[r]]=!0;return t};function ao(e,t){var r={};for(var u in e)Object.prototype.hasOwnProperty.call(e,u)&&t.indexOf(u)<0&&(r[u]=e[u]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var l=0;for(u=Object.getOwnPropertySymbols(e);l<u.length;l++)t.indexOf(u[l])<0&&Object.prototype.propertyIsEnumerable.call(e,u[l])&&(r[u[l]]=e[u[l]])}return r}Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function e(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,function(r,u){return Array.isArray(u)?r.push.apply(r,e.call(u,t-1)):r.push(u),r},[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{configurable:!0,value:function(e){return Array.prototype.map.apply(this,arguments).flat()},writable:!0});var Uie=n(244),Wie=n.n(Uie),Vie=n(243),$ie=n.n(Vie),Hie=n(86),sC=n.n(Hie);function yF(e){return!!e.or}function bF(e){return!!e.and}function xF(e){return!!e.not}const uC=$ie.a,Sa=Wie.a;function cC(e,t){const r={};for(const u of t)Tw(e,u)&&(r[u]=e[u]);return r}function U1(e,t){const r=Object.assign({},e);for(const u of t)delete r[u];return r}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>sC()(e)).join(",")})`};const tc=sC.a;function cs(e){if(fl(e))return e;const t=Ca(e)?e:sC()(e);if(t.length<250)return t;let r=0;for(let u=0;u<t.length;u++)r=(r<<5)-r+t.charCodeAt(u),r&=r;return r}function dz(e){return e===!1||e===null}function bo(e,t){return e.indexOf(t)>-1}function lC(e,t){let r=0;for(const[u,l]of e.entries())if(t(l,u,r++))return!0;return!1}function hz(e,t){let r=0;for(const[u,l]of e.entries())if(!t(l,u,r++))return!1;return!0}function qie(e,t){for(const r of di(t))vF(e,r,t[r],!0)}function Xb(e,t){const r=[],u={};let l;for(const d of e)(l=t(d))in u||(u[l]=1,r.push(d));return r}function pz(e,t){for(const r of e)if(t.has(r))return!0;return!1}function mz(e){const t=new Set;for(const r of e){const u=Dw(r).map((d,b)=>b===0?d:`[${d}]`),l=u.map((d,b)=>u.slice(0,b+1).join(""));for(const d of l)t.add(d)}return t}function gz(e,t){return e===void 0||t===void 0||pz(mz(e),mz(t))}function su(e){return di(e).length===0}const di=Object.keys,Jb=Object.values;function vz(e){const t=[];for(const r in e)Tw(e,r)&&t.push({key:r,value:e[r]});return t}function S3(e){return e===!0||e===!1}function nc(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function fC(e,t){return xF(e)?"!("+fC(e.not,t)+")":bF(e)?"("+e.and.map(r=>fC(r,t)).join(") && (")+")":yF(e)?"("+e.or.map(r=>fC(r,t)).join(") || (")+")":t(e)}function wF(e,t){if(t.length===0)return!0;const r=t.shift();return r in e&&wF(e[r],t)&&delete e[r],su(e)}function A3(e){return e.charAt(0).toUpperCase()+e.substr(1)}function yz(e,t="datum"){const r=Dw(e),u=[];for(let l=1;l<=r.length;l++){const d=`[${r.slice(0,l).map(ns).join("][")}]`;u.push(`${t}${d}`)}return u.join(" && ")}function Gie(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function Qb(e){return`${Dw(e).map(Gie).join("\\.")}`}function __(e,t,r){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),r)}function bz(e){return`${Dw(e).join(".")}`}function dC(e){return e?Dw(e).length:0}function dl(...e){for(const t of e)if(t!==void 0)return t}let Kie=42;function Yie(e){const t=++Kie;return e?String(e)+t:t}function O3(e){if(e!==void 0)return(e%360+360)%360}function _F(e){return!!fl(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const xz={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",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDash"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDash"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"},titleColor:{part:"title",vgProp:"fill"},title:null};function kF(e){return e&&e.condition}const wz=["domain","grid","labels","ticks","title"],Xie={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"main",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},_z={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},Jie=Object.assign(Object.assign({},_z),{style:1,labelExpr:1,encoding:1});function kz(e){return!!Jie[e]}const ep={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},Ez=ep.arc,D3=ep.area,T3=ep.bar,Qie=ep.image,N3=ep.line,I3=ep.point,Zie=ep.rect,M3=ep.rule,Cz=ep.text,EF=ep.tick,eoe=ep.trail,CF=ep.circle,SF=ep.square,Sz=ep.geoshape;function Iw(e){return bo(["line","area","trail"],e)}function Az(e){return bo(["rect","bar","image","arc"],e)}const Oz=di(ep);function Py(e){return e.type}Nw(Oz);const toe=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],Dz=di({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBand:1,timeUnitBandPosition:1}),noe={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},roe={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},ioe={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function W1(e){return"mark"in e}class F3{constructor(t,r){this.name=t,this.run=r}hasMatchingType(t){return!!W1(t)&&function(r){return Py(r)?r.type:r}(t.mark)===this.name}}const ooe={argmax:1,argmin:1,average:1,count:1,distinct:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},aoe={count:1,min:1,max:1};function Zb(e){return!!e&&!!e.argmin}function Mw(e){return!!e&&!!e.argmax}function AF(e){return Ca(e)&&!!ooe[e]}const soe=["count","valid","missing","distinct"];function Tz(e){return Ca(e)&&bo(soe,e)}const uoe=["count","sum","distinct","valid","missing"],coe=Nw(["mean","average","median","q1","q3","min","max"]),V1="row",$1="column",R3="facet",pc="x",Rl="y",xv="x2",jy="y2",Ly="radius",H1="radius2",wv="theta",q1="theta2",zy="latitude",Uy="longitude",_v="latitude2",b0="longitude2",mm="color",Wy="fill",Vy="stroke",gm="shape",G1="size",Fw="angle",K1="opacity",ex="fillOpacity",tx="strokeOpacity",nx="strokeWidth",rx="strokeDash",hC="text",pC="order",mC="detail",B3="key",Rw="tooltip",P3="href",j3="url",L3="description",Nz={theta:1,theta2:1,radius:1,radius2:1};function Iz(e){return e in Nz}const OF={longitude:1,longitude2:1,latitude:1,latitude2:1},loe=di(OF),Mz=Object.assign(Object.assign(Object.assign(Object.assign({},{x:1,y:1,x2:1,y2:1}),Nz),OF),{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1});function k_(e){return e===mm||e===Wy||e===Vy}const Fz={row:1,column:1,facet:1},x0=di(Fz),DF=Object.assign(Object.assign({},Mz),Fz),Rz=di(DF),foe=ao(DF,["order","detail","tooltip"]),doe=ao(foe,["row","column","facet"]);function hoe(e){return!!doe[e]}function Bz(e){return!!DF[e]}const poe=[xv,jy,_v,b0,q1,H1];function Pz(e){return Bw(e)!==e}function Bw(e){switch(e){case xv:return pc;case jy:return Rl;case _v:return zy;case b0:return Uy;case q1:return wv;case H1:return Ly}return e}function ix(e){if(Iz(e))switch(e){case wv:return"startAngle";case q1:return"endAngle";case Ly:return"outerRadius";case H1:return"innerRadius"}return e}function $y(e){switch(e){case pc:return xv;case Rl:return jy;case zy:return _v;case Uy:return b0;case wv:return q1;case Ly:return H1}}function Hy(e){switch(e){case pc:case xv:return"width";
7838case Rl:case jy:return"height"}}const TF=ao(Mz,["x","y","x2","y2","latitude","longitude","latitude2","longitude2","theta","theta2","radius","radius2"]),moe=di(TF),ox={x:1,y:1},w0=di(ox);function qy(e){return e in ox}const NF={theta:1,radius:1},goe=di(NF);function z3(e){return e==="width"?pc:Rl}const jz=ao(TF,["text","tooltip","href","url","description","detail","key","order"]),voe=di(jz),Lz=Object.assign(Object.assign(Object.assign({},ox),NF),jz),U3=di(Lz);function ax(e){return!!Lz[e]}function yoe(e,t){return function(r){switch(r){case mm:case Wy:case Vy:case L3:case mC:case B3:case Rw:case P3:case pC:case K1:case ex:case tx:case nx:case R3:case V1:case $1:return zz;case pc:case Rl:case zy:case Uy:return boe;case xv:case jy:case _v:case b0:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case G1:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case rx:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case gm:return{point:"always",geoshape:"always"};case hC:return{text:"always"};case Fw:return{point:"always",square:"always",text:"always"};case j3:return{image:"always"};case wv:case Ly:return{text:"always",arc:"always"};case q1:case H1:return{arc:"always"}}}(e)[t]}const zz={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},boe=ao(zz,["geoshape"]);function W3(e){switch(e){case pc:case Rl:case wv:case Ly:case G1:case Fw:case nx:case K1:case ex:case tx:case xv:case jy:case q1:case H1:return;case R3:case V1:case $1:case gm:case rx:case hC:case Rw:case P3:case j3:case L3:return"discrete";case mm:case Wy:case Vy:return"flexible";case zy:case Uy:case _v:case b0:case mC:case B3:case pC:return}}function Uz(e){return aC(e)&&(e=Z3(e,void 0)),"bin"+di(e).map(t=>V3(e[t])?nc(`_${t}_${Object.entries(e[t])}`):nc(`_${t}_${e[t]}`)).join("")}function Du(e){return e===!0||gC(e)&&!e.binned}function tp(e){return e==="binned"||gC(e)&&e.binned===!0}function gC(e){return ff(e)}function V3(e){return e==null?void 0:e.selection}function Wz(e){switch(e){case V1:case $1:case G1:case mm:case Wy:case Vy:case nx:case K1:case ex:case tx:case gm:return 6;case rx:return 4;default:return 10}}function xoe(e){return`Invalid specification ${JSON.stringify(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const woe='Autosize "fit" only works for single views and layered views.';function _oe(e){return`${e=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function koe(e){return`${e=="width"?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${e=="width"?"x":"y"}".`}function Eoe(e){return e?`Dropping "fit-${e}" because spec has discrete ${Hy(e)}.`:'Dropping "fit" because spec has discrete size.'}function Coe(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function Soe(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function Aoe(e){return`The "nearest" transform is not supported for ${e} marks.`}function Ooe(e){return`Selection not supported for ${e} yet.`}function Doe(e){return`Cannot find a selection named "${e}".`}const Toe="Scale bindings are currently only supported for scales with unbinned, continuous domains.",Noe="Legend bindings are only supported for selections over an individual field or encoding channel.";function Ioe(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}function Moe(e){return`Unknown repeated value "${e}".`}function Foe(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const Roe="Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function Boe(e){return`Unrecognized parse "${e}".`}function Poe(e,t,r){return`An ancestor parsed field "${e}" as ${r} but a child wants to parse the field as ${t}.`}
7838function joe(e){return`Ignoring an invalid transform: ${tc(e)}.`}const Loe='If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.';function zoe(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function Uoe(e){return`Layer's shared ${e.join(",")} channel ${e.length===1?"is":"are"} overriden.`}function Woe(e){const{parentProjection:t,projection:r}=e;return`Layer's shared projection ${tc(t)} is overridden by a child projection ${tc(r)}.`}const Voe="Arc marks uses theta channel rather than angle, replacing angle with theta.";function $oe(e,t,r){return`Channel ${e} is a ${t}. Converted to {value: ${tc(r)}}.`}function Hoe(e){return`Invalid field type "${e}".`}function qoe(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function Goe(e){return`Invalid aggregation operator "${e}".`}function Koe(e,t){return`Missing type for channel "${e}", using "${t}" instead.`}function Yoe(e,t){const{fill:r,stroke:u}=t;return`Dropping color ${e} as the plot also has ${r&&u?"fill and stroke":r?"fill":"stroke"}.`}function Xoe(e,t){return`Dropping ${tc(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function Joe(e,t,r){return`${e}-encoding with type ${t} is deprecated. Replacing with ${r}-encoding.`}const Qoe="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function Zoe(e,t,r){return`${e} dropped as it is incompatible with "${t}"${r?` when ${r}`:""}.`}function eae(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function tae(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function nae(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function rae(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t==="ordinal"?"order":"magnitude"}.`}function iae(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`}function oae(e,t){return`Specified orient "${e}" overridden with "${t}".`}const aae="Custom domain scale cannot be unioned with default field-based domain.",sae=`Scale's "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.`;function uae(e){return`Cannot use the scale property "${e}" with non-color channel.`}function cae(e){return`Using unaggregated domain with raw field has no effect (${tc(e)}).`}function lae(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function fae(e){return`Unaggregated domain is currently unsupported for log scale (${tc(e)}).`}function dae(e){return`Cannot apply size to non-oriented mark "${e}".`}function hae(e,t,r){return`Channel "${e}" does not work with "${t}" scale. We are using "${r}" scale instead.`}function pae(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function mae(e,t,r){return`${r}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function gae(e,t){return`Scale type "${t}" does not work with mark "${e}".`}function vae(e){return`The step for "${e}" is dropped because the ${e==="width"?"x":"y"} is continuous.`}function yae(e,t,r,u){return`Conflicting ${t.toString()} property "${e.toString()}" (${tc(r)} and ${tc(u)}). Using ${tc(r)}.`}function bae(e,t,r,u){return`Conflicting ${t.toString()} property "${e.toString()}" (${tc(r)} and ${tc(u)}). Using the union of the two domains.`}function xae(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function wae(e){return`Dropping sort property ${tc(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const _ae="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",kae="Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.",Eae="Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.",Cae="Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.",Sae="Invalid channel for axis.";function Aae(e){return`Cannot stack "${e}" if there is already "${e}2".`}function Oae(e){return`Cannot stack non-linear scale (${e}).`}function Dae(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function Tae(e,t){return`Invalid ${e}: ${tc(t)}.`}function Nae(e){return`Dropping day from datetime ${tc(e)} as day cannot be combined with other units.`}function Iae(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}function Mae(e,t,r){return`${e} is not usually used with ${t} for ${r}.`}function Fae(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function Rae(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`}function Bae(e){return`1D error band does not support ${e}.`}function Pae(e){return`Channel ${e} is required for "binned" bin.`}function jae(e){return`Domain for ${e} is required for threshold scale.`}const Vz=function(e,t){var r=e||0;return{level:function(u){return arguments.length?(r=+u,this):r},error:function(){return r>=1&&C3(t||"error","ERROR",arguments),this},warn:function(){return r>
7838=2&&C3(t||"warn","WARN",arguments),this},info:function(){return r>=3&&C3(t||"log","INFO",arguments),this},debug:function(){return r>=4&&C3(t||"log","DEBUG",arguments),this}}}(2);let $3=Vz;function Lae(){return $3=Vz}function li(...e){$3.warn(...e)}function E_(e){if(e&&ff(e)){for(const t of MF)if(t in e)return!0}return!1}const $z=["january","february","march","april","may","june","july","august","september","october","november","december"],zae=$z.map(e=>e.substr(0,3)),Hz=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Uae=Hz.map(e=>e.substr(0,3));function IF(e,t){const r=[];if(t&&e.day!==void 0&&di(e).length>1&&(li(re.droppedDay(e)),delete(e=Sa(e)).day),e.year!==void 0?r.push(e.year):r.push(2012),e.month!==void 0){const u=t?function(l){if(_F(l)&&(l=+l),fl(l))return l-1;{const d=l.toLowerCase(),b=$z.indexOf(d);if(b!==-1)return b;const k=d.substr(0,3),T=zae.indexOf(k);if(T!==-1)return T;throw new Error(re.invalidTimeUnit("month",l))}}(e.month):e.month;r.push(u)}else if(e.quarter!==void 0){const u=t?function(l){if(_F(l)&&(l=+l),fl(l))return l>4&&li(re.invalidTimeUnit("quarter",l)),l-1;throw new Error(re.invalidTimeUnit("quarter",l))}(e.quarter):e.quarter;r.push(fl(u)?3*u:u+"*3")}else r.push(0);if(e.date!==void 0)r.push(e.date);else if(e.day!==void 0){const u=t?function(l){if(_F(l)&&(l=+l),fl(l))return l%7;{const d=l.toLowerCase(),b=Hz.indexOf(d);if(b!==-1)return b;const k=d.substr(0,3),T=Uae.indexOf(k);if(T!==-1)return T;throw new Error(re.invalidTimeUnit("day",l))}}(e.day):e.day;r.push(fl(u)?u+1:u+"+1")}else r.push(1);for(const u of["hours","minutes","seconds","milliseconds"]){const l=e[u];r.push(l===void 0?0:l)}return r}function vC(e){const t=IF(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const qz={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},MF=di(qz);function FF(e){return e.startsWith("utc")}const Wae={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function RF(e){const t=[];for(const r of MF)Gz(e,r)&&t.push(r);return t}function Gz(e,t){const r=e.indexOf(t);return!(r<0)&&!(r>0&&t==="seconds"&&e.charAt(r-1)==="i")&&!(e.length>r+3&&t==="day"&&e.charAt(r+3)==="o")&&!(r>0&&t==="year"&&e.charAt(r-1)==="f")}function Vae(e,t,{end:r}={end:!1}){const u=yz(t),l=FF(e)?"utc":"";function d(T){return T==="quarter"?`(${l}quarter(${u})-1)`:`${l}${T}(${u})`}let b;const k={};for(const T of MF)Gz(e,T)&&(k[T]=d(T),b=T);return r&&(k[b]+="+1"),function(T){const j=IF(T,!1).join(", ");return T.utc?`utc(${j})`:`datetime(${j})`}(k)}function Kz(e){if(!e)return;const t=RF(e);return`timeUnitSpecifier(${sC()(t)}, ${sC()(Wae)})`}function np(e){if(!e)return;let t;return Ca(e)?t={unit:e}:ff(e)&&(t=Object.assign(Object.assign({},e),e.unit?{unit:e.unit}:{})),FF(t.unit)&&(t.utc=!0,t.unit=function(r){return r.substr(3)}(t.unit)),t}function Uo(e){return e&&!!e.signal}function sx(e){return!!e.step}function ux(e){return!mo(e)&&"field"in e&&"data"in e}const $ae=di({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1}),Hae={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},BF=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function PF(e){return e&&!!e.field&&e.equal!==void 0}function Yz(e){return e&&!!e.field&&e.lt!==void 0}function Xz(e){return e&&!!e.field&&e.lte!==void 0}function Jz(e){return e&&!!e.field&&e.gt!==void 0}function Qz(e){return e&&!!e.field&&e.gte!==void 0}function jF(e){return!!(e&&e.field&&(mo(e.range)&&e.range.length===2||Uo(e.range)))}function LF(e){return e&&!!e.field&&(mo(e.oneOf)||mo(e.in))}function Zz(e){return LF(e)||PF(e)||jF(e)||Yz(e)||Jz(e)||Xz(e)||Qz(e)}function Gy(e,t){return rR(e,{timeUnit:t,wrapTime:!0})}function eU(e,t=!0){var r;const{field:u}=e,l=(r=np(e.timeUnit))===null||r===void 0?void 0:r.unit,d=l?"time("+Vae(l,u)+")":bi(e,{expr:"datum"});if(PF(e))return d+"==="+Gy(e.equal,l);if(Yz(e))return`${d}<${Gy(e.lt,l)}`;if(Jz(e))return`${d}>${Gy(e.gt,l)}`;if(Xz(e))return`${d}<=${Gy(e.lte,l)}`;if(Qz(e))return`${d}>=${Gy(e.gte,l)}`;if(LF(e))return`indexof([${function(b,k){return b.map(T=>Gy(T,k))}(e.oneOf,l).join(",")}], ${d}) !== -1`;if(function(b){return b&&!!b.field&&b.valid!==void 0}(e))return zF(d,e.valid);if(jF(e)){const{range:b}=e,k=Uo(b)?{signal:`${b.signal}[0]`}:b[0],T=Uo(b)?{signal:`${b.signal}[1]`}:b[1];if(k!==null&&T!==null&&t)return"inrange("+d+", ["+Gy(k,l)+", "+Gy(T,l)+"])";const j=[];return k!==null&&j.push(`${d} >= ${Gy(k,l)}`),T!==null&&j.push(`${d} <= ${Gy(T,l)}`),j.length>0?j.join(" && "):"true"}throw new Error(`Invalid field predicate: ${JSON.stringify(e)}`)}function zF(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function qae(e){var t;return Zz(e)&&e.timeUnit?Object.assign(Object.assign({},e),{timeUnit:(t=np(e.timeUnit))===null||t===void 0?void 0:t.unit}):e}const C_={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"},Pw=C_.quantitative,UF=C_.ordinal,S_=C_.temporal,WF=C_.nominal,A_=C_.geojson,Gae=di(C_),hl={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},VF={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"},Kae=di(VF);function Yae(e,t){const r=VF[e],u=VF[t];return r===u||r==="ordinal-position"&&u==="time"||u==="ordinal-position"&&r==="time"}const Xae={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function tU(e){return Xae[e]}const nU=["linear","log","pow","sqrt","symlog","time","utc"],Jae=Nw(nU),Qae=Nw(["linear","log","pow","sqrt","symlog"]),Zae=Nw(["quantile","quantize","threshold"]),ese=Nw(nU.concat(["quantile","quantize","threshold","sequential","identity"])),tse=Nw(["ordinal","bin-ordinal","point","band"]);function vm(e){return e in tse}function _0(e){return e in ese}function kv(e){return e in Jae}function H3(e){return e in Zae}function rU(e){return e==null?void 0:e.selection}const nse={type:1,domain:1,domainMid:1,align:1,range:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},rse=ao(nse,["type","domain","range","scheme"]),ise=di(rse);(function(){var e;const t={};for(const r of Rz)for(const u of Gae)for(const l of Kae){const d=ose(r,u);sU(r,l)&&aU(l,u)&&(t[d]=(e=t[d])!==null&&e!==void 0?e:[],t[d].push(l))}})();function iU(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!bo(["point","band","identity"],e);case"bins":return!bo(["point","band","identity","ordinal"],e);case"round":return kv(e)||e==="band"||e==="point";case"padding":return kv(e)||bo(["point","band"],e);case"paddingOuter":case"align":return bo(["point","band"],e);case"paddingInner":return e==="band";case"domainMid":case"clamp":return kv(e);case"nice":return kv(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return _0(e)&&!bo(["log","time","utc","threshold","quantile"],e)}}function oU(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return k_(e)?void 0:re.cannotUseScalePropertyWithNonColor(e);case"align":case"type":case"bins":case"domain":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"reverse":case"round":case"clamp":case"zero":return}}function aU(e,t){return bo([UF,WF],t)?e===void 0||vm(e):t===S_?bo([hl.TIME,hl.UTC,void 0],e):t!==Pw||bo([hl.LOG,hl.POW,hl.SQRT,hl.SYMLOG,hl.QUANTILE,hl.QUANTIZE,hl.THRESHOLD,hl.LINEAR,void 0],e)}function sU(e,t){if(!ax(e))return!1;switch(e){case pc:case Rl:case wv:case Ly:return kv(t)||bo(["band","point"],t);case G1:case nx:case K1:case ex:case tx:case Fw:return kv(t)||H3(t)||bo(["band","point","ordinal"],t);case mm:case Wy:case Vy:return t!=="band";case rx:return t==="ordinal"||H3(t);case gm:return t==="ordinal"}}function ose(e,t){return e+"_"+t}function $F(e){const{channel:t,channelDef:r,markDef:u,scale:l,config:d}=e,b=cU(e);return Si(r)&&!Tz(r.aggregate)&&l&&kv(l.get("type"))&&l.get("zero")===!1?uU({fieldDef:r,channel:t,markDef:u,ref:b,config:d}):b}function uU({fieldDef:e,channel:t,markDef:r,ref:u,config:l}){return Iw(r.type)||Ns("invalid",r,l)===null?u:[function(d,b){const k=HF(d,!0),T=Bw(b)==="y"?{field:{group:"height"}}:{value:0};return Object.assign({test:k},T)}(e,t),u]}function HF(e,t=!0){return zF(Ca(e)?e:bi(e,{expr:"datum"}),!t)}
7838function jw(e,t,r,u){const l={};if(t&&(l.scale=t),lx(e)){const{datum:d}=e;E_(d)?l.signal=vC(d):Uo(d)?l.signal=d.signal:l.value=d}else l.field=bi(e,r);if(u){const{offset:d,band:b}=u;d&&(l.offset=d),b&&(l.band=b)}return l}function q3({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:r,offset:u,startSuffix:l,band:d=.5}){const b=0<d&&d<1?"datum":void 0,k=bi(t,{expr:b,suffix:l}),T=r!==void 0?bi(r,{expr:b}):bi(t,{suffix:"end",expr:b}),j={};if(d===0||d===1){j.scale=e;const $=d===0?k:T;j.field=$}else{const $=`${d} * ${k} + ${1-d} * ${T}`;j.signal=`scale("${e}", ${$})`}return u&&(j.offset=u),j}function cU({channel:e,channelDef:t,channel2Def:r,markDef:u,config:l,scaleName:d,scale:b,stack:k,offset:T,defaultRef:j,band:$}){var G;if(t){if(ta(t)){if(Cg(t)){$=$??xC({channel:e,fieldDef:t,fieldDef2:r,markDef:u,stack:k,config:l,isMidPoint:!0});const{bin:se,timeUnit:he,type:ve}=t;if(Du(se)||$&&he&&ve===S_)return k&&k.impute?jw(t,d,{binSuffix:"mid"},{offset:T}):$?q3({scaleName:d,fieldOrDatumDef:t,band:$,offset:T}):jw(t,d,wC(t,e)?{binSuffix:"range"}:{},{offset:T});if(tp(se)){if(Si(r))return q3({scaleName:d,fieldOrDatumDef:t,fieldOrDatumDef2:r,band:$,offset:T});{const Be=e===pc?xv:jy;li(re.channelRequiredForBinned(Be))}}}const te=b==null?void 0:b.get("type");return jw(t,d,vm(te)?{binSuffix:"range"}:{},{offset:T,band:te==="band"?(G=$??t.band)!==null&&G!==void 0?G:.5:void 0})}if(Y1(t)){const te=t.value,se=T?{offset:T}:{};return Object.assign(Object.assign({},yC(e,te)),se)}}return Lie(j)&&(j=j()),j&&Object.assign(Object.assign({},j),T?{offset:T}:{})}function yC(e,t){return bo(["x","x2"],e)&&t==="width"?{field:{group:"width"}}:bo(["y","y2"],e)&&t==="height"?{field:{group:"height"}}:Gc(t)}function Lw(e){return e&&e!=="number"&&e!=="time"}function lU(e,t,r){return`${e}(${t}${r?`, ${JSON.stringify(r)}`:""})`}const ase=" â ";function qF({fieldOrDatumDef:e,format:t,formatType:r,expr:u,normalizeStack:l,config:d}){var b,k;if(Lw(r))return GF({fieldOrDatumDef:e,format:t,formatType:r,expr:u,config:d});const T=fU(e,u,l);if(eD(e)){const j=function($,G,te,se,he){return!G||te?(te=Ca(te)?te:se,`${he?"utc":"time"}Format(${$}, '${te}')`):function(ve,Be,ze){if(!ve)return;const Ue=Kz(ve);return`${ze||FF(ve)?"utc":"time"}Format(${Be}, ${Ue})`}(G,$,he)}(T,Si(e)?(b=np(e.timeUnit))===null||b===void 0?void 0:b.unit:void 0,t,d.timeFormat,ZF(e)&&((k=e.scale)===null||k===void 0?void 0:k.type)===hl.UTC);return j?{signal:j}:void 0}return t=pU(cx(e),t,d),Si(e)&&Du(e.bin)?{signal:G3(T,bi(e,{expr:u,binSuffix:"end"}),t,r,d)}:t||cx(e)==="quantitative"?{signal:`${mU(T,t)}`}:{signal:`isValid(${T}) ? ${T} : ""+${T}`}}function fU(e,t,r){return Si(e)?r?`${bi(e,{expr:t,suffix:"end"})}-${bi(e,{expr:t,suffix:"start"})}`:bi(e,{expr:t}):function(u){const{datum:l}=u;return E_(l)?vC(l):`${JSON.stringify(l)}`}(e)}function GF({fieldOrDatumDef:e,format:t,formatType:r,expr:u,normalizeStack:l,config:d,field:b}){return b=b??fU(e,u,l),Si(e)&&Du(e.bin)?{signal:G3(b,bi(e,{expr:u,binSuffix:"end"}),t,r,d)}:{signal:lU(r,b,t)}}function dU(e,t,r,u,l,d){var b;if(!Lw(u))return eD(e)?function(k,T,j,$){return k||(T?{signal:Kz(T)}:$?void 0:j.timeFormat)}(r,Si(e)?(b=np(e.timeUnit))===null||b===void 0?void 0:b.unit:void 0,l,d):pU(t,r,l)}function hU(e,t,r){return e&&(Uo(e)||e==="number"||e==="time")?e:eD(t)&&r!=="time"&&r!=="utc"?"time":void 0}function pU(e,t,r){return Ca(t)?t:e===Pw?r.numberFormat:void 0}function mU(e,t){return`format(${e}, "${t||""}")`}function gU(e,t,r,u){var l;return Lw(r)?lU(r,e,t):mU(e,(l=Ca(t)?t:void 0)!==null&&l!==void 0?l:u.numberFormat)}function G3(e,t,r,u,l){const d=gU(e,r,u,l),b=gU(t,r,u,l);return`${zF(e,!1)} ? "null" : ${d} + "${ase}" + ${b}`}const K3="min",sse={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function vU(e){return e in sse}function yU(e){return!!e&&!!e.encoding}function Ky(e){return!(!e||e.op!=="count"&&!e.field)}function bU(e){return!!e&&mo(e)}function bC(e){return"row"in e||"column"in e}function KF(e){return!!e&&"header"in e}function Y3(e){return"facet"in e}function xU(e){const{field:t,timeUnit:r,bin:u,aggregate:l}=e;return Object.assign(Object.assign(Object.assign(Object.assign({},r?{timeUnit:r}:{}),u?{bin:u}:{}),l?{aggregate:l}:{}),{field:t})}function wU(e){return Cg(e)&&"sort"in e}function xC({channel:e,fieldDef:t,fieldDef2:r,markDef:u,stack:l,config:d,isMidPoint:b}){if(ta(t)&&t.band!==void 0)return t.band;if(Si(t)){const{timeUnit:k,bin:T}=t;if(k&&!r)return b?Ww("timeUnitBandPosition",u,d):Az(u.type)?Ww("timeUnitBand",u,d):0;if(Du(T))return Az(u.type)&&!b?1:.5}return(l==null?void 0:l.fieldChannel)===e&&b?.5:void 0}function YF(e,t,r,u,l,d){return!!(Du(t.bin)||t.timeUnit&&Cg(t)&&t.type==="temporal")&&!!xC({channel:e,fieldDef:t,fieldDef2:r,stack:u,markDef:l,config:d})}function XF(e){return!!e&&"condition"in e}function X3(e){const t=e&&e.condition;return!!t&&!mo(t)&&Si(t)}function JF(e){const t=e&&e.condition;return!!t&&!mo(t)&&ta(t)}function Si(e){return!(!e||!e.field&&e.aggregate!=="count")}function cx(e){return e&&e.type}function lx(e){return!!e&&"datum"in e}function Yy(e){return Cg(e)&&CU(e)||QF(e)}function QF(e){return lx(e)&&fl(e.datum)}function ta(e){return Si(e)||lx(e)}function Cg(e){return!!e&&("field"in e&&"type"in e||e.aggregate==="count")}function Y1(e){return e&&"value"in e&&"value"in e}function ZF(e){return!!e&&("scale"in e||"sort"in e)}function eR(e){return e&&("axis"in e||"stack"in e||"impute"in e)}function _U(e){return!!e&&"legend"in e}function kU(e){return!!e&&("format"in e||"formatType"in e)}function bi(e,t={}){var r,u,l;let d=e.field;const b=t.prefix;let k=t.suffix,T="";if(function(j){return j.aggregate==="count"}(e))d=function(j){return function($){return $.indexOf("__")===0}(j)?j:`__${j}`}("count");else{let j;if(!t.nofn)if(function($){return"op"in $}(e))j=e.op;else{const{bin:$,aggregate:G,timeUnit:te}=e;Du($)?(j=Uz($),k=((r=t.binSuffix)!==null&&r!==void 0?r:"")+((u=t.suffix)!==null&&u!==void 0?u:"")):G?Mw(G)?(T=`["${d}"]`,d=`argmax_${G.argmax}`):Zb(G)?(T=`["${d}"]`,d=`argmin_${G.argmin}`):j=String(G):te&&(j=function(se){const he=np(se),{utc:ve}=he,Be=ao(he,["utc"]);return Be.unit?(ve?"utc":"")+di(Be).map(ze=>nc(`${ze==="unit"?"":`_${ze}_`}${Be[ze]}`)).join(""):(ve?"utc":"")+"timeunit"+di(Be).map(ze=>nc(`_${ze}_${Be[ze]}`)).join("")}(te),k=(!bo(["range","mid"],t.binSuffix)&&t.binSuffix||"")+((l=t.suffix)!==null&&l!==void 0?l:""))}j&&(d=d?`${j}_${d}`:j)}return k&&(d=`${d}_${k}`),b&&(d=`${b}_${d}`),t.forAs?bz(d):t.expr?function(j,$="datum"){return`${$}[${ns(Dw(j).join("."))}]`}(d,t.expr)+T:Qb(d)+T}function EU(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return Si(e)&&!!e.bin;case"temporal":return!1}
7838throw new Error(re.invalidFieldType(e.type))}function CU(e){return!EU(e)}const SU=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(r){const{aggregate:u,bin:l,timeUnit:d,field:b}=r;if(Mw(u))return`${b} for argmax(${u.argmax})`;if(Zb(u))return`${b} for argmin(${u.argmin})`;const k=np(d),T=u||(k==null?void 0:k.unit)||(k==null?void 0:k.maxbins)&&"timeunit"||Du(l)&&"bin";return T?T.toUpperCase()+"("+b+")":b}(e);default:return function(r,u){var l;const{field:d,bin:b,timeUnit:k,aggregate:T}=r;if(T==="count")return u.countTitle;if(Du(b))return`${d} (binned)`;if(k){const j=(l=np(k))===null||l===void 0?void 0:l.unit;if(j)return`${d} (${RF(j).join("-")})`}else if(T)return Mw(T)?`${d} for max ${T.argmax}`:Zb(T)?`${d} for min ${T.argmin}`:`${A3(T)} of ${d}`;return d}(e,t)}};let AU=SU;function OU(e){AU=e}function zw(e,t,{allowDisabling:r,includeDefault:u=!0}){var l,d;const b=((l=tR(e))!==null&&l!==void 0?l:{}).title;if(!Si(e))return b;const k=e,T=u?DU(k,t):void 0;return r?dl(b,k.title,T):(d=b??k.title)!==null&&d!==void 0?d:T}function tR(e){return eR(e)&&e.axis?e.axis:_U(e)&&e.legend?e.legend:KF(e)&&e.header?e.header:void 0}function DU(e,t){return AU(e,t)}function J3(e){var t;if(kU(e)){const{format:r,formatType:u}=e;return{format:r,formatType:u}}{const r=(t=tR(e))!==null&&t!==void 0?t:{},{format:u,formatType:l}=r;return{format:u,formatType:l}}}function Xy(e){return Si(e)?e:X3(e)?e.condition:void 0}function Bl(e){return ta(e)?e:JF(e)?e.condition:void 0}function nR(e,t,r){if(Ca(e)||fl(e)||aC(e)){const u=Ca(e)?"string":fl(e)?"number":"boolean";return li(re.primitiveChannelDef(t,u,e)),{value:e}}return ta(e)?Q3(e,t,r):JF(e)?Object.assign(Object.assign({},e),{condition:Q3(e.condition,t,r)}):e}function Q3(e,t,r){if(kU(e)){const{format:u,formatType:l}=e,d=ao(e,["format","formatType"]);if(Lw(l)&&!r.customFormatTypes)return li(re.customFormatTypeNotAllowed(t)),Q3(d,t,r)}else{const u=eR(e)?"axis":_U(e)?"legend":KF(e)?"header":null;if(u&&e[u]){const l=e[u],{format:d,formatType:b}=l,k=ao(l,["format","formatType"]);if(Lw(b)&&!r.customFormatTypes)return li(re.customFormatTypeNotAllowed(t)),Q3(Object.assign(Object.assign({},e),{[u]:k}),t,r)}}return Si(e)?TU(e,t):function(u){let l=u.type;if(l)return u;const{datum:d}=u;return l=fl(d)?"quantitative":Ca(d)?"nominal":E_(d)?"temporal":void 0,Object.assign(Object.assign({},u),{type:l})}(e)}function TU(e,t){const{aggregate:r,timeUnit:u,bin:l,field:d}=e,b=Object.assign({},e);if(!r||AF(r)||Mw(r)||Zb(r)||(li(re.invalidAggregate(r)),delete b.aggregate),u&&(b.timeUnit=np(u)),d&&(b.field=`${d}`),Du(l)&&(b.bin=Z3(l,t)),tp(l)&&!qy(t)&&li(`Channel ${t} should not be used with "binned" bin.`),Cg(b)){const{type:k}=b,T=function(j){if(j)switch(j=j.toLowerCase()){case"q":case Pw:return"quantitative";case"t":case S_:return"temporal";case"o":case UF:return"ordinal";case"n":case WF:return"nominal";case A_:return"geojson"}}(k);k!==T&&(b.type=T),k!=="quantitative"&&Tz(r)&&(li(re.invalidFieldTypeForCountAggregate(k,r)),b.type="quantitative")}else if(!Pz(t)){const k=function(T,j){if(T.timeUnit)return"temporal";if(Du(T.bin))return"quantitative";switch(W3(j)){case"continuous":return"quantitative";case"discrete":case"flexible":return"nominal";default:return"quantitative"}}(b,t);li(re.missingFieldType(t,k)),b.type=k}if(Cg(b)){const{compatible:k,warning:T}=function(j,$){const G=j.type;if(G==="geojson"&&$!=="shape")return{compatible:!1,warning:`Channel ${$} should not be used with a geojson data.`};switch($){case V1:case $1:case R3:return CU(j)?{compatible:!1,warning:re.facetChannelShouldBeDiscrete($)}:Uw;case pc:case Rl:case mm:case Wy:case Vy:case hC:case mC:case B3:case Rw:case P3:case j3:case Fw:case wv:case Ly:case L3:return Uw;case Uy:case b0:case zy:case _v:return G!==Pw?{compatible:!1,warning:`Channel ${$} should be used with a quantitative field only, not ${j.type} field.`}:Uw;case K1:case ex:case tx:case nx:case G1:case q1:case H1:case xv:case jy:return G!=="nominal"||j.sort?Uw:{compatible:!1,warning:`Channel ${$} should not be used with an unsorted discrete field.`};case rx:return bo(["ordinal","nominal"],j.type)?Uw:{compatible:!1,warning:"StrokeDash channel should be used with only discrete data."};case gm:return bo(["ordinal","nominal","geojson"],j.type)?Uw:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case pC:return j.type!=="nominal"||"sort"in j?Uw:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(b,t);k||li(T)}if(wU(b)&&Ca(b.sort)){const{sort:k}=b;if(vU(k))return Object.assign(Object.assign({},b),{sort:{encoding:k}});const T=k.substr(1);if(k.charAt(0)==="-"&&vU(T))return Object.assign(Object.assign({},b),{sort:{encoding:T,order:"descending"}})}if(KF(b)){const{header:k}=b,{orient:T}=k,j=ao(k,["orient"]);if(T)return Object.assign(Object.assign({},b),{header:Object.assign(Object.assign({},j),{labelOrient:k.labelOrient||T,titleOrient:k.titleOrient||T})})}return b}function Z3(e,t){return aC(e)?{maxbins:Wz(t)}:e==="binned"?{binned:!0}:e.maxbins||e.step?e:Object.assign(Object.assign({},e),{maxbins:Wz(t)})}const Uw={compatible:!0};function eD(e){const{formatType:t}=J3(e);return t==="time"||!t&&function(r){return r&&(r.type==="temporal"||Si(r)&&!!r.timeUnit)}(e)}function rR(e,{timeUnit:t,type:r,wrapTime:u,undefinedIfExprNotRequired:l}){var d;const b=t&&((d=np(t))===null||d===void 0?void 0:d.unit);let k,T=b||r==="temporal";return Uo(e)?k=e.signal:E_(e)?(T=!0,k=vC(e)):(Ca(e)||fl(e))&&T&&(k=`datetime(${JSON.stringify(e)})`,function(j){return!!qz[j]}(b)&&(fl(e)&&e<1e4||Ca(e)&&isNaN(Date.parse(e)))&&(k=vC({[b]:e}))),k?u&&T?`time(${k})`:k:l?void 0:JSON.stringify(e)}function NU(e,t){const{type:r}=e;return t.map(u=>{const l=rR(u,{timeUnit:Si(e)?e.timeUnit:void 0,type:r,undefinedIfExprNotRequired:!0});return l!==void 0?{signal:l}:u})}function wC(e,t){return Du(e.bin)?ax(t)&&bo(["ordinal","nominal"],e.type):(console.warn("Only call this method for binned field defs."),!1)}function IU(e){const{anchor:t,frame:r,offset:u,orient:l,color:d,subtitleColor:b,subtitleFont:k,subtitleFontSize:T,subtitleFontStyle:j,subtitleFontWeight:$,subtitleLineHeight:G,subtitlePadding:te}=e,se=ao(e,["anchor","frame","offset","orient","color","subtitleColor","subtitleFont","subtitleFontSize","subtitleFontStyle","subtitleFontWeight","subtitleLineHeight","subtitlePadding"]),he=Object.assign(Object.assign({},se),d?{fill:d}:{}),ve=Object.assign(Object.assign(Object.assign(Object.assign({}
7838,t?{anchor:t}:{}),r?{frame:r}:{}),u?{offset:u}:{}),l?{orient:l}:{}),Be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},b?{subtitleColor:b}:{}),k?{subtitleFont:k}:{}),T?{subtitleFontSize:T}:{}),j?{subtitleFontStyle:j}:{}),$?{subtitleFontWeight:$}:{}),G?{subtitleLineHeight:G}:{}),te?{subtitlePadding:te}:{});return{titleMarkConfig:he,subtitleMarkConfig:cC(he,["align","baseline","dx","dy","limit"]),nonMark:ve,subtitle:Be}}function fx(e){return Ca(e)||mo(e)&&Ca(e[0])}function Gc(e){return Uo(e)?e:e!==void 0?{value:e}:void 0}function MU(e){return Uo(e)?e.signal:ns(e.value)}function _C(e){return Uo(e)?e.signal:e==null?null:ns(e)}function FU(e){var t;return[].concat(e.type,(t=e.style)!==null&&t!==void 0?t:[])}function Ns(e,t,r,u={}){const{vgChannel:l,ignoreVgConfig:d}=u;return l&&t[l]!==void 0?t[l]:t[e]!==void 0?t[e]:!d||l&&l!==e?Ww(e,t,r,u):void 0}function Ww(e,t,r,{vgChannel:u}={}){return dl(u?tD(e,t,r.style):void 0,tD(e,t,r.style),u?r[t.type][u]:void 0,r[t.type][e],u?r.mark[u]:r.mark[e])}function tD(e,t,r){return RU(e,FU(t),r)}function RU(e,t,r){let u;t=qc(t);for(const l of t){const d=r[l];d&&d[e]!==void 0&&(u=d[e])}return u}function BU(e,t){return qc(e).reduce((r,u)=>{var l;return r.field.push(bi(u,t)),r.order.push((l=u.sort)!==null&&l!==void 0?l:"ascending"),r},{field:[],order:[]})}function PU(e,t){const r=[...e];return t.forEach(u=>{for(const l of r)if(uC(l,u))return;r.push(u)}),r}function jU(e,t){return uC(e,t)||!t?e:e?[...qc(e),...qc(t)].join(", "):t}function LU(e,t){const r=e.value,u=t.value;if(r==null||u===null)return{explicit:e.explicit,value:null};if((fx(r)||Uo(r))&&(fx(u)||Uo(u)))return{explicit:e.explicit,value:jU(r,u)};if(fx(r)||Uo(r))return{explicit:e.explicit,value:r};if(fx(u)||Uo(u))return{explicit:e.explicit,value:u};if(!(fx(r)||Uo(r)||fx(u)||Uo(u)))return{explicit:e.explicit,value:PU(r,u)};throw new Error("It should never reach here")}function Vw(e,t){const r=e&&e[t];return!!r&&(mo(r)?lC(r,u=>!!u.field):Si(r)||X3(r))}function iR(e){return lC(Rz,t=>{if(Vw(e,t)){const r=e[t];if(mo(r))return lC(r,u=>!!u.aggregate);{const u=Xy(r);return u&&!!u.aggregate}}return!1})}function oR(e,t){const r=[],u=[],l=[],d=[],b={};return aR(e,(k,T)=>{if(Si(k)){const{field:j,aggregate:$,bin:G,timeUnit:te}=k,se=ao(k,["field","aggregate","bin","timeUnit"]);if($||te||G){const he=tR(k),ve=he&&he.title;let Be=bi(k,{forAs:!0});const ze=Object.assign(Object.assign(Object.assign({},ve?[]:{title:zw(k,t,{allowDisabling:!0})}),se),{field:Be});if($){let Ue;if(Mw($)?(Ue="argmax",Be=bi({op:"argmax",field:$.argmax},{forAs:!0}),ze.field=`${Be}.${j}`):Zb($)?(Ue="argmin",Be=bi({op:"argmin",field:$.argmin},{forAs:!0}),ze.field=`${Be}.${j}`):$!=="boxplot"&&$!=="errorbar"&&$!=="errorband"&&(Ue=$),Ue){const st={op:Ue,as:Be};j&&(st.field=j),d.push(st)}}else if(r.push(Be),Cg(k)&&Du(G)){if(u.push({bin:G,field:j,as:Be}),r.push(bi(k,{binSuffix:"end"})),wC(k,T)&&r.push(bi(k,{binSuffix:"range"})),qy(T)){const Ue={field:Be+"_end"};b[T+"2"]=Ue}ze.bin="binned",Pz(T)||(ze.type=Pw)}else if(te){l.push({timeUnit:te,field:j,as:Be});const Ue=Cg(k)&&k.type!==S_&&"time";Ue&&(T===hC||T===Rw?ze.formatType=Ue:function(st){return!!TF[st]}(T)?ze.legend=Object.assign({formatType:Ue},ze.legend):qy(T)&&(ze.axis=Object.assign({formatType:Ue},ze.axis)))}b[T]=ze}else r.push(j),b[T]=e[T]}else b[T]=e[T]}),{bins:u,timeUnits:l,aggregate:d,groupby:r,encoding:b}}function use(e,t,r){const u=t.type;return di(e).reduce((l,d)=>{if(!Bz(d))return li(re.invalidEncodingChannel(d)),l;const b=e[d];if(d!=="angle"||u!=="arc"||e.theta||(li(re.REPLACE_ANGLE_WITH_THETA),d=wv),!function(k,T,j){const $=yoe(T,j);if(!$)return!1;if($==="binned"){const G=k[T===xv?pc:Rl];return!!(Si(G)&&Si(k[T])&&tp(G.bin))}return!0}(e,d,u))return li(re.incompatibleChannel(d,u)),l;if(d===G1&&u==="line"){const k=Xy(e[d]);if(k!=null&&k.aggregate)return li(re.LINE_WITH_VARYING_SIZE),l}if(d===mm&&(t.filled?"fill"in e:"stroke"in e))return li(re.droppingColor("encoding",{fill:"fill"in e,stroke:"stroke"in e})),l;if(d===mC||d===pC&&!mo(b)&&!Y1(b)||d===Rw&&mo(b))b&&(l[d]=qc(b).reduce((k,T)=>(Si(T)?k.push(TU(T,d)):li(re.emptyFieldDef(T,d)),k),[]));else{if(d===Rw&&b===null)l[d]=null;else if(!(Si(b)||lx(b)||Y1(b)||XF(b)||Uo(b)))return li(re.emptyFieldDef(b,d)),l;l[d]=nR(b,d,r)}return l},{})}function aR(e,t,r){if(e)for(const u of di(e)){const l=e[u];if(mo(l))for(const d of l)t.call(r,d,u);else t.call(r,l,u)}}function zU(e,t,r,u){return e?di(e).reduce((l,d)=>{const b=e[d];return mo(b)?b.reduce((k,T)=>t.call(u,k,T,d),l):t.call(u,l,b,d)},r):r}function UU(e,t){return di(t).reduce((r,u)=>
7838{switch(u){case pc:case Rl:case P3:case L3:case j3:case xv:case jy:case wv:case q1:case Ly:case H1:case zy:case Uy:case _v:case b0:case hC:case gm:case Fw:case Rw:return r;case pC:if(e==="line"||e==="trail")return r;case mC:case B3:{const l=t[u];if(mo(l)||Si(l))for(const d of qc(l))d.aggregate||r.push(bi(d,{}));return r}case G1:if(e==="trail")return r;case mm:case Wy:case Vy:case K1:case ex:case tx:case rx:case nx:{const l=Xy(t[u]);return l&&!l.aggregate&&r.push(bi(l,{})),r}}},[])}function sR(e,t,r,u=!0){return"tooltip"in r?{tooltip:r.tooltip}:{tooltip:[...e.map(({fieldPrefix:l,titlePrefix:d})=>{const b=u?` of ${t.field}`:"";return{field:l+t.field,type:t.type,title:Uo(d)?{signal:d+`"${escape(b)}"`}:d+b}}),...function(l){const d=[];for(const b of di(l))if(Vw(l,b)){const k=l[b],T=qc(k);for(const j of T)Si(j)?d.push(j):X3(j)&&d.push(j.condition)}return d}(r)]}}function WU(e){const{axis:t,title:r,field:u}=e;return t&&t.title!==void 0?void 0:dl(r,u)}function uR(e,t,r,u,l){const{scale:d,axis:b}=r;return({partName:k,mark:T,positionPrefix:j,endPositionPrefix:$,aria:G,extraEncoding:te={}})=>{const se=WU(r);return VU(e,k,l,G,{mark:T,encoding:Object.assign(Object.assign(Object.assign({[t]:Object.assign(Object.assign(Object.assign({field:j+"_"+r.field,type:r.type},se!==void 0?{title:se}:{}),d!==void 0?{scale:d}:{}),b!==void 0?{axis:b}:{})},Ca($)?{[t+"2"]:{field:$+"_"+r.field}}:{}),u),te)})}}function VU(e,t,r,u,l){const{clip:d,color:b,opacity:k}=e,T=e.type;return e[t]||e[t]===void 0&&r[t]?[Object.assign(Object.assign({},l),{mark:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r[t]),d?{clip:d}:{}),b?{color:b}:{}),k?{opacity:k}:{}),Py(l.mark)?l.mark:{type:l.mark}),{style:`${T}-${t}`}),aC(e[t])?{}:e[t]),u===!1?{aria:u}:{})})]:[]}function $U(e,t,r){const{encoding:u}=e,l=t==="vertical"?"y":"x",d=u[l],b=u[l+"2"],k=u[l+"Error"],T=u[l+"Error2"];return{continuousAxisChannelDef:nD(d,r),continuousAxisChannelDef2:nD(b,r),continuousAxisChannelDefError:nD(k,r),continuousAxisChannelDefError2:nD(T,r),continuousAxis:l}}function nD(e,t){if(e&&e.aggregate){const{aggregate:r}=e,u=ao(e,["aggregate"]);return r!==t&&li(re.errorBarContinuousAxisHasCustomizedAggregate(r,t)),u}return e}function HU(e,t){const{mark:r,encoding:u}=e,{x:l,y:d}=u;if(Yy(l)){if(Yy(d)){const b=Si(l)&&l.aggregate,k=Si(d)&&d.aggregate;if(b||k!==t){if(k||b!==t){if(b===t&&k===t)throw new Error("Both x and y cannot have aggregate");return Py(r)&&r.orient?r.orient:"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(Yy(d))return"vertical";throw new Error("Need a valid continuous axis for "+t+"s")}const rD="boxplot",cse=new F3(rD,GU);function qU(e){return fl(e)?"tukey":e}function GU(e,{config:t}){var r,u;const{mark:l,encoding:d,selection:b,projection:k}=e,T=ao(e,["mark","encoding","selection","projection"]),j=Py(l)?l:{type:l};b&&li(re.selectionNotSupported("boxplot"));const $=(r=j.extent)!==null&&r!==void 0?r:t.boxplot.extent,G=Ns("size",j,t),te=qU($),{transform:se,continuousAxisChannelDef:he,continuousAxis:ve,groupby:Be,aggregate:ze,encodingWithoutContinuousAxis:Ue,ticksOrient:st,boxOrient:ut,customTooltipWithoutAggregatedField:mt}=function(Lr,hi,Ri){const Pi=HU(Lr,rD),{continuousAxisChannelDef:so,continuousAxis:Ui}=$U(Lr,Pi,rD),ji=so.field,Yi=qU(hi),Go=[...KU(ji),{op:"median",field:ji,as:"mid_box_"+ji},{op:"min",field:ji,as:(Yi==="min-max"?"lower_whisker_":"min_")+ji},{op:"max",field:ji,as:(Yi==="min-max"?"upper_whisker_":"max_")+ji}],Ra=Yi==="min-max"||Yi==="tukey"?[]:[{calculate:`datum["upper_box_${ji}"] - datum["lower_box_${ji}"]`,as:"iqr_"+ji},{calculate:`min(datum["upper_box_${ji}"] + datum["iqr_${ji}"] * ${hi}, datum["max_${ji}"])`,as:"upper_whisker_"+ji},{calculate:`max(datum["lower_box_${ji}"] - datum["iqr_${ji}"] * ${hi}, datum["min_${ji}"])`,as:"lower_whisker_"+ji}],uo=Lr.encoding,rs=Ui,is=(uo[rs],ao(uo,[typeof rs=="symbol"?rs:rs+""])),{customTooltipWithoutAggregatedField:Is,filteredEncoding:Tu}=function(U_){const{tooltip:ib}=U_,W_=ao(U_,["tooltip"]);if(!ib)return{filteredEncoding:U_};let bx,ip;if(mo(ib)){for(const m5 of ib)m5.aggregate?(bx||(bx=[]),bx.push(m5)):(ip||(ip=[]),ip.push(m5));bx&&(W_.tooltip=bx)}else ib.aggregate?W_.tooltip=ib:ip=ib;return mo(ip)&&ip.length===1&&(ip=ip[0]),{customTooltipWithoutAggregatedField:ip,filteredEncoding:W_}}(is),{bins:Nu,timeUnits:uu,aggregate:Xf,groupby:VD,encoding:p5}=oR(Tu,Ri);return{transform:[...Nu,...uu,{aggregate:[...Xf,...Go],groupby:VD},...Ra],groupby:VD,aggregate:Xf,continuousAxisChannelDef:so,continuousAxis:Ui,encodingWithoutContinuousAxis:
7838p5,ticksOrient:Pi==="vertical"?"horizontal":"vertical",boxOrient:Pi,customTooltipWithoutAggregatedField:Is}}(e,$,t),{color:pt,size:Ct}=Ue,Et=ao(Ue,["color","size"]),mn=Lr=>uR(j,ve,he,Lr,t.boxplot),An=mn(Et),xn=mn(Ue),Wn=mn(Object.assign(Object.assign({},Et),Ct?{size:Ct}:{})),Un=sR([{fieldPrefix:te==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:te==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],he,Ue),Kn={type:"tick",color:"black",opacity:1,orient:st,invalid:null},Qn=te==="min-max"?Un:sR([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],he,Ue),ir=[...An({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",aria:!1,extraEncoding:Qn}),...An({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",aria:!1,extraEncoding:Qn}),...An({partName:"ticks",mark:Kn,positionPrefix:"lower_whisker",aria:!1,extraEncoding:Qn}),...An({partName:"ticks",mark:Kn,positionPrefix:"upper_whisker",aria:!1,extraEncoding:Qn})],Nr=[...te!=="tukey"?ir:[],...xn({partName:"box",mark:Object.assign(Object.assign({type:"bar"},G?{size:G}:{}),{orient:ut,invalid:null}),positionPrefix:"lower_box",endPositionPrefix:"upper_box",aria:!1,extraEncoding:Un}),...Wn({partName:"median",mark:Object.assign(Object.assign(Object.assign({type:"tick",invalid:null},ff(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{}),G?{size:G}:{}),{orient:st,ariaRoleDescription:"box"}),positionPrefix:"mid_box",extraEncoding:Un})];let Jr;if(te!=="min-max"){const Lr=`datum["lower_box_${he.field}"]`,hi=`datum["upper_box_${he.field}"]`,Ri=`(${hi} - ${Lr})`,Pi=`${Lr} - ${$} * ${Ri}`,so=`${hi} + ${$} * ${Ri}`,Ui=`datum["${he.field}"]`,ji={joinaggregate:KU(he.field),groupby:Be};let Yi;te==="tukey"&&(Yi={transform:[{filter:`(${Pi} <= ${Ui}) && (${Ui} <= ${so})`},{aggregate:[{op:"min",field:he.field,as:"lower_whisker_"+he.field},{op:"max",field:he.field,as:"upper_whisker_"+he.field},{op:"min",field:"lower_box_"+he.field,as:"lower_box_"+he.field},{op:"max",field:"upper_box_"+he.field,as:"upper_box_"+he.field},...ze],groupby:Be}],layer:ir});const Go=ao(Et,["tooltip"]),{scale:Ra,axis:uo}=he,rs=WU(he),is=VU(j,"outliers",t.boxplot,!0,{transform:[{filter:`(${Ui} < ${Pi}) || (${Ui} > ${so})`}],mark:"point",encoding:Object.assign(Object.assign({[ve]:Object.assign(Object.assign(Object.assign({field:he.field,type:he.type},rs!==void 0?{title:rs}:{}),Ra!==void 0?{scale:Ra}:{}),uo!==void 0?{axis:uo}:{})},Go),mt?{tooltip:mt}:{})})[0];is&&Yi?Jr={transform:[ji],layer:[is,Yi]}:is?(Jr=is).transform.unshift(ji):Yi&&(Jr=Yi).transform.unshift(ji)}return Jr?Object.assign(Object.assign({},T),{layer:[Jr,{transform:se,layer:Nr}]}):Object.assign(Object.assign({},T),{transform:((u=T.transform)!==null&&u!==void 0?u:[]).concat(se),layer:Nr})}function KU(e){return[{op:"q1",field:e,as:"lower_box_"+e},{op:"q3",field:e,as:"upper_box_"+e}]}const cR="errorbar",lse=new F3(cR,YU);function YU(e,{config:t}){const{transform:r,continuousAxisChannelDef:u,continuousAxis:l,encodingWithoutContinuousAxis:d,ticksOrient:b,markDef:k,outerSpec:T,tooltipEncoding:j}=XU(e,cR,t),$=uR(k,l,u,d,t.errorbar),G={type:"tick",orient:b},te=[...$({partName:"ticks",mark:G,positionPrefix:"lower",aria:!1,extraEncoding:j}),...$({partName:"ticks",mark:G,positionPrefix:"upper",aria:!1,extraEncoding:j}),...$({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar"},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:j})];return Object.assign(Object.assign(Object.assign({},T),{transform:r}),te.length>1?{layer:te}:Object.assign({},te[0]))}function fse(e,t){const{encoding:r}=e;if(function(k){return(ta(k.x)||ta(k.y))&&!ta(k.x2)&&!ta(k.y2)&&!ta(k.xError)&&!ta(k.xError2)&&!ta(k.yError)&&!ta(k.yError2)}(r))return{orient:HU(e,t),inputType:"raw"};const u=function(k){return ta(k.x2)||ta(k.y2)}(r),l=function(k){return ta(k.xError)||ta(k.xError2)||ta(k.yError)||ta(k.yError2)}(r),d=r.x,b=r.y;if(u){if(l)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const k=r.x2,T=r.y2;if(ta(k)&&ta(T))throw new Error(`${t} cannot have both x2 and y2`);if(ta(k)){if(Yy(d))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(ta(T)){if(Yy(b))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}{const k=r.xError,T=r.xError2,j=r.yError,$=r.yError2;if(ta(T)&&!ta(k))throw new Error(`${t} cannot have xError2 without xError`);if(ta($)&&!ta(j))throw new Error(`${t} cannot have yError2 without yError`);if(ta(k)&&ta(j))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(ta(k)){if(Yy(d))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(ta(j)){if(Yy(b))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function XU(e,t,r){var u;const{mark:l,encoding:d,selection:b,projection:k}=e,T=ao(e,["mark","encoding","selection","projection"]),j=Py(l)?l:{type:l};b&&li(re.selectionNotSupported(t));const{orient:$,inputType:G}=fse(e,t),{continuousAxisChannelDef:te,continuousAxisChannelDef2:se,continuousAxisChannelDefError:he,continuousAxisChannelDefError2:ve,continuousAxis:Be}=$U(e,$,t),{errorBarSpecificAggregate:ze,postAggregateCalculates:Ue,tooltipSummary:st,tooltipTitleWithFieldName:ut}=function(Lr,hi,Ri,Pi,so,Ui,ji,Yi){let Go=[],Ra=[];const uo=hi.field;let rs,is=!1;if(Ui==="raw"){const Is=Lr.center?Lr.center:Lr.extent?Lr.extent==="iqr"?"median":"mean":Yi.errorbar.center,Tu=Lr.extent?Lr.extent:Is==="mean"?"stderr":"iqr";if(Is==="median"!=(Tu==="iqr")&&li(re.errorBarCenterIsUsedWithWrongExtent(Is,Tu,ji)),Tu==="stderr"||Tu==="stdev")Go=[{op:Tu,field:uo,as:"extent_"+uo},{op:Is,field:uo,as:"center_"+uo}],Ra=[{calculate:`datum["center_${uo}"] + datum["extent_${uo}"]`,as:"upper_"+uo},{calculate:`datum["center_${uo}"] - datum["extent_${uo}"]`,as:"lower_"+uo}],rs=[{fieldPrefix:"center_",titlePrefix:A3(Is)},{fieldPrefix:"upper_",titlePrefix:JU(Is,Tu,"+")},{fieldPrefix:"lower_",titlePrefix:JU(Is,Tu,"-")}],is=!0;else{let Nu,uu,Xf;Lr.center&&Lr.extent&&li(re.errorBarCenterIsNotNeeded(Lr.extent,ji)),Tu==="ci"?(Nu="mean",uu="ci0",Xf="ci1"):(Nu="median",uu="q1",Xf="q3"),Go=[{op:uu,field:uo,as:"lower_"+uo},{op:Xf,field:uo,as:"upper_"+uo},{op:Nu,field:uo,as:"center_"+uo}],rs=[{fieldPrefix:"upper_",titlePrefix:zw({field:uo,aggregate:Xf,type:"quantitative"},Yi,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:zw({field:uo,aggregate:uu,type:"quantitative"},Yi,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:zw({field:uo,aggregate:Nu,type:"quantitative"},Yi,{allowDisabling:!1})}]}}else{(Lr.center||Lr.extent)&&li(re.errorBarCenterAndExtentAreNotNeeded(Lr.center,Lr.extent)),Ui==="aggregated-upper-lower"?(rs=[],Ra=[{calculate:`datum["${Ri.field}"]`,as:"upper_"+uo},{calculate:`datum["${uo}"]`,as:"lower_"+uo}]):Ui==="aggregated-error"&&(rs=[{fieldPrefix:"",titlePrefix:uo}],Ra=[{calculate:`datum["${uo}"] + datum["${Pi.field}"]`,as:"upper_"+uo}],so?Ra.push({calculate:`datum["${uo}"] + datum["${so.field}"]`,as:"lower_"+uo}
7838):Ra.push({calculate:`datum["${uo}"] - datum["${Pi.field}"]`,as:"lower_"+uo}));for(const Is of Ra)rs.push({fieldPrefix:Is.as.substring(0,6),titlePrefix:__(__(Is.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:Ra,errorBarSpecificAggregate:Go,tooltipSummary:rs,tooltipTitleWithFieldName:is}}(j,te,se,he,ve,G,t,r),mt=d,pt=Be,Ct=(mt[pt],Be==="x"?"x2":"y2"),Et=(mt[Ct],Be==="x"?"xError":"yError"),mn=(mt[Et],Be==="x"?"xError2":"yError2"),An=(mt[mn],ao(mt,[typeof pt=="symbol"?pt:pt+"",typeof Ct=="symbol"?Ct:Ct+"",typeof Et=="symbol"?Et:Et+"",typeof mn=="symbol"?mn:mn+""])),{bins:xn,timeUnits:Wn,aggregate:Un,groupby:Kn,encoding:Qn}=oR(An,r),ir=[...Un,...ze],Nr=G!=="raw"?[]:Kn,Jr=sR(st,te,Qn,ut);return{transform:[...(u=T.transform)!==null&&u!==void 0?u:[],...xn,...Wn,...ir.length===0?[]:[{aggregate:ir,groupby:Nr}],...Ue],groupby:Nr,continuousAxisChannelDef:te,continuousAxis:Be,encodingWithoutContinuousAxis:Qn,ticksOrient:$==="vertical"?"horizontal":"vertical",markDef:j,outerSpec:T,tooltipEncoding:Jr}}function JU(e,t,r){return A3(e)+" "+r+" "+t}const lR="errorband",dse=new F3(lR,QU);function QU(e,{config:t}){const{transform:r,continuousAxisChannelDef:u,continuousAxis:l,encodingWithoutContinuousAxis:d,markDef:b,outerSpec:k,tooltipEncoding:T}=XU(e,lR,t),j=b,$=uR(j,l,u,d,t.errorband),G=e.encoding.x!==void 0&&e.encoding.y!==void 0;let te={type:G?"area":"rect"},se={type:G?"line":"rule"};const he=Object.assign(Object.assign({},j.interpolate?{interpolate:j.interpolate}:{}),j.tension&&j.interpolate?{tension:j.tension}:{});return G?(te=Object.assign(Object.assign(Object.assign({},te),he),{ariaRoleDescription:"errorband"}),se=Object.assign(Object.assign({},se),he)):j.interpolate?li(re.errorBand1DNotSupport("interpolate")):j.tension&&li(re.errorBand1DNotSupport("tension")),Object.assign(Object.assign({},k),{transform:r,layer:[...$({partName:"band",mark:te,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:T}),...$({partName:"borders",mark:se,positionPrefix:"lower",aria:!1,extraEncoding:T}),...$({partName:"borders",mark:se,positionPrefix:"upper",aria:!1,extraEncoding:T})]})}const ZU={};function fR(e,t,r){const u=new F3(e,t);ZU[e]={normalizer:u,parts:r}}fR(rD,GU,["box","median","outliers","rule","ticks"]),fR(cR,YU,["ticks","rule"]),fR(lR,QU,["band","borders"]);const hse=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],eW=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],pse={fillColor:{part:"legend",vgProp:"fill"},gradientStrokeColor:{part:"gradient",vgProp:"stroke"},labelColor:{part:"labels",vgProp:"fill"},strokeColor:{part:"legend",vgProp:"stroke"},symbolFillColor:{part:"symbols",vgProp:"fill"},symbolStrokeColor:{part:"symbols",vgProp:"stroke"},titleColor:{part:"title",vgProp:"fill"}},mse={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},O_="_vgsid_",gse={single:{on:"click",fields:[O_],resolve:"global",empty:"all",clear:"dblclick"},multi:{on:"click",fields:[O_],toggle:"event.shiftKey",resolve:"global",empty:"all",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function dR(e){return!(!e||e!=="legend"&&!e.legend)}function hR(e){return dR(e)&&ff(e)}function pR(e){return"concat"in e}function iD(e){return"vconcat"in e}function mR(e){return"hconcat"in e}function Jy(e){return ff(e)&&e.step!==void 0}function tW(e){return e.view||e.width||e.height}const vse=di({align:1,bounds:1,center:1,columns:1,spacing:1});function gR(e,t){var r;return(r=e[t])!==null&&r!==void 0?r:e[t==="width"?"continuousWidth":"continuousHeight"]}function oD(e,t){const r=kC(e,t);return Jy(r)?r.step:vR}function kC(e,t){var r;return dl((r=e[t])!==null&&r!==void 0?r:e[t==="width"?"discreteWidth":"discreteHeight"],{step:e.step})}const vR=20,yse={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:vR},mark:{color:"#4c78a8",invalid:"filter",timeUnitBand:1},arc:{},area:{},bar:roe,circle:{},geoshape:{},image:{},line:{},point:{},rect:ioe,rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:gse,style:{},title:{},facet:{spacing:20},concat:{spacing:20}},X1=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],nW={text:11,guideL
7838abel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},rW={blue:X1[0],orange:X1[1],red:X1[2],teal:X1[3],green:X1[4],yellow:X1[5],purple:X1[6],pink:X1[7],brown:X1[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function iW(e={}){const{color:t,font:r,fontSize:u}=e,l=ao(e,["color","font","fontSize"]);return fz({},yse,r?function(d){return{text:{font:d},style:{"guide-label":{font:d},"guide-title":{font:d},"group-title":{font:d},"group-subtitle":{font:d}}}}(r):{},t?function(d={}){return{signals:[{name:"color",value:ff(d)?Object.assign(Object.assign({},rW),d):rW}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},u?function(d){return{signals:[{name:"fontSize",value:ff(d)?Object.assign(Object.assign({},nW),d):nW}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(u):{},l||{})}const bse=["view",...Oz],xse=["color","fontSize","background","padding","facet","concat","numberFormat","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],wse=Object.assign({view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"]},{area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]});function _se(e){e=Sa(e);for(const t of xse)delete e[t];if(e.axis)for(const t in e.axis)kF(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of hse)delete e.legend[t];if(e.mark){for(const t of Dz)delete e.mark[t];e.mark.tooltip&&ff(e.mark.tooltip)&&delete e.mark.tooltip}for(const t of bse){for(const u of Dz)delete e[t][u];const r=wse[t];if(r)for(const u of r)delete e[t][u];kse(e,t)}for(const t of di(ZU))delete e[t];(function(t){const{titleMarkConfig:r,subtitleMarkConfig:u,subtitle:l}=IU(t.title);su(r)||(t.style["group-title"]=Object.assign(Object.assign({},t.style["group-title"]),r)),su(u)||(t.style["group-subtitle"]=Object.assign(Object.assign({},t.style["group-subtitle"]),u)),su(l)?delete t.title:t.title=l})(e);for(const t in e)ff(e[t])&&su(e[t])&&delete e[t];return su(e)?void 0:e}function kse(e,t,r,u){const l=u?e[t][u]:e[t];t==="view"&&(r="cell");const d=Object.assign(Object.assign({},l),e.style[r??t]);su(d)||(e.style[r??t]=d),u||delete e[t]}function aD(e){return"layer"in e}class oW{map(t,r){return Y3(t)?this.mapFacet(t,r):function(u){return"repeat"in u}(t)?this.mapRepeat(t,r):mR(t)?this.mapHConcat(t,r):iD(t)?this.mapVConcat(t,r):pR(t)?this.mapConcat(t,r):this.mapLayerOrUnit(t,r)}mapLayerOrUnit(t,r){if(aD(t))return this.mapLayer(t,r);if(W1(t))return this.mapUnit(t,r);throw new Error(re.invalidSpec(t))}mapLayer(t,r){return Object.assign(Object.assign({},t),{layer:t.layer.map(u=>this.mapLayerOrUnit(u,r))})}mapHConcat(t,r){return Object.assign(Object.assign({},t),{hconcat:t.hconcat.map(u=>this.map(u,r))})}mapVConcat(t,r){return Object.assign(Object.assign({},t),{vconcat:t.vconcat.map(u=>this.map(u,r))})}mapConcat(t,r){const{concat:u}
7838=t,l=ao(t,["concat"]);return Object.assign(Object.assign({},l),{concat:u.map(d=>this.map(d,r))})}mapFacet(t,r){return Object.assign(Object.assign({},t),{spec:this.map(t.spec,r)})}mapRepeat(t,r){return Object.assign(Object.assign({},t),{spec:this.map(t.spec,r)})}}const Ese={zero:1,center:1,normalize:1},Cse=new Set([Ez,T3,D3,M3,I3,CF,SF,N3,Cz,EF]),Sse=new Set([T3,D3,Ez]);function aW(e,t){var r,u;const l=t==="x"?"y":"radius",d=e[t],b=e[l];if(Si(d)&&Si(b))if(cx(d)==="quantitative"&&cx(b)==="quantitative"){if(d.stack)return t;if(b.stack)return l;const k=Si(d)&&!!d.aggregate;if(k!==(Si(b)&&!!b.aggregate))return k?t:l;{const T=(r=d.scale)===null||r===void 0?void 0:r.type,j=(u=b.scale)===null||u===void 0?void 0:u.type;if(T&&T!=="linear")return l;if(j&&j!=="linear")return t}}else{if(cx(d)==="quantitative")return t;if(cx(b)==="quantitative")return l}else{if(cx(d)==="quantitative")return t;if(cx(b)==="quantitative")return l}}function sW(e,t,r={}){const u=Py(e)?e.type:e;if(!Cse.has(u))return null;const l=aW(t,"x")||aW(t,"theta");if(!l)return null;const d=t[l],b=Si(d)?bi(d,{}):void 0;let k=function(te){switch(te){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(l),T=t[k],j=Si(T)?bi(T,{}):void 0;j===b&&(j=void 0,T=void 0,k=void 0);const $=moe.reduce((te,se)=>{if(se!=="tooltip"&&Vw(t,se)){const he=t[se];for(const ve of qc(he)){const Be=Xy(ve);if(Be.aggregate)continue;const ze=bi(Be,{});ze&&ze===j||te.push({channel:se,fieldDef:Be})}}return te},[]);let G;if(d.stack!==void 0?G=aC(d.stack)?d.stack?"zero":null:d.stack:$.length>0&&Sse.has(u)&&(G="zero"),!G||!function(te){return te in Ese}(G)||iR(t)&&$.length===0)return null;if(d.scale&&d.scale.type&&d.scale.type!==hl.LINEAR){if(r.disallowNonLinearStack)return null;li(re.cannotStackNonLinearScale(d.scale.type))}return ta(t[$y(l)])?(d.stack!==void 0&&li(re.cannotStackRangedMark(l)),null):(Si(d)&&d.aggregate&&!bo(uoe,d.aggregate)&&li(re.stackNonSummativeAggregate(d.aggregate)),{groupbyChannel:T?k:void 0,groupbyField:j,fieldChannel:l,impute:d.impute!==null&&Iw(u),stackBy:$,offset:G})}function yR(e,t={},r){return e.point==="transparent"?{opacity:0}:e.point?ff(e.point)?e.point:{}:e.point!==void 0?null:t.point||r.shape?ff(t.point)?t.point:{}:void 0}function uW(e,t={}){return e.line?e.line===!0?{}:e.line:e.line!==void 0?null:t.line?t.line===!0?{}:t.line:void 0}class Ase{constructor(){this.name="path-overlay"}hasMatchingType(t,r){if(W1(t)){const{mark:u,encoding:l}=t,d=Py(u)?u:{type:u};switch(d.type){case"line":case"rule":case"trail":return!!yR(d,r[d.type],l);case"area":return!!yR(d,r[d.type],l)||!!uW(d,r[d.type])}}return!1}run(t,r,u){const{config:l}=r,{selection:d,projection:b,encoding:k,mark:T}=t,j=ao(t,["selection","projection","encoding","mark"]),$=Py(T)?T:{type:T},G=yR($,l[$.type],k),te=$.type==="area"&&uW($,l[$.type]),se=[Object.assign(Object.assign({},d?{selection:d}:{}),{mark:function(Be){const ze=ao(Be,["point","line"]);return di(ze).length>1?ze:ze.type}(Object.assign(Object.assign({},$.type==="area"&&$.opacity===void 0&&$.fillOpacity===void 0?{opacity:.7}:{}),$)),encoding:U1(k,["shape"])})],he=sW($,k);let ve=k;if(he){const{fieldChannel:Be,offset:ze}=he;ve=Object.assign(Object.assign({},k),{[Be]:Object.assign(Object.assign({},k[Be]),ze?{stack:ze}:{})})}return te&&se.push(Object.assign(Object.assign({},b?{projection:b}:{}),{mark:Object.assign(Object.assign({type:"line"},cC($,["clip","interpolate","tension","tooltip"])),te),encoding:ve})),G&&se.push(Object.assign(Object.assign({},b?{projection:b}:{}),{mark:Object.assign(Object.assign({type:"point",opacity:1,filled:!0},cC($,["clip","tooltip"])),G),encoding:ve})),u(Object.assign(Object.assign({},j),{layer:se}),Object.assign(Object.assign({},r),{config:function(Be){for(const ze of["line","area","rule","trail"])Be[ze]&&(Be=Object.assign(Object.assign({},Be),{[ze]:U1(Be[ze],["point","line"])}));return Be}(l)}))}}class Ose{constructor(){this.name="RangeStep"}hasMatchingType(t){var r;if(W1(t)&&t.encoding)for(const u of w0){const l=t.encoding[u];if(l&&ta(l)&&(!((r=l==null?void 0:l.scale)===null||r===void 0)&&r.rangeStep))return!0}return!1}run(t){var r;const u={};let l=Object.assign({},t.encoding);for(const d of w0){const b=Hy(d),k=l[d];if(k&&ta(k)&&(!((r=k==null?void 0:k.scale)===null||r===void 0)&&r.rangeStep)){const{scale:T}=k,j=ao(k,["scale"]),$=T,G=ao($,["rangeStep"]);u[b]={step:T.rangeStep},li(re.RANGE_STEP_DEPRECATED),l=Object.assign(Object.assign({},l),{[d]:Object.assign(Object.assign({},j),su(G)?{}:{scale:G})})}}return Object.assign(Object.assign(Object.assign({},u),t),{encoding:l})}}function bR(e,t){return t?dW(e,t):e}function xR(e,t,r){const u=t[e];return function(l){return l&&!Ca(l)&&"repeat"in l}(u)?u.repeat in r?Object.assign(Object.assign({},t),{[e]:r[u.repeat]}):void li(re.noSuchRepeatedValue(u.repeat)):t}function cW(e,t){if((e=xR("field",e,t))!==void 0){if(e===null)return null;if(wU(e)&&Ky(e.sort)){const r=xR("field",e.sort,t);e=Object.assign(Object.assign({},e),r?{sort:r}:{})}return e}}function lW(e,t){if(Si(e))return cW(e,t);{const r=xR("datum",e,t);return r===e||r.type||(r.type="nominal"),r}}
7838function fW(e,t){if(!ta(e)){if(JF(e)){const r=lW(e.condition,t);return r?Object.assign(Object.assign({},e),{condition:r}):ao(e,["condition"])}return e}{const r=lW(e,t);if(r)return r;if(XF(e))return{condition:e.condition}}}function dW(e,t){const r={};for(const u in e)if(Tw(e,u)){const l=e[u];if(mo(l))r[u]=l.map(d=>fW(d,t)).filter(d=>d);else{const d=fW(l,t);d!==void 0&&(r[u]=d)}}return r}class Dse{constructor(){this.name="RuleForRangedLine"}hasMatchingType(t){if(W1(t)){const{encoding:r,mark:u}=t;if(u==="line")for(const l of poe){const d=r[Bw(l)];if(r[l]&&(Si(d)&&!tp(d.bin)||lx(d)))return!0}}return!1}run(t,r,u){const{encoding:l}=t;return li(re.lineWithRange(!!l.x2,!!l.y2)),u(Object.assign(Object.assign({},t),{mark:"rule"}),r)}}function hW(e){const{parentEncoding:t,encoding:r}=e;if(t&&r){const l=di(t).reduce((d,b)=>(r[b]&&d.push(b),d),[]);l.length>0&&li(re.encodingOverridden(l))}const u=Object.assign(Object.assign({},t??{}),r??{});return su(u)?void 0:u}function pW(e){const{parentProjection:t,projection:r}=e;return t&&r&&li(re.projectionOverridden({parentProjection:t,projection:r})),r??t}function mW(e,t){t===void 0&&(t=iW(e.config));const r=function(b,k={}){return Tse.map(b,{config:k})}(e,t),{width:u,height:l}=e,d=function(b,k,T){let{width:j,height:$}=k;const G=W1(b)||aD(b),te={};G?j=="container"&&$=="container"?(te.type="fit",te.contains="padding"):j=="container"?(te.type="fit-x",te.contains="padding"):$=="container"&&(te.type="fit-y",te.contains="padding"):(j=="container"&&(li(re.containerSizeNonSingle("width")),j=void 0),$=="container"&&(li(re.containerSizeNonSingle("height")),$=void 0));const se=Object.assign(Object.assign(Object.assign({type:"pad"},te),T?gW(T.autosize):{}),gW(b.autosize));if(se.type!=="fit"||G||(li(re.FIT_NON_SINGLE),se.type="pad"),j=="container"&&se.type!="fit"&&se.type!="fit-x"&&li(re.containerSizeNotCompatibleWithAutosize("width")),$=="container"&&se.type!="fit"&&se.type!="fit-y"&&li(re.containerSizeNotCompatibleWithAutosize("height")),!uC(se,{type:"pad"}))return se}(r,{width:u,height:l,autosize:e.autosize},t);return Object.assign(Object.assign({},r),d?{autosize:d}:{})}const Tse=new class extends oW{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[cse,lse,dse,new Ase,new Dse,new Ose]}map(e,t){if(W1(e)){const r=Vw(e.encoding,V1),u=Vw(e.encoding,$1),l=Vw(e.encoding,R3);if(r||u||l)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:r,parentProjection:u}=t,l=Object.assign(Object.assign({},e),{encoding:bR(e.encoding,t.repeater)});if(r||u)return this.mapUnitWithParentEncodingOrProjection(l,t);const d=this.mapLayerOrUnit.bind(this);for(const b of this.nonFacetUnitNormalizers)if(b.hasMatchingType(l,t.config))return b.run(l,t,d);return l}mapRepeat(e,t){return function(r){return!mo(r.repeat)&&r.repeat.layer}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:r,spec:u}=e,l=ao(e,["repeat","spec"]),{row:d,column:b,layer:k}=r,{repeater:T={},repeaterPrefix:j=""}=t;return d||b?this.mapRepeat(Object.assign(Object.assign({},e),{repeat:Object.assign(Object.assign({},d?{row:d}:{}),b?{column:b}:{}),spec:{repeat:{layer:k},spec:u}}),t):Object.assign(Object.assign({},l),{layer:k.map($=>{const G=Object.assign(Object.assign({},T),{layer:$}),te=(u.name||"")+j+`child__layer_${nc($)}`,se=this.mapLayerOrUnit(u,Object.assign(Object.assign({},t),{repeater:G,repeaterPrefix:te}));return se.name=te,se})})}mapNonLayerRepeat(e,t){var r;const{repeat:u,spec:l,data:d}=e,b=ao(e,["repeat","spec","data"]);!mo(u)&&e.columns&&(e=U1(e,["columns"]),li(re.columnsNotSupportByRowCol("repeat")));const k=[],{repeater:T={},repeaterPrefix:j=""}=t,$=!mo(u)&&u.row||[T?T.row:null],G=!mo(u)&&u.column||[T?T.column:null],te=mo(u)&&u||[T?T.repeat:null];for(const he of te)for(const ve of $)for(const Be of G){const ze={repeat:he,row:ve,column:Be,layer:T.layer},Ue=(l.name||"")+j+"child__"+(mo(u)?`${nc(he)}`:(u.row?`row_${nc(ve)}`:"")+(u.column?`column_${nc(Be)}`:"")),st=this.map(l,Object.assign(Object.assign({},t),{repeater:ze,repeaterPrefix:Ue}));st.name=Ue,k.push(U1(st,["data"]))}const se=mo(u)?e.columns:u.column?u.column.length:1;return Object.assign(Object.assign({data:(r=l.data)!==null&&r!==void 0?r:d,align:"all"},b),{columns:se,concat:k})}mapFacet(e,t){const{facet:r}=e;return bC(r)&&e.columns&&(e=U1(e,["columns"]),li(re.columnsNotSupportByRowCol("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:r,projection:u}=e,{parentEncoding:l,parentProjection:d,config:b}=t,k=pW({parentProjection:d,projection:u}),T=hW({parentEncoding:l,encoding:bR(r,t.repeater)});return this.mapUnit(Object.assign(Object.assign(Object.assign({},e),k?{projection:k}:{}),T?{encoding:T}:{}),{config:b})}mapFacetedUnit(e,t){const r=e.encoding,{row:u,column:l,facet:d}=r,b=ao(r,["row","column","facet"]),{mark:k,width:T,projection:j,height:$,view:G,selection:te,encoding:se}=e,he=ao(e,["mark","width","projection","height","view","selection","encoding"]),{facetMapping:ve,layout:Be}=this.getFacetMappingAndLayout({row:u,column:l,facet:d},t),ze=bR(b,t.repeater);return this.mapFacet(Object.assign(Object.assign(Object.assign({},he),Be),{facet:ve,spec:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},T?{width:T}:{}),$?{height:$}:{}),G?{view:G}:{}),j?{projection:j}:{}),{mark:k,encoding:ze}),te?{selection:te}:{})}),t)}getFacetMappingAndLayout(e,t){var r;const{row:u,column:l,facet:d}=e;if(u||l){d&&li(re.facetChannelDropped([...u?[V1]:[],...l?[$1]:[]]));const b={},k={};for(const T of[V1,$1]){const j=e[T];if(j){const $=ao(j,["align","center","spacing","columns"]);b[T]=$;for(const G of["align","center","spacing"])j[G]!==void 0&&(k[G]=(r=k[G])!==null&&r!==void 0?r:{},k[G][T]=j[G])}}return{facetMapping:b,layout:k}}{const{align:b,center:k,spacing:T,columns:j}=d;return{facetMapping:function($,G){return G?bC($)?dW($,G):cW($,G):$}(ao(d,["align","center","spacing","columns"]),t.repeater),layout:Object.assign(Object.assign(Object.assign(Object.assign({},b?{align:b}:{}),k?{center:k}:{}),T?{spacing:T}:{}),j?{columns:j}:{})}}}mapLayer(e,t){var{parentEncoding:r,parentProjection:u}
7838=t,l=ao(t,["parentEncoding","parentProjection"]);const{encoding:d,projection:b}=e,k=ao(e,["encoding","projection"]),T=Object.assign(Object.assign({},l),{parentEncoding:hW({parentEncoding:r,encoding:d}),parentProjection:pW({parentProjection:u,projection:b})});return super.mapLayer(k,T)}};function gW(e){return Ca(e)?{type:e}:e??{}}const Nse=["background","padding"];function vW(e){return Nse.reduce((t,r)=>(e&&e[r]!==void 0&&(t[r]=e[r]),t),{})}class J1{constructor(t={},r={}){this.explicit=t,this.implicit=r}clone(){return new J1(Sa(this.explicit),Sa(this.implicit))}combine(){return Object.assign(Object.assign({},this.explicit),this.implicit)}get(t){return dl(this.explicit[t],this.implicit[t])}getWithExplicit(t){return this.explicit[t]!==void 0?{explicit:!0,value:this.explicit[t]}:this.implicit[t]!==void 0?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,r){r.value!==void 0&&this.set(t,r.value,r.explicit)}set(t,r,u){return delete this[u?"implicit":"explicit"][t],this[u?"explicit":"implicit"][t]=r,this}copyKeyFromSplit(t,r){r.explicit[t]!==void 0?this.set(t,r.explicit[t],!0):r.implicit[t]!==void 0&&this.set(t,r.implicit[t],!1)}copyKeyFromObject(t,r){r[t]!==void 0&&this.set(t,r[t],!0)}copyAll(t){for(const r of di(t.combine())){const u=t.getWithExplicit(r);this.setWithExplicit(r,u)}}}function $w(e){return{explicit:!0,value:e}}function Ev(e){return{explicit:!1,value:e}}function yW(e){return(t,r,u,l)=>{const d=e(t.value,r.value);return d>0?t:d<0?r:sD(t,r,u,l)}}function sD(e,t,r,u){return e.explicit&&t.explicit&&li(re.mergeConflictingProperty(r,u,e.value,t.value)),e}function dx(e,t,r,u,l=sD){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:uC(e.value,t.value)?e:l(e,t,r,u)}class Ise extends J1{constructor(t={},r={},u=!1){super(t,r),this.explicit=t,this.implicit=r,this.parseNothing=u}clone(){const t=super.clone();return t.parseNothing=this.parseNothing,t}}function EC(e){return"url"in e}function uD(e){return"values"in e}function bW(e){return"name"in e&&!EC(e)&&!uD(e)&&!Hw(e)}function Hw(e){return e&&(xW(e)||wW(e)||wR(e))}function xW(e){return"sequence"in e}function wW(e){return"sphere"in e}function wR(e){return"graticule"in e}const Vd="main",cD="raw";function _W(e){return"filter"in e}function Mse(e){return"lookup"in e}function Fse(e){return"pivot"in e}function Rse(e){return"density"in e}function Bse(e){return"quantile"in e}function Pse(e){return"regression"in e}function jse(e){return"loess"in e}function Lse(e){return"sample"in e}function zse(e){return"window"in e}function Use(e){return"joinaggregate"in e}function Wse(e){return"flatten"in e}function Vse(e){return"calculate"in e}function $se(e){return"bin"in e}function Hse(e){return"impute"in e}function qse(e){return"timeUnit"in e}function Gse(e){return"aggregate"in e}function Kse(e){return"stack"in e}function Yse(e){return"fold"in e}function Xse(e){return e.map(t=>_W(t)?{filter:function r(u,l){return xF(u)?{not:r(u.not,l)}:bF(u)?{and:u.and.map(d=>r(d,l))}:yF(u)?{or:u.or.map(d=>r(d,l))}:l(u)}(t.filter,qae)}:t)}function CC(e,t,r,u){const l=XF(t)&&t.condition,d=u(t);return l?{[r]:[...qc(l).map(b=>{const k=u(b),T=function(j){return j.selection}(b)?aV(e,b.selection):wD(e,b.test);return Object.assign({test:T},k)}),...d!==void 0?[d]:[]]}:d!==void 0?{[r]:d}:{}}function _R(e,t="text"){const r=e.encoding[t];return CC(e,r,t,u=>lD(u,e.config))}function lD(e,t,r="datum"){if(e){if(Y1(e))return Gc(e.value);if(ta(e)){const{format:u,formatType:l}=J3(e);return qF({fieldOrDatumDef:e,format:u,formatType:l,expr:r,config:t})}}}function kW(e,t={}){const{encoding:r,markDef:u,config:l,stack:d}=e,b=r.tooltip;if(mo(b))return{tooltip:CW({tooltip:b},d,l,t)};{const k=t.reactiveGeom?"datum.datum":"datum";return CC(e,b,"tooltip",T=>{const j=lD(T,l,k);if(j)return j;if(T===null)return;let $=Ns("tooltip",u,l);return $===!0&&($={content:"encoding"}),Ca($)?{value:$}:ff($)?$.content==="encoding"?CW(r,d,l,t):{signal:k}:void 0})}}function EW(e,t,r,{reactiveGeom:u}={}){const l={},d=u?"datum.datum":"datum",b=[];function k(j,$){const G=Bw($),te=Cg(j)?j:Object.assign(Object.assign({},j),{type:e[G].type}),se=qc(zw(te,r,{allowDisabling:!1})).join(", ");let he;if(qy($)){const ve=$==="x"?"x2":"y2",Be=Xy(e[ve]);if(tp(te.bin)&&Be){const ze=bi(te,{expr:d}),Ue=bi(Be,{expr:d}),{format:st,formatType:ut}=J3(te);he=G3(ze,Ue,st,ut,r),l[ve]=!0}else if(t&&t.fieldChannel===$&&t.offset==="normalize"){const{format:ze,formatType:Ue}=J3(te);he=qF({fieldOrDatumDef:te,format:ze,formatType:Ue,expr:d,config:r,normalizeStack:!0}).signal}}he=he??lD(te,r,d).signal,b.push({channel:$,key:se,value:he})}aR(e,(j,$)=>{Si(j)?k(j,$):X3(j)&&k(j.condition,$)});const T={};for(const{channel:j,key:$,value:G}of b)l[j]||T[$]||(T[ns($)]=G);return T}function CW(e,t,r,{reactiveGeom:u}={}){const l=vz(EW(e,t,r,{reactiveGeom:u})).map(({key:d,value:b})=>`${d}: ${b}`);return l.length>0?{signal:`{${l.join(", ")}}`}:void 0}function Jse(e){const{markDef:t,config:r}=e,u=Ns("aria",t,r);return u===!1?{}:Object.assign(Object.assign(Object.assign({},u?{aria:u}:{}),function(l){const{mark:d,markDef:b,config:k}=l;if(k.aria===!1)return{};const T=Ns("ariaRoleDescription",b,k);return T!=null?{ariaRoleDescription:{value:T}}:d in Hae?{}:{ariaRoleDescription:{value:d}}}(e)),function(l){const{encoding:d,markDef:b,config:k,stack:T}=l,j=d.description;if(j)return CC(l,j,"description",te=>lD(te,l.config));const $=Ns("description",b,k);if($!=null)return{description:Gc($)};if(k.aria===!1)return{};const G=EW(d,T,k);if(!su(G))return{description:{signal:vz(G).map(({key:te,value:se})=>`${te} + ": " + (${se})`).join(' + "; " + ')}}}(e))}function df(e,t,r={}){const{markDef:u,encoding:l,config:d}=t,{vgChannel:b}=r;let{defaultRef:k,defaultValue:T}=r;k===void 0&&(T=T??Ns(e,u,d,{vgChannel:b,ignoreVgConfig:!0}))!==void 0&&(k=Gc(T));const j=l[e];return CC(t,j,b??e,$=>cU({channel:e,channelDef:$,markDef:u,config:d,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:k}))}function SW(e,t={filled:void 0}){var r,u,l,d;const{markDef:b,encoding:k,config:T}=e,{type:j}=b,$=(r=t.filled)!==null&&r!==void 0?r:Ns("filled",b,T),G=bo(["bar","point","circle","square","geoshape"],j)?"transparent":void 0,te=(l=(u=Ns($===!0?"color":void 0,b,T,{vgChannel:"fill"}))!==null&&u!==void 0?u:T.mark[$===!0&&"color"])!==null&&l!==void 0?l:G,se=(d=Ns($===!1?"color":void 0,b,T,{vgChannel:"stroke"}))!==null&&d!==void 0?d:T.mark[$===!1&&"color"],he=$?"fill":"stroke",ve=Object.assign(Object.assign({},te?{fill:Gc(te)}:{}
7838),se?{stroke:Gc(se)}:{});return b.color&&($?b.fill:b.stroke)&&li(re.droppingColor("property",{fill:"fill"in b,stroke:"stroke"in b})),Object.assign(Object.assign(Object.assign(Object.assign({},ve),df("color",e,{vgChannel:he,defaultValue:$?te:se})),df("fill",e,{defaultValue:k.fill?te:void 0})),df("stroke",e,{defaultValue:k.stroke?se:void 0}))}function fD(e,t){const r=t[function(u){switch(u){case pc:return"xOffset";case Rl:return"yOffset";case xv:return"x2Offset";case jy:return"y2Offset";case wv:return"thetaOffset";case Ly:return"radiusOffset";case q1:return"theta2Offset";case H1:return"radius2Offset"}}(e)];if(r)return r}function $d(e,t,{defaultPos:r,vgChannel:u,isMidPoint:l}){const{encoding:d,markDef:b,config:k,stack:T}=t,j=d[e],$=d[$y(e)],G=t.scaleName(e),te=t.getScaleComponent(e),se=fD(e,b),he=kR({model:t,defaultPos:r,channel:e,scaleName:G,scale:te}),ve=!j&&qy(e)&&(d.latitude||d.longitude)?{field:t.getName(e)}:function(Be){const{channel:ze,channelDef:Ue,isMidPoint:st,scaleName:ut,stack:mt,offset:pt,markDef:Ct,config:Et}=Be;if(ta(Ue)&&mt&&ze===mt.fieldChannel){if(Si(Ue)){const mn=xC({channel:ze,fieldDef:Ue,isMidPoint:st,markDef:Ct,stack:mt,config:Et});if(mn!==void 0)return q3({scaleName:ut,fieldOrDatumDef:Ue,startSuffix:"start",band:mn,offset:pt})}return jw(Ue,ut,{suffix:"end"},{offset:pt})}return $F(Be)}({channel:e,channelDef:j,channel2Def:$,markDef:b,config:k,isMidPoint:l,scaleName:G,scale:te,stack:T,offset:se,defaultRef:he});return ve?{[u||e]:ve}:void 0}function kR({model:e,defaultPos:t,channel:r,scaleName:u,scale:l}){const{markDef:d,config:b}=e;return()=>{const k=Bw(r),T=ix(r),j=Ns(r,d,b,{vgChannel:T});if(j!==void 0)return yC(r,j);switch(t){case"zeroOrMin":case"zeroOrMax":if(u){const $=l.get("type");if(!bo([hl.LOG,hl.TIME,hl.UTC],$)){if(l.domainDefinitelyIncludesZero())return{scale:u,value:0}}}if(t==="zeroOrMin")return k==="y"?{field:{group:"height"}}:{value:0};switch(k){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":{const $=e[Hy(r)];return Object.assign(Object.assign({},$),{mult:.5})}}}}const Qse={left:"x",center:"xc",right:"x2"},Zse={top:"y",middle:"yc",bottom:"y2"};function AW(e,t,r,u="middle"){if(e==="radius"||e==="theta")return ix(e);const l=Ns(e==="x"?"align":"baseline",t,r);return e==="x"?Qse[l||(u==="top"?"left":"center")]:Zse[l||u]}function dD(e,t,{defaultPos:r,defaultPos2:u,range:l}){return l?OW(e,t,{defaultPos:r,defaultPos2:u}):$d(e,t,{defaultPos:r})}function OW(e,t,{defaultPos:r,defaultPos2:u}){const{markDef:l,config:d}=t,b=$y(e),k=Hy(e),T=function($,G,te){const{encoding:se,mark:he,markDef:ve,stack:Be,config:ze}=$,Ue=Bw(te),st=Hy(te),ut=ix(te),mt=se[Ue],pt=$.scaleName(Ue),Ct=$.getScaleComponent(Ue),Et=fD(te in se||te in ve?te:Ue,$.markDef);if(!mt&&(te==="x2"||te==="y2")&&(se.latitude||se.longitude))return{[ut]:{field:$.getName(te)}};const mn=function({channel:An,channelDef:xn,channel2Def:Wn,markDef:Un,config:Kn,scaleName:Qn,scale:ir,stack:Nr,offset:Jr,defaultRef:Lr}){return ta(xn)&&Nr&&An.charAt(0)===Nr.fieldChannel.charAt(0)?jw(xn,Qn,{suffix:"start"},{offset:Jr}):$F({channel:An,channelDef:Wn,scaleName:Qn,scale:ir,stack:Nr,markDef:Un,config:Kn,offset:Jr,defaultRef:Lr})}({channel:te,channelDef:mt,channel2Def:se[te],markDef:ve,config:ze,scaleName:pt,scale:Ct,stack:Be,offset:Et,defaultRef:void 0});return mn!==void 0?{[ut]:mn}:hD(te,ve)||hD(te,{[te]:tD(te,ve,ze.style),[st]:tD(st,ve,ze.style)})||hD(te,ze[he])||hD(te,ze.mark)||{[ut]:kR({model:$,defaultPos:G,channel:te,scaleName:pt,scale:Ct})()}}(t,u,b),j=T[k]?AW(e,l,d):ix(e);return Object.assign(Object.assign({},$d(e,t,{defaultPos:r,vgChannel:j})),T)}function hD(e,t){const r=Hy(e),u=ix(e);return t[u]!==void 0?{[u]:yC(e,t[u])}:t[e]!==void 0?{[u]:yC(e,t[e])}:t[r]?{[r]:yC(e,t[r])}:void 0}function hx(e,t,r){var u,l,d,b;const{config:k,encoding:T,markDef:j,stack:$}=e,G=$y(t),te=Hy(t),se=T[t],he=T[G],ve=e.getScaleComponent(t),Be=ve?ve.get("type"):void 0,ze=e.scaleName(t),Ue=j.orient,st=(l=(u=T[te])!==null&&u!==void 0?u:T.size)!==null&&l!==void 0?l:Ns("size",j,k,{vgChannel:te}),ut=r==="bar"&&(t==="x"?Ue==="vertical":Ue==="horizontal");if(Si(se)&&(Du(se.bin)||tp(se.bin)||se.timeUnit&&!he)&&!st&&!vm(Be)){const mt=xC({channel:t,fieldDef:se,stack:$,markDef:j,config:k}),pt=(d=e.component.axes[t])===null||d===void 0?void 0:d[0];return function({fieldDef:Ct,fieldDef2:Et,channel:mn,band:An,scaleName:xn,markDef:Wn,spacing:Un=0,axisTranslate:Kn,reverse:Qn,config:ir}){const Nr=$y(mn),Jr=ix(mn),Lr=ix(Nr),hi=fD(mn,Wn);if(Du(Ct.bin)||Ct.timeUnit)return{[Lr]:DW({channel:mn,fieldDef:Ct,scaleName:xn,markDef:Wn,band:(1-An)/2,offset:SC(Nr,Un,Qn,Kn,hi),config:ir}),[Jr]:DW({channel:mn,fieldDef:Ct,scaleName:xn,markDef:Wn,band:1-(1-An)/2,offset:SC(mn,Un,Qn,Kn,hi),config:ir})};if(tp(Ct.bin)){const Ri=jw(Ct,xn,{},{offset:SC(Nr,Un,Qn,Kn,hi)});if(Si(Et))return{[Lr]:Ri,[Jr]:jw(Et,xn,{},{offset:SC(mn,Un,Qn,Kn,hi)})};if(gC(Ct.bin)&&Ct.bin.step)return{[Lr]:Ri,[Jr]:{signal:`scale("${xn}", ${bi(Ct,{expr:"datum"})} + ${Ct.bin.step})`,offset:SC(mn,Un,Qn,Kn,hi)}}}return void li(re.channelRequiredForBinned(Nr))}
7838({fieldDef:se,fieldDef2:he,channel:t,markDef:j,scaleName:ze,band:mt,axisTranslate:(b=pt==null?void 0:pt.get("translate"))!==null&&b!==void 0?b:.5,spacing:qy(t)?Ns("binSpacing",j,k):void 0,reverse:ve.get("reverse"),config:k})}return(ta(se)&&vm(Be)||ut)&&!he?function(mt,pt,Ct,Et){var mn;const{markDef:An,encoding:xn,config:Wn,stack:Un}=Et,Kn=An.orient,Qn=Et.scaleName(Ct),ir=Et.getScaleComponent(Ct),Nr=Hy(Ct),Jr=$y(Ct),Lr=Kn==="horizontal"&&Ct==="y"||Kn==="vertical"&&Ct==="x",hi=Ns(Lr?"size":Nr,An,Wn,{vgChannel:Nr});let Ri;(xn.size||hi!==void 0)&&(Lr?Ri=df("size",Et,{vgChannel:Nr,defaultValue:hi}):li(re.cannotApplySizeToNonOrientedMark(An.type)));const Pi=(mn=ta(pt)?xC({channel:Ct,fieldDef:pt,markDef:An,stack:Un,config:Wn}):void 0)!==null&&mn!==void 0?mn:1;Ri=Ri||{[Nr]:function(Go,Ra,uo,rs,is,Is){if(rs){const uu=rs.get("type");if(uu==="point"||uu==="band"){if(is[Go].discreteBandSize!==void 0)return{value:is[Go].discreteBandSize};if(uu===hl.POINT){const Xf=rs.get("range");return sx(Xf)&&fl(Xf.step)?{value:Xf.step-2}:{value:vR-2}}return{scale:uo,band:Is}}return{value:is[Go].continuousBandSize}}const Tu=oD(is.view,Ra),Nu=dl(is[Go].discreteBandSize,Tu-2);return Nu!==void 0?{value:Nu}:void 0}(mt,Nr,Qn,ir,Wn,Pi)};const so=(ir==null?void 0:ir.get("type"))!=="band"||!("band"in Ri[Nr]),Ui=AW(Ct,An,Wn,so?"middle":"top"),ji=fD(Ct,An),Yi=$F({channel:Ct,channelDef:pt,markDef:An,config:Wn,scaleName:Qn,scale:ir,stack:Un,offset:ji,defaultRef:kR({model:Et,defaultPos:"mid",channel:Ct,scaleName:Qn,scale:ir}),band:so?.5:(1-Pi)/2});if(Nr)return Object.assign({[Ui]:Yi},Ri);{const Go=ix(Jr),Ra=Ri[Nr],uo=ji?Object.assign(Object.assign({},Ra),{offset:ji}):Ra;return{[Ui]:Yi,[Go]:mo(Yi)?[Yi[0],Object.assign(Object.assign({},Yi[1]),{offset:uo})]:Object.assign(Object.assign({},Yi),{offset:uo})}}}(r,se,t,e):OW(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function SC(e,t,r,u,l){if(Iz(e))return 0;const d=e==="x"||e==="y2"?-t/2:t/2;if(Uo(r)){const b=_C(l);return{signal:`${r.signal} ? ${u-d}${b?"-"+b:""} : ${u+d}${b?"+"+b:""}`}}if(Uo(l)){const b=u+(r?-d:d);return{signal:`${b||""}${r?" - ":b?" + ":""}${l.signal}`}}return l=l||0,u+(r?-l-d:+l+d)}function DW({channel:e,fieldDef:t,scaleName:r,markDef:u,band:l,offset:d,config:b}){return uU({fieldDef:t,channel:e,markDef:u,ref:q3({scaleName:r,fieldOrDatumDef:t,band:l,offset:d}),config:b})}const eue=new Set(["aria"]);function k0(e,t){const{fill:r,stroke:u}=t.color==="include"?SW(e):{};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},function(l,d){return $ae.reduce((b,k)=>(eue.has(k)||l[k]===void 0||d[k]==="ignore"||(b[k]=Gc(l[k])),b),{})}(e.markDef,t)),TW(e,"fill",r)),TW(e,"stroke",u)),df("opacity",e)),df("fillOpacity",e)),df("strokeOpacity",e)),df("strokeWidth",e)),df("strokeDash",e)),kW(e)),_R(e,"href")),Jse(e))}function TW(e,t,r){const{config:u,mark:l,markDef:d}=e;if(Ns("invalid",d,u)==="hide"&&r&&!Iw(l)){const b=function(k,{invalid:T=!1,channels:j}){const $=j.reduce((te,se)=>{const he=k.getScaleComponent(se);if(he){const ve=he.get("type"),Be=k.vgField(se,{expr:"datum"});Be&&_0(ve)&&(te[Be]=!0)}return te},{}),G=di($);if(G.length>0){const te=T?"||":"&&";return G.map(se=>HF(se,T)).join(` ${te} `)}}(e,{invalid:!0,channels:U3});if(b)return{[t]:[{test:b,value:null},...qc(r)]}}return r?{[t]:r}:{}}function ER(e){const{config:t,markDef:r}=e;if(Ns("invalid",r,t)){const u=function(l,{invalid:d=!1,channels:b}){const k=b.reduce((j,$)=>{const G=l.getScaleComponent($);if(G){const te=G.get("type"),se=l.vgField($,{expr:"datum"});se&&_0(te)&&(j[se]=!0)}return j},{}),T=di(k);if(T.length>0){const j=d?"||":"&&";return T.map($=>HF($,d)).join(` ${j} `)}}(e,{channels:w0});if(u)return{defined:{signal:u}}}return{}}function NW(e,t){if(t!==void 0)return{[e]:Gc(t)}}var IW={has:e=>e.type!=="interval"&&e.nearest,parse:(e,t)=>{if(t.events)for(const r of t.events)r.markname=e.getName("voronoi")},marks:(e,t,r)=>{const{x:u,y:l}=t.project.hasChannel,d=e.mark;if(Iw(d))return li(re.nearestNotSupportForContinuous(d)),r;const b={name:e.getName("voronoi"),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:Object.assign({fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}},kW(e,{reactiveGeom:!0}))},transform:[{type:"voronoi",x:{expr:u||!l?"datum.datum.x || 0":"0"},y:{expr:l||!u?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let k=0,T=!1;return r.forEach((j,$)=>{var G;const te=(G=j.name)!==null&&G!==void 0?G:"";te===e.component.mark[0].name?k=$:te.indexOf("voronoi")>=0&&(T=!0)}),T||r.splice(k+1,0,b),r}};class Js{constructor(t,r){this.debugName=r,this._children=[],this._parent=null,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,r){this._children.indexOf(t)>-1?console.warn("Attempt to add the same child twice."):r!==void 0?this._children.splice(r,0,t):this._children.push(t)}removeChild(t){const r=this._children.indexOf(t);return this._children.splice(r,1),r}remove(){let t=this._parent.removeChild(this);for(const r of this._children)r._parent=this._parent,this._parent.addChild(r,t++)}insertAsParentOf(t){const r=t.parent;r.removeChild(this),this.parent=r,t.parent=this}swapWithParent(){const t=this._parent,r=t.parent;for(const u of this._children)u.parent=t;this._children=[],t.removeChild(this),t.parent.removeChild(t),this.parent=r,t.parent=this}}class rp extends Js{constructor(t,r,u,l){super(t,r),this.type=u,this.refCounts=l,this._source=this._name=r,!this.refCounts||this._name in this.refCounts||(this.refCounts[this._name]=0)}clone(){const t=new this.constructor;return t.debugName="clone_"+this.debugName,t._source=this._source,t._name="clone_"+this._name,t.type=this.t
7838ype,t.refCounts=this.refCounts,t.refCounts[t._name]=0,t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${Yie()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}class Qy extends Js{constructor(t,r){super(t),this.formula=r}clone(){return new Qy(null,Sa(this.formula))}static makeFromEncoding(t,r){const u=r.reduceFieldDef((l,d,b)=>{const{field:k,timeUnit:T}=d,j=Sc(r)?r.encoding[$y(b)]:void 0,$=Sc(r)&&YF(b,d,j,r.stack,r.markDef,r.config);if(T){const G=bi(d,{forAs:!0});l[cs({as:G,field:k,timeUnit:T})]=Object.assign({as:G,field:k,timeUnit:T},$?{band:!0}:{})}return l},{});return su(u)?null:new Qy(t,u)}static makeFromTransform(t,r){const u=Object.assign({},r),{timeUnit:l}=u,d=ao(u,["timeUnit"]),b=np(l),k=Object.assign(Object.assign({},d),{timeUnit:b});return new Qy(t,{[cs(k)]:k})}merge(t){this.formula=Object.assign({},this.formula);for(const r in t.formula)this.formula[r]&&!t.formula[r].band||(this.formula[r]=t.formula[r]);for(const r of t.children)t.removeChild(r),r.parent=this;t.remove()}producedFields(){return new Set(Jb(this.formula).map(t=>t.as))}dependentFields(){return new Set(Jb(this.formula).map(t=>t.field))}hash(){return`TimeUnit ${cs(this.formula)}`}assemble(){const t=[];for(const r of Jb(this.formula)){const{field:u,as:l,timeUnit:d}=r,b=np(d),{unit:k,utc:T}=b,j=ao(b,["unit","utc"]);t.push(Object.assign(Object.assign(Object.assign(Object.assign({field:Qb(u),type:"timeunit"},k?{units:RF(k)}:{}),T?{timezone:"utc"}:{}),j),{as:[l,`${l}_end`]}))}return t}}const AC="_tuple_fields";var MW={has:e=>e.type==="single"&&e.resolve==="global"&&e.bind&&e.bind!=="scales"&&!dR(e.bind),parse:(e,t,r,u)=>{u.on||delete t.events,u.clear||delete t.clear},topLevelSignals:(e,t,r)=>{const u=t.name,l=t.project,d=t.bind,b=t.init&&t.init[0],k=IW.has(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return l.items.forEach((T,j)=>{var $,G;const te=nc(`${u}_${T.field}`);r.filter(se=>se.name===te).length||r.unshift(Object.assign(Object.assign({name:te},b?{init:D_(b[j])}:{value:null}),{on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${k}[${ns(T.field)}] : null`}]:[],bind:(G=($=d[T.field])!==null&&$!==void 0?$:d[T.channel])!==null&&G!==void 0?G:d}))}),r},signals:(e,t,r)=>{const u=t.name,l=t.project,d=r.filter(j=>j.name===u+Zy)[0],b=u+AC,k=l.items.map(j=>nc(`${u}_${j.field}`)),T=k.map(j=>`${j} !== null`).join(" && ");return k.length&&(d.update=`${T} ? {fields: ${b}, values: [${k.join(", ")}]} : null`),delete d.value,delete d.on,r}},FW={has:e=>e.type==="multi"&&!!e.toggle,signals:(e,t,r)=>r.concat({name:t.name+"_toggle",value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const r=t.name+Zy,u=t.name+"_toggle";return`${u} ? null : ${r}, `+(t.resolve==="global"?`${u} ? null : true, `:`${u} ? null : {unit: ${Q1(e)}}, `)+`${u} ? ${r} : null`}},px={has:e=>e.type==="interval"&&e.resolve==="global"&&e.bind&&e.bind==="scales",parse:(e,t)=>{const r=t.scales=[];for(const u of t.project.items){const l=u.channel;if(!ax(l))continue;const d=e.getScaleComponent(l),b=d?d.get("type"):void 0;if(!d||!_0(b)){li(re.SCALE_BINDINGS_CONTINUOUS);continue}const k={selection:t.name,field:u.field};d.set("selectionExtent",k,!0),r.push(u)}},topLevelSignals:(e,t,r)=>{const u=t.scales.filter(b=>r.filter(k=>k.name===b.signals.data).length===0);if(!e.parent||SR(e)||u.length===0)return r;const l=r.filter(b=>b.name===t.name)[0];let d=l.update;if(d.indexOf(HW)>=0)l.update=`{${u.map(b=>`${ns(b.field)}: ${b.signals.data}`).join(", ")}}`;else{for(const b of u){const k=`${ns(b.field)}: ${b.signals.data}`;d.indexOf(k)<0&&(d=`${d.substring(0,d.length-1)}, ${k}}`)}l.update=d}return r.concat(u.map(b=>({name:b.signals.data})))},signals:(e,t,r)=>{if(e.parent&&!SR(e))for(const u of t.scales){const l=r.filter(d=>d.name===u.signals.data)[0];l.push="outer",delete l.value,delete l.update}return r}};function CR(e,t){return`domain(${ns(e.scaleName(t))})`}function SR(e){var t;return e.parent&&j_(e.parent)&&((t=!e.parent.parent)!==null&&t!==void 0?t:SR(e.parent.parent))}const RW={has:e=>{const t=e.resolve==="global"&&e.bind&&dR(e.bind),r=e.project.items.length===1&&e.project.items[0].field!==O_;return t&&!r&&li(re.LEGEND_BINDINGS_PROJECT_LENGTH),t&&r},parse:(e,t,r,u)=>{var l;if(u.on||delete t.events,u.clear||delete t.clear,u.on||u.clear){const k='event.item && indexof(event.item.mark.role, "legend") < 0';for(const T of t.events)T.filter=qc((l=T.filter)!==null&&l!==void 0?l:[]),T.filter.indexOf(k)<0&&T.filter.push(k)}const d=hR(t.bind)?t.bind.legend:"click",b=Ca(d)?Ow(d,"view"):qc(d);t.bind={legend:{merge:b}}},topLevelSignals:(e,t,r)=>
7838{const u=t.name,l=hR(t.bind)&&t.bind.legend,d=b=>k=>{const T=Sa(k);return T.markname=b,T};for(const b of t.project.items){if(!b.hasLegend)continue;const k=`${nc(b.field)}_legend`,T=`${u}_${k}`;if(r.filter(j=>j.name===T).length===0){const j=l.merge.map(d(`${k}_symbols`)).concat(l.merge.map(d(`${k}_labels`))).concat(l.merge.map(d(`${k}_entries`)));r.unshift(Object.assign(Object.assign({name:T},t.init?{}:{value:null}),{on:[{events:j,update:"datum.value || item().items[0].items[0].datum.value",force:!0},{events:l.merge,update:`!event.item || !datum ? null : ${T}`,force:!0}]}))}}return r},signals:(e,t,r)=>{const u=t.name,l=t.project,d=r.find(G=>G.name===u+Zy),b=u+AC,k=l.items.filter(G=>G.hasLegend).map(G=>nc(`${u}_${nc(G.field)}_legend`)),T=`${k.map(G=>`${G} !== null`).join(" && ")} ? {fields: ${b}, values: [${k.join(", ")}]} : null`;t.events&&k.length>0?d.on.push({events:k.map(G=>({signal:G})),update:T}):k.length>0&&(d.update=T,delete d.value,delete d.on);const j=r.find(G=>G.name===u+"_toggle"),$=hR(t.bind)&&t.bind.legend;return j&&(t.events?j.on.push(Object.assign(Object.assign({},j.on[0]),{events:$})):j.on[0].events=$),r}},BW="_translate_anchor",PW="_translate_delta";function jW(e,t,r,u,l){var d;const b=t.name,k=b+BW,T=b+PW,j=r.channel,$=px.has(t),G=l.filter(ze=>ze.name===r.signals[$?"data":"visual"])[0],te=e.getSizeSignalRef(u).signal,se=e.getScaleComponent(j),he=se.get("type"),ve=`${k}.extent_${j}`,Be=`${$?he==="log"?"panLog":he==="pow"?"panPow":"panLinear":"panLinear"}(${ve}, ${`${$&&j===pc?"-":""}${T}.${j} / `+($?`${te}`:`span(${ve})`)}`+($&&he==="pow"?`, ${(d=se.get("exponent"))!==null&&d!==void 0?d:1}`:"")+")";G.on.push({events:{signal:T},update:$?Be:`clampRange(${Be}, 0, ${te})`})}const LW="_zoom_anchor",zW="_zoom_delta";function UW(e,t,r,u,l){var d;const b=t.name,k=r.channel,T=px.has(t),j=l.filter(Be=>Be.name===r.signals[T?"data":"visual"])[0],$=e.getSizeSignalRef(u).signal,G=e.getScaleComponent(k),te=G.get("type"),se=T?CR(e,k):j.name,he=b+zW,ve=`${T?te==="log"?"zoomLog":te==="pow"?"zoomPow":"zoomLinear":"zoomLinear"}(${se}, ${`${b}${LW}.${k}`}, ${he}`+(T&&te==="pow"?`, ${(d=G.get("exponent"))!==null&&d!==void 0?d:1}`:"")+")";j.on.push({events:{signal:he},update:T?ve:`clampRange(${ve}, 0, ${$})`})}const tue=[{has:()=>!0,parse:(e,t,r)=>{var u,l,d;const b=t.name,k=(u=t.project)!==null&&u!==void 0?u:t.project=new class{constructor(...te){this.items=te,this.hasChannel={},this.hasField={}}},T={},j={},$=new Set,G=(te,se)=>{const he=se==="visual"?te.channel:te.field;let ve=nc(`${b}_${he}`);for(let Be=1;$.has(ve);Be++)ve=nc(`${b}_${he}_${Be}`);return $.add(ve),{[se]:ve}};if(!r.fields&&!r.encodings){const te=e.config.selection[r.type];if(r.init)for(const se of qc(r.init))for(const he of di(se))hoe(he)?(r.encodings||(r.encodings=[])).push(he):r.type==="interval"?(li('Interval selections should be initialized using "x" and/or "y" keys.'),r.encodings=te.encodings):(r.fields||(r.fields=[])).push(he);else r.encodings=te.encodings,r.fields=te.fields}for(const te of(l=r.fields)!==null&&l!==void 0?l:[]){const se={type:"E",field:te};se.signals=Object.assign({},G(se,"data")),k.items.push(se),k.hasField[te]=se}for(const te of(d=r.encodings)!==null&&d!==void 0?d:[]){const se=e.fieldDef(te);if(se){let he=se.field;if(se.aggregate){li(re.cannotProjectAggregate(te,se.aggregate));continue}if(!he){li(re.cannotProjectOnChannelWithoutField(te));continue}if(se.timeUnit){he=e.vgField(te);const ve={timeUnit:se.timeUnit,as:he,field:se.field};j[cs(ve)]=ve}if(!T[he]){let ve="E";t.type==="interval"?_0(e.getScaleComponent(te).get("type"))&&(ve="R"):se.bin&&(ve="R-RE");const Be={field:he,channel:te,type:ve};Be.signals=Object.assign(Object.assign({},G(Be,"data")),G(Be,"visual")),k.items.push(T[he]=Be),k.hasField[he]=k.hasChannel[te]=T[he]}}else li(re.cannotProjectOnChannelWithoutField(te))}if(r.init){const te=se=>k.items.map(he=>se[he.channel]!==void 0?se[he.channel]:se[he.field]);if(r.type==="interval")t.init=te(r.init);else{const se=qc(r.init);t.init=se.map(te)}}su(j)||(k.timeUnit=new Qy(null,j))},signals:(e,t,r)=>{const u=t.name+AC;return r.filter(l=>l.name===u).length>
78380?r:r.concat({name:u,value:t.project.items.map(l=>{const d=ao(l,["signals","hasLegend"]);return d.field=Qb(d.field),d})})}},FW,px,RW,{has:e=>e.type==="interval"&&e.translate,signals:(e,t,r)=>{const u=t.name,l=px.has(t),d=u+BW,{x:b,y:k}=t.project.hasChannel;let T=Ow(t.translate,"scope");return l||(T=T.map(j=>(j.between[0].markname=u+OC,j))),r.push({name:d,value:{},on:[{events:T.map(j=>j.between[0]),update:"{x: x(unit), y: y(unit)"+(b!==void 0?", extent_x: "+(l?CR(e,pc):`slice(${b.signals.visual})`):"")+(k!==void 0?", extent_y: "+(l?CR(e,Rl):`slice(${k.signals.visual})`):"")+"}"}]},{name:u+PW,value:{},on:[{events:T,update:`{x: ${d}.x - x(unit), y: ${d}.y - y(unit)}`}]}),b!==void 0&&jW(e,t,b,"width",r),k!==void 0&&jW(e,t,k,"height",r),r}},{has:e=>e.type==="interval"&&e.zoom,signals:(e,t,r)=>{const u=t.name,l=px.has(t),d=u+zW,{x:b,y:k}=t.project.hasChannel,T=ns(e.scaleName(pc)),j=ns(e.scaleName(Rl));let $=Ow(t.zoom,"scope");return l||($=$.map(G=>(G.markname=u+OC,G))),r.push({name:u+LW,on:[{events:$,update:l?"{"+[T?`x: invert(${T}, x(unit))`:"",j?`y: invert(${j}, y(unit))`:""].filter(G=>!!G).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:d,on:[{events:$,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),b!==void 0&&UW(e,t,b,"width",r),k!==void 0&&UW(e,t,k,"height",r),r}},MW,IW,{has:e=>e.clear!==void 0&&e.clear!==!1,parse:(e,t,r)=>{r.clear&&(t.clear=Ca(r.clear)?Ow(r.clear,"scope"):r.clear)},topLevelSignals:(e,t,r)=>{if(MW.has(t))for(const u of t.project.items){const l=r.findIndex(d=>d.name===nc(`${t.name}_${u.field}`));l!==-1&&r[l].on.push({events:t.clear,update:"null"})}return r},signals:(e,t,r)=>{function u(l,d){l!==-1&&r[l].on&&r[l].on.push({events:t.clear,update:d})}if(t.type==="interval")for(const l of t.project.items){const d=r.findIndex(b=>b.name===l.signals.visual);u(d,"[0, 0]"),d===-1&&u(r.findIndex(b=>b.name===l.signals.data),"null")}else{let l=r.findIndex(d=>d.name===t.name+Zy);u(l,"null"),FW.has(t)&&u(l=r.findIndex(d=>d.name===t.name+"_toggle"),"false")}return r}}];function pD(e,t){for(const r of tue)r.has(e)&&t(r)}function D_(e,t=!0,r=Pie){if(mo(e)){const u=e.map(l=>D_(l,t,r));return t?`[${u.join(", ")}]`:u}return E_(e)?r(t?vC(e):function(u){const l=IF(u,!0);return u.utc?+new Date(Date.UTC(...l)):+new Date(...l)}(e)):t?r(JSON.stringify(e)):e}function WW(e,t){return Gw(e,(r,u)=>{t=u.marks?u.marks(e,r,t):t,pD(r,l=>{l.marks&&(t=l.marks(e,r,t))})}),t}function AR(e){return e.map(t=>(t.on&&!t.on.length&&delete t.on,t))}const OC="_brush",OR="_scale_trigger",nue={signals:(e,t)=>{const r=t.name,u=r+AC,l=px.has(t),d=[],b=[],k=[];if(t.translate&&!l){const $=`!event.item || event.item.mark.name !== ${ns(r+OC)}`;VW(t,(G,te)=>{var se;const he=qc((se=te.between[0].filter)!==null&&se!==void 0?se:te.between[0].filter=[]);return he.indexOf($)<0&&he.push($),G})}t.project.items.forEach(($,G)=>{const te=$.channel;if(te!==pc&&te!==Rl)return void li("Interval selections only support x and y encoding channels.");const se=t.init?t.init[G]:null,he=function(st,ut,mt,pt){const Ct=mt.channel,Et=mt.signals.visual,mn=mt.signals.data,An=px.has(ut),xn=ns(st.scaleName(Ct)),Wn=st.getScaleComponent(Ct),Un=Wn?Wn.get("type"):void 0,Kn=Jr=>`scale(${xn}, ${Jr})`,Qn=st.getSizeSignalRef(Ct===pc?"width":"height").signal,ir=`${Ct}(unit)`,Nr=VW(ut,(Jr,Lr)=>[...Jr,{events:Lr.between[0],update:`[${ir}, ${ir}]`},{events:Lr,update:`[${Et}[0], clamp(${ir}, 0, ${Qn})]`}]);return Nr.push({events:{signal:ut.name+OR},update:_0(Un)?`[${Kn(`${mn}[0]`)}, ${Kn(`${mn}[1]`)}]`:"[0, 0]"}),An?[{name:mn,on:[]}
7838]:[Object.assign(Object.assign({name:Et},pt?{init:D_(pt,!0,Kn)}:{value:[]}),{on:Nr}),Object.assign(Object.assign({name:mn},pt?{init:D_(pt)}:{}),{on:[{events:{signal:Et},update:`${Et}[0] === ${Et}[1] ? null : invert(${xn}, ${Et})`}]})]}(e,t,$,se),ve=$.signals.data,Be=$.signals.visual,ze=ns(e.scaleName(te)),Ue=_0(e.getScaleComponent(te).get("type"))?"+":"";d.push(...he),b.push(ve),k.push({scaleName:e.scaleName(te),expr:`(!isArray(${ve}) || (${Ue}invert(${ze}, ${Be})[0] === ${Ue}${ve}[0] && ${Ue}invert(${ze}, ${Be})[1] === ${Ue}${ve}[1]))`})}),l||d.push({name:r+OR,value:{},on:[{events:k.map($=>({scale:$.scaleName})),update:k.map($=>$.expr).join(" && ")+` ? ${r+OR} : {}`}]});const T=t.init,j=`unit: ${Q1(e)}, fields: ${u}, values`;return d.concat(Object.assign(Object.assign({name:r+Zy},T?{init:`{${j}: ${D_(T)}}`}:{}),{on:[{events:[{signal:b.join(" || ")}],update:b.join(" && ")+` ? {${j}: [${b}]} : null`}]}))},modifyExpr:(e,t)=>t.name+Zy+", "+(t.resolve==="global"?"true":`{unit: ${Q1(e)}}`),marks:(e,t,r)=>{const u=t.name,{x:l,y:d}=t.project.hasChannel,b=l&&l.signals.visual,k=d&&d.signals.visual,T=`data(${ns(t.name+qw)})`;if(px.has(t))return r;const j={x:l!==void 0?{signal:`${b}[0]`}:{value:0},y:d!==void 0?{signal:`${k}[0]`}:{value:0},x2:l!==void 0?{signal:`${b}[1]`}:{field:{group:"width"}},y2:d!==void 0?{signal:`${k}[1]`}:{field:{group:"height"}}};if(t.resolve==="global")for(const Be of di(j))j[Be]=[Object.assign({test:`${T}.length && ${T}[0].unit === ${Q1(e)}`},j[Be]),{value:0}];const $=t.mark,{fill:G,fillOpacity:te,cursor:se}=$,he=ao($,["fill","fillOpacity","cursor"]),ve=di(he).reduce((Be,ze)=>(Be[ze]=[{test:[l!==void 0&&`${b}[0] !== ${b}[1]`,d!==void 0&&`${k}[0] !== ${k}[1]`].filter(Ue=>Ue).join(" && "),value:he[ze]},{value:null}],Be),{});return[{name:u+OC+"_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:G},fillOpacity:{value:te}},update:j}},...r,{name:u+OC,type:"rect",clip:!0,encode:{enter:Object.assign(Object.assign({},se?{cursor:{value:se}}:{}),{fill:{value:"transparent"}}),update:Object.assign(Object.assign({},j),ve)}}]}};function VW(e,t){return e.events.reduce((r,u)=>u.between?t(r,u):(li(`${u} is not an ordered event stream for interval selections.`),r),[])}function $W(e,t){const r=t.name,u=r+AC,l="(item().isVoronoi ? datum.datum : datum)",d=t.project.items.map(T=>{const j=e.fieldDef(T.channel);return j&&j.bin?`[${l}[${ns(e.vgField(T.channel,{}))}], ${l}[${ns(e.vgField(T.channel,{binSuffix:"end"}))}]]`:`${l}[${ns(T.field)}]`}).join(", "),b=`unit: ${Q1(e)}, fields: ${u}, values`,k=t.events;return[{name:r+Zy,on:k?[{events:k,update:`datum && item().mark.marktype !== 'group' ? {${b}: [${d}]} : null`,force:!0}]:[]}]}const rue={signals:$W,modifyExpr:(e,t)=>t.name+Zy+", "+(t.resolve==="global"?"null":`{unit: ${Q1(e)}}`)},iue={signals:$W,modifyExpr:(e,t)=>t.name+Zy+", "+(t.resolve==="global"?"true":`{unit: ${Q1(e)}}`)},qw="_store",Zy="_tuple",oue="_modify",HW="vlSelectionResolve",aue={single:iue,multi:rue,interval:nue};function Gw(e,t){const r=e.component.selection;if(r){for(const u of Jb(r))if(t(u,aue[u.type])===!0)break}}function Q1(e,{escape:t}={escape:!0}){let r=t?ns(e.name):e.name;const u=function(l){let d=l.parent;for(;d&&!Ov(d);)d=d.parent;return d}(e);if(u){const{facet:l}=u;for(const d of x0)l[d]&&(r+=` + '__facet_${d}_' + (facet[${ns(u.vgField(d))}])`)}return r}function DR(e){let t=!1;return Gw(e,r=>{t=t||r.project.items.some(u=>u.field===O_)}),t}const sue="RawCode",uue="Literal",cue="Property",lue="Identifier",fue="ArrayExpression",due="BinaryExpression",hue="CallExpression",pue="ConditionalExpression",mue="LogicalExpression",gue="MemberExpression",vue="ObjectExpression",yue="UnaryExpression";function Cv(e){this.type=e}var Z1,Ki,$r,Hd,$s;Cv.prototype.visit=function(e){let t,r,u;if(e(this))return 1;for(r=0,u=(t=function(l){switch(l.type){case fue:return l.elements;case due:case mue:return[l.left,l.right];case hue:return[l.callee].concat(l.arguments);case pue:return[l.test,l.consequent,l.alternate];case gue:return[l.object,l.property];case vue:return l.properties;case cue:return[l.key,l.value];case yue:return[l.argument];case lue:case uue:case sue:default:return[]}}(this)).length;r<u;++r)if(t[r].visit(e))return 1};var mD=1,DC=2,Kw=3,mx=4,gD=5,Yw=6,ym=7,TC=8;(Z1={})[mD]="Boolean",Z1[DC]="<end>",Z1[Kw]="Identifier",Z1[mx]="Keyword",Z1[gD]="Null",Z1[Yw]="Numeric",Z1[ym]="Punctuator",Z1[TC]="String",Z1[9]="RegularExpression";var bue="ArrayExpression",xue="BinaryExpression",wue="CallExpression",_ue="ConditionalExpression",qW="Identifier",kue="Literal",Eue="LogicalExpression",Cue="MemberExpression",Sue="ObjectExpression",Aue="Property",Oue="UnaryExpression",Yf="Unexpected token %0",Due="Unexpected number",Tue="Unexpected string",Nue="Unexpected identifier",Iue="Unexpected reserved word",Mue="Unexpected end of input",TR="Invalid regular expression",NR="Invalid regular expression: missing /",GW="Octal literals are not allowed in strict mode.",Fue="Duplicate data property in object literal not allowed in strict mode",qd="ILLEGAL",NC="Disabled.",Rue=ne
7838w RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC
78387\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),Bue=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC
78387\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function vD(e,t){if(!e)throw new Error("ASSERT: "+t)}function eb(e){return e>=48&&e<=57}function IR(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function IC(e){return"01234567".indexOf(e)>=0}function Pue(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function MC(e){return e===10||e===13||e===8232||e===8233}function FC(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&Rue.test(String.fromCharCode(e))}function yD(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&Bue.test(String.fromCharCode(e))}var jue={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function KW(){for(var e;$r<Hd&&(Pue(e=Ki.charCodeAt($r))||MC(e));)++$r}function MR(e){var t,r,u,l=0;for(r=e==="u"?4:2,t=0;t<r;++t)$r<Hd&&IR(Ki[$r])?(u=Ki[$r++],l=16*l+"0123456789abcdef".indexOf(u.toLowerCase())):Cs({},Yf,qd);return String.fromCharCode(l)}function Lue(){var e,t,r,u;for(t=0,(e=Ki[$r])==="}"&&Cs({},Yf,qd);$r<Hd&&IR(e=Ki[$r++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||e!=="}")&&Cs({},Yf,qd),t<=65535?String.fromCharCode(t):(r=55296+(t-65536>>10),u=56320+(t-65536&1023),String.fromCharCode(r,u))}function YW(){var e,t;for(e=Ki.charCodeAt($r++),t=String.fromCharCode(e),e===92&&(Ki.charCodeAt($r)!==117&&Cs({},Yf,qd),++$r,(e=MR("u"))&&e!=="\\"&&FC(e.charCodeAt(0))||Cs({},Yf,qd),t=e);$r<Hd&&yD(e=Ki.charCodeAt($r));)++$r,t+=String.fromCharCode(e),e===92&&(t=t.substr(0,t.length-1),Ki.charCodeAt($r)!==117&&Cs({},Yf,qd),++$r,(e=MR("u"))&&e!=="\\"&&yD(e.charCodeAt(0))||Cs({},Yf,qd),t+=e);return t}function zue(){var e,t;return e=$r,{type:(t=Ki.charCodeAt($r)===92?YW():function(){var r,u;for(r=$r++;$r<Hd;){if((u=Ki.charCodeAt($r))===92)return $r=r,YW();if(!yD(u))break;++$r}return Ki.slice(r,$r)}()).length===1?Kw:jue.hasOwnProperty(t)?mx:t==="null"?gD:t==="true"||t==="false"?mD:Kw,value:t,start:e,end:$r}}function FR(){var e,t,r,u,l=$r,d=Ki.charCodeAt($r),b=Ki[$r];switch(d){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++$r,{type:ym,value:String.fromCharCode(d),start:l,end:$r};default:if((e=Ki.charCodeAt($r+1))===61)switch(d){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return $r+=2,{type:ym,value:String.fromCharCode(d)+String.fromCharCode(e),start:l,end:$r};case 33:case 61:return $r+=2,Ki.charCodeAt($r)===61&&++$r,{type:ym,value:Ki.slice(l,$r),start:l,end:$r}}}return(u=Ki.substr($r,4))===">>>="?{type:ym,value:u,start:l,end:$r+=4}:(r=u.substr(0,3))===">>>"||r==="<<="||r===">>="?{type:ym,value:r,start:l,end:$r+=3}:b===(t=r.substr(0,2))[1]&&"+-<>&|".indexOf(b)>=0||t==="=>"?{type:ym,value:t,start:l,end:$r+=2}:"<>=!+-*%&|^/".indexOf(b)>=0?{type:ym,value:b,start:l,end:++$r}:void Cs({},Yf,qd)}function XW(){var e,t,r;if(vD(eb((r=Ki[$r]).charCodeAt(0))||r===".","Numeric literal must start with a decimal digit or a decimal point"),t=$r,e="",r!=="."){if(e=Ki[$r++],r=Ki[$r],e==="0"){if(r==="x"||r==="X")return++$r,function(u){for(var l="";$r<Hd&&IR(Ki[$r]);)l+=Ki[$r++];return l.length===0&&Cs({},Yf,qd),FC(Ki.charCodeAt($r))&&Cs({},Yf,qd),{type:Yw,value:parseInt("0x"+l,16),start:u,end:$r}}(t);if(IC(r))return function(u){for(var l="0"+Ki[$r++];$r<Hd&&IC(Ki[$r]);)l+=Ki[$r++];return(FC(Ki.charCodeAt($r))||eb(Ki.charCodeAt($r)))&&Cs({},Yf,qd),{type:Yw,value:parseInt(l,8),octal:!0,start:u,end:$r}}(t);r&&eb(r.charCodeAt(0))&&Cs({},Yf,qd)}for(;eb(Ki.charCodeAt($r));)e+=Ki[$r++];r=Ki[$r]}if(r==="."){for(e+=Ki[$r++];eb(Ki.charCodeAt($r));)e+=Ki[$r++];r=Ki[$r]}if(r==="e"||r==="E")if(e+=Ki[$r++],(r=Ki[$r])!=="+"&&r!=="-"||(e+=Ki[$r++]),eb(Ki.charCodeAt($r)))for(;eb(Ki.charCodeAt($r));)e+=Ki[$r++];else Cs({},Yf,qd);return FC(Ki.charCodeAt($r))&&Cs({},Yf,qd),{type:Yw,value:parseFloat(e),start:t,end:$r}}function Uue(){var e,t,r,u;return $s=null,KW(),e=$r,t=function(){var l,d,b,k;for(vD((l=Ki[$r])==="/","Regular expression literal must start with a slash"),d=Ki[$r++],b=!1,k=!1;$r<Hd;
7838)if(d+=l=Ki[$r++],l==="\\")MC((l=Ki[$r++]).charCodeAt(0))&&Cs({},NR),d+=l;else if(MC(l.charCodeAt(0)))Cs({},NR);else if(b)l==="]"&&(b=!1);else{if(l==="/"){k=!0;break}l==="["&&(b=!0)}return k||Cs({},NR),{value:d.substr(1,d.length-2),literal:d}}(),r=function(){var l,d,b;for(d="",b="";$r<Hd&&yD((l=Ki[$r]).charCodeAt(0));)++$r,l==="\\"&&$r<Hd?Cs({},Yf,qd):(b+=l,d+=l);return b.search(/[^gimuy]/g)>=0&&Cs({},TR,b),{value:b,literal:d}}(),u=function(l,d){var b=l;d.indexOf("u")>=0&&(b=b.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(k,T){if(parseInt(T,16)<=1114111)return"x";Cs({},TR)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(b)}catch{Cs({},TR)}try{return new RegExp(l,d)}catch{return null}}(t.value,r.value),{literal:t.literal+r.literal,value:u,regex:{pattern:t.value,flags:r.value},start:e,end:$r}}function JW(){var e;return KW(),$r>=Hd?{type:DC,start:$r,end:$r}:FC(e=Ki.charCodeAt($r))?zue():e===40||e===41||e===59?FR():e===39||e===34?function(){var t,r,u,l,d="",b=!1;for(vD((t=Ki[$r])==="'"||t==='"',"String literal must starts with a quote"),r=$r,++$r;$r<Hd;){if((u=Ki[$r++])===t){t="";break}if(u==="\\")if((u=Ki[$r++])&&MC(u.charCodeAt(0)))u==="\r"&&Ki[$r]===` 7839`&&++$r;else switch(u){case"u":case"x":Ki[$r]==="{"?(++$r,d+=Lue()):d+=MR(u);break;case"n":d+=` 7840`;break;case"r":d+="\r";break;case"t":d+=" ";break;case"b":d+="\b";break;case"f":d+="\f";break;case"v":d+="\v";break;default:IC(u)?((l="01234567".indexOf(u))!==0&&(b=!0),$r<Hd&&IC(Ki[$r])&&(b=!0,l=8*l+"01234567".indexOf(Ki[$r++]),"0123".indexOf(u)>=0&&$r<Hd&&IC(Ki[$r])&&(l=8*l+"01234567".indexOf(Ki[$r++]))),d+=String.fromCharCode(l)):d+=u}else{if(MC(u.charCodeAt(0)))break;d+=u}}return t!==""&&Cs({},Yf,qd),{type:TC,value:d,octal:b,start:r,end:$r}}():e===46?eb(Ki.charCodeAt($r+1))?XW():FR():eb(e)?XW():FR()}function bm(){var e;return $r=(e=$s).end,$s=JW(),$r=e.end,e}function QW(){var e;e=$r,$s=JW(),$r=e}function ZW(e,t,r){var u=new Cv(e==="||"||e==="&&"?Eue:xue);return u.operator=e,u.left=t,u.right=r,u}function Wue(e,t){var r=new Cv(wue);return r.callee=e,r.arguments=t,r}function RR(e){var t=new Cv(qW);return t.name=e,t}function RC(e){var t=new Cv(kue);return t.value=e.value,t.raw=Ki.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function eV(e,t,r){var u=new Cv(Cue);return u.computed=e==="[",u.object=t,u.property=r,u.computed||(r.member=!0),u}function tV(e,t,r){var u=new Cv(Aue);return u.key=t,u.value=r,u.kind=e,u}function Cs(e,t){var r,u=Array.prototype.slice.call(arguments,2),l=t.replace(/%(\d)/g,function(d,b){return vD(b<u.length,"Message reference must be in range"),u[b]});throw(r=new Error(l)).index=$r,r.description=l,r}function bD(e){e.type===DC&&Cs(e,Mue),e.type===Yw&&Cs(e,Due),e.type===TC&&Cs(e,Tue),e.type===Kw&&Cs(e,Nue),e.type===mx&&Cs(e,Iue),Cs(e,Yf,e.value)}function Gd(e){var t=bm();t.type===ym&&t.value===e||bD(t)}function Lu(e){return $s.type===ym&&$s.value===e}function BR(e){return $s.type===mx&&$s.value===e}function Vue(){var e=[];for($r=$s.start,Gd("[");!Lu("]");)Lu(",")?(bm(),e.push(null)):(e.push(Xw()),Lu("]")||Gd(","));return bm(),function(t){var r=new Cv(bue);return r.elements=t,r}(e)}function nV(){var e;return $r=$s.start,(e=bm()).type===TC||e.type===Yw?(e.octal&&Cs(e,GW),RC(e)):RR(e.value)}function $ue(){var e,t,r;return $r=$s.start,(e=$s).type===Kw?(r=nV(),Gd(":"),tV("init",r,Xw())):e.type!==DC&&e.type!==ym?(t=nV(),Gd(":"),tV("init",t,Xw())):void bD(e)}function Hue(){var e,t,r=[],u={},l=String;for($r=$s.start,Gd("{");!Lu("}");)t="$"+((e=$ue()).key.type===qW?e.key.name:l(e.key.value)),Object.prototype.hasOwnProperty.call(u,t)?Cs({},Fue):u[t]=!0,r.push(e),Lu("}")||Gd(",");return Gd("}"),function(d){var b=new Cv(Sue);return b.properties=d,b}(r)}var que={if:1};function Gue(){var e,t,r;if(Lu("("))return function(){var u;return Gd("("),u=PR(),Gd(")"),u}();if(Lu("["))return Vue();if(Lu("{"))return Hue();if(e=$s.type,$r=$s.start,e===Kw||que[$s.value])r=RR(bm().value);else if(e===TC||e===Yw)$s.octal&&Cs($s,GW),r=RC(bm());else{if(e===mx)throw new Error(NC);e===mD?((t=bm()).value=t.value==="true",r=RC(t)):e===gD?((t=bm()).value=null,r=RC(t)):Lu("/")||Lu("/=")?(r=RC(Uue()),QW()):bD(bm())}return r}function Kue(){var e=[];
7840if(Gd("("),!Lu(")"))for(;$r<Hd&&(e.push(Xw()),!Lu(")"));)Gd(",");return Gd(")"),e}function Yue(){var e;return $r=$s.start,function(t){return t.type===Kw||t.type===mx||t.type===mD||t.type===gD}(e=bm())||bD(e),RR(e.value)}function Xue(){var e;return Gd("["),e=PR(),Gd("]"),e}function rV(){var e=function(){var t;for(t=Gue();;)if(Lu("."))Gd("."),t=eV(".",t,Yue());else if(Lu("("))t=Wue(t,Kue());else{if(!Lu("["))break;t=eV("[",t,Xue())}return t}();if($s.type===ym&&(Lu("++")||Lu("--")))throw new Error(NC);return e}function xD(){var e,t;if($s.type!==ym&&$s.type!==mx)t=rV();else{if(Lu("++")||Lu("--"))throw new Error(NC);if(Lu("+")||Lu("-")||Lu("~")||Lu("!"))e=bm(),t=xD(),t=function(r,u){var l=new Cv(Oue);return l.operator=r,l.argument=u,l.prefix=!0,l}(e.value,t);else{if(BR("delete")||BR("void")||BR("typeof"))throw new Error(NC);t=rV()}}return t}function iV(e){var t=0;if(e.type!==ym&&e.type!==mx)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function Xw(){var e,t;return e=function(){var r,u,l,d,b,k,T,j,$,G;if(r=$s,$=xD(),(b=iV(d=$s))===0)return $;for(d.prec=b,bm(),u=[r,$s],k=[$,d,T=xD()];(b=iV($s))>0;){for(;k.length>2&&b<=k[k.length-2].prec;)T=k.pop(),j=k.pop().value,$=k.pop(),u.pop(),l=ZW(j,$,T),k.push(l);(d=bm()).prec=b,k.push(d),u.push($s),l=xD(),k.push(l)}for(l=k[G=k.length-1],u.pop();G>1;)u.pop(),l=ZW(k[G-1].value,k[G-2],l),G-=2;return l}(),Lu("?")&&(bm(),t=Xw(),Gd(":"),e=function(r,u,l){var d=new Cv(_ue);return d.test=r,d.consequent=u,d.alternate=l,d}(e,t,Xw())),e}function PR(){var e=Xw();if(Lu(","))throw new Error(NC);return e}var Jue=function(e){$r=0,Hd=(Ki=e).length,$s=null,QW();var t=PR();if($s.type!==DC)throw new Error("Unexpect token after expression.");return t};function T_(e,t,r){return e.fields=t||[],e.fname=r,e}function Que(e){return e.length===1?Zue(e[0]):ece(e)}const Zue=e=>function(t){return t[e]},ece=e=>{const t=e.length;return function(r){for(let u=0;u<t;++u)r=r[e[u]];return r}};function jR(e){throw Error(e)}function tce(e){const t=[],r=e.length;let u,l,d,b=null,k=0,T="";function j(){t.push(T+e.substring(u,l)),T="",u=l+1}for(e+="",u=l=0;l<r;++l)if((d=e[l])==="\\")T+=e.substring(u,l),T+=e.substring(++l,++l),u=l;else if(d===b)j(),b=null,k=-1;else{if(b)continue;u===k&&d==='"'||u===k&&d==="'"?(u=l+1,b=d):d!=="."||k?d==="["?(l>u&&j(),k=u=l+1):d==="]"&&(k||jR("Access path missing open bracket: "+e),k>0&&j(),k=0,u=l+1):l>u?j():u=l+1}return k&&jR("Access path missing closing bracket: "+e),b&&jR("Access path missing closing quote: "+e),l>u&&(l++,j()),t}function nce(e,t,r){const u=tce(e);return e=u.length===1?u[0]:e,T_((r&&r.get||Que)(u),[e],t||e)}nce("id"),T_(e=>e,[],"identity"),T_(()=>0,[],"zero"),T_(()=>1,[],"one"),T_(()=>!0,[],"true"),T_(()=>!1,[],"false");function oV(e){const t=Jue(e),r=new Set;return t.visit(u=>{u.type==="MemberExpression"&&function l(d){return d.object.type==="MemberExpression"?l(d.object):d.object.name==="datum"}(u)&&r.add(function l(d){const b=[];return d.type==="Identifier"?[d.name]:d.type==="Literal"?[d.value]:(d.type==="MemberExpression"&&(b.push(...l(d.object)),b.push(...l(d.property))),b)}(u).slice(1).join("."))}),r}class N_ extends Js{constructor(t,r,u){super(t),this.model=r,this.filter=u,this.expr=wD(this.model,this.filter,this),this._dependentFields=oV(this.expr)}clone(){return new N_(null,this.model,Sa(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function aV(e,t,r,u="datum"){const l=[],d=fC(t,function(b){const k=nc(b),T=e.getSelectionComponent(k,b),j=ns(k+qw);if(T.project.timeUnit){const $=r??e.component.data.raw,G=T.project.timeUnit.clone();$.parent?G.insertAsParentOf($):$.parent=G}return T.empty!=="none"&&l.push(j),`vlSelectionTest(${j}, ${u}`+(T.resolve==="global"?")":`, ${ns(T.resolve)})`)});return(l.length?"!("+l.map(b=>`length(data(${b}))`).join(" || ")+") || ":"")+`(${d}
7840)`}function sV(e,t){const r=t.encoding;let u=t.field;if(r||u){if(r&&!u){const l=e.project.items.filter(d=>d.channel===r);!l.length||l.length>1?(u=e.project.items[0].field,li((l.length?"Multiple ":"No ")+`matching ${ns(r)} encoding found for selection ${ns(t.selection)}. Using "field": ${ns(u)}.`)):u=l[0].field}}else u=e.project.items[0].field,e.project.items.length>1&&li(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${ns(u)}.`);return`${e.name}[${ns(u)}]`}function wD(e,t,r){return fC(t,u=>Ca(u)?u:function(l){return l==null?void 0:l.selection}(u)?aV(e,u.selection,r):eU(u))}function LR(e,t,r,u){var l,d,b;e.encode=(l=e.encode)!==null&&l!==void 0?l:{},e.encode[t]=(d=e.encode[t])!==null&&d!==void 0?d:{},e.encode[t].update=(b=e.encode[t].update)!==null&&b!==void 0?b:{},e.encode[t].update[r]=u}function BC(e,t,r,u={header:!1}){var l,d;const b=e.combine(),{disable:k,orient:T,scale:j,labelExpr:$,title:G,zindex:te}=b,se=ao(b,["disable","orient","scale","labelExpr","title","zindex"]);if(!k){for(const he in se){const ve=Xie[he],Be=se[he];if(ve&&ve!==t&&ve!=="both")delete se[he];else if(kF(Be)){const{condition:ze}=Be,Ue=ao(Be,["condition"]),st=qc(ze),ut=xz[he];if(ut){const{vgProp:mt,part:pt}=ut;LR(se,pt,mt,[...st.map(Ct=>{const{test:Et}=Ct,mn=ao(Ct,["test"]);return Object.assign({test:wD(null,Et)},mn)}),Ue]),delete se[he]}else if(ut===null){const mt={signal:st.map(pt=>{const{test:Ct}=pt,Et=ao(pt,["test"]);return`${wD(null,Ct)} ? ${MU(Et)} : `}).join("")+MU(Ue)};se[he]=mt}}else if(Uo(Be)){const ze=xz[he];if(ze){const{vgProp:Ue,part:st}=ze;LR(se,st,Ue,Be),delete se[he]}}}if(t==="grid"){if(!se.grid)return;if(se.encode){const{grid:he}=se.encode;se.encode=Object.assign({},he?{grid:he}:{}),su(se.encode)&&delete se.encode}return Object.assign(Object.assign({scale:j,orient:T},se),{domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:dl(te,0)})}{if(!u.header&&e.mainExtracted)return;if($!==void 0){let ve=$;!((d=(l=se.encode)===null||l===void 0?void 0:l.labels)===null||d===void 0)&&d.update&&Uo(se.encode.labels.update.text)&&(ve=__($,"datum.label",se.encode.labels.update.text.signal)),LR(se,"labels","text",{signal:ve})}if(se.labelAlign===null&&delete se.labelAlign,se.encode){for(const ve of wz)e.hasAxisPart(ve)||delete se.encode[ve];su(se.encode)&&delete se.encode}const he=function(ve,Be){if(ve)return mo(ve)&&!fx(ve)?ve.map(ze=>DU(ze,Be)).join(", "):ve}(G,r);return Object.assign(Object.assign(Object.assign(Object.assign({scale:j,orient:T,grid:!1},he?{title:he}:{}),se),r.aria===!1?{aria:!1}:{}),{zindex:dl(te,0)})}}}function uV(e){const{axes:t}=e.component,r=[];for(const u of w0)if(t[u]){for(const l of t[u])if(!l.get("disable")&&!l.get("gridScale")){const d=u==="x"?"height":"width",b=e.getSizeSignalRef(d).signal;d!==b&&r.push({name:d,update:b})}}return r}const cV={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},lV={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},rce=di(cV),ice=di(lV);function fV(e,t,r,u){return Object.assign.apply(null,[{},...e.map(l=>{if(l==="axisOrient"){const d=r==="x"?"bottom":"left",b=t[r==="x"?"axisBottom":"axisLeft"]||{},k=t[r==="x"?"axisTop":"axisRight"]||{},T=new Set([...di(b),...di(k)]),j={};for(const $ of T.values())j[$]={signal:`${u.signal} === "${d}" ? ${_C(b[$])} : ${_C(k[$])}`};return j}return t[l]})])}function oce(e,t,r,u){const l=t==="band"?["axisDiscrete","axisBand"]:t==="point"?["axisDiscrete","axisPoint"]:function(j){return j in Qae}(t)?["axisQuantitative"]:t==="time"||t==="utc"?["axisTemporal"]:[],d=e==="x"?"axisX":"axisY",b=Uo(r)?"axisOrient":"axis"+A3(r),k=[...l,...l.map(j=>d+j.substr(4))],T=["axis",b,d];return{vlOnlyAxisConfig:fV(k,u,e,r),vgAxisConfig:fV(T,u,e,r),axisConfigStyle:function(j,$){var G;const te=[{}];for(const se of j){let he=(G=$[se])===null||G===void 0?void 0:G.style;if(he){he=qc(he);for(const ve of he)te.push($.style[ve])}}return Object.assign.apply(null,te)}([...T,...k],u)}}function zR(e,t,r,u={}){var l;const d=RU(e,r,t.style);if(d!==void 0)return{configFrom:"style",configValue:d};for(const b of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(((l=u[b])===null||l===void 0?void 0:l[e])!==void 0)return{configFrom:b,configValue:u[b][e]};return{}}const dV={scale:({model:e,channel:t})=>e.scaleName(t),format:({fieldOrDatumDef:e,config:t,axis:r})=>{const{format:u,formatType:l}=r;return dU(e,e.type,u,l,t,!0)},formatType:({axis:e,fieldOrDatumDef:t,scaleType:r})=>{const{formatType:u}=e;return hU(u,t,r)},grid:({fieldOrDatumDef:e,axis:t,scaleType:r})=>{var u;return(!Si(e)||!tp(e.bin))&&((u=t.grid)!==null&&u!==void 0?u:function(l,d){return!vm(l)&&Si(d)&&!Du(d==null?void 0:d.bin)}(r,e))},gridScale:({model:e,channel:t})=>function(r,u){const l=u==="x"?"y":"x";if(r.getScaleComponent(l))return r.scaleName(l)}(e,t),labelAlign:({axis:e,labelAngle:t,orient:r,channel:u})=>e.labelAlign||pV(t,r,u),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:r,channel:u})=>e.labelBaseline||hV(t,r,u),labelFlush:({axis:e,fieldOrDatumDef:t,channel:r})=>{var u;return(u=e.labelFlush)!==null&&u!==void 0?u:function(l,d){if(d==="x"&&bo(["quantitative","temporal"],l))return!0}(t.type,r)},labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:r})=>{var u;return(u=e.labelOverlap)!==null&&u!==void 0?u:function(l,d){if(l!=="nominal")return d!=="log"||"greedy"}(t.type,r)},orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:r,fieldOrDatumDef:u,scaleType:l})=>{var d;const b=e==="x"?"width":e==="y"?"height":void 0,k=b?t.getSizeSignalRef(b):void 0;return(d=r.tickCount)!==null&&d!==void 0?d:function({fieldOrDatumDef:T,scaleType:j,size:$,values:G}){var te;if(!G&&!vm(j)&&j!=="log"){if(Si(T)){if(Du(T.bin))return{signal:`ceil(${$.signal}/10)`};if(T.timeUnit&&bo(["month","hours","day","quarter"],(te=np(T.timeUnit))===null||te===void 0?void 0:te.unit))return}return{signal:`ceil(${$.signal}/40)`}}}({fieldOrDatumDef:u,scaleType:l,size:k,values:r.values})},title:({axis:e,model:t,channel:r})=>{if(e.title!==void 0)return e.title;const u=mV(t,r);if(u!==void 0)return u;const l=t.typedFieldDef(r),d=r==="x"?"x2":"y2",b=t.fieldDef(d);return PU(l?[xU(l)]:[],Si(b)?[xU(b)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(r,u){const l=r.values;if(mo(l))return NU(u,l);if(Uo(l))return l}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:r})=>{var u;return(u=e.zindex)!==null&&u!==void 0?u:function(l,d){return l==="rect"&&EU(d)?1:0}
7840(r,t)}};function UR(e){return`(((${e.signal} % 360) + 360) % 360)`}function hV(e,t,r,u){if(e!==void 0){if(r==="x"){if(Uo(e)){const l=UR(e);return{signal:`(45 < ${l} && ${l} < 135) || (225 < ${l} && ${l} < 315) ? "middle" :(${l} <= 45 || 315 <= ${l}) === ${Uo(t)?`(${t.signal} === "top")`:t==="top"} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(Uo(t)){const l=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${l} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==(t==="top")?"bottom":"top"}if(Uo(e)){const l=UR(e),d=Uo(t)?`(${t.signal} === "left")`:t==="left";return{signal:`${l} <= 45 || 315 <= ${l} || (135 <= ${l} && ${l} <= 225) ? ${u?'"middle"':"null"} : (45 <= ${l} && ${l} <= 135) === ${d} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return u?"middle":null;if(Uo(t)){const l=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${l} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==(t==="left")?"top":"bottom"}}function pV(e,t,r){if(e===void 0)return;const u=r==="x",l=u?0:90,d=u?"bottom":"left";if(Uo(e)){const b=UR(e),k=Uo(t)?`(${t.signal} === "${d}")`:t===d;return{signal:`(${l?"("+b+" + 90)":b} % 180 === 0) ? ${u?null:'"center"'} :(${l} < ${b} && ${b} < ${180+l}) === ${k} ? "left" : "right"`}}if((e+l)%180==0)return u?null:"center";if(Uo(t)){const b=l<e&&e<180+l?"===":"!==";return{signal:`${`${t.signal} ${b} "${d}"`} ? "left" : "right"`}}return(l<e&&e<180+l)==(t===d)?"left":"right"}function mV(e,t){const r=t==="x"?"x2":"y2",u=e.fieldDef(t),l=e.fieldDef(r),d=u?u.title:void 0,b=l?l.title:void 0;return d&&b?jU(d,b):d||b||(d!==void 0?d:b!==void 0?b:void 0)}class I_ extends Js{constructor(t,r){super(t),this.transform=r,this._dependentFields=oV(this.transform.calculate)}clone(){return new I_(null,Sa(this.transform))}static parseAllForSortIndex(t,r){return r.forEachFieldDef((u,l)=>{if(ZF(u)&&bU(u.sort)){const{field:d,timeUnit:b}=u,k=u.sort,T=k.map((j,$)=>`${eU({field:d,timeUnit:b,equal:j})} ? ${$} : `).join("")+k.length;t=new I_(t,{calculate:T,as:M_(u,l,{forAs:!0})})}}),t}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${cs(this.transform)}`}}function M_(e,t,r){return bi(e,Object.assign({prefix:t,suffix:"sort_index"},r??{}))}function _D(e,t){return bo(["top","bottom"],t)?"column":bo(["left","right"],t)||e==="row"?"row":"column"}function F_(e,t,r,u){const l=u==="row"?r.headerRow:u==="column"?r.headerColumn:r.headerFacet;return dl(((t==null?void 0:t.header)||{})[e],l[e],r.header[e])}function kD(e,t,r,u){const l={};for(const d of e){const b=F_(d,t,r,u);b!==void 0&&(l[d]=b)}return l}const WR=["row","column"],VR=["header","footer"];function ace(e,t){const r=e.component.layoutHeaders[t].title,u=e.config?e.config:void 0,l=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:d,titleAngle:b,titleOrient:k}=kD(["titleAnchor","titleAngle","titleOrient"],l,u,t),T=_D(t,k),j=O3(b);return{name:`${t}-title`,type:"group",role:`${T}-title`,title:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:r},t==="row"?{orient:"left"}:{}),{style:"guide-title"}),vV(j,T)),gV(T,j,d)),yV(u,l,t,rce,cV))}}function gV(e,t,r="middle"){switch(r){case"start":return{align:"left"};case"end":return{align:"right"}}const u=pV(t,e==="row"?"left":"top",e==="row"?"y":"x");return u?{align:u}:{}}function vV(e,t){const r=hV(e,t==="row"?"left":"top",t==="row"?"y":"x",!0);return r?{baseline:r}:{}}function sce(e,t){const r=e.component.layoutHeaders[t],u=[];for(const l of VR)if(r[l])for(const d of r[l]){const b=uce(e,t,l,r,d);b!=null&&u.push(b)}return u}function $R(e,t,r){const{format:u,formatType:l,labelAngle:d,labelAnchor:b,labelOrient:k,labelExpr:T}=kD(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e,r,t),j=qF({fieldOrDatumDef:e,format:u,formatType:l,expr:"parent",config:r}).signal,$=_D(t,k);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:{signal:T?__(__(T,"datum.label",j),"datum.value",bi(e,{expr:"parent"})):j}},t==="row"?{orient:"left"}:{}),{style:"guide-label",frame:"group"}),vV(d,$)),gV($,d,b)),yV(r,e,t,ice,lV))}function uce(e,t,r,u,l){if(l){let d=null;const{facetFieldDef:b}=u,k=e.config?e.config:void 0;if(b&&l.labels){const{labelOrient:G}=kD(["labelOrient"],b,k,t);(t==="row"&&!bo(["top","bottom"],G)||t==="column"&&!bo(["left","right"],G))&&(d=$R(b,t,k))}const T=Ov(e)&&!bC(e.facet),j=l.axes,$=(j==null?void 0:j.length)>0;if(d||$){const G=t==="row"?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName(`${t}_${r}`),type:"group",role:`${t}-${r}`},u.facetFieldDef?{from:{data:e.getName(t+"_domain")},sort:function(te,se){var he;const{sort:ve}=te;return Ky(ve)?{field:bi(ve,{expr:"datum"}),order:(he=ve.order)!==null&&he!==void 0?he:"ascending"}:mo(ve)?{field:M_(te,se,{expr:"datum"}),order:"ascending"}:{field:bi(te,{expr:"datum"}),order:ve??"ascending"}}(b,t)}:{}),$&&T?{from:{data:e.getName(`facet_domain_${t}`)}}:{}),d?{title:d}:{}),l.sizeSignal?{encode:{update:{[G]:l.sizeSignal}}}:{}),$?{axes:j}:{})}}return null}const cce={column:{start:0,end:1},row:{start:1,end:0}};function lce(e,t){return cce[t][e]}function yV(e,t,r,u,l){const d={};for(const b of u){if(!l[b])continue;
7840const k=F_(b,t,e,r);k!==void 0&&(d[l[b]]=k)}return d}function HR(e){return[...ED(e,"width"),...ED(e,"height"),...ED(e,"childWidth"),...ED(e,"childHeight")]}function ED(e,t){const r=t==="width"?"x":"y",u=e.component.layoutSize.get(t);if(!u||u==="merged")return[];const l=e.getSizeSignalRef(t).signal;if(u==="step"){const d=e.getScaleComponent(r);if(d){const b=d.get("type"),k=d.get("range");if(vm(b)&&sx(k)){const T=e.scaleName(r);return Ov(e.parent)&&e.parent.component.resolve.scale[r]==="independent"?[bV(T,k)]:[bV(T,k),{name:l,update:xV(T,d,`domain('${T}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if(u=="container"){const d=l.endsWith("width"),b=d?"containerSize()[0]":"containerSize()[1]",k=`isFinite(${b}) ? ${b} : ${gR(e.config.view,d?"width":"height")}`;return[{name:l,init:k,on:[{update:k,events:"window:resize"}]}]}return[{name:l,value:u}]}function bV(e,t){return{name:e+"_step",value:t.step}}function xV(e,t,r){const u=t.get("type"),l=t.get("padding"),d=dl(t.get("paddingOuter"),l);let b=t.get("paddingInner");return`bandspace(${r}, ${b=u==="band"?b!==void 0?b:l:1}, ${d}) * ${e}_step`}function wV(e){return e==="childWidth"?"width":e==="childHeight"?"height":e}function _V(e,t){return di(e).reduce((r,u)=>{const l=e[u];return Object.assign(Object.assign({},r),CC(t,l,u,d=>Uo(d)?d:{value:d.value}))},{})}function fce(e,t){if(j_(t)||Ov(t))return"shared";if(i5(t))return qy(e)?"independent":"shared";throw new Error("invalid model type for resolve")}function qR(e,t){const r=e.scale[t],u=qy(t)?"axis":"legend";return r==="independent"?(e[u][t]==="shared"&&li(re.independentScaleMeansIndependentGuide(t)),"independent"):e[u][t]||"shared"}const dce=Object.assign(Object.assign({},mse),{disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),kV=di(dce);class hce extends J1{}const EV={symbols:function(e,{fieldOrDatumDef:t,model:r,channel:u,legendCmpt:l,legendType:d}){var b,k,T,j,$;if(d!=="symbol")return;const{markDef:G,encoding:te,config:se,mark:he}=r,ve=G.filled&&he!=="trail";let Be=Object.assign(Object.assign({},function(Ue,st,ut){for(const mt of ut){const pt=Ww(mt,st.markDef,st.config);pt!==void 0&&(Ue[mt]=Gc(pt))}return Ue}({},r,toe)),SW(r,{filled:ve}));const ze=(b=CV(te.opacity))!==null&&b!==void 0?b:G.opacity;if(Be.fill){if(u==="fill"||ve&&u===mm)delete Be.fill;else if(Be.fill.field)l.get("symbolFillColor")?delete Be.fill:(Be.fill=Gc((k=se.legend.symbolBaseFillColor)!==null&&k!==void 0?k:"black"),Be.fillOpacity=Gc(ze??1));else if(mo(Be.fill)){const Ue=($=(j=GR((T=te.fill)!==null&&T!==void 0?T:te.color))!==null&&j!==void 0?j:G.fill)!==null&&$!==void 0?$:ve&&G.color;Ue&&(Be.fill=Gc(Ue))}}if(Be.stroke){if(u==="stroke"||!ve&&u===mm)delete Be.stroke;else if(Be.stroke.field)delete Be.stroke;else if(mo(Be.stroke)){const Ue=dl(GR(te.stroke||te.color),G.stroke,ve?G.color:void 0);Ue&&(Be.stroke={value:Ue})}}if(u!==K1){const Ue=Si(t)&&AV(r,l,t);Ue?Be.opacity=[Object.assign({test:Ue},Gc(ze??1)),Gc(se.legend.unselectedOpacity)]:ze&&(Be.opacity=Gc(ze))}return su(Be=Object.assign(Object.assign({},Be),e))?void 0:Be},gradient:function(e,{model:t,legendType:r}){if(r!=="gradient")return;let u={};const l=CV(t.encoding.opacity)||t.markDef.opacity;return l&&(u.opacity=Gc(l)),su(u=Object.assign(Object.assign({},u),e))?void 0:u},labels:function(e,{fieldOrDatumDef:t,model:r,channel:u,legendCmpt:l}){const d=r.legend(u)||{},b=r.config,k=Si(t)?AV(r,l,t):void 0,T=k?[{test:k,value:1},{value:b.legend.unselectedOpacity}]:void 0,{format:j,formatType:$}=d,G=Lw($)?GF({fieldOrDatumDef:t,field:"datum.value",format:j,formatType:$,config:b}):void 0,te=Object.assign(Object.assign(Object.assign({},T?{opacity:T}:{}),G?{text:G}:{}),e);return su(te)?void 0:te},entries:function(e,{legendCmpt:t}){const r=t.get("selections");return r!=null&&r.length?Object.assign(Object.assign({},e),{fill:{value:"transparent"}}):e}};function CV(e){return SV(e,(t,r)=>Math.max(t,r.value))}function GR(e){return SV(e,(t,r)=>dl(t,r.value))}function SV(e,t){return function(r){const u=r&&r.condition;return!!u&&(mo(u)||Y1(u))}(e)?qc(e.condition).reduce(t,e.value):Y1(e)?e.value:void 0}function AV(e,t,r){const u=t.get("selections");
7840if(!(u!=null&&u.length))return;const l=ns(r.field);return u.map(d=>`(!length(data(${ns(nc(d)+qw)})) || (${d}[${l}] && indexof(${d}[${l}], datum.value) >= 0))`).join(" || ")}const OV={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:r})=>{const{format:u,formatType:l}=t;return dU(e,e.type,u,l,r,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:r})=>{const{formatType:u}=e;return hU(u,t,r)},gradientLength:e=>{var t,r;const{legend:u,legendConfig:l}=e;return(r=(t=u.gradientLength)!==null&&t!==void 0?t:l.gradientLength)!==null&&r!==void 0?r:function({legendConfig:d,model:b,direction:k,orient:T,scaleType:j}){const{gradientHorizontalMaxLength:$,gradientHorizontalMinLength:G,gradientVerticalMaxLength:te,gradientVerticalMinLength:se}=d;if(kv(j))return k==="horizontal"?T==="top"||T==="bottom"?DV(b,"width",G,$):G:DV(b,"height",se,te)}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:r})=>{var u,l;return(l=(u=e.labelOverlap)!==null&&u!==void 0?u:t.labelOverlap)!==null&&l!==void 0?l:function(d){if(bo(["quantile","threshold","log"],d))return"greedy"}(r)},symbolType:({legend:e,markDef:t,channel:r,encoding:u})=>{var l;return(l=e.symbolType)!==null&&l!==void 0?l:function(d,b,k,T){var j;if(b!=="shape"){const $=(j=GR(k))!==null&&j!==void 0?j:T;if($)return $}switch(d){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,r,u.shape,t.shape)},title:({fieldOrDatumDef:e,config:t})=>zw(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:r})=>{if(k_(r)&&kv(t)){if(e==="gradient")return}else if(e==="symbol")return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(r,u){const l=r.values;if(mo(l))return NU(u,l);if(Uo(l))return l}(t,e)};function pce(e){const{legend:t}=e;return dl(t.type,function({channel:r,timeUnit:u,scaleType:l}){if(k_(r)){if(bo(["quarter","month","day"],u))return"symbol";if(kv(l))return"gradient"}return"symbol"}(e))}function mce({legendConfig:e,legendType:t,orient:r,legend:u}){var l,d;return(d=(l=u.direction)!==null&&l!==void 0?l:e[t?"gradientDirection":"symbolDirection"])!==null&&d!==void 0?d:function(b,k){switch(b){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return k==="gradient"?"horizontal":void 0}}(r,t)}function DV(e,t,r,u){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${r}, ${u})`}}function TV(e){const t=Sc(e)?function(r){const{encoding:u}=r,l={};for(const d of[mm,...eW]){const b=Bl(u[d]);b&&r.getScaleComponent(d)&&(d===gm&&Si(b)&&b.type===A_||(l[d]=vce(r,d)))}return l}(e):function(r){const{legends:u,resolve:l}=r.component;for(const d of r.children){TV(d);for(const b of di(d.component.legends))l.legend[b]=qR(r.component.resolve,b),l.legend[b]==="shared"&&(u[b]=NV(u[b],d.component.legends[b]),u[b]||(l.legend[b]="independent",delete u[b]))}for(const d of di(u))for(const b of r.children)b.component.legends[d]&&l.legend[d]==="shared"&&delete b.component.legends[d];return u}(e);return e.component.legends=t,t}function gce(e,t,r,u){switch(t){case"disable":return r!==void 0;case"values":return!!(r!=null&&r.values);case"title":if(t==="title"&&e===(u==null?void 0:u.title))return!0}return e===(r||{})[t]}function vce(e,t){var r,u,l;let d=e.legend(t);const{markDef:b,encoding:k,config:T}=e,j=T.legend,$=new hce({},function(pt,Ct){const Et=pt.scaleName(Ct);if(pt.mark==="trail"){if(Ct==="color")return{stroke:Et};if(Ct==="size")return{strokeWidth:Et}}return Ct==="color"?pt.markDef.filled?{fill:Et}:{stroke:Et}:{[Ct]:Et}}(e,t));(function(pt,Ct,Et){var mn;const An=(mn=pt.fieldDef(Ct))===null||mn===void 0?void 0:mn.field;Gw(pt,xn=>{var Wn,Un;const Kn=(Wn=xn.project.hasField[An])!==null&&Wn!==void 0?Wn:xn.project.hasChannel[Ct];if(Kn&&RW.has(xn)){const Qn=(Un=Et.get("selections"))!==null&&Un!==void 0?Un:[];Qn.push(xn.name),Et.set("selections",Qn,!1),Kn.hasLegend=!0}})})(e,t,$);const G=d!==void 0?!d:j.disable;if($.set("disable",G,d!==void 0),G)return $;d=d||{};const te=e.getScaleComponent(t).get("type"),se=Bl(k[t]),he=Si(se)?(r=np(se.timeUnit))===null||r===void 0?void 0:r.unit:void 0,ve=d.orient||T.legend.orient||"right",Be=pce({legend:d,channel:t,timeUnit:he,scaleType:te}),ze={legend:d,channel:t,model:e,markDef:b,encoding:k,fieldOrDatumDef:se,legendConfig:j,config:T,scaleType:te,orient:ve,legendType:Be,direction:mce({legend:d,legendT
7840ype:Be,orient:ve,legendConfig:j})};for(const pt of kV){const Ct=pt in OV?OV[pt](ze):d[pt];if(Ct!==void 0){const Et=gce(Ct,pt,d,e.fieldDef(t));(Et||T.legend[pt]===void 0)&&$.set(pt,Ct,Et)}}const Ue=(u=d==null?void 0:d.encoding)!==null&&u!==void 0?u:{},st=$.get("selections"),ut={},mt={fieldOrDatumDef:se,model:e,channel:t,legendCmpt:$,legendType:Be};for(const pt of["labels","legend","title","symbols","gradient","entries"]){const Ct=_V((l=Ue[pt])!==null&&l!==void 0?l:{},e),Et=pt in EV?EV[pt](Ct,mt):Ct;Et===void 0||su(Et)||(ut[pt]=Object.assign(Object.assign(Object.assign({},st!=null&&st.length&&Si(se)?{name:`${nc(se.field)}_legend_${pt}`}:{}),st!=null&&st.length?{interactive:!!st}:{}),{update:Et}))}return su(ut)||$.set("encode",ut,!!(d!=null&&d.encoding)),$}function NV(e,t){var r,u,l,d;if(!e)return t.clone();const b=e.getWithExplicit("orient"),k=t.getWithExplicit("orient");if(b.explicit&&k.explicit&&b.value!==k.value)return;let T=!1;for(const j of kV){const $=dx(e.getWithExplicit(j),t.getWithExplicit(j),j,"legend",(G,te)=>{switch(j){case"symbolType":return yce(G,te);case"title":return LU(G,te);case"type":return T=!0,Ev("symbol")}return sD(G,te,j,"legend")});e.setWithExplicit(j,$)}return T&&(!((u=(r=e.implicit)===null||r===void 0?void 0:r.encode)===null||u===void 0)&&u.gradient&&wF(e.implicit,["encode","gradient"]),!((d=(l=e.explicit)===null||l===void 0?void 0:l.encode)===null||d===void 0)&&d.gradient&&wF(e.explicit,["encode","gradient"])),e}function yce(e,t){return t.value==="circle"?t:e}function IV(e,t,r,u){var l,d,b;e.encode=(l=e.encode)!==null&&l!==void 0?l:{},e.encode[t]=(d=e.encode[t])!==null&&d!==void 0?d:{},e.encode[t].update=(b=e.encode[t].update)!==null&&b!==void 0?b:{},e.encode[t].update[r]=u}function MV(e){const t=e.component.legends,r={};for(const u of di(t)){const l=e.getScaleComponent(u),d=tc(l.get("domains"));if(r[d])for(const b of r[d])NV(b,t[u])||r[d].push(t[u]);else r[d]=[t[u].clone()]}return Jb(r).flat().map(u=>function(l,d){var b,k,T;const j=l.combine(),{disable:$,labelExpr:G,selections:te}=j,se=ao(j,["disable","labelExpr","selections"]);if(!$){if(d.aria===!1&&se.aria==null&&(se.aria=!1),!((b=se.encode)===null||b===void 0)&&b.symbols){const he=se.encode.symbols.update;!he.fill||he.fill.value==="transparent"||he.stroke||se.stroke||(he.stroke={value:"transparent"});for(const ve of eW)se[ve]&&delete he[ve]}if(se.title||delete se.title,G!==void 0){let he=G;!((T=(k=se.encode)===null||k===void 0?void 0:k.labels)===null||T===void 0)&&T.update&&Uo(se.encode.labels.update.text)&&(he=__(G,"datum.label",se.encode.labels.update.text.signal)),IV(se,"labels","text",{signal:he})}for(const he in se){const ve=se[he];if(Uo(ve)){const Be=pse[he];if(Be){const{vgProp:ze,part:Ue}=Be;IV(se,Ue,ze,ve),delete se[he]}}}return se}}(u,e.config)).filter(u=>u!==void 0)}function bce(e){return j_(e)||i5(e)?function(t){return t.children.reduce((r,u)=>r.concat(u.assembleProjections()),FV(t))}(e):FV(e)}function FV(e){const t=e.component.projection;if(!t||t.merged)return[];const r=t.combine(),{name:u}=r;if(t.data){const l={signal:`[${t.size.map(b=>b.signal).join(", ")}]`},d=t.data.reduce((b,k)=>{const T=Uo(k)?k.signal:`data('${e.lookupDataSource(k)}')`;return bo(b,T)||b.push(T),b},[]);if(d.length<=0)throw new Error("Projection's fit didn't find any data sources");return[Object.assign({name:u,size:l,fit:{signal:d.length>1?`[${d.join(", ")}]`:d[0]}},r)]}return[Object.assign(Object.assign({name:u},{translate:{signal:"[width / 2, height / 2]"}}),r)]}const xce=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class RV extends J1{constructor(t,r,u,l){super(Object.assign({},r),{name:t}),this.specifiedProjection=r,this.size=u,this.data=l,this.merged=!1}get isFit(){return!!this.data}}function BV(e){e.component.projection=Sc(e)?function(t){var r;if(t.hasProjection){const u=t.specifiedProjection,l=!(u&&(u.scale!=null||u.translate!=null)),d=l?[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]:void 0,b=l?function(k){const T=[],{encoding:j}=k;for(const $ of[[Uy,zy],[b0,_v]])(Bl(j[$[0]])||Bl(j[$[1]]))&&T.push({signal:k.getName(`geojson_${T.length}`)});return k.channelHasField(gm)&&k.typedFieldDef(gm).type===A_&&T.push({signal:k.getName(`geojson_${T.length}`)}),T.length===0&&T.push(k.requestDataName(Vd)),T}(t):void 0;return new RV(t.projectionName(!0),Object.assign(Object.assign({},(r=t.config.projection)!==null&&r!==void 0?r:{}),u??{}),d,b)}}(e):function(t){if(t.children.length===0)return;let r;for(const l of t.children)BV(l);const u=hz(t.children,l=>{const d=l.component.projection;if(d){if(r){const b=function(k,T){const j=hz(xce,$=>!Tw(k.explicit,$)&&!Tw(T.explicit,$)||!(!Tw(k.explicit,$)||!Tw(T.explicit,$)||tc(k.get($))!==tc(T.get($))));if(tc(k.size)===tc(T.size)){if(j)return k;if(tc(k.explicit)===tc({}))return T;if(tc(T.explicit)===tc({}))return k}return null}(r,d);return b&&(r=b),!!b}return r=d,!0}return!0});if(r&&u){const l=t.projectionName(!0),d=new RV(l,r.specifiedProjection,r.size,Sa(r.data));for(const b of t.children){const k=b.component.projection;k&&(k.isFit&&d.data.push(...b.component.projection.data),b.renameProjection(k.get("name"),l),k.merged=!0)}return d}}(e)}function PV(e,t){return`${Uz(e)}_${t}`}function KR(e,t,r){var u;const l=PV((u=Z3(r,void 0))!==null&&u!==void 0?u:{},t);return e.getName(`${l}_bins`)}function jV(e,t,r){let u,l;u=function(j){return"as"in j}(e)?Ca(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[bi(e,{forAs:!0}),bi(e,{binSuffix:"end",forAs:!0})];const d=Object.assign({},Z3(t,void 0)),b=PV(d,e.field),{signal:k,extentSignal:T}=function(j,$){return{signal:j.getName(`${$}_bins`),extentSignal:j.getName(`${$}_extent`)}}(r,b);if(V3(d.extent)){const j=d.extent,$=j.selection;l=sV(r.getSelectionComponent(nc($),$),j),delete d.extent}return{key:b,binComponent:Object.assign(Object.assign(Object.assign({bin:d,field:e.field,as:[u]},k?{signal:k}:{}),T?{extentSignal:T}:{}),l?{span:l}:{})}}class e1 extends Js{constructor(t,r){super(t),this.bins=r}clone(){return new e1(null,Sa(this.bins))}static makeFromEncoding(t,r){const u=r.reduceFieldDef((l,d,b)=>{if(Cg(d)&&Du(d.bin)){const{key:k,binComponent:T}=jV(d,d.bin,r);l[k]=Object.assign(Object.assign(Object.assign({},T),l[k]),function(j,$,G,te){var se,he;if(wC($,G)){const ve=Sc(j)&&(he=(se=j.axis(G))!==null&&se!==void 0?se:j.legend(G))!==null&&he!==void 0?he:{},Be=bi($,{expr:"datum"}),ze=bi($,{expr:"datum",binSuffix:"end"});return{formulaAs:bi($,{binSuffix:"range",forAs:!0}),formula:G3(Be,ze,ve.format,ve.formatType,te)}}return{}}(r,d,b,r.config))}return l},{});return su(u)?null:new e1(t,u)}static makeFromTransform(t,r,u){const{key:l,binComponent:d}=jV(r,r.bin,u);return new e1(t,{[l]:d})}merge(t,r){for(const u of di(t.bins))u in this.bins?(r(t.bins[u].signal,this.bins[u].signal),this.bins[u].as=Xb([...this.bins[u].as,...t.bins[u].as],cs)):this.bins[u]=t.bins[u];for(const u of t.children)t.removeChild(u),u.parent=this;t.remove()}producedFields(){return new Set(Jb(this.bins).map(t=>t.as).flat(2))}dependentFields(){return new Set(Jb(this.bins).map(t=>t.field))}hash(){return`Bin ${cs(this.bins)}`}assemble(){return Jb(this.bins).flatMap(t=>{const r=[],[u,...l]=t.as,d=t.bin,{extent:b}=d,k=ao(d,["extent"]),T=Object.assign(Object.assign(Object.assign({type:"bin",field:Qb(t.field),as:u,signal:t.signal},V3(b)?{extent:null}:{extent:b}),t.span?{span:{signal:`span(${t.span})`}}:{}),k);!b&&t.extentSignal&&(r.push({type:"extent",field:Qb(t.field),signal:t.extentSignal}),T.extent={signal:t.extentSignal}),r.push(T);for(const j of l)for(let $=0;$<2;$++)r.push({type:"formula",expr:bi({field:u[$]},{expr:"datum"}),as:j[$]});return t.formula&&r.push({type:"formula",expr:t.formula,as:t.formulaAs}),r})}}class R_ extends Js{constructor(t){let r;if(super(null),Hw(t=t??{name:"source"})||(r=t.format?Object.assign({},U1(t.format,["parse"])):{}),uD(t))this._data={values:t.values};else if(EC(t)){if(this._data={url:t.url},!r.type){let u=/(?:\.([^.]+))?$/.exec(t.url)[1];bo(["json","csv","tsv","dsv","topojson"],u)||(u="json"),r.type=u}}else wW(t)?this._data={values:[{type:"Sphere"}]}:(bW(t)||Hw(t))&&(this._data={});this._generator=Hw(t),t.name&&(this._name=t.name),r&&!su(r)&&(this._data.format=r)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(t){this._name=t}set parent(t){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return Object.assign(Object.assign({name:this._name},this._data),{transform:[]})}}function YR(e){for(const t of e){for(const r of t.children)if(r.parent!==t)return console.error("Dataflow graph is inconsistent.",t,r),!1;if(!YR(t.children))return!1}return!0}class PC extends Js{constructor(t,r){super(t),this.params=r}clone(){return new PC(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${cs(this.params)}`}assemble(){return Object.assign({type:"graticule"},this.params===!0?{}:this.params)}}class jC extends Js{constructor(t,r){super(t),this.params=r}clone(){return new jC(null,this.params)}dependentFields(){return new Set}producedFields(){var t;return new Set([(t=this.params.as)!==null&&t!==void 0?t:"data"])}hash(){return`Hash ${cs(this.params)}`}assemble(){return Object.assign({type:"sequence"},this.params)}}function CD(e){return e instanceof R_||e instanceof PC||e instanceof jC}class LV{constructor(){this._mutated=!1}setMutated(){this._mutated=!0}get mutatedFlag(){return this._mutated}}class tb extends LV{constructor(){super(),this._continue=!1}setContinue(){this._continue=!0}get continueFlag(){return this._continue}get flags(){return{continueFlag:this.continueFlag,mutatedFlag:this.mutatedFlag}}set flags({continueFlag:t,mutatedFlag:r}){t&&this.setContinue(),r&&this.setMutated()}reset(){}optimizeNextFromLeaves(t){if(CD(t))return!1;const r=t.parent,{continueFlag:u}=this.run(t);return u&&this.optimizeNextFromLeaves(r),this.mutatedFlag}}class XR extends LV{}function wce(e,t,r,u){const l=Sc(u)?u.encoding[$y(t)]:void 0;if(Cg(r)&&Sc(u)&&YF(t,r,l,u.stack,u.markDef,u.config))e.add(bi(r,{})),e.add(bi(r,{suffix:"end"})),r.bin&&wC(r,t)&&e.add(bi(r,{binSuffix:"range"}));else if(function(d){return d in OF}(t)){const d=function(b){switch(b){case zy:return"y";case _v:return"y2";case Uy:return"x";case b0:return"x2"}}(t);e.add(u.getName(d))}else e.add(bi(r));return e}class Sv extends Js{constructor(t,r,u){super(t),this.dimensions=r,this.measures=u}clone(){return new Sv(null,new Set(this.dimensions),Sa(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(t,r){let u=!1;r.forEachFieldDef(b=>{b.aggregate&&(u=!0)});const l={},d=new Set;return u?(r.forEachFieldDef((b,k)=>{var T,j,$,G;const{aggregate:te,field:se}=b;if(te)if(te==="count")l["*"]=(T=l["*"])!==null&&T!==void 0?T:{},l["*"].count=new Set([bi(b,{forAs:!0})]);else{if(Zb(te)||Mw(te)){const he=Zb(te)?"argmin":"argmax",ve=te[he];l[ve]=(j=l[ve])!==null&&j!==void 0?j:{},l[ve][he]=new Set([bi({op:he,field:ve},{forAs:!0})])}else l[se]=($=l[se])!==null&&$!==void 0?$:{},l[se][te]=new Set([bi(b,{forAs:!0})]);ax(k)&&r.scaleDomain(k)==="unaggregated"&&(l[se]=(G=l[se])!==null&&G!==void 0?G:{},l[se].min=new Set([bi({field:se,aggregate:"min"},{forAs:!0})]),l[se].max=new Set([bi({field:se,aggregate:"max"},{forAs:!0})]))}else wce(d,k,b,r)}),d.size+di(l).length===0?null:new Sv(t,d,l)):null}static makeFromTransform(t,r){var u,l,d;const b=new Set,k={};for(const T of r.aggregate){const{op:j,field:$,as:G}=T;j&&(j==="count"?(k["*"]=(u=k["*"])!==null&&u!==void 0?u:{},k["*"].count=new Set([G||bi(T,{forAs:!0})])):(k[$]=(l=k[$])!==null&&l!==void 0?l:{},k[$][j]=new Set([G||bi(T,{forAs:!0})])))}for(const T of(d=r.groupby)!==null&&d!==void 0?d:[])b.add(T);return b.size+di(k).length===0?null:new Sv(t,b,k)}merge(t){return function(r,u){if(r.size!==u.size)return!1;for(const l of r)if(!u.has(l))return!1;return!0}(this.dimensions,t.dimensions)?(function(r,u){var l;
7840for(const d of di(u)){const b=u[d];for(const k of di(b))d in r?r[d][k]=new Set([...(l=r[d][k])!==null&&l!==void 0?l:[],...b[k]]):r[d]={[k]:b[k]}}}(this.measures,t.measures),!0):(function(...r){$3.debug(...r)}("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...di(this.measures)])}producedFields(){const t=new Set;for(const r of di(this.measures))for(const u of di(this.measures[r])){const l=this.measures[r][u];l.size===0?t.add(`${u}_${r}`):l.forEach(t.add,t)}return t}hash(){return`Aggregate ${cs({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],r=[],u=[];for(const l of di(this.measures))for(const d of di(this.measures[l]))for(const b of this.measures[l][d])u.push(b),t.push(d),r.push(l==="*"?null:Qb(l));return{type:"aggregate",groupby:[...this.dimensions].map(Qb),ops:t,fields:r,as:u}}}class B_ extends Js{constructor(t,r,u,l){super(t),this.model=r,this.name=u,this.data=l;for(const d of x0){const b=r.facet[d];if(b){const{bin:k,sort:T}=b;this[d]=Object.assign({name:r.getName(`${d}_domain`),fields:[bi(b),...Du(k)?[bi(b,{binSuffix:"end"})]:[]]},Ky(T)?{sortField:T}:mo(T)?{sortIndexField:M_(b,d)}:{})}}this.childModel=r.child}hash(){let t="Facet";for(const r of x0)this[r]&&(t+=` ${r.charAt(0)}:${cs(this[r])}`);return t}get fields(){var t;const r=[];for(const u of x0)!((t=this[u])===null||t===void 0)&&t.fields&&r.push(...this[u].fields);return r}dependentFields(){const t=new Set(this.fields);for(const r of x0)this[r]&&(this[r].sortField&&t.add(this[r].sortField.field),this[r].sortIndexField&&t.add(this[r].sortIndexField));return t}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const t={};for(const r of w0){const u=this.childModel.component.scales[r];if(u&&!u.merged){const l=u.get("type"),d=u.get("range");if(vm(l)&&sx(d)){const b=n5(AD(this.childModel,r));b?t[r]=b:li(`Unknown field for ${r}. Cannot calculate view size.`)}}}return t}assembleRowColumnHeaderData(t,r,u){const l={row:"y",column:"x"}[t],d=[],b=[],k=[];u&&u[l]&&(r?(d.push(`distinct_${u[l]}`),b.push("max")):(d.push(u[l]),b.push("distinct")),k.push(`distinct_${u[l]}`));const{sortField:T,sortIndexField:j}=this[t];if(T){const{op:$=K3,field:G}=T;d.push(G),b.push($),k.push(bi(T,{forAs:!0}))}else j&&(d.push(j),b.push("max"),k.push(j));return{name:this[t].name,source:r??this.data,transform:[Object.assign({type:"aggregate",groupby:this[t].fields},d.length?{fields:d,ops:b,as:k}:{})]}}assembleFacetHeaderData(t){var r,u;const{columns:l}=this.model.layout,{layoutHeaders:d}=this.model.component,b=[],k={};for(const $ of WR){for(const G of VR){const te=(r=d[$]&&d[$][G])!==null&&r!==void 0?r:[];for(const se of te)if(((u=se.axes)===null||u===void 0?void 0:u.length)>0){k[$]=!0;break}}if(k[$]){const G=`length(data("${this.facet.name}"))`,te=$==="row"?l?{signal:`ceil(${G} / ${l})`}:1:l?{signal:`min(${G}, ${l})`}:{signal:G};b.push({name:`${this.facet.name}_${$}`,transform:[{type:"sequence",start:0,stop:te}]})}}const{row:T,column:j}=k;return(T||j)&&b.unshift(this.assembleRowColumnHeaderData("facet",null,t)),b}assemble(){var t,r;const u=[];let l=null;const d=this.getChildIndependentFieldsWithStep(),{column:b,row:k,facet:T}=this;if(b&&k&&(d.x||d.y)){l=`cross_${this.column.name}_${this.row.name}`;const j=[].concat((t=d.x)!==null&&t!==void 0?t:[],(r=d.y)!==null&&r!==void 0?r:[]),$=j.map(()=>"distinct");u.push({name:l,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:j,ops:$}]})}for(const j of[$1,V1])this[j]&&u.push(this.assembleRowColumnHeaderData(j,l,d));if(T){const j=this.assembleFacetHeaderData(d);j&&u.push(...j)}return u}}function zV(e){return e[0]==="'"&&e[e.length-1]==="'"||e[0]==='"'&&e[e.length-1]==='"'?e.slice(1,-1):e}function _ce(e){const t={};return function r(u,l){if(xF(u))r(u.not,l);else if(bF(u))for(const d of u.and)r(d,l);else if(yF(u))for(const d of u.or)r(d,l);else l(u)}(e.filter,r=>{var u;if(Zz(r)){let l=null;PF(r)?l=r.equal:jF(r)?l=r.range[0]:LF(r)&&(l=((u=r.oneOf)!==null&&u!==void 0?u:r.in)[0]),l&&(E_(l)?t[r.field]="date":fl(l)?t[r.field]="number":Ca(l)&&(t[r.field]="string")),r.timeUnit&&(t[r.field]="date")}}),t}function kce(e){const t={};function r(u){eD(u)?t[u.field]="date":u.type==="quantitative"&&function(l){return Ca(l)&&bo(["min","max"],l)}(u.aggregate)?t[u.field]="number":dC(u.field)>1?u.field in t||(t[u.field]="flatten"):ZF(u)&&Ky(u.sort)&&dC(u.sort.field)>1&&(u.sort.field in t||(t[u.sort.field]="flatten"))}if((Sc(e)||Ov(e))&&e.forEachFieldDef((u,l)=>{if(Cg(u))r(u);else{const d=Bw(l),b=e.fieldDef(d);r(Object.assign(Object.assign({},u),{type:b.type}))}}),Sc(e)){const{mark:u,markDef:l,encoding:d}=e;if(Iw(u)&&!e.encoding.order){const b=d[l.orient==="horizontal"?"y":"x"];!Si(b)||b.type!=="quantitative"||b.field in t||(t[b.field]="number")}}return t}class Kd extends Js{constructor(t,r){super(t),this._parse=r}clone(){return new Kd(null,Sa(this._parse))}hash(){return`Parse ${cs(this._parse)}`}static makeExplicit(t,r,u){let l={};const d=r.data;return!Hw(d)&&d&&d.format&&d.format.parse&&(l=d.format.parse),this.makeWithAncestors(t,l,{},u)}static makeWithAncestors(t,r,u,l){for(const k of di(u)){const T=l.getWithExplicit(k);T.value!==void 0&&(T.explicit||T.value===u[k]||T.value==="derived"||u[k]==="flatten"?delete u[k]:li(re.differentParse(k,u[k],T.value)))}for(const k of di(r)){const T=l.get(k);T!==void 0&&(T===r[k]?delete r[k]:li(re.differentParse(k,r[k],T)))}const d=new J1(r,u);l.copyAll(d);const b={};for(const k of di(d.combine())){const T=d.get(k);T!==null&&(b[k]=T)}return di(b).length===0||l.parseNothing?null:new Kd(t,b)}get parse(){return this._parse}merge(t){this._parse=Object.assign(Object.assign({},this._parse),t.parse),t.remove()}assembleFormatParse(){const t={};for(const r of di(this._parse)){const u=this._parse[r];dC(r)===1&&(t[r]=u)}return t}producedFields(){return new Set(di(this._parse))}dependentFields(){return new Set(di(this._parse))}assembleTransforms(t=!1){return di(this._parse).filter(r=>!t||dC(r)>1).map(r=>{const u=function(l,d){const b=yz(l);return d==="number"?`toNumber(${b}
7840)`:d==="boolean"?`toBoolean(${b})`:d==="string"?`toString(${b})`:d==="date"?`toDate(${b})`:d==="flatten"?b:d.indexOf("date:")===0?`timeParse(${b},'${zV(d.slice(5,d.length))}')`:d.indexOf("utc:")===0?`utcParse(${b},'${zV(d.slice(4,d.length))}')`:(li(re.unrecognizedParse(d)),null)}(r,this._parse[r]);return u?{type:"formula",expr:u,as:bz(r)}:null}).filter(r=>r!==null)}}class gx extends Js{clone(){return new gx(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([O_])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:O_}}}class Jw extends Js{constructor(t,r){super(t),this.transform=r}clone(){return new Jw(null,Sa(this.transform))}addDimensions(t){this.transform.groupby=Xb(this.transform.groupby.concat(t),r=>r)}dependentFields(){const t=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t.add,t),this.transform.joinaggregate.map(r=>r.field).filter(r=>r!==void 0).forEach(t.add,t),t}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(t){var r;return(r=t.as)!==null&&r!==void 0?r:bi(t)}hash(){return`JoinAggregateTransform ${cs(this.transform)}`}assemble(){const t=[],r=[],u=[];for(const d of this.transform.joinaggregate)r.push(d.op),u.push(this.getDefaultName(d)),t.push(d.field===void 0?null:d.field);const l=this.transform.groupby;return Object.assign({type:"joinaggregate",as:u,ops:r,fields:t},l!==void 0?{groupby:l}:{})}}class nb extends Js{constructor(t,r){super(t),this._stack=r}clone(){return new nb(null,Sa(this._stack))}static makeFromTransform(t,r){const{stack:u,groupby:l,as:d,offset:b="zero"}=r,k=[],T=[];if(r.sort!==void 0)for(const G of r.sort)k.push(G.field),T.push(dl(G.order,"ascending"));const j={field:k,order:T};let $;return $=function(G){return mo(G)&&G.every(te=>Ca(te))&&G.length>1}(d)?d:Ca(d)?[d,d+"_end"]:[r.stack+"_start",r.stack+"_end"],new nb(t,{stackField:u,groupby:l,offset:b,sort:j,facetby:[],as:$})}static makeFromEncoding(t,r){const u=r.stack,{encoding:l}=r;if(!u)return null;const{groupbyChannel:d,fieldChannel:b,offset:k,impute:T}=u;let j;d&&(j=Xy(l[d]));const $=function(se){return se.stack.stackBy.reduce((he,ve)=>{const Be=bi(ve.fieldDef);return Be&&he.push(Be),he},[])}(r),G=r.encoding.order;let te;return te=mo(G)||Si(G)?BU(G):$.reduce((se,he)=>
7840(se.field.push(he),se.order.push(b==="y"?"descending":"ascending"),se),{field:[],order:[]}),new nb(t,{dimensionFieldDef:j,stackField:r.vgField(b),facetby:[],stackby:$,sort:te,offset:k,impute:T,as:[r.vgField(b,{suffix:"start",forAs:!0}),r.vgField(b,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(t){this._stack.facetby.push(...t)}dependentFields(){const t=new Set;return t.add(this._stack.stackField),this.getGroupbyFields().forEach(t.add,t),this._stack.facetby.forEach(t.add,t),this._stack.sort.field.forEach(t.add,t),t}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${cs(this._stack)}`}getGroupbyFields(){const{dimensionFieldDef:t,impute:r,groupby:u}=this._stack;return t?t.bin?r?[bi(t,{binSuffix:"mid"})]:[bi(t,{}),bi(t,{binSuffix:"end"})]:[bi(t)]:u??[]}assemble(){const t=[],{facetby:r,dimensionFieldDef:u,stackField:l,stackby:d,sort:b,offset:k,impute:T,as:j}=this._stack;if(T&&u){const{band:$=.5,bin:G}=u;G&&t.push({type:"formula",expr:`${$}*`+bi(u,{expr:"datum"})+`+${1-$}*`+bi(u,{expr:"datum",binSuffix:"end"}),as:bi(u,{binSuffix:"mid",forAs:!0})}),t.push({type:"impute",field:l,groupby:[...d,...r],key:bi(u,{binSuffix:"mid"}),method:"value",value:0})}return t.push({type:"stack",groupby:[...this.getGroupbyFields(),...r],field:l,sort:b,as:j,offset:k}),t}}class P_ extends Js{constructor(t,r){super(t),this.transform=r}clone(){return new P_(null,Sa(this.transform))}addDimensions(t){this.transform.groupby=Xb(this.transform.groupby.concat(t),r=>r)}dependentFields(){var t,r;const u=new Set;return((t=this.transform.groupby)!==null&&t!==void 0?t:[]).forEach(u.add,u),((r=this.transform.sort)!==null&&r!==void 0?r:[]).forEach(l=>u.add(l.field)),this.transform.window.map(l=>l.field).filter(l=>l!==void 0).forEach(u.add,u),u}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(t){var r;return(r=t.as)!==null&&r!==void 0?r:bi(t)}hash(){return`WindowTransform ${cs(this.transform)}`}assemble(){var t;const r=[],u=[],l=[],d=[];for(const te of this.transform.window)u.push(te.op),l.push(this.getDefaultName(te)),d.push(te.param===void 0?null:te.param),r.push(te.field===void 0?null:te.field);const b=this.transform.frame,k=this.transform.groupby;if(b&&b[0]===null&&b[1]===null&&u.every(te=>AF(te)))return Object.assign({type:"joinaggregate",as:l,ops:u,fields:r},k!==void 0?{groupby:k}:{});const T=[],j=[];if(this.transform.sort!==void 0)for(const te of this.transform.sort)T.push(te.field),j.push((t=te.order)!==null&&t!==void 0?t:"ascending");const $={field:T,order:j},G=this.transform.ignorePeers;return Object.assign(Object.assign(Object.assign({type:"window",params:d,as:l,ops:u,fields:r,sort:$},G!==void 0?{ignorePeers:G}:{}),k!==void 0?{groupby:k}:{}),b!==void 0?{frame:b}:{})}}class Ece extends tb{run(t){const r=t.parent;if(t instanceof Kd){if(CD(r))return this.flags;if(r.numChildren()>1)return this.setContinue(),this.flags;if(r instanceof Kd)this.setMutated(),r.merge(t);else{if(gz(r.producedFields(),t.dependentFields()))return this.setContinue(),this.flags;this.setMutated(),t.swapWithParent()}}return this.setContinue(),this.flags}}class Cce extends XR{mergeNodes(t,r){const u=r.shift();for(const l of r)t.removeChild(l),l.parent=u,l.remove()}run(t){const r=t.children.map(l=>l.hash()),u={};for(let l=0;l<r.length;l++)u[r[l]]===void 0?u[r[l]]=[t.children[l]]:u[r[l]].push(t.children[l]);for(const l of di(u))u[l].length>1&&(this.setMutated(),this.mergeNodes(t,u[l]));for(const l of t.children)this.run(l);return this.mutatedFlag}}class Sce extends tb{run(t){return t instanceof rp||t.numChildren()>0||t instanceof B_?this.flags:(this.setMutated(),t.remove(),this.flags)}}class Ace extends tb{constructor(){super(...arguments),this.fields=new Set,this.prev=null}run(t){if(this.setContinue(),t instanceof Qy){const r=t.producedFields();pz(r,this.fields)?(this.setMutated(),this.prev.remove()):this.fields=new Set([...this.fields,...r]),this.prev=t}return this.flags}reset(){this.fields.clear()}}class Oce extends tb{run(t){this.setContinue();const r=t.parent.children.filter(l=>l instanceof Qy),u=r.pop();for(const l of r)this.setMutated(),u.merge(l);return this.flags}}function JR(e){if(e instanceof B_)if(e.numChildren()!==1||e.children[0]instanceof rp){const t=e.model.component.data.main;(function l(d){if(d instanceof rp&&d.type===Vd&&d.numChildren()===1){const b=d.children[0];b instanceof B_||(b.swapWithParent(),l(d))}})(t);const r=function(l){return function d(b){if(!(b instanceof B_)){const k=b.clone();if(k instanceof rp){const T=QR+k.getSource();k.setSource(T),l.model.component.data.outputNodes[T]=k}
7840else(k instanceof Sv||k instanceof nb||k instanceof P_||k instanceof Jw)&&k.addDimensions(l.fields);for(const T of b.children.flatMap(d))T.parent=k;return[k]}return b.children.flatMap(d)}}(e),u=e.children.map(r).flat();for(const l of u)l.parent=t}else{const t=e.children[0];(t instanceof Sv||t instanceof nb||t instanceof P_||t instanceof Jw)&&t.addDimensions(e.fields),t.swapWithParent(),JR(e)}else e.children.map(JR)}class Dce extends XR{constructor(){super()}run(t){t instanceof rp&&!t.isRequired()&&(this.setMutated(),t.remove());for(const r of t.children)this.run(r);return this.mutatedFlag}}class Tce extends XR{constructor(t){super(),this.requiresSelectionId=t&&DR(t)}run(t){t instanceof gx&&(this.requiresSelectionId&&(CD(t.parent)||t.parent instanceof Sv||t.parent instanceof Kd)||(this.setMutated(),t.remove()));for(const r of t.children)this.run(r);return this.mutatedFlag}}class Nce extends tb{run(t){const r=t.parent,u=[...r.children],l=r.children.filter(d=>d instanceof Kd);if(r.numChildren()>1&&l.length>=1){const d={},b=new Set;for(const k of l){const T=k.parse;for(const j of di(T))j in d?d[j]!==T[j]&&b.add(j):d[j]=T[j]}for(const k of b)delete d[k];if(!su(d)){this.setMutated();const k=new Kd(r,d);for(const T of u){if(T instanceof Kd)for(const j of di(d))delete T.parse[j];r.removeChild(T),T.parent=k,T instanceof Kd&&di(T.parse).length===0&&T.remove()}}}return this.setContinue(),this.flags}}class Ice extends tb{run(t){const r=t.parent,u=r.children.filter(d=>d instanceof Sv),l={};for(const d of u){const b=cs(d.groupBy);b in l||(l[b]=[]),l[b].push(d)}for(const d of di(l)){const b=l[d];if(b.length>1){const k=b.pop();for(const T of b)k.merge(T)&&(r.removeChild(T),T.parent=k,T.remove(),this.setMutated())}}return this.setContinue(),this.flags}}class Mce extends tb{constructor(t){super(),this.model=t}run(t){const r=t.parent,u=!(CD(r)||r instanceof N_||r instanceof Kd||r instanceof gx),l=[],d=[];for(const b of r.children)b instanceof e1&&(u&&!gz(r.producedFields(),b.depen
7840dentFields())?l.push(b):d.push(b));if(l.length>0){const b=l.pop();for(const k of l)b.merge(k,this.model.renameSignal.bind(this.model));this.setMutated(),r instanceof e1?r.merge(b,this.model.renameSignal.bind(this.model)):b.swapWithParent()}if(d.length>1){const b=d.pop();for(const k of d)b.merge(k,this.model.renameSignal.bind(this.model));this.setMutated()}return this.setContinue(),this.flags}}class Fce extends tb{run(t){const r=t.parent,u=[...r.children];if(!lC(u,b=>b instanceof rp)||r.numChildren()<=1)return this.setContinue(),this.flags;const l=[];let d;for(const b of u)if(b instanceof rp){let k=b;for(;k.numChildren()===1;){const T=k.children[0];if(!(T instanceof rp))break;k=T}l.push(...k.children),d?(r.removeChild(b),b.parent=d.parent,d.parent.removeChild(d),d.parent=k,this.setMutated()):d=k}else l.push(b);if(l.length){this.setMutated();for(const b of l)b.parent.removeChild(b),b.parent=d}return this.setContinue(),this.flags}}const QR="scale_",SD=5;function vx(e){const t=[];function r(u){if(u.numChildren()===0)t.push(u);else for(const l of u.children)r(l)}for(const u of e)r(u);return t}function Rce(e){return e}function Av(e,t){return t.map(r=>{if(e instanceof tb){const u=e.optimizeNextFromLeaves(r);return e.reset(),u}return e.run(r)}).some(Rce)}function UV(e,t){let r=e.sources;const u=new Set;return u.add(Av(new Dce,r)),u.add(Av(new Tce(t),r)),r=r.filter(l=>l.numChildren()>0),u.add(Av(new Sce,vx(r))),r=r.filter(l=>l.numChildren()>0),u.add(Av(new Ece,vx(r))),u.add(Av(new Mce(t),vx(r))),u.add(Av(new Ace,vx(r))),u.add(Av(new Nce,vx(r))),u.add(Av(new Ice,vx(r))),u.add(Av(new Oce,vx(r))),u.add(Av(new Cce,r)),u.add(Av(new Fce,vx(r))),e.sources=r,u.has(!0)}class Sg{constructor(t){Object.defineProperty(this,"signal",{enumerable:!0,get:t})}static fromName(t,r){return new Sg(()=>t(r))}}function WV(e){Sc(e)?function(t){const r=t.component.scales;for(const u of di(r)){const l=Bce(t,u);if(r[u].setWithExplicit("domains",l),Pce(t,u),t.component.data.isFaceted){let b=t;for(;!Ov(b)&&b.parent;)b=b.parent;if(b.component.resolve.scale[u]==="shared")for(const T of l.value)ux(T)&&(T.data=QR+T.data.replace(QR,""))}}}(e):function(t){for(const u of t.children)WV(u);const r=t.component.scales;for(const u of di(r)){let l,d=null;for(const b of t.children){const k=b.component.scales[u];if(k){l=l===void 0?k.getWithExplicit("domains"):dx(l,k.getWithExplicit("domains"),"domains","scale",t5);const T=k.get("selectionExtent");d&&T&&d.selection!==T.selection&&li("The same selection must be used to override scale domains in a layered view."),d=T}}r[u].setWithExplicit("domains",l),d&&r[u].set("selectionExtent",d,!0)}}(e)}function Bce(e,t){const r=e.getScaleComponent(t).get("type"),{encoding:u}=e,l=function(d,b,k,T){if(d==="unaggregated"){const{valid:j,reason:$}=VV(b,k);if(!j)return void li($)}else if(d===void 0&&T.useUnaggregatedDomain){const{valid:j}=VV(b,k);if(j)return"unaggregated"}return d}(e.scaleDomain(t),e.typedFieldDef(t),r,e.config.scale);return l!==e.scaleDomain(t)&&(e.specifiedScales[t]=Object.assign(Object.assign({},e.specifiedScales[t]),{domain:l})),t==="x"&&Bl(u.x2)?Bl(u.x)?dx(yx(r,l,e,"x"),yx(r,l,e,"x2"),"domain","scale",t5):yx(r,l,e,"x2"):t==="y"&&Bl(u.y2)?Bl(u.y)?dx(yx(r,l,e,"y"),yx(r,l,e,"y2"),"domain","scale",t5):yx(r,l,e,"y2"):yx(r,l,e,t)}function ZR(e,t,r){var u;const l=(u=np(r))===null||u===void 0?void 0:u.unit;return t==="temporal"||l?function(d,b,k){return d.map(T=>({signal:`{data: ${rR(T,{timeUnit:k,type:b})}}`}))}(e,t,l):[e]}function yx(e,t,r,u){const{encoding:l}=r,d=Bl(l[u]),{type:b}=d,k=d.timeUnit;if(function(G){return G&&G.unionWith}(t)){const G=yx(e,void 0,r,u),te=ZR(t.unionWith,b,k);return $w([...G.value,...te])}if(Uo(t))return $w([t]);if(t&&t!=="unaggregated"&&!rU(t))return $w(ZR(t,b,k));const T=r.stack;if(T&&u===T.fieldChannel){if(T.offset==="normalize")return Ev([[0,1]]);const G=r.requestDataName(Vd);return Ev([{data:G,field:r.vgField(u,{suffix:"start"})},{data:G,field:r.vgField(u,{suffix:"end"})}])}const j=ax(u)&&Si(d)?function(G,te,se){if(!vm(se))return;const he=G.fieldDef(te),ve=he.sort;if(bU(ve))return{op:"min",field:M_(he,te),order:"ascending"};const{stack:Be}=G,ze=Be?[...Be.groupbyField?[Be.groupbyField]:[],...Be.stackBy.map(Ue=>Ue.fieldDef.field)]:void 0;if(Ky(ve)){const Ue=Be&&!bo(ze,ve.field);return e5(ve,Ue)}if(yU(ve)){const{encoding:Ue,order:st}=ve,ut=G.fieldDef(Ue),{aggregate:mt,field:pt}=ut,Ct=Be&&!bo(ze,pt);
7840if(Zb(mt)||Mw(mt))return e5({field:bi(ut),order:st},Ct);if(AF(mt)||!mt)return e5({op:mt,field:pt,order:st},Ct)}else{if(ve==="descending")return{op:"min",field:G.vgField(te),order:"descending"};if(bo(["ascending",void 0],ve))return!0}}(r,u,e):void 0;if(lx(d))return Ev(ZR([d.datum],b,k));const $=d;if(t==="unaggregated"){const G=r.requestDataName(Vd),{field:te}=d;return Ev([{data:G,field:bi({field:te,aggregate:"min"})},{data:G,field:bi({field:te,aggregate:"max"})}])}if(Du($.bin)){if(vm(e))return Ev(e==="bin-ordinal"?[]:[{data:S3(j)?r.requestDataName(Vd):r.requestDataName(cD),field:r.vgField(u,wC($,u)?{binSuffix:"range"}:{}),sort:j!==!0&&ff(j)?j:{field:r.vgField(u,{}),op:"min"}}]);{const{bin:G}=$;if(Du(G)){const te=KR(r,$.field,G);return Ev([new Sg(()=>{const se=r.getSignalName(te);return`[${se}.start, ${se}.stop]`})])}return Ev([{data:r.requestDataName(Vd),field:r.vgField(u,{})}])}}if($.timeUnit&&bo(["time","utc"],e)&&YF(u,$,Sc(r)?r.encoding[$y(u)]:void 0,r.stack,r.markDef,r.config)){const G=r.requestDataName(Vd);return Ev([{data:G,field:r.vgField(u)},{data:G,field:r.vgField(u,{suffix:"end"})}])}return Ev(j?[{data:S3(j)?r.requestDataName(Vd):r.requestDataName(cD),field:r.vgField(u),sort:j}]:[{data:r.requestDataName(Vd),field:r.vgField(u)}])}function e5(e,t){const{op:r,field:u,order:l}=e;return Object.assign(Object.assign({op:r??(t?"sum":K3)},u?{field:Qb(u)}:{}),l?{order:l}:{})}function Pce(e,t){var r;const u=e.component.scales[t],l=e.specifiedScales[t].domain,d=(r=e.fieldDef(t))===null||r===void 0?void 0:r.bin,b=rU(l)&&l,k=gC(d)&&V3(d.extent)&&d.extent;(b||k)&&u.set("selectionExtent",b??k,!0)}function VV(e,t){const{aggregate:r,type:u}=e;return r?Ca(r)&&!coe[r]?{valid:!1,reason:re.unaggregateDomainWithNonSharedDomainOp(r)}:u==="quantitative"&&t==="log"?{valid:!1,reason:re.unaggregatedDomainWithLogScale(e)}:{valid:!0}:{valid:!1,reason:re.unaggregateDomainHasNoEffectForRawField(e)}}function t5(e,t,r,u){return e.explicit&&t.explicit&&li(re.mergeConflictingDomainProperty(r,u,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function n5(e){if(ux(e)&&Ca(e.field))return e.field;if(function(t){return!mo(t)&&"fields"in t&&!("data"in t)}(e)){let t;for(const r of e.fields)if(ux(r)&&Ca(r.field))if(t){if(t!==r.field)return li(re.FACETED_INDEPENDENT_DIFFERENT_SOURCES),t}else t=r.field;return li(re.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES),t}if(function(t){return!mo(t)&&"fields"in t&&"data"in t}(e)){li(re.FACETED_INDEPENDENT_SAME_SOURCE);const t=e.fields[0];return Ca(t)?t:void 0}}function AD(e,t){return function(r){const u=Xb(r.map(T=>ux(T)?ao(T,["sort"]):T),cs),l=Xb(r.map(T=>{if(ux(T)){const j=T.sort;return j===void 0||S3(j)||("op"in j&&j.op==="count"&&delete j.field,j.order==="ascending"&&delete j.order),j}}).filter(T=>T!==void 0),cs);if(u.length===0)return;if(u.length===1){const T=r[0];if(ux(T)&&l.length>0){let j=l[0];if(l.length>1)li(re.MORE_THAN_ONE_SORT),j=!0;else if(ff(j)&&"field"in j){const $=j.field;T.field===$&&(j=!j.order||{order:j.order})}return Object.assign(Object.assign({},T),{sort:j})}return T}const d=Xb(l.map(T=>S3(T)||!("op"in T)||T.op in aoe?T:(li(re.domainSortDropped(T)),!0)),cs);let b;d.length===1?b=d[0]:d.length>1&&(li(re.MORE_THAN_ONE_SORT),b=!0);const k=Xb(r.map(T=>ux(T)?T.data:null),T=>T);return k.length===1&&k[0]!==null?Object.assign({data:k[0],fields:u.map(T=>T.field)},b?{sort:b}:{}):Object.assign({fields:u},b?{sort:b}:{})}(e.component.scales[t].get("domains").map(r=>(ux(r)&&(r.data=e.lookupDataSource(r.data)),r)))}function $V(e){return di(e.component.scales).reduce((t,r)=>{const u=e.component.scales[r];if(u.merged)return t;const l=u.combine(),{name:d,type:b,selectionExtent:k,domains:T,range:j,reverse:$}=l,G=ao(l,["name","type","selectionExtent","domains","range","reverse"]),te=function(ve,Be,ze){return qy(ze)&&sx(ve)?{step:{signal:Be+"_step"}}:ve}(l.range,d,r);let se;k&&(se=function(ve,Be){const ze=Be.selection;return{signal:sV(ve.getSelectionComponent(ze,nc(ze)),Be)}}(e,k));const he=AD(e,r);return t.push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:d,type:b},he?{domain:he}:{}),se?{domainRaw:se}:{}),{range:te}),$!==void 0?{reverse:$}:{}),G)),t},[])}class HV extends J1{constructor(t,r){super({},{name:t}),this.merged=!1,this.setWithExplicit("type",r)}domainDefinitelyIncludesZero(){return this.get("zero")!==!1||lC(this.get("domains"),t=>mo(t)&&t.length===2&&t[0]<=0&&t[1]>=0)}}const jce=["range","scheme"];function qV(e){return e==="x"?"width":e==="y"?"height":void 0}function GV(e,t){const r=e.fieldDef(t);if(r&&r.bin&&Du(r.bin)){const u=KR(e,r.field,r.bin),l=qV(t),d=e.getName(l);return new Sg(()=>{const b=e.getSignalName(u),k=`(${b}.stop - ${b}.start) / ${b}.step`;return`${e.getSignalName(d)} / (${k})`})}}function Lce(e,t){const r=t.specifiedScales[e],{size:u}=t,l=t.getScaleComponent(e).get("type");for(const d of jce)if(r[d]!==void 0){const b=iU(l,d),k=oU(e,d);if(b)if(k)li(k);else switch(d){case"range":return mo(r.range)&&qy(e)?$w(r.range.map(T=>{if(T==="width"||T==="height"){const j=t.getName(T),$=t.getSignalName.bind(t);return Sg.fromName($,j)}return T})):$w(r.range);case"scheme":return $w(zce(r[d]))}else li(re.scalePropertyNotWorkWithScaleType(l,d,e))}if(e===pc||e===Rl){const d=e===pc?"width":"height",b=u[d];if(Jy(b)){if(vm(l))return $w({step:b.step});li(re.stepDropped(d))}}return Ev(function(d,b){const{size:k,config:T,mark:j,encoding:$}=b,G=b.getSignalName.bind(b),{type:te}=Bl($[d]),se=b.getScaleComponent(d).get("type"),{domain:he,domainMid:ve}=b.specifiedScales[d];switch(d){case pc:case Rl:{if(bo(["point","band"],se))if(d!==pc||k.width){if(d===Rl&&!k.height){const Ue=kC(T.view,"height");if(Jy(Ue))return Ue}}else{const Ue=kC(T.view,"width");
7840if(Jy(Ue))return Ue}const Be=qV(d),ze=b.getName(Be);return d===Rl&&_0(se)?[Sg.fromName(G,ze),0]:[0,Sg.fromName(G,ze)]}case G1:{const Be=b.component.scales[d].get("zero"),ze=function st(ut,mt,pt){if(mt)return Uo(mt)?{signal:`${mt.signal} ? 0 : ${st(ut,!1,pt)}`}:0;switch(ut){case"bar":case"tick":return pt.scale.minBandSize;case"line":case"trail":case"rule":return pt.scale.minStrokeWidth;case"text":return pt.scale.minFontSize;case"point":case"square":case"circle":return pt.scale.minSize}throw new Error(re.incompatibleChannel("size",ut))}(j,Be,T),Ue=function(st,ut,mt,pt){const Ct={x:GV(mt,"x"),y:GV(mt,"y")};switch(st){case"bar":case"tick":{if(pt.scale.maxBandSize!==void 0)return pt.scale.maxBandSize;const Et=YV(ut,Ct,pt.view);return fl(Et)?Et-1:new Sg(()=>`${Et.signal} - 1`)}case"line":case"trail":case"rule":return pt.scale.maxStrokeWidth;case"text":return pt.scale.maxFontSize;case"point":case"square":case"circle":{if(pt.scale.maxSize)return pt.scale.maxSize;const Et=YV(ut,Ct,pt.view);return fl(Et)?Math.pow(KV*Et,2):new Sg(()=>`pow(${KV} * ${Et.signal}, 2)`)}}throw new Error(re.incompatibleChannel("size",st))}(j,k,b,T);return H3(se)?function(st,ut,mt){const pt=()=>{const Ct=_C(ut),Et=_C(st),mn=`(${Ct} - ${Et}) / (${mt} - 1)`;return`sequence(${Et}, ${Ct} + ${mn}, ${mn})`};return Uo(ut)?new Sg(pt):{signal:pt()}}(ze,Ue,function(st,ut,mt,pt){switch(st){case"quantile":return ut.scale.quantileCount;case"quantize":return ut.scale.quantizeCount;case"threshold":return mt!==void 0&&mo(mt)?mt.length+1:(li(re.domainRequiredForThresholdScale(pt)),3)}}(se,T,he,d)):[ze,Ue]}case wv:return[0,2*Math.PI];case Fw:return[0,360];case Ly:return[0,new Sg(()=>{const Be=b.getSignalName("width"),ze=b.getSignalName("height");return`min(${Be},${ze})/2`})];case nx:return[T.scale.minStrokeWidth,T.scale.maxStrokeWidth];case rx:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case gm:return"symbol";case mm:case Wy:case Vy:return se==="ordinal"?te==="nominal"?"category":"ordinal":ve!==void 0?"diverging":j==="rect"||j==="geoshape"?"heatmap":"ramp";case K1:case ex:case tx:return[T.scale.minOpacity,T.scale.maxOpacity]}throw new Error(`Scale range undefined for channel ${d}`)}(e,t))}function zce(e){return function(t){return!Ca(t)&&!!t.name}(e)?Object.assign({scheme:e.name},U1(e,["name"])):{scheme:e}}const KV=.95;function YV(e,t,r){const u=Jy(e.width)?e.width.step:oD(r,"width"),l=Jy(e.height)?e.height.step:oD(r,"height");return t.x||t.y?new Sg(()=>`min(${[t.x?t.x.signal:u,t.y?t.y.signal:l].join(", ")})`):Math.min(u,l)}function XV(e,t){Sc(e)?function(r,u){const l=r.component.scales,{config:d,encoding:b,markDef:k,specifiedScales:T}=r;for(const j of di(l)){const $=T[j],G=l[j],te=r.getScaleComponent(j),se=Bl(b[j]),he=$[u],ve=te.get("type"),Be=te.get("padding"),ze=te.get("paddingInner"),Ue=iU(ve,u),st=oU(j,u);if(he!==void 0&&(Ue?st&&li(st):li(re.scalePropertyNotWorkWithScaleType(ve,u,j))),Ue&&st===void 0)if(he!==void 0)G.copyKeyFromObject(u,$);else{const ut=u in JV?JV[u]({model:r,channel:j,fieldOrDatumDef:se,scaleType:ve,scalePadding:Be,scalePaddingInner:ze,domain:$.domain,markDef:k,config:d}):d.scale[u];ut!==void 0&&G.set(u,ut,!1)}}}(e,t):ZV(e,t)}const JV={bins:({model:e,fieldOrDatumDef:t})=>Si(t)?function(r,u){const l=u.bin;if(Du(l)){const d=KR(r,u.field,l);return new Sg(()=>r.getSignalName(d))}if(tp(l)&&gC(l)&&l.step!==void 0)return{step:l.step}}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(r,u){if(bo([mm,Wy,Vy],r)&&u!=="nominal")return"hcl"}(e,t.type),nice:({scaleType:e,channel:t,fieldOrDatumDef:r})=>function(u,l,d){var b;if(!(!((b=Xy(d))===null||b===void 0)&&b.bin||bo([hl.TIME,hl.UTC],u)))return l in ox||void 0}(e,t,r),padding:({channel:e,scaleType:t,fieldOrDatumDef:r,markDef:u,config:l})=>function(d,b,k,T,j,$){if(d in ox){if(kv(b)){if(k.continuousPadding!==void 0)return k.continuousPadding;const{type:G,orient:te}=j;if(G==="bar"&&(!Si(T)||!T.bin&&!T.timeUnit)&&(te==="vertical"&&d==="x"||te==="horizontal"&&d==="y"))return $.continuousBandSize}if(b===hl.POINT)return k.pointPadding}}(e,t,l.scale,r,u,l.bar),paddingInner:({scalePadding:e,channel:t,markDef:r,config:u})=>function(l,d,b,k){if(l===void 0&&d in ox){const{bandPaddingInner:T,barBandPaddingInner:j,rectBandPaddingInner:$}=k;return dl(T,b==="bar"?j:$)}}(e,t,r.type,u.scale),paddingOuter:({scalePadding:e,channel:t,scaleType:r,markDef:u,scalePaddingInner:l,config:d})=>function(b,k,T,j,$,G){if(b===void 0&&k in ox&&T===hl.BAND){const{bandPaddingOuter:te}=G;return dl(te,Uo($)?{signal:`${$.signal}/2`}:$/2)}}(e,t,r,u.type,l,d.scale),reverse:({fieldOrDatumDef:e,scaleType:t,channel:r,config:u})=>function(l,d,b,k){if(b==="x"&&k.xReverse!==void 0)return _0(l)&&d==="descending"?Uo(k.xReverse)?{signal:`!${k.xReverse.signal}`}:!k.xReverse:k.xReverse;if(_0(l)&&d==="descending")return!0}(t,Si(e)?e.sort:void 0,r,u.scale),zero:({channel:e,fieldOrDatumDef:t,domain:r,markDef:u,scaleType:l})=>function(d,b,k,T,j){if(k&&k!=="unaggregated"&&_0(j)){if(mo(k)){const $=k[0],G=k[k.length-1];if($<=0&&G>=0)return!0}return!1}if(d==="size"&&b.type==="quantitative"&&!H3(j))return!0;
7840if((!Si(b)||!b.bin)&&bo([...w0,...goe],d)){const{orient:$,type:G}=T;return!bo(["bar","area","line","trail"],G)||!($==="horizontal"&&d==="y"||$==="vertical"&&d==="x")}return!1}(e,t,r,u,l)};function QV(e){Sc(e)?function(t){const r=t.component.scales;for(const u of U3){const l=r[u];if(!l)continue;const d=Lce(u,t);l.setWithExplicit("range",d)}}(e):ZV(e,"range")}function ZV(e,t){const r=e.component.scales;for(const u of e.children)t==="range"?QV(u):XV(u,t);for(const u of di(r)){let l;for(const d of e.children){const b=d.component.scales[u];b&&(l=dx(l,b.getWithExplicit(t),t,"scale",yW((k,T)=>{switch(t){case"range":return k.step&&T.step?k.step-T.step:0}return 0})))}r[u].setWithExplicit(t,l)}}function Uce(e,t,r,u){const l=function(b,k,T){var j;switch(k.type){case"nominal":case"ordinal":if(k_(b)||W3(b)==="discrete")return b==="shape"&&k.type==="ordinal"&&li(re.discreteChannelCannotEncode(b,"ordinal")),"ordinal";if(b in ox){if(bo(["rect","bar","image","rule"],T))return"band"}else if(T==="arc"&&b in NF)return"band";return k.band!==void 0||eR(k)&&(!((j=k.axis)===null||j===void 0)&&j.tickBand)?"band":"point";case"temporal":return k_(b)?"time":W3(b)==="discrete"?(li(re.discreteChannelCannotEncode(b,"temporal")),"ordinal"):Si(k)&&k.timeUnit&&np(k.timeUnit).utc?"utc":"time";case"quantitative":return k_(b)?Si(k)&&Du(k.bin)?"bin-ordinal":"linear":W3(b)==="discrete"?(li(re.discreteChannelCannotEncode(b,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(re.invalidFieldType(k.type))}(t,r,u),{type:d}=e;return ax(t)?d!==void 0?sU(t,d)?Si(r)&&!aU(d,r.type)?(li(re.scaleTypeNotWorkWithFieldDef(d,l)),l):d:(li(re.scaleTypeNotWorkWithChannel(t,d,l)),l):l:null}function e$(e){Sc(e)?e.component.scales=function(t){const{encoding:r,mark:u}=t;return U3.reduce((l,d)=>{const b=Bl(r[d]);if(b&&u===Sz&&d===gm&&b.type===A_)return l;let k=b&&b.scale;if(b&&k!==null&&k!==!1){const T=Uce(k=k??{},d,b,u);
7840l[d]=new HV(t.scaleName(d+"",!0),{value:T,explicit:k.type===T})}return l},{})}(e):e.component.scales=function(t){var r;const u=t.component.scales={},l={},d=t.component.resolve;for(const b of t.children){e$(b);for(const k of di(b.component.scales))if(d.scale[k]=(r=d.scale[k])!==null&&r!==void 0?r:fce(k,t),d.scale[k]==="shared"){const T=l[k],j=b.component.scales[k].getWithExplicit("type");T?Yae(T.value,j.value)?l[k]=dx(T,j,"type","scale",Wce):(d.scale[k]="independent",delete l[k]):l[k]=j}}for(const b of di(l)){const k=t.scaleName(b,!0),T=l[b];u[b]=new HV(k,T);for(const j of t.children){const $=j.component.scales[b];$&&(j.renameScale($.get("name"),k),$.merged=!0)}}return u}(e)}const Wce=yW((e,t)=>tU(e)-tU(t));class r5{constructor(){this.nameMap={}}rename(t,r){this.nameMap[t]=r}has(t){return this.nameMap[t]!==void 0}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function Sc(e){return(e==null?void 0:e.type)==="unit"}function Ov(e){return(e==null?void 0:e.type)==="facet"}function i5(e){return(e==null?void 0:e.type)==="concat"}function j_(e){return(e==null?void 0:e.type)==="layer"}class o5{constructor(t,r,u,l,d,b,k){var T,j;this.type=r,this.parent=u,this.config=d,this.view=k,this.children=[],this.correctDataNames=$=>($.from&&$.from.data&&($.from.data=this.lookupDataSource($.from.data)),$.from&&$.from.facet&&$.from.facet.data&&($.from.facet.data=this.lookupDataSource($.from.facet.data)),$),this.parent=u,this.config=d,this.name=(T=t.name)!==null&&T!==void 0?T:l,this.title=fx(t.title)?{text:t.title}:t.title,this.scaleNameMap=u?u.scaleNameMap:new r5,this.projectionNameMap=u?u.projectionNameMap:new r5,this.signalNameMap=u?u.signalNameMap:new r5,this.data=t.data,this.description=t.description,this.transforms=Xse((j=t.transform)!==null&&j!==void 0?j:[]),this.layout=r==="layer"||r==="unit"?{}:function($,G,te){var se,he;const ve=te[G],Be={},{spacing:ze,columns:Ue}=ve;ze!==void 0&&(Be.spacing=ze),Ue!==void 0&&(Y3($)&&!bC($.facet)||pR($))&&(Be.columns=Ue),iD($)&&(Be.columns=1);for(const st of vse)if($[st]!==void 0)if(st==="spacing"){const ut=$[st];Be[st]=fl(ut)?ut:{row:(se=ut.row)!==null&&se!==void 0?se:ze,column:(he=ut.column)!==null&&he!==void 0?he:ze}}else Be[st]=$[st];return Be}(t,r,d),this.component={data:{sources:u?u.component.data.sources:[],outputNodes:u?u.component.data.outputNodes:{},outputNodeRefCounts:u?u.component.data.outputNodeRefCounts:{},isFaceted:Y3(t)||u&&u.component.data.isFaceted&&t.data===void 0},layoutSize:new J1,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:Object.assign({scale:{},axis:{},legend:{}},b?Sa(b):{}),selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){(function(t,{ignoreRange:r}={}){e$(t),WV(t);for(const u of ise)XV(t,u);r||QV(t)})(this)}parseProjection(){BV(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){TV(this)}assembleGroupStyle(){var t,r;if(this.type==="unit"||this.type==="layer")return(r=(t=this.view)===null||t===void 0?void 0:t.style)!==null&&r!==void 0?r:"cell"}assembleEncodeFromView(t){const r=ao(t,["style"]),u={};for(const l of di(r)){const d=r[l];d!==void 0&&(u[l]=Gc(d))}return u}assembleGroupEncodeEntry(t){let r={};return this.view&&(r=this.assembleEncodeFromView(this.view)),t||(this.description&&(r.description=Gc(this.description)),this.type!=="unit"&&this.type!=="layer")?su(r)?void 0:r:Object.assign({width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")},r??{})}assembleLayout(){if(!this.layout)return;const t=this.layout,{spacing:r}=t,u=ao(t,["spacing"]),{component:l,config:d}=this,b=function(k,T){const j={};for(const $ of x0){const G=k[$];if(G!=null&&G.facetFieldDef){const{titleAnchor:te,titleOrient:se}=kD(["titleAnchor","titleOrient"],G.facetFieldDef,T,$),he=_D($,se),ve=lce(te,he);ve!==void 0&&(j[he]=ve)}}return su(j)?void 0:j}(l.layoutHeaders,d);return Object.assign(Object.assign(Object.assign({padding:r},this.assembleDefaultLayout()),u),b?{titleBand:b}:{})}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let r=[];for(const u of x0)t[u].title&&r.push(ace(this,u));for(const u of WR)r=r.concat(sce(this,u));return r}assembleAxes(){return function(t,r){const{x:u=[],y:l=[]}=t;return[...u.map(d=>BC(d,"grid",r)),...l.map(d=>BC(d,"grid",r)),...u.map(d=>BC(d,"main",r)),...l.map(d=>BC(d,"main",r))].filter(d=>d)}(this.component.axes,this.config)}assembleLegends(){return MV(this)}assembleProjections(){return bce(this)}assembleTitle(){var t,r,u;const l=(t=this.title)!==null&&t!==void 0?t:{},{encoding:d}=l,b=ao(l,["encoding"]),k=Object.assign(Object.assign(Object.assign({},IU(this.config.title).nonMark),b),d?{encode:{update:d}}:{});if(k.text)return bo(["unit","layer"],this.type)?bo(["middle",void 0],k.anchor)&&(k.frame=(r=k.frame)!==null&&r!==void 0?r:"group"):k.anchor=(u=k.anchor)!==null&&u!==void 0?u:"start",su(k)?void 0:k}assembleGroup(t=[]){const r={};(t=t.concat(this.assembleSignals())).length>0&&(r.signals=t);const u=this.assembleLayout();u&&(r.layout=u),r.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const l=!this.parent||Ov(this.parent)?function k(T){return j_(T)||i5(T)?T.children.reduce((j,$)=>j.concat(k($)),$V(T)):$V(T)}(this):[];l.length>0&&(r.scales=l);const d=this.assembleAxes();d.length>0&&(r.axes=d);const b=this.assembleLegends();return b.length>0&&(r.legends=b),r}getName(t){return nc((this.name?this.name+"_":"")+t)}requestDataName(t){var r;const u=this.getName(t),l=this.component.data.outputNodeRefCounts;return l[u]=((r=l[u])!==null&&r!==void 0?r:0)+1,u}getSizeSignalRef(t){if(Ov(this.parent)){const r=z3(wV(t)),u=this.component.scales[r];if(u&&!u.merged){const l=u.get("type"),d=u.get("range");if(vm(l)&&sx(d)){const b=u.get("name"),k=n5(AD(this,r));return k?{signal:xV(b,u,bi({aggregate:"distinct",field:k},{expr:"datum"}))}:(li(`Unknown field for ${r}. Cannot calculate view size.`),null)}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const r=this.component.data.outputNodes[t];return r?r.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,r){this.signalNameMap.rename(t,r)}renameScale(t,r){this.scaleNameMap.rename(t,r)}renameProjection(t,r){this.projectionNameMap.rename(t,r)}scaleName(t,r){return r?this.getName(t):Bz(t)&&ax(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t))?this.scaleNameMap.get(this.getName(t)):void 0}projectionName(t){return t?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const r=this.component.scales[t];return r&&!r.merged?r:this.parent?this.parent.getScaleComponent(t):void 0}getSelectionComponent(t,r){let u=this.component.selection[t];if(!u&&this.parent&&(u=this.parent.getSelectionComponent(t,r)),!u)throw new Error(re.selectionNotFound(r));return u}hasAxisOrientSignalRef(){var t,r;return((t=this.component.axes.x)===null||t===void 0?void 0:t.some(u=>u.hasOrientSignalRef()))||((r=this.component.axes.y)===null||r===void 0?void 0:r.some(u=>u.hasOrientSignalRef()))}}class t$ extends o5{vgField(t,r={}){const u=this.fieldDef(t);if(u)return bi(u,r)}reduceFieldDef(t,r){return zU(this.getMapping(),(u,l,d)=>{const b=Xy(l);return b?t(u,b,d):u},r)}forEachFieldDef(t,r){aR(this.getMapping(),(u,l)=>{const d=Xy(u);d&&t(d,l)},r)}}class OD extends Js{constructor(t,r){var u,l,d;super(t),this.transform=r,this.transform=Sa(r);const b=(u=this.transform.as)!==null&&u!==void 0?u:[void 0,void 0];this.transform.as=[(l=b[0])!==null&&l!==void 0?l:"value",(d=b[1])!==null&&d!==void 0?d:"density"]}clone(){return new OD(null,Sa(this.transform))}dependentFields(){var t;return new Set([this.transform.density,...(t=this.transform.groupby)!==null&&t!==void 0?t:[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${cs(this.transform)}`}assemble(){const t=this.transform,{density:r}=t,u=ao(t,["density"]);return Object.assign({type:"kde",field:r},u)}}class LC extends Js{constructor(t,r){super(t),this.filter=r}clone(){return new LC(null,Object.assign({},this.filter))}static make(t,r){const{config:u,mark:l,markDef:d}=r;if(Ns("invalid",d,u)!=="filter")return null;const b=r.reduceFieldDef((k,T,j)=>{const $=ax(j)&&r.getScaleComponent(j);return $&&_0($.get("type"))&&T.aggregate!=="count"&&!Iw(l)&&(k[T.field]=T),k},{});return di(b).length?new LC(t,b):null}dependentFields(){return new Set(di(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${cs(this.filter)}`}assemble(){const t=di(this.filter).reduce((r,u)=>{const l=this.filter[u],d=bi(l,{expr:"datum"});return l!==null&&(l.type==="temporal"?r.push(`(isDate(${d}) || (isValid(${d}) && isFinite(+${d})))`):l.type==="quantitative"&&(r.push(`isValid(${d})`),r.push(`isFinite(+${d})`))),r},[]);return t.length>0?{type:"filter",expr:t.join(" && ")}:null}}class DD extends Js{constructor(t,r){super(t),this.transform=r,this.transform=Sa(r);const{flatten:u,as:l=[]}=this.transform;this.transform.as=u.map((d,b)=>{var k;return(k=l[b])!==null&&k!==void 0?k:d})}clone(){return new DD(this.parent,Sa(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${cs(this.transform)}`}assemble(){const{flatten:t,as:r}=this.transform;return{type:"flatten",fields:t,as:r}}}class TD extends Js{constructor(t,r){var u,l,d;super(t),this.transform=r,this.transform=Sa(r);const b=(u=this.transform.as)!==null&&u!==void 0?u:[void 0,void 0];this.transform.as=[(l=b[0])!==null&&l!==void 0?l:"key",(d=b[1])!==null&&d!==void 0?d:"value"]}clone(){return new TD(null,Sa(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${cs(this.transform)}`}assemble(){const{fold:t,as:r}=this.transform;return{type:"fold",fields:t,as:r}}}class L_ extends Js{constructor(t,r,u,l){super(t),this.fields=r,this.geojson=u,this.signal=l}clone(){return new L_(null,Sa(this.fields),this.geojson,this.signal)}static parseAll(t,r){if(r.component.projection&&!r.component.projection.isFit)return t;let u=0;for(const l of[[Uy,zy],[b0,_v]]){const d=l.map(b=>{const k=Bl(r.encoding[b]);return Si(k)?k.field:lx(k)?{expr:`${k.datum}`}:Y1(k)?{expr:`${k.value}`}:void 0});(d[0]||d[1])&&(t=new L_(t,d,null,r.getName(`geojson_${u++}`)))}if(r.channelHasField(gm)){const l=r.typedFieldDef(gm);l.type===A_&&(t=new L_(t,null,l.field,r.getName(`geojson_${u++}`)))}return t}dependentFields(){var t;const r=((t=this.fields)!==null&&t!==void 0?t:[]).filter(Ca);return new Set([...this.geojson?[this.geojson]:[],...r])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${cs(this.fields)}`}assemble(){return Object.assign(Object.assign(Object.assign({type:"geojson"},this.fields?{fields:this.fields}:{}),this.geojson?{geojson:this.geojson}:{}),{signal:this.signal})}}class zC extends Js{constructor(t,r,u,l){super(t),this.projection=r,this.fields=u,this.as=l}clone(){return new zC(null,this.projection,Sa(this.fields),Sa(this.as))}static parseAll(t,r){if(!r.projectionName())return t;for(const u of[[Uy,zy],[b0,_v]]){const l=u.map(b=>{const k=Bl(r.encoding[b]);return Si(k)?k.field:lx(k)?{expr:`${k.datum}`}:Y1(k)?{expr:`${k.value}`}:void 0}),d=u[0]===b0?"2":"";(l[0]||l[1])&&(t=new zC(t,r.projectionName(),l,[r.getName("x"+d),r.getName("y"+d)]))}return t}dependentFields(){return new Set(this.fields.filter(Ca))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${cs(this.fields)} ${cs(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Qw extends Js{constructor(t,r){super(t),this.transform=r}clone(){return new Qw(null,Sa(this.transform))}dependentFields(){var t;return new Set([this.transform.impute,this.transform.key,...(t=this.transform.groupby)!==null&&t!==void 0?t:[]])}producedFields(){return new Set([this.transform.impute])}processSequence(t){const{start:r=0,stop:u,step:l}=t;return{signal:`sequence(${[r,u,...l?[l]:[]].join(",")})`}}static makeFromTransform(t,r){return new Qw(t,r)}static makeFromEncoding(t,r){const u=r.encoding,l=u.x,d=u.y;if(Si(l)&&Si(d)){const b=l.impute?l:d.impute?d:void 0;if(b===void 0)return;const k=l.impute?d:d.impute?l:void 0,{method:T,value:j,frame:$,keyvals:G}=b.impute,te=UU(r.mark,u);return new Qw(t,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({impute:b.field,key:k.field},T?{method:T}:{}),j!==void 0?{value:j}:{}),$?{frame:$}:{}),G!==void 0?{keyvals:G}:{}),te.length?{groupby:te}:{}))}return null}hash(){return`Impute ${cs(this.transform)}`}assemble(){const{impute:t,key:r,keyvals:u,method:l,groupby:d,value:b,frame:k=[null,null]}=this.transform,T=Object.assign(Object.assign(Object.assign(Object.assign({type:"impute",field:t,key:r},u?{keyvals:function(j){return(j==null?void 0:j.stop)!==void 0}(u)?this.processSequence(u):u}:{}),{method:"value"}),d?{groupby:d}:{}),{value:l&&l!=="value"?null:b});return l&&l!=="value"?[T,Object.assign({type:"window",as:[`imputed_${t}_value`],ops:[l],fields:[t],frame:k,ignorePeers:!1},d?{groupby:d}:{}),{type:"formula",expr:`datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,as:t}]:[T]}}class ND extends Js{constructor(t,r){var u,l,d;super(t),this.transform=r,this.transform=Sa(r);const b=(u=this.transform.as)!==null&&u!==void 0?u:[void 0,void 0];this.transform.as=[(l=b[0])!==null&&l!==void 0?l:r.on,(d=b[1])!==null&&d!==void 0?d:r.loess]}clone(){return new ND(null,Sa(this.transform))}dependentFields(){var t;return new Set([this.transform.loess,this.transform.on,...(t=this.transform.groupby)!==null&&t!==void 0?t:[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${cs(this.transform)}`}assemble(){const t=this.transform,{loess:r,on:u}
7840=t,l=ao(t,["loess","on"]);return Object.assign({type:"loess",x:u,y:r},l)}}class UC extends Js{constructor(t,r,u){super(t),this.transform=r,this.secondary=u}clone(){return new UC(null,Sa(this.transform),this.secondary)}static make(t,r,u,l){const d=r.component.data.sources,{from:b}=u;let k=null;if(function(T){return"data"in T}(b)){let T=o$(b.data,d);T||(T=new R_(b.data),d.push(T));const j=r.getName(`lookup_${l}`);k=new rp(T,j,"lookup",r.component.data.outputNodeRefCounts),r.component.data.outputNodes[j]=k}else if(function(T){return"selection"in T}(b)){const T=b.selection;if(u=Object.assign({as:T},u),!(k=r.getSelectionComponent(nc(T),T).materialized))throw new Error(re.noSameUnitLookup(T))}return new UC(t,u,k.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?qc(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${cs({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t=Object.assign({values:this.transform.from.fields},this.transform.as?{as:qc(this.transform.as)}:{});else{let r=this.transform.as;Ca(r)||(li(re.NO_FIELDS_NEEDS_AS),r="_lookup"),t={as:[r]}}return Object.assign(Object.assign({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},t),this.transform.default?{default:this.transform.default}:{})}}class ID extends Js{constructor(t,r){var u,l,d;super(t),this.transform=r,this.transform=Sa(r);const b=(u=this.transform.as)!==null&&u!==void 0?u:[void 0,void 0];this.transform.as=[(l=b[0])!==null&&l!==void 0?l:"prob",(d=b[1])!==null&&d!==void 0?d:"value"]}clone(){return new ID(null,Sa(this.transform))}dependentFields(){var t;return new Set([this.transform.quantile,...(t=this.transform.groupby)!==null&&t!==void 0?t:[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${cs(this.transform)}`}assemble(){const t=this.transform,{quantile:r}=t,u=ao(t,["quantile"]);return Object.assign({type:"quantile",field:r},u)}}class MD extends Js{constructor(t,r){var u,l,d;super(t),this.transform=r,this.transform=Sa(r);const b=(u=this.transform.as)!==null&&u!==void 0?u:[void 0,void 0];this.transform.as=[(l=b[0])!==null&&l!==void 0?l:r.on,(d=b[1])!==null&&d!==void 0?d:r.regression]}clone(){return new MD(null,Sa(this.transform))}dependentFields(){var t;return new Set([this.transform.regression,this.transform.on,...(t=this.transform.groupby)!==null&&t!==void 0?t:[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${cs(this.transform)}`}assemble(){const t=this.transform,{regression:r,on:u}=t,l=ao(t,["regression","on"]);return Object.assign({type:"regression",x:u,y:r},l)}}class FD extends Js{constructor(t,r){super(t),this.transform=r}clone(){return new FD(null,Sa(this.transform))}addDimensions(t){var r;this.transform.groupby=Xb(((r=this.transform.groupby)!==null&&r!==void 0?r:[]).concat(t),u=>u)}producedFields(){}dependentFields(){var t;return new Set([this.transform.pivot,this.transform.value,...(t=this.transform.groupby)!==null&&t!==void 0?t:[]])}hash(){return`PivotTransform ${cs(this.transform)}`}assemble(){const{pivot:t,value:r,groupby:u,limit:l,op:d}=this.transform;return Object.assign(Object.assign(Object.assign({type:"pivot",field:t,value:r},l!==void 0?{limit:l}:{}),d!==void 0?{op:d}:{}),u!==void 0?{groupby:u}:{})}}class RD extends Js{constructor(t,r){super(t),this.transform=r}clone(){return new RD(null,Sa(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${cs(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function n$(e){let t=0;return function r(u,l){var d;if(u instanceof R_&&!u.isGenerator&&!EC(u.data)&&(e.push(l),l={name:null,source:l.name,transform:[]}),u instanceof Kd&&(u.parent instanceof R_&&!l.source?(l.format=Object.assign(Object.assign({},(d=l.format)!==null&&d!==void 0?d:{}),{parse:u.assembleFormatParse()}),l.transform.push(...u.assembleTransforms(!0))):l.transform.push(...u.assembleTransforms())),u instanceof B_){l.name||(l.name=`data_${t++}`),!l.source||l.transform.length>0?(e.push(l),u.data=l.name):u.data=l.source;for(const b of u.assemble())e.push(b)}else switch((u instanceof PC||u instanceof jC||u instanceof LC||u instanceof N_||u instanceof I_||u instanceof zC||u instanceof L_||u instanceof Sv||u instanceof UC||u instanceof P_||u instanceof Jw||u instanceof TD||u instanceof DD||u instanceof OD||u instanceof ND||u instanceof ID||u instanceof MD||u instanceof gx||u instanceof RD||u instanceof FD)&&l.transform.push(u.assemble()),(u instanceof e1||u instanceof Qy||u instanceof Qw||u instanceof nb)&&l.transform.push(...u.assemble()),u instanceof rp&&(l.source&&l.transform.length===0?u.setSource(l.source):u.parent instanceof rp?u.setSource(l.name):(l.name||(l.name=`data_${t++}`),u.setSource(l.name),u.numChildren()===1&&(e.push(l),l={name:null,source:l.name,transform:[]}))),u.numChildren()){case 0:u instanceof rp&&(!l.source||l.transform.length>0)&&e.push(l);break;case 1:r(u.children[0],l);break;default:{l.name||(l.name=`data_${t++}`);let b=l.name;!l.source||l.transform.length>0?e.push(l):b=l.source;for(const k of u.children)r(k,{name:null,source:b,transform:[]});break}}}}function Vce(e){return e==="top"||e==="left"||Uo(e)?"header":"footer"}function $ce(e,t){var r;const{facet:u,config:l,child:d,component:b}=e;if(e.channelHasField(t)){const k=u[t],T=F_("title",null,l,t);let j=zw(k,l,{allowDisabling:!0,includeDefault:T===void 0||!!T});d.component.layoutHeaders[t].title&&(j=mo(j)?j.join(", "):j,j+=" / "+d.component.layoutHeaders[t].title,d.component.layoutHeaders[t].title=null);const $=F_("labelOrient",k,l,t),G=dl(((r=k.header)!==null&&r!==void 0?r:{}).labels,l.header.labels,!0),te=bo(["bottom","right"],$)?"footer":"header";b.layoutHeaders[t]={title:j,facetFieldDef:k,[te]:t==="facet"?[]:[r$(e,t,G)]}}}function r$(e,t,r){const u=t==="row"?"height":"width";return{labels:r,sizeSignal:e.child.component.layoutSize.get(u)?e.child.get
7840SizeSignalRef(u):void 0,axes:[]}}function i$(e,t){var r;const{child:u}=e;if(u.component.axes[t]){const{layoutHeaders:l,resolve:d}=e.component;if(d.axis[t]=qR(d,t),d.axis[t]==="shared"){const b=t==="x"?"column":"row",k=l[b];for(const T of u.component.axes[t]){const j=Vce(T.get("orient"));k[j]=(r=k[j])!==null&&r!==void 0?r:[r$(e,b,!1)];const $=BC(T,"main",e.config,{header:!0});$&&k[j][0].axes.push($),T.mainExtracted=!0}}}}function Hce(e){a5(e);const t=e.layout.columns===1?"width":"childWidth",r=e.layout.columns===void 0?"height":"childHeight";BD(e,t),BD(e,r)}function a5(e){for(const t of e.children)t.parseLayoutSize()}function BD(e,t){const r=wV(t),u=z3(r),l=e.component.resolve,d=e.component.layoutSize;let b;for(const k of e.children){const T=k.component.layoutSize.getWithExplicit(r),j=l.scale[u];if(j==="independent"&&T.value==="step"){b=void 0;break}if(b){if(j==="independent"&&b.value!==T.value){b=void 0;break}b=dx(b,T,r,"")}else b=T}if(b){for(const k of e.children)e.renameSignal(k.getName(r),e.getName(t)),k.component.layoutSize.set(r,"merged",!1);d.setWithExplicit(t,b)}else d.setWithExplicit(t,{explicit:!1,value:void 0})}function qce(e,t){const r=t==="width"?"x":"y",u=e.config,l=e.getScaleComponent(r);if(l){const d=l.get("type"),b=l.get("range");if(vm(d)){const k=kC(u.view,t);return sx(b)||Jy(k)?"step":k}return gR(u.view,t)}if(e.hasProjection||e.mark==="arc")return gR(u.view,t);{const d=kC(u.view,t);return Jy(d)?d.step:d}}function s5(e,t,r){return bi(t,Object.assign({suffix:`by_${bi(e)}`},r??{}))}class WC extends t${constructor(t,r,u,l){super(t,"facet",r,u,l,t.resolve),this.child=f5(t.spec,this,this.getName("child"),void 0,l),this.children=[this.child],this.facet=this.initFacet(t.facet,l)}initFacet(t,r){return bC(t)?zU(t,(u,l,d)=>bo([V1,$1],d)?l.field===void 0?(li(re.emptyFieldDef(l,d)),u):(u[d]=nR(l,d,r),u):(li(re.incompatibleChannel(d,"facet")),u),{}):{facet:nR(t,"facet",r)}}channelHasField(t){return!!this.facet[t]}fieldDef(t){return this.facet[t]}parseData(){this.component.data=PD(this),this.child.parseData()}parseLayoutSize(){a5(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(t){for(const r of x0)$ce(t,r);i$(t,"x"),i$(t,"y")}(this)}assembleSelectionTopLevelSignals(t){return this.child.assembleSelectionTopLevelSignals(t)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(t){return this.child.assembleSelectionData(t)}getHeaderLayoutMixins(){var t,r,u;const l={};for(const d of x0)for(const b of VR){const k=this.component.layoutHeaders[d],T=k[b],{facetFieldDef:j}=k;if(j){const $=F_("titleOrient",j,this.config,d);if(bo(["right","bottom"],$)){const G=_D(d,$);l.titleAnchor=(t=l.titleAnchor)!==null&&t!==void 0?t:{},l.titleAnchor[G]="end"}}if(T!=null&&T[0]){const $=d==="row"?"height":"width",G=b==="header"?"headerBand":"footerBand";d==="facet"||this.child.component.layoutSize.get($)||(l[G]=(r=l[G])!==null&&r!==void 0?r:{},l[G][d]=.5),k.title&&(l.offset=(u=l.offset)!==null&&u!==void 0?u:{},l.offset[d==="row"?"rowTitle":"columnTitle"]=10)}}return l}assembleDefaultLayout(){const{column:t,row:r}=this.facet,u=t?this.columnDistinctSignal():r?1:void 0;let l="all";return(r||this.component.resolve.scale.x!=="independent")&&(t||this.component.resolve.scale.y!=="independent")||(l="none"),Object.assign(Object.assign(Object.assign({},this.getHeaderLayoutMixins()),u?{columns:u}:{}),{bounds:"full",align:l})}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof WC))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroup(t){return this.parent&&this.parent instanceof WC?Object.assign(Object.assign({},this.channelHasField("column")?{encode:{update:{columns:{field:bi(this.facet.column,{prefix:"distinct"})}}}}:{}),super.assembleGroup(t)):super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],r=[],u=[];if(this.child instanceof WC){if(this.child.channelHasField("column")){const l=bi(this.child.facet.column);t.push(l),r.push("distinct"),u.push(`distinct_${l}`)}}else for(const l of w0){const d=this.child.component.scales[l];if(d&&!d.merged){const b=d.get("type"),k=d.get("range");if(vm(b)&&sx(k)){const T=n5(AD(this.child,l));T?(t.push(T),r.push("distinct"),u.push(`distinct_${T}`)):li(`Unknown field for ${l}. Cannot calculate view size.`)}}}return{fields:t,ops:r,as:u}}assembleFacet(){const{name:t,data:r}=this.component.data.facetRoot,{row:u,column:l}=this.facet,{fields:d,ops:b,as:k}=this.getCardinalityAggregateForChild(),T=[];for(const $ of x0){const G=this.facet[$];if(G){T.push(bi(G));const{bin:te,sort:se}=G;if(Du(te)&&T.push(bi(G,{binSuffix:"end"})),Ky(se)){const{field:he,op:ve=K3}=se,Be=s5(G,se);u&&l?(d.push(Be),b.push("max"),k.push(Be)):(d.push(he),b.push(ve),k.push(Be))}else if(mo(se)){const he=M_(G,$);d.push(he),b.push("max"),k.push(he)}}}const j=!!u&&!!l;return Object.assign({name:t,data:r,groupby:T},j||d.length>0?{aggregate:Object.assign(Object.assign({},j?{cross:j}:{}),d.length?{fields:d,ops:b,as:k}:{})}:{})}facetSortFields(t){const{facet:r}=this,u=r[t];return u?Ky(u.sort)?[s5(u,u.sort,{expr:"datum"})]:mo(u.sort)?[M_(u,t,{expr:"datum"})]:[bi(u,{expr:"datum"})]:[]}facetSortOrder(t){const{facet:r}=this,u=r[t];if(u){const{sort:l}=u;return[(Ky(l)?l.order:!mo(l)&&l)||"ascending"]}return[]}assembleLabelTitle(){const{facet:t,config:r}=this;if(t.facet)return $R(t.facet,"facet",r);const u={row:["top","bottom"],column:["left","right"]};for(const l of WR)if(t[l]){const d=F_("labelOrient",t[l],r,l);if(bo(u[l],d))return $R(t[l],l,r)}}assembleMarks(){const{child:t}=this,r=function(b){const k=[],T=n$(k);for(const j of b.children)T(j,{source:b.name,name:null,transform:[]});return k}(this.component.data.facetRoot),u=t.assembleGroupEncodeEntry(!1),l=this.assembleLabelTitle()||t.assembleTitle(),d=t.assembleGroupStyle();return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:this.getName("cell"),type:"group"},l?{title:l}:{}),d?{style:d}:{}),{from:{facet:this.assembleFacet()},sort:{field:x0.map(b=>
7840this.facetSortFields(b)).flat(),order:x0.map(b=>this.facetSortOrder(b)).flat()}}),r.length>0?{data:r}:{}),u?{encode:{update:u}}:{}),t.assembleGroup(function(b,k){if(b.component.selection&&di(b.component.selection).length){const T=ns(b.getName("cell"));k.unshift({name:"facet",value:{},on:[{events:Ow("mousemove","scope"),update:`isTuple(facet) ? facet : group(${T}).datum`}]})}return AR(k)}(this,[])))]}getMapping(){return this.facet}}function o$(e,t){var r,u,l,d,b,k,T,j,$,G;for(const te of t){const se=te.data;if((!e.name||!te.hasName()||e.name===te.dataName)&&!(!((r=e.format)===null||r===void 0)&&r.mesh&&(!((u=se.format)===null||u===void 0)&&u.feature)||(!((l=e.format)===null||l===void 0)&&l.feature||!((d=se.format)===null||d===void 0)&&d.feature)&&((b=e.format)===null||b===void 0?void 0:b.feature)!==((k=se.format)===null||k===void 0?void 0:k.feature)||(!((T=e.format)===null||T===void 0)&&T.mesh||!((j=se.format)===null||j===void 0)&&j.mesh)&&(($=e.format)===null||$===void 0?void 0:$.mesh)!==((G=se.format)===null||G===void 0?void 0:G.mesh))){if(uD(e)&&uD(se)){if(uC(e.values,se.values))return te}else if(EC(e)&&EC(se)){if(e.url===se.url)return te}else if(bW(e)&&e.name===te.dataName)return te}}return null}function Gce(e,t){if(e.data||!e.parent){if(e.data===null){const u=new R_({values:[]});return t.push(u),u}const r=o$(e.data,t);if(r)return Hw(e.data)||(r.data.format=function(u,...l){for(const d of l)qie(u,d??{});return u}({},e.data.format,r.data.format)),!r.hasName()&&e.data.name&&(r.dataName=e.data.name),r;{const u=new R_(e.data);return t.push(u),u}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function PD(e){var t,r,u,l,d,b,k,T,j,$;let G=Gce(e,e.component.data.sources);const{outputNodes:te,outputNodeRefCounts:se}=e.component.data,he=e.parent?e.parent.component.data.ancestorParse.clone():new Ise,ve=e.data;Hw(ve)?(xW(ve)?G=new jC(G,ve.sequence):wR(ve)&&(G=new PC(G,ve.graticule)),he.parseNothing=!0):((t=ve==null?void 0:ve.format)===null||t===void 0?void 0:t.parse)===null&&(he.parseNothing=!0),G=(r=Kd.makeExplicit(G,e,he))!==null&&r!==void 0?r:G,G=new gx(G);const Be=e.parent&&j_(e.parent);(Sc(e)||Ov(e))&&Be&&(G=(u=e1.makeFromEncoding(G,e))!==null&&u!==void 0?u:G),e.transforms.length>0&&(G=function(Et,mn,An){var xn,Wn;let Un=0;for(const Kn of mn.transforms){let Qn,ir;if(Vse(Kn))Qn=Et=new I_(Et,Kn),ir="derived";else if(_W(Kn)){const Nr=_ce(Kn);Qn=Et=(xn=Kd.makeWithAncestors(Et,{},Nr,An))!==null&&xn!==void 0?xn:Et,Et=new N_(Et,mn,Kn.filter)}else if($se(Kn))Qn=Et=e1.makeFromTransform(Et,Kn,mn),ir="number";else if(qse(Kn))ir="date",An.getWithExplicit(Kn.field).value===void 0&&(Et=new Kd(Et,{[Kn.field]:ir}),An.set(Kn.field,ir,!1)),Qn=Et=Qy.makeFromTransform(Et,Kn);else if(Gse(Kn))Qn=Et=Sv.makeFromTransform(Et,Kn),ir="number",DR(mn)&&(Et=new gx(Et));else if(Mse(Kn))Qn=Et=UC.make(Et,mn,Kn,Un++),ir="derived";else if(zse(Kn))Qn=Et=new P_(Et,Kn),ir="number";else if(Use(Kn))Qn=Et=new Jw(Et,Kn),ir="number";else if(Kse(Kn))Qn=Et=nb.makeFromTransform(Et,Kn),ir="derived";else if(Yse(Kn))Qn=Et=new TD(Et,Kn),ir="derived";else if(Wse(Kn))Qn=Et=new DD(Et,Kn),ir="derived";else if(Fse(Kn))Qn=Et=new FD(Et,Kn),ir="derived";else if(Lse(Kn))Et=new RD(Et,Kn);else if(Hse(Kn))Qn=Et=Qw.makeFromTransform(Et,Kn),ir="derived";else if(Rse(Kn))Qn=Et=new OD(Et,Kn),ir="derived";else if(Bse(Kn))Qn=Et=new ID(Et,Kn),ir="derived";else if(Pse(Kn))Qn=Et=new MD(Et,Kn),ir="derived";else{if(!jse(Kn)){li(re.invalidTransformIgnored(Kn));continue}Qn=Et=new ND(Et,Kn),ir="derived"}if(Qn&&ir!==void 0)for(const Nr of(Wn=Qn.producedFields())!==null&&Wn!==void 0?Wn:[])An.set(Nr,ir,!1)}return Et}(G,e,he));const ze=function(Et){const mn={};if(Sc(Et)&&Et.component.selection)for(const An of di(Et.component.selection)){const xn=Et.component.selection[An];for(const Wn of xn.project.items)!Wn.channel&&dC(Wn.field)>1&&(mn[Wn.field]="flatten")}return mn}(e),Ue=kce(e);G=(l=Kd.makeWithAncestors(G,{},Object.assign(Object.assign({},ze),Ue),he))!==null&&l!==void 0?l:G,Sc(e)&&(G=L_.parseAll(G,e),G=zC.parseAll(G,e)),(Sc(e)||Ov(e))&&(Be||(G=(d=e1.makeFromEncoding(G,e))!==null&&d!==void 0?d:G),G=(b=Qy.makeFromEncoding(G,e))!==null&&b!==void 0?b:G,G=I_.parseAllForSortIndex(G,e));const st=e.getName(cD),ut=new rp(G,st,cD,se);if(te[st]=ut,G=ut,Sc(e)){const Et=Sv.makeFromEncoding(G,e);Et&&(G=Et,DR(e)&&(G=new gx(G))),G=(k=Qw.makeFromEncoding(G,e))!==null&&k!==void 0?k:G,G=(T=nb.makeFromEncoding(G,e))!==null&&T!==void 0?T:G}Sc(e)&&(G=(j=LC.make(G,e))!==null&&j!==void 0?j:G);const mt=e.getName(Vd),pt=new rp(G,mt,Vd,se);te[mt]=pt,G=pt,Sc(e)&&function(Et,mn){Gw(Et,An=>{const xn=An.name,Wn=Et.getName(`lookup_${xn}`);Et.component.data.outputNodes[Wn]=An.materialized=new rp(new N_(mn,Et,{selection:xn}),Wn,"lookup",Et.component.data.outputNodeRefCounts)})}(e,pt);let Ct=null;if(Ov(e)){const Et=e.getName("facet");
7840G=($=function(mn,An){const{row:xn,column:Wn}=An;if(xn&&Wn){let Un=null;for(const Kn of[xn,Wn])if(Ky(Kn.sort)){const{field:Qn,op:ir=K3}=Kn.sort;mn=Un=new Jw(mn,{joinaggregate:[{op:ir,field:Qn,as:s5(Kn,Kn.sort,{forAs:!0})}],groupby:[bi(Kn)]})}return Un}return null}(G,e.facet))!==null&&$!==void 0?$:G,Ct=new B_(G,e,Et,pt.getSource()),te[Et]=Ct}return Object.assign(Object.assign({},e.component.data),{outputNodes:te,outputNodeRefCounts:se,raw:ut,main:pt,facetRoot:Ct,ancestorParse:he})}class Kce extends o5{constructor(t,r,u,l){var d,b,k,T;super(t,"concat",r,u,l,t.resolve),((b=(d=t.resolve)===null||d===void 0?void 0:d.axis)===null||b===void 0?void 0:b.x)!=="shared"&&((T=(k=t.resolve)===null||k===void 0?void 0:k.axis)===null||T===void 0?void 0:T.y)!=="shared"||li(re.CONCAT_CANNOT_SHARE_AXIS),this.children=this.getChildren(t).map((j,$)=>f5(j,this,this.getName("concat_"+$),void 0,l))}parseData(){this.component.data=PD(this);for(const t of this.children)t.parseData()}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const r of di(t.component.selection))this.component.selection[r]=t.component.selection[r]}}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){for(const t of this.children)t.parseAxesAndHeaders()}getChildren(t){return iD(t)?t.vconcat:mR(t)?t.hconcat:t.concat}parseLayoutSize(){Hce(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(t){return this.children.reduce((r,u)=>u.assembleSelectionTopLevelSignals(r),t)}assembleSignals(){return this.children.forEach(t=>t.assembleSignals()),[]}assembleLayoutSignals(){const t=HR(this);for(const r of this.children)t.push(...r.assembleLayoutSignals());return t}assembleSelectionData(t){return this.children.reduce((r,u)=>u.assembleSelectionData(r),t)}assembleMarks(){return this.children.map(t=>{const r=t.assembleTitle(),u=t.assembleGroupStyle(),l=t.assembleGroupEncodeEntry(!1);return Object.assign(Object.assign(Object.assign(Object.assign({type:"group",name:t.getName("group")},r?{title:r}:{}),u?{style:u}:{}),l?{encode:{update:l}}:{}),t.assembleGroup())})}assembleDefaultLayout(){const t=this.layout.columns;return Object.assign(Object.assign({},t!=null?{columns:t}:{}),{bounds:"full",align:"each"})}}const Yce=Object.assign(Object.assign({disable:1,gridScale:1,scale:1},_z),{labelExpr:1,encode:1}),a$=di(Yce);class u5 extends J1{constructor(t={},r={},u=!1){super(),this.explicit=t,this.implicit=r,this.mainExtracted=u}
7840clone(){return new u5(Sa(this.explicit),Sa(this.implicit),this.mainExtracted)}hasAxisPart(t){return t==="axis"||(t==="grid"||t==="title"?!!this.get(t):!function(r){return r===!1||r===null}(this.get(t)))}hasOrientSignalRef(){return Uo(this.explicit.orient)}}function Xce(e){return w0.reduce((t,r)=>(e.component.scales[r]&&(t[r]=[function(u,l){var d,b,k;let T=l.axis(u);const j=new u5,$=Bl(l.encoding[u]),{mark:G,config:te}=l,se=(T==null?void 0:T.orient)||((d=te[u==="x"?"axisX":"axisY"])===null||d===void 0?void 0:d.orient)||((b=te.axis)===null||b===void 0?void 0:b.orient)||function(mt){return mt==="x"?"bottom":"left"}(u),he=l.getScaleComponent(u).get("type"),ve=oce(u,he,se,l.config),Be=T!==void 0?!T:zR("disable",te,T==null?void 0:T.style,ve).configValue;if(j.set("disable",Be,T!==void 0),Be)return j;const ze=function(mt,pt,Ct,Et,mn){const An=pt==null?void 0:pt.labelAngle;if(An!==void 0)return Uo(An)?An:O3(An);{const{configValue:xn}=zR("labelAngle",mt.config,pt==null?void 0:pt.style,mn);return xn!==void 0?O3(xn):Ct===pc&&bo([WF,UF],Et.type)?270:void 0}}(l,T=T||{},u,$,ve),Ue={fieldOrDatumDef:$,axis:T,channel:u,model:l,scaleType:he,orient:se,labelAngle:ze,mark:G,config:te};for(const mt of a$){const pt=mt in dV?dV[mt](Ue):kz(mt)?T[mt]:void 0,Ct=pt!==void 0,Et=ele(pt,mt,T,l,u);if(Ct&&Et)j.set(mt,pt,Et);else{const{configValue:mn,configFrom:An}=kz(mt)&&mt!=="values"?zR(mt,l.config,T.style,ve):{},xn=mn!==void 0;Ct&&!xn?j.set(mt,pt,Et):(An!=="vgAxisConfig"||tle.has(mt)&&xn||kF(mn)||Uo(mn))&&j.set(mt,mn,!1)}}const st=(k=T.encoding)!==null&&k!==void 0?k:{},ut=wz.reduce((mt,pt)=>{var Ct;if(!j.hasAxisPart(pt))return mt;const Et=_V((Ct=st[pt])!==null&&Ct!==void 0?Ct:{},l),mn=pt==="labels"?function(An,xn,Wn){var Un;const{encoding:Kn,config:Qn}=An,ir=(Un=Bl(Kn[xn]))!==null&&Un!==void 0?Un:Bl(Kn[$y(xn)]),Nr=An.axis(xn)||{},{format:Jr,formatType:Lr}=Nr;return Lw(Lr)?Object.assign({text:GF({fieldOrDatumDef:ir,field:"datum.value",format:Jr,formatType:Lr,config:Qn})},Wn):Wn}(l,u,Et):Et;return mn===void 0||su(mn)||(mt[pt]={update:mn}),mt},{});return su(ut)||j.set("encode",ut,!!T.encoding||T.labelAngle!==void 0),j}(r,e)]),t),{})}const Jce={bottom:"top",top:"bottom",left:"right",right:"left"};function Qce(e,t){if(!e)return t.map(r=>r.clone());{if(e.length!==t.length)return;const r=e.length;for(let u=0;u<r;u++){const l=e[u],d=t[u];if(!!l!=!!d)return;if(l&&d){const b=l.getWithExplicit("orient"),k=d.getWithExplicit("orient");if(b.explicit&&k.explicit&&b.value!==k.value)return;e[u]=Zce(l,d)}}}return e}function Zce(e,t){for(const r of a$){const u=dx(e.getWithExplicit(r),t.getWithExplicit(r),r,"axis",(l,d)=>{switch(r){case"title":return LU(l,d);case"gridScale":return{explicit:l.explicit,value:dl(l.value,d.value)}}return sD(l,d,r,"axis")});e.setWithExplicit(r,u)}return e}function ele(e,t,r,u,l){if(t==="disable")return r!==void 0;switch(r=r||{},t){case"titleAngle":case"labelAngle":return e===(Uo(r.labelAngle)?r.labelAngle:O3(r.labelAngle));case"values":return!!r.values;case"encode":return!!r.encoding||!!r.labelAngle;case"title":if(e===mV(u,l))return!0}return e===r[t]}const tle=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function nle(e,t,r,{graticule:u}){const l=Py(e)?Object.assign({},e):{type:e},d=Ns("orient",l,r);if(l.orient=function(b,k,T){switch(b){case I3:case CF:case SF:case Cz:case Zie:case Qie:return}const{x:j,y:$,x2:G,y2:te}=k;switch(b){case T3:if(Si(j)&&(tp(j.bin)||Si($)&&$.aggregate&&!j.aggregate))return"vertical";if(Si($)&&(tp($.bin)||Si(j)&&j.aggregate&&!$.aggregate))return"horizontal";if(te||G){if(T)return T;if(!G&&(Si(j)&&j.type===Pw&&!Du(j.bin)||QF(j)))return"horizontal";if(!te&&(Si($)&&$.type===Pw&&!Du($.bin)||QF($)))return"vertical"}case M3:if(G&&(!Si(j)||!tp(j.bin))&&te&&(!Si($)||!tp($.bin)))return;case D3:if(te)return Si($)&&tp($.bin)?"horizontal":"vertical";if(G)return Si(j)&&tp(j.bin)?"vertical":"horizontal";if(b===M3){if(j&&!$)return"vertical";if($&&!j)return"horizontal"}case N3:case EF:{const se=Yy(j),he=Yy($);if(se&&!he)return b!=="tick"?"horizontal":"vertical";if(!se&&he)return b!=="tick"?"vertical":"horizontal";if(se&&he){const ve=j,Be=$,ze=ve.type===S_,Ue=Be.type===S_;return ze&&!Ue?b!=="tick"?"vertical":"horizontal":!ze&&Ue?b!=="tick"?"horizontal":"vertical":!ve.aggregate&&Be.aggregate?b!=="tick"?"vertical":"horizontal":ve.aggregate&&!Be.aggregate?b!=="tick"?"horizontal":"vertical":T||"vertical"}return T||void 0}}return"vertical"}(l.type,t,d),d!==void 0&&d!==l.orient&&li(re.orientOverridden(l.orient,d)),l.type==="bar"&&l.orient){const b=Ns("cornerRadiusEnd",l,r);
7840if(b!==void 0){const k=l.orient==="horizontal"&&t.x2||l.orient==="vertical"&&t.y2?["cornerRadius"]:noe[l.orient];for(const T of k)l[T]=b;l.cornerRadiusEnd!==void 0&&delete l.cornerRadiusEnd}}return Ns("opacity",l,r)===void 0&&(l.opacity=function(b,k){if(bo([I3,EF,CF,SF],b)&&!iR(k))return .7}(l.type,t)),l.filled===void 0&&(l.filled=!u&&function(b,k){const T=Ww("filled",b,k),j=b.type;return dl(T,j!==I3&&j!==N3&&j!==M3)}(l,r)),Ns("cursor",l,r)===void 0&&(l.cursor=function(b,k,T){return k.href||b.href||Ns("href",b,T)?"pointer":b.cursor}(l,t,r)),l}function c5(e,t){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"})),$d("x",e,{defaultPos:"mid"})),$d("y",e,{defaultPos:"mid"})),df("size",e)),df("angle",e)),function(r,u,l){return l?{shape:{value:l}}:df("shape",r)}(e,0,t))}const jD={arc:{vgMark:"arc",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),$d("x",e,{defaultPos:"mid"})),$d("y",e,{defaultPos:"mid"})),hx(e,"radius","arc")),hx(e,"theta","arc"))},area:{vgMark:"area",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"})),dD("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="horizontal"})),dD("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="vertical"})),ER(e))},bar:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),hx(e,"x","bar")),hx(e,"y","bar"))},circle:{vgMark:"symbol",encodeEntry:e=>c5(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),postEncodingTransform:e=>{const{encoding:t}=e,r=t.shape;return[Object.assign({type:"geoshape",projection:e.projectionName()},r&&Si(r)&&r.type===A_?{field:bi(r,{expr:"datum"})}:{})]}}
7840,image:{vgMark:"image",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"})),hx(e,"x","image")),hx(e,"y","image")),_R(e,"url"))},line:{vgMark:"line",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),$d("x",e,{defaultPos:"mid"})),$d("y",e,{defaultPos:"mid"})),df("size",e,{vgChannel:"strokeWidth"})),ER(e))},point:{vgMark:"symbol",encodeEntry:e=>c5(e)},rect:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),hx(e,"x","rect")),hx(e,"y","rect"))},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,r=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?Object.assign(Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),dD("x",e,{defaultPos:r==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:r!=="vertical"})),dD("y",e,{defaultPos:r==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:r!=="horizontal"})),df("size",e,{vgChannel:"strokeWidth"})):{}}},square:{vgMark:"symbol",encodeEntry:e=>c5(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:r}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},k0(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"})),$d("x",e,{defaultPos:"mid"})),$d("y",e,{defaultPos:"mid"})),_R(e)),df("size",e,{vgChannel:"fontSize"})),df("angle",e)),NW("align",function(u,l,d){if(Ns("align",u,d)===void 0)return"center"}(e.markDef,0,t))),NW("baseline",function(u,l,d){if(Ns("baseline",u,d)===void 0)return"middle"}(e.markDef,0,t))),$d("radius",e,{defaultPos:null,isMidPoint:!0})),$d("theta",e,{defaultPos:null,isMidPoint:!0}))}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:r}=e,u=r.orient,l=u==="horizontal"?"width":"height",d=u==="horizontal"?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),$d("x",e,{defaultPos:"mid",vgChannel:"xc"})),$d("y",e,{defaultPos:"mid",vgChannel:"yc"})),df("size",e,{defaultValue:function(b){var k;const{config:T,markDef:j}=b,{orient:$}=j,G=$==="horizontal"?"width":"height",te=b.getScaleComponent($==="horizontal"?"x":"y"),se=(k=Ns("size",j,T,{vgChannel:G}))!==null&&k!==void 0?k:T.tick.bandSize;if(se!==void 0)return se;{const he=te?te.get("range"):void 0;return he&&sx(he)&&fl(he.step)?3*he.step/4:3*oD(T.view,G)/4}}(e),vgChannel:l})),{[d]:Gc(Ns("thickness",r,t))})}},trail:{vgMark:"trail",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},k0(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"})),$d("x",e,{defaultPos:"mid"})),$d("y",e,{defaultPos:"mid"})),df("size",e)),ER(e))}};function rle(e){return bo([N3,D3,eoe],e.mark)?function(t){const r=UU(t.mark,t.encoding),u=LD(t,{fromPrefix:r.length>0?s$:""});return r.length>0?[{name:t.getName("pathgroup"),type:"group",from:{facet:{name:s$+t.requestDataName(Vd),data:t.requestDataName(Vd),groupby:r}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:u}]:u}(e):bo([T3],e.mark)?function(t){const r=BF.some(u=>Ns(u,t.markDef,t.config));if(t.stack&&!t.fieldDef("size")&&r){const[u]=LD(t,{fromPrefix:u$}),l=t.scaleName(t.stack.fieldChannel),d=(te={})=>t.vgField(t.stack.fieldChannel,te),b=(te,se)=>{const he=[d({prefix:"min",suffix:"start",expr:se}),d({prefix:"max",suffix:"start",expr:se}),d({prefix:"min",suffix:"end",expr:se}),d({prefix:"max",suffix:"end",expr:se})];return`${te}(${he.map(ve=>`scale('${l}',${ve})`).join(",")})`};let k,T;t.stack.fieldChannel==="x"?(k=Object.assign(Object.assign({},cC(u.encode.update,["y","yc","y2","height",...BF])),{x:{signal:b("min","datum")},x2:{signal:b("max","datum")},clip:{value:!0}}),T={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},u.encode.update=Object.assign(Object.assign({},U1(u.encode.update,["y","yc","y2"])),{height:{field:{group:"height"}}})):(k=Object.assign(Object.assign({}
7840,cC(u.encode.update,["x","xc","x2","width"])),{y:{signal:b("min","datum")},y2:{signal:b("max","datum")},clip:{value:!0}}),T={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},u.encode.update=Object.assign(Object.assign({},U1(u.encode.update,["x","xc","x2"])),{width:{field:{group:"width"}}}));for(const te of BF){const se=Ww(te,t.markDef,t.config);u.encode.update[te]?(k[te]=u.encode.update[te],delete u.encode.update[te]):se&&(k[te]=Gc(se)),se&&(u.encode.update[te]={value:0})}const j=t.fieldDef(t.stack.groupbyChannel),$=bi(j)?[bi(j)]:[];return(j!=null&&j.bin||j!=null&&j.timeUnit)&&$.push(bi(j,{binSuffix:"end"})),(k=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((te,se)=>{if(u.encode.update[se])return Object.assign(Object.assign({},te),{[se]:u.encode.update[se]});{const he=Ww(se,t.markDef,t.config);return he!==void 0?Object.assign(Object.assign({},te),{[se]:Gc(he)}):te}},k)).stroke&&(k.strokeForeground={value:!0},k.strokeOffset={value:0}),[{type:"group",from:{facet:{data:t.requestDataName(Vd),name:u$+t.requestDataName(Vd),groupby:$,aggregate:{fields:[d({suffix:"start"}),d({suffix:"start"}),d({suffix:"end"}),d({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:k},marks:[{type:"group",encode:{update:T},marks:[u]}]}]}return LD(t)}(e):LD(e)}const s$="faceted_path_",u$="stack_group_";function LD(e,t={fromPrefix:""}){const{mark:r,markDef:u,config:l}=e,d=dl(u.clip,function(te){const se=te.getScaleComponent("x"),he=te.getScaleComponent("y");return!!(se&&se.get("selectionExtent")||he&&he.get("selectionExtent"))||void 0}(e),function(te){const se=te.component.projection;return!(!se||se.isFit)||void 0}(e)),b=FU(u),k=e.encoding.key,T=function(te){const{encoding:se,stack:he,mark:ve,markDef:Be,config:ze}=te,Ue=se.order;if(!(!mo(Ue)&&Y1(Ue)&&dz(Ue.value)||!Ue&&dz(Ns("order",Be,ze)))){if((mo(Ue)||Si(Ue))&&!he)return BU(Ue,{expr:"datum"});if(Iw(ve)){const st=Be.orient==="horizontal"?"y":"x",ut=se[st];if(Si(ut)){const mt=ut.sort;return mo(mt)?{field:bi(ut,{prefix:st,suffix:"sort_index",expr:"datum"})}:Ky(mt)?{field:bi({aggregate:iR(te.encoding)?mt.op:void 0,field:mt.field},{expr:"datum"})}:yU(mt)?{field:bi(te.fieldDef(mt.encoding),{expr:"datum"}),order:mt.order}:mt===null?void 0:{field:bi(ut,{binSuffix:te.stack&&te.stack.impute?"mid":void 0,expr:"datum"})}}}}}(e),j=function(te){if(!te.component.selection)return null;const se=di(te.component.selection).length;let he=se,ve=te.parent;for(;ve&&he===0;)he=di(ve.component.selection).length,ve=ve.parent;return he?{interactive:se>0}:null}(e),$=Ns("aria",u,l),G=jD[r].postEncodingTransform?jD[r].postEncodingTransform(e):null;return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName("marks"),type:jD[r].vgMark},d?{clip:!0}:{}),b?{style:b}:{}),k?{key:k.field}:{}),T?{sort:T}:{}),j||{}),$===!1?{aria:$}:{}),{from:{data:t.fromPrefix+e.requestDataName(Vd)},encode:{update:jD[r].encodeEntry(e)}}),G?{transform:G}:{})]}class c$ extends t${constructor(t,r,u,l={},d){var b,k;super(t,"unit",r,u,d,void 0,tW(t)?t.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection={},this.children=[];const T=Py(t.mark)?t.mark.type:t.mark;this.markDef=nle(t.mark,(b=t.encoding)!==null&&b!==void 0?b:{},d,{graticule:t.data&&wR(t.data)});const j=this.encoding=use((k=t.encoding)!==null&&k!==void 0?k:{},this.markDef,d);this.size=function({encoding:$,size:G}){for(const te of w0){const se=Hy(te);Jy(G[se])&&Yy($[te])&&(delete G[se],li(re.stepDropped(se)))}return G}({encoding:j,size:tW(t)?Object.assign(Object.assign(Object.assign({},l),t.width?{width:t.width}:{}),t.height?{height:t.height}:{}):l}),this.stack=sW(T,j),this.specifiedScales=this.initScales(T,j),this.specifiedAxes=this.initAxes(j),this.specifiedLegends=this.initLegend(j),this.specifiedProjection=t.projection,this.selection=t.selection}get hasProjection(){const{encoding:t}=this,r=this.mark===Sz,u=t&&loe.some(l=>ta(t[l]));return r||u}scaleDomain(t){const r=this.specifiedScales[t];return r?r.domain:void 0}axis(t){return this.specifiedAxes[t]}legend(t){return this.specifiedLegends[t]}initScales(t,r){return U3.reduce((u,l)=>{var d;const b=Bl(r[l]);return b&&(u[l]=(d=b.scale)!==null&&d!==void 0?d:{}),u},{})}initAxes(t){return w0.reduce((r,u)=>{const l=t[u];if(ta(l)||u===pc&&ta(t.x2)||u===Rl&&ta(t.y2)){const d=ta(l)?l.axis:void 0;r[u]=d&&Object.assign({},d)}return r},{})}initLegend(t){return voe.reduce((r,u)=>{const l=Bl(t[u]);if(l&&function(d){switch(d){case mm:case Wy:case Vy:case G1:case gm:case K1:case nx:case rx:return!0;case ex:case tx:case Fw:return!1}}(u)){const d=l.legend;r[u]=d&&Object.assign({},d)}return r},{})}parseData(){this.component.data=PD(this)}parseLayoutSize(){(function(t){const{size:r,component:u}=t;for(const l of w0){const d=Hy(l);if(r[d]){const b=r[d];u.layoutSize.set(d,Jy(b)?"step":b,!0)}else{const b=qce(t,d);u.layoutSize.set(d,b,!1)}}})(this)}parseSelections(){this.component.selection=function(t,r){var u;const l={},d=t.config.selection;for(const b of di(r??{})){const k=Sa(r[b]),T=d[k.type],j=ao(T,["fields","encodings"]);for(const te in j)te==="encodings"&&k.fields||te==="fields"&&k.encodings||(te==="mark"&&(k[te]=Object.assign(Object.assign({},j[te]),k[te])),k[te]!==void 0&&k[te]!==!0||(k[te]=(u=j[te])!==null&&u!==void 0?u:k[te]));const $=nc(b),G=l[$]=Object.assign(Object.assign({},k),{name:$,events:Ca(k.on)?Ow(k.on,"scope"):Sa(k.on)});pD(G,te=>{te.has(G)&&te.parse&&te.parse(t,G,k,r[b])})}return l}(this,this.selection)}parseMarkGroup(){this.component.mark=rle(this)}parseAxesAndHeaders(){this.component.axes=Xce(this)}assembleSelectionTopLevelSignals(t){return function(r,u){let l=!1;return Gw(r,(d,b)=>{const k=d.name,T=ns(k+qw);if(u.filter(j=>j.name===k).length===0){const j=d.resolve==="global"?"union":d.resolve,$=d.type==="multi"?", true)":")";u.push({name:d.name,update:`${HW}(${T}, ${ns(j)}${$}`})}l=!0,b.topLevelSignals&&(u=b.topLevelSignals(r,d,u)),pD(d,j=>{j.topLevelSignals&&(u=j.topLevelSignals(r,d,u))})}),l&&u.filter(d=>d.name==="unit").length===0&&u.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]}),AR(u)}(this,t)}assembleSignals(){return[...uV(this),...function(t,r){return Gw(t,(u,l)=>{const d=u.name;let b=l.modifyExpr(t,u);r.push(...l.signals(t,u)),pD(u,k=>{k.signals&&(r=k.signals(t,u,r)),k.modifyExpr&&(b=k.modifyExpr(t,u,b))}),r.push({name:d+oue,on:[{events:{signal:u.name+Zy},update:`modify(${ns(u.name+qw)}, ${b})`}]})}),AR(r)}(this,[])]}assembleSelectionData(t){return function(r,u){const l=[...u];return Gw(r,d=>{const b={name:d.name+qw};if(d.init){const k=d.project.items.map(j=>ao(j,["signals"])),T=d.init.map(j=>D_(j,!1));b.values=d.type==="interval"?[{unit:Q1(r,{escape:!1}),fields:k,values:T}]:T.map(j=>({unit:Q1(r,{escape:!1}),fields:k,values:j}))}l.filter(k=>k.name===d.name+qw).length||l.push(b)}),l}(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return HR(this)}assembleMarks(){var t;let r=(t=this.component.mark)!==null&&t!==void 0?t:[];return this.parent&&j_(this.parent)||(r=WW(this,r)),r.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(t){return Vw(this.encoding,t)}fieldDef(t){return Xy(this.encoding[t])}typedFieldDef(t){const r=this.fieldDef(t);return Cg(r)?r:null}}class l5 extends o5{constructor(t,r,u,l,d){super(t,"layer",r,u,d,t.resolve,t.view
7840);const b=Object.assign(Object.assign(Object.assign({},l),t.width?{width:t.width}:{}),t.height?{height:t.height}:{});this.children=t.layer.map((k,T)=>{if(aD(k))return new l5(k,this,this.getName("layer_"+T),b,d);if(W1(k))return new c$(k,this,this.getName("layer_"+T),b,d);throw new Error(re.invalidSpec(k))})}parseData(){this.component.data=PD(this);for(const t of this.children)t.parseData()}parseLayoutSize(){(function(t){a5(t),BD(t,"width"),BD(t,"height")})(this)}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const r of di(t.component.selection))this.component.selection[r]=t.component.selection[r]}}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){(function(t){var r;const{axes:u,resolve:l}=t.component,d={top:0,bottom:0,right:0,left:0};for(const b of t.children){b.parseAxesAndHeaders();for(const k of di(b.component.axes))l.axis[k]=qR(t.component.resolve,k),l.axis[k]==="shared"&&(u[k]=Qce(u[k],b.component.axes[k]),u[k]||(l.axis[k]="independent",delete u[k]))}for(const b of w0){for(const k of t.children)if(k.component.axes[b]){if(l.axis[b]==="independent"){u[b]=((r=u[b])!==null&&r!==void 0?r:[]).concat(k.component.axes[b]);for(const T of k.component.axes[b]){const{value:j,explicit:$}=T.getWithExplicit("orient");if(!Uo(j)){if(d[j]>0&&!$){const G=Jce[j];d[j]>d[G]&&T.set("orient",G,!1)}d[j]++}}}delete k.component.axes[b]}if(l.axis[b]==="independent"&&u[b]&&u[b].length>1)for(const k of u[b])k.get("grid")&&!k.explicit.grid&&(k.implicit.grid=!1)}})(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce((r,u)=>u.assembleSelectionTopLevelSignals(r),t)}assembleSignals(){return this.children.reduce((t,r)=>t.concat(r.assembleSignals()),uV(this))}assembleLayoutSignals(){return this.children.reduce((t,r)=>t.concat(r.assembleLayoutSignals()),HR(this))}assembleSelectionData(t){return this.children.reduce((r,u)=>u.assembleSelectionData(r),t)}assembleTitle(){let t=super.assembleTitle();if(t)return t;for(const r of this.children)if(t=r.assembleTitle())return t}assembleLayout(){return null}assembleMarks(){return function(t,r){for(const u of t.children)Sc(u)&&(r=WW(u,r));return r}(this,this.children.flatMap(t=>t.assembleMarks()))}assembleLegends(){return this.children.reduce((t,r)=>t.concat(r.assembleLegends()),MV(this))}}function f5(e,t,r,u,l){if(Y3(e))return new WC(e,t,r,l);if(aD(e))return new l5(e,t,r,u,l);if(W1(e))return new c$(e,t,r,u,l);if(function(d){return iD(d)||mR(d)||pR(d)}(e))return new Kce(e,t,r,l);throw new Error(re.invalidSpec(e))}function ile(e,t={}){t.logger&&function(r){$3=r}(t.logger),t.fieldTitle&&OU(t.fieldTitle);try{const r=iW(fz(t.config,e.config)),u=mW(e,r),l=f5(u,null,"",void 0,r);return l.parse(),function(d,b){YR(d.sources);let k=0,T=0;for(let j=0;j<SD&&UV(d,b);j++)k++;d.sources.map(JR);for(let j=0;j<SD&&UV(d,b);j++)T++;YR(d.sources),Math.max(k,T)===SD&&li(`Maximum optimization runs(${SD}) reached.`)}(l.component.data,l),{spec:function(d,b,k={},T){const j=d.config?_se(d.config):void 0,$=[].concat(d.assembleSelectionData([]),function(Be,ze){var Ue,st;const ut=[],mt=n$(ut);let pt=0;for(const Et of Be.sources)Et.hasName()||(Et.dataName=`source_${pt++}`),mt(Et,Et.assemble());for(const Et of ut)Et.transform.length===0&&delete Et.transform;let Ct=0;for(const[Et,mn]of ut.entries())((Ue=mn.transform)!==null&&Ue!==void 0?Ue:[]).length!==0||mn.source||ut.splice(Ct++,0,ut.splice(Et,1)[0]);for(const Et of ut)for(const mn of(st=Et.transform)!==null&&st!==void 0?st:[])mn.type==="lookup"&&(mn.from=Be.outputNodes[mn.from].getSource());for(const Et of ut)Et.name in ze&&(Et.values=ze[Et.name]);return ut}(d.component.data,k)),G=d.assembleProjections(),te=d.assembleTitle(),se=d.assembleGroupStyle(),he=d.assembleGroupEncodeEntry(!0);let ve=d.assembleLayoutSignals();return ve=ve.filter(Be=>Be.name!=="width"&&Be.name!=="height"||Be.value===void 0||(b[Be.name]=+Be.value,!1)),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({$schema:"https://vega.github.io/schema/vega/v5.json"},d.description?{description:d.description}:{}),b),te?{title:te}:{}),se?{style:se}:{}),he?{encode:{update:he}}:{}),{data:$}),G.length>0?{projections:G}:{}),d.assembleGroup([...ve,...d.assembleSelectionTopLevelSignals([])])),j?{config:j}:{}),T?{usermeta:T}:{})}(l,function(d,b,k,T){const j=T.component.layoutSize.get("width"),$=T.component.layoutSize.get("height");if(b===void 0?(b={type:"pad"},T.hasAxisOrientSignalRef()&&(b.resize=!0)):Ca(b)&&(b={type:b}),j&&$&&function(G){return G==="fit"||G==="fit-x"||G==="fit-y"}(b.type)){if(j==="step"&&$==="step")li(re.droppingFit()),b.type="pad";else if(j==="step"||$==="step"){const G=j==="step"?"width":"height";li(re.droppingFit(z3(G)));const te=G==="width"?"height":"width";b.type=function(se){return se?`fit-${z3(se)}`:"fit"}(te)}}return Object.assign(Object.assign(Object.assign({},di(b).length===1&&b.type?b.type==="pad"?{}:{autosize:b.type}:{autosize:b}),vW(k)),vW(d))}(e,u.autosize,r,l),e.datasets,e.usermeta),normalized:u}}finally{t.logger&&Lae(),t.fieldTitle&&OU(SU)}}
7840const ole=new class extends oW{mapUnit(e,{config:t}){if(e.encoding){const{encoding:r,transform:u}=e,{bins:l,timeUnits:d,aggregate:b,groupby:k,encoding:T}=oR(r,t),j=[...u||[],...l,...d,...b.length===0?[]:[{aggregate:b,groupby:k}]];return Object.assign(Object.assign(Object.assign({},e),j.length>0?{transform:j}:{}),{encoding:T})}return e}};function ale(e,t){return ole.map(e,{config:t})}const sle=Iie.version;var l$=function(e){const[t,r]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:r}};const ule={background:"#333",title:{color:"#fff",subtitleColor:"#fff"},style:{"guide-label":{fill:"#fff"},"guide-title":{fill:"#fff"}},axis:{domainColor:"#fff",gridColor:"#888",tickColor:"#fff"}},cle={background:"#fff",arc:{fill:"#4572a7"},area:{fill:"#4572a7"},line:{stroke:"#4572a7",strokeWidth:2},path:{stroke:"#4572a7"},rect:{fill:"#4572a7"},shape:{stroke:"#4572a7"},symbol:{fill:"#4572a7",strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},lle={arc:{fill:"#30a2da"},area:{fill:"#30a2da"},axis:{domainColor:"#cbcbcb",grid:!0,gridColor:"#cbcbcb",gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:"#cbcbcb",tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:"#f0f0f0",group:{fill:"#f0f0f0"},legend:{labelColor:"#333",labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:"#333",titleFontSize:14,titlePadding:10},line:{stroke:"#30a2da",strokeWidth:2},path:{stroke:"#30a2da",strokeWidth:.5},rect:{fill:"#30a2da"},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:"#30a2da"},bar:{binSpacing:2,fill:"#30a2da",stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},fle={group:{fill:"#e5e5e5"},arc:{fill:"#000"},area:{fill:"#000"},line:{stroke:"#000"},path:{stroke:"#000"},rect:{fill:"#000"},shape:{stroke:"#000"},symbol:{fill:"#000",size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},d5="Benton Gothic Bold, sans-serif",VC={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},dle={background:"#ffffff",title:{anchor:"start",color:"#000000",font:d5,fontSize:22,fontWeight:"normal"},arc:{fill:"#82c6df"},area:{fill:"#82c6df"},line:{stroke:"#82c6df",strokeWidth:2},path:{stroke:"#82c6df"},rect:{fill:"#82c6df"},shape:{stroke:"#82c6df"},symbol:{fill:"#82c6df",size:30},axis:{labelFont:"Benton Gothic, sans-serif",labelFontSize:11.5,labelFontWeight:"normal",titleFont:d5,titleFontSize:13,titleFontWeight:"normal"},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:"Benton Gothic, sans-serif",labelFontSize:11.5,symbolType:"square",titleFont:d5,titleFontSize:13,titleFontWeight:"normal"},range:{category:VC["category-6"],diverging:VC["fireandice-6"],heatmap:VC["fire-7"],ordinal:VC["fire-7"],ramp:VC["fire-7"]}},hle={background:"#f9f9f9",arc:{fill:"#ab5787"},area:{fill:"#ab5787"},line:{stroke:"#ab5787"},path:{stroke:"#ab5787"},rect:{fill:"#ab5787"},shape:{stroke:"#ab5787"},symbol:{fill:"#ab5787",size:30},axis:{domainColor:"#979797",domainWidth:.5,gridWidth:.2,labelColor:"#979797",tickColor:"#979797",tickWidth:.2,titleColor:"#979797"},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},ple={background:"#fff",arc:{fill:"#3e5c69"},area:{fill:"#3e5c69"},line:{stroke:"#3e5c69"},path:{stroke:"#3e5c69"},rect:{fill:"#3e5c69"},shape:{stroke:"#3e5c69"},symbol:{fill:"#3e5c69"},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}}
7840,$C={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},mle={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:"Lato"},axisX:{domain:!0,domainColor:"#000000",domainWidth:1,grid:!1,labelFontSize:12,labelFont:"Lato",labelAngle:0,tickColor:"#000000",tickSize:5,titleFontSize:12,titlePadding:10,titleFont:"Lato"},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:"Lato",labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:"Lato",titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:"Lato",symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:"Lato",orient:"right",offset:10},view:{stroke:"transparent"},range:{category:$C["six-groups-cat-1"],diverging:$C["diverging-colors"],heatmap:$C["diverging-colors"],ordinal:$C["six-groups-seq"],ramp:$C["shades-blue"]},area:{fill:"#1696d2"},rect:{fill:"#1696d2"},line:{color:"#1696d2",stroke:"#1696d2",strokeWidth:5},trail:{color:"#1696d2",stroke:"#1696d2",strokeWidth:0,size:1},path:{stroke:"#1696d2",strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:"#1696d2",fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:"#1696d2",stroke:null}},arc:{fill:"#1696d2"},shape:{stroke:"#1696d2"},symbol:{fill:"#1696d2",size:30}},gle={arc:{fill:"#3366CC"},area:{fill:"#3366CC"},path:{stroke:"#3366CC"},rect:{fill:"#3366CC"},shape:{stroke:"#3366CC"},symbol:{stroke:"#3366CC"},circle:{fill:"#3366CC"},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:"Arial, sans-serif",fontSize:12},"guide-title":{font:"Arial, sans-serif",fontSize:12},"group-title":{font:"Arial, sans-serif",fontSize:12}},title:{font:"Arial, sans-serif",fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:"#ccc",tickColor:"#ccc",domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},vle="2.10.0";var yle=`#vg-tooltip-element { 7841 visibility: hidden; 7842 padding: 8px; 7843 position: fixed; 7844 z-index: 1000; 7845 font-family: sans-serif; 7846 font-size: 11px; 7847 border-radius: 3px; 7848 box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); 7849 /* The default theme is the light theme. */ 7850 background-color: rgba(255, 255, 255, 0.95); 7851 border: 1px solid #d9d9d9; 7852 color: black; } 7853 #vg-tooltip-element.visible { 7854 visibility: visible; } 7855 #vg-tooltip-element h2 { 7856 margin-top: 0; 7857 margin-bottom: 10px; 7858 font-size: 13px; } 7859 #vg-tooltip-element img { 7860 max-width: 200px; 7861 max-height: 200px; } 7862 #vg-tooltip-element table { 7863 border-spacing: 0; } 7864 #vg-tooltip-element table tr { 7865 border: none; } 7866 #vg-tooltip-element table tr td { 7867 overflow: hidden; 7868 text-overflow: ellipsis; 7869 padding-top: 2px; 7870 padding-bottom: 2px; } 7871 #vg-tooltip-element table tr td.key { 7872 color: #808080; 7873 max-width: 150px; 7874 text-align: right; 7875 padding-right: 4px; } 7876 #vg-tooltip-element table tr td.value { 7877 display: block; 7878 max-width: 300px; 7879 max-height: 7em; 7880 text-align: left; } 7881 #vg-tooltip-element.dark-theme { 7882 background-color: rgba(32, 32, 32, 0.9); 7883 border: 1px solid #f5f5f5; 7884 color: white; } 7885 #vg-tooltip-element.dark-theme td.key { 7886 color: #bfbfbf; } 7887`;const f$="vg-tooltip-element",ble={offsetX:10,offsetY:10,id:f$,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/</g,"<")},maxDepth:2};function xle(e,t,r){if(Object(xe.B)(e))return`[${e.map(u=>t(Object(xe.J)(u)?u:d$(u,r))).join(", ")}]`;if(Object(xe.H)(e)){let u="";const l=e,{title:d,image:b}=l,k=function(j,$){var G={};for(var te in j)Object.prototype.hasOwnProperty.call(j,te)&&$.indexOf(te)<0&&(G[te]=j[te]);if(j!=null&&typeof Object.getOwnPropertySymbols=="function"){var se=0;for(te=Object.getOwnPropertySymbols(j);se<te.length;se++)$.indexOf(te[se])<0&&Object.prototype.propertyIsEnumerable.call(j,te[se])&&(G[te[se]]=j[te[se]])}return G}(l,["title","image"]);d&&(u+=`<h2>${t(d)}</h2>`),b&&(u+=`<img src="${t(b)}">`);const T=Object.keys(k);if(T.length>0){u+="<table>";for(const j of T){let $=k[j];$!==void 0&&(Object(xe.H)($)&&($=d$($,r)),u+=`<tr><td class="key">${t(j)}:</td><td class="value">${t($)}</td></tr>`)}u+="</table>"}return u||"{}"}return t(e)}function d$(e,t){return JSON.stringify(e,function(r){const u=[];return function(l,d){if(typeof d!="object"||d===null)return d;const b=u.indexOf(this)+1;return u.length=b,u.length>r?"[Object]":u.indexOf(d)>=0?"[Circular]":(u.push(d),d)}}(t))}class wle{constructor(t){this.options=Object.assign(Object.assign({},ble),t);const r=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const u=document.createElement("style");u.setAttribute("id",this.options.styleId),u.innerHTML=function(d){if(!/^[A-Za-z]+[-:.\w]*$/.test(d))throw new Error("Invalid HTML ID");return yle.toString().replace(f$,d)}(r);const l=document.head;l.childNodes.length>0?l.insertBefore(u,l.childNodes[0]):l.appendChild(u)}}tooltipHandler(t,r,u,l){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),document.body.appendChild(this.el)),(document.fullscreenElement!=null?document.fullscreenElement:document.body).appendChild(this.el),l==null||l==="")return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=xle(l,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:d,y:b}=function(k,T,j,$){let G=k.clientX+j;G+T.width>window.innerWidth&&(G=+k.clientX-j-T.width);let te=k.clientY+$;return te+T.height>window.innerHeight&&(te=+k.clientY-$-T.height),{x:G,y:te}}(r,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.setAttribute("style",`top: ${b}px; left: ${d}px`)}}/*! ***************************************************************************** 7888 Copyright (c) Microsoft Corporation. 7889 7890 Permission to use, copy, modify, and/or distribute this software for any 7891 purpose with or without fee is hereby granted. 7892 7893 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 7894 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 7895 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 7896 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 7897 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 7898 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 7899 PERFORMANCE OF THIS SOFTWARE. 7900 ***************************************************************************** */function zD(e,t,r,u){return new(r||(r=Promise))(function(l,d){function b(j){try{T(u.next(j))}catch($){d($)}}function k(j){try{T(u.throw(j))}catch($){d($)}}function T(j){j.done?l(j.value):function($){return $ instanceof r?$:new r(function(G){G($)})}(j.value).then(b,k)}T((u=u.apply(e,t||[])).next())})}n.d(i,"DEFAULT_ACTIONS",function(){return p$}),n.d(i,"guessMode",function(){return g$}),n.d(i,"vega",function(){return rb}),n.d(i,"vegaLite",function(){return z_});var h5,_le=`.vega-embed { 7901 position: relative; 7902 display: inline-block; 7903 box-sizing: border-box; } 7904 .vega-embed.has-actions { 7905 padding-right: 38px; } 7906 .vega-embed details:not([open]) > :not(summary) { 7907 display: none !important; } 7908 .vega-embed summary { 7909 list-style: none; 7910 position: absolute; 7911 top: 0; 7912 right: 0; 7913 padding: 6px; 7914 z-index: 1000; 7915 background: white; 7916 box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); 7917 color: #1b1e23; 7918 border: 1px solid #aaa; 7919 border-radius: 999px; 7920 opacity: 0.2; 7921 transition: opacity 0.4s ease-in; 7922 outline: none; 7923 cursor: pointer; 7924 line-height: 0px; } 7925 .vega-embed summary::-webkit-details-marker { 7926 display: none; } 7927 .vega-embed summary:active { 7928 box-shadow: #aaa 0px 0px 0px 1px inset; } 7929 .vega-embed summary svg { 7930 width: 14px; 7931 height: 14px; } 7932 .vega-embed details[open] summary { 7933 opacity: 0.7; } 7934 .vega-embed:hover summary, 7935 .vega-embed:focus summary { 7936 opacity: 1 !important; 7937 transition: opacity 0.2s ease; } 7938 .vega-embed .vega-actions { 7939 position: absolute; 7940 z-index: 1001; 7941 top: 35px; 7942 right: -9px; 7943 display: flex; 7944 flex-direction: column; 7945 padding-bottom: 8px; 7946 padding-top: 8px; 7947 border-radius: 4px; 7948 box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2); 7949 border: 1px solid #d9d9d9; 7950 background: white; 7951 animation-duration: 0.15s; 7952 animation-name: scale-in; 7953 animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); 7954 text-align: left; } 7955 .vega-embed .vega-actions a { 7956 padding: 8px 16px; 7957 font-family: sans-serif; 7958 font-size: 14px; 7959 font-weight: 600; 7960 white-space: nowrap; 7961 color: #434a56; 7962 text-decoration: none; } 7963 .vega-embed .vega-actions a:hover { 7964 background-color: #f7f7f9; 7965 color: black; } 7966 .vega-embed .vega-actions::before, .vega-embed .vega-actions::after { 7967 content: ""; 7968 display: inline-block; 7969 position: absolute; } 7970 .vega-embed .vega-actions::before { 7971 left: auto; 7972 right: 14px; 7973 top: -16px; 7974 border: 8px solid #0000; 7975 border-bottom-color: #d9d9d9; } 7976 .vega-embed .vega-actions::after { 7977 left: auto; 7978 right: 15px; 7979 top: -14px; 7980 border: 7px solid #0000; 7981 border-bottom-color: #fff; } 7982 .vega-embed .chart-wrapper { 7983 width: 100%; 7984 height: 100%; } 7985 7986.vega-embed-wrapper { 7987 max-width: 100%; 7988 overflow: auto; 7989 padding-right: 14px; } 7990 7991@keyframes scale-in { 7992 from { 7993 opacity: 0; 7994 transform: scale(0.6); } 7995 to { 7996 opacity: 1; 7997 transform: scale(1); } } 7998`;function h$(e,...t){for(const r of t)kle(e,r);return e}function kle(e,t){for(const r of Object.keys(t))Object(xe.La)(e,r,t[r],!0)}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.substr(!t||t<0?0:+t,e.length)===e});const rb=K;let z_=ce;const UD=typeof window<"u"?window:void 0;z_===void 0&&(!((h5=UD==null?void 0:UD.vl)===null||h5===void 0)&&h5.compile)&&(z_=UD.vl);const p$={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},Ele={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},HC={vega:"Vega","vega-lite":"Vega-Lite"},WD={vega:rb.version,"vega-lite":z_?z_.version:"not available"},Cle={vega:e=>e,"vega-lite":(e,t)=>z_.compile(e,{config:t}).spec},Sle=` 7999<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"> 8000 <circle r="2" cy="8" cx="2"></circle> 8001 <circle r="2" cy="8" cx="8"></circle> 8002 <circle r="2" cy="8" cx="14"></circle> 8003</svg>`,Ale="chart-wrapper";function m$(e,t,r,u){const l=`<html><head>${t}</head><body><pre><code class="json">`,d=`</code></pre>${r}</body></html>`,b=window.open("");b.document.write(l+e+d),b.document.title=`${HC[u]} JSON Source`}function g$(e,t){var r;if(e.$schema){const u=l$(e.$schema);t&&t!==u.library&&console.warn(`The given visualization spec is written in ${HC[u.library]}, but mode argument sets ${(r=HC[t])!==null&&r!==void 0?r:t}.`);const l=u.library;return Object(En.satisfies)(WD[l],`^${u.version.slice(1)}`)||console.warn(`The input spec uses ${HC[l]} ${u.version}, but the current version of ${HC[l]} is v${WD[l]}.`),l}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}function v$(e){return function(t){return!!(t&&"load"in t)}(e)?e:rb.loader(e)}function y$(e){var t;return(t=e.usermeta&&e.usermeta.embedOptions)!==null&&t!==void 0?t:{}}function b$(e,t){var r;return zD(this,void 0,void 0,function*(){const u=Object(xe.J)(e.config)?JSON.parse(yield t.load(e.config)):(r=e.config)!==null&&r!==void 0?r:{},l=Object(xe.J)(e.patch)?JSON.parse(yield t.load(e.patch)):e.patch;return Object.assign(Object.assign(Object.assign({},e),l?{patch:l}:{}),u?{config:u}:{})})}i.default=function(e,t,r={}){var u,l,d;return zD(this,void 0,void 0,function*(){let b,k;Object(xe.J)(t)?(k=v$(r.loader),b=JSON.parse(yield k.load(t))):b=t;const T=y$(b).loader;k&&!T||(k=v$((u=r.loader)!==null&&u!==void 0?u:T));const j=yield b$(y$(b),k),$=yield b$(r,k),G=Object.assign(Object.assign({},h$($,j)),{config:Object(xe.P)((l=$.config)!==null&&l!==void 0?l:{},(d=j.config)!==null&&d!==void 0?d:{})});return yield function(te,se,he={},ve){var Be,ze,Ue,st,ut,mt;return zD(this,void 0,void 0,function*(){const pt=he.theme?Object(xe.P)(pe[he.theme],(Be=he.config)!==null&&Be!==void 0?Be:{}):he.config,Ct=Object(xe.C)(he.actions)?he.actions:h$({},p$,(ze=he.actions)!==null&&ze!==void 0?ze:{}),Et=Object.assign(Object.assign({},Ele),he.i18n),mn=(Ue=he.renderer)!==null&&Ue!==void 0?Ue:"canvas",An=(st=he.logLevel)!==null&&st!==void 0?st:rb.Warn,xn=(ut=he.downloadFileName)!==null&&ut!==void 0?ut:"visualization",Wn=typeof te=="string"?document.querySelector(te):te;if(!Wn)throw new Error(`${te} does not exist`);if(he.defaultStyle!==!1){const Pi="vega-embed-style",{root:so,rootContainer:Ui}=function(ji){var Yi;const Go=ji.getRootNode?ji.getRootNode():document;return Go instanceof ShadowRoot?{root:Go,rootContainer:Go}:{root:document,rootContainer:(Yi=document.head)!==null&&Yi!==void 0?Yi:document.body}}(Wn);if(!so.getElementById(Pi)){const ji=document.createElement("style");ji.id=Pi,ji.innerText=he.defaultStyle===void 0||he.defaultStyle===!0?_le.toString():he.defaultStyle,Ui.appendChild(ji)}}const Un=g$(se,he.mode);let Kn=Cle[Un](se,pt);if(Un==="vega-lite"&&Kn.$schema){const Pi=l$(Kn.$schema);Object(En.satisfies)(WD.vega,`^${Pi.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${Pi.version}, but current version is v${WD.vega}.`)}Wn.classList.add("vega-embed"),Ct&&Wn.classList.add("has-actions"),Wn.innerHTML="";let Qn=Wn;if(Ct){const Pi=document.createElement("div");Pi.classList.add(Ale),Wn.appendChild(Pi),Qn=Pi}const ir=he.patch;ir&&(Kn=ir instanceof Function?ir(Kn):Ht(Kn,ir,!0,!1).newDocument),he.formatLocale&&rb.formatLocale(he.formatLocale),he.timeFormatLocale&&rb.timeFormatLocale(he.timeFormatLocale);const{ast:Nr}
8003=he,Jr=rb.parse(Kn,Un==="vega-lite"?{}:pt,{ast:Nr}),Lr=new(he.viewClass||rb.View)(Jr,Object.assign({loader:ve,logLevel:An,renderer:mn},Nr?{expr:rb.expressionInterpreter}:{}));if(he.tooltip!==!1){let Pi;Pi=function(so){return typeof so=="function"}(he.tooltip)?he.tooltip:new wle(he.tooltip===!0?{}:he.tooltip).call,Lr.tooltip(Pi)}let hi,{hover:Ri}=he;if(Ri===void 0&&(Ri=Un==="vega"),Ri){const{hoverSet:Pi,updateSet:so}=typeof Ri=="boolean"?{}:Ri;Lr.hover(Pi,so)}if(he&&(he.width!=null&&Lr.width(he.width),he.height!=null&&Lr.height(he.height),he.padding!=null&&Lr.padding(he.padding)),yield Lr.initialize(Qn,he.bind).runAsync(),Ct!==!1){let Pi=Wn;if(he.defaultStyle!==!1){const Ui=document.createElement("details");Ui.title=Et.CLICK_TO_VIEW_ACTIONS,Wn.append(Ui),Pi=Ui;const ji=document.createElement("summary");ji.innerHTML=Sle,Ui.append(ji),hi=Yi=>{Ui.contains(Yi.target)||Ui.removeAttribute("open")},document.addEventListener("click",hi)}const so=document.createElement("div");if(Pi.append(so),so.classList.add("vega-actions"),Ct===!0||Ct.export!==!1){for(const Ui of["svg","png"])if(Ct===!0||Ct.export===!0||Ct.export[Ui]){const ji=Et[`${Ui.toUpperCase()}_ACTION`],Yi=document.createElement("a");Yi.text=ji,Yi.href="#",Yi.target="_blank",Yi.download=`${xn}.${Ui}`,Yi.addEventListener("mousedown",function(Go){return zD(this,void 0,void 0,function*(){Go.preventDefault();const Ra=yield Lr.toImageURL(Ui,he.scaleFactor);this.href=Ra})}),so.append(Yi)}}if(Ct===!0||Ct.source!==!1){const Ui=document.createElement("a");Ui.text=Et.SOURCE_ACTION,Ui.href="#",Ui.addEventListener("click",function(ji){var Yi,Go;m$(Xt()(se),(Yi=he.sourceHeader)!==null&&Yi!==void 0?Yi:"",(Go=he.sourceFooter)!==null&&Go!==void 0?Go:"",Un),ji.preventDefault()}),so.append(Ui)}if(Un==="vega-lite"&&(Ct===!0||Ct.compiled!==!1)){const Ui=document.createElement("a");Ui.text=Et.COMPILED_ACTION,Ui.href="#",Ui.addEventListener("click",function(ji){var Yi,Go;m$(Xt()(Kn),(Yi=he.sourceHeader)!==null&&Yi!==void 0?Yi:"",(Go=he.sourceFooter)!==null&&Go!==void 0?Go:"","vega"),ji.preventDefault()}),so.append(Ui)}if(Ct===!0||Ct.editor!==!1){const Ui=(mt=he.editorUrl)!==null&&mt!==void 0?mt:"https://vega.github.io/editor/",ji=document.createElement("a");ji.text=Et.EDITOR_ACTION,ji.href="#",ji.addEventListener("click",function(Yi){(function(Go,Ra,uo){const rs=Go.open(Ra),is=250,{origin:Is}=new URL(Ra);let Tu=~~(1e4/is);Go.addEventListener("message",function Nu(uu){uu.source===rs&&(Tu=0,Go.removeEventListener("message",Nu,!1))},!1),setTimeout(function Nu(){Tu<=0||(rs.postMessage(uo,Is),setTimeout(Nu,is),Tu-=1)},is)})(window,Ui,{config:pt,mode:Un,renderer:mn,spec:Xt()(se)}),Yi.preventDefault()}),so.append(ji)}}return{view:Lr,spec:se,vgSpec:Kn,finalize:function(){hi&&document.removeEventListener("click",hi),Lr.finalize()}}})}(e,b,G,k)})}},function(a,i,n){const{MAX_LENGTH:s}=n(117),{re:h,t:v}=n(90),g=n(32),O=n(115);a.exports=(A,S)=>{if(S=O(S),A instanceof g)return A;if(typeof A!="string"||A.length>s||!(S.loose?h[v.LOOSE]:h[v.FULL]).test(A))return null;try{return new g(A,S)}catch{return null}}},function(a,i,n){const{MAX_SAFE_COMPONENT_LENGTH:s}=n(117),h=n(116),v=(i=a.exports={}).re=[],g=i.src=[],O=i.t={};let A=0;const S=(M,P,L)=>{const V=A++;h(V,P),O[M]=V,g[V]=P,v[V]=new RegExp(P,L?"g":void 0)};S("NUMERICIDENTIFIER","0|[1-9]\\d*"),S("NUMERICIDENTIFIERLOOSE","[0-9]+"),S("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),S("MAINVERSION",`(${g[O.NUMERICIDENTIFIER]})\\.(${g[O.NUMERICIDENTIFIER]})\\.(${g[O.NUMERICIDENTIFIER]})`),S("MAINVERSIONLOOSE",`(${g[O.NUMERICIDENTIFIERLOOSE]})\\.(${g[O.NUMERICIDENTIFIERLOOSE]})\\.(${g[O.NUMERICIDENTIFIERLOOSE]})`),S("PRERELEASEIDENTIFIER",`(?:${g[O.NUMERICIDENTIFIER]}|${g[O.NONNUMERICIDENTIFIER]})`),S("PRERELEASEIDENTIFIERLOOSE",`(?:${g[O.NUMERICIDENTIFIERLOOSE]}|${g[O.NONNUMERICIDENTIFIER]})`),S("PRERELEASE",`(?:-(${g[O.PRERELEASEIDENTIFIER]}(?:\\.${g[O.PRERELEASEIDENTIFIER]})*))`),S("PRERELEASELOOSE",`(?:-?(${g[O.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${g[O.PRERELEASEIDENTIFIERLOOSE]})*))`),S("BUILDIDENTIFIER","[0-9A-Za-z-]+"),S("BUILD",`(?:\\+(${g[O.BUILDIDENTIFIER]}(?:\\.${g[O.BUILDIDENTIFIER]})*))`),S("FULLPLAIN",`v?${g[O.MAINVERSION]}${g[O.PRERELEASE]}?${g[O.BUILD]}?`),S("FULL",`^${g[O.FULLPLAIN]}$`),S("LOOSEPLAIN",`[v=\\s]*${g[O.MAINVERSIONLOOSE]}${g[O.PRERELEASELOOSE]}?${g[O.BUILD]}?`),S("LOOSE",`^${g[O.LOOSEPLAIN]}$`),S("GTLT","((?:<|>)?=?)"),S("XRANGEIDENTIFIERLOOSE",`${g[O.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),S("XRANGEIDENTIFIER",`${g[O.NUMERICIDENTIFIER]}|x|X|\\*`),S("XRANGEPLAIN",`[v=\\s]*(${g[O.XRANGEIDENTIFIER]})(?:\\.(${g[O.XRANGEIDENTIFIER]})(?:\\.(${g[O.XRANGEIDENTIFIER]})(?:${g[O.PRERELEASE]})?${g[O.BUILD]}?)?)?`),S("XRANGEPLAINLOOSE",`[v=\\s]*(${g[O.XRANGEIDENTIFIERLOOSE]})(?:\\.(${g[O.XRANGEIDENTIFIERLOOSE]})(?:\\.(${g[O.XRANGEIDENTIFIERLOOSE]})(?:${g[O.PRERELEASELOOSE]})?${g[O.BUILD]}?)?)?`),S("XRANGE",`^${g[O.GTLT]}\\s*${g[O.XRANGEPLAIN]}$`),S("XRANGELOOSE",`^${g[O.GTLT]}\\s*${g[O.XRANGEPLAINLOOSE]}$`),S("COERCE",`(^|[^\\d])(\\d{1,${s}})(?:\\.(\\d{1,${s}}))?(?:\\.(\\d{1,${s}}))?(?:$|[^\\d])`),S("COERCERTL",g[O.COERCE],!0),S("LONETILDE","(?:~>?)"),S("TILDETRIM",`(\\s*)${g[O.LONETILDE]}\\s+`,!0),i.tildeTrimReplace="$1~",S("TILDE",`^${g[O.LONETILDE]}${g[O.XRANGEPLAIN]}$`),S("TILDELOOSE",`^${g[O.LONETILDE]}${g[O.XRANGEPLAINLOOSE]}$`),S("LONECARET","(?:\\^)"),S("CARETTRIM",`(\\s*)${g[O.LONECARET]}
8003\\s+`,!0),i.caretTrimReplace="$1^",S("CARET",`^${g[O.LONECARET]}${g[O.XRANGEPLAIN]}$`),S("CARETLOOSE",`^${g[O.LONECARET]}${g[O.XRANGEPLAINLOOSE]}$`),S("COMPARATORLOOSE",`^${g[O.GTLT]}\\s*(${g[O.LOOSEPLAIN]})$|^$`),S("COMPARATOR",`^${g[O.GTLT]}\\s*(${g[O.FULLPLAIN]})$|^$`),S("COMPARATORTRIM",`(\\s*)${g[O.GTLT]}\\s*(${g[O.LOOSEPLAIN]}|${g[O.XRANGEPLAIN]})`,!0),i.comparatorTrimReplace="$1$2$3",S("HYPHENRANGE",`^\\s*(${g[O.XRANGEPLAIN]})\\s+-\\s+(${g[O.XRANGEPLAIN]})\\s*$`),S("HYPHENRANGELOOSE",`^\\s*(${g[O.XRANGEPLAINLOOSE]})\\s+-\\s+(${g[O.XRANGEPLAINLOOSE]})\\s*$`),S("STAR","(<|>)?=?\\s*\\*"),S("GTE0","^\\s*>=\\s*0.0.0\\s*$"),S("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")},function(a,i,n){/** 8004* @license 8005* Copyright 2018 Google LLC. All Rights Reserved. 8006* Licensed under the Apache License, Version 2.0 (the "License"); 8007* you may not use this file except in compliance with the License. 8008* You may obtain a copy of the License at 8009* 8010* http://www.apache.org/licenses/LICENSE-2.0 8011* 8012* Unless required by applicable law or agreed to in writing, software 8013* distributed under the License is distributed on an "AS IS" BASIS, 8014* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8015* See the License for the specific language governing permissions and 8016* limitations under the License. 8017* ============================================================================= 8018*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(103),v=n(29),g=n(21),O=n(373),A=n(28);function S(L,V,N,ee){if(ee==null&&(ee=g.inferDtype(L)),ee==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!g.isTypedArray(L)&&!Array.isArray(L)&&typeof L!="number"&&typeof L!="boolean"&&typeof L!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(V!=null){g.assertNonNegativeIntegerDimensions(V);var J=g.sizeFromShape(V),K=g.sizeFromShape(N);g.assert(J===K,function(){return"Based on the provided shape, ["+V+"], the tensor should have "+J+" values but has "+K});for(var re=0;re<N.length;++re){var ce=N[re],pe=re!==N.length-1||ce!==g.sizeFromShape(V.slice(re));g.assert(N[re]===V[re]||!pe,function(){return"Error creating a new Tensor. Inferred shape ("+N+") does not match the provided shape ("+V+"). "})}}return g.isTypedArray(L)||Array.isArray(L)||(L=[L]),V=V||N,L=ee!=="string"?g.toTypedArray(L,ee,h.env().getBool("DEBUG")):g.flatten(L,[],!0),s.ENGINE.makeTensor(L,V,ee)}function M(L,V){g.assertNonNull(L);var N=v.inferShape(L,V);if(N.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return S(L,null,N,V)}function P(L,V){if(V===void 0&&(V="float32"),V==="complex64"){var N=P(L,"float32"),ee=P(L,"float32");return O.complex(N,ee)}var J=g.makeZerosTypedArray(g.sizeFromShape(L),V);return s.ENGINE.makeTensor(J,L,V)}i.tensor=function(L,V,N){return S(L,V,v.inferShape(L,N),N)},i.scalar=function(L,V){if((g.isTypedArray(L)&&V!=="string"||Array.isArray(L))&&V!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(V==="string"&&g.isTypedArray(L)&&!(L instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return S(L,[],[],V)},i.tensor1d=M,i.tensor2d=function(L,V,N){if(g.assertNonNull(L),V!=null&&V.length!==2)throw new Error("tensor2d() requires shape to have two numbers");var ee=v.inferShape(L,N);if(ee.length!==2&&ee.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(ee.length===1&&V==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return S(L,V,ee,N)},i.tensor3d=function(L,V,N){if(g.assertNonNull(L),V!=null&&V.length!==3)throw new Error("tensor3d() requires shape to have three numbers");var ee=v.inferShape(L,N);if(ee.length!==3&&ee.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(ee.length===1&&V==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return S(L,V,ee,N)},i.tensor4d=function(L,V,N){if(g.assertNonNull(L),V!=null&&V.length!==4)throw new Error("tensor4d() requires shape to have four numbers");var ee=v.inferShape(L,N);if(ee.length!==4&&ee.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(ee.length===1&&V==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return S(L,V,ee,N)},i.tensor5d=function(L,V,N){if(g.assertNonNull(L),V!=null&&V.length!==5)throw new Error("tensor5d() requires shape to have five numbers");var ee=v.inferShape(L,N);if(ee.length!==5&&ee.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(ee.length===1&&V==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return S(L,V,ee,N)},i.tensor6d=function(L,V,N){if(g.assertNonNull(L),V!=null&&V.length!==6)throw new Error("tensor6d() requires shape to have six numbers");var ee=v.inferShape(L,N);if(ee.length!==6&&ee.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(ee.length===1&&V==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return S(L,V=V||ee,ee,N)},i.variable=function(L,V,N,ee){return V===void 0&&(V=!0),s.ENGINE.makeVariable(L,V,N,ee)},i.ones=function L(V,N){if(N===void 0&&(N="float32"),N==="complex64"){var ee=L(V,"float32"),J=P(V,"float32");return O.complex(ee,J)}var K=g.makeOnesTypedArray(g.sizeFromShape(V),N);return s.ENGINE.makeTensor(K,V,N)},i.zeros=P,i.fill=function(L,V,N){return s.ENGINE.runKernelFunc(function(ee){return ee.fill(L,V,N)},{})},i.linspace=function(L,V,N){if(N<=0)throw new Error("The number of values should be positive.");return s.ENGINE.runKernelFunc(function(ee){return ee.linspace(L,V,N)},{})},i.range=function(L,V,N,ee){if(N===void 0&&(N=1),ee===void 0&&(ee="float32"),N===0)throw new Error("Cannot have a step of zero");if(L===V||L<V&&N<0||V<L&&N>1)return P([0],ee);var J=Math.abs(Math.ceil((V-L)/N)),K=g.makeZerosTypedArray(J,ee);V<L&&N===1&&(N=-1),K[0]=L;for(var re=1;re<K.length;re++)K[re]=K[re-1]+N;return M(K,ee)},i.onesLike=A.op({onesLike_:function(L){var V=v.convertToTensor(L,"x","onesLike");if(V.dtype==="complex64"){var N=i.onesLike(O.real(V)),ee=i.zerosLike(O.imag(V));return O.complex(N,ee)}return s.ENGINE.runKernelFunc(function(J){return J.onesLike(V)},{x:V},function(J,K){return{x:function(){return i.zerosLike(J)}}},"OnesLike")}}),i.zerosLike=A.op({zerosLike_:function(L){var V=v.convertToTensor(L,"x","zerosLike");return s.ENGINE.runKernelFunc(function(N){return N.zerosLike(V)},{x:V},function(N,ee){return{x:function(){return i.zerosLike(N)}}},"ZerosLike")}})},function(a,i,n){(function(s){/*! 8019 * The buffer module from node.js, for the browser. 8020 * 8021 * @author Feross Aboukhadijeh <http://feross.org> 8022 * @license MIT 8023 */var h=n(394),v=n(393),g=n(392);function O(){return S.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function A(We,Ye){if(O()<Ye)throw new RangeError("Invalid typed array length");return S.TYPED_ARRAY_SUPPORT?(We=new Uint8Array(Ye)).__proto__=S.prototype:(We===null&&(We=new S(Ye)),We.length=Ye),We}function S(We,Ye,He){if(!(S.TYPED_ARRAY_SUPPORT||this instanceof S))return new S(We,Ye,He);if(typeof We=="number"){if(typeof Ye=="string")throw new Error("If encoding is specified then the first argument must be a string");return L(this,We)}return M(this,We,Ye,He)}function M(We,Ye,He,dt){if(typeof Ye=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&Ye instanceof ArrayBuffer?function(It,ct,on,Xt){if(ct.byteLength,on<0||ct.byteLength<on)throw new RangeError("'offset' is out of bounds");if(ct.byteLength<on+(Xt||0))throw new RangeError("'length' is out of bounds");return ct=on===void 0&&Xt===void 0?new Uint8Array(ct):Xt===void 0?new Uint8Array(ct,on):new Uint8Array(ct,on,Xt),S.TYPED_ARRAY_SUPPORT?(It=ct).__proto__=S.prototype:It=V(It,ct),It}(We,Ye,He,dt):typeof Ye=="string"?function(It,ct,on){if(typeof on=="string"&&on!==""||(on="utf8"),!S.isEncoding(on))throw new TypeError('"encoding" must be a valid string encoding');var Xt=0|ee(ct,on),En=(It=A(It,Xt)).write(ct,on);return En!==Xt&&(It=It.slice(0,En)),It}(We,Ye,He):function(It,ct){if(S.isBuffer(ct)){var on=0|N(ct.length);return(It=A(It,on)).length===0||ct.copy(It,0,0,on),It}if(ct){if(typeof ArrayBuffer<"u"&&ct.buffer instanceof ArrayBuffer||"length"in ct)return typeof ct.length!="number"||function(Xt){return Xt!=Xt}(ct.length)?A(It,0):V(It,ct);if(ct.type==="Buffer"&&g(ct.data))return V(It,ct.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(We,Ye)}function P(We){if(typeof We!="number")throw new TypeError('"size" argument must be a number');if(We<0)throw new RangeError('"size" argument must not be negative')}function L(We,Ye){if(P(Ye),We=A(We,Ye<0?0:0|N(Ye)),!S.TYPED_ARRAY_SUPPORT)for(var He=0;He<Ye;++He)We[He]=0;return We}function V(We,Ye){var He=Ye.length<0?0:0|N(Ye.length);We=A(We,He);for(var dt=0;dt<He;dt+=1)We[dt]=255&Ye[dt];return We}function N(We){if(We>=O())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+O().toString(16)+" bytes");return 0|We}function ee(We,Ye){if(S.isBuffer(We))return We.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(We)||We instanceof ArrayBuffer))return We.byteLength;typeof We!="string"&&(We=""+We);var He=We.length;if(He===0)return 0;for(var dt=!1;;)switch(Ye){case"ascii":case"latin1":case"binary":return He;case"utf8":case"utf-8":case void 0:return sn(We).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*He;case"hex":return He>>>1;case"base64":return yn(We).length;default:if(dt)return sn(We).length;Ye=(""+Ye).toLowerCase(),dt=!0}}function J(We,Ye,He){var dt=We[Ye];We[Ye]=We[He],We[He]=dt}function K(We,Ye,He,dt,It){if(We.length===0)return-1;if(typeof He=="string"?(dt=He,He=0):He>2147483647?He=2147483647:He<-2147483648&&(He=-2147483648),He=+He,isNaN(He)&&(He=It?0:We.length-1),He<0&&(He=We.length+He),He>=We.length){if(It)return-1;He=We.length-1}else if(He<0){if(!It)return-1;He=0}if(typeof Ye=="string"&&(Ye=S.from(Ye,dt)),S.isBuffer(Ye))return Ye.length===0?-1:re(We,Ye,He,dt,It);if(typeof Ye=="number")return Ye&=255,S.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?It?Uint8Array.prototype.indexOf.call(We,Ye,He):Uint8Array.prototype.lastIndexOf.call(We,Ye,He):re(We,[Ye],He,dt,It);throw new TypeError("val must be string, number or Buffer")}function re(We,Ye,He,dt,It){var ct,on=1,Xt=We.length,En=Ye.length;if(dt!==void 0&&((dt=String(dt).toLowerCase())==="ucs2"||dt==="ucs-2"||dt==="utf16le"||dt==="utf-16le")){if(We.length<2||Ye.length<2)return-1;on=2,Xt/=2,En/=2,He/=2}function xe(cr,Er){return on===1?cr[Er]:cr.readUInt16BE(Er*on)}if(It){var jn=-1;for(ct=He;ct<Xt;ct++)if(xe(We,ct)===xe(Ye,jn===-1?0:ct-jn)){if(jn===-1&&(jn=ct),ct-jn+1===En)return jn*on}else jn!==-1&&(ct-=ct-jn),jn=-1}else for(He+En>Xt&&(He=Xt-En),ct=He;ct>=0;ct--){for(var nr=!0,ar=0;ar<En;ar++)if(xe(We,ct+ar)!==xe(Ye,ar)){nr=!1;break}if(nr)return ct}return-1}function ce(We,Ye,He,dt){He=Number(He)||0;var It=We.length-He;dt?(dt=Number(dt))>It&&(dt=It):dt=It;var ct=Ye.length;if(ct%2!=0)throw new TypeError("Invalid hex string");dt>ct/2&&(dt=ct/2);for(var on=0;on<dt;++on){var Xt=parseInt(Ye.substr(2*on,2),16);if(isNaN(Xt))return on;We[He+on]=Xt}return on}function pe(We,Ye,He,dt){return Yt(sn(Ye,We.length-He),We,He,dt)}function ke(We,Ye,He,dt){return Yt(function(It){for(var ct=[],on=0;on<It.length;++on)ct.push(255&It.charCodeAt(on));return ct}(Ye),We,He,dt)}function Ce(We,Ye,He,dt){return ke(We,Ye,He,dt)}function be(We,Ye,He,dt){return Yt(yn(Ye),We,He,dt)}function $e(We,Ye,He,dt){return Yt(function(It,ct){for(var on,Xt,En,xe=[],jn=0;jn<It.length&&!((ct-=2)<0);++jn)on=It.charCodeAt(jn),Xt=on>>8,En=on%256,xe.push(En),xe.push(Xt);return xe}(Ye,We.length-He),We,He,dt)}function ht(We,Ye,He){return Ye===0&&He===We.length?h.fromByteArray(We):h.fromByteArray(We.slice(Ye,He))}function Dt(We,Ye,He){He=Math.min(We.length,He);for(var dt=[],It=Ye;It<He;){var ct,on,Xt,En,xe=We[It],jn=null,nr=xe>239?4:xe>223?3:xe>191?2:1;if(It+nr<=He)switch(nr){case 1:xe<128&&(jn=xe);break;case 2:(192&(ct=We[It+1]))==128&&(En=(31&xe)<<6|63&ct)>127&&(jn=En);break;case 3:ct=We[It+1],on=We[It+2],(192&ct)==128&&(192&on)==128&&(En=(15&xe)<<12|(63&ct)<<6|63&on)>2047&&(En<55296||En>57343)&&(jn=En);break;case 4:ct=We[It+1],on=We[It+2],Xt=We[It+3],(192&ct)==128&&(192&on)==128&&(192&Xt)==128&&(En=(15&xe)<<18|(63&ct)<<12|(63&on)<<6|63&Xt)>65535&&En<1114112&&(jn=En)}jn===null?(jn=65533,nr=1):jn>
vendor: 15,063 bytes, line 8023
802365535&&(jn-=65536,dt.push(jn>>>10&1023|55296),jn=56320|1023&jn),dt.push(jn),It+=nr}return function(ar){var cr=ar.length;if(cr<=Ut)return String.fromCharCode.apply(String,ar);for(var Er="",hn=0;hn<cr;)Er+=String.fromCharCode.apply(String,ar.slice(hn,hn+=Ut));return Er}(dt)}i.Buffer=S,i.SlowBuffer=function(We){return+We!=We&&(We=0),S.alloc(+We)},i.INSPECT_MAX_BYTES=50,S.TYPED_ARRAY_SUPPORT=s.TYPED_ARRAY_SUPPORT!==void 0?s.TYPED_ARRAY_SUPPORT:function(){try{var We=new Uint8Array(1);return We.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},We.foo()===42&&typeof We.subarray=="function"&&We.subarray(1,1).byteLength===0}catch{return!1}}(),i.kMaxLength=O(),S.poolSize=8192,S._augment=function(We){return We.__proto__=S.prototype,We},S.from=function(We,Ye,He){return M(null,We,Ye,He)},S.TYPED_ARRAY_SUPPORT&&(S.prototype.__proto__=Uint8Array.prototype,S.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&S[Symbol.species]===S&&Object.defineProperty(S,Symbol.species,{value:null,configurable:!0})),S.alloc=function(We,Ye,He){return function(dt,It,ct,on){return P(It),It<=0?A(dt,It):ct!==void 0?typeof on=="string"?A(dt,It).fill(ct,on):A(dt,It).fill(ct):A(dt,It)}(null,We,Ye,He)},S.allocUnsafe=function(We){return L(null,We)},S.allocUnsafeSlow=function(We){return L(null,We)},S.isBuffer=function(We){return!(We==null||!We._isBuffer)},S.compare=function(We,Ye){if(!S.isBuffer(We)||!S.isBuffer(Ye))throw new TypeError("Arguments must be Buffers");if(We===Ye)return 0;for(var He=We.length,dt=Ye.length,It=0,ct=Math.min(He,dt);It<ct;++It)if(We[It]!==Ye[It]){He=We[It],dt=Ye[It];break}return He<dt?-1:dt<He?1:0},S.isEncoding=function(We){switch(String(We).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},S.concat=function(We,Ye){if(!g(We))throw new TypeError('"list" argument must be an Array of Buffers');if(We.length===0)return S.alloc(0);var He;if(Ye===void 0)for(Ye=0,He=0;He<We.length;++He)Ye+=We[He].length;var dt=S.allocUnsafe(Ye),It=0;for(He=0;He<We.length;++He){var ct=We[He];if(!S.isBuffer(ct))throw new TypeError('"list" argument must be an Array of Buffers');ct.copy(dt,It),It+=ct.length}return dt},S.byteLength=ee,S.prototype._isBuffer=!0,S.prototype.swap16=function(){var We=this.length;if(We%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var Ye=0;Ye<We;Ye+=2)J(this,Ye,Ye+1);return this},S.prototype.swap32=function(){var We=this.length;if(We%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var Ye=0;Ye<We;Ye+=4)J(this,Ye,Ye+3),J(this,Ye+1,Ye+2);return this},S.prototype.swap64=function(){var We=this.length;if(We%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var Ye=0;Ye<We;Ye+=8)J(this,Ye,Ye+7),J(this,Ye+1,Ye+6),J(this,Ye+2,Ye+5),J(this,Ye+3,Ye+4);return this},S.prototype.toString=function(){var We=0|this.length;return We===0?"":arguments.length===0?Dt(this,0,We):function(Ye,He,dt){var It=!1;if((He===void 0||He<0)&&(He=0),He>this.length||((dt===void 0||dt>this.length)&&(dt=this.length),dt<=0)||(dt>>>=0)<=(He>>>=0))return"";for(Ye||(Ye="utf8");;)switch(Ye){case"hex":return zt(this,He,dt);case"utf8":case"utf-8":return Dt(this,He,dt);case"ascii":return Ee(this,He,dt);case"latin1":case"binary":return Ot(this,He,dt);case"base64":return ht(this,He,dt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,He,dt);default:if(It)throw new TypeError("Unknown encoding: "+Ye);Ye=(Ye+"").toLowerCase(),It=!0}}.apply(this,arguments)},S.prototype.equals=function(We){if(!S.isBuffer(We))throw new TypeError("Argument must be a Buffer");return this===We||S.compare(this,We)===0},S.prototype.inspect=function(){var We="",Ye=i.INSPECT_MAX_BYTES;return this.length>0&&(We=this.toString("hex",0,Ye).match(/.{2}/g).join(" "),this.length>Ye&&(We+=" ... ")),"<Buffer "+We+">"},S.prototype.compare=function(We,Ye,He,dt,It){if(!S.isBuffer(We))throw new TypeError("Argument must be a Buffer");if(Ye===void 0&&(Ye=0),He===void 0&&(He=We?We.length:0),dt===void 0&&(dt=0),It===void 0&&(It=this.length),Ye<0||He>We.length||dt<0||It>this.length)throw new RangeError("out of range index");if(dt>=It&&Ye>=He)return 0;if(dt>=It)return-1;if(Ye>=He)return 1;if(Ye>>>=0,He>>>=0,dt>>>=0,It>>>=0,this===We)return 0;for(var ct=It-dt,on=He-Ye,Xt=Math.min(ct,on),En=this.slice(dt,It),xe=We.slice(Ye,He),jn=0;jn<Xt;++jn)if(En[jn]!==xe[jn]){ct=En[jn],on=xe[jn];break}return ct<on?-1:on<ct?1:0},S.prototype.includes=function(We,Ye,He){return this.indexOf(We,Ye,He)!==-1},S.prototype.indexOf=function(We,Ye,He){return K(this,We,Ye,He,!0)},S.prototype.lastIndexOf=function(We,Ye,He){return K(this,We,Ye,He,!1)},S.prototype.write=function(We,Ye,He,dt){if(Ye===void 0)dt="utf8",He=this.length,Ye=0;else if(He===void 0&&typeof Ye=="string")dt=Ye,He=this.length,Ye=0;else{if(!isFinite(Ye))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");Ye|=0,isFinite(He)?(He|=0,dt===void 0&&(dt="utf8")):(dt=He,He=void 0)}var It=this.length-Ye;if((He===void 0||He>It)&&(He=It),We.length>0&&(He<0||Ye<0)||Ye>this.length)throw new RangeError("Attempt to write outside buffer bounds");dt||(dt="utf8");for(var ct=!1;;)switch(dt){case"hex":return ce(this,We,Ye,He);case"utf8":case"utf-8":return pe(this,We,Ye,He);case"ascii":return ke(this,We,Ye,He);case"latin1":case"binary":return Ce(this,We,Ye,He);case"base64":return be(this,We,Ye,He);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $e(this,We,Ye,He);default:if(ct)throw new TypeError("Unknown encoding: "+dt);dt=(""+dt).toLowerCase(),ct=!0}},S.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Ut=4096;function Ee(We,Ye,He){var dt="";He=Math.min(We.length,He);for(var It=Ye;It<He;++It)dt+=String.fromCharCode(127&We[It]);return dt}function Ot(We,Ye,He){var dt="";He=Math.min(We.length,He);for(var It=Ye;It<He;++It)dt+=String.fromCharCode(We[It]);return dt}function zt(We,Ye,He){var dt=We.length;(!Ye||Ye<0)&&(Ye=0),(!He||He<0||He>dt)&&(He=dt);for(var It="",ct=Ye;ct<He;++ct)It+=Vt(We[ct]);return It}function Mt(We,Ye,He){for(var dt=We.slice(Ye,He),It="",ct=0;ct<dt.length;ct+=2)It+=String.fromCharCode(dt[ct]+256*dt[ct+1]);return It}function Ke(We,Ye,He){if(We%1!=0||We<0)throw new RangeError("offset is not uint");if(We+Ye>He)throw new RangeError("Trying to access beyond buffer length")}function Tt(We,Ye,He,dt,It,ct){if(!S.isBuffer(We))throw new TypeError('"buffer" argument must be a Buffer instance');if(Ye>It||Ye<ct)throw new RangeError('"value" argument is out of bounds');if(He+dt>We.length)throw new RangeError("Index out of range")}function vt(We,Ye,He,dt){Ye<0&&(Ye=65535+Ye+1);for(var It=0,ct=Math.min(We.length-He,2);It<ct;++It)We[He+It]=(Ye&255<<8*(dt?It:1-It))>>>8*(dt?It:1-It)}function yt(We,Ye,He,dt){Ye<0&&(Ye=4294967295+Ye+1);for(var It=0,ct=Math.min(We.length-He,4);It<ct;++It)We[He+It]=Ye>>>8*(dt?It:3-It)&255}function bt(We,Ye,He,dt,It,ct){if(He+dt>We.length)throw new RangeError("Index out of range");if(He<0)throw new RangeError("Index out of range")}function Ht(We,Ye,He,dt,It){return It||bt(We,0,He,4),v.write(We,Ye,He,dt,23,4),He+4}function _t(We,Ye,He,dt,It){return It||bt(We,0,He,8),v.write(We,Ye,He,dt,52,8),He+8}S.prototype.slice=function(We,Ye){var He,dt=this.length;if(We=~~We,Ye=Ye===void 0?dt:~~Ye,We<0?(We+=dt)<0&&(We=0):We>dt&&(We=dt),Ye<0?(Ye+=dt)<0&&(Ye=0):Ye>dt&&(Ye=dt),Ye<We&&(Ye=We),S.TYPED_ARRAY_SUPPORT)(He=this.subarray(We,Ye)).__proto__=S.prototype;else{var It=Ye-We;He=new S(It,void 0);for(var ct=0;ct<It;++ct)He[ct]=this[ct+We]}return He},S.prototype.readUIntLE=function(We,Ye,He){We|=0,Ye|=0,He||Ke(We,Ye,this.length);for(var dt=this[We],It=1,ct=0;++ct<Ye&&(It*=256);)dt+=this[We+ct]*It;return dt},S.prototype.readUIntBE=function(We,Ye,He){We|=0,Ye|=0,He||Ke(We,Ye,this.length);for(var dt=this[We+--Ye],It=1;Ye>0&&(It*=256);)dt+=this[We+--Ye]*It;return dt},S.prototype.readUInt8=function(We,Ye){return Ye||Ke(We,1,this.length),this[We]},S.prototype.readUInt16LE=function(We,Ye){return Ye||Ke(We,2,this.length),this[We]|this[We+1]<<8},S.prototype.readUInt16BE=function(We,Ye){return Ye||Ke(We,2,this.length),this[We]<<8|this[We+1]},S.prototype.readUInt32LE=function(We,Ye){return Ye||Ke(We,4,this.length),(this[We]|this[We+1]<<8|this[We+2]<<16)+16777216*this[We+3]},S.prototype.readUInt32BE=function(We,Ye){return Ye||Ke(We,4,this.length),16777216*this[We]+(this[We+1]<<16|this[We+2]<<8|this[We+3])},S.prototype.readIntLE=function(We,Ye,He){We|=0,Ye|=0,He||Ke(We,Ye,this.length);for(var dt=this[We],It=1,ct=0;++ct<Ye&&(It*=256);)dt+=this[We+ct]*It;return dt>=(It*=128)&&(dt-=Math.pow(2,8*Ye)),dt},S.prototype.readIntBE=function(We,Ye,He){We|=0,Ye|=0,He||Ke(We,Ye,this.length);for(var dt=Ye,It=1,ct=this[We+--dt];dt>0&&(It*=256);)ct+=this[We+--dt]*It;return ct>=(It*=128)&&(ct-=Math.pow(2,8*Ye)),ct},S.prototype.readInt8=function(We,Ye){return Ye||Ke(We,1,this.length),128&this[We]?-1*(255-this[We]+1):this[We]},S.prototype.readInt16LE=function(We,Ye){Ye||Ke(We,2,this.length);var He=this[We]|this[We+1]<<8;return 32768&He?4294901760|He:He},S.prototype.readInt16BE=function(We,Ye){Ye||Ke(We,2,this.length);var He=this[We+1]|this[We]<<8;return 32768&He?4294901760|He:He},S.prototype.readInt32LE=function(We,Ye){return Ye||Ke(We,4,this.length),this[We]|this[We+1]<<8|this[We+2]<<16|this[We+3]<<24},S.prototype.readInt32BE=function(We,Ye){return Ye||Ke(We,4,this.length),this[We]<<24|this[We+1]<<16|this[We+2]<<8|this[We+3]},S.prototype.readFloatLE=function(We,Ye){return Ye||Ke(We,4,this.length),v.read(this,We,!0,23,4)},S.prototype.readFloatBE=function(We,Ye){return Ye||Ke(We,4,this.length),v.read(this,We,!1,23,4)},S.prototype.readDoubleLE=function(We,Ye){return Ye||Ke(We,8,this.length),v.read(this,We,!0,52,8)},S.prototype.readDoubleBE=function(We,Ye){return Ye||Ke(We,8,this.length),v.read(this,We,!1,52,8)},S.prototype.writeUIntLE=function(We,Ye,He,dt){We=+We,Ye|=0,He|=0,dt||Tt(this,We,Ye,He,Math.pow(2,8*He)-1,0);var It=1,ct=0;for(this[Ye]=255&We;++ct<He&&(It*=256);)this[Ye+ct]=We/It&255;return Ye+He},S.prototype.writeUIntBE=function(We,Ye,He,dt){We=+We,Ye|=0,He|=0,dt||Tt(this,We,Ye,He,Math.pow(2,8*He)-1,0);var It=He-1,ct=1;for(this[Ye+It]=255&We;--It>=0&&(ct*=256);)this[Ye+It]=We/ct&255;return Ye+He},S.prototype.writeUInt8=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,1,255,0),S.TYPED_ARRAY_SUPPORT||(We=Math.floor(We)),this[Ye]=255&We,Ye+1},S.prototype.writeUInt16LE=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,2,65535,0),S.TYPED_ARRAY_SUPPORT?(this[Ye]=255&We,this[Ye+1]=We>>>8):vt(this,We,Ye,!0),Ye+2},S.prototype.writeUInt16BE=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,2,65535,0),S.TYPED_ARRAY_SUPPORT?(this[Ye]=We>>>8,this[Ye+1]=255&We):vt(this,We,Ye,!1),Ye+2},S.prototype.writeUInt32LE=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,4,4294967295,0),S.TYPED_ARRAY_SUPPORT?(this[Ye+3]=We>>>24,this[Ye+2]=We>>>16,this[Ye+1]=We>>>8,this[Ye]=255&We):yt(this,We,Ye,!0),Ye+4},S.prototype.writeUInt32BE=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,4,4294967295,0),S.TYPED_ARRAY_SUPPORT?(this[Ye]=We>>>24,this[Ye+1]=We>>>16,this[Ye+2]=We>>>8,this[Ye+3]=255&We):yt(this,We,Ye,!1),Ye+4},S.prototype.writeIntLE=function(We,Ye,He,dt){if(We=+We,Ye|=0,!dt){var It=Math.pow(2,8*He-1);Tt(this,We,Ye,He,It-1,-It)}var ct=0,on=1,Xt=0;for(this[Ye]=255&We;++ct<He&&(on*=256);)We<0&&Xt===0&&this[Ye+ct-1]!==0&&(Xt=1),this[Ye+ct]=(We/on>>0)-Xt&255;return Ye+He},S.prototype.writeIntBE=function(We,Ye,He,dt){if(We=+We,Ye|=0,!dt){var It=Math.pow(2,8*He-1);Tt(this,We,Ye,He,It-1,-It)}var ct=He-1,on=1,Xt=0;for(this[Ye+ct]=255&We;--ct>=0&&(on*=256);)We<0&&Xt===0&&this[Ye+ct+1]!==0&&(Xt=1),this[Ye+ct]=(We/on>>0)-Xt&255;return Ye+He},S.prototype.writeInt8=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,1,127,-128),S.TYPED_ARRAY_SUPPORT||(We=Math.floor(We)),We<0&&(We=255+We+1),this[Ye]=255&We,Ye+1},S.prototype.writeInt16LE=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,2,32767,-32768),S.TYPED_ARRAY_SUPPORT?(this[Ye]=255&We,this[Ye+1]=We>>>8):vt(this,We,Ye,!0),Ye+2},S.prototype.writeInt16BE=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,2,32767,-32768),S.TYPED_ARRAY_SUPPORT?(this[Ye]=We>>>8,this[Ye+1]=255&We):vt(this,We,Ye,!1),Ye+2},S.prototype.writeInt32LE=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,4,2147483647,-2147483648),S.TYPED_ARRAY_SUPPORT?(this[Ye]=255&We,this[Ye+1]=We>>>8,this[Ye+2]=We>>>16,this[Ye+3]=We>>>24):yt(this,We,Ye,!0),Ye+4},S.prototype.writeInt32BE=function(We,Ye,He){return We=+We,Ye|=0,He||Tt(this,We,Ye,4,2147483647,-2147483648),We<0&&(We=4294967295+We+1),S.TYPED_ARRAY_SUPPORT?(this[Ye]=We>>>24,this[Ye+1]=We>>>16,this[Ye+2]=We>>>8,this[Ye+3]=255&We):yt(this,We,Ye,!1),Ye+4},S.prototype.writeFloatLE=function(We,Ye,He){return Ht(this,We,Ye,!0,He)},S.prototype.writeFloatBE=function(We,Ye,He){return Ht(this,We,Ye,!1,He)},S.prototype.writeDoubleLE=function(We,Ye,He){return _t(this,We,Ye,!0,He)},S.prototype.writeDoubleBE=function(We,Ye,He){return _t(this,We,Ye,!1,He)},S.prototype.copy=function(We,Ye,He,dt){if(He||(He=0),dt||dt===0||(dt=this.length),Ye>=We.length&&(Ye=We.length),Ye||(Ye=0),dt>0&&dt<He&&(dt=He),dt===He||We.length===0||this.length===0)return 0;if(Ye<0)throw new RangeError("targetStart out of bounds");if(He<0||He>=this.length)throw new RangeError("sourceStart out of bounds");if(dt<0)throw new RangeError("sourceEnd out of bounds");dt>this.length&&(dt=this.length),We.length-Ye<dt-He&&(dt=We.length-Ye+He);var It,ct=dt-He;if(this===We&&He<Ye&&Ye<dt)for(It=ct-1;It>=0;--It)We[It+Ye]=this[It+He];else if(ct<1e3||!S.TYPED_ARRAY_SUPPORT)for(It=0;It<ct;++It)We[It+Ye]=this[It+He];else Uint8Array.prototype.set.call(We,this.subarray(He,He+ct),Ye);return ct},S.prototype.fill=function(We,Ye,He,dt){if(typeof We=="string"){if(typeof Ye=="string"?(dt=Ye,Ye=0,He=this.length):typeof He=="string"&&(dt=He,He=this.length),We.length===1){var It=We.charCodeAt(0);It<256&&(We=It)}if(dt!==void 0&&typeof dt!="string")throw new TypeError("encoding must be a string");if(typeof dt=="string"&&!S.isEncoding(dt))throw new TypeError("Unknown encoding: "+dt)}else typeof We=="number"&&(We&=255);if(Ye<0||this.length<Ye||this.length<He)throw new RangeError("Out of range index");if(He<=Ye)return this;var ct;if(Ye>>>=0,He=He===void 0?this.length:He>>>0,We||(We=0),typeof We=="number")for(ct=Ye;ct<He;++ct)this[ct]=We;else{var on=S.isBuffer(We)?We:sn(new S(We,dt).toString()),Xt=on.length;for(ct=0;ct<He-Ye;++ct)this[ct+Ye]=on[ct%Xt]}return this};var Ze=/[^+\/0-9A-Za-z-_]/g;function Vt(We){return We<16?"0"+We.toString(16):We.toString(16)}function sn(We,Ye){var He;Ye=Ye||1/0;for(var dt=We.length,It=null,ct=[],on=0;on<dt;++on){if((He=We.charCodeAt(on))>55295&&He<57344){if(!It){if(He>56319){(Ye-=3)>-1&&ct.push(239,191,189);continue}if(on+1===dt){(Ye-=3)>-1&&ct.push(239,191,189);continue}It=He;continue}if(He<56320){(Ye-=3)>-1&&ct.push(239,191,189),It=He;continue}He=65536+(It-55296<<10|He-56320)}else It&&(Ye-=3)>
8023-1&&ct.push(239,191,189);if(It=null,He<128){if((Ye-=1)<0)break;ct.push(He)}else if(He<2048){if((Ye-=2)<0)break;ct.push(He>>6|192,63&He|128)}else if(He<65536){if((Ye-=3)<0)break;ct.push(He>>12|224,He>>6&63|128,63&He|128)}else{if(!(He<1114112))throw new Error("Invalid code point");if((Ye-=4)<0)break;ct.push(He>>18|240,He>>12&63|128,He>>6&63|128,63&He|128)}}return ct}function yn(We){return h.toByteArray(function(Ye){if((Ye=function(He){return He.trim?He.trim():He.replace(/^\s+|\s+$/g,"")}(Ye).replace(Ze,"")).length<2)return"";for(;Ye.length%4!=0;)Ye+="=";return Ye}(We))}function Yt(We,Ye,He,dt){for(var It=0;It<dt&&!(It+He>=Ye.length||It>=We.length);++It)Ye[It+He]=We[It];return It}}).call(this,n(59))},function(a,i,n){var s=n(38);a.exports=function(h,v,g){for(var O in v)s(h,O,v[O],g);return h}},function(a,i){a.exports=function(n,s,h,v){if(!(n instanceof s)||v!==void 0&&v in n)throw TypeError(h+": incorrect invocation!");return n}},function(a,i,n){var s=n(16),h=n(26),v=n(27),g=n(19)("species");a.exports=function(O){var A=s[O];v&&A&&!A[g]&&h.f(A,g,{configurable:!0,get:function(){return this}})}},function(a,i){a.exports={}},function(a,i,n){var s=n(8),h=n(61),v=n(15),g=n(169),O="["+g+"]",A=RegExp("^"+O+O+"*"),S=RegExp(O+O+"*$"),M=function(L,V,N){var ee={},J=v(function(){return!!g[L]()||"âÂ
"[L]()!="âÂ
"}),K=ee[L]=J?V(P):g[L];N&&(ee[N]=K),s(s.P+s.F*J,"String",ee)},P=M.trim=function(L,V){return L=String(h(L)),1&V&&(L=L.replace(A,"")),2&V&&(L=L.replace(S,"")),L};a.exports=M},function(a,i,n){var s=n(26).f,h=n(43),v=n(19)("toStringTag");a.exports=function(g,O,A){g&&!h(g=A?g:g.prototype,v)&&s(g,v,{configurable:!0,value:O})}},function(a,i,n){var s,h=typeof Reflect=="object"?Reflect:null,v=h&&typeof h.apply=="function"?h.apply:function(K,re,ce){return Function.prototype.apply.call(K,re,ce)};s=h&&typeof h.ownKeys=="function"?h.ownKeys:Object.getOwnPropertySymbols?function(K){return Object.getOwnPropertyNames(K).concat(Object.getOwnPropertySymbols(K))}:function(K){return Object.getOwnPropertyNames(K)};var g=Number.isNaN||function(K){return K!=K};function O(){O.init.call(this)}a.exports=O,a.exports.once=function(K,re){return new Promise(function(ce,pe){function ke(be){K.removeListener(re,Ce),pe(be)}function Ce(){typeof K.removeListener=="function"&&K.removeListener("error",ke),ce([].slice.call(arguments))}J(K,re,Ce,{once:!0}),re!=="error"&&function(be,$e,ht){typeof be.on=="function"&&J(be,"error",$e,ht)}(K,ke,{once:!0})})},O.EventEmitter=O,O.prototype._events=void 0,O.prototype._eventsCount=0,O.prototype._maxListeners=void 0;var A=10;function S(K){if(typeof K!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof K)}function M(K){return K._maxListeners===void 0?O.defaultMaxListeners:K._maxListeners}function P(K,re,ce,pe){var ke,Ce,be;if(S(ce),(Ce=K._events)===void 0?(Ce=K._events=Object.create(null),K._eventsCount=0):(Ce.newListener!==void 0&&(K.emit("newListener",re,ce.listener?ce.listener:ce),Ce=K._events),be=Ce[re]),be===void 0)be=Ce[re]=ce,++K._eventsCount;else if(typeof be=="function"?be=Ce[re]=pe?[ce,be]:[be,ce]:pe?be.unshift(ce):be.push(ce),(ke=M(K))>0&&be.length>ke&&!be.warned){be.warned=!0;var $e=new Error("Possible EventEmitter memory leak detected. "+be.length+" "+String(re)+" listeners added. Use emitter.setMaxListeners() to increase limit");$e.name="MaxListenersExceededWarning",$e.emitter=K,$e.type=re,$e.count=be.length,function(ht){console&&console.warn&&console.warn(ht)}($e)}return K}function L(K,re,ce){var pe={fired:!1,wrapFn:void 0,target:K,type:re,listener:ce},ke=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(pe);return ke.listener=ce,pe.wrapFn=ke,ke}function V(K,re,ce){var pe=K._events;if(pe===void 0)return[];var ke=pe[re];return ke===void 0?[]:typeof ke=="function"?ce?[ke.listener||ke]:[ke]:ce?function(Ce){for(var be=new Array(Ce.length),$e=0;$e<be.length;++$e)be[$e]=Ce[$e].listener||Ce[$e];return be}(ke):ee(ke,ke.length)}function N(K){var re=this._events;if(re!==void 0){var ce=re[K];if(typeof ce=="function")return 1;if(ce!==void 0)return ce.length}return 0}function ee(K,re){for(var ce=new Array(re),pe=0;pe<re;++pe)ce[pe]=K[pe];return ce}function J(K,re,ce,pe){if(typeof K.on=="function")pe.once?K.once(re,ce):K.on(re,ce);else{if(typeof K.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof K);K.addEventListener(re,function ke(Ce){pe.once&&K.removeEventListener(re,ke),ce(Ce)})}}Object.defineProperty(O,"defaultMaxListeners",{enumerable:!0,get:function(){return A},set:function(K){if(typeof K!="number"||K<0||g(K))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+K+".");A=K}}),O.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},O.prototype.setMaxListeners=function(K){if(typeof K!="number"||K<0||g(K))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+K+".");return this._maxListeners=K,this},O.prototype.getMaxListeners=function(){return M(this)},O.prototype.emit=function(K){for(var re=[],ce=1;ce<arguments.length;ce++)re.push(arguments[ce]);var pe=K==="error",ke=this._events;if(ke!==void 0)pe=pe&&ke.error===void 0;else if(!pe)return!1;if(pe){var Ce;if(re.length>0&&(Ce=re[0]),Ce instanceof Error)throw Ce;var be=new Error("Unhandled error."+(Ce?" ("+Ce.message+")":""));throw be.context=Ce,be}var $e=ke[K];if($e===void 0)return!1;if(typeof $e=="function")v($e,this,re);else{var ht=$e.length,Dt=ee($e,ht);for(ce=0;ce<ht;++ce)v(Dt[ce],this,re)}return!0},O.prototype.addListener=function(K,re){return P(this,K,re,!1)},O.prototype.on=O.prototype.addListener,O.prototype.prependListener=function(K,re){return P(this,K,re,!0)},O.prototype.once=function(K,re){return S(re),this.on(K,L(this,K,re)),this},O.prototype.prependOnceListener=function(K,re){return S(re),this.prependListener(K,L(this,K,re)),this},O.prototype.removeListener=function(K,re){var ce,pe,ke,Ce,be;if(S(re),(pe=this._events)===void 0)return this;if((ce=pe[K])===void 0)return this;if(ce===re||ce.listener===re)--this._eventsCount==0?this._events=Object.create(null):(delete pe[K],pe.removeListener&&this.emit
8023("removeListener",K,ce.listener||re));else if(typeof ce!="function"){for(ke=-1,Ce=ce.length-1;Ce>=0;Ce--)if(ce[Ce]===re||ce[Ce].listener===re){be=ce[Ce].listener,ke=Ce;break}if(ke<0)return this;ke===0?ce.shift():function($e,ht){for(;ht+1<$e.length;ht++)$e[ht]=$e[ht+1];$e.pop()}(ce,ke),ce.length===1&&(pe[K]=ce[0]),pe.removeListener!==void 0&&this.emit("removeListener",K,be||re)}return this},O.prototype.off=O.prototype.removeListener,O.prototype.removeAllListeners=function(K){var re,ce,pe;if((ce=this._events)===void 0)return this;if(ce.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):ce[K]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete ce[K]),this;if(arguments.length===0){var ke,Ce=Object.keys(ce);for(pe=0;pe<Ce.length;++pe)(ke=Ce[pe])!=="removeListener"&&this.removeAllListeners(ke);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(re=ce[K])=="function")this.removeListener(K,re);else if(re!==void 0)for(pe=re.length-1;pe>=0;pe--)this.removeListener(K,re[pe]);return this},O.prototype.listeners=function(K){return V(this,K,!0)},O.prototype.rawListeners=function(K){return V(this,K,!1)},O.listenerCount=function(K,re){return typeof K.listenerCount=="function"?K.listenerCount(re):N.call(K,re)},O.prototype.listenerCount=N,O.prototype.eventNames=function(){return this._eventsCount>0?s(this._events):[]}},function(a,i,n){n.d(i,"a",function(){return h}),n.d(i,"b",function(){return v}),n.d(i,"c",function(){return g}),n.d(i,"d",function(){return O});var s,h,v,g,O,A=n(246);(function(S){s=Object(A.a)(S),h=s.format,v=s.parse,g=s.utcFormat,O=s.utcParse})({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(h){return typeof h=="string"&&s.test(h)};var s=/-webkit-|-moz-|-ms-/;a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.compose=i.merge=i.$=i.style=i.presets=i.keyframes=i.fontFace=i.insertGlobal=i.insertRule=i.plugins=i.styleSheet=void 0,i.speedy=function(He){return P.speedy(He)},i.simulations=function(){var He=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];J=!!He},i.simulate=function(){for(var He=arguments.length,dt=Array(He),It=0;It<He;It++)dt[It]=arguments[It];return(dt=(0,g.default)(dt))?J?dt.reduce(function(ct,on){return ct["data-simulate-"+pe(on)]="",ct},{}):(K||(console.warn("can't simulate without once calling simulations(true)"),K=!0),V||N||re||(console.warn("don't use simulation outside dev"),re=!0),{}):{}},i.cssLabels=function(He){ce=!!He},i.isLikeRule=Ce,i.idFor=be,i.css=yn,i.rehydrate=function(He){(0,s.default)(zt,He.reduce(function(dt,It){return dt[It]=!0,dt},{}))},i.flush=function(){zt=P.inserted={},Mt=P.registered={},Tt={},P.flush(),P.inject()},i.select=We,i.parent=function(He){for(var dt=arguments.length,It=Array(dt>1?dt-1:0),ct=1;ct<dt;ct++)It[ct-1]=arguments[ct];return yn(M({},He+" &",It))},i.media=function(He){for(var dt=arguments.length,It=Array(dt>1?dt-1:0),ct=1;ct<dt;ct++)It[ct-1]=arguments[ct];return yn(M({},"@media "+He,It))},i.pseudo=Ye,i.active=function(He){return Ye(":active",He)},i.any=function(He){return Ye(":any",He)},i.checked=function(He){return Ye(":checked",He)},i.disabled=function(He){return Ye(":disabled",He)},i.empty=function(He){return Ye(":empty",He)},i.enabled=function(He){return Ye(":enabled",He)},i._default=function(He){return Ye(":default",He)},i.first=function(He){return Ye(":first",He)},i.firstChild=function(He){return Ye(":first-child",He)},i.firstOfType=function(He){return Ye(":first-of-type",He)},i.fullscreen=function(He){return Ye(":fullscreen",He)},i.focus=function(He){return Ye(":focus",He)},i.hover=function(He){return Ye(":hover",He)},i.indeterminate=function(He){return Ye(":indeterminate",He)},i.inRange=function(He){return Ye(":in-range",He)},i.invalid=function(He){return Ye(":invalid",He)},i.lastChild=function(He){return Ye(":last-child",He)},i.lastOfType=function(He){return Ye(":last-of-type",He)},i.left=function(He){return Ye(":left",He)},i.link=function(He){return Ye(":link",He)},i.onlyChild=function(He){return Ye(":only-child",He)},i.onlyOfType=function(He){return Ye(":only-of-type",He)},i.optional=function(He){return Ye(":optional",He)},i.outOfRange=function(He){return Ye(":out-of-range",He)},i.readOnly=function(He){return Ye(":read-only",He)},i.readWrite=function(He){return Ye(":read-write",He)},i.required=function(He){return Ye(":required",He)},i.right=function(He){return Ye(":right",He)},i.root=function(He){return Ye(":root",He)},i.scope=function(He){return Ye(":scope",He)},i.target=function(He){return Ye(":target",He)},i.valid=function(He){return Ye(":valid",He)},i.visited=function(He){return Ye(":visited",He)},i.dir=function(He,dt){return Ye(":dir("+He+")",dt)},i.lang=function(He,dt){return Ye(":lang("+He+")",dt)},i.not=function(He,dt){var It=He.split(",").map(function(ct){return ct.trim()}).map(function(ct){return":not("+ct+")"});return It.length===1?Ye(":not("+He+")",dt):We(It.join(""),dt)},i.nthChild=function(He,dt){return Ye(":nth-child("+He+")",dt)},i.nthLastChild=function(He,dt){return Ye(":nth-last-child("+He+")",dt)},i.nthLastOfType=function(He,dt){return Ye(":nth-last-of-type("+He+")",dt)},i.nthOfType=function(He,dt){return Ye(":nth-of-type("+He+")",dt)},i.after=function(He){return Ye("::after",He)},i.before=function(He){return Ye("::before",He)},i.firstLetter=function(He){return Ye("::first-letter",He)},i.firstLine=function(He){return Ye("::first-line",He)},i.selection=function(He){return Ye("::selection",He)},i.backdrop=function(He){return Ye("::backdrop",He)},i.placeholder=function(He){return yn({"::placeholder":He})},i.cssFor=function(){for(var He=arguments.length,dt=Array(He),It=0;It<He;It++)dt[It]=arguments[It];return(dt=(0,g.default)(dt))?dt.map(function(ct){var on={label:[]};return Ht(on,{src:ct}),Ot(ke(on),Ee(on)).join("")}).join(""):""},i.attribsFor=function(){for(var He=arguments.length,dt=Array(He),It=0;It<He;It++)dt[It]=arguments[It];return(dt=(0,g.default)(dt))?dt.map(function(ct){be(ct);var on=Object.keys(ct)[0],Xt=ct[on];return on+'="'+(Xt||"")+'"'}).join(" "):""};var s=S(n(139)),h=n(320),v=n(201),g=S(n(311)),O=n(310),A=S(n(293));function S(He){return He&&He.__esModule?He:{default:He}}function M(He,dt,It){return dt in He?Object.defineProperty(He,dt,{value:It,enumerable:!0,configurable:!0,writable:!0}):He[dt]=It,He}var P=i.styleSheet=new h.StyleSheet;P.inject();var L=i.plugins=P.plugins=new O.PluginSet([O.prefixes,O.contentWrap,O.fallbacks]);L.media=new O.PluginSet,L.fontFace=new O.PluginSet,L.keyframes=new O.PluginSet([O.prefixes,O.fallbacks]);var V=!1,N=!1,ee=typeof window<"u",J=V,K=!1,re=!1,ce=V;function pe(He){var dt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return He.toLowerCase().replace(/[^a-z0-9]/g,dt)}function ke(He){var dt=JSON.stringify(He),It=(0,A.default)(dt).toString(36);return He.label&&He.label.length>0&&V?pe(He.label.join("."),"-")+"-"+It:It}function Ce(He){var dt=Object.keys(He).filter(function(It){return It!=="toString"});return dt.length===1&&!!/data\-css\-([a-zA-Z0-9\-_]+)/.exec(dt[0])}function be(He){var dt=Object.keys(He).filter(function(ct){return ct!=="toString"});if(dt.length!==1)throw new Error("not a rule");var It=/data\-css\-([a-zA-Z0-9\-_]+)/.exec(dt[0]);if(!It)throw new Error("not a rule");return It[1]}var $e=/[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g;function ht(He){if(He.indexOf(",")===-1)return[He];for(var dt,It=[],ct=[],on=0;dt=$e.exec(He);)switch(dt[0]){case"(":on++;break;case")":on--;break;case",":if(on)break;It.push(dt.index)}for(dt=It.length;dt--;
8023)ct.unshift(He.slice(It[dt]+1)),He=He.slice(0,It[dt]);return ct.unshift(He),ct}function Dt(He,dt){if(!He)return dt.replace(/\&/g,"");if(!dt)return".css-"+He+",[data-css-"+He+"]";var It=ht(dt).map(function(ct){return ct.indexOf("&")>=0?[ct.replace(/\&/gm,".css-"+He),ct.replace(/\&/gm,"[data-css-"+He+"]")].join(","):".css-"+He+ct+",[data-css-"+He+"]"+ct}).join(",");return J&&/^\&\:/.exec(dt)&&!/\s/.exec(dt)&&(It+=",.css-"+He+"[data-simulate-"+pe(dt)+"],[data-css-"+He+"][data-simulate-"+pe(dt)+"]"),It}function Ut(He){var dt=He.selector,It=He.style,ct=L.transform({selector:dt,style:It});return ct.selector+"{"+(0,v.createMarkupForStyles)(ct.style)+"}"}function Ee(He){var dt=void 0,It=void 0,ct=void 0,on=void 0;return Object.keys(He).forEach(function(Xt){Xt.indexOf("&")>=0?(It=It||{})[Xt]=He[Xt]:Xt.indexOf("@media")===0?(ct=ct||{})[Xt]=Ee(He[Xt]):Xt.indexOf("@supports")===0?(on=on||{})[Xt]=Ee(He[Xt]):Xt==="label"?He.label.length>0&&((dt=dt||{}).label=ce?He.label.join("."):""):(dt=dt||{})[Xt]=He[Xt]}),{plain:dt,selects:It,medias:ct,supports:on}}function Ot(He,dt){var It=[],ct=dt.plain,on=dt.selects,Xt=dt.medias,En=dt.supports;return ct&&It.push(Ut({style:ct,selector:Dt(He)})),on&&Object.keys(on).forEach(function(xe){return It.push(Ut({style:on[xe],selector:Dt(He,xe)}))}),Xt&&Object.keys(Xt).forEach(function(xe){return It.push(xe+"{"+Ot(He,Xt[xe]).join("")+"}")}),En&&Object.keys(En).forEach(function(xe){return It.push(xe+"{"+Ot(He,En[xe]).join("")+"}")}),It}var zt=P.inserted={},Mt=P.registered={};function Ke(He){Mt[He.id]||(Mt[He.id]=He)}var Tt={};function vt(He){if(Ke(He),function(It){if(!zt[It.id]){zt[It.id]=!0;var ct=Ee(It.style),on=Ot(It.id,ct);zt[It.id]=!!ee||on,on.forEach(function(Xt){return P.insert(Xt)})}}(He),Tt[He.id])return Tt[He.id];var dt=M({},"data-css-"+He.id,ce&&He.label||"");return Object.defineProperty(dt,"toString",{enumerable:!1,value:function(){return"css-"+He.id}}),Tt[He.id]=dt,dt}function yt(He,dt){var It=ht(He).map(function(ct){return ct.indexOf("&")>=0?ct:"&"+ct});return ht(dt).map(function(ct){return ct.indexOf("&")>=0?ct:"&"+ct}).reduce(function(ct,on){return ct.concat(It.map(function(Xt){return on.replace(/\&/g,Xt)}))},[]).join(",")}var bt={"::placeholder":["::-webkit-input-placeholder","::-moz-placeholder","::-ms-input-placeholder"],":fullscreen":[":-webkit-full-screen",":-moz-full-screen",":-ms-fullscreen"]};function Ht(He,dt){var It=dt.selector,ct=It===void 0?"":It,on=dt.mq,Xt=on===void 0?"":on,En=dt.supp,xe=En===void 0?"":En,jn=dt.src,nr=jn===void 0?{}:jn;Array.isArray(nr)||(nr=[nr]),(nr=function ar(cr){for(var Er=[],hn=0;hn<cr.length;hn++)Er=Array.isArray(cr[hn])?Er.concat(ar(cr[hn])):Er.concat(cr[hn]);return Er}(nr)).forEach(function(ar){if(Ce(ar)){var cr=function(Er){if(Ce(Er)){var hn=Mt[be(Er)];if(hn==null)throw new Error("[glamor] an unexpected rule cache miss occurred. This is probably a sign of multiple glamor instances in your app. See https://github.com/threepointone/glamor/issues/79");return hn}return Er}(ar);if(cr.type!=="css")throw new Error("cannot merge this rule");ar=cr.style}(ar=(0,g.default)(ar))&&ar.composes&&Ht(He,{selector:ct,mq:Xt,supp:xe,src:ar.composes}),Object.keys(ar||{}).forEach(function(Er){if(function(rn){for(var fn=[":",".","[",">"," "],Xn=!1,Fn=rn.charAt(0),Ar=0;Ar<fn.length;Ar++)if(Fn===fn[Ar]){Xn=!0;break}return Xn||rn.indexOf("&")>=0}(Er))bt[Er]&&bt[Er].forEach(function(rn){return Ht(He,{selector:yt(ct,rn),mq:Xt,supp:xe,src:ar[Er]})}),Ht(He,{selector:yt(ct,Er),mq:Xt,supp:xe,src:ar[Er]});else if(function(rn){return rn.indexOf("@media")===0}(Er))Ht(He,{selector:ct,mq:function(rn,fn){return rn?"@media "+rn.substring(6)+" and "+fn.substring(6):fn}(Xt,Er),supp:xe,src:ar[Er]});else if(function(rn){return rn.indexOf("@supports")===0}(Er))Ht(He,{selector:ct,mq:Xt,supp:function(rn,fn){return rn?"@supports "+rn.substring(9)+" and "+fn.substring(9):fn}(xe,Er),src:ar[Er]});else if(Er!=="composes"){var hn=He;xe&&(hn[xe]=hn[xe]||{},hn=hn[xe]),Xt&&(hn[Xt]=hn[Xt]||{},hn=hn[Xt]),ct&&(hn[ct]=hn[ct]||{},hn=hn[ct]),Er==="label"?ce&&(He.label=He.label.concat(ar.label)):hn[Er]=ar[Er]}})})}function _t(He){var dt={label:[]};return Ht(dt,{src:He}),vt({id:ke(dt),style:dt,label:ce?dt.label.join("."):"",type:"css"})}var Ze={};Object.defineProperty(Ze,"toString",{enumerable:!1,value:function(){return"css-nil"}});var Vt=typeof WeakMap<"u"?[Ze,new WeakMap,new WeakMap,new WeakMap]:[Ze],sn=typeof WeakMap<"u"?function(He){return function(dt){if(Vt[dt.length]){for(var It=Vt[dt.length],ct=0;ct<dt.length-1;)It.has(dt[ct])||It.set(dt[ct],new WeakMap),It=It.get(dt[ct]),ct++;
8023if(It.has(dt[dt.length-1])){var on=It.get(dt[ct]);if(Mt[on.toString().substring(4)])return on}}var Xt=He(dt);if(Vt[dt.length]){for(var En=0,xe=Vt[dt.length];En<dt.length-1;)xe=xe.get(dt[En]),En++;try{xe.set(dt[En],Xt)}catch{}}return Xt}}(_t):_t;function yn(){for(var He=arguments.length,dt=Array(He),It=0;It<He;It++)dt[It]=arguments[It];if(dt[0]&&dt[0].length&&dt[0].raw)throw new Error("you forgot to include glamor/babel in your babel plugins.");return(dt=(0,g.default)(dt))?sn(dt):Ze}yn.insert=function(He){var dt={id:ke(He),css:He,type:"raw"};Ke(dt),zt[dt.id]||(P.insert(dt.css),zt[dt.id]=!!ee||[dt.css])},i.insertRule=yn.insert,yn.global=function(He,dt){if(dt=(0,g.default)(dt))return yn.insert(Ut({selector:He,style:dt}))},i.insertGlobal=yn.global,yn.keyframes=function(He,dt){dt||(dt=He,He="animation");var It={id:ke({name:He,kfs:dt=(0,g.default)(dt)||{}}),type:"keyframes",name:He,keyframes:dt};return Ke(It),function(ct){if(!zt[ct.id]){var on=Object.keys(ct.keyframes).map(function(En){var xe=L.keyframes.transform({id:ct.id,name:En,style:ct.keyframes[En]});return xe.name+"{"+(0,v.createMarkupForStyles)(xe.style)+"}"}).join(""),Xt=["-webkit-","-moz-","-o-",""].map(function(En){return"@"+En+"keyframes "+ct.name+"_"+ct.id+"{"+on+"}"});Xt.forEach(function(En){return P.insert(En)}),zt[ct.id]=!!ee||Xt}}(It),He+"_"+It.id},yn.fontFace=function(He){var dt={id:ke(He=(0,g.default)(He)),type:"font-face",font:He};return Ke(dt),function(It){if(!zt[It.id]){var ct="@font-face{"+(0,v.createMarkupForStyles)(It.font)+"}";P.insert(ct),zt[It.id]=!!ee||[ct]}}(dt),He.fontFamily},i.fontFace=yn.fontFace,i.keyframes=yn.keyframes,i.presets={mobile:"(min-width: 400px)",Mobile:"@media (min-width: 400px)",phablet:"(min-width: 550px)",Phablet:"@media (min-width: 550px)",tablet:"(min-width: 750px)",Tablet:"@media (min-width: 750px)",desktop:"(min-width: 1000px)",Desktop:"@media (min-width: 1000px)",hd:"(min-width: 1200px)",Hd:"@media (min-width: 1200px)"};var Yt=i.style=yn;function We(He){for(var dt=arguments.length,It=Array(dt>1?dt-1:0),ct=1;ct<dt;ct++)It[ct-1]=arguments[ct];return He?yn(M({},He,It)):Yt(It)}i.$=We,i.merge=yn,i.compose=yn;function Ye(He){for(var dt=arguments.length,It=Array(dt>1?dt-1:0),ct=1;ct<dt;ct++)It[ct-1]=arguments[ct];return yn(M({},He,It))}},function(a,i,n){/** 8024* @license 8025* Copyright 2017 Google Inc. All Rights Reserved. 8026* Licensed under the Apache License, Version 2.0 (the "License"); 8027* you may not use this file except in compliance with the License. 8028* You may obtain a copy of the License at 8029* 8030* http://www.apache.org/licenses/LICENSE-2.0 8031* 8032* Unless required by applicable law or agreed to in writing, software 8033* distributed under the License is distributed on an "AS IS" BASIS, 8034* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8035* See the License for the specific language governing permissions and 8036* limitations under the License. 8037* ============================================================================= 8038*/Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function v(g){this.global=g,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return v.prototype.setPlatform=function(g,O){this.platform!=null&&console.warn("Platform "+this.platformName+" has already been set. Overwriting the platform with "+O+"."),this.platformName=g,this.platform=O},v.prototype.registerFlag=function(g,O,A){if(this.flagRegistry[g]={evaluationFn:O,setHook:A},this.urlFlags[g]!=null){var S=this.urlFlags[g];console.warn("Setting feature override from URL "+g+": "+S+"."),this.set(g,S)}},v.prototype.get=function(g){return g in this.flags?this.flags[g]:(this.flags[g]=this.evaluateFlag(g),this.flags[g])},v.prototype.getNumber=function(g){return this.get(g)},v.prototype.getBool=function(g){return this.get(g)},v.prototype.getFlags=function(){return this.flags},Object.defineProperty(v.prototype,"features",{get:function(){return this.flags},enumerable:!0,configurable:!0}),v.prototype.set=function(g,O){if(this.flagRegistry[g]==null)throw new Error("Cannot set flag "+g+" as it has not been registered.");this.flags[g]=O,this.flagRegistry[g].setHook!=null&&this.flagRegistry[g].setHook(O)},v.prototype.evaluateFlag=function(g){if(this.flagRegistry[g]==null)throw new Error("Cannot evaluate flag '"+g+"': no evaluation function found.");return this.flagRegistry[g].evaluationFn()},v.prototype.setFlags=function(g){this.flags=Object.assign({},g)},v.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},v.prototype.populateURLFlags=function(){var g=this;if(this.global!==void 0&&this.global.location!==void 0&&this.global.location.search!==void 0){var O=h(this.global.location.search);"tfjsflags"in O&&O.tfjsflags.split(",").forEach(function(A){var S=A.split(":"),M=S[0],P=S[1];g.urlFlags[M]=function(L,V){if((V=V.toLowerCase())==="true"||V==="false")return V==="true";if(""+ +V===V)return+V;throw new Error("Could not parse value flag value "+V+" for flag "+L+".")}(M,P)})}},v}();function h(v){var g={};return v.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(O){for(var A=[],S=1;S<arguments.length;S++)A[S-1]=arguments[S];return function(M,P,L){M[decodeURIComponent(P)]=decodeURIComponent(L||"")}(g,A[0],A[1]),A.join("=")}),g}i.Environment=s,i.getQueryParams=h,i.env=function(){return i.ENV}
8038,i.ENV=null,i.setEnvironmentGlobal=function(v){i.ENV=v}},function(a,i,n){var s=n(14),h=n(55),v=n(19)("species");a.exports=function(g,O){var A,S=s(g).constructor;return S===void 0||(A=s(S)[v])==null?O:h(A)}},function(a,i,n){var s=n(62),h=n(19)("toStringTag"),v=s(function(){return arguments}())=="Arguments";a.exports=function(g){var O,A,S;return g===void 0?"Undefined":g===null?"Null":typeof(A=function(M,P){try{return M[P]}catch{}}(O=Object(g),h))=="string"?A:v?s(O):(S=s(O))=="Object"&&typeof O.callee=="function"?"Arguments":S}},function(a,i){i.f={}.propertyIsEnumerable},function(a,i,n){var s=n(62);a.exports=Object("z").propertyIsEnumerable(0)?Object:function(h){return s(h)=="String"?h.split(""):Object(h)}},function(a,i,n){var s=n(87);i.a=function(h){let v=h,g=h;function O(A,S,M,P){for(M==null&&(M=0),P==null&&(P=A.length);M<P;){const L=M+P>>>1;g(A[L],S)<0?M=L+1:P=L}return M}return h.length===1&&(v=(A,S)=>h(A)-S,g=function(A){return(S,M)=>Object(s.a)(A(S),M)}(h)),{left:O,center:function(A,S,M,P){M==null&&(M=0),P==null&&(P=A.length);const L=O(A,S,M,P-1);return L>M&&v(A[L-1],S)>-v(A[L],S)?L-1:L},right:function(A,S,M,P){for(M==null&&(M=0),P==null&&(P=A.length);M<P;){const L=M+P>>>1;g(A[L],S)>0?P=L:M=L+1}return M}}}},function(a,i,n){/** 8039* @license 8040* Copyright 2018 Google LLC. All Rights Reserved. 8041* Licensed under the Apache License, Version 2.0 (the "License"); 8042* you may not use this file except in compliance with the License. 8043* You may obtain a copy of the License at 8044* 8045* http://www.apache.org/licenses/LICENSE-2.0 8046* 8047* Unless required by applicable law or agreed to in writing, software 8048* distributed under the License is distributed on an "AS IS" BASIS, 8049* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8050* See the License for the specific language governing permissions and 8051* limitations under the License. 8052* ============================================================================= 8053*/Object.defineProperty(i,"__esModule",{value:!0});const s=n(50),h=n(247),v=n(102),g=n(46);i.table=function(A,S,M={}){if(S&&S.headers==null)throw new Error('Data to render must have a "headers" property');if(S&&S.values==null)throw new Error('Data to render must have a "values" property');const P=g.getDrawArea(A),L=Object.assign({},O,M);let V=h.select(P).select("table.tf-table");const N=v.css({fontSize:L.fontSize||".875rem",width:"100%",maxWidth:"64rem",marginRight:"auto",marginLeft:"auto"});if(V.size()===0&&((V=h.select(P).append("table")).attr("class",` ${N} tf-table`),V.append("thead").append("tr"),V.append("tbody")),V.size()!==1)throw new Error("Error inserting table");const ee=v.css({fontWeight:"600",borderBottomStyle:"solid",borderBottomWidth:"1px",borderColor:"rgba( 0, 0, 0, .2 )",textAlign:"left",paddingBottom:"1rem",paddingRight:"1rem",backgroundColor:"#fff"}),J=V.select("thead").select("tr").selectAll("th").data(S.headers),K=J.enter().append("th").attr("class",`${ee}`);J.merge(K).html($e=>$e),J.exit().remove();const re=s.format(",.4~f"),ce=V.select("tbody").selectAll("tr").data(S.values),pe=ce.enter().append("tr"),ke=v.css({padding:"0.25rem",borderBottomStyle:"solid",borderBottomWidth:"1px",borderColor:"rgba( 0, 0, 0, .2 )"}),Ce=ce.merge(pe).selectAll("td").data($e=>$e),be=Ce.enter().append("td").attr("class",`${ke}`);Ce.merge(be).html($e=>typeof $e=="number"?re($e):$e),Ce.exit().remove(),ce.exit().remove()};const O={fontSize:14}},function(a,i,n){/** 8054* @license 8055* Copyright 2018 Google LLC. All Rights Reserved. 8056* Licensed under the Apache License, Version 2.0 (the "License"); 8057* you may not use this file except in compliance with the License. 8058* You may obtain a copy of the License at 8059* 8060* http://www.apache.org/licenses/LICENSE-2.0 8061* 8062* Unless required by applicable law or agreed to in writing, software 8063* distributed under the License is distributed on an "AS IS" BASIS, 8064* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8065* See the License for the specific language governing permissions and 8066* limitations under the License. 8067* ============================================================================= 8068*/var s=this&&this.__awaiter||function(g,O,A,S){return new(A||(A=Promise))(function(M,P){function L(ee){try{N(S.next(ee))}catch(J){P(J)}}function V(ee){try{N(S.throw(ee))}catch(J){P(J)}}function N(ee){ee.done?M(ee.value):new A(function(J){J(ee.value)}).then(L,V)}N((S=S.apply(g,O||[])).next())})};Object.defineProperty(i,"__esModule",{value:!0});const h=n(0),v=n(111);i.arrayStats=function(g){if(!Array.isArray(g))throw new Error("input must be an array");if(g.length===0)return{numVals:0,numNans:0,numZeros:0,max:void 0,min:void 0};const O=g.length;let A=-1/0,S=1/0,M=0,P=0,L=0;for(let N=0;N<O;N++){const ee=g[N];ee>A&&(A=ee),ee<S&&(S=ee),ee===0&&(M+=1),isNaN(ee)?P+=1:isFinite(ee)||(L+=1)}const V={numVals:O,numZeros:M,numNans:P,max:A,min:S,numInfs:L};return V.max===-1/0&&(V.max=NaN),V.min===1/0&&(V.min=NaN),V},i.tensorStats=function(g){return s(this,void 0,void 0,function*(){const[O,A,S]=h.tidy(()=>{const M=h.scalar(0,g.dtype);return[g.min(),g.max(),g.equal(M).sum()]});return Promise.all([g.data(),O.data(),A.data(),S.data()]).then(([M,P,L,V])=>{const N=M.length;let ee=0,J=0;for(let ce=0;ce<N;ce++){const pe=M[ce];isNaN(pe)?ee+=1:isFinite(pe)||(J+=1)}let K=P[0],re=L[0];return ee===N&&(K=NaN,re=NaN),{numVals:N,numZeros:V[0],numNans:ee,min:K,max:re,numInfs:J}})})},i.confusionMatrix=function(g,O,A,S){return s(this,void 0,void 0,function*(){v.assert(g.rank===1,"labels must be a 1D tensor"),v.assert(O.rank===1,"predictions must be a 1D tensor"),v.assert(g.size===O.
8068size,"labels and predictions must be the same length"),S!=null&&v.assert(S.size===O.size,"labels and predictions must be the same length");const M=g.cast("int32"),P=O.cast("int32");A==null&&(A=h.tidy(()=>h.maximum(M.max(),P.max()).cast("int32").dataSync()[0]+1));let L=Promise.resolve(null);return S!=null&&(L=S.data()),Promise.all([M.data(),P.data(),L]).then(([V,N,ee])=>{const J=Array(A).fill(0);for(let K=0;K<A;K++)J[K]=Array(A).fill(0);for(let K=0;K<V.length;K++){const re=V[K],ce=N[K];J[re][ce]+=ee!=null?ee[K]:1}return J})})},i.accuracy=function(g,O){return s(this,void 0,void 0,function*(){v.assertShapesMatch(g.shape,O.shape,"Error computing accuracy.");const A=g.equal(O),S=A.mean(),M=(yield S.data())[0];return h.dispose([A,S]),M})},i.perClassAccuracy=function(g,O,A){return s(this,void 0,void 0,function*(){return v.assert(g.rank===1,"labels must be a 1D tensor"),v.assert(O.rank===1,"predictions must be a 1D tensor"),v.assert(g.size===O.size,"labels and predictions must be the same length"),A==null&&(A=h.tidy(()=>h.maximum(g.max(),O.max()).dataSync()[0]+1)),Promise.all([g.data(),O.data()]).then(([S,M])=>{const P=Array(A).fill(0),L=Array(A).fill(0);for(let N=0;N<S.length;N++){const ee=S[N],J=M[N];P[ee]+=1,ee===J&&(L[ee]+=1)}const V=[];for(let N=0;N<P.length;N++)V.push({count:P[N],accuracy:P[N]===0?0:L[N]/P[N]});return V})})}},function(a,i,n){/* 8069* @license 8070* Copyright 2018 Google LLC. All Rights Reserved. 8071* Licensed under the Apache License, Version 2.0 (the "License"); 8072* you may not use this file except in compliance with the License. 8073* You may obtain a copy of the License at 8074* 8075* http://www.apache.org/licenses/LICENSE-2.0 8076* 8077* Unless required by applicable law or agreed to in writing, software 8078* distributed under the License is distributed on an "AS IS" BASIS, 8079* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8080* See the License for the specific language governing permissions and 8081* limitations under the License. 8082* ============================================================================= 8083*/function s(v,g){if(!v)throw new Error(typeof g=="string"?g:g())}function h(v,g){if(v.length!==g.length)return!1;for(let O=0;O<v.length;O++)if(v[O]!==g[O])return!1;return!0}Object.defineProperty(i,"__esModule",{value:!0}),i.assert=s,i.assertShapesMatch=function(v,g,O=""){s(h(v,g),O+` Shapes ${v} and ${g} must match`)},i.arraysEqual=h,i.DECIMAL_PLACES_TO_CHECK=4},function(a,i,n){const s=n(47);a.exports=(h,v,g)=>{try{v=new s(v,g)}catch{return!1}return v.test(h)}},function(a,i,n){const s=Symbol("SemVer ANY");class h{static get ANY(){return s}constructor(V,N){if(N=v(N),V instanceof h){if(V.loose===!!N.loose)return V;V=V.value}S("comparator",V,N),this.options=N,this.loose=!!N.loose,this.parse(V),this.semver===s?this.value="":this.value=this.operator+this.semver.version,S("comp",this)}parse(V){const N=this.options.loose?g[O.COMPARATORLOOSE]:g[O.COMPARATOR],ee=V.match(N);if(!ee)throw new TypeError(`Invalid comparator: ${V}`);this.operator=ee[1]!==void 0?ee[1]:"",this.operator==="="&&(this.operator=""),ee[2]?this.semver=new M(ee[2],this.options.loose):this.semver=s}toString(){return this.value}test(V){if(S("Comparator.test",V,this.options.loose),this.semver===s||V===s)return!0;if(typeof V=="string")try{V=new M(V,this.options)}catch{return!1}return A(V,this.operator,this.semver,this.options)}intersects(V,N){if(!(V instanceof h))throw new TypeError("a Comparator is required");if(N&&typeof N=="object"||(N={loose:!!N,includePrerelease:!1}),this.operator==="")return this.value===""||new P(V.value,N).test(this.value);if(V.operator==="")return V.value===""||new P(this.value,N).test(V.semver);const ee=!(this.operator!==">="&&this.operator!==">"||V.operator!==">="&&V.operator!==">"),J=!(this.operator!=="<="&&this.operator!=="<"||V.operator!=="<="&&V.operator!=="<"),K=this.semver.version===V.semver.version,re=!(this.operator!==">="&&this.operator!=="<="||V.operator!==">="&&V.operator!=="<="),ce=A(this.semver,"<",V.semver,N)&&(this.operator===">="||this.operator===">")&&(V.operator==="<="||V.operator==="<"),pe=A(this.semver,">
8083",V.semver,N)&&(this.operator==="<="||this.operator==="<")&&(V.operator===">="||V.operator===">");return ee||J||K&&re||ce||pe}}a.exports=h;const v=n(115),{re:g,t:O}=n(90),A=n(203),S=n(116),M=n(32),P=n(47)},function(a,i,n){const s=n(48);a.exports=(h,v,g)=>s(h,v,g)>0},function(a,i){const n=["includePrerelease","loose","rtl"];a.exports=s=>s?typeof s!="object"?{loose:!0}:n.filter(h=>s[h]).reduce((h,v)=>(h[v]=!0,h),{}):{}},function(a,i,n){(function(s){const h=typeof s=="object"&&s.env&&s.env.NODE_DEBUG&&/\bsemver\b/i.test(s.env.NODE_DEBUG)?(...v)=>console.error("SEMVER",...v):()=>{};a.exports=h}).call(this,n(75))},function(a,i){const n=Number.MAX_SAFE_INTEGER||9007199254740991;a.exports={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:n,MAX_SAFE_COMPONENT_LENGTH:16}},function(a,i,n){for(var s,h=n(16),v=n(42),g=n(84),O=g("typed_array"),A=g("view"),S=!(!h.ArrayBuffer||!h.DataView),M=S,P=0,L="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");P<9;)(s=h[L[P++]])?(v(s.prototype,O,!0),v(s.prototype,A,!0)):M=!1;a.exports={ABV:S,CONSTR:M,TYPED:O,VIEW:A}},function(a,i,n){var s=n(16),h=n(8),v=n(38),g=n(93),O=n(65),A=n(121),S=n(94),M=n(13),P=n(15),L=n(125),V=n(98),N=n(168);a.exports=function(ee,J,K,re,ce,pe){var ke=s[ee],Ce=ke,be=ce?"set":"add",$e=Ce&&Ce.prototype,ht={},Dt=function(Ke){var Tt=$e[Ke];v($e,Ke,Ke=="delete"?function(vt){return!(pe&&!M(vt))&&Tt.call(this,vt===0?0:vt)}:Ke=="has"?function(vt){return!(pe&&!M(vt))&&Tt.call(this,vt===0?0:vt)}:Ke=="get"?function(vt){return pe&&!M(vt)?void 0:Tt.call(this,vt===0?0:vt)}:Ke=="add"?function(vt){return Tt.call(this,vt===0?0:vt),this}:function(vt,yt){return Tt.call(this,vt===0?0:vt,yt),this})};if(typeof Ce=="function"&&(pe||$e.forEach&&!P(function(){new Ce().entries().next()}))){var Ut=new Ce,Ee=Ut[be](pe?{}:-0,1)!=Ut,Ot=P(function(){Ut.has(1)}),zt=L(function(Ke){new Ce(Ke)}),Mt=!pe&&P(function(){for(var Ke=new Ce,Tt=5;Tt--;)Ke[be](Tt,Tt);return!Ke.has(-0)});zt||((Ce=J(function(Ke,Tt){S(Ke,Ce,ee);var vt=N(new ke,Ke,Ce);return Tt!=null&&A(Tt,ce,vt[be],vt),vt})).prototype=$e,$e.constructor=Ce),(Ot||Mt)&&(Dt("delete"),Dt("has"),ce&&Dt("get")),(Mt||Ee)&&Dt(be),pe&&$e.clear&&delete $e.clear}else Ce=re.getConstructor(J,ee,ce,be),g(Ce.prototype,K),O.NEED=!0;return V(Ce,ee),ht[ee]=Ce,h(h.G+h.W+h.F*(Ce!=ke),ht),pe||re.setStrong(Ce,ee,ce),Ce}},function(a,i,n){var s=n(16).navigator;a.exports=s&&s.userAgent||""},function(a,i,n){var s=n(56),h=n(225),v=n(159),g=n(14),O=n(22),A=n(157),S={},M={};(i=a.exports=function(P,L,V,N,ee){var J,K,re,ce,pe=ee?function(){return P}:A(P),ke=s(V,N,L?2:1),Ce=0;if(typeof pe!="function")throw TypeError(P+" is not iterable!");if(v(pe)){for(J=O(P.length);J>Ce;Ce++)if((ce=L?ke(g(K=P[Ce])[0],K[1]):ke(P[Ce]))===S||ce===M)return ce}else for(re=pe.call(P);!(K=re.next()).done;)if((ce=h(re,ke,K.value,L))===S||ce===M)return ce}).BREAK=S,i.RETURN=M},function(a,i,n){n(220);var s=n(38),h=n(42),v=n(15),g=n(61),O=n(19),A=n(154),S=O("species"),M=!v(function(){var L=/./;return L.exec=function(){var V=[];return V.groups={a:"7"},V},"".replace(L,"$<a>")!=="7"}),P=function(){var L=/(?:)/,V=L.exec;L.exec=function(){return V.apply(this,arguments)};var N="ab".split(L);return N.length===2&&N[0]==="a"&&N[1]==="b"}();a.exports=function(L,V,N){var ee=O(L),J=!v(function(){var Ce={};return Ce[ee]=function(){return 7},""[L](Ce)!=7}),K=J?!v(function(){var Ce=!1,be=/a/;return be.exec=function(){return Ce=!0,null},L==="split"&&(be.constructor={},be.constructor[S]=function(){return be}),be[ee](""),!Ce}):void 0;if(!J||!K||L==="replace"&&!M||L==="split"&&!P){var re=/./[ee],ce=N(g,ee,""[L],function(Ce,be,$e,ht,Dt){return be.exec===A?J&&!Dt?{done:!0,value:re.call(be,$e,ht)}:{done:!0,value:Ce.call($e,be,ht)}:{done:!1}}),pe=ce[0],ke=ce[1];s(String.prototype,L,pe),h(RegExp.prototype,ee,V==2?function(Ce,be){return ke.call(Ce,this,be)}:function(Ce){return ke.call(Ce,this)})}}},function(a,i,n){var s=n(105),h=RegExp.prototype.exec;a.exports=function(v,g){var O=v.exec;if(typeof O=="function"){var A=O.call(v,g);if(typeof A!="object")throw new TypeError("RegExp exec method returned something other than an Object or null");return A}if(s(v)!=="RegExp")throw new TypeError("RegExp#exec called on incompatible receiver");return h.call(v,g)}},function(a,i,n){var s=n(14);a.exports=function(){var h=s(this),v="";return h.global&&(v+="g"),h.ignoreCase&&(v+="i"),h.multiline&&(v+="m"),h.unicode&&(v+="u"),h.sticky&&(v+="y"),v}},function(a,i,n){var s=n(19)("iterator"),h=!1;try{var v=[7][s]();v.return=function(){h=!0},Array.from(v,function(){throw 2})}catch{}a.exports=function(g,O){if(!O&&!h)return!1;var A=!1;try{var S=[7],M=S[s]();M.next=function(){return{done:A=!0}},S[s]=function(){return M},g(S)}catch{}return A}},function(a,i,n){var s=n(62);a.exports=Array.isArray||function(h){return s(h)=="Array"}},function(a,i){i.f=Object.getOwnPropertySymbols},function(a,i,n){var s=n(41),h=n(22),v=n(81);a.exports=function(g){return function(O,A,S){var M,P=s(O),L=h(P.length),V=v(S,L);if(g&&A!=A){for(;L>V;)if((M=P[V++])!=M)return!0}else for(;L>V;V++)if((g||V in P)&&P[V]===A)return g||V||0;return!g&&-1}}},function(a,i,n){var s=n(24),h=n(16),v=h["__core-js_shared__"]||(h["__core-js_shared__"]={});(a.exports=function(g,O){return v[g]||(v[g]=O!==void 0?O:{})})("versions",[]).push({version:s.version,mode:n(83)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(a,i,n){n.r(i),function(s,h){n.d(i,"array",function(){return on}),n.d(i,"Dataset",function(){return It}),n.d(i,"zip",function(){return Xt}),n.d(i,"CSVDataset",function(){return hn}),n.d(i,"TextLineDataset",function(){return xe}),n.d(i,"csv",function(){return yi}),n.d(i,"func",function(){return na}),n.d(i,"generator",function(){return co}),n.d(i,"microphone",function(){return Ft}),n.d(i,"webcam",function(){return $i}),n.d(i,"FileDataSource",function(){return ti}),n.d(i,"URLDataSource",function(){return ri}),n.d(i,"version_data",function(){return Qr});var v=n(0),g=function(Zt,_e){return(g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ge,Ae){ge.__proto__=Ae}||function(ge,Ae){for(var Ie in Ae)Ae.hasOwnProperty(Ie)&&(ge[Ie]=Ae[Ie])})(Zt,_e)};/** 8084 * @license 8085 * Copyright 2020 Google LLC. All Rights Reserved. 8086 * Licensed under the Apache License, Version 2.0 (the "License");
8087 * you may not use this file except in compliance with the License. 8088 * You may obtain a copy of the License at 8089 * 8090 * http://www.apache.org/licenses/LICENSE-2.0 8091 * 8092 * Unless required by applicable law or agreed to in writing, software 8093 * distributed under the License is distributed on an "AS IS" BASIS, 8094 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8095 * See the License for the specific language governing permissions and 8096 * limitations under the License. 8097 * ============================================================================= 8098 */function O(Zt,_e){function ge(){this.constructor=Zt}g(Zt,_e),Zt.prototype=_e===null?Object.create(_e):(ge.prototype=_e.prototype,new ge)}function A(Zt,_e,ge,Ae){return new(ge||(ge=Promise))(function(Ie,it){function St(rr){try{kn(Ae.next(rr))}catch(Bn){it(Bn)}}function Jt(rr){try{kn(Ae.throw(rr))}catch(Bn){it(Bn)}}function kn(rr){rr.done?Ie(rr.value):new ge(function(Bn){Bn(rr.value)}).then(St,Jt)}kn((Ae=Ae.apply(Zt,_e||[])).next())})}function S(Zt,_e){var ge,Ae,Ie,it,St={label:0,sent:function(){if(1&Ie[0])throw Ie[1];return Ie[1]},trys:[],ops:[]};return it={next:Jt(0),throw:Jt(1),return:Jt(2)},typeof Symbol=="function"&&(it[Symbol.iterator]=function(){return this}),it;function Jt(kn){return function(rr){return function(Bn){if(ge)throw new TypeError("Generator is already executing.");for(;St;)try{if(ge=1,Ae&&(Ie=2&Bn[0]?Ae.return:Bn[0]?Ae.throw||((Ie=Ae.return)&&Ie.call(Ae),0):Ae.next)&&!(Ie=Ie.call(Ae,Bn[1])).done)return Ie;switch(Ae=0,Ie&&(Bn=[2&Bn[0],Ie.value]),Bn[0]){case 0:case 1:Ie=Bn;break;case 4:return St.label++,{value:Bn[1],done:!1};case 5:St.label++,Ae=Bn[1],Bn=[0];continue;case 7:Bn=St.ops.pop(),St.trys.pop();continue;default:if(!(Ie=(Ie=St.trys).length>0&&Ie[Ie.length-1])&&(Bn[0]===6||Bn[0]===2)){St=0;continue}if(Bn[0]===3&&(!Ie||Bn[1]>Ie[0]&&Bn[1]<Ie[3])){St.label=Bn[1];break}if(Bn[0]===6&&St.label<Ie[1]){St.label=Ie[1],Ie=Bn;break}if(Ie&&St.label<Ie[2]){St.label=Ie[2],St.ops.push(Bn);break}Ie[2]&&St.ops.pop(),St.trys.pop();continue}Bn=_e.call(Zt,St)}catch(Gn){Bn=[6,Gn],Ae=0}finally{ge=Ie=0}if(5&Bn[0])throw Bn[1];return{value:Bn[0]?Bn[1]:void 0,done:!0}}([kn,rr])}}}function M(Zt,_e){return Zt(_e={exports:{}},_e.exports),_e.exports}var P=M(function(Zt){(function(_e,ge,Ae){function Ie(St,Jt){return Jt.c=St.c,Jt.s0=St.s0,Jt.s1=St.s1,Jt.s2=St.s2,Jt}function it(St,Jt){var kn=new function(Gn){var Zn,Gt=this,Wt=(Zn=4022871197,function(Sn){Sn=Sn.toString();for(var un=0;un<Sn.length;un++){var qe=.02519603282416938*(Zn+=Sn.charCodeAt(un));qe-=Zn=qe>>>0,Zn=(qe*=Zn)>>>0,Zn+=4294967296*(qe-=Zn)}return 23283064365386963e-26*(Zn>>>0)});Gt.next=function(){var Sn=2091639*Gt.s0+23283064365386963e-26*Gt.c;return Gt.s0=Gt.s1,Gt.s1=Gt.s2,Gt.s2=Sn-(Gt.c=0|Sn)},Gt.c=1,Gt.s0=Wt(" "),Gt.s1=Wt(" "),Gt.s2=Wt(" "),Gt.s0-=Wt(Gn),Gt.s0<0&&(Gt.s0+=1),Gt.s1-=Wt(Gn),Gt.s1<0&&(Gt.s1+=1),Gt.s2-=Wt(Gn),Gt.s2<0&&(Gt.s2+=1),Wt=null}(St),rr=Jt&&Jt.state,Bn=kn.next;return Bn.int32=function(){return 4294967296*kn.next()|0},Bn.double=function(){return Bn()+11102230246251565e-32*(2097152*Bn()|0)},Bn.quick=Bn,rr&&(typeof rr=="object"&&Ie(rr,kn),Bn.state=function(){return Ie(kn,{})}),Bn}ge&&ge.exports?ge.exports=it:this.alea=it})(0,Zt)}),L=M(function(Zt){(function(_e,ge,Ae){function Ie(St,Jt){return Jt.x=St.x,Jt.y=St.y,Jt.z=St.z,Jt.w=St.w,Jt}function it(St,Jt){var kn=new function(Gn){var Zn=this,Gt="";Zn.x=0,Zn.y=0,Zn.z=0,Zn.w=0,Zn.next=function(){var Sn=Zn.x^Zn.x<<11;return Zn.x=Zn.y,Zn.y=Zn.z,Zn.z=Zn.w,Zn.w^=Zn.w>>>19^Sn^Sn>>>8},Gn===(0|Gn)?Zn.x=Gn:Gt+=Gn;for(var Wt=0;Wt<Gt.length+64;Wt++)Zn.x^=0|Gt.charCodeAt(Wt),Zn.next()}(St),rr=Jt&&Jt.state,Bn=function(){return(kn.next()>>>0)/4294967296};return Bn.double=function(){do var Gn=((kn.next()>>>11)+(kn.next()>>>0)/4294967296)/2097152;while(Gn===0);return Gn},Bn.int32=kn.next,Bn.quick=Bn,rr&&(typeof rr=="object"&&Ie(rr,kn),Bn.state=function(){return Ie(kn,{})}),Bn}ge&&ge.exports?ge.exports=it:this.xor128=it})(0,Zt)}),V=M(function(Zt){(function(_e,ge,Ae){function Ie(St,Jt){return Jt.x=St.x,Jt.y=St.y,Jt.z=St.z,Jt.w=St.w,Jt.v=St.v,Jt.d=St.d,Jt}function it(St,Jt){var kn=new function(Gn){var Zn=this,Gt="";Zn.next=function(){var Sn=Zn.x^Zn.x>>>2;return Zn.x=Zn.y,Zn.y=Zn.z,Zn.z=Zn.w,Zn.w=Zn.v,(Zn.d=Zn.d+362437|0)+(Zn.v=Zn.v^Zn.v<<4^Sn^Sn<<1)|0},Zn.x=0,Zn.y=0,Zn.z=0,Zn.w=0,Zn.v=0,Gn===(0|Gn)?Zn.x=Gn:Gt+=Gn;for(var Wt=0;Wt<Gt.length+64;Wt++)Zn.x^=0|Gt.charCodeAt(Wt),Wt==Gt.length&&(Zn.d=Zn.x<<10^Zn.x>>>4),Zn.next()}(St),rr=Jt&&Jt.state,Bn=function(){return(kn.next()>>>0)/4294967296};return Bn.double=function(){do var Gn=((kn.next()>>>11)+(kn.next()>>>0)/4294967296)/2097152;while(Gn===0);return Gn},Bn.int32=kn.next,Bn.quick=Bn,rr&&(typeof rr=="object"&&Ie(rr,kn),Bn.state=function(){return Ie(kn,{})}),Bn}ge&&ge.exports?ge.exports=it:this.xorwow=it})(0,Zt)}),N=M(function(Zt){(function(_e,ge,Ae){function Ie(St,Jt){return Jt.x=St.x.slice(),Jt.i=St.i,Jt}function it(St,Jt){St==null&&(St=+new Date);var kn=new function(Gn){var Zn=this;Zn.next=function(){var Gt,Wt,Sn=Zn.x,un=Zn.i;return Gt=Sn[un],Wt=(Gt^=Gt>>>7)^Gt<<24,Wt^=(Gt=Sn[un+1&7])^Gt>>>10,Wt^=(Gt=Sn[un+3&7])^Gt>>>3,Wt^=(Gt=Sn[un+4&7])^Gt<<7,Gt=Sn[un+7&7],Wt^=(Gt^=Gt<<13)^Gt<<9,Sn[un]=Wt,Zn.i=un+1&7,Wt},function(Gt,Wt){var Sn,un=[];if(Wt===(0|Wt))un[0]=Wt;else for(Wt=""+Wt,Sn=0;Sn<Wt.length;++Sn)un[7&Sn]=un[7&Sn]<<15^Wt.charCodeAt(Sn)+un[Sn+1&7]<<13;for(;un.length<8;)un.push(0);for(Sn=0;Sn<8&&un[Sn]===0;++Sn);for(Sn==8?un[7]=-1:un[Sn],Gt.x=un,Gt.i=0,Sn=256;Sn>0;--Sn)Gt.next()}(Zn,Gn)}(St),rr=Jt&&Jt.state,Bn=function(){return(kn.next()>>>0)/4294967296};return Bn.double=function(){do var Gn=((kn.next()>>>11)+(kn.next()>>>0)/4294967296)/2097152;while(Gn===0);return Gn},Bn.int32=kn.next,Bn.quick=Bn,rr&&(rr.x&&Ie(rr,kn),Bn.state=function(){return Ie(kn,{})}),Bn}ge&&ge.exports?ge.exports=it:this.xorshift7=it})(0,Zt)}),ee=M(function(Zt){(function(_e,ge,Ae){function Ie(St,Jt){return Jt.i=St.i,Jt.w=St.w,Jt.X=St.X.slice(),Jt}function it(St,Jt){St==null&&(St=+new Date);var kn=new function(Gn){var Zn=this;Zn.next=function(){var Gt,Wt,Sn=Zn.w,un=Zn.X,qe=Zn.i;
vendor: 23,864 bytes, lines 8098-8099
8098return Zn.w=Sn=Sn+1640531527|0,Wt=un[qe+34&127],Gt=un[qe=qe+1&127],Wt^=Wt<<13,Gt^=Gt<<17,Wt^=Wt>>>15,Gt^=Gt>>>12,Wt=un[qe]=Wt^Gt,Zn.i=qe,Wt+(Sn^Sn>>>16)|0},function(Gt,Wt){var Sn,un,qe,$n,er,sr=[],pr=128;for(Wt===(0|Wt)?(un=Wt,Wt=null):(Wt+="\0",un=0,pr=Math.max(pr,Wt.length)),qe=0,$n=-32;$n<pr;++$n)Wt&&(un^=Wt.charCodeAt(($n+32)%Wt.length)),$n===0&&(er=un),un^=un<<10,un^=un>>>15,un^=un<<4,un^=un>>>13,$n>=0&&(er=er+1640531527|0,qe=(Sn=sr[127&$n]^=un+er)==0?qe+1:0);for(qe>=128&&(sr[127&(Wt&&Wt.length||0)]=-1),qe=127,$n=512;$n>0;--$n)un=sr[qe+34&127],Sn=sr[qe=qe+1&127],un^=un<<13,Sn^=Sn<<17,un^=un>>>15,Sn^=Sn>>>12,sr[qe]=un^Sn;Gt.w=er,Gt.X=sr,Gt.i=qe}(Zn,Gn)}(St),rr=Jt&&Jt.state,Bn=function(){return(kn.next()>>>0)/4294967296};return Bn.double=function(){do var Gn=((kn.next()>>>11)+(kn.next()>>>0)/4294967296)/2097152;while(Gn===0);return Gn},Bn.int32=kn.next,Bn.quick=Bn,rr&&(rr.X&&Ie(rr,kn),Bn.state=function(){return Ie(kn,{})}),Bn}ge&&ge.exports?ge.exports=it:this.xor4096=it})(0,Zt)}),J=M(function(Zt){(function(_e,ge,Ae){function Ie(St,Jt){return Jt.a=St.a,Jt.b=St.b,Jt.c=St.c,Jt.d=St.d,Jt}function it(St,Jt){var kn=new function(Gn){var Zn=this,Gt="";Zn.next=function(){var Sn=Zn.b,un=Zn.c,qe=Zn.d,$n=Zn.a;return Sn=Sn<<25^Sn>>>7^un,un=un-qe|0,qe=qe<<24^qe>>>8^$n,$n=$n-Sn|0,Zn.b=Sn=Sn<<20^Sn>>>12^un,Zn.c=un=un-qe|0,Zn.d=qe<<16^un>>>16^$n,Zn.a=$n-Sn|0},Zn.a=0,Zn.b=0,Zn.c=-1640531527,Zn.d=1367130551,Gn===Math.floor(Gn)?(Zn.a=Gn/4294967296|0,Zn.b=0|Gn):Gt+=Gn;for(var Wt=0;Wt<Gt.length+20;Wt++)Zn.b^=0|Gt.charCodeAt(Wt),Zn.next()}(St),rr=Jt&&Jt.state,Bn=function(){return(kn.next()>>>0)/4294967296};return Bn.double=function(){do var Gn=((kn.next()>>>11)+(kn.next()>>>0)/4294967296)/2097152;while(Gn===0);return Gn},Bn.int32=kn.next,Bn.quick=Bn,rr&&(typeof rr=="object"&&Ie(rr,kn),Bn.state=function(){return Ie(kn,{})}),Bn}ge&&ge.exports?ge.exports=it:this.tychei=it})(0,Zt)}),K=M(function(Zt){(function(_e,ge){var Ae,Ie=this,it=256,St=6,Jt="random",kn=ge.pow(it,St),rr=ge.pow(2,52),Bn=2*rr,Gn=it-1;function Zn(un,qe,$n){var er=[],sr=Wt(function Mr(Ii,Lo){var Ai,ko=[],Ji=typeof Ii;if(Lo&&Ji=="object")for(Ai in Ii)try{ko.push(Mr(Ii[Ai],Lo-1))}catch{}return ko.length?ko:Ji=="string"?Ii:Ii+"\0"}((qe=qe==1?{entropy:!0}:qe||{}).entropy?[un,Sn(_e)]:un??function(){try{var Mr;return Ae&&(Mr=Ae.randomBytes)?Mr=Mr(it):(Mr=new Uint8Array(it),(Ie.crypto||Ie.msCrypto).getRandomValues(Mr)),Sn(Mr)}catch{var Ii=Ie.navigator,Lo=Ii&&Ii.plugins;return[+new Date,Ie,Lo,Ie.screen,Sn(_e)]}}(),3),er),pr=new function(Mr){var Ii,Lo=Mr.length,Ai=this,ko=0,Ji=Ai.i=Ai.j=0,ai=Ai.S=[];for(Lo||(Mr=[Lo++]);ko<it;)ai[ko]=ko++;for(ko=0;ko<it;ko++)ai[ko]=ai[Ji=Gn&Ji+Mr[ko%Lo]+(Ii=ai[ko])],ai[Ji]=Ii;(Ai.g=function(Yr){for(var Hn,ki=0,lo=Ai.i,Kr=Ai.j,Io=Ai.S;Yr--;)Hn=Io[lo=Gn&lo+1],ki=ki*it+Io[Gn&(Io[lo]=Io[Kr=Gn&Kr+Hn])+(Io[Kr]=Hn)];return Ai.i=lo,Ai.j=Kr,ki})(it)}(er),Zr=function(){for(var Mr=pr.g(St),Ii=kn,Lo=0;Mr<rr;)Mr=(Mr+Lo)*it,Ii*=it,Lo=pr.g(1);for(;Mr>=Bn;)Mr/=2,Ii/=2,Lo>>>=1;return(Mr+Lo)/Ii};return Zr.int32=function(){return 0|pr.g(4)},Zr.quick=function(){return pr.g(4)/4294967296},Zr.double=Zr,Wt(Sn(pr.S),_e),(qe.pass||$n||function(Mr,Ii,Lo,Ai){return Ai&&(Ai.S&&Gt(Ai,pr),Mr.state=function(){return Gt(pr,{})}),Lo?(ge[Jt]=Mr,Ii):Mr})(Zr,sr,"global"in qe?qe.global:this==ge,qe.state)}function Gt(un,qe){return qe.i=un.i,qe.j=un.j,qe.S=un.S.slice(),qe}function Wt(un,qe){for(var $n,er=un+"",sr=0;sr<er.length;)qe[Gn&sr]=Gn&($n^=19*qe[Gn&sr])+er.charCodeAt(sr++);return Sn(qe)}function Sn(un){return String.fromCharCode.apply(0,un)}if(ge["seed"+Jt]=Zn,Wt(ge.random(),_e),Zt.exports){Zt.exports=Zn;try{Ae=n(387)}catch{}}})([],Math)});K.alea=P,K.xor128=L,K.xorwow=V,K.xorshift7=N,K.xor4096=ee,K.tychei=J;var re=K.alea;function ce(Zt,_e,ge,Ae){if(ge===void 0&&(ge=new Map),Ae===void 0&&(Ae=new Set),Zt==null)return null;if(Ae.has(Zt))throw new Error("Circular references are not supported.");if(ge.has(Zt))return ge.get(Zt);var Ie=_e(Zt);if(Ie.recurse&&Ie.value!==null)throw new Error("A deep map function may not return both a value and recurse=true.");if(Ie.recurse){if(be(Zt)){var it=Array.isArray(Zt)?[]:{};for(var St in Ae.add(Zt),Zt){var Jt=ce(Zt[St],_e,ge,Ae);it[St]=Jt}return Ae.delete(Zt),it}throw new Error("Can't recurse into non-iterable type: "+Zt)}return ge.set(Zt,Ie.value),Ie.value}function pe(Zt,_e){return _e===void 0&&(_e=ke),function ge(Ae,Ie,it){it===void 0&&(it=new Set);var St=Ae[0];if(it.has(St))throw new Error("Circular references are not supported.");var Jt=Ie(Ae);if(Jt.recurse&&Jt.value!==null)throw new Error("A deep zip function may not return both a value and recurse=true.");if(Jt.recurse){if(be(St)){var kn=Array.isArray(St)?[]:{};it.add(St);var rr=function(Gn){var Zn=ge(Ae.map(function(Gt){return Gt[Gn]}),Ie,it);kn[Gn]=Zn};for(var Bn in St)rr(Bn);return it.delete(St),kn}throw new Error("Can't recurse into non-iterable type: "+St)}return Jt.value}(Zt,_e)}function ke(Zt){return Zt===null?null:be(Zt[0])?{value:null,recurse:!0}:{value:Zt,recurse:!1}}function Ce(Zt,_e){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it,St,Jt;return S(this,function(kn){switch(kn.label){case 0:ge=new Map,ce(Zt,_e,ge),Ae=0,Ie=Array.from(ge.keys()),kn.label=1;case 1:return Ae<Ie.length?(it=Ie[Ae],(St=ge.get(it))instanceof Promise?[4,St]:[3,3]):[3,4];case 2:Jt=kn.sent(),ge.set(it,Jt),kn.label=3;case 3:return Ae++,[3,1];case 4:return[2,ce(Zt,_e,ge)]}})})}function be(Zt){return Zt!=null&&!ArrayBuffer.isView(Zt)&&(Array.isArray(Zt)||typeof Zt=="object"&&!(Zt instanceof v.Tensor))}function $e(Zt){return function(_e,ge){return ce(_e,ge)}(Zt,ht)}function ht(Zt){return Zt instanceof v.Tensor?{value:Zt.clone(),recurse:!1}:be(Zt)?{value:null,recurse:!0}:{value:Zt,recurse:!1}}var Dt=function(){function Zt(_e){if(this.capacity=_e,this.begin=0,this.end=0,_e==null)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(_e<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(_e),this.doubledCapacity=2*_e}return Zt.prototype.wrap=function(_e){for(;_e<0;)_e+=this.doubledCapacity;return _e%this.doubledCapacity},Zt.prototype.get=function(_e){if(_e<0)throw new RangeError("Can't get item at a negative index.");return this.data[_e%this.capacity]},Zt.prototype.set=function(_e,ge){if(_e<0)throw new RangeError("Can't set item at a negative index.");this.data[_e%this.capacity]=ge},Zt.prototype.length=function(){var _e=this.end-this.begin;return _e<0&&(_e=this.doubledCapacity+_e),_e},Zt.prototype.isFull=function(){return this.length()===this.capacity},Zt.prototype.isEmpty=function(){return this.length()===0},Zt.prototype.push=function(_e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,_e),this.end=this.wrap(this.end+1)},Zt.prototype.pushAll=function(_e){for(var ge=0,Ae=_e;ge<Ae.length;ge++){var Ie=Ae[ge];this.push(Ie)}},Zt.prototype.pop=function(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);var _e=this.get(this.end);return this.set(this.end,void 0),_e},Zt.prototype.unshift=function(_e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,_e)},Zt.prototype.shift=function(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");var _e=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),_e},Zt.prototype.shuffleExcise=function(_e){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");var ge=this.wrap(this.begin+_e),Ae=this.get(ge);return this.set(ge,this.pop()),Ae},Zt}(),Ut=function(Zt){function _e(){return Zt.call(this,_e.INITIAL_CAPACITY)||this}return O(_e,Zt),_e.prototype.isFull=function(){return!1},_e.prototype.push=function(ge){Zt.prototype.isFull.call(this)&&this.expand(),Zt.prototype.push.call(this,ge)},_e.prototype.unshift=function(ge){Zt.prototype.isFull.call(this)&&this.expand(),Zt.prototype.unshift.call(this,ge)},_e.prototype.expand=function(){for(var ge=2*this.capacity,Ae=new Array(ge),Ie=this.length(),it=0;it<Ie;it++)Ae[it]=this.get(this.wrap(this.begin+it));this.data=Ae,this.capacity=ge,this.doubledCapacity=2*this.capacity,this.begin=0,this.end=Ie},_e.INITIAL_CAPACITY=32,_e}(Dt);function Ee(Zt){return new Ke(Zt)}function Ot(Zt){return new Tt(Zt)}var zt,Mt=function(){function Zt(){}return Zt.prototype.toArray=function(){return A(this,void 0,void 0,function(){var _e,ge;return S(this,function(Ae){switch(Ae.label){case 0:return _e=[],[4,this.next()];case 1:ge=Ae.sent(),Ae.label=2;case 2:return ge.done?[3,4]:(_e.push(ge.value),[4,this.next()]);case 3:return ge=Ae.sent(),[3,2];case 4:return[2,_e]}})})},Zt.prototype.toArrayForTest=function(){return A(this,void 0,void 0,function(){var _e,ge,Ae;return S(this,function(Ie){switch(Ie.label){case 0:return _e=this.prefetch(100),ge=[],[4,_e.next()];case 1:Ae=Ie.sent(),Ie.label=2;case 2:return Ae.done?[3,4]:(ge.push(Ae.value),[4,_e.next()]);case 3:return Ae=Ie.sent(),[3,2];case 4:return[2,ge]}})})},Zt.prototype.resolveFully=function(){return A(this,void 0,void 0,function(){var _e;return S(this,function(ge){switch(ge.label){case 0:return[4,this.next()];case 1:_e=ge.sent(),ge.label=2;case 2:return _e.done?[3,4]:[4,this.next()];case 3:return _e=ge.sent(),[3,2];case 4:return[2]}})})},Zt.prototype.resolveWhile=function(_e){return A(this,void 0,void 0,function(){var ge,Ae;return S(this,function(Ie){switch(Ie.label){case 0:return[4,this.next()];case 1:ge=Ie.sent(),Ae=_e(ge.value),Ie.label=2;case 2:return ge.done||!Ae?[3,4]:[4,this.next()];case 3:return ge=Ie.sent(),Ae=_e(ge.value),[3,2];case 4:return[2]}})})},Zt.prototype.handleErrors=function(_e){return new Vt(this,_e)},Zt.prototype.filter=function(_e){return new _t(this,_e)},Zt.prototype.map=function(_e){return new Ze(this,_e)},Zt.prototype.mapAsync=function(_e){return new sn(this,_e)},Zt.prototype.serialMapAsync=function(_e){return new sn(this,_e).serial()},Zt.prototype.flatmap=function(_e){return new Yt(this,_e)},Zt.prototype.forEachAsync=function(_e){return A(this,void 0,void 0,function(){return S(this,function(ge){return[2,this.map(_e).resolveFully()]})})},Zt.prototype.serialForEach=function(_e){return A(this,void 0,void 0,function(){return S(this,function(ge){return[2,this.serialMapAsync(_e).resolveWhile(function(Ae){return Ae===!0})]})})},Zt.prototype.rowMajorBatch=function(_e,ge){return ge===void 0&&(ge=!0),new Ht(this,_e,ge)},Zt.prototype.columnMajorBatch=function(_e,ge,Ae){return ge===void 0&&(ge=!0),Ae===void 0&&(Ae=ke),this.rowMajorBatch(_e,ge).map(function(Ie){return pe(Ie,Ae)})},Zt.prototype.concatenate=function(_e,ge){return new We(Ee([this,_e]),ge)},Zt.prototype.take=function(_e){return _e<0||_e==null?this:new bt(this,_e)},Zt.prototype.skip=function(_e){return _e<0||_e==null?this:new yt(this,_e)},Zt.prototype.prefetch=function(_e){return new He(this,_e)},Zt.prototype.shuffle=function(_e,ge){return new dt(this,_e,ge)},Zt.prototype.serial=function(){return new vt(this)},Zt}(),Ke=function(Zt){function _e(ge){var Ae=Zt.call(this)||this;return Ae.items=ge,Ae.trav=0,Ae}return O(_e,Zt),_e.prototype.summary=function(){return"Array of "+this.items.length+" items"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge;return S(this,function(Ae){return this.trav>=this.items.length?[2,{value:null,done:!0}]:(ge=this.items[this.trav],this.trav++,[2,{value:$e(ge),done:!1}])})})},_e}(Mt),Tt=function(Zt){function _e(ge){var Ae=Zt.call(this)||this;return Ae.nextFn=ge,Ae}return O(_e,Zt),_e.prototype.summary=function(){return"Function call"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){try{return[2,this.nextFn()]}catch(Ae){throw Ae.message="Error thrown while iterating through a dataset: "+Ae.message,Ae}return[2]})})},_e}(Mt),vt=function(Zt){function _e(ge){var Ae=Zt.call(this)||this;return Ae.upstream=ge,Ae.lastRead=Promise.resolve({value:null,done:!1}),Ae}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> Serial"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge=this;return S(this,function(Ae){return this.lastRead=this.lastRead.then(function(){return ge.serialNext()}),[2,this.lastRead]})})},_e.prototype.serialNext=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){return[2,this.upstream.next()]})})},_e}(Mt),yt=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.maxCount=Ae,Ie.count=0,Ie.lastRead=Promise.resolve({value:null,done:!1}),Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> Skip"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge=this;return S(this,function(Ae){return this.lastRead=this.lastRead.then(function(){return ge.serialNext()}),[2,this.lastRead]})})},_e.prototype.serialNext=function(){return A(this,void 0,void 0,function(){var ge;return S(this,function(Ae){switch(Ae.label){case 0:return this.count++<this.maxCount?[4,this.upstream.next()]:[3,2];case 1:return(ge=Ae.sent()).done?[2,ge]:(Object(v.dispose)(ge.value),[3,0]);case 2:return[2,this.upstream.next()]}})})},_e}(Mt),bt=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.maxCount=Ae,Ie.count=0,Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> Take"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){return this.count++>=this.maxCount?[2,{value:null,done:!0}]:[2,this.upstream.next()]})})},_e}(Mt),Ht=function(Zt){function _e(ge,Ae,Ie){Ie===void 0&&(Ie=!0);var it=Zt.call(this)||this;return it.upstream=ge,it.batchSize=Ae,it.enableSmallLastBatch=Ie,it.lastRead=Promise.resolve({value:null,done:!1}),it}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> RowMajorBatch"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge=this;return S(this,function(Ae){return this.lastRead=this.lastRead.then(function(){return ge.serialNext()}),[2,this.lastRead]})})},_e.prototype.serialNext=function(){return A(this,void 0,void 0,function(){var ge,Ae;return S(this,function(Ie){switch(Ie.label){case 0:ge=[],Ie.label=1;case 1:return ge.length<this.batchSize?[4,this.upstream.next()]:[3,3];case 2:return(Ae=Ie.sent()).done?this.enableSmallLastBatch&&ge.length>0?[2,{value:ge,done:!1}]:[2,{value:null,done:!0}]:(ge.push(Ae.value),[3,1]);case 3:return[2,{value:ge,done:!1}]}})})},_e}(Mt),_t=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.predicate=Ae,Ie.lastRead=Promise.resolve({value:null,done:!1}),Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> Filter"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge=this;return S(this,function(Ae){return this.lastRead=this.lastRead.then(function(){return ge.serialNext()}),[2,this.lastRead]})})},_e.prototype.serialNext=function(){return A(this,void 0,void 0,function(){var ge;return S(this,function(Ae){switch(Ae.label){case 0:return[4,this.upstream.next()];case 1:return(ge=Ae.sent()).done||this.predicate(ge.value)?[2,ge]:(Object(v.dispose)(ge.value),[3,0]);case 2:return[2]}})})},_e}(Mt),Ze=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.transform=Ae,Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> Map"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it,St,Jt,kn;return S(this,function(rr){switch(rr.label){case 0:return[4,this.upstream.next()];case 1:if((ge=rr.sent()).done)return[2,{value:null,done:!0}];for(Ae=v.tensor_util.getTensorsInContainer(ge.value),Ie=this.transform(ge.value),it=v.tensor_util.getTensorsInContainer(Ie),St=0,Jt=Ae;St<Jt.length;St++)kn=Jt[St],v.tensor_util.isTensorInList(kn,it)||kn.dispose();return[2,{value:Ie,done:!1}]}})})},_e}(Mt),Vt=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.handler=Ae,Ie.count=0,Ie.lastRead=Promise.resolve({value:null,done:!1}),Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> handleErrors"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge=this;return S(this,function(Ae){return this.lastRead=this.lastRead.then(function(){return ge.serialNext()}),[2,this.lastRead]})})},_e.prototype.serialNext=function(){return A(this,void 0,void 0,function(){var ge;return S(this,function(Ae){switch(Ae.label){case 0:Ae.label=1;case 1:return Ae.trys.push([1,3,,4]),[4,this.upstream.next()];case 2:return[2,Ae.sent()];case 3:return ge=Ae.sent(),this.handler(ge)?[3,4]:[2,{value:null,done:!0}];case 4:return[3,0];case 5:return[2]}})})},_e}(Mt),sn=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.transform=Ae,Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> AsyncMap"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it,St,Jt,kn;return S(this,function(rr){switch(rr.label){case 0:return[4,this.upstream.next()];case 1:return(ge=rr.sent()).done?[2,{value:null,done:!0}]:(Ae=v.tensor_util.getTensorsInContainer(ge.value),[4,this.transform(ge.value)]);case 2:for(Ie=rr.sent(),it=v.tensor_util.getTensorsInContainer(Ie),St=0,Jt=Ae;St<Jt.length;St++)kn=Jt[St],v.tensor_util.isTensorInList(kn,it)||kn.dispose();return[2,{value:Ie,done:!1}]}})})},_e}(Mt),yn=function(Zt){function _e(){var ge=Zt.call(this)||this;return ge.outputQueue=new Ut,ge.lastRead=Promise.resolve({value:null,done:!1}),ge}return O(_e,Zt),_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge=this;return S(this,function(Ae){return this.lastRead=this.lastRead.then(function(){return ge.serialNext()}),[2,this.lastRead]})})},_e.prototype.serialNext=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){switch(ge.label){case 0:return this.outputQueue.length()!==0?[3,2]:[4,this.pump()];case 1:return ge.sent()?[3,0]:[2,{value:null,done:!0}];case 2:return[2,{value:this.outputQueue.shift(),done:!1}]}})})},_e}(Mt),Yt=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.transform=Ae,Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> Flatmap"},_e.prototype.pump=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it,St,Jt,kn;return S(this,function(rr){switch(rr.label){case 0:return[4,this.upstream.next()];case 1:if((ge=rr.sent()).done)return[2,!1];for(Ae=v.tensor_util.getTensorsInContainer(ge.value),Ie=this.transform(ge.value),it=v.tensor_util.getTensorsInContainer(Ie),this.outputQueue.pushAll(Ie),St=0,Jt=Ae;St<Jt.length;St++)kn=Jt[St],v.tensor_util.isTensorInList(kn,it)||kn.dispose();return[2,!0]}})})},_e}(yn),We=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.baseErrorHandler=Ae,Ie.lastRead=null,Ie.iterator=null,Ie.moreIterators=ge,Ie}return O(_e,Zt),_e.prototype.summary=function(){return"TODO: fill in upstream of chained summaries -> Chained"},_e.prototype.next=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){return this.lastRead=this.readFromChain(this.lastRead),[2,this.lastRead]})})},_e.prototype.readFromChain=function(ge){return A(this,void 0,void 0,function(){var Ae,Ie;return S(this,function(it){switch(it.label){case 0:return[4,ge];case 1:return it.sent(),this.iterator!=null?[3,3]:[4,this.moreIterators.next()];case 2:if((Ae=it.sent()).done)return[2,{value:null,done:!0}];this.iterator=Ae.value,this.baseErrorHandler!=null&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler)),it.label=3;case 3:return[4,this.iterator.next()];case 4:return(Ie=it.sent()).done?(this.iterator=null,[2,this.readFromChain(ge)]):[2,Ie]}})})},_e}(Mt);(function(Zt){Zt[Zt.FAIL=0]="FAIL",Zt[Zt.SHORTEST=1]="SHORTEST",Zt[Zt.LONGEST=2]="LONGEST"})(zt||(zt={}));var Ye=function(Zt){function _e(ge,Ae){Ae===void 0&&(Ae=zt.FAIL);var Ie=Zt.call(this)||this;return Ie.iterators=ge,Ie.mismatchMode=Ae,Ie.count=0,Ie.currentPromise=null,Ie}return O(_e,Zt),_e.prototype.summary=function(){return"{TODO: fill in upstream of zip summaries} -> Zip"},_e.prototype.nextState=function(ge){return A(this,void 0,void 0,function(){function Ae(Jt){return Jt instanceof Mt?{value:Jt.next().then(function(kn){return Ie++,kn.done&&it++,kn.value}),recurse:!1}:{value:null,recurse:!0}}var Ie,it,St;return S(this,function(Jt){switch(Jt.label){case 0:return[4,ge];case 1:return Jt.sent(),Ie=0,it=0,[4,Ce(this.iterators,Ae)];case 2:if(St=Jt.sent(),Ie===it)return[2,{value:null,done:!0}];if(it>0)switch(this.mismatchMode){case zt.FAIL:throw new Error("Zipped streams should have the same length. Mismatched at element "+this.count+".");case zt.SHORTEST:return[2,{value:null,done:!0}];case zt.LONGEST:}return this.count++,[2,{value:St,done:!1}]}})})},_e.prototype.next=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){return this.currentPromise=this.nextState(this.currentPromise),[2,this.currentPromise]})})},_e}(Mt),He=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.bufferSize=Ae,Ie.buffer=new Dt(Ae),Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> Prefetch"},_e.prototype.refill=function(){for(;!this.buffer.isFull();){var ge=this.upstream.next();this.buffer.push(ge)}},_e.prototype.next=function(){return this.refill(),this.buffer.shift()},_e}(Mt),dt=function(Zt){function _e(ge,Ae,Ie){var it=Zt.call(this,ge,Ae)||this;return it.upstream=ge,it.windowSize=Ae,it.upstreamExhausted=!1,it.random=re(Ie||v.util.now().toString()),it.lastRead=Promise.resolve({value:null,done:!1}),it}return O(_e,Zt),_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge=this;return S(this,function(Ae){return this.lastRead=this.lastRead.then(function(){return ge.serialNext()}),[2,this.lastRead]})})},_e.prototype.randomInt=function(ge){return Math.floor(this.random()*ge)},_e.prototype.chooseIndex=function(){return this.randomInt(this.buffer.length())},_e.prototype.serialNext=function(){return A(this,void 0,void 0,function(){var ge,Ae;return S(this,function(Ie){switch(Ie.label){case 0:this.upstreamExhausted||this.refill(),Ie.label=1;case 1:return this.buffer.isEmpty()?[3,3]:(ge=this.chooseIndex(),[4,this.buffer.shuffleExcise(ge)]);case 2:return(Ae=Ie.sent()).done?(this.upstreamExhausted=!0,[3,1]):(this.refill(),[2,Ae]);case 3:return[2,{value:null,done:!0}]}})})},_e}(He),It=function(){function Zt(){this.size=null}return Zt.prototype.batch=function(_e,ge){var Ae=this;ge===void 0&&(ge=!0);var Ie=this;return v.util.assert(_e>0,function(){return`batchSize needs to be positive, but it is 8099 `+_e}),ct(function(){return A(Ae,void 0,void 0,function(){return S(this,function(it){switch(it.label){case 0:return[4,Ie.iterator()];case 1:return[2,it.sent().columnMajorBatch(_e,ge,En)]}})})},this.size===1/0||this.size==null?this.size:ge?Math.ceil(this.size/_e):Math.floor(this.size/_e))},Zt.prototype.concatenate=function(_e){var ge=this,Ae=this;return ct(function(){return A(ge,void 0,void 0,function(){var Ie,it;return S(this,function(St){switch(St.label){case 0:return[4,Ae.iterator()];case 1:return it=(Ie=St.sent()).concatenate,[4,_e.iterator()];case 2:return[2,it.apply(Ie,[St.sent()])]}})})},this.size===1/0||_e.size===1/0?1/0:this.size!=null&&_e.size!=null?this.size+_e.size:null)},Zt.prototype.filter=function(_e){var ge=this,Ae=this;return ct(function(){return A(ge,void 0,void 0,function(){return S(this,function(Ie){switch(Ie.label){case 0:return[4,Ae.iterator()];case 1:return[2,Ie.sent().filter(function(it){return Object(v.tidy)(function(){return _e(it)})})]}})})},this.size===1/0?1/0:null)},Zt.prototype.forEachAsync=function(_e){return A(this,void 0,void 0,function(){return S(this,function(ge){switch(ge.label){case 0:return[4,this.iterator()];
8099case 1:return[2,ge.sent().forEachAsync(_e)]}})})},Zt.prototype.forEach=function(_e){return A(this,void 0,void 0,function(){return S(this,function(ge){return Object(v.deprecationWarn)("dataset.forEach() is deprecated and will be removed. Please use dataset.forEachAsync() instead"),[2,this.forEachAsync(_e)]})})},Zt.prototype.map=function(_e){var ge=this,Ae=this;return ct(function(){return A(ge,void 0,void 0,function(){return S(this,function(Ie){switch(Ie.label){case 0:return[4,Ae.iterator()];case 1:return[2,Ie.sent().map(function(it){return Object(v.tidy)(function(){return _e(it)})})]}})})},this.size)},Zt.prototype.mapAsync=function(_e){var ge=this,Ae=this;return ct(function(){return A(ge,void 0,void 0,function(){return S(this,function(Ie){switch(Ie.label){case 0:return[4,Ae.iterator()];case 1:return[2,Ie.sent().mapAsync(_e)]}})})},this.size)},Zt.prototype.prefetch=function(_e){var ge=this;if(_e==null)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");var Ae=this;return ct(function(){return A(ge,void 0,void 0,function(){return S(this,function(Ie){switch(Ie.label){case 0:return[4,Ae.iterator()];case 1:return[2,Ie.sent().prefetch(_e)]}})})},this.size)},Zt.prototype.repeat=function(_e){var ge=this,Ae=this;return ct(function(){return A(ge,void 0,void 0,function(){var Ie=this;return S(this,function(it){return[2,function(St,Jt){return new We(St,Jt)}(Ot(function(){return A(Ie,void 0,void 0,function(){var St;return S(this,function(Jt){switch(Jt.label){case 0:return St={},[4,Ae.iterator()];case 1:return[2,(St.value=Jt.sent(),St.done=!1,St)]}})})}).take(_e))]})})},this.size!=null&&_e>0?this.size*_e:_e===0?0:this.size!=null&&(_e===void 0||_e<0)?1/0:null)},Zt.prototype.skip=function(_e){var ge=this,Ae=this;return ct(function(){return A(ge,void 0,void 0,function(){return S(this,function(Ie){switch(Ie.label){case 0:return[4,Ae.iterator()];case 1:return[2,Ie.sent().skip(_e)]}})})},this.size!=null&&_e>=0&&this.size>=_e?this.size-_e:this.size!=null&&(this.size<_e||_e===void 0||_e<0)?0:null)},Zt.prototype.shuffle=function(_e,ge,Ae){var Ie=this;if(Ae===void 0&&(Ae=!0),_e==null||_e<0)throw this.size==null?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError("`Dataset.shuffle()` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for `tf.Tensor`s), consider setting bufferSize to the dataset size ("+this.size+" elements)");var it=this,St=re(ge||v.util.now().toString());return ct(function(){return A(Ie,void 0,void 0,function(){var Jt;return S(this,function(kn){switch(kn.label){case 0:return Jt=St.int32(),Ae&&(Jt+=St.int32()),[4,it.iterator()];case 1:return[2,kn.sent().shuffle(_e,Jt.toString())]}})})},this.size)},Zt.prototype.take=function(_e){var ge=this,Ae=this;return ct(function(){return A(ge,void 0,void 0,function(){return S(this,function(Ie){switch(Ie.label){case 0:return[4,Ae.iterator()];case 1:return[2,Ie.sent().take(_e)]}})})},this.size!=null&&this.size>_e?_e:this.size!=null&&this.size<=_e?this.size:null)},Zt.prototype.toArray=function(){return A(this,void 0,void 0,function(){return S(this,function(_e){switch(_e.label){case 0:if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return[4,this.iterator()];case 1:return[2,_e.sent().toArray()]}})})},Zt.prototype.toArrayForTest=function(){return A(this,void 0,void 0,function(){return S(this,function(_e){switch(_e.label){case 0:if(this.size===1/0)throw new Error("Can not convert infinite data stream to array.");return[4,this.iterator()];case 1:return[2,_e.sent().toArrayForTest()]}})})},Zt.MAX_BUFFER_SIZE=1e4,Zt}();function ct(Zt,_e){return _e===void 0&&(_e=null),new(function(ge){function Ae(){var Ie=ge!==null&&ge.apply(this,arguments)||this;return Ie.size=_e,Ie}return O(Ae,ge),Ae.prototype.iterator=function(){return A(this,void 0,void 0,function(){return S(this,function(Ie){return[2,Zt()]})})},Ae}(It))}function on(Zt){var _e=this;return ct(function(){return A(_e,void 0,void 0,function(){return S(this,function(ge){return[2,Ee(Zt)]})})},Zt.length)}function Xt(Zt){var _e,ge=this;if(!be(Zt))throw new Error("The argument to zip() must be an object or array.");if(Array.isArray(Zt))for(var Ae=0;Ae<Zt.length;Ae++)_e=_e==null?Zt[Ae].size:Math.min(_e,Zt[Ae].size);else if(Zt instanceof Object)for(var Ie in Zt)_e=_e==null?Zt[Ie].size:Math.min(_e,Zt[Ie].size);return ct(function(){return A(ge,void 0,void 0,function(){return S(this,function(it){switch(it.label){case 0:return[4,Ce(Zt,function(St){if(St instanceof It)return{value:St.iterator(),recurse:!1};if(be(St))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")})];case 1:return[2,function(St,Jt){return Jt===void 0&&(Jt=zt.FAIL),new Ye(St,Jt)}
8099(it.sent(),zt.SHORTEST)]}})})},_e)}function En(Zt){return Zt===null?null:function(_e){return _e==null||function(ge){return ge===null||typeof ge!="object"&&typeof ge!="function"}(_e)||Array.isArray(_e)||typeof _e=="object"&&_e instanceof v.Tensor||v.util.isTypedArray(_e)}(Zt[0])?{value:function(_e){if(_e.length===0)throw new Error("Can't make a batch of zero elements.");return _e[0]instanceof v.Tensor?Object(v.stack)(_e):Object(v.tensor)(_e)}(Zt),recurse:!1}:{value:null,recurse:!0}}var xe=function(Zt){function _e(ge){var Ae=Zt.call(this)||this;return Ae.input=ge,Ae}return O(_e,Zt),_e.prototype.iterator=function(){return A(this,void 0,void 0,function(){var ge;return S(this,function(Ae){switch(Ae.label){case 0:return[4,this.input.iterator()];case 1:return ge=Ae.sent(),[2,ge.decodeUTF8().split(` 8100`).map(function(Ie){return Ie.endsWith("\r")&&(Ie=Ie.slice(0,-1)),Ie})]}})})},_e}(It),jn=Symbol("out"),nr=Symbol("field"),ar=Symbol("quote"),cr=Symbol("quoteafterquote"),Er=Symbol("quoteinquote"),hn=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.input=ge,Ie.hasHeader=!0,Ie.fullColumnNames=null,Ie.columnNamesValidated=!1,Ie.columnConfigs=null,Ie.configuredColumnsOnly=!1,Ie.delimiter=",",Ie.delimWhitespace=!1,Ie.base=new xe(ge),Ae||(Ae={}),Ie.hasHeader=Ae.hasHeader!==!1,Ie.fullColumnNames=Ae.columnNames,Ie.columnConfigs=Ae.columnConfigs,Ie.configuredColumnsOnly=Ae.configuredColumnsOnly,Ae.delimWhitespace?(v.util.assert(Ae.delimiter==null,function(){return"Delimiter should not be provided when delimWhitespace is true."}),Ie.delimWhitespace=!0,Ie.delimiter=" "):Ie.delimiter=Ae.delimiter?Ae.delimiter:",",Ie}return O(_e,Zt),_e.prototype.columnNames=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){switch(ge.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:ge.sent(),ge.label=2;case 2:return[2,this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames]}})})},_e.prototype.setColumnNames=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it,St,Jt,kn=this;return S(this,function(rr){switch(rr.label){case 0:return[4,this.maybeReadHeaderLine()];case 1:if(ge=rr.sent(),!this.fullColumnNames&&!ge)throw new Error("Column names must be provided if there is no header line.");if(this.fullColumnNames&&ge&&v.util.assert(ge.length===this.fullColumnNames.length,function(){return"The length of provided columnNames ("+kn.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+ge.length.toString()+")."}),this.fullColumnNames||(this.fullColumnNames=ge),Ae=this.fullColumnNames.reduce(function(Bn,Gn){return Bn[Gn]=Bn[Gn]+1||1,Bn},{}),Ie=Object.keys(Ae).filter(function(Bn){return Ae[Bn]>1}),v.util.assert(Ie.length===0,function(){return"Duplicate column names found: "+Ie.toString()}),this.columnConfigs){for(it=0,St=Object.keys(this.columnConfigs);it<St.length;it++)if(Jt=St[it],this.fullColumnNames.indexOf(Jt)===-1)throw new Error('The key "'+Jt+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").")}return this.columnNamesValidated=!0,[2]}})})},_e.prototype.maybeReadHeaderLine=function(){return A(this,void 0,void 0,function(){var ge,Ae;return S(this,function(Ie){switch(Ie.label){case 0:return this.hasHeader?[4,this.base.iterator()]:[3,3];case 1:return[4,Ie.sent().next()];case 2:if((ge=Ie.sent()).done)throw new Error("No data was found for CSV parsing.");return Ae=ge.value,[2,this.parseRow(Ae,!1)];case 3:return[2,null]}})})},_e.prototype.iterator=function(){return A(this,void 0,void 0,function(){var ge,Ae=this;return S(this,function(Ie){switch(Ie.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:Ie.sent(),Ie.label=2;case 2:return[4,this.base.iterator()];case 3:return ge=Ie.sent(),this.hasHeader&&(ge=ge.skip(1)),[2,ge.map(function(it){return Ae.makeDataElement(it)})]}})})},_e.prototype.makeDataElement=function(ge){for(var Ae=this.parseRow(ge),Ie={},it={},St=0;St<this.fullColumnNames.length;St++){var Jt=this.fullColumnNames[St],kn=this.columnConfigs?this.columnConfigs[Jt]:null;if(!this.configuredColumnsOnly||kn){var rr=Ae[St],Bn=null;if(rr==="")if(kn&&kn.default!==void 0)Bn=kn.default;else{if(kn&&(kn.required||kn.isLabel))throw new Error("Required column "+Jt+" is empty in this line: "+ge);Bn=void 0}else{var Gn=Number(rr);
8100if(isNaN(Gn))Bn=kn&&kn.dtype==="bool"?this.getBoolean(rr):rr;else if(kn&&kn.dtype)switch(kn.dtype){case"float32":Bn=Gn;break;case"int32":Bn=Math.floor(Gn);break;case"bool":Bn=this.getBoolean(rr);break;default:Bn=Gn}else Bn=Gn}kn&&kn.isLabel?it[Jt]=Bn:Ie[Jt]=Bn}}return Object.keys(it).length===0?Ie:{xs:Ie,ys:it}},_e.prototype.getBoolean=function(ge){return ge==="1"||ge.toLowerCase()==="true"?1:0},_e.prototype.parseRow=function(ge,Ae){Ae===void 0&&(Ae=!0);for(var Ie=[],it=0,St=ge.length,Jt=jn,kn=0;kn<St;kn++)switch(Jt){case jn:switch(ge.charAt(kn)){case'"':it=kn+1,Jt=ar;break;case this.delimiter:if(it=kn+1,this.delimiter===" "&&this.delimWhitespace)break;Ie.push(""),Jt=jn;break;default:Jt=nr,it=kn}break;case nr:switch(ge.charAt(kn)){case this.delimiter:Ie.push(ge.substring(it,kn)),Jt=jn,it=kn+1}break;case ar:switch(ge.charAt(kn)){case'"':Jt=cr}break;case cr:switch(ge.charAt(kn)){case this.delimiter:Ie.push(ge.substring(it,kn-1)),Jt=jn,it=kn+1;break;case'"':Jt=ar;break;default:Jt=Er}break;case Er:switch(ge.charAt(kn)){case'"':Jt=ar}}if(Jt===cr?Ie.push(ge.substring(it,St-1)):Ie.push(ge.substring(it)),Ae&&Ie.length!==this.fullColumnNames.length)throw new Error("Invalid row in csv file. Should have "+this.fullColumnNames.length+" elements in a row, but got "+Ie);return Ie},_e}(It),rn=function(Zt){function _e(ge){var Ae=Zt.call(this)||this;Ae.microphoneConfig=ge,Ae.isClosed=!1,Ae.fftSize=ge.fftSize||1024;var Ie=Math.log2(Ae.fftSize);if(Ae.fftSize<0||Ie<4||Ie>14||!Number.isInteger(Ie))throw new Error("Invalid fftSize: it must be a power of 2 between 2 to 4 and 2 to 14, but got "+Ae.fftSize);if(Ae.numFrames=ge.numFramesPerSpectrogram||43,Ae.sampleRateHz=ge.sampleRateHz,Ae.columnTruncateLength=ge.columnTruncateLength||Ae.fftSize,Ae.audioTrackConstraints=ge.audioTrackConstraints,Ae.smoothingTimeConstant=ge.smoothingTimeConstant||0,Ae.includeSpectrogram=ge.includeSpectrogram!==!1,Ae.includeWaveform=ge.includeWaveform===!0,!Ae.includeSpectrogram&&!Ae.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.");return Ae}return O(_e,Zt),_e.prototype.summary=function(){return"microphone"},_e.create=function(ge){return ge===void 0&&(ge={}),A(this,void 0,void 0,function(){var Ae;return S(this,function(Ie){switch(Ie.label){case 0:if(Object(v.env)().get("IS_NODE"))throw new Error("microphone API is only supported in browser environment.");return[4,(Ae=new _e(ge)).start()];case 1:return Ie.sent(),[2,Ae]}})})},_e.prototype.start=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it;return S(this,function(St){switch(St.label){case 0:return St.trys.push([0,2,,3]),ge=this,[4,navigator.mediaDevices.getUserMedia({audio:this.audioTrackConstraints==null||this.audioTrackConstraints,video:!1})];case 1:return ge.stream=St.sent(),[3,3];case 2:throw Ae=St.sent(),new Error("Error thrown while initializing video stream: "+Ae.message);case 3:if(!this.stream)throw new Error("Could not obtain audio from microphone.");if(Ie=window.AudioContext||window.webkitAudioContext,this.audioContext=new Ie,this.sampleRateHz){if(this.audioContext.sampleRate!==this.sampleRateHz)throw new Error("Mismatch in sampling rate: Expected: "+this.sampleRateHz+"; Actual: "+this.audioContext.sampleRate)}else this.sampleRateHz=this.audioContext.sampleRate;return it=this.audioContext.createMediaStreamSource(this.stream),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,it.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize),[2]}})})},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it,St;return S(this,function(Jt){switch(Jt.label){case 0:return this.isClosed?[2,{value:null,done:!0}]:[4,this.getAudioData()];case 1:return Ie=Jt.sent(),this.includeSpectrogram&&(it=this.flattenQueue(Ie.freqDataQueue),ge=this.getTensorFromAudioDataArray(it,[this.numFrames,this.columnTruncateLength,1])),this.includeWaveform&&(St=this.flattenQueue(Ie.timeDataQueue),Ae=this.getTensorFromAudioDataArray(St,[this.numFrames*this.fftSize,1])),[2,{value:{spectrogram:ge,waveform:Ae},done:!1}]}})})},_e.prototype.capture=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){switch(ge.label){case 0:return[4,this.next()];
8100case 1:return[2,ge.sent().value]}})})},_e.prototype.getAudioData=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it=this;return S(this,function(St){return ge=[],Ae=[],Ie=0,[2,new Promise(function(Jt){var kn=setInterval(function(){it.includeSpectrogram&&(it.analyser.getFloatFrequencyData(it.freqData),it.freqData[0]===-1/0&&Jt({freqDataQueue:ge,timeDataQueue:Ae}),ge.push(it.freqData.slice(0,it.columnTruncateLength))),it.includeWaveform&&(it.analyser.getFloatTimeDomainData(it.timeData),Ae.push(it.timeData.slice())),++Ie===it.numFrames&&(clearInterval(kn),Jt({freqDataQueue:ge,timeDataQueue:Ae}))},it.fftSize/it.sampleRateHz*1e3)})]})})},_e.prototype.stop=function(){this.isClosed||(this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),this.stream!=null&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop())},_e.prototype.toArray=function(){throw new Error("Can not convert infinite audio stream to array.")},_e.prototype.getSampleRate=function(){return this.sampleRateHz},_e.prototype.flattenQueue=function(ge){var Ae=ge[0].length,Ie=new Float32Array(ge.length*Ae);return ge.forEach(function(it,St){return Ie.set(it,St*Ae)}),Ie},_e.prototype.getTensorFromAudioDataArray=function(ge,Ae){var Ie=new Float32Array(v.util.sizeFromShape(Ae));return Ie.set(ge,Ie.length-ge.length),Object(v.tensor)(Ie,Ae)},_e}(Mt),fn=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;if(Ie.webcamVideoElement=ge,Ie.webcamConfig=Ae,Ie.isClosed=!0,Ie.resize=!1,Ie.needToResize())if(Ie.resize=!0,Ie.cropSize=[Ie.webcamConfig.resizeHeight,Ie.webcamConfig.resizeWidth],Ie.cropBoxInd=Object(v.tensor1d)([0],"int32"),Ie.webcamConfig.centerCrop){var it=1*Ie.webcamConfig.resizeWidth/Ie.webcamVideoElement.width,St=1*Ie.webcamConfig.resizeHeight/Ie.webcamVideoElement.height,Jt=(1-it)/2,kn=(1-St)/2,rr=Jt+it,Bn=St+kn;Ie.cropBox=Object(v.tensor2d)([kn,Jt,Bn,rr],[1,4])}else Ie.cropBox=Object(v.tensor2d)([0,0,1,1],[1,4]);return Ie}return O(_e,Zt),_e.prototype.summary=function(){return"webcam"},_e.create=function(ge,Ae){return Ae===void 0&&(Ae={}),A(this,void 0,void 0,function(){var Ie;return S(this,function(it){switch(it.label){case 0:if(Object(v.env)().get("IS_NODE"))throw new Error("tf.data.webcam is only supported in browser environment.");if(!ge){if(ge=document.createElement("video"),!Ae.resizeWidth||!Ae.resizeHeight)throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");ge.width=Ae.resizeWidth,ge.height=Ae.resizeHeight}return[4,(Ie=new _e(ge,Ae)).start()];case 1:return it.sent(),[2,Ie]}})})},_e.prototype.start=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie=this;return S(this,function(it){switch(it.label){case 0:this.webcamConfig.facingMode&&v.util.assert(this.webcamConfig.facingMode==="user"||this.webcamConfig.facingMode==="environment",function(){return"Invalid webcam facing mode: "+Ie.webcamConfig.facingMode+". Please provide 'user' or 'environment'"}),it.label=1;case 1:return it.trys.push([1,3,,4]),ge=this,[4,navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}})];case 2:return ge.stream=it.sent(),[3,4];case 3:throw(Ae=it.sent()).message="Error thrown while initializing video stream: "+Ae.message,Ae;case 4:if(!this.stream)throw new Error("Could not obtain video from webcam.");try{this.webcamVideoElement.srcObject=this.stream}catch(St){console.log(St),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,[2,new Promise(function(St){Ie.webcamVideoElement.onloadedmetadata=function(){St()}})]}})})},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge;return S(this,function(Ae){if(this.isClosed)return[2,{value:null,done:!0}];try{ge=v.browser.fromPixels(this.webcamVideoElement)}catch(Ie){throw new Error("Error thrown converting video to pixels: "+JSON.stringify(Ie))}if(!this.resize)return[2,{value:ge,done:!1}];try{return[2,{value:this.cropAndResizeFrame(ge),done:!1}]}catch(Ie){throw new Error("Error thrown cropping the video: "+Ie.message)}finally{ge.dispose()}return[2]})})},_e.prototype.needToResize=function(){return!(!this.webcamConfig.resizeWidth||!this.webcamConfig.resizeHeight||this.webcamVideoElement.width===this.webcamConfig.resizeWidth&&this.webcamVideoElement.height===this.webcamConfig.resizeHeight)},_e.prototype.cropAndResizeFrame=function(ge){var Ae=this;return Object(v.tidy)(function(){var Ie,it=ge.toFloat().expandDims(0),St=(Ie=v.image.cropAndResize(it,Ae.cropBox,Ae.cropBoxInd,Ae.cropSize,"bilinear")).shape;return Ie.reshape(St.slice(1))})},_e.prototype.capture=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){switch(ge.label){case 0:return[4,this.next()];
8100case 1:return[2,ge.sent().value]}})})},_e.prototype.stop=function(){this.stream.getTracks().forEach(function(ge){return ge.stop()});try{this.webcamVideoElement.srcObject=null}catch(ge){console.log(ge),this.webcamVideoElement.src=null}this.isClosed=!0},_e.prototype.toArray=function(){throw new Error("Can not convert infinite video stream to array.")},_e}(Mt),Xn=function(){},Fn=function(Zt){function _e(){return Zt!==null&&Zt.apply(this,arguments)||this}return O(_e,Zt),_e.prototype.split=function(ge){return new Ar(this,ge)},_e}(Mt),Ar=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.impl=new Dr(ge,Ae),Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.impl.summary()},_e.prototype.next=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){return[2,this.impl.next()]})})},_e}(Fn),Dr=function(Zt){function _e(ge,Ae){var Ie=Zt.call(this)||this;return Ie.upstream=ge,Ie.separator=Ae,Ie.carryover="",Ie}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> Split('"+this.separator+"')"},_e.prototype.pump=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie,it,St;return S(this,function(Jt){switch(Jt.label){case 0:return[4,this.upstream.next()];case 1:if((ge=Jt.sent()).done)return this.carryover===""?[2,!1]:(this.outputQueue.push(this.carryover),this.carryover="",[2,!0]);for((Ae=ge.value.split(this.separator))[0]=this.carryover+Ae[0],Ie=0,it=Ae.slice(0,-1);Ie<it.length;Ie++)St=it[Ie],this.outputQueue.push(St);return this.carryover=Ae[Ae.length-1],[2,!0]}})})},_e}(yn),xr=function(Zt){function _e(){return Zt!==null&&Zt.apply(this,arguments)||this}return O(_e,Zt),_e.prototype.decodeUTF8=function(){return new fi(this)},_e}(Mt),fi=function(Zt){function _e(ge){var Ae=Zt.call(this)||this;return Ae.upstream=ge,Ae.impl=new ci(ge),Ae}return O(_e,Zt),_e.prototype.summary=function(){return this.impl.summary()},_e.prototype.next=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){return[2,this.impl.next()]})})},_e}(Fn),ci=function(Zt){function _e(ge){var Ae=Zt.call(this)||this;if(Ae.upstream=ge,Object(v.env)().get("IS_BROWSER"))Ae.decoder=new TextDecoder("utf-8");else{var Ie=n(386).StringDecoder;Ae.decoder=new Ie("utf8")}return Ae}return O(_e,Zt),_e.prototype.summary=function(){return this.upstream.summary()+" -> Utf8"},_e.prototype.pump=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie;return S(this,function(it){switch(it.label){case 0:return[4,this.upstream.next()];case 1:return(ge=it.sent()).done?[2,!1]:(Ae=ge.value,Ie=Object(v.env)().get("IS_BROWSER")?this.decoder.decode(Ae,{stream:!0}):this.decoder.write(h.from(Ae.buffer)),this.outputQueue.push(Ie),[2,!0])}})})},_e}(yn),qr=function(Zt){function _e(ge,Ae){Ae===void 0&&(Ae={});var Ie=Zt.call(this)||this;return Ie.file=ge,Ie.options=Ae,v.util.assert(ge instanceof Uint8Array||!!Object(v.env)().get("IS_BROWSER")&&(ge instanceof File||ge instanceof Blob),function(){return"FileChunkIterator only supports File, Blob and Uint8Array right now."}),Ie.offset=Ae.offset||0,Ie.chunkSize=Ae.chunkSize||1048576,Ie}return O(_e,Zt),_e.prototype.summary=function(){return"FileChunks "+this.file},_e.prototype.next=function(){return A(this,void 0,void 0,function(){var ge,Ae,Ie=this;return S(this,function(it){switch(it.label){case 0:return this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size)?[2,{value:null,done:!0}]:(ge=new Promise(function(St,Jt){var kn=Ie.offset+Ie.chunkSize;if(Ie.file instanceof Uint8Array)St(new Uint8Array(Ie.file.slice(Ie.offset,kn)));else{var rr=new FileReader;rr.onload=function(Gn){var Zn=rr.result;if(Zn instanceof ArrayBuffer&&(Zn=new Uint8Array(Zn)),!(Zn instanceof Uint8Array))return Jt(new TypeError("FileReader returned unknown type."));St(Zn)},rr.onabort=function(Gn){return Jt(new Error("Aborted"))},rr.onerror=function(Gn){return Jt(new Error(Gn.type))};var Bn=Ie.file.slice(Ie.offset,kn);rr.readAsArrayBuffer(Bn)}Ie.offset=kn}),Ae={},[4,ge]);case 1:return[2,(Ae.value=it.sent(),Ae.done=!1,Ae)]}})})},_e}(xr),mi=function(Zt){return{method:Zt.method,headers:Zt.headers,body:Zt.body,mode:Zt.mode,credentials:Zt.credentials,cache:Zt.cache,redirect:Zt.redirect,referrer:Zt.referrer,integrity:Zt.integrity}};function Ir(Zt){return typeof Zt=="string"&&Zt.substr(0,7)==="file://"}var ti=function(Zt){function _e(ge,Ae){Ae===void 0&&(Ae={});var Ie=Zt.call(this)||this;
8100return Ie.input=ge,Ie.options=Ae,Ie}return O(_e,Zt),_e.prototype.iterator=function(){return A(this,void 0,void 0,function(){var ge;return S(this,function(Ae){return Ir(this.input)&&Object(v.env)().get("IS_NODE")&&(ge=n(385),this.input=ge.readFileSync(this.input.substr(7))),[2,new qr(this.input,this.options)]})})},_e}(Xn),ri=function(Zt){function _e(ge,Ae){Ae===void 0&&(Ae={});var Ie=Zt.call(this)||this;return Ie.url=ge,Ie.fileOptions=Ae,Ie}return O(_e,Zt),_e.prototype.iterator=function(){return A(this,void 0,void 0,function(){return S(this,function(ge){return Ir(this.url)?[2,new ti(this.url,this.fileOptions).iterator()]:[2,function(Ae,Ie){return Ie===void 0&&(Ie={}),A(this,void 0,void 0,function(){var it,St,Jt,kn,rr;return S(this,function(Bn){switch(Bn.label){case 0:return typeof Ae=="string"?it=Ae:(it=Ae.url,St=mi(Ae)),[4,v.util.fetch(it,St)];case 1:return(Jt=Bn.sent()).ok?(rr=Uint8Array.bind,[4,Jt.arrayBuffer()]):[3,3];case 2:return kn=new(rr.apply(Uint8Array,[void 0,Bn.sent()])),[2,new qr(kn,Ie)];case 3:throw new Error(Jt.statusText)}})})}(this.url,this.fileOptions)]})})},_e}(Xn);function yi(Zt,_e){return _e===void 0&&(_e={}),new hn(new ri(Zt),_e)}function na(Zt){var _e=this,ge=Ot(Zt);return ct(function(){return A(_e,void 0,void 0,function(){return S(this,function(Ae){return[2,ge]})})})}function co(Zt){var _e=this;return ct(function(){return A(_e,void 0,void 0,function(){var ge;return S(this,function(Ae){switch(Ae.label){case 0:return[4,Zt()];case 1:return ge=Ae.sent(),[2,Ot(function(){return ge.next()})]}})})})}function $i(Zt,_e){return A(this,void 0,void 0,function(){return S(this,function(ge){return[2,fn.create(Zt,_e)]})})}function Ft(Zt){return A(this,void 0,void 0,function(){return S(this,function(_e){return[2,rn.create(Zt)]})})}var Qr="1.7.4"}.call(this,n(59),n(92).Buffer)},function(a,i,n){function s(h){var v="";if(!h)try{h=n(185)}catch(g){v=g.toString()}return{readFile:h?function(g){return new Promise(function(O,A){h.readFile(g,function(S,M){return S?A(S):O(M)})})}:function(){throw new Error("readFile - failed to require fs in nodejs environment with error: "+v)}}}n.d(i,"a",function(){return s})},function(a){a.exports={a:"0.12.2"}},function(a,i,n){var s=/("(?:[^\\"]|\\.)*")|[:,]/g;a.exports=function(h,v){var g,O,A;return v=v||{},g=JSON.stringify([1],void 0,v.indent===void 0?2:v.indent).slice(2,-3),O=g===""?1/0:v.maxLength===void 0?80:v.maxLength,A=v.replacer,function S(M,P,L){var V,N,ee,J,K,re,ce,pe,ke,Ce,be,$e;if(M&&typeof M.toJSON=="function"&&(M=M.toJSON()),(be=JSON.stringify(M,A))===void 0)return be;if(ce=O-P.length-L,be.length<=ce&&(ke=be.replace(s,function(ht,Dt){return Dt||ht+" "})).length<=ce)return ke;if(A!=null&&(M=JSON.parse(be),A=void 0),typeof M=="object"&&M!==null){if(pe=P+g,ee=[],N=0,Array.isArray(M))for(Ce="[",V="]",ce=M.length;N<ce;N++)ee.push(S(M[N],pe,N===ce-1?0:1)||"null");else for(Ce="{",V="}",ce=(re=Object.keys(M)).length;N<ce;N++)J=re[N],K=JSON.stringify(J)+": ",($e=S(M[J],pe,K.length+(N===ce-1?0:1)))!==void 0&&ee.push(K+$e);if(ee.length>0)return[Ce,g+ee.join(`, 8101`+pe),V].join(` 8102`+P)}return be}(h,"",0)}},function(a,i,n){var s=n(31),h=Object(s.a)(function(v){v.setUTCDate(1),v.setUTCHours(0,0,0,0)},function(v,g){v.setUTCMonth(v.getUTCMonth()+g)},function(v,g){return g.getUTCMonth()-v.getUTCMonth()+12*(g.getUTCFullYear()-v.getUTCFullYear())},function(v){return v.getUTCMonth()});i.a=h,h.range},function(a,i,n){var s=n(31),h=Object(s.a)(function(v){v.setDate(1),v.setHours(0,0,0,0)},function(v,g){v.setMonth(v.getMonth()+g)},function(v,g){return g.getMonth()-v.getMonth()+12*(g.getFullYear()-v.getFullYear())},function(v){return v.getMonth()});i.a=h,h.range},function(a,i,n){(function(s){var h=n(36),v=n(275),g=n(193),O={"Content-Type":"application/x-www-form-urlencoded"};function A(M,P){!h.isUndefined(M)&&h.isUndefined(M["Content-Type"])&&(M["Content-Type"]=P)}var S={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:function(){var M;return(typeof XMLHttpRequest<"u"||s!==void 0&&Object.prototype.toString.call(s)==="[object process]")&&(M=n(192)),M}(),transformRequest:[function(M,P){return v(P,"Accept"),v(P,"Content-Type"),h.isFormData(M)||h.isArrayBuffer(M)||h.isBuffer(M)||h.isStream(M)||h.isFile(M)||h.isBlob(M)?M:h.isArrayBufferView(M)?M.buffer:h.isURLSearchParams(M)?(A(P,"application/x-www-form-urlencoded;charset=utf-8"),M.toString()):h.isObject(M)||P&&P["Content-Type"]==="application/json"?(A(P,"application/json"),function(L,V,N){if(h.isString(L))try{return(V||JSON.parse)(L),h.trim(L)}catch(ee){if(ee.name!=="SyntaxError")throw ee}return(N||JSON.stringify)(L)}(M)):M}],transformResponse:[function(M){var P=this.transitional,L=P&&P.silentJSONParsing,V=P&&P.forcedJSONParsing,N=!L&&this.responseType==="json";if(N||V&&h.isString(M)&&M.length)try{return JSON.parse(M)}catch(ee){if(N)throw ee.name==="SyntaxError"?g(ee,this,"E_JSON_PARSE"):ee}return M}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(M){return M>=200&&M<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};h.forEach(["delete","get","head"],function(M){S.headers[M]={}}),h.forEach(["post","put","patch"],function(M){S.headers[M]=h.merge(O)}),a.exports=S}).call(this,n(75))},function(a,i,n){/** 8103* @license 8104* Copyright 2018 Google LLC. All Rights Reserved. 8105* Licensed under the Apache License, Version 2.0 (the "License");
8106* you may not use this file except in compliance with the License. 8107* You may obtain a copy of the License at 8108* 8109* http://www.apache.org/licenses/LICENSE-2.0 8110* 8111* Unless required by applicable law or agreed to in writing, software 8112* distributed under the License is distributed on an "AS IS" BASIS, 8113* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8114* See the License for the specific language governing permissions and 8115* limitations under the License. 8116* ============================================================================= 8117*/var s=this&&this.__awaiter||function(P,L,V,N){return new(V||(V=Promise))(function(ee,J){function K(pe){try{ce(N.next(pe))}catch(ke){J(ke)}}function re(pe){try{ce(N.throw(pe))}catch(ke){J(ke)}}function ce(pe){pe.done?ee(pe.value):new V(function(ke){ke(pe.value)}).then(K,re)}ce((N=N.apply(P,L||[])).next())})},h=this&&this.__importDefault||function(P){return P&&P.__esModule?P:{default:P}};Object.defineProperty(i,"__esModule",{value:!0});const v=n(50),g=h(n(88)),O=n(64),A=n(110),S=n(109),M={maxBins:12,fontSize:11};i.histogram=function(P,L,V={}){return s(this,void 0,void 0,function*(){const N=function(ce){if(ce.length==null)throw new Error("input data must be an array");if(ce.length===0)return[];if(typeof ce[0]=="object"){if(ce[0].value==null)throw new Error("input data must have a value field");return ce}{const pe=Array(ce.length);for(let ke=0;ke<ce.length;ke++)pe[ke]={value:ce[ke]};return pe}}(L),ee=Object.assign({},M,V),J=O.subSurface(P,"histogram");if(V.stats!==!1){const ce=O.subSurface(P,"stats",{prepend:!0});(function(pe,ke,Ce){const be=v.format(",.4~f"),$e=v.format(".4~p"),ht=[],Dt=[];if(pe.numVals!=null&&(ht.push("Num Vals"),Dt.push(be(pe.numVals))),pe.min!=null&&(ht.push("Min"),Dt.push(be(pe.min))),pe.max!=null&&(ht.push("Max"),Dt.push(be(pe.max))),pe.numZeros!=null){ht.push("# Zeros");let Ut="";pe.numVals&&(Ut=pe.numZeros>0?`(${$e(pe.numZeros/pe.numVals)})`:""),Dt.push(`${be(pe.numZeros)} ${Ut}`)}if(pe.numNans!=null){ht.push("# NaNs");let Ut="";pe.numVals&&(Ut=pe.numNans>0?`(${$e(pe.numNans/pe.numVals)})`:""),Dt.push(`${be(pe.numNans)} ${Ut}`)}if(pe.numInfs!=null){ht.push("# Infinity");let Ut="";pe.numVals&&(Ut=pe.numInfs>0?`(${$e(pe.numInfs/pe.numVals)})`:""),Dt.push(`${be(pe.numInfs)} ${Ut}`)}S.table(ke,{headers:ht,values:[Dt]},Ce)})(V.stats?V.stats:A.arrayStats(N.map(pe=>pe.value)),ce,{fontSize:ee.fontSize})}if(N.length===0)return;const K=[];for(let ce=0;ce<N.length;ce++){const pe=N[ce].value;pe!=null&&isFinite(pe)&&K.push(N[ce])}const re={width:ee.width||O.getDefaultWidth(J),height:ee.height||O.getDefaultHeight(J),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},data:{values:K},mark:{type:"bar",tooltip:!0},config:{axis:{labelFontSize:ee.fontSize,titleFontSize:ee.fontSize},text:{fontSize:ee.fontSize},legend:{labelFontSize:ee.fontSize,titleFontSize:ee.fontSize}},encoding:{x:{bin:{maxbins:ee.maxBins},field:"value",type:"quantitative"},y:{aggregate:"count",type:"quantitative"},color:{value:ee.color||"#001B44"}}};return g.default(J,re,{actions:!1,mode:"vega-lite",defaultStyle:!1})})}},function(a,i,n){n.r(i),n.d(i,"h",function(){return g}),n.d(i,"createElement",function(){return g}),n.d(i,"cloneElement",function(){return S}),n.d(i,"Component",function(){return yt}),n.d(i,"render",function(){return bt}),n.d(i,"rerender",function(){return V}),n.d(i,"options",function(){return s});var s={},h=[],v=[];function g(_t,Ze){var Vt,sn,yn,Yt,We=v;for(Yt=arguments.length;Yt-- >2;)h.push(arguments[Yt]);for(Ze&&Ze.children!=null&&(h.length||h.push(Ze.children),delete Ze.children);h.length;)if((sn=h.pop())&&sn.pop!==void 0)for(Yt=sn.length;Yt--;)h.push(sn[Yt]);else typeof sn=="boolean"&&(sn=null),(yn=typeof _t!="function")&&(sn==null?sn="":typeof sn=="number"?sn=String(sn):typeof sn!="string"&&(yn=!1)),yn&&Vt?We[We.length-1]+=sn:We===v?We=[sn]:We.push(sn),Vt=yn;var Ye=new function(){};return Ye.nodeName=_t,Ye.children=We,Ye.attributes=Ze??void 0,Ye.key=Ze==null?void 0:Ze.key,s.vnode!==void 0&&s.vnode(Ye),Ye}function O(_t,Ze){for(var Vt in Ze)_t[Vt]=Ze[Vt];return _t}var A=typeof Promise=="function"?Promise.resolve().then.bind(Prom
8117ise.resolve()):setTimeout;function S(_t,Ze){return g(_t.nodeName,O(O({},_t.attributes),Ze),arguments.length>2?[].slice.call(arguments,2):_t.children)}var M=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,P=[];function L(_t){!_t._dirty&&(_t._dirty=!0)&&P.push(_t)==1&&(s.debounceRendering||A)(V)}function V(){var _t,Ze=P;for(P=[];_t=Ze.pop();)_t._dirty&&Tt(_t)}function N(_t,Ze,Vt){return typeof Ze=="string"||typeof Ze=="number"?_t.splitText!==void 0:typeof Ze.nodeName=="string"?!_t._componentConstructor&&ee(_t,Ze.nodeName):Vt||_t._componentConstructor===Ze.nodeName}function ee(_t,Ze){return _t.normalizedNodeName===Ze||_t.nodeName.toLowerCase()===Ze.toLowerCase()}function J(_t){var Ze=O({},_t.attributes);Ze.children=_t.children;var Vt=_t.nodeName.defaultProps;if(Vt!==void 0)for(var sn in Vt)Ze[sn]===void 0&&(Ze[sn]=Vt[sn]);return Ze}function K(_t){var Ze=_t.parentNode;Ze&&Ze.removeChild(_t)}function re(_t,Ze,Vt,sn,yn){if(Ze==="className"&&(Ze="class"),Ze!=="key")if(Ze==="ref")Vt&&Vt(null),sn&&sn(_t);else if(Ze!=="class"||yn)if(Ze==="style"){if(sn&&typeof sn!="string"&&typeof Vt!="string"||(_t.style.cssText=sn||""),sn&&typeof sn=="object"){if(typeof Vt!="string")for(var Yt in Vt)Yt in sn||(_t.style[Yt]="");for(var Yt in sn)_t.style[Yt]=typeof sn[Yt]=="number"&&M.test(Yt)===!1?sn[Yt]+"px":sn[Yt]}}else if(Ze==="dangerouslySetInnerHTML")sn&&(_t.innerHTML=sn.__html||"");else if(Ze[0]=="o"&&Ze[1]=="n"){var We=Ze!==(Ze=Ze.replace(/Capture$/,""));Ze=Ze.toLowerCase().substring(2),sn?Vt||_t.addEventListener(Ze,ce,We):_t.removeEventListener(Ze,ce,We),(_t._listeners||(_t._listeners={}))[Ze]=sn}else if(Ze!=="list"&&Ze!=="type"&&!yn&&Ze in _t)(function(He,dt,It){try{He[dt]=It}catch{}})(_t,Ze,sn??""),sn!=null&&sn!==!1||_t.removeAttribute(Ze);else{var Ye=yn&&Ze!==(Ze=Ze.replace(/^xlink:?/,""));sn==null||sn===!1?Ye?_t.removeAttributeNS("http://www.w3.org/1999/xlink",Ze.toLowerCase()):_t.removeAttribute(Ze):typeof sn!="function"&&(Ye?_t.setAttributeNS("http://www.w3.org/1999/xlink",Ze.toLowerCase(),sn):_t.setAttribute(Ze,sn))}else _t.className=sn||""}function ce(_t){return this._listeners[_t.type](s.event&&s.event(_t)||_t)}var pe=[],ke=0,Ce=!1,be=!1;function $e(){for(var _t;_t=pe.pop();)s.afterMount&&s.afterMount(_t),_t.componentDidMount&&_t.componentDidMount()}function ht(_t,Ze,Vt,sn,yn,Yt){ke++||(Ce=yn!=null&&yn.ownerSVGElement!==void 0,be=_t!=null&&!("__preactattr_"in _t));var We=Dt(_t,Ze,Vt,sn,Yt);return yn&&We.parentNode!==yn&&yn.appendChild(We),--ke||(be=!1,Yt||$e()),We}function Dt(_t,Ze,Vt,sn,yn){var Yt=_t,We=Ce;if(Ze!=null&&typeof Ze!="boolean"||(Ze=""),typeof Ze=="string"||typeof Ze=="number")return _t&&_t.splitText!==void 0&&_t.parentNode&&(!_t._component||yn)?_t.nodeValue!=Ze&&(_t.nodeValue=Ze):(Yt=document.createTextNode(Ze),_t&&(_t.parentNode&&_t.parentNode.replaceChild(Yt,_t),Ut(_t,!0))
8117),Yt.__preactattr_=!0,Yt;var Ye=Ze.nodeName;if(typeof Ye=="function")return function(Xt,En,xe,jn){for(var nr=Xt&&Xt._component,ar=nr,cr=Xt,Er=nr&&Xt._componentConstructor===En.nodeName,hn=Er,rn=J(En);nr&&!hn&&(nr=nr._parentComponent);)hn=nr.constructor===En.nodeName;return nr&&hn&&(!jn||nr._component)?(Ke(nr,rn,3,xe,jn),Xt=nr.base):(ar&&!Er&&(vt(ar),Xt=cr=null),nr=zt(En.nodeName,rn,xe),Xt&&!nr.nextBase&&(nr.nextBase=Xt,cr=null),Ke(nr,rn,1,xe,jn),Xt=nr.base,cr&&Xt!==cr&&(cr._component=null,Ut(cr,!1))),Xt}(_t,Ze,Vt,sn);if(Ce=Ye==="svg"||Ye!=="foreignObject"&&Ce,Ye=String(Ye),(!_t||!ee(_t,Ye))&&(Yt=function(Xt,En){var xe=En?document.createElementNS("http://www.w3.org/2000/svg",Xt):document.createElement(Xt);return xe.normalizedNodeName=Xt,xe}(Ye,Ce),_t)){for(;_t.firstChild;)Yt.appendChild(_t.firstChild);_t.parentNode&&_t.parentNode.replaceChild(Yt,_t),Ut(_t,!0)}var He=Yt.firstChild,dt=Yt.__preactattr_,It=Ze.children;if(dt==null){dt=Yt.__preactattr_={};for(var ct=Yt.attributes,on=ct.length;on--;)dt[ct[on].name]=ct[on].value}return!be&&It&&It.length===1&&typeof It[0]=="string"&&He!=null&&He.splitText!==void 0&&He.nextSibling==null?He.nodeValue!=It[0]&&(He.nodeValue=It[0]):(It&&It.length||He!=null)&&function(Xt,En,xe,jn,nr){var ar,cr,Er,hn,rn,fn=Xt.childNodes,Xn=[],Fn={},Ar=0,Dr=0,xr=fn.length,fi=0,ci=En?En.length:0;if(xr!==0)for(var qr=0;qr<xr;qr++){var mi=fn[qr],Ir=mi.__preactattr_,ti=ci&&Ir?mi._component?mi._component.__key:Ir.key:null;ti!=null?(Ar++,Fn[ti]=mi):(Ir||(mi.splitText!==void 0?!nr||mi.nodeValue.trim():nr))&&(Xn[fi++]=mi)}if(ci!==0)for(var qr=0;qr<ci;qr++){hn=En[qr],rn=null;var ti=hn.key;if(ti!=null)Ar&&Fn[ti]!==void 0&&(rn=Fn[ti],Fn[ti]=void 0,Ar--);else if(!rn&&Dr<fi){for(ar=Dr;ar<fi;ar++)if(Xn[ar]!==void 0&&N(cr=Xn[ar],hn,nr)){rn=cr,Xn[ar]=void 0,ar===fi-1&&fi--,ar===Dr&&Dr++;break}}rn=Dt(rn,hn,xe,jn),Er=fn[qr],rn&&rn!==Xt&&rn!==Er&&(Er==null?Xt.appendChild(rn):rn===Er.nextSibling?K(Er):Xt.insertBefore(rn,Er))}if(Ar)for(var qr in Fn)Fn[qr]!==void 0&&Ut(Fn[qr],!1);for(;Dr<=fi;)(rn=Xn[fi--])!==void 0&&Ut(rn,!1)}(Yt,It,Vt,sn,be||dt.dangerouslySetInnerHTML!=null),function(Xt,En,xe){var jn;for(jn in xe)En&&En[jn]!=null||xe[jn]==null||re(Xt,jn,xe[jn],xe[jn]=void 0,Ce);for(jn in En)jn==="children"||jn==="innerHTML"||jn in xe&&En[jn]===(jn==="value"||jn==="checked"?Xt[jn]:xe[jn])||re(Xt,jn,xe[jn],xe[jn]=En[jn],Ce)}(Yt,Ze.attributes,dt),Ce=We,Yt}function Ut(_t,Ze){var Vt=_t._component;Vt?vt(Vt):(_t.__preactattr_!=null&&_t.__preactattr_.ref&&_t.__preactattr_.ref(null),Ze!==!1&&_t.__preactattr_!=null||K(_t),Ee(_t))}function Ee(_t){for(_t=_t.lastChild;_t;){var Ze=_t.previousSibling;Ut(_t,!0),_t=Ze}}var Ot={};function zt(_t,Ze,Vt){var sn,yn=Ot[_t.name];if(_t.prototype&&_t.prototype.render?(sn=new _t(Ze,Vt),yt.call(sn,Ze,Vt)):((sn=new yt(Ze,Vt)).c
8117onstructor=_t,sn.render=Mt),yn){for(var Yt=yn.length;Yt--;)if(yn[Yt].constructor===_t){sn.nextBase=yn[Yt].nextBase,yn.splice(Yt,1);break}}return sn}function Mt(_t,Ze,Vt){return this.constructor(_t,Vt)}function Ke(_t,Ze,Vt,sn,yn){_t._disable||(_t._disable=!0,(_t.__ref=Ze.ref)&&delete Ze.ref,(_t.__key=Ze.key)&&delete Ze.key,!_t.base||yn?_t.componentWillMount&&_t.componentWillMount():_t.componentWillReceiveProps&&_t.componentWillReceiveProps(Ze,sn),sn&&sn!==_t.context&&(_t.prevContext||(_t.prevContext=_t.context),_t.context=sn),_t.prevProps||(_t.prevProps=_t.props),_t.props=Ze,_t._disable=!1,Vt!==0&&(Vt!==1&&s.syncComponentUpdates===!1&&_t.base?L(_t):Tt(_t,1,yn)),_t.__ref&&_t.__ref(_t))}function Tt(_t,Ze,Vt,sn){if(!_t._disable){var yn,Yt,We,Ye=_t.props,He=_t.state,dt=_t.context,It=_t.prevProps||Ye,ct=_t.prevState||He,on=_t.prevContext||dt,Xt=_t.base,En=_t.nextBase,xe=Xt||En,jn=_t._component,nr=!1;if(Xt&&(_t.props=It,_t.state=ct,_t.context=on,Ze!==2&&_t.shouldComponentUpdate&&_t.shouldComponentUpdate(Ye,He,dt)===!1?nr=!0:_t.componentWillUpdate&&_t.componentWillUpdate(Ye,He,dt),_t.props=Ye,_t.state=He,_t.context=dt),_t.prevProps=_t.prevState=_t.prevContext=_t.nextBase=null,_t._dirty=!1,!nr){yn=_t.render(Ye,He,dt),_t.getChildContext&&(dt=O(O({},dt),_t.getChildContext()));var ar,cr,Er=yn&&yn.nodeName;if(typeof Er=="function"){var hn=J(yn);(Yt=jn)&&Yt.constructor===Er&&hn.key==Yt.__key?Ke(Yt,hn,1,dt,!1):(ar=Yt,_t._component=Yt=zt(Er,hn,dt),Yt.nextBase=Yt.nextBase||En,Yt._parentComponent=_t,Ke(Yt,hn,0,dt,!1),Tt(Yt,1,Vt,!0)),cr=Yt.base}else We=xe,(ar=jn)&&(We=_t._component=null),(xe||Ze===1)&&(We&&(We._component=null),cr=ht(We,yn,dt,Vt||!Xt,xe&&xe.parentNode,!0));if(xe&&cr!==xe&&Yt!==jn){var rn=xe.parentNode;rn&&cr!==rn&&(rn.replaceChild(cr,xe),ar||(xe._component=null,Ut(xe,!1)))}if(ar&&vt(ar),_t.base=cr,cr&&!sn){for(var fn=_t,Xn=_t;Xn=Xn._parentComponent;)(fn=Xn).base=cr;cr._component=fn,cr._componentConstructor=fn.constructor}}if(!Xt||Vt?pe.unshift(_t):nr||(_t.componentDidUpdate&&_t.componentDidUpdate(It,ct,on),s.afterUpdate&&s.afterUpdate(_t)),_t._renderCallbacks!=null)for(;_t._renderCallbacks.length;)_t._renderCallbacks.pop().call(_t);ke||sn||$e()}}function vt(_t){s.beforeUnmount&&s.beforeUnmount(_t);var Ze=_t.base;_t._disable=!0,_t.componentWillUnmount&&_t.componentWillUnmount(),_t.base=null;var Vt=_t._component;Vt?vt(Vt):Ze&&(Ze.__preactattr_&&Ze.__preactattr_.ref&&Ze.__preactattr_.ref(null),_t.nextBase=Ze,K(Ze),function(sn){var yn=sn.constructor.name;(Ot[yn]||(Ot[yn]=[])).push(sn)}(_t),Ee(Ze)),_t.__ref&&_t.__ref(null)}function yt(_t,Ze){this._dirty=!0,this.context=Ze,this.props=_t,this.state=this.state||{}}function bt(_t,Ze,Vt){return ht(Vt,_t,{},!1,Ze,!1)}O(yt.prototype,{setState:function(_t,Ze){var Vt=this.state;this.prevState||(this.prevState=O({},Vt)),O(Vt,typeof _t=="function"?_t(Vt,this.props):_t),Ze&&(this._renderCallbacks=this._renderCallbacks||[]).push(Ze),L(this)}
8117,forceUpdate:function(_t){_t&&(this._renderCallbacks=this._renderCallbacks||[]).push(_t),Tt(this,2)},render:function(){}});var Ht={h:g,createElement:g,cloneElement:S,Component:yt,render:bt,rerender:V,options:s};i.default=Ht},function(a,i,n){/* 8118object-assign 8119(c) Sindre Sorhus 8120@license MIT 8121*/var s=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;a.exports=function(){try{if(!Object.assign)return!1;var g=new String("abc");if(g[5]="de",Object.getOwnPropertyNames(g)[0]==="5")return!1;for(var O={},A=0;A<10;A++)O["_"+String.fromCharCode(A)]=A;if(Object.getOwnPropertyNames(O).map(function(M){return O[M]}).join("")!=="0123456789")return!1;var S={};return"abcdefghijklmnopqrst".split("").forEach(function(M){S[M]=M}),Object.keys(Object.assign({},S)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}()?Object.assign:function(g,O){for(var A,S,M=function(N){if(N==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(N)}(g),P=1;P<arguments.length;P++){for(var L in A=Object(arguments[P]))h.call(A,L)&&(M[L]=A[L]);if(s){S=s(A);for(var V=0;V<S.length;V++)v.call(A,S[V])&&(M[S[V]]=A[S[V]])}}return M}},function(a,i,n){const s=n(32),h=n(113),{ANY:v}=h,g=n(47),O=n(112),A=n(114),S=n(143),M=n(141),P=n(142);a.exports=(L,V,N,ee)=>{let J,K,re,ce,pe;switch(L=new s(L,ee),V=new g(V,ee),N){case">":J=A,K=M,re=S,ce=">",pe=">=";break;case"<":J=S,K=P,re=A,ce="<",pe="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(O(L,V,ee))return!1;for(let ke=0;ke<V.set.length;++ke){let Ce=null,be=null;if(V.set[ke].forEach($e=>{$e.semver===v&&($e=new h(">=0.0.0")),Ce=Ce||$e,be=be||$e,J($e.semver,Ce.semver,ee)?Ce=$e:re($e.semver,be.semver,ee)&&(be=$e)}),Ce.operator===ce||Ce.operator===pe||(!be.operator||be.operator===ce)&&K(L,be.semver)||be.operator===pe&&re(L,be.semver))return!1}return!0}},function(a,i,n){const s=n(48);a.exports=(h,v,g)=>s(h,v,g)<=0},function(a,i,n){const s=n(48);a.exports=(h,v,g)=>s(h,v,g)>=0},function(a,i,n){const s=n(48);a.exports=(h,v,g)=>s(h,v,g)<0},function(a,i,n){const s=n(32);a.exports=(h,v,g)=>{const O=new s(h,g),A=new s(v,g);return O.compare(A)||O.compareBuild(A)}},function(a,i,n){const s=n(48);a.exports=(h,v,g)=>s(h,v,g)===0},function(a,i){const n=/^[0-9]+$/,s=(h,v)=>{const g=n.test(h),O=n.test(v);return g&&O&&(h=+h,v=+v),h===v?0:g&&!O?-1:O&&!g?1:h<v?-1:1};a.exports={compareIdentifiers:s,rcompareIdentifiers:(h,v)=>s(v,h)}},function(a,i,n){/** 8122* @license 8123* Copyright 2017 Google Inc. All Rights Reserved. 8124* Licensed under the Apache License, Version 2.0 (the "License"); 8125* you may not use this file except in compliance with the License. 8126* You may obtain a copy of the License at 8127* 8128* http://www.apache.org/licenses/LICENSE-2.0 8129* 8130* Unless required by applicable law or agreed to in writing, software 8131* distributed under the License is distributed on an "AS IS" BASIS, 8132* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8133* See the License for the specific language governing permissions and 8134* limitations under the License. 8135* ============================================================================= 8136*/Object.defineProperty(i,"__esModule",{value:!0}),i.getBroadcastDims=function(s,h){for(var v=s.length,g=[],O=0;O<v;O++){var A=v-1-O,S=s[A]||1;(h[h.length-1-O]||1)>1&&S===1&&g.unshift(A)}return g},i.getReductionAxes=function(s,h){for(var v=[],g=0;g<h.length;g++){var O=s[s.length-g-1],A=h.length-g-1,S=h[A];(O==null||O===1&&S>1)&&v.unshift(A)}return v},i.assertAndGetBroadcastShape=function(s,h){for(var v=[],g=Math.max(s.length,h.length),O=0;O<g;O++){var A=s[s.length-O-1];A==null&&(A=1);var S=h[h.length-O-1];if(S==null&&(S=1),A===1)v.unshift(S);else if(S===1)v.unshift(A);else{if(A!==S)throw Error("Operands could not be broadcast together with shapes "+s+" and "+h+".");v.unshift(A)}}return v}},function(a,i,n){a.exports=!n(208)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(a,i){a.exports=function(n){return typeof n=="object"?n!==null:typeof n=="function"}},function(a,i){var n=a.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=n)},function(a,i,n){var s=n(16),h=n(27),v=n(83),g=n(118),O=n(42),A=n(93),S=n(15),M=n(94),P=n(54),L=n(22),
vendor: 4,208 bytes, line 8136
8136V=n(213),N=n(79).f,ee=n(26).f,J=n(156),K=n(98),re="prototype",ce="Wrong index!",pe=s.ArrayBuffer,ke=s.DataView,Ce=s.Math,be=s.RangeError,$e=s.Infinity,ht=pe,Dt=Ce.abs,Ut=Ce.pow,Ee=Ce.floor,Ot=Ce.log,zt=Ce.LN2,Mt=h?"_b":"buffer",Ke=h?"_l":"byteLength",Tt=h?"_o":"byteOffset";function vt(Xt,En,xe){var jn,nr,ar,cr=new Array(xe),Er=8*xe-En-1,hn=(1<<Er)-1,rn=hn>>1,fn=En===23?Ut(2,-24)-Ut(2,-77):0,Xn=0,Fn=Xt<0||Xt===0&&1/Xt<0?1:0;for((Xt=Dt(Xt))!=Xt||Xt===$e?(nr=Xt!=Xt?1:0,jn=hn):(jn=Ee(Ot(Xt)/zt),Xt*(ar=Ut(2,-jn))<1&&(jn--,ar*=2),(Xt+=jn+rn>=1?fn/ar:fn*Ut(2,1-rn))*ar>=2&&(jn++,ar/=2),jn+rn>=hn?(nr=0,jn=hn):jn+rn>=1?(nr=(Xt*ar-1)*Ut(2,En),jn+=rn):(nr=Xt*Ut(2,rn-1)*Ut(2,En),jn=0));En>=8;cr[Xn++]=255&nr,nr/=256,En-=8);for(jn=jn<<En|nr,Er+=En;Er>0;cr[Xn++]=255&jn,jn/=256,Er-=8);return cr[--Xn]|=128*Fn,cr}function yt(Xt,En,xe){var jn,nr=8*xe-En-1,ar=(1<<nr)-1,cr=ar>>1,Er=nr-7,hn=xe-1,rn=Xt[hn--],fn=127&rn;for(rn>>=7;Er>0;fn=256*fn+Xt[hn],hn--,Er-=8);for(jn=fn&(1<<-Er)-1,fn>>=-Er,Er+=En;Er>0;jn=256*jn+Xt[hn],hn--,Er-=8);if(fn===0)fn=1-cr;else{if(fn===ar)return jn?NaN:rn?-$e:$e;jn+=Ut(2,En),fn-=cr}return(rn?-1:1)*jn*Ut(2,fn-En)}function bt(Xt){return Xt[3]<<24|Xt[2]<<16|Xt[1]<<8|Xt[0]}function Ht(Xt){return[255&Xt]}function _t(Xt){return[255&Xt,Xt>>8&255]}function Ze(Xt){return[255&Xt,Xt>>8&255,Xt>>16&255,Xt>>24&255]}function Vt(Xt){return vt(Xt,52,8)}function sn(Xt){return vt(Xt,23,4)}function yn(Xt,En,xe){ee(Xt[re],En,{get:function(){return this[xe]}})}function Yt(Xt,En,xe,jn){var nr=V(+xe);if(nr+En>Xt[Ke])throw be(ce);var ar=Xt[Mt]._b,cr=nr+Xt[Tt],Er=ar.slice(cr,cr+En);return jn?Er:Er.reverse()}function We(Xt,En,xe,jn,nr,ar){var cr=V(+xe);if(cr+En>Xt[Ke])throw be(ce);for(var Er=Xt[Mt]._b,hn=cr+Xt[Tt],rn=jn(+nr),fn=0;fn<En;fn++)Er[hn+fn]=rn[ar?fn:En-fn-1]}if(g.ABV){if(!S(function(){pe(1)})||!S(function(){new pe(-1)})||S(function(){return new pe,new pe(1.5),new pe(NaN),pe.name!="ArrayBuffer"})){for(var Ye,He=(pe=function(Xt){return M(this,pe),new ht(V(Xt))})[re]=ht[re],dt=N(ht),It=0;dt.length>It;)(Ye=dt[It++])in pe||O(pe,Ye,ht[Ye]);v||(He.constructor=pe)}var ct=new ke(new pe(2)),on=ke[re].setInt8;ct.setInt8(0,2147483648),ct.setInt8(1,2147483649),!ct.getInt8(0)&&ct.getInt8(1)||A(ke[re],{setInt8:function(Xt,En){on.call(this,Xt,En<<24>>24)},setUint8:function(Xt,En){on.call(this,Xt,En<<24>>24)}},!0)}else pe=function(Xt){M(this,pe,"ArrayBuffer");var En=V(Xt);this._b=J.call(new Array(En),0),this[Ke]=En},ke=function(Xt,En,xe){M(this,ke,"DataView"),M(Xt,pe,"DataView");var jn=Xt[Ke],nr=P(En);if(nr<0||nr>jn)throw be("Wrong offset!");if(nr+(xe=xe===void 0?jn-nr:L(xe))>jn)throw be("Wrong length!");this[Mt]=Xt,this[Tt]=nr,this[Ke]=xe},h&&(yn(pe,"byteLength","_l"),yn(ke,"buffer","_b"),yn(ke,"byteLength","_l"),yn(ke,"byteOffset","_o")),A(ke[re],{getInt8:function(Xt){return Yt(this,1,Xt)[0]<<24>>24},getUint8:function(Xt){return Yt(this,1,Xt)[0]},getInt16:function(Xt){var En=Yt(this,2,Xt,arguments[1]);return(En[1]<<8|En[0])<<16>>16},getUint16:function(Xt){var En=Yt(this,2,Xt,arguments[1]);return En[1]<<8|En[0]},getInt32:function(Xt){return bt(Yt(this,4,Xt,arguments[1]))},getUint32:function(Xt){return bt(Yt(this,4,Xt,arguments[1]))>>>0},getFloat32:function(Xt){return yt(Yt(this,4,Xt,arguments[1]),23,4)},getFloat64:function(Xt){return yt(Yt(this,8,Xt,arguments[1]),52,8)},setInt8:function(Xt,En){We(this,1,Xt,Ht,En)},setUint8:function(Xt,En){We(this,1,Xt,Ht,En)},setInt16:function(Xt,En){We(this,2,Xt,_t,En,arguments[2])},setUint16:function(Xt,En){We(this,2,Xt,_t,En,arguments[2])},setInt32:function(Xt,En){We(this,4,Xt,Ze,En,arguments[2])},setUint32:function(Xt,En){We(this,4,Xt,Ze,En,arguments[2])},setFloat32:function(Xt,En){We(this,4,Xt,sn,En,arguments[2])},setFloat64:function(Xt,En){We(this,8,Xt,Vt,En,arguments[2])}});K(pe,"ArrayBuffer"),K(ke,"DataView"),O(ke[re],g.VIEW,!0),i.ArrayBuffer=pe,i.DataView=ke},function(a,i,n){var s,h,v,g=n(56),O=n(232),A=n(171),S=n(175),M=n(16),P=M.process,L=M.setImmediate,V=M.clearImmediate,N=M.MessageChannel,ee=M.Dispatch,J=0,K={},re=function(){var pe=+this;if(K.hasOwnProperty(pe)){var ke=K[pe];delete K[pe],ke()}},ce=function(pe){re.call(pe.data)};L&&V||(L=function(pe){for(var ke=[],Ce=1;arguments.length>Ce;)ke.push(arguments[Ce++]);
8136return K[++J]=function(){O(typeof pe=="function"?pe:Function(pe),ke)},s(J),J},V=function(pe){delete K[pe]},n(62)(P)=="process"?s=function(pe){P.nextTick(g(re,pe,1))}:ee&&ee.now?s=function(pe){ee.now(g(re,pe,1))}:N?(v=(h=new N).port2,h.port1.onmessage=ce,s=g(v.postMessage,v,1)):M.addEventListener&&typeof postMessage=="function"&&!M.importScripts?(s=function(pe){M.postMessage(pe+"","*")},M.addEventListener("message",ce,!1)):s="onreadystatechange"in S("script")?function(pe){A.appendChild(S("script")).onreadystatechange=function(){A.removeChild(this),re.call(pe)}}:function(pe){setTimeout(g(re,pe,1),0)}),a.exports={set:L,clear:V}},function(a,i,n){var s=n(164)(!0);a.exports=function(h,v,g){return v+(g?s(h,v).length:1)}},function(a,i,n){var s=n(124),h=RegExp.prototype.exec,v=String.prototype.replace,g=h,O=function(){var S=/a/,M=/b*/g;return h.call(S,"a"),h.call(M,"a"),S.lastIndex!==0||M.lastIndex!==0}(),A=/()??/.exec("")[1]!==void 0;(O||A)&&(g=function(S){var M,P,L,V,N=this;return A&&(P=new RegExp("^"+N.source+"$(?!\\s)",s.call(N))),O&&(M=N.lastIndex),L=h.call(N,S),O&&L&&(N.lastIndex=N.global?L.index+L[0].length:M),A&&L&&L.length>1&&v.call(L[0],P,function(){for(V=1;V<arguments.length-2;V++)arguments[V]===void 0&&(L[V]=void 0)}),L}),a.exports=g},function(a,i,n){var s=n(77),h=n(221),v=n(96),g=n(41);a.exports=n(163)(Array,"Array",function(O,A){this._t=g(O),this._i=0,this._k=A},function(){var O=this._t,A=this._k,S=this._i++;return!O||S>=O.length?(this._t=void 0,h(1)):h(0,A=="keys"?S:A=="values"?O[S]:[S,O[S]])},"values"),v.Arguments=v.Array,s("keys"),s("values"),s("entries")},function(a,i,n){var s=n(34),h=n(81),v=n(22);a.exports=function(g){for(var O=s(this),A=v(O.length),S=arguments.length,M=h(S>1?arguments[1]:void 0,A),P=S>2?arguments[2]:void 0,L=P===void 0?A:h(P,A);L>M;)O[M++]=g;return O}},function(a,i,n){var s=n(105),h=n(19)("iterator"),v=n(96);a.exports=n(24).getIteratorMethod=function(g){if(g!=null)return g[h]||g["@@iterator"]||v[s(g)]}},function(a,i,n){var s=n(26),h=n(85);a.exports=function(v,g,O){g in v?s.f(v,g,h(0,O)):v[g]=O}},function(a,i,n){var s=n(96),h=n(19)("iterator"),v=Array.prototype;a.exports=function(g){return g!==void 0&&(s.Array===g||v[h]===g)}},function(a,i,n){var s=n(19)("match");a.exports=function(h){var v=/./;try{"/./"[h](v)}catch{try{return v[s]=!1,!"/./"[h](v)}catch{}}return!0}},function(a,i,n){var s=n(13),h=n(62),v=n(19)("match");a.exports=function(g){var O;return s(g)&&((O=g[v])!==void 0?!!O:h(g)=="RegExp")}},function(a,i,n){var s=n(161),h=n(61);a.exports=function(v,g,O){if(s(g))throw TypeError("String#"+O+" doesn't accept regex!");return String(h(v))}},function(a,i,n){var s=n(83),h=n(8),v=n(38),g=n(42),O=n(96),A=n(226),S=n(98),M=n(78),P=n(19)("iterator"),L=!([].keys&&"next"in[].keys()),V=function(){return this};a.exports=function(N,ee,J,K,re,ce,pe){A(J,ee,K);var ke,Ce,be,$e=function(Tt){if(!L&&Tt in Ee)return Ee[Tt];switch(Tt){case"keys":case"values":return function(){return new J(this,Tt)}}return function(){return new J(this,Tt)}},ht=ee+" Iterator",Dt=re=="values",Ut=!1,Ee=N.prototype,Ot=Ee[P]||Ee["@@iterator"]||re&&Ee[re],zt=Ot||$e(re),Mt=re?Dt?$e("entries"):zt:void 0,Ke=ee=="Array"&&Ee.entries||Ot;if(Ke&&(be=M(Ke.call(new N)))!==Object.prototype&&be.next&&(S(be,ht,!0),s||typeof be[P]=="function"||g(be,P,V)),Dt&&Ot&&Ot.name!=="values"&&(Ut=!0,zt=function(){return Ot.call(this)}),s&&!pe||!L&&!Ut&&Ee[P]||g(Ee,P,zt),O[ee]=zt,O[ht]=V,re)if(ke={values:Dt?zt:$e("values"),keys:ce?zt:$e("keys"),entries:Mt},pe)for(Ce in ke)Ce in Ee||v(Ee,Ce,ke[Ce]);else h(h.P+h.F*(L||Ut),ee,ke);return ke}},function(a,i,n){var s=n(54),h=n(61);a.exports=function(v){return function(g,O){var A,S,M=String(h(g)),P=s(O),L=M.length;return P<0||P>=L?v?"":void 0:(A=M.charCodeAt(P))<55296||A>56319||P+1===L||(S=M.charCodeAt(P+1))<56320||S>57343?v?M.charAt(P):A:v?M.slice(P,P+2):S-56320+(A-55296<<10)+65536}}},function(a,i){var n=Math.expm1;a.exports=!n||n(10)>22025.465794806718||n(10)<22025.465794806718||n(-2e-17)!=-2e-17?function(s){return(s=+s)==0?s:s>-1e-6&&s<1e-6?s+s*s/2:Math.exp(s)-1}:n},function(a,i){a.exports=Math.sign||function(n){return(n=+n)==0||n!=n?n:n<0?-1:1}},function(a,i,n){var s=n(54),h=n(61);a.exports=function(v){var g=String(h(this)),O="",A=s(v);if(A<0||A==1/0)throw RangeError("Count can't be negative");for(;A>0;(A>>>=1)&&(g+=g))1&A&&(O+=g);return O}},function(a,i,n){var s=n(13),h=n(170).set;a.exports=function(v,g,O){var A,S=g.constructor;return S!==O&&typeof S=="function"&&(A=S.prototype)!==O.prototype&&s(A)&&h&&h(v,A),v}},function(a,i){a.exports=` 8137\v\f\r  áá ââââââ ââââââ¯âã\u2028\u2029\uFEFF`},function(a,i,n){var s=n(13),h=n(14),v=function(g,O){if(h(g),!s(O)&&O!==null)throw TypeError(O+": can't set as prototype!")};a.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(g,O,A){try{(A=n(56)(Function.call,n(53).f(Object.prototype,"__proto__").set,2))(g,[]),O=!(g instanceof Array)}catch{O=!0}return function(S,M){return v(S,M),O?S.__proto__=M:A(S,M),S}}({},!1):void 0),check:v}},function(a,i,n){var s=n(16).document;a.exports=s&&s.documentElement},function(a,i){a.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleStr
8137ing,toString,valueOf".split(",")},function(a,i,n){var s=n(129)("keys"),h=n(84);a.exports=function(v){return s[v]||(s[v]=h(v))}},function(a,i,n){i.f=n(19)},function(a,i,n){var s=n(13),h=n(16).document,v=s(h)&&s(h.createElement);a.exports=function(g){return v?h.createElement(g):{}}},function(a,i,n){var s=function(ce){return ce},h=function(ce){if(ce==null)return s;var pe,ke,Ce=ce.scale[0],be=ce.scale[1],$e=ce.translate[0],ht=ce.translate[1];return function(Dt,Ut){Ut||(pe=ke=0);var Ee=2,Ot=Dt.length,zt=new Array(Ot);for(zt[0]=(pe+=Dt[0])*Ce+$e,zt[1]=(ke+=Dt[1])*be+ht;Ee<Ot;)zt[Ee]=Dt[Ee],++Ee;return zt}},v=function(ce){var pe,ke=h(ce.transform),Ce=1/0,be=Ce,$e=-Ce,ht=-Ce;function Dt(Ee){(Ee=ke(Ee))[0]<Ce&&(Ce=Ee[0]),Ee[0]>$e&&($e=Ee[0]),Ee[1]<be&&(be=Ee[1]),Ee[1]>ht&&(ht=Ee[1])}function Ut(Ee){switch(Ee.type){case"GeometryCollection":Ee.geometries.forEach(Ut);break;case"Point":Dt(Ee.coordinates);break;case"MultiPoint":Ee.coordinates.forEach(Dt)}}for(pe in ce.arcs.forEach(function(Ee){for(var Ot,zt=-1,Mt=Ee.length;++zt<Mt;)(Ot=ke(Ee[zt],zt))[0]<Ce&&(Ce=Ot[0]),Ot[0]>$e&&($e=Ot[0]),Ot[1]<be&&(be=Ot[1]),Ot[1]>ht&&(ht=Ot[1])}),ce.objects)Ut(ce.objects[pe]);return[Ce,be,$e,ht]},g=function(ce,pe){for(var ke,Ce=ce.length,be=Ce-pe;be<--Ce;)ke=ce[be],ce[be++]=ce[Ce],ce[Ce]=ke},O=function(ce,pe){return typeof pe=="string"&&(pe=ce.objects[pe]),pe.type==="GeometryCollection"?{type:"FeatureCollection",features:pe.geometries.map(function(ke){return A(ce,ke)})}:A(ce,pe)};function A(ce,pe){var ke=pe.id,Ce=pe.bbox,be=pe.properties==null?{}:pe.properties,$e=S(ce,pe);return ke==null&&Ce==null?{type:"Feature",properties:be,geometry:$e}:Ce==null?{type:"Feature",id:ke,properties:be,geometry:$e}:{type:"Feature",id:ke,bbox:Ce,properties:be,geometry:$e}}function S(ce,pe){var ke=h(ce.transform),Ce=ce.arcs;function be(Ee,Ot){Ot.length&&Ot.pop();for(var zt=Ce[Ee<0?~Ee:Ee],Mt=0,Ke=zt.length;Mt<Ke;++Mt)Ot.push(ke(zt[Mt],Mt));Ee<0&&g(Ot,Ke)}function $e(Ee){return ke(Ee)}function ht(Ee){for(var Ot=[],zt=0,Mt=Ee.length;zt<Mt;++zt)be(Ee[zt],Ot);return Ot.length<2&&Ot.push(Ot[0]),Ot}function Dt(Ee){for(var Ot=ht(Ee);Ot.length<4;)Ot.push(Ot[0]);return Ot}function Ut(Ee){return Ee.map(Dt)}return function Ee(Ot){var zt,Mt=Ot.type;switch(Mt){case"GeometryCollection":return{type:Mt,geometries:Ot.geometries.map(Ee)};case"Point":zt=$e(Ot.coordinates);break;case"MultiPoint":zt=Ot.coordinates.map($e);break;case"LineString":zt=ht(Ot.arcs);break;case"MultiLineString":zt=Ot.arcs.map(ht);break;case"Polygon":zt=Ut(Ot.arcs);break;case"MultiPolygon":zt=Ot.arcs.map(Ut);break;default:return null}return{type:Mt,coordinates:zt}}(pe)}var M=function(ce,pe){var ke={},Ce={},be={},$e=[],ht=-1;function Dt(Ut,Ee){for(var Ot in Ut){var zt=Ut[Ot];delete Ee[zt.start],delete zt.start,delete zt.end,zt.forEach(function(Mt){ke[Mt<0?~Mt:Mt]=1}),$e.push(zt)}}return pe.forEach(function(Ut,Ee){var Ot,zt=ce.arcs[Ut<0?~Ut:Ut];
vendor: 4,499 bytes, line 8137
8137zt.length<3&&!zt[1][0]&&!zt[1][1]&&(Ot=pe[++ht],pe[ht]=Ut,pe[Ee]=Ot)}),pe.forEach(function(Ut){var Ee,Ot,zt=function(yt){var bt,Ht=ce.arcs[yt<0?~yt:yt],_t=Ht[0];return ce.transform?(bt=[0,0],Ht.forEach(function(Ze){bt[0]+=Ze[0],bt[1]+=Ze[1]})):bt=Ht[Ht.length-1],yt<0?[bt,_t]:[_t,bt]}(Ut),Mt=zt[0],Ke=zt[1];if(Ee=be[Mt])if(delete be[Ee.end],Ee.push(Ut),Ee.end=Ke,Ot=Ce[Ke]){delete Ce[Ot.start];var Tt=Ot===Ee?Ee:Ee.concat(Ot);Ce[Tt.start=Ee.start]=be[Tt.end=Ot.end]=Tt}else Ce[Ee.start]=be[Ee.end]=Ee;else if(Ee=Ce[Ke])if(delete Ce[Ee.start],Ee.unshift(Ut),Ee.start=Mt,Ot=be[Mt]){delete be[Ot.end];var vt=Ot===Ee?Ee:Ot.concat(Ee);Ce[vt.start=Ot.start]=be[vt.end=Ee.end]=vt}else Ce[Ee.start]=be[Ee.end]=Ee;else Ce[(Ee=[Ut]).start=Mt]=be[Ee.end=Ke]=Ee}),Dt(be,Ce),Dt(Ce,be),pe.forEach(function(Ut){ke[Ut<0?~Ut:Ut]||$e.push([Ut])}),$e},P=function(ce){return S(ce,L.apply(this,arguments))};function L(ce,pe,ke){var Ce,be,$e;if(arguments.length>1)Ce=function(ht,Dt,Ut){var Ee,Ot=[],zt=[];function Mt(vt){var yt=vt<0?~vt:vt;(zt[yt]||(zt[yt]=[])).push({i:vt,g:Ee})}function Ke(vt){vt.forEach(Mt)}function Tt(vt){vt.forEach(Ke)}return function vt(yt){switch(Ee=yt,yt.type){case"GeometryCollection":yt.geometries.forEach(vt);break;case"LineString":Ke(yt.arcs);break;case"MultiLineString":case"Polygon":Tt(yt.arcs);break;case"MultiPolygon":(function(bt){bt.forEach(Tt)})(yt.arcs)}}(Dt),zt.forEach(Ut==null?function(vt){Ot.push(vt[0].i)}:function(vt){Ut(vt[0].g,vt[vt.length-1].g)&&Ot.push(vt[0].i)}),Ot}(0,pe,ke);else for(be=0,Ce=new Array($e=ce.arcs.length);be<$e;++be)Ce[be]=be;return{type:"MultiLineString",arcs:M(ce,Ce)}}var V=function(ce){return S(ce,N.apply(this,arguments))};function N(ce,pe){var ke={},Ce=[],be=[];function $e(Dt){Dt.forEach(function(Ut){Ut.forEach(function(Ee){(ke[Ee=Ee<0?~Ee:Ee]||(ke[Ee]=[])).push(Dt)})}),Ce.push(Dt)}function ht(Dt){return function(Ut){for(var Ee,Ot=-1,zt=Ut.length,Mt=Ut[zt-1],Ke=0;++Ot<zt;)Ee=Mt,Mt=Ut[Ot],Ke+=Ee[0]*Mt[1]-Ee[1]*Mt[0];return Math.abs(Ke)}(S(ce,{type:"Polygon",arcs:[Dt]}).coordinates[0])}return pe.forEach(function Dt(Ut){switch(Ut.type){case"GeometryCollection":Ut.geometries.forEach(Dt);break;case"Polygon":$e(Ut.arcs);break;case"MultiPolygon":Ut.arcs.forEach($e)}}),Ce.forEach(function(Dt){if(!Dt._){var Ut=[],Ee=[Dt];for(Dt._=1,be.push(Ut);Dt=Ee.pop();)Ut.push(Dt),Dt.forEach(function(Ot){Ot.forEach(function(zt){ke[zt<0?~zt:zt].forEach(function(Mt){Mt._||(Mt._=1,Ee.push(Mt))})})})}}),Ce.forEach(function(Dt){delete Dt._}),{type:"MultiPolygon",arcs:be.map(function(Dt){var Ut,Ee=[];if(Dt.forEach(function(Tt){Tt.forEach(function(vt){vt.forEach(function(yt){ke[yt<0?~yt:yt].length<2&&Ee.push(yt)})})}),(Ut=(Ee=M(ce,Ee)).length)>1)for(var Ot,zt,Mt=1,Ke=ht(Ee[0]);Mt<Ut;++Mt)(Ot=ht(Ee[Mt]))>Ke&&(zt=Ee[0],Ee[0]=Ee[Mt],Ee[Mt]=zt,Ke=Ot);return Ee}).filter(function(Dt){return Dt.length>0})}}var ee=function(ce,pe){for(var ke=0,Ce=ce.length;ke<Ce;){var be=ke+Ce>>>1;ce[be]<pe?ke=be+1:Ce=be}return ke},J=function(ce){var pe={},ke=ce.map(function(){return[]});function Ce(Tt,vt){Tt.forEach(function(yt){yt<0&&(yt=~yt);var bt=pe[yt];bt?bt.push(vt):pe[yt]=[vt]})}function be(Tt,vt){Tt.forEach(function(yt){Ce(yt,vt)})}var $e={LineString:Ce,MultiLineString:be,Polygon:be,MultiPolygon:function(Tt,vt){Tt.forEach(function(yt){be(yt,vt)})}};for(var ht in ce.forEach(function Tt(vt,yt){vt.type==="GeometryCollection"?vt.geometries.forEach(function(bt){Tt(bt,yt)}):vt.type in $e&&$e[vt.type](vt.arcs,yt)}),pe)for(var Dt=pe[ht],Ut=Dt.length,Ee=0;Ee<Ut;++Ee)for(var Ot=Ee+1;Ot<Ut;++Ot){var zt,Mt=Dt[Ee],Ke=Dt[Ot];(zt=ke[Mt])[ht=ee(zt,Ke)]!==Ke&&zt.splice(ht,0,Ke),(zt=ke[Ke])[ht=ee(zt,Mt)]!==Mt&&zt.splice(ht,0,Mt)}return ke},K=function(ce){if(ce==null)return s;var pe,ke,Ce=ce.scale[0],be=ce.scale[1],$e=ce.translate[0],ht=ce.translate[1];return function(Dt,Ut){Ut||(pe=ke=0);var Ee=2,Ot=Dt.length,zt=new Array(Ot),Mt=Math.round((Dt[0]-$e)/Ce),Ke=Math.round((Dt[1]-ht)/be);for(zt[0]=Mt-pe,pe=Mt,zt[1]=Ke-ke,ke=Ke;Ee<Ot;)zt[Ee]=Dt[Ee],++Ee;return zt}},re=function(ce,pe){if(ce.transform)throw new Error("already quantized");if(pe&&pe.scale)Dt=ce.bbox;else{if(!((ke=Math.floor(pe))>=2))throw new Error("n must be â¥2");var ke,Ce=(Dt=ce.bbox||v(ce))[0],be=Dt[1],$e=Dt[2],ht=Dt[3];pe={scale:[$e-Ce?($e-Ce)/(ke-1):1,ht-be?(ht-be)/(ke-1):1],translate:[Ce,be]}}var Dt,Ut,Ee=K(pe),Ot=ce.objects,zt={};function Mt(Tt){return Ee(Tt)}function Ke(Tt){var vt;switch(Tt.type){case"GeometryCollection":vt={type:"GeometryCollection",geometries:Tt.geometries.map(Ke)};break;
8137case"Point":vt={type:"Point",coordinates:Mt(Tt.coordinates)};break;case"MultiPoint":vt={type:"MultiPoint",coordinates:Tt.coordinates.map(Mt)};break;default:return Tt}return Tt.id!=null&&(vt.id=Tt.id),Tt.bbox!=null&&(vt.bbox=Tt.bbox),Tt.properties!=null&&(vt.properties=Tt.properties),vt}for(Ut in Ot)zt[Ut]=Ke(Ot[Ut]);return{type:"Topology",bbox:Dt,transform:pe,objects:zt,arcs:ce.arcs.map(function(Tt){var vt,yt=0,bt=1,Ht=Tt.length,_t=new Array(Ht);for(_t[0]=Ee(Tt[0],0);++yt<Ht;)((vt=Ee(Tt[yt],yt))[0]||vt[1])&&(_t[bt++]=vt);return bt===1&&(_t[bt++]=[0,0]),_t.length=bt,_t})}};n.d(i,!1,function(){return v}),n.d(i,"a",function(){return O}),n.d(i,"b",function(){return P}),n.d(i,!1,function(){return L}),n.d(i,!1,function(){return V}),n.d(i,!1,function(){return N}),n.d(i,!1,function(){return J}),n.d(i,!1,function(){return re}),n.d(i,!1,function(){return h}),n.d(i,!1,function(){return K})},function(a,i,n){(function(s,h){function v(){return typeof s=="object"&&a!==void 0&&h!==void 0&&!!h.version}n.d(i,"a",function(){return v})}).call(this,n(59),n(75))},function(a,i,n){(function(s){n.d(i,"a",function(){return g});var h=n(5),v=n(131);function g(){var O=s.Canvas||s.HTMLCanvasElement,A=s.Image||s.HTMLImageElement,S=s.fetch||function(){throw new Error("fetch - missing fetch implementation for nodejs environment")},M=Object(v.a)();return Object(h.a)({Canvas:O||function(){return function(){}}(),CanvasRenderingContext2D:s.CanvasRenderingContext2D||function(){return function(){}}(),Image:A||function(){return function(){}}(),ImageData:s.ImageData||function(){return function(){}}(),Video:s.HTMLVideoElement||function(){return function(){}}(),createCanvasElement:function(){if(O)return new O;throw new Error("createCanvasElement - missing Canvas implementation for nodejs environment")},createImageElement:function(){if(A)return new A;throw new Error("createImageElement - missing Image implementation for nodejs environment")},fetch:S},M)}}).call(this,n(59))},function(a,i,n){const s=n(90);a.exports={re:s.re,src:s.src,tokens:s.t,SEMVER_SPEC_VERSION:n(117).SEMVER_SPEC_VERSION,SemVer:n(32),compareIdentifiers:n(146).compareIdentifiers,rcompareIdentifiers:n(146).rcompareIdentifiers,parse:n(89),valid:n(348),clean:n(347),inc:n(346),diff:n(345),major:n(344),minor:n(343),patch:n(342),prerelease:n(341),compare:n(48),rcompare:n(340),compareLoose:n(339),compareBuild:n(144),sort:n(338),rsort:n(337),gt:n(114),lt:n(143),eq:n(145),neq:n(204),gte:n(142),lte:n(141),cmp:n(203),coerce:n(336),Comparator:n(113),Range:n(47),satisfies:n(112),toComparators:n(332),maxSatisfying:n(331),minSatisfying:n(330),minVersion:n(329),validRange:n(328),outside:n(140),gtr:n(327),ltr:n(326),intersects:n(325),simplifyRange:n(324),subset:n(323)}},function(a,i,n){var s=n(31),h=n(12),v=Object(s.a)(function(g){g.setUTCSeconds(0,0)},function(g,O){g.setTime(+g+O*h.c)},function(g,O){return(O-g)/h.c},function(g){return g.getUTCMinutes()});i.a=v,v.range},function(a,i,n){var s=n(31),h=n(12),v=Object(s.a)(function(g){g.setUTCMinutes(0,0,0)},function(g,O){g.setTime(+g+O*h.b)},function(g,O){return(O-g)/h.b},function(g){return g.getUTCHours()});i.a=v,v.range},function(a,i,n){var s=n(31),h=Object(s.a)(function(){},function(v,g){v.setTime(+v+g)},function(v,g){return g-v});h.every=function(v){return v=Math.floor(v),isFinite(v)&&v>0?v>1?Object(s.a)(function(g){g.setTime(Math.floor(g/v)*v)},function(g,O){g.setTime(+g+O*v)},function(g,O){return(O-g)/v}):h:null},i.a=h,h.range},function(a,i,n){var s=n(31),h=n(12),v=Object(s.a)(function(g){g.setTime(g-g.getMilliseconds()-g.getSeconds()*h.e)},function(g,O){g.setTime(+g+O*h.c)},function(g,O){return(O-g)/h.c},function(g){return g.getMinutes()});i.a=v,v.range},function(a,i,n){var s=n(31),h=n(12),v=Object(s.a)(function(g){g.setTime(g-g.getMilliseconds()-g.getSeconds()*h.e-g.getMinutes()*h.c)},function(g,O){g.setTime(+g+O*h.b)},function(g,O){return(O-g)/h.b},function(g){return g.getHours()});i.a=v,v.range},function(a,i){},function(a,i){a.exports=function(n,s){(s==null||s>n.length)&&(s=n.length);for(var h=0,v=new Array(s);h<s;h++)v[h]=n[h];return v},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){var s=n(186);a.exports=function(h,v){if(h){if(typeof h=="string")return s(h,v);var g=Object.prototype.toString.call(h).slice(8,-1);return g==="Object"&&h.constructor&&(g=h.constructor.name),g==="Map"||g==="Set"?Array.from(h):g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g)?s(h,v):void 0}},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){function s(h){this.message=h}s.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")}
8137,s.prototype.__CANCEL__=!0,a.exports=s},function(a,i,n){var s=n(36);a.exports=function(h,v){v=v||{};var g={},O=["url","method","data"],A=["headers","auth","proxy","params"],S=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],M=["validateStatus"];function P(ee,J){return s.isPlainObject(ee)&&s.isPlainObject(J)?s.merge(ee,J):s.isPlainObject(J)?s.merge({},J):s.isArray(J)?J.slice():J}function L(ee){s.isUndefined(v[ee])?s.isUndefined(h[ee])||(g[ee]=P(void 0,h[ee])):g[ee]=P(h[ee],v[ee])}s.forEach(O,function(ee){s.isUndefined(v[ee])||(g[ee]=P(void 0,v[ee]))}),s.forEach(A,L),s.forEach(S,function(ee){s.isUndefined(v[ee])?s.isUndefined(h[ee])||(g[ee]=P(void 0,h[ee])):g[ee]=P(void 0,v[ee])}),s.forEach(M,function(ee){ee in v?g[ee]=P(h[ee],v[ee]):ee in h&&(g[ee]=P(void 0,h[ee]))});var V=O.concat(A).concat(S).concat(M),N=Object.keys(h).concat(Object.keys(v)).filter(function(ee){return V.indexOf(ee)===-1});return s.forEach(N,L),g}},function(a,i,n){a.exports=function(s){return!(!s||!s.__CANCEL__)}},function(a,i,n){var s=n(193);a.exports=function(h,v,g,O,A){var S=new Error(h);return s(S,v,g,O,A)}},function(a,i,n){var s=n(36),h=n(274),v=n(273),g=n(194),O=n(272),A=n(269),S=n(268),M=n(191);a.exports=function(P){return new Promise(function(L,V){var N=P.data,ee=P.headers,J=P.responseType;s.isFormData(N)&&delete ee["Content-Type"];var K=new XMLHttpRequest;if(P.auth){var re=P.auth.username||"",ce=P.auth.password?unescape(encodeURIComponent(P.auth.password)):"";ee.Authorization="Basic "+btoa(re+":"+ce)}var pe=O(P.baseURL,P.url);function ke(){if(K){var be="getAllResponseHeaders"in K?A(K.getAllResponseHeaders()):null,$e={data:J&&J!=="text"&&J!=="json"?K.response:K.responseText,status:K.status,statusText:K.statusText,headers:be,config:P,request:K};h(L,V,$e),K=null}}if(K.open(P.method.toUpperCase(),g(pe,P.params,P.paramsSerializer),!0),K.timeout=P.timeout,"onloadend"in K?K.onloadend=ke:K.onreadystatechange=function(){K&&K.readyState===4&&(K.status!==0||K.responseURL&&K.responseURL.indexOf("file:")===0)&&setTimeout(ke)},K.onabort=function(){K&&(V(M("Request aborted",P,"ECONNABORTED",K)),K=null)},K.onerror=function(){V(M("Network Error",P,null,K)),K=null},K.ontimeout=function(){var be="timeout of "+P.timeout+"ms exceeded";P.timeoutErrorMessage&&(be=P.timeoutErrorMessage),V(M(be,P,P.transitional&&P.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",K)),K=null},s.isStandardBrowserEnv()){var Ce=(P.withCredentials||S(pe))&&P.xsrfCookieName?v.read(P.xsrfCookieName):void 0;Ce&&(ee[P.xsrfHeaderName]=Ce)}"setRequestHeader"in K&&s.forEach(ee,function(be,$e){N===void 0&&$e.toLowerCase()==="content-type"?delete ee[$e]:K.setRequestHeader($e,be)}),s.isUndefined(P.withCredentials)||(K.withCredentials=!!P.withCredentials),J&&J!=="json"&&(K.responseType=P.responseType),typeof P.onDownloadProgress=="function"&&K.addEventListener("progress",P.onDownloadProgress),typeof P.onUploadProgress=="function"&&K.upload&&K.upload.addEventListener("progress",P.onUploadProgress),P.cancelToken&&P.cancelToken.promise.then(function(be){K&&(K.abort(),V(be),K=null)}),N||(N=null),K.send(N)})}},function(a,i,n){a.exports=function(s,h,v,g,O){return s.config=h,v&&(s.code=v),s.request=g,s.response=O,s.isAxiosError=!0,s.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},s}},function(a,i,n){var s=n(36);function h(v){return encodeURIComponent(v).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}a.exports=function(v,g,O){if(!g)return v;var A;if(O)A=O(g);else if(s.isURLSearchParams(g))A=g.toString();else{var S=[];s.forEach(g,function(P,L){P!=null&&(s.isArray(P)?L+="[]":P=[P],s.forEac
8137h(P,function(V){s.isDate(V)?V=V.toISOString():s.isObject(V)&&(V=JSON.stringify(V)),S.push(h(L)+"="+h(V))}))}),A=S.join("&")}if(A){var M=v.indexOf("#");M!==-1&&(v=v.slice(0,M)),v+=(v.indexOf("?")===-1?"?":"&")+A}return v}},function(a,i,n){a.exports=function(s,h){return function(){for(var v=new Array(arguments.length),g=0;g<v.length;g++)v[g]=arguments[g];return s.apply(h,v)}}},function(a,i,n){/** 8138* @license 8139* Copyright 2018 Google LLC. All Rights Reserved. 8140* Licensed under the Apache License, Version 2.0 (the "License"); 8141* you may not use this file except in compliance with the License. 8142* You may obtain a copy of the License at 8143* 8144* http://www.apache.org/licenses/LICENSE-2.0 8145* 8146* Unless required by applicable law or agreed to in writing, software 8147* distributed under the License is distributed on an "AS IS" BASIS, 8148* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8149* See the License for the specific language governing permissions and 8150* limitations under the License. 8151* ============================================================================= 8152*/var s=this&&this.__awaiter||function(M,P,L,V){return new(L||(L=Promise))(function(N,ee){function J(ce){try{re(V.next(ce))}catch(pe){ee(pe)}}function K(ce){try{re(V.throw(ce))}catch(pe){ee(pe)}}function re(ce){ce.done?N(ce.value):new L(function(pe){pe(ce.value)}).then(J,K)}re((V=V.apply(M,P||[])).next())})},h=this&&this.__importDefault||function(M){return M&&M.__esModule?M:{default:M}};Object.defineProperty(i,"__esModule",{value:!0});const v=h(n(88)),g=n(64),O=n(111),A=n(46);i.linechart=function(M,P,L={}){return s(this,void 0,void 0,function*(){const V=Array.isArray(P.values[0])?P.values:[P.values],N=V[0].length,ee=P.series?P.series:V.map((Ce,be)=>`Series ${be+1}`);O.assert(ee.length===V.length,"Must have an equal number of series labels as there are data series"),L.seriesColors!=null&&O.assert(L.seriesColors.length===V.length,"Must have an equal number of series colors as there are data series");const J=[];for(let Ce=0;Ce<N;Ce++){const be={x:Ce};ee.forEach(($e,ht)=>{const Dt=V[ht][Ce].y;be[$e]=Dt,be[`${$e}-name`]=$e}),J.push(be)}const K=Object.assign({},S,L),re={x:{field:"x",type:K.xType,title:K.xLabel},tooltip:[{field:"x",type:"quantitative"},...ee.map(Ce=>({field:Ce,type:"quantitative"}))]},ce=ee.map(Ce=>({data:void 0,mark:{type:"line",clip:!0},encoding:{y:{field:Ce,type:K.yType,title:K.yLabel,scale:K.zoomToFit?{zero:!1}:K.yAxisDomain!=null?{domain:K.yAxisDomain}:void 0},color:{field:`${Ce}-name`,type:"nominal",legend:{values:ee,title:null},scale:{range:K.seriesColors}}}})),pe=A.getDrawArea(M),ke={width:K.width||g.getDefaultWidth(pe),height:K.height||g.getDefaultHeight(pe),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:K.fontSize,titleFontSize:K.fontSize},text:{fontSize:K.fontSize},legend:{labelFontSize:K.fontSize,titleFontSize:K.fontSize}},data:{values:J},encoding:re,layer:[...ce,{mark:"rule",selection:{hover:{type:"single",on:"mouseover",nearest:!0,clear:"mouseout"}},encoding:{color:{value:"grey",condition:{selection:{not:"hover"},value:"transparent"}}}}]};return yield v.default(pe,ke,{actions:!1,mode:"vega-lite",defaultStyle:!1}),Promise.resolve()})};const S={xLabel:"x",yLabel:"y",xType:"quantitative",yType:"quantitative",zoomToFit:!1,fontSize:11}},function(a,i,n){/** 8153* @license 8154* Copyright 2018 Google LLC. All Rights Reserved. 8155* Licensed under the Apache License, Version 2.0 (the "License"); 8156* you may not use this file except in compliance with the License. 8157* You may obtain a copy of the License at 8158* 8159* http://www.apache.org/licenses/LICENSE-2.0 8160* 8161* Unless required by applicable law or agreed to in writing, software 8162* distributed under the License is distributed on an "AS IS" BASIS, 8163* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8164* See the License for the specific language governing permissions and 8165* limitations under the License. 8166* ============================================================================= 8167*/Object.defineProperty(i,"__esModule",{value:!0});const s=n(292);let h;const v="Visor",g="tfjs-visor-container";i.visor=function(){if(typeof document>"u")throw new Error("No document defined. This library needs a browser/dom to work");if(document.getElementById(g)&&h!=null)return h;let A,S=document.getElementById(g);function M(V,N){let ee=null;return A=s.VisorComponent.render(V,A,{ref:J=>ee=J,surfaceList:Array.from(N.values())}),ee}S==null&&((S=document.createElement("div")).id=g,document.body.appendChild(S));const P=new Map,L=M(S,P);return h=new O(L,S,P,M)};class O{constructor(S,M,P,L){this.visorComponent=S,this.el=M,this.surfaceList=P,this.renderVisor=L}surface(S){const{name:M}=S,P=S.tab==null?v:S.tab;
8167if(M==null||!(typeof M=="string"||M instanceof String))throw new Error("You must pass a config object with a 'name' property to create or retrieve a surface");const L=Object.assign({},S,{tab:P}),V=`${M}-${P}`;return this.surfaceList.has(V)||this.surfaceList.set(V,L),this.renderVisor(this.el,this.surfaceList),this.visorComponent.getSurface(M,P)}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(S){if(!this.visorComponent.state.tabs.has(S))throw new Error(`Tab '${S}' does not exist`);this.visorComponent.setState({activeTab:S})}}i.Visor=O},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.isSurfaceInfo=function(s){return s.name!=null},i.isSurface=function(s){return s.drawArea instanceof HTMLElement}},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(s){return s.charAt(0).toUpperCase()+s.slice(1)},a.exports=i.default},function(a,i,n){var s=n(315);a.exports=s},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.processStyleName=void 0,i.createMarkupForStyles=function(A,S){var M="";for(var P in A){var L=P.indexOf("--")===0;if(A.hasOwnProperty(P)&&P!=="label"){var V=A[P];V!=null&&(L?M+=P+":"+V+";":(M+=O(P)+":",M+=(0,s.default)(P,V,S)+";"))}}return M||null},g(n(319));var s=g(n(317)),h=g(n(314)),v=g(n(312));g(n(200));function g(A){return A&&A.__esModule?A:{default:A}}var O=i.processStyleName=(0,v.default)(h.default)},function(a,i,n){n.r(i),n.d(i,"default",function(){return g}),n.d(i,"point",function(){return O});var s=n(null),h=n(null),v=n(null);function g(){var A,S,M=Object(v.a)().unknown(void 0),P=M.domain,L=M.range,V=0,N=1,ee=!1,J=0,K=0,re=.5;function ce(){var pe=P().length,ke=N<V,Ce=ke?N:V,be=ke?V:N;A=(be-Ce)/Math.max(1,pe-J+2*K),ee&&(A=Math.floor(A)),Ce+=(be-Ce-A*(pe-J))*re,S=A*(1-J),ee&&(Ce=Math.round(Ce),S=Math.round(S));var $e=Object(s.a)(pe).map(function(ht){return Ce+A*ht});return L(ke?$e.reverse():$e)}return delete M.unknown,M.domain=function(pe){return arguments.length?(P(pe),ce()):P()},M.range=function(pe){return arguments.length?([V,N]=pe,V=+V,N=+N,ce()):[V,N]},M.rangeRound=function(pe){return[V,N]=pe,V=+V,N=+N,ee=!0,ce()},M.bandwidth=function(){return S},M.step=function(){return A},M.round=function(pe){return arguments.length?(ee=!!pe,ce()):ee},M.padding=function(pe){return arguments.length?(J=Math.min(1,K=+pe),ce()):J},M.paddingInner=function(pe){return arguments.length?(J=Math.min(1,pe),ce()):J},M.paddingOuter=function(pe){return arguments.length?(K=+pe,ce()):K},M.align=function(pe){return arguments.length?(re=Math.max(0,Math.min(1,pe)),ce()):re},M.copy=function(){return g(P(),[V,N]).round(ee).paddingInner(J).paddingOuter(K).align(re)},h.a.apply(ce(),arguments)}function O(){return function A(S){var M=S.copy;return S.padding=S.paddingOuter,delete S.paddingInner,delete S.paddingOuter,S.copy=function(){return A(M())},S}(g.apply(null,arguments).paddingInner(1))}},function(a,i,n){const s=n(145),h=n(204),v=n(114),g=n(142),O=n(143),A=n(141);a.exports=(S,M,P,L)=>{switch(M){case"===":return typeof S=="object"&&(S=S.version),typeof P=="object"&&(P=P.version),S===P;case"!==":return typeof S=="object"&&(S=S.version),typeof P=="object"&&(P=P.version),S!==P;case"":case"=":case"==":return s(S,P,L);case"!=":return h(S,P,L);case">":return v(S,P,L);case">=":return g(S,P,L);case"<":return O(S,P,L);case"<=":return A(S,P,L);default:throw new TypeError(`Invalid operator: ${M}`)}}},function(a,i,n){const s=n(48);a.exports=(h,v,g)=>s(h,v,g)!==0},function(a,i,n){/** 8168* @license 8169* Copyright 2020 Google Inc. All Rights Reserved. 8170* Licensed under the Apache License, Version 2.0 (the "License"); 8171* you may not use this file except in compliance with the License. 8172* You may obtain a copy of the License at 8173* 8174* http://www.apache.org/licenses/LICENSE-2.0 8175* 8176* Unless required by applicable law or agreed to in writing, softw
8176are 8177* distributed under the License is distributed on an "AS IS" BASIS, 8178* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8179* See the License for the specific language governing permissions and 8180* limitations under the License. 8181* ============================================================================= 8182*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(73),v=n(74),g=n(29),O=n(374),A=n(28);i.div=A.op({div_:function(S,M){var P,L=g.convertToTensor(S,"a","div"),V=g.convertToTensor(M,"b","div");if(P=v.makeTypesMatch(L,V),L=P[0],V=P[1],L.dtype==="int32"&&V.dtype==="int32")return O.floorDiv(L,V);var N={a:L,b:V};return s.ENGINE.runKernelFunc(function(ee,J){var K=ee.realDivide(L,V);return J([L,V]),K},N,null,h.Div,{})}})},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});/** 8183 * @license 8184 * Copyright 2020 Google Inc. All Rights Reserved. 8185 * Licensed under the Apache License, Version 2.0 (the "License"); 8186 * you may not use this file except in compliance with the License. 8187 * You may obtain a copy of the License at 8188 * 8189 * http://www.apache.org/licenses/LICENSE-2.0 8190 * 8191 * Unless required by applicable law or agreed to in writing, software 8192 * distributed under the License is distributed on an "AS IS" BASIS, 8193 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8194 * See the License for the specific language governing permissions and 8195 * limitations under the License. 8196 * ============================================================================= 8197 */var s=n(25),h=n(73),v=n(74),g=n(29),O=n(28);i.add=O.op({add_:function(A,S){var M,P=g.convertToTensor(A,"a","add"),L=g.convertToTensor(S,"b","add");M=v.makeTypesMatch(P,L),P=M[0],L=M[1];var V={a:P,b:L};return s.ENGINE.runKernelFunc(function(N,ee){var J=N.add(P,L);return ee([P,L]),J},V,null,h.Add)}})},function(a,i,n){(function(s){var h=s!==void 0&&s||typeof self<"u"&&self||window,v=Function.prototype.apply;function g(O,A){this._id=O,this._clearFn=A}i.setTimeout=function(){return new g(v.call(setTimeout,h,arguments),clearTimeout)},i.setInterval=function(){return new g(v.call(setInterval,h,arguments),clearInterval)},i.clearTimeout=i.clearInterval=function(O){O&&O.close()},g.prototype.unref=g.prototype.ref=function(){},g.prototype.close=function(){this._clearFn.call(h,this._id)},i.enroll=function(O,A){clearTimeout(O._idleTimeoutId),O._idleTimeout=A},i.unenroll=function(O){clearTimeout(O._idleTimeoutId),O._idleTimeout=-1},i._unrefActive=i.active=function(O){clearTimeout(O._idleTimeoutId);var A=O._idleTimeout;A>=0&&(O._idleTimeoutId=setTimeout(function(){O._onTimeout&&O._onTimeout()},A))},n(391),i.setImmediate=typeof self<"u"&&self.setImmediate||s!==void 0&&s.setImmediate||this&&this.setImmediate,i.clearImmediate=typeof self<"u"&&self.clearImmediate||s!==void 0&&s.clearImmediate||this&&this.clearImmediate}).call(this,n(59))},function(a,i){a.exports=function(n){try{return!!n()}catch{return!0}}},function(a,i){var n=a.exports={version:"2.6.12"};typeof __e=="number"&&(__e=n)},function(a,i,n){var s=n(27),h=n(82),v=n(41),g=n(106).f;a.exports=function(O){return function(A){for(var S,M=v(A),P=h(M),L=P.length,V=0,N=[];L>V;)S=P[V++],s&&!g.call(M,S)||N.push(O?[S,M[S]]:M[S]);return N}}},function(a,i,n){var s=n(22),h=n(167),v=n(61);a.exports=function(g,O,A,S){var M=String(v(g)),P=M.length,L=A===void 0?" ":String(A),V=s(O);if(V<=P||L=="")return M;var N=V-P,ee=h.call(L,Math.ceil(N/L.length));return ee.length>N&&(ee=ee.slice(0,N)),S?ee+M:M+ee}},function(a,i,n){var s=n(79),h=n(127),v=n(14),g=n(16).Reflect;a.exports=g&&g.ownKeys||function(O){var A=s.f(v(O)),S=h.f;return S?A.concat(S(O)):A}},function(a,i,n){var s=n(54),h=n(22);a.exports=function(v){if(v===void 0)return 0;var g=s(v),O=h(g);if(g!==O)throw RangeError("Wrong length!");return O}},function(a,i,n){var s=n(93),h=n(65).getWeak,v=n(14),g=n(13),O=n(94),A=n(121),S=n(51),M=n(43),P=n(76),L=S(5),V=S(6),N=0,ee=function(re){return re._l||(re._l=new J)},J=function(){this.a=[]},K=function(re,ce){return L(re.a,function(pe){return pe[0]===ce})};J.prototype={get:function(re){var ce=K(this,re);if(ce)return ce[1]},has:function(re){return!!K(this,re)},set:function(re,ce){var pe=K(this,re);pe?pe[1]=ce:this.a.push([re,ce])},delete:function(re){var ce=V(this.a,function(pe){return pe[0]===re});return~ce&&this.a.splice(ce,1),!!~ce}},a.exports={getConstructor:function(re,ce,pe,ke){var Ce=re(function(be,$e){O(be,Ce,ce,"_i"),be._t=ce,be._i=N++,be._l=void 0,$e!=null&&A($e,pe,be[ke],be)});return s(Ce.prototype,{delete:function(be){if(!g(be))return!1;var $e=h(be);return $e===!0?ee(P(this,ce)).delete(be):$e&&M($e,this._i)&&delete $e[this._i]},has:function(be){if(!g(be))return!1;var $e=h(be);return $e===!0?ee(P(this,ce)).has(be):$e&&M($e,this._i)}}),Ce},def:function(re,ce,pe){var ke=h(v(ce),!0);return ke===!0?ee(re).set(ce,pe):ke[re._i]=pe,re},ufstore:ee}},function(a,i,n){var s=n(26).f,h=n(80),v=n(93),g=n(56),O=n(94),A=n(121
vendor: 5,434 bytes, line 8197
8197),S=n(163),M=n(221),P=n(95),L=n(27),V=n(65).fastKey,N=n(76),ee=L?"_s":"size",J=function(K,re){var ce,pe=V(re);if(pe!=="F")return K._i[pe];for(ce=K._f;ce;ce=ce.n)if(ce.k==re)return ce};a.exports={getConstructor:function(K,re,ce,pe){var ke=K(function(Ce,be){O(Ce,ke,re,"_i"),Ce._t=re,Ce._i=h(null),Ce._f=void 0,Ce._l=void 0,Ce[ee]=0,be!=null&&A(be,ce,Ce[pe],Ce)});return v(ke.prototype,{clear:function(){for(var Ce=N(this,re),be=Ce._i,$e=Ce._f;$e;$e=$e.n)$e.r=!0,$e.p&&($e.p=$e.p.n=void 0),delete be[$e.i];Ce._f=Ce._l=void 0,Ce[ee]=0},delete:function(Ce){var be=N(this,re),$e=J(be,Ce);if($e){var ht=$e.n,Dt=$e.p;delete be._i[$e.i],$e.r=!0,Dt&&(Dt.n=ht),ht&&(ht.p=Dt),be._f==$e&&(be._f=ht),be._l==$e&&(be._l=Dt),be[ee]--}return!!$e},forEach:function(Ce){N(this,re);for(var be,$e=g(Ce,arguments.length>1?arguments[1]:void 0,3);be=be?be.n:this._f;)for($e(be.v,be.k,this);be&&be.r;)be=be.p},has:function(Ce){return!!J(N(this,re),Ce)}}),L&&s(ke.prototype,"size",{get:function(){return N(this,re)[ee]}}),ke},def:function(K,re,ce){var pe,ke,Ce=J(K,re);return Ce?Ce.v=ce:(K._l=Ce={i:ke=V(re,!0),k:re,v:ce,p:pe=K._l,n:void 0,r:!1},K._f||(K._f=Ce),pe&&(pe.n=Ce),K[ee]++,ke!=="F"&&(K._i[ke]=Ce)),K},getEntry:J,setStrong:function(K,re,ce){S(K,re,function(pe,ke){this._t=N(pe,re),this._k=ke,this._l=void 0},function(){for(var pe=this._k,ke=this._l;ke&&ke.r;)ke=ke.p;return this._t&&(this._l=ke=ke?ke.n:this._t._f)?M(0,pe=="keys"?ke.k:pe=="values"?ke.v:[ke.k,ke.v]):(this._t=void 0,M(1))},ce?"entries":"values",!ce,!0),P(re)}}},function(a,i,n){var s=n(14),h=n(13),v=n(217);a.exports=function(g,O){if(s(g),h(O)&&O.constructor===g)return O;var A=v.f(g);return(0,A.resolve)(O),A.promise}},function(a,i,n){var s=n(55);a.exports.f=function(h){return new function(v){var g,O;this.promise=new v(function(A,S){if(g!==void 0||O!==void 0)throw TypeError("Bad Promise constructor");g=A,O=S}),this.resolve=s(g),this.reject=s(O)}(h)}},function(a,i,n){var s,h,v,g,O=n(83),A=n(16),S=n(56),M=n(105),P=n(8),L=n(13),V=n(55),N=n(94),ee=n(121),J=n(104),K=n(152).set,re=n(466)(),ce=n(217),pe=n(465),ke=n(120),Ce=n(216),be=A.TypeError,$e=A.process,ht=$e&&$e.versions,Dt=ht&&ht.v8||"",Ut=A.Promise,Ee=M($e)=="process",Ot=function(){},zt=h=ce.f,Mt=!!function(){try{var Ze=Ut.resolve(1),Vt=(Ze.constructor={})[n(19)("species")]=function(sn){sn(Ot,Ot)};return(Ee||typeof PromiseRejectionEvent=="function")&&Ze.then(Ot)instanceof Vt&&Dt.indexOf("6.6")!==0&&ke.indexOf("Chrome/66")===-1}catch{}}(),Ke=function(Ze){var Vt;return!(!L(Ze)||typeof(Vt=Ze.then)!="function")&&Vt},Tt=function(Ze,Vt){if(!Ze._n){Ze._n=!0;var sn=Ze._c;re(function(){for(var yn=Ze._v,Yt=Ze._s==1,We=0,Ye=function(He){var dt,It,ct,on=Yt?He.ok:He.fail,Xt=He.resolve,En=He.reject,xe=He.domain;try{on?(Yt||(Ze._h==2&&bt(Ze),Ze._h=1),on===!0?dt=yn:(xe&&xe.enter(),dt=on(yn),xe&&(xe.exit(),ct=!0)),dt===He.promise?En(be("Promise-chain cycle")):(It=Ke(dt))?It.call(dt,Xt,En):Xt(dt)):En(yn)}catch(jn){xe&&!ct&&xe.exit(),En(jn)}};sn.length>We;)Ye(sn[We++]);Ze._c=[],Ze._n=!1,Vt&&!Ze._h&&vt(Ze)})}},vt=function(Ze){K.call(A,function(){var Vt,sn,yn,Yt=Ze._v,We=yt(Ze);if(We&&(Vt=pe(function(){Ee?$e.emit("unhandledRejection",Yt,Ze):(sn=A.onunhandledrejection)?sn({promise:Ze,reason:Yt}):(yn=A.console)&&yn.error&&yn.error("Unhandled promise rejection",Yt)}),Ze._h=Ee||yt(Ze)?2:1),Ze._a=void 0,We&&Vt.e)throw Vt.v})},yt=function(Ze){return Ze._h!==1&&(Ze._a||Ze._c).length===0},bt=function(Ze){K.call(A,function(){var Vt;Ee?$e.emit("rejectionHandled",Ze):(Vt=A.onrejectionhandled)&&Vt({promise:Ze,reason:Ze._v})})},Ht=function(Ze){var Vt=this;Vt._d||(Vt._d=!0,(Vt=Vt._w||Vt)._v=Ze,Vt._s=2,Vt._a||(Vt._a=Vt._c.slice()),Tt(Vt,!0))},_t=function(Ze){var Vt,sn=this;if(!sn._d){sn._d=!0,sn=sn._w||sn;try{if(sn===Ze)throw be("Promise can't be resolved itself");(Vt=Ke(Ze))?re(function(){var yn={_w:sn,_d:!1};try{Vt.call(Ze,S(_t,yn,1),S(Ht,yn,1))}catch(Yt){Ht.call(yn,Yt)}}):(sn._v=Ze,sn._s=1,Tt(sn,!1))}catch(yn){Ht.call({_w:sn,_d:!1},yn)}}};Mt||(Ut=function(Ze){N(this,Ut,"Promise","_h"),V(Ze),s.call(this);try{Ze(S(_t,this,1),S(Ht,this,1))}catch(Vt){Ht.call(this,Vt)}},(s=function(Ze){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(93)(Ut.prototype,{then:function(Ze,Vt){var sn=zt(J(this,Ut));return sn.ok=typeof Ze!="function"||Ze,sn.fail=typeof Vt=="function"&&Vt,sn.domain=Ee?$e.domain:void 0,this._c.push(sn),this._a&&this._a.push(sn),this._s&&Tt(this,!1),sn.promise},catch:function(Ze){return this.then(void 0,Ze)}}),v=function(){var Ze=new s;this.promise=Ze,this.resolve=S(_t,Ze,1),this.reject=S(Ht,Ze,1)},ce.f=zt=function(Ze){return Ze===Ut||Ze===g?new v(Ze):h(Ze)}),P(P.G+P.W+P.F*!Mt,{Promise:Ut}),n(98)(Ut,"Promise"),n(95)("Promise"),g=n(24).Promise,P(P.S+P.F*!Mt,"Promise",{reject:function(Ze){var Vt=zt(this);return(0,Vt.reject)(Ze),Vt.promise}}),P(P.S+P.F*(O||!Mt),"Promise",{resolve:function(Ze){return Ce(O&&this===g?Ut:this,Ze)}}),P(P.S+P.F*!(Mt&&n(125)(function(Ze){Ut.all(Ze).catch(Ot)})),"Promise",{all:function(Ze){var Vt=this,sn=zt(Vt),yn=sn.resolve,Yt=sn.reject,We=pe(function(){var Ye=[],He=0,dt=1;ee(Ze,!1,function(It){var ct=He++,on=!1;Ye.push(void 0),dt++,Vt.resolve(It).then(function(Xt){on||(on=!0,Ye[ct]=Xt,--dt||yn(Ye))},Yt)}),--dt||yn(Ye)});return We.e&&Yt(We.v),sn.promise},race:function(Ze){var Vt=this,sn=zt(Vt),yn=sn.reject,Yt=pe(function(){ee(Ze,!1,function(We){Vt.resolve(We).then(sn.resolve,yn)})});return Yt.e&&yn(Yt.v),sn.promise}})}
8197,function(a,i,n){n(27)&&/./g.flags!="g"&&n(26).f(RegExp.prototype,"flags",{configurable:!0,get:n(124)})},function(a,i,n){var s=n(154);n(8)({target:"RegExp",proto:!0,forced:s!==/./.exec},{exec:s})},function(a,i){a.exports=function(n,s){return{value:s,done:!!n}}},function(a,i,n){var s=n(34),h=n(81),v=n(22);a.exports=[].copyWithin||function(g,O){var A=s(this),S=v(A.length),M=h(g,S),P=h(O,S),L=arguments.length>2?arguments[2]:void 0,V=Math.min((L===void 0?S:h(L,S))-P,S-M),N=1;for(P<M&&M<P+V&&(N=-1,P+=V-1,M+=V-1);V-- >0;)P in A?A[M]=A[P]:delete A[M],M+=N,P+=N;return A}},function(a,i,n){var s=n(55),h=n(34),v=n(107),g=n(22);a.exports=function(O,A,S,M,P){s(A);var L=h(O),V=v(L),N=g(L.length),ee=P?N-1:0,J=P?-1:1;if(S<2)for(;;){if(ee in V){M=V[ee],ee+=J;break}if(ee+=J,P?ee<0:N<=ee)throw TypeError("Reduce of empty array with no initial value")}for(;P?ee>=0:N>ee;ee+=J)ee in V&&(M=A(M,V[ee],ee,L));return M}},function(a,i,n){var s=n(486);a.exports=function(h,v){return new(s(h))(v)}},function(a,i,n){var s=n(14);a.exports=function(h,v,g,O){try{return O?v(s(g)[0],g[1]):v(g)}catch(S){var A=h.return;throw A!==void 0&&s(A.call(h)),S}}},function(a,i,n){var s=n(80),h=n(85),v=n(98),g={};n(42)(g,n(19)("iterator"),function(){return this}),a.exports=function(O,A,S){O.prototype=s(g,{next:h(1,S)}),v(O,A+" Iterator")}},function(a,i){a.exports=Math.log1p||function(n){return(n=+n)>-1e-8&&n<1e-8?n-n*n/2:Math.log(1+n)}},function(a,i,n){var s=n(13),h=Math.floor;a.exports=function(v){return!s(v)&&isFinite(v)&&h(v)===v}},function(a,i,n){var s=n(62);a.exports=function(h,v){if(typeof h!="number"&&s(h)!="Number")throw TypeError(v);return+h}},function(a,i,n){var s=n(16).parseFloat,h=n(97).trim;a.exports=1/s(n(169)+"-0")!=-1/0?function(v){var g=h(String(v),3),O=s(g);return O===0&&g.charAt(0)=="-"?-0:O}:s},function(a,i,n){var s=n(16).parseInt,h=n(97).trim,v=n(169),g=/^[-+]?0[xX]/;a.exports=s(v+"08")!==8||s(v+"0x16")!==22?function(O,A){var S=h(String(O),3);return s(S,A>>>0||(g.test(S)?16:10))}:s},function(a,i){a.exports=function(n,s,h){var v=h===void 0;switch(s.length){case 0:return v?n():n.call(h);case 1:return v?n(s[0]):n.call(h,s[0]);case 2:return v?n(s[0],s[1]):n.call(h,s[0],s[1]);case 3:return v?n(s[0],s[1],s[2]):n.call(h,s[0],s[1],s[2]);case 4:return v?n(s[0],s[1],s[2],s[3]):n.call(h,s[0],s[1],s[2],s[3])}return n.apply(h,s)}},function(a,i,n){var s=n(55),h=n(13),v=n(232),g=[].slice,O={};a.exports=Function.bind||function(A){var S=s(this),M=g.call(arguments,1),P=function(){var L=M.concat(g.call(arguments));return this instanceof P?function(V,N,ee){if(!(N in O)){for(var J=[],K=0;K<N;K++)J[K]="a["+K+"]";O[N]=Function("F,a","return new F("+J.join(",")+")")}return O[N](V,ee)}(S,L.length,L):v(S,L,A)};return h(S.prototype)&&(P.prototype=S.prototype),P}},function(a,i){a.exports=Object.is||function(n,s){return n===s?n!==0||1/n==1/s:n!=n&&s!=s}},function(a,i,n){var s=n(27),h=n(82),v=n(127),g=n(106),O=n(34),A=n(107),S=Object.assign;a.exports=!S||n(15)(function(){var M={},P={},L=Symbol(),V="abcdefghijklmnopqrst";return M[L]=7,V.split("").forEach(function(N){P[N]=N}),S({},M)[L]!=7||Object.keys(S({},P)).join("")!=V})?function(M,P){for(var L=O(M),V=arguments.length,N=1,ee=v.f,J=g.f;V>N;)for(var K,re=A(arguments[N++]),ce=ee?h(re).concat(ee(re)):h(re),pe=ce.length,ke=0;pe>ke;)K=ce[ke++],s&&!J.call(re,K)||(L[K]=re[K]);return L}:S},function(a,i,n){var s=n(41),h=n(79).f,v={}.toString,g=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];a.exports.f=function(O){return g&&v.call(O)=="[object Window]"?function(A){try{return h(A)}catch{return g.slice()}}(O):h(s(O))}},function(a,i,n){var s=n(26),h=n(14),v=n(82);a.exports=n(27)?Object.defineProperties:function(g,O){h(g);for(var A,S=v(O),M=S.length,P=0;M>P;)s.f(g,A=S[P++],O[A]);return g}},function(a,i,n){var s=n(43),h=n(41),v=n(128)(!1),g=n(173)("IE_PROTO");a.exports=function(O,A){var S,M=h(O),P=0,L=[];for(S in M)S!=g&&s(M,S)&&L.push(S);for(;A.length>P;)s(M,S=A[P++])&&(~v(L,S)||L.push(S));return L}},function(a,i,n){var s=n(16),h=n(24),v=n(83),g=n(174),O=n(26).f;a.exports=function(A){var S=h.Symbol||(h.Symbol=v?{}:s.Symbol||{});A.charAt(0)=="_"||A in S||O(S,A,{value:g.f(A)})}},function(a,i,n){a.exports=!n(27)&&!n(15)(function(){return Object.defineProperty(n(175)("div"),"a",{get:function(){return 7}}).a!=7})},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(2);i.tf=s,function(h){for(var v in h)i.hasOwnProperty(v)||(i[v]=h[v])}(n(257))},function(a,i,n){/** 8198 * @license 8199 * Copyright 2021 Google LLC. All Rights Reserved. 8200 * Licensed under the Apache License, Version 2.0 (the "License");
8201 * you may not use this file except in compliance with the License. 8202 * You may obtain a copy of the License at 8203 * 8204 * http://www.apache.org/licenses/LICENSE-2.0 8205 * 8206 * Unless required by applicable law or agreed to in writing, software 8207 * distributed under the License is distributed on an "AS IS" BASIS, 8208 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8209 * See the License for the specific language governing permissions and 8210 * limitations under the License. 8211 * ============================================================================= 8212 */(function(s,h,v){const g={1:{name:"/m/01g317",id:1,displayName:"person"},2:{name:"/m/0199g",id:2,displayName:"bicycle"},3:{name:"/m/0k4j",id:3,displayName:"car"},4:{name:"/m/04_sv",id:4,displayName:"motorcycle"},5:{name:"/m/05czz6l",id:5,displayName:"airplane"},6:{name:"/m/01bjv",id:6,displayName:"bus"},7:{name:"/m/07jdr",id:7,displayName:"train"},8:{name:"/m/07r04",id:8,displayName:"truck"},9:{name:"/m/019jd",id:9,displayName:"boat"},10:{name:"/m/015qff",id:10,displayName:"traffic light"},11:{name:"/m/01pns0",id:11,displayName:"fire hydrant"},13:{name:"/m/02pv19",id:13,displayName:"stop sign"},14:{name:"/m/015qbp",id:14,displayName:"parking meter"},15:{name:"/m/0cvnqh",id:15,displayName:"bench"},16:{name:"/m/015p6",id:16,displayName:"bird"},17:{name:"/m/01yrx",id:17,displayName:"cat"},18:{name:"/m/0bt9lr",id:18,displayName:"dog"},19:{name:"/m/03k3r",id:19,displayName:"horse"},20:{name:"/m/07bgp",id:20,displayName:"sheep"},21:{name:"/m/01xq0k1",id:21,displayName:"cow"},22:{name:"/m/0bwd_0j",id:22,displayName:"elephant"},23:{name:"/m/01dws",id:23,displayName:"bear"},24:{name:"/m/0898b",id:24,displayName:"zebra"},25:{name:"/m/03bk1",id:25,displayName:"giraffe"},27:{name:"/m/01940j",id:27,displayName:"backpack"},28:{name:"/m/0hnnb",id:28,displayName:"umbrella"},31:{name:"/m/080hkjn",id:31,displayName:"handbag"},32:{name:"/m/01rkbr",id:32,displayName:"tie"},33:{name:"/m/01s55n",id:33,displayName:"suitcase"},34:{name:"/m/02wmf",id:34,displayName:"frisbee"},35:{name:"/m/071p9",id:35,displayName:"skis"},36:{name:"/m/06__v",id:36,displayName:"snowboard"},37:{name:"/m/018xm",id:37,displayName:"sports ball"},38:{name:"/m/02zt3",id:38,displayName:"kite"},39:{name:"/m/03g8mr",id:39,displayName:"baseball bat"},40:{name:"/m/03grzl",id:40,displayName:"baseball glove"},41:{name:"/m/06_fw",id:41,displayName:"skateboard"},42:{name:"/m/019w40",id:42,displayName:"surfboard"},43:{name:"/m/0dv9c",id:43,displayName:"tennis racket"},44:{name:"/m/04dr76w",id:44,displayName:"bottle"},46:{name:"/m/09tvcd",id:46,displayName:"wine glass"},47:{name:"/m/08gqpm",id:47,displayName:"cup"},48:{name:"/m/0dt3t",id:48,displayName:"fork"},49:{name:"/m/04ctx",id:49,displayName:"knife"},50:{name:"/m/0cmx8",id:50,displayName:"spoon"},51:{name:"/m/04kkgm",id:51,displayName:"bowl"},52:{name:"/m/09qck",id:52,displayName:"banana"},53:{name:"/m/014j1m",id:53,displayName:"apple"},54:{name:"/m/0l515",id:54,displayName:"sandwich"},55:{name:"/m/0cyhj_",id:55,displayName:"orange"},56:{name:"/m/0hkxq",id:56,displayName:"broccoli"},57:{name:"/m/0fj52s",id:57,displayName:"carrot"},58:{name:"/m/01b9xk",id:58,displayName:"hot dog"},59:{name:"/m/0663v",id:59,displayName:"pizza"},60:{name:"/m/0jy4k",id:60,displayName:"donut"},61:{name:"/m/0fszt",id:61,displayName:"cake"},62:{name:"/m/01mzpv",id:62,displayName:"chair"}
8212,63:{name:"/m/02crq1",id:63,displayName:"couch"},64:{name:"/m/03fp41",id:64,displayName:"potted plant"},65:{name:"/m/03ssj5",id:65,displayName:"bed"},67:{name:"/m/04bcr3",id:67,displayName:"dining table"},70:{name:"/m/09g1w",id:70,displayName:"toilet"},72:{name:"/m/07c52",id:72,displayName:"tv"},73:{name:"/m/01c648",id:73,displayName:"laptop"},74:{name:"/m/020lf",id:74,displayName:"mouse"},75:{name:"/m/0qjjc",id:75,displayName:"remote"},76:{name:"/m/01m2v",id:76,displayName:"keyboard"},77:{name:"/m/050k8",id:77,displayName:"cell phone"},78:{name:"/m/0fx9l",id:78,displayName:"microwave"},79:{name:"/m/029bxz",id:79,displayName:"oven"},80:{name:"/m/01k6s3",id:80,displayName:"toaster"},81:{name:"/m/0130jx",id:81,displayName:"sink"},82:{name:"/m/040b_t",id:82,displayName:"refrigerator"},84:{name:"/m/0bt_c3",id:84,displayName:"book"},85:{name:"/m/01x3z",id:85,displayName:"clock"},86:{name:"/m/02s195",id:86,displayName:"vase"},87:{name:"/m/01lsmm",id:87,displayName:"scissors"},88:{name:"/m/0kmg4",id:88,displayName:"teddy bear"},89:{name:"/m/03wvsk",id:89,displayName:"hair drier"},90:{name:"/m/012xff",id:90,displayName:"toothbrush"}};class O{constructor(S,M){this.modelPath=M||`https://storage.googleapis.com/tfjs-models/savedmodel/${this.getPrefix(S)}/model.json`}getPrefix(S){return S==="lite_mobilenet_v2"?`ssd${S}`:`ssd_${S}`}async load(){this.model=await h.loadGraphModel(this.modelPath);const S=v.zeros([1,300,300,3],"int32"),M=await this.model.executeAsync(S);await Promise.all(M.map(P=>P.data())),M.map(P=>P.dispose()),S.dispose()}async infer(S,M,P){const L=v.tidy(()=>(S instanceof v.Tensor||(S=v.browser.fromPixels(S)),v.expandDims(S))),V=L.shape[1],N=L.shape[2],ee=await this.model.executeAsync(L),J=ee[0].dataSync(),K=ee[1].dataSync();L.dispose(),v.dispose(ee);const[re,ce]=this.calculateMaxScores(J,ee[0].shape[1],ee[0].shape[2]),pe=v.getBackend();v.getBackend()==="webgl"&&v.setBackend("cpu");const ke=v.tidy(()=>{const be=v.tensor2d(K,[ee[1].shape[1],ee[1].shape[3]]);return v.image.nonMaxSuppression(be,re,M,P,P)}),Ce=ke.dataSync();return ke.dispose(),pe!==v.getBackend()&&v.setBackend(pe),this.buildDetectedObjects(N,V,K,re,Ce,ce)}buildDetectedObjects(S,M,P,L,V,N){const ee=V.length,J=[];for(let K=0;K<ee;K++){const re=[];for(let be=0;be<4;be++)re[be]=P[4*V[K]+be];const ce=re[0]*M,pe=re[1]*S,ke=re[2]*M,Ce=re[3]*S;re[0]=pe,re[1]=ce,re[2]=Ce-pe,re[3]=ke-ce,J.push({bbox:re,class:g[N[V[K]]+1].displayName,score:L[V[K]]})}return J}calculateMaxScores(S,M,P){const L=[],V=[];for(let N=0;N<M;N++){let ee=Number.MIN_VALUE,J=-1;for(let K=0;K<P;K++)S[N*P+K]>ee&&(ee=S[N*P+K],J=K);L[N]=ee,V[N]=J}return[L,V]}async detect(S,M=20,P=.5){return this.infer(S,M,P)}dispose(){this.model!=null&&this.model.dispose()}}s.ObjectDetection=O,s.load=async function(A={}){if(v==null)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");const S=A.base||"lite_mobilenet_v2",M=A.modelUrl;if(["mobilenet_v1","mobilenet_v2","lite_mobilenet_v2"].indexOf(S)===-1)throw new Error(`ObjectDetection constructed with invalid base model ${S}. Valid names are 'mobilenet_v1', 'mobilenet_v2' and 'lite_mobilenet_v2'.`);const P=new O(S,M);return await P.load(),P},s.version="2.2.2",Object.defineProperty(s,"__esModule",{value:!0})})(i,n(20),n(0))},function(a,i,n){a.exports=function s(h,v){if(h===v)return!0;if(h&&v&&typeof h=="object"&&typeof v=="object"){if(h.constructor!==v.constructor)return!1;var g,O,A;if(Array.isArray(h)){if((g=h.length)!=v.length)return!1;for(O=g;O--!=0;)if(!s(h[O],v[O]))return!1;return!0}if(h.constructor===RegExp)return h.source===v.source&&h.flags===v.flags;if(h.valueOf!==Object.prototype.valueOf)return h.valueOf()===v.valueOf();if(h.toString!==Object.prototype.toString)return h.toString()===v.toString();if((g=(A=Object.keys(h)).length)!==Object.keys(v).length)return!1;for(O=g;O--!=0;)if(!Object.prototype.hasOwnProperty.call(v,A[O]))return!1;for(O=g;O--!=0;){var S=A[O];if(!s(h[S],v[S]))return!1}return!0}return h!=h&&v!=v}},function(a,i,n){(function(s){var h=function(){function v(L,V){return V!=null&&L instanceof V}var g,O,A;try{g=Map}catch{g=function(){}}try{O=Set}catch{O=function(){}}try{A=Promise}catch{A=function(){}}function S(L,V,N,ee,J){typeof V=="object"&&(N=V.depth,ee=V.prototype,J=V.includeNonEnumerable,V=V.circular);var K=[],re=[],ce=s!==void 0;return V===void 0&&(V=!0),N===void 0&&(N=1/0),function pe(ke,Ce){if(ke===null)return null;if(Ce===0)return ke;var be,$e;if(typeof ke!="object")return ke;if(v(ke,g))be=new g;else if(v(ke,O))be=new O;else if(v(ke,A))be=new A(function(Tt,vt){ke.then(function(yt){Tt(pe(yt,Ce-1))},function(yt){vt(pe(yt,Ce-1))})});else if(S.__isArray(ke))be=[];else if(S.__isRegExp(ke))be=new RegExp(ke.source,P(ke)),ke.lastIndex&&(be.lastIndex=ke.lastIndex);else if(S.__isDate(ke))be=new Date(ke.getTime());else{if(ce&&s.isBuffer(ke))return be=s.allocUnsafe?s.allocUnsafe(ke.length):new s(ke.length),ke.copy(be),be;v(ke,Error)?be=Object.create(ke):ee===void 0?($e=Object.getPrototypeOf(ke),be=Object.create($e)):(be=Object.create(ee),$e=ee)}if(V){var ht=K.indexOf(ke);if(ht!=-1)return re[ht];K.push(ke),re.push(be)}for(var Dt in v(ke,g)&&ke.forEach(function(Tt,vt){var yt=pe(vt,Ce-1),bt=pe(Tt,Ce-1);be.set(yt,bt)}),v(ke,O)&&ke.forEach(function(Tt){var vt=pe(Tt,Ce-1);be.add(vt)}),ke){var Ut;$e&&(Ut=Object.getOwnPropertyDescriptor($e,Dt)),Ut&&Ut.set==null||(be[Dt]=pe(ke[Dt],Ce-1))}if(Object.getOwnPropertySymbols){var Ee=Object.getOwnPropertySymbols(ke);for(Dt=0;Dt<Ee.length;Dt++){var Ot=Ee[Dt];(!(Mt=Object.getOwnPropertyDescriptor(ke,Ot))||Mt.enumerable||J)&&(be[Ot]=pe(ke[Ot],Ce-1),Mt.enumerable||Object.defineProperty(be,Ot,{enumerable:!1}))}}if(J){var zt=Object.getOwnPropertyNames(ke);for(Dt=0;Dt<zt.length;Dt++){var Mt,Ke=zt[Dt];(Mt=Object.getOwnPropertyDescriptor(ke,Ke))&&Mt.enumerable||(be[Ke]=pe(ke[Ke],Ce-1),Object.defineProperty(be,Ke,{enumerable:!1}))}}return be}(L,N)}function M(L){return Object.prototype.toString.call(L)}function P(L){var V="";return L.global&&(V+="g"),L.ignoreCase&&(V+="i"),L.multiline&&(V+="m"),V}return S.clonePrototype=function(L){if(L===null)return null;var V=function(){};return V.prototype=L,new V},S.__objToStr=M,S.__isDate=function(L){return typeof L=="object"&&M(L)==="[object Date]"},S.__isArray=function(L){return typeof L=="object"&&M(L)==="[object Array]"},S.__isRegExp=function(L){return typeof L=="object"&&M(L)==="[object RegExp]"},S.__getRegExpFlags=P,S}();
8212typeof a=="object"&&a.exports&&(a.exports=h)}).call(this,n(92).Buffer)},function(a){a.exports={name:"vega-lite",author:'Dominik Moritz, Kanit "Ham" Wongsuphasawat, Arvind Satyanarayan, Jeffrey Heer',version:"4.13.1",collaborators:["Kanit Wongsuphasawat (http://kanitw.yellowpigz.com)","Dominik Moritz (https://www.domoritz.de)","Arvind Satyanarayan (https://arvindsatya.com)","Jeffrey Heer (https://jheer.org)"],homepage:"https://vega.github.io/vega-lite/",description:"Vega-Lite is a concise high-level language for interactive visualization.",main:"build/vega-lite.js",unpkg:"build/vega-lite.min.js",jsdelivr:"build/vega-lite.min.js",module:"build/src/index",types:"build/src/index.d.ts",bin:{vl2png:"./bin/vl2png",vl2svg:"./bin/vl2svg",vl2pdf:"./bin/vl2pdf",vl2vg:"./bin/vl2vg"},directories:{test:"test"},scripts:{changelog:"conventional-changelog -p angular -r 2",build:"yarn build:only","build:only":"yarn tsc:src && rollup -c",postbuild:"terser build/vega-lite.js -cm --source-map content=build/vega-lite.js.map,filename=build/vega-lite.min.js.map -o build/vega-lite.min.js && yarn schema && babel build/vega-lite.js --out-dir build-es5 --config-file ./babel.config.js","prebuild:examples":"yarn build:only","build:examples":"yarn data && TZ=America/Los_Angeles scripts/build-examples.sh","prebuild:examples-full":"yarn build:only","build:examples-full":"TZ=America/Los_Angeles scripts/build-examples.sh 1","build:example":"TZ=America/Los_Angeles scripts/build-example.sh","build:toc":"yarn build:jekyll && scripts/generate-toc","build:site":"yarn tsc:site && rollup -c site/rollup.config.js","build:jekyll":"pushd site && bundle exec jekyll build -q && popd","build:versions":"scripts/update-version.sh",clean:"find build ! -name 'vega-lite-schema.json' -type f -delete && rm -rf site/data/* && rm -f examples/compiled/*.png && find site/examples ! -name 'index.md' ! -name 'data' -type f -delete","predeploy:site":"yarn presite","deploy:site":"gh-pages -d site",data:"rsync -r node_modules/vega-datasets/data/* site/data",schema:"mkdir -p build && ts-json-schema-generator -f tsconfig.json -p src/index.ts -t TopLevelSpec --no-type-check --no-ref-encode > build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/",renameschema:"scripts/rename-schema.sh",presite:"yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh",site:"pushd site && bundle exec jekyll serve -I -l && popd","tsc:src":"tsc -b src/tsconfig.src.json","tsc:site":"tsc -b site/tsconfig.site.json",prettierbase:"prettier '**/*.{md,css,yml}'",eslintbase:"eslint .",format:"yarn eslintbase --fix && yarn prettierbase --write",lint:"yarn eslintbase && yarn prettierbase --check",test:"jest test/ && yarn lint && yarn schema && jest examples/ && yarn test:runtime","test:inspect":"node --inspect-brk ./node_modules/.bin/jest --runInBand test","test:runtime":"TZ=America/Los_Angeles jest test-runtime/","test:runtime:generate":"yarn build:only && rm -Rf test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime","watch:build":"yarn build:only && concurrently --kill-others -n Typescript,Rollup 'yarn tsc:src -w' 'rollup -c -w'","watch:site":"concurrently --kill-others -n Typescript,Rollup 'yarn tsc:site -w' 'rollup -c site/rollup.config.js -w'","watch:test":"jest --watch"},repository:{type:"git",url:"https://github.com/vega/vega-lite.git"},license:"BSD-3-Clause",bugs:{url:"https://github.com/vega/vega-lite/issues"},devDependencies:{"@babel/cli":"^7.10.1","@babel/core":"^7.10.1","@babel/preset-env":"^7.10.1","@rollup/plugin-commonjs":"12.0.0","@rollup/plugin-json":"^4.0.3","@rollup/plugin-node-resolve":"^8.0.0","@types/chai":"^4.2.11","@types/d3":"^5.7.2","@types/jest":"^25.2.3","@types/mkdirp":"^1.0.0","@types/puppeteer":"^3.0.0","@typescript-eslint/eslint-plugin":"^3.0.2","@typescript-eslint/parser":"^3.0.2",ajv:"^6.12.2",chai:"^4.2.0",cheerio:"^1.0.0-rc.3",codecov:"^3.7.0",concurrently:"^5.2.0","conventional-changelog-cli":"^2.0.34",d3:"^5.16.0",eslint:"^7.1.0","eslint-config-prettier":"^6.11.0","eslint-plugin-jest":"^23.13.2","eslint-plugin-
8212prettier":"^3.1.3","gh-pages":"^2.2.0","highlight.js":"^10.0.3","http-server":"^0.12.3",jest:"^26.0.1","jest-puppeteer":"^4.4.0",mkdirp:"^1.0.4",prettier:"^2.0.5",puppeteer:"^3.1.0",rollup:"^2.11.0","rollup-plugin-sourcemaps":"^0.6.2","rollup-plugin-terser":"^6.1.0","svg2png-many":"^0.0.7",terser:"^4.7.0","ts-jest":"^26.0.0","ts-json-schema-generator":"^0.68.1",typescript:"~3.9.3","vega-cli":"^5.12.1","vega-datasets":"^1.30.2","vega-embed":"^6.8.0","vega-tooltip":"^0.23.0","vega-typings":"^0.17.0","yaml-front-matter":"^4.1.0"},dependencies:{"@types/clone":"~0.1.30","@types/fast-json-stable-stringify":"^2.0.0","array-flat-polyfill":"^1.0.1",clone:"~2.1.2","fast-deep-equal":"~3.1.1","fast-json-stable-stringify":"~2.1.0","json-stringify-pretty-compact":"~2.0.0",tslib:"~2.0.0","vega-event-selector":"~2.0.3","vega-expression":"~2.6.5","vega-util":"~1.14.0",yargs:"~15.3.1"},peerDependencies:{vega:"^5.12.1"},jest:{preset:"jest-puppeteer",transform:{"^.+\\.tsx?$":"ts-jest"},testRegex:"(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",moduleFileExtensions:["ts","tsx","js","jsx","json","node"],testPathIgnorePatterns:["<rootDir>/node_modules","<rootDir>/build","<rootDir>/_site","<rootDir>/src"],coverageDirectory:"./coverage/",collectCoverage:!1}}},function(a,i,n){n.d(i,"a",function(){return L});var s=n(39),h=n(71),v=n(40),g=n(72),O=n(70),A=n(68);function S(Ie){if(0<=Ie.y&&Ie.y<100){var it=new Date(-1,Ie.m,Ie.d,Ie.H,Ie.M,Ie.S,Ie.L);return it.setFullYear(Ie.y),it}return new Date(Ie.y,Ie.m,Ie.d,Ie.H,Ie.M,Ie.S,Ie.L)}function M(Ie){if(0<=Ie.y&&Ie.y<100){var it=new Date(Date.UTC(-1,Ie.m,Ie.d,Ie.H,Ie.M,Ie.S,Ie.L));return it.setUTCFullYear(Ie.y),it}return new Date(Date.UTC(Ie.y,Ie.m,Ie.d,Ie.H,Ie.M,Ie.S,Ie.L))}function P(Ie,it,St){return{y:Ie,m:it,d:St,H:0,M:0,S:0,L:0}}function L(Ie){var it=Ie.dateTime,St=Ie.date,Jt=Ie.time,kn=Ie.periods,rr=Ie.days,Bn=Ie.shortDays,Gn=Ie.months,Zn=Ie.shortMonths,Gt=ce(kn),Wt=pe(kn),Sn=ce(rr),un=pe(rr),qe=ce(Bn),$n=pe(Bn),er=ce(Gn),sr=pe(Gn),pr=ce(Zn),Zr=pe(Zn),Mr={a:function(ai){return Bn[ai.getDay()]},A:function(ai){return rr[ai.getDay()]},b:function(ai){return Zn[ai.getMonth()]},B:function(ai){return Gn[ai.getMonth()]},c:null,d:sn,e:sn,f:He,g:cr,G:hn,H:yn,I:Yt,j:We,L:Ye,m:dt,M:It,p:function(ai){return kn[+(ai.getHours()>=12)]},q:function(ai){return 1+~~(ai.getMonth()/3)},Q:ge,s:Ae,S:ct,u:on,U:Xt,V:xe,w:jn,W:nr,x:null,X:null,y:ar,Y:Er,Z:rn,"%":_e},Ii={a:function(ai){return Bn[ai.getUTCDay()]},A:function(ai){return rr[ai.getUTCDay()]},b:function(ai){return Zn[ai.getUTCMonth()]},B:function(ai){return Gn[ai.getUTCMonth()]},c:null,d:fn,e:fn,f:xr,g:$i,G:Qr,H:Xn,I:Fn,j:Ar,L:Dr,m:fi,M:ci,p:function(ai){return kn[+(ai.getUTCHours()>=12)]},q:function(ai){return 1+~~(ai.getUTCMonth()/3)},Q:ge,s:Ae,S:qr,u:mi,U:Ir,V:ri,w:yi,W:na,x:null,X:null,y:co,Y:Ft,Z:Zt,"%":_e},Lo={a:function(ai,Yr,Hn){var ki=qe.exec(Yr.slice(Hn));return ki?(ai.w=$n.get(ki[0].toLowerCase()),Hn+ki[0].length):-1},A:function(ai,Yr,Hn){var ki=Sn.exec(Yr.slice(Hn));return ki?(ai.w=un.get(ki[0].toLowerCase()),Hn+ki[0].length):-1},b:function(ai,Yr,Hn){var ki=pr.exec(Yr.slice(Hn));return ki?(ai.m=Zr.get(ki[0].toLowerCase()),Hn+ki[0].length):-1},B:function(ai,Yr,Hn){var ki=er.exec(Yr.slice(Hn));return ki?(ai.m=sr.get(ki[0].toLowerCase()),Hn+ki[0].length):-1},c:function(ai,Yr,Hn){return Ji(ai,it,Yr,Hn)},d:Mt,e:Mt,f:Ht,g:Ut,G:Dt,H:Tt,I:Tt,j:Ke,L:bt,m:zt,M:vt,p:function(ai,Yr,Hn){var ki=Gt.exec(Yr.slice(Hn));return ki?(ai.p=Wt.get(ki[0].toLowerCase()),Hn+ki[0].length):-1},q:Ot,Q:Ze,s:Vt,S:yt,u:Ce,U:be,V:$e,w:ke,W:ht,x:function(ai,Yr,Hn){return Ji(ai,St,Yr,Hn)},X:function(ai,Yr,Hn){return Ji(ai,Jt,Yr,Hn)},y:Ut,Y:Dt,Z:Ee,"%":_t};function Ai(ai,Yr){return function(Hn){var ki,lo,Kr,Io=[],Ko=-1,Eo=0,Yo=ai.length;for(Hn instanceof Date||(Hn=new Date(+Hn));++Ko<Yo;)ai.charCodeAt(Ko)===37&&(Io.push(ai.slice(Eo,Ko)),(lo=V[ki=ai.charAt(++Ko)])!=null?ki=ai.charAt(++Ko):lo=ki==="e"?" ":"0",(Kr=Yr[ki])&&(ki=Kr(Hn,lo)),Io.push(ki),Eo=Ko+1);return Io.push(ai.slice(Eo,Ko)),Io.join("")}}function ko(ai,Yr){return function(Hn){var ki,lo,Kr=P(1900,void 0,1);if(Ji(Kr,ai,Hn+="",0)!=Hn.length)return null;if("Q"in Kr)return new Date(Kr.Q);if("s"in Kr)return new Date(1e3*Kr.s+("L"in Kr?Kr.L:0));if(!Yr||"Z"in Kr||(Kr.Z=0),"p"in Kr&&(Kr.H=Kr.H%12+12*Kr.p),Kr.m===void 0&&(Kr.m="q"in Kr?Kr.q:0),"V"in Kr){if(Kr.V<1||Kr.V>53)return null;"w"in Kr||(Kr.w=1),"Z"in Kr?(ki=(lo=(ki=M(P(Kr.y,0,1))).getUTCDay())>4||lo===0?s.a.ceil(ki):Object(s.a)(ki),ki=h.a.offset(ki,7*(Kr.V-1)),Kr.y=ki.getUTCFullYear(),Kr.m=ki.getUTCMonth(),Kr.d=ki.getUTCDate()+(Kr.w+6)%7):(ki=(lo=(ki=S(P(Kr.y,0,1))).getDay())>4||lo===0?v.a.ceil(ki):Object(v.a)(ki),ki=g.a.offset(ki,7*(Kr.V-1)),Kr.y=ki.getFullYear(),Kr.m=ki.getMonth(),Kr.d=ki.getDate()+(Kr.w+6)%7)}else("W"in Kr||"U"in Kr)&&("w"in Kr||(Kr.w="u"in Kr?Kr.u%7:"W"in Kr?1:0),lo="Z"in Kr?M(P(Kr.y,0,1)).getUTCDay():S(P(Kr.y,0,1)).getDay(),Kr.m=0,Kr.d="W"in Kr?(Kr.w+6)%7+7*Kr.W-(lo+5)%7:Kr.w+7*Kr.U-(lo+6)%7);return"Z"in Kr?(Kr.H+=Kr.Z/100|0,Kr.M+=Kr.Z%100,M(Kr)):S(Kr)}}function Ji(ai,Yr,Hn,ki){for(var lo,Kr,Io=0,Ko=Yr.length,Eo=Hn.length;Io<Ko;){if(ki>=Eo)return-1;if((lo=Yr.charCodeAt(Io++))===37){if(lo=Yr.charAt(Io++),!(Kr=Lo[lo in V?Yr.charAt(Io++):lo])||(ki=Kr(ai,Hn,ki))<0)return-1}else if(lo!=Hn.charCodeAt(ki++))return-1}return ki}return Mr.x=Ai(St,Mr),Mr.X=Ai(Jt,Mr),Mr.c=Ai(it,Mr),Ii.x=Ai(St,Ii),Ii.X=Ai(Jt,Ii),Ii.c=Ai(it,Ii),{format:function(ai){var Yr=Ai(ai+="",Mr);return Yr.toString=function(){return ai},Yr},parse:function(ai){var Yr=ko(ai+="",!1);return Yr.toString=function(){return ai},Yr},utcFormat:function(ai){var Yr=Ai(ai+="",Ii);return Yr.toString=function(){return ai},Yr},utcParse:function(ai){var Yr=ko(ai+="",!0);return Yr.toString=function(){return ai},Yr}}}var V={"-":"",_:" ",0:"0"},N=/^\s*\d+/,ee=/^%/,J=/[\\^$*+?|[\]().{}]/g;function K(Ie,it,St){var Jt=Ie<0?"-":"",kn=(Jt?-Ie:Ie)+"",rr=kn.length;return Jt+(rr<St?new Array(St-rr+1).join(it)+kn:kn)}function re(Ie){return Ie.replace(J,"\\$&")}function ce(Ie){return new RegExp("^(?:"+Ie.map(re).join("|")+")","i")}function pe(Ie){return new Map(Ie.map((it,St)=>[it.toLowerCase(),St]))}function ke(Ie,it,St){var Jt=N.exec(it.slice(St,St+1));return Jt?(Ie.w=+Jt[0],St+Jt[0].length):-1}function Ce(Ie,it,St){var Jt=N.exec(it.slice(St,St+1));return Jt?(Ie.u=+Jt[0],St+Jt[0].length):-1}function be(Ie,it,St){var Jt=N.exec(it.slice(St,St+2));return Jt?(Ie.U=+Jt[0],St+Jt[0].length):-1}function $e(Ie,it,St){var Jt=N.exec(it.slice(St,St+2));return Jt?(Ie.V=+Jt[0],St+Jt[0].length):-1}function ht(Ie,it,St){var Jt=N.exec(it.slice(St,St+2));return Jt?(Ie.W=+Jt[0],St+Jt[0].length):-1}function Dt(Ie,it,St){var Jt=N.exec(it.slice(St,St+4));return Jt?(Ie.y=+Jt[0],St+Jt[0].length):-1}function Ut(Ie,it,St){var Jt=N.exec(it.slice(St,St+2));return Jt?(Ie.y=+Jt[0]+(+Jt[0]>68?1900:2e3),St+Jt[0].length):-1}function Ee(Ie,it,St){var Jt=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(it.slice(St,St+6));return Jt?(Ie.Z=Jt[1]?0:-(Jt[2]+(Jt[3]||"00")),St+Jt[0].length):-1}function Ot(Ie,it,St){var Jt=N.exec(it.slice(St,St+1));return Jt?(Ie.q=3*Jt[0]-3,St+Jt[0].length):-1}function zt(Ie,it,St){var Jt=N.exec(it.slice(St,St+2));return Jt?(Ie.m=Jt[0]-1,St+Jt[0].length):-1}function Mt(Ie,it,St){var Jt=N.exec(it.slice(St,St+2));return Jt?(Ie.d=+Jt[0],St+Jt[0].length):-1}function Ke(Ie,it,St){var Jt=N.exec(it.slice(St,St+3));return Jt?(Ie.m=0,Ie.d=+Jt[0],St+Jt[0].length):-1}function Tt(Ie,it,St){var Jt=N.exec(it.slice(St,St+2));return Jt?(Ie.H=+Jt[0],St+Jt[0].length):-1}function vt(Ie,it,St){var Jt=N.exec(it.slice(St,St+2));return Jt?(Ie.M=+Jt[0],St+Jt[0].length):-1}function yt(Ie,it,St){var Jt=N.exec(it.slice(St,St+2));return Jt?(Ie.S=+Jt[0],St+Jt[0].length):-1}function bt(Ie,it,St){var Jt=N.exec(it.slice(St,St+3));return Jt?(Ie.L=+Jt[0],St+Jt[0].length):-1}function Ht(Ie,it,St){var Jt=N.exec(it.slice(St,St+6));return Jt?(Ie.L=Math.floor(Jt[0]/1e3),St+Jt[0].length):-1}function _t(Ie,it,St){var Jt=ee.exec(it.slice(St,St+1));return Jt?St+Jt[0].length:-1}function Ze(Ie,it,St){var Jt=N.exec(it.slice(St));return Jt?(Ie.Q=+Jt[0],St+Jt[0].length):-1}function Vt(Ie,it,St){var Jt=N.exec(it.slice(St));return Jt?(Ie.s=+Jt[0],St+Jt[0].length):-1}function sn(Ie,it){return K(Ie.getDate(),it,2)}function yn(Ie,it){return K(Ie.getHours(),it,2)}function Yt(Ie,it){return K(Ie.getHours()%12||12,it,2)}function We(Ie,it){return K(1+g.a.count(Object(O.a)(Ie),Ie),it,3)}function Ye(Ie,it){return K(Ie.getMilliseconds(),it,3)}function He(Ie,it){return Ye(Ie,it)+"000"}function dt(Ie,it){return K(Ie.getMonth()+1,it,2)}function It(Ie,it){return K(Ie.getMinutes(),it,2)}function ct(Ie,it){return K(Ie.getSeconds(),it,2)}function on(Ie){var it=Ie.getDay();return it===0?7:it}function Xt(Ie,it){return K(v.b.count(Object(O.a)(Ie)-1,Ie),it,2)}function En(Ie){var it=Ie.getDay();return it>=4||it===0?Object(v.c)(Ie):v.c.ceil(Ie)}function xe(Ie,it){return Ie=En(Ie),K(v.c.count(Object(O.a)(Ie),Ie)+(Object(O.a)(Ie).getDay()===4),it,2)}function jn(Ie){return Ie.getDay()}function nr(Ie,it){return K(v.a.count(Object(O.a)(Ie)-1,Ie),it,2)}function ar(Ie,it){return K(Ie.getFullYear()%100,it,2)}function cr(Ie,it){return K((Ie=En(Ie)).getFullYear()%100,it,2)}function Er(Ie,it){return K(Ie.getFullYear()%1e4,it,4)}function hn(Ie,it){var St=Ie.getDay();return K((Ie=St>=4||St===0?Object(v.c)(Ie):v.c.ceil(Ie)).getFullYear()%1e4,it,4)}function rn(Ie){var it=Ie.getTimezoneOffset();return(it>0?"-":(it*=-1,"+"))+K(it/60|0,"0",2)+K(it%60,"0",2)}function fn(Ie,it){return K(Ie.getUTCDate(),it,2)}function Xn(Ie,it){return K(Ie.getUTCHours(),it,2)}function Fn(Ie,it){return K(Ie.getUTCHours()%12||12,it,2)}function Ar(Ie,it){return K(1+h.a.count(Object(A.a)(Ie),Ie),it,3)}function Dr(Ie,it){return K(Ie.getUTCMilliseconds(),it,3)}function xr(Ie,it){return Dr(Ie,it)+"000"}function fi(Ie,it){return K(Ie.getUTCMonth()+1,it,2)}function ci(Ie,it){return K(Ie.getUTCMinutes(),it,2)}function qr(Ie,it){return K(Ie.getUTCSeconds(),it,2)}function mi(Ie){var it=Ie.getUTCDay();return it===0?7:it}function Ir(Ie,it){return K(s.b.count(Object(A.a)(Ie)-1,Ie),it,2)}function ti(Ie){var it=Ie.getUTCDay();return it>=4||it===0?Object(s.c)(Ie):s.c.ceil(Ie)}function ri(Ie,it){return Ie=ti(Ie),K(s.c.count(Object(A.a)(Ie),Ie)+(Object(A.a)(Ie).getUTCDay()===4),it,2)}function yi(Ie){return Ie.getUTCDay()}function na(Ie,it){return K(s.a.count(Object(A.a)(Ie)-1,Ie),it,2)}function co(Ie,it){return K(Ie.getUTCFullYear()%100,it,2)}function $i(Ie,it){return K((Ie=ti(Ie)).getUTCFullYear()%100,it,2)}function Ft(Ie,it){return K(Ie.getUTCFullYear()%1e4,it,4)}function Qr(Ie,it){var St=Ie.getUTCDay();return K((Ie=St>=4||St===0?Object(s.c)(Ie):s.c.ceil(Ie)).getUTCFullYear()%1e4,it,4)}function Zt(){return"+0000"}function _e(){return"%"}function ge(Ie){return+Ie}function Ae(Ie){return Math.floor(+Ie/1e3)}},function(a,i,n){n.r(i);var s="http://www.w3.org/1999/xhtml",h={svg:"http://www.w3.org/2000/svg",xhtml:s,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},v=function(hn){var rn=hn+="",fn=rn.indexOf(":");return fn>=0&&(rn=hn.slice(0,fn))!=="xmlns"&&(hn=hn.slice(fn+1)),h.hasOwnProperty(rn)?{space:h[rn],local:hn}:hn},g=function(hn){var rn=v(hn);return(rn.local?function(fn){return function(){return this.ownerDocument.createElementNS(fn.space,fn.local)}}:function(fn){return function(){var Xn=this.ownerDocument,Fn=this.namespaceURI;return Fn===s&&Xn.documentElement.namespaceURI===s?Xn.createElement(fn):Xn.createElementNS(Fn,fn
8212)}})(rn)};function O(){}var A=function(hn){return hn==null?O:function(){return this.querySelector(hn)}};function S(){return[]}var M=function(hn){return hn==null?S:function(){return this.querySelectorAll(hn)}},P=function(hn){return function(){return this.matches(hn)}};if(typeof document<"u"){var L=document.documentElement;if(!L.matches){var V=L.webkitMatchesSelector||L.msMatchesSelector||L.mozMatchesSelector||L.oMatchesSelector;P=function(hn){return function(){return V.call(this,hn)}}}}var N=P,ee=function(hn){return new Array(hn.length)};function J(hn,rn){this.ownerDocument=hn.ownerDocument,this.namespaceURI=hn.namespaceURI,this._next=null,this._parent=hn,this.__data__=rn}J.prototype={constructor:J,appendChild:function(hn){return this._parent.insertBefore(hn,this._next)},insertBefore:function(hn,rn){return this._parent.insertBefore(hn,rn)},querySelector:function(hn){return this._parent.querySelector(hn)},querySelectorAll:function(hn){return this._parent.querySelectorAll(hn)}};var K="$";function re(hn,rn,fn,Xn,Fn,Ar){for(var Dr,xr=0,fi=rn.length,ci=Ar.length;xr<ci;++xr)(Dr=rn[xr])?(Dr.__data__=Ar[xr],Xn[xr]=Dr):fn[xr]=new J(hn,Ar[xr]);for(;xr<fi;++xr)(Dr=rn[xr])&&(Fn[xr]=Dr)}function ce(hn,rn,fn,Xn,Fn,Ar,Dr){var xr,fi,ci,qr={},mi=rn.length,Ir=Ar.length,ti=new Array(mi);for(xr=0;xr<mi;++xr)(fi=rn[xr])&&(ti[xr]=ci=K+Dr.call(fi,fi.__data__,xr,rn),ci in qr?Fn[xr]=fi:qr[ci]=fi);for(xr=0;xr<Ir;++xr)(fi=qr[ci=K+Dr.call(hn,Ar[xr],xr,Ar)])?(Xn[xr]=fi,fi.__data__=Ar[xr],qr[ci]=null):fn[xr]=new J(hn,Ar[xr]);for(xr=0;xr<mi;++xr)(fi=rn[xr])&&qr[ti[xr]]===fi&&(Fn[xr]=fi)}function pe(hn,rn){return hn<rn?-1:hn>rn?1:hn>=rn?0:NaN}var ke=function(hn){return hn.ownerDocument&&hn.ownerDocument.defaultView||hn.document&&hn||hn.defaultView};function Ce(hn,rn){return hn.style.getPropertyValue(rn)||ke(hn).getComputedStyle(hn,null).getPropertyValue(rn)}function be(hn){return hn.trim().split(/^|\s+/)}function $e(hn){return hn.classList||new ht(hn)}function ht(hn){this._node=hn,this._names=be(hn.getAttribute("class")||"")}function Dt(hn,rn){for(var fn=$e(hn),Xn=-1,Fn=rn.length;++Xn<Fn;)fn.add(rn[Xn])}function Ut(hn,rn){for(var fn=$e(hn),Xn=-1,Fn=rn.length;++Xn<Fn;)fn.remove(rn[Xn])}ht.prototype={add:function(hn){this._names.indexOf(hn)<0&&(this._names.push(hn),this._node.setAttribute("class",this._names.join(" ")))},remove:function(hn){var rn=this._names.indexOf(hn);rn>=0&&(this._names.splice(rn,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(hn){return this._names.indexOf(hn)>=0}};function Ee(){this.textContent=""}function Ot(){this.innerHTML=""}function zt(){this.nextSibling&&this.parentNode.appendChild(this)}function Mt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ke(){return null}function Tt(){var hn=this.parentNode;hn&&hn.removeChild(this)}function vt(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function yt(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var bt={},Ht=null;typeof document<"u"&&("onmouseenter"in document.documentElement||(bt={mouseenter:"mouseover",mouseleave:"mou
8212seout"}));function _t(hn,rn,fn){return hn=Ze(hn,rn,fn),function(Xn){var Fn=Xn.relatedTarget;Fn&&(Fn===this||8&Fn.compareDocumentPosition(this))||hn.call(this,Xn)}}function Ze(hn,rn,fn){return function(Xn){var Fn=Ht;Ht=Xn;try{hn.call(this,this.__data__,rn,fn)}finally{Ht=Fn}}}function Vt(hn){return function(){var rn=this.__on;if(rn){for(var fn,Xn=0,Fn=-1,Ar=rn.length;Xn<Ar;++Xn)fn=rn[Xn],hn.type&&fn.type!==hn.type||fn.name!==hn.name?rn[++Fn]=fn:this.removeEventListener(fn.type,fn.listener,fn.capture);++Fn?rn.length=Fn:delete this.__on}}}function sn(hn,rn,fn){var Xn=bt.hasOwnProperty(hn.type)?_t:Ze;return function(Fn,Ar,Dr){var xr,fi=this.__on,ci=Xn(rn,Ar,Dr);if(fi){for(var qr=0,mi=fi.length;qr<mi;++qr)if((xr=fi[qr]).type===hn.type&&xr.name===hn.name)return this.removeEventListener(xr.type,xr.listener,xr.capture),this.addEventListener(xr.type,xr.listener=ci,xr.capture=fn),void(xr.value=rn)}this.addEventListener(hn.type,ci,fn),xr={type:hn.type,name:hn.name,value:rn,listener:ci,capture:fn},fi?fi.push(xr):this.__on=[xr]}}function yn(hn,rn,fn,Xn){var Fn=Ht;hn.sourceEvent=Ht,Ht=hn;try{return rn.apply(fn,Xn)}finally{Ht=Fn}}function Yt(hn,rn,fn){var Xn=ke(hn),Fn=Xn.CustomEvent;typeof Fn=="function"?Fn=new Fn(rn,fn):(Fn=Xn.document.createEvent("Event"),fn?(Fn.initEvent(rn,fn.bubbles,fn.cancelable),Fn.detail=fn.detail):Fn.initEvent(rn,!1,!1)),hn.dispatchEvent(Fn)}var We=[null];function Ye(hn,rn){this._groups=hn,this._parents=rn}function He(){return new Ye([[document.documentElement]],We)}Ye.prototype=He.prototype={constructor:Ye,select:function(hn){typeof hn!="function"&&(hn=A(hn));for(var rn=this._groups,fn=rn.length,Xn=new Array(fn),Fn=0;Fn<fn;++Fn)for(var Ar,Dr,xr=rn[Fn],fi=xr.length,ci=Xn[Fn]=new Array(fi),qr=0;qr<fi;++qr)(Ar=xr[qr])&&(Dr=hn.call(Ar,Ar.__data__,qr,xr))&&("__data__"in Ar&&(Dr.__data__=Ar.__data__),ci[qr]=Dr);return new Ye(Xn,this._parents)},selectAll:function(hn){typeof hn!="function"&&(hn=M(hn));for(var rn=this._groups,fn=rn.length,Xn=[],Fn=[],Ar=0;Ar<fn;++Ar)for(var Dr,xr=rn[Ar],fi=xr.length,ci=0;ci<fi;++ci)(Dr=xr[ci])&&(Xn.push(hn.call(Dr,Dr.__data__,ci,xr)),Fn.push(Dr));return new Ye(Xn,Fn)},filter:function(hn){typeof hn!="function"&&(hn=N(hn));for(var rn=this._groups,fn=rn.length,Xn=new Array(fn),Fn=0;Fn<fn;++Fn)for(var Ar,Dr=rn[Fn],xr=Dr.length,fi=Xn[Fn]=[],ci=0;ci<xr;++ci)(Ar=Dr[ci])&&hn.call(Ar,Ar.__data__,ci,Dr)&&fi.push(Ar);return new Ye(Xn,this._parents)},data:function(hn,rn){if(!hn)return ti=new Array(this.size()),ci=-1,this.each(function(Zt){ti[++ci]=Zt}),ti;var fn=rn?ce:re,Xn=this._parents,Fn=this._groups;typeof hn!="function"&&(hn=function(Zt){return function(){return Zt}}(hn));for(var Ar=Fn.length,Dr=new Array(Ar),xr=new Array(Ar),fi=new Array(Ar),ci=0;ci<Ar;++ci){var qr=Xn[ci],mi=Fn[ci],Ir=mi.length,ti=hn.call(qr,qr&&qr.__data__,ci,Xn),ri=ti.length,yi=xr[ci]=new Array(ri),na=Dr[ci]=new Array(ri);fn(qr,mi,yi,na,fi[ci]=new Array(Ir),ti,rn);for(var co,$i,Ft=0,Qr=0;Ft<ri;++Ft)if(co=yi[Ft]){for(Ft>=Qr&&(Qr=Ft+1);!($i=na[Qr])&&++Qr<ri;);co._next=$i||null}}return(Dr=new Ye(Dr,Xn))._enter=xr,Dr._exit=fi,Dr},enter:function(){return new Ye(this._enter||this._groups.map(ee),this._parents)},exit:function(){return new Ye(this._exit||this._groups.map(ee),this._parents)},merge:function(hn){for(var rn=this._groups,fn=hn._groups,Xn=rn.length,Fn=fn.length,Ar=Math.min(Xn,Fn),Dr=new Array(Xn),xr=0;xr<Ar;++xr)for(var fi,ci=rn[xr],qr=fn[xr],mi=ci.length,Ir=Dr[xr]=new Array(mi),ti=0;ti<mi;++ti)(fi=ci[ti]||qr[ti])&&(Ir[ti]=fi);for(;xr<Xn;++xr)Dr[xr]=rn[xr];return new Ye(Dr,this._parents)},order:function(){for(var hn=this._groups,rn=-1,fn=hn.length;++rn<fn;)for(var Xn,Fn=hn[rn],Ar=Fn.length-1,Dr=Fn[Ar];--Ar>=0;)(Xn=Fn[Ar])&&(Dr&&Dr!==Xn.nextSibling&&Dr.parentNode.insertBefore(Xn,Dr),Dr=Xn);return this},sort:function(hn){function rn(mi,Ir){return mi&&Ir?hn(mi.__data__,Ir.__data__):!mi-!Ir}hn||(hn=pe);for(var fn=this._groups,Xn=fn.length,Fn=new Array(Xn),Ar=0;Ar<Xn;++Ar){for(var Dr,xr=fn[Ar],fi=xr.length,ci=Fn[Ar]=new Array(fi),qr=0;qr<fi;++qr)(Dr=xr[qr])&&(ci[qr]=Dr);ci.sort(rn)}return new Ye(Fn,this._parents).order()},call:function(){var hn=arguments[0];return arguments[0]=this,hn.apply(null,arguments),this},nodes:function(){var hn=new Array(this.size()),rn=-1;return this.each(function(){hn[++rn]=this}),hn},node:function(){for(var hn=this._groups,rn=0,fn=hn.length;rn<fn;++rn)for(var Xn=hn[rn],Fn=0,Ar=Xn.length;Fn<Ar;++Fn){var Dr=Xn[Fn];if(Dr)return Dr}return null},size:function(){var hn=0;return this.each(function(){++hn}),hn},empty:function(){return!this.node()},each:function(hn){for(var rn=this._groups,fn=0,Xn=rn.length;fn<Xn;++fn)for(var Fn,Ar=rn[fn],Dr=0,xr=Ar.length;Dr<xr;++Dr)(Fn=Ar[Dr])&&hn.call(Fn,Fn.__data__,Dr,Ar);return this},attr:function(hn,rn){var fn=v(hn);if(arguments.length<2){var Xn=this.node();return fn.local?Xn.getAttributeNS(fn.space,fn.local):Xn.getAttribute(fn)}return this.each((rn==null?fn.local?function(Fn){return function(){this.removeAttributeNS(Fn.space,Fn.local)}}:function(Fn){return function(){this.removeAttribute(Fn)}}:typeof rn=="function"?fn.local?function(Fn,Ar){return function(){var Dr=Ar.apply(this,arguments);Dr==null?this.removeAttributeNS(Fn.space,Fn.local):this.setAttributeNS(Fn.space,Fn.local,Dr)}}:function(Fn,Ar){return function(){var Dr=Ar.apply(this,arguments);Dr==null?this.removeAttribute(Fn):this.setAttribute(Fn,Dr)}}:fn.local?function(Fn,Ar){return function(){this.setAttributeNS(Fn.space,Fn.local,Ar)}}:function(Fn,Ar){return function(){this.setAttribute(Fn,Ar)}})(fn,rn))},style:function(hn,rn,fn){return arguments.length>1?this.each((rn==null?function(Xn){return function(){this.style.removeProperty(Xn)}}:typeof rn=="function"?function(Xn,Fn,Ar){return function(){var Dr=Fn.apply(this,arguments);Dr==null?this.style.removeProperty(Xn):this.style.setProperty(Xn,Dr,Ar)}}:function(Xn,Fn,Ar){return function(){this.style.setProperty(Xn,Fn,Ar)}})(hn,rn,fn??"")):Ce(this.node(),hn)},property:function(hn,rn){return arguments.length>1?this.each((rn==null?function(fn){return function(){delete this[fn]}}:typeof rn=="function"?function(fn,Xn){return function(){var Fn=Xn.apply(this,arguments);Fn==null?delete this[fn]:this[fn]=Fn}}:function(fn,Xn){return function(){this[fn]=Xn}})(hn,rn)):this.node()[hn]},classed:function(hn,rn){var fn=be(hn+"");if(arguments.length<2){for(var Xn=$e(this.node()),Fn=-1,Ar=fn.length;++Fn<Ar;)if(!Xn.contains(fn[Fn]))return!1;return!0}return this.each((typeof rn=="function"?function(Dr,xr){return function(){(xr.a
8212pply(this,arguments)?Dt:Ut)(this,Dr)}}:rn?function(Dr){return function(){Dt(this,Dr)}}:function(Dr){return function(){Ut(this,Dr)}})(fn,rn))},text:function(hn){return arguments.length?this.each(hn==null?Ee:(typeof hn=="function"?function(rn){return function(){var fn=rn.apply(this,arguments);this.textContent=fn??""}}:function(rn){return function(){this.textContent=rn}})(hn)):this.node().textContent},html:function(hn){return arguments.length?this.each(hn==null?Ot:(typeof hn=="function"?function(rn){return function(){var fn=rn.apply(this,arguments);this.innerHTML=fn??""}}:function(rn){return function(){this.innerHTML=rn}})(hn)):this.node().innerHTML},raise:function(){return this.each(zt)},lower:function(){return this.each(Mt)},append:function(hn){var rn=typeof hn=="function"?hn:g(hn);return this.select(function(){return this.appendChild(rn.apply(this,arguments))})},insert:function(hn,rn){var fn=typeof hn=="function"?hn:g(hn),Xn=rn==null?Ke:typeof rn=="function"?rn:A(rn);return this.select(function(){return this.insertBefore(fn.apply(this,arguments),Xn.apply(this,arguments)||null)})},remove:function(){return this.each(Tt)},clone:function(hn){return this.select(hn?yt:vt)},datum:function(hn){return arguments.length?this.property("__data__",hn):this.node().__data__},on:function(hn,rn,fn){var Xn,Fn,Ar=function(mi){return mi.trim().split(/^|\s+/).map(function(Ir){var ti="",ri=Ir.indexOf(".");return ri>=0&&(ti=Ir.slice(ri+1),Ir=Ir.slice(0,ri)),{type:Ir,name:ti}})}(hn+""),Dr=Ar.length;if(!(arguments.length<2)){for(xr=rn?sn:Vt,fn==null&&(fn=!1),Xn=0;Xn<Dr;++Xn)this.each(xr(Ar[Xn],rn,fn));return this}var xr=this.node().__on;if(xr){for(var fi,ci=0,qr=xr.length;ci<qr;++ci)for(Xn=0,fi=xr[ci];Xn<Dr;++Xn)if((Fn=Ar[Xn]).type===fi.type&&Fn.name===fi.name)return fi.value}},dispatch:function(hn,rn){return this.each((typeof rn=="function"?function(fn,Xn){return function(){return Yt(this,fn,Xn.apply(this,arguments))}}:function(fn,Xn){return function(){return Yt(this,fn,Xn)}})(hn,rn))}};var dt=He,It=function(hn){return typeof hn=="string"?new Ye([[document.querySelector(hn)]],[document.documentElement]):new Ye([[hn]],We)},ct=function(hn){return It(g(hn).call(document.documentElement))},on=0;function Xt(){return new En}function En(){this._="@"+(++on).toString(36)}En.prototype=Xt.prototype={constructor:En,get:function(hn){for(var rn=this._;!(rn in hn);)if(!(hn=hn.parentNode))return;return hn[rn]},set:function(hn,rn){return hn[this._]=rn},remove:function(hn){return this._ in hn&&delete hn[this._]},toString:function(){return this._}};var xe=function(){for(var hn,rn=Ht;hn=rn.sourceEvent;)rn=hn;return rn},jn=function(hn,rn){var fn=hn.ownerSVGElement||hn;if(fn.createSVGPoint){var Xn=fn.createSVGPoint();return Xn.x=rn.clientX,Xn.y=rn.clientY,[(Xn=Xn.matrixTransform(hn.getScreenCTM().inverse())).x,Xn.y]}var Fn=hn.getBoundingClientRect();return[rn.clientX-Fn.left-hn.clientLeft,rn.clientY-Fn.top-hn.clientTop]},nr=function(hn){var rn=xe();return rn.changedTouches&&(rn=rn.changedTouches[0]),jn(hn,rn)},ar=function(hn){return typeof hn=="string"?new Ye([document.querySelectorAll(hn)],[document.documentElement]):new Ye([hn??[]],We)},cr=function(hn,rn,fn){arguments.length<3&&(fn=rn,rn=xe().changedTouches);for(var Xn,Fn=0,Ar=rn?rn.length:0;Fn<Ar;++Fn)if((Xn=rn[Fn]).identifier===fn)return jn(hn,Xn);return null},Er=function(hn,rn){rn==null&&(rn=xe().touches);for(var fn=0,Xn=rn?rn.length:0,Fn=new Array(Xn);fn<Xn;++fn)Fn[fn]=jn(hn,rn[fn]);return Fn};n.d(i,"create",function(){return ct}),n.d(i,"creator",function(){return g}),n.d(i,"local",function(){return Xt}),n.d(i,"matcher",function(){return N}),n.d(i,"mouse",function(){return nr}),n.d(i,"namespace",function(){return v}),n.d(i,"namespaces",function(){return h}),n.d(i,"clientPoint",function(){return jn}),n.d(i,"select",function(){return It}),n.d(i,"selectAll",function(){return ar}),n.d(i,"selection",function(){return dt}),n.d(i,"selector",function(){return A}),n.d(i,"selectorAll",function(){return M}),n.d(i,"style",function(){return Ce}),n.d(i,"touch",function(){return cr}),n.d(i,"touches",function(){return Er}),n.d(i,"window",function(){return ke}),n.d(i,"event",function(){return Ht}),n.d(i,"customEvent",function(){return yn})},function(a,i,n){n.r(i);var s={};n.d(s,"load",function(){return _t});var h={};n.d(h,"Darknet",function(){return He}),n.d(h,"load",function(){return dt});var v={};n.d(v,"Doodlenet",function(){return jn}),n.d(v,"load",function(){return nr});var g={};n.d(g,"array3DToImage",function(){return hn}),n.d(g,"processVideo",function(){return Er}),n.d(g,"cropImage",function(){return rn}),n.d(g,"imgToTensor",function(){return Xn}),n.d(g,"isInstanceOfSupportedElement",function(){return Fn}),n.d(g,"flipImage",function(){return fn}),n.d(g,"imgToPixelArray",function(){return Ar});var O={};n.d(O,"SpeechCommands",function(){return pr}),n.d(O,"load",function(){return Zr});var A={};n.d(A,"isTensor",function(){return Oo}),n.d(A,"isTensor1D",function(){return gd}),n.d(A,"isTensor2D",function(){return gh}),n.d(A,"isTensor3D",function(){return fr}),n.d(A,"isTensor4D",function(){return js}),n.d(A,"isFloat",function(){return as}),n.d(A,"isEven",function(){return ho}),n.d(A,"round",function(){return Mc}),n.d(A,"isDimensions",function(){return El}),n.d(A,"computeReshapedDimensions",function(){return qu}),n.d(A,"getCenterPoint",function(){return Cl}),n.d(A,"range",function(){return Oa}),n.d(A,"isValidNumber",function(){return rl}),n.d(A,"isValidProbablitiy",function(){return Gu});var S={};n.d(S,"drawContour",function(){return Hu}),n.d(S,"drawDetections",function(){return lr}),n.d(S,"drawFaceExpressions",function(){return Ju}),n.d(S,"DrawBoxOptions",function(){return Jn}),n.d(S,"DrawBox",function(){return Vn}),n.d(S,"DrawFaceLandmarksOptions",function(){return qs}),n.d(S,"DrawFaceLandmarks",function(){return _s}),n.d(S,"drawFaceLandmarks",function(){return Ol}),n.d(S,"AnchorPosition",function(){return qt}),n.d(S,"DrawTextFieldOptions",function(){return Pn}),n.d(S,"DrawTextField",function(){return zn});var M={};n.d(M,"draw",function(){return S}),n.d(M,"utils",function(){return A}),n.d(M,"tf",function(){return gn}),n.d(M,"env",function(){return en}),n.d(M,"FaceLandmarkNet",function(){return Hv}),n.d(M,"createFaceRecognitionNet",function(){return L0}),n.d(M,"createMtcnn",function(){return Q0}),n.d(M,"sigmoid",function(){return Sf}),n.d(M,"inverseSigmoid",function(){return Mp}),n.d(M,"createSsdMobilenetv1",function(){return Yv}),n.d(M,"createFaceDetectionNet",function(){return Xv}),n.d(M,"FaceDetectionNet",function(){return Db}),n.d(M,"createTinyFaceDetector",function(){return e0}),n.d(M,"TinyYolov2",function(){return jp}),n.d(M,"createTinyYolov2",function(){return Nb}),n.d(M,"euclideanDistance",function(){return J0}),n.d(M,"NeuralNetwork",function(){return Xi}),n.d(M,"resizeResults",function(){return ay}),n.d(M,"AgeGenderNet",function(){return Vv}),n.d(M,"Gender",function(){return yd}),n.d(M,"BoundingBox",function(){return ps}),n.d(M,"Box",function(){return tu}),n.d(M,"Dimensions",function(){return Eu}),n.d(M,"FaceDetection",function(){return Da}),n.d(M,"FaceLandmarks",function(){return Yu}),n.d(M,"FaceLandmarks5",function(){return Bc}),n.d(M,"FaceLandmarks68",function(){return Pc}),n.d(M,"FaceMatch",function(){return lc}),n.d(M,"LabeledBox",function(){return Fp}),n.d(M,"LabeledFaceDescriptors",function(){return vh}
8212),n.d(M,"ObjectDetection",function(){return nu}),n.d(M,"Point",function(){return Mo}),n.d(M,"PredictedBox",function(){return yh}),n.d(M,"Rect",function(){return Af}),n.d(M,"awaitMediaLoaded",function(){return Tr}),n.d(M,"bufferToImage",function(){return Hr}),n.d(M,"createCanvas",function(){return Br}),n.d(M,"createCanvasFromMedia",function(){return ui}),n.d(M,"extractFaces",function(){return Co}),n.d(M,"extractFaceTensors",function(){return _o}),n.d(M,"fetchImage",function(){return ro}),n.d(M,"fetchJson",function(){return So}),n.d(M,"fetchNetWeights",function(){return ja}),n.d(M,"fetchOrThrow",function(){return ba}),n.d(M,"getContext2dOrThrow",function(){return Tn}),n.d(M,"getMediaDimensions",function(){return oi}),n.d(M,"imageTensorToCanvas",function(){return ii}),n.d(M,"imageToSquare",function(){return Di}),n.d(M,"isMediaElement",function(){return Ci}),n.d(M,"isMediaLoaded",function(){return dr}),n.d(M,"loadWeightMap",function(){return Ta}),n.d(M,"matchDimensions",function(){return Zi}),n.d(M,"NetInput",function(){return si}),n.d(M,"resolveInput",function(){return gt}),n.d(M,"toNetInput",function(){return wi}),n.d(M,"FaceExpressionNet",function(){return Do}),n.d(M,"FACE_EXPRESSION_LABELS",function(){return Cu}),n.d(M,"FaceExpressions",function(){return iu}),n.d(M,"FaceLandmark68Net",function(){return P0}),n.d(M,"FaceLandmark68TinyNet",function(){return j0}),n.d(M,"FaceRecognitionNet",function(){return Km}),n.d(M,"extendWithFaceDescriptor",function(){return z0}),n.d(M,"isWithFaceDetection",function(){return vd}),n.d(M,"extendWithFaceDetection",function(){return bh}),n.d(M,"isWithFaceExpressions",function(){return Su}),n.d(M,"extendWithFaceExpressions",function(){return Ls}),n.d(M,"isWithFaceLandmarks",function(){return Xl}),n.d(M,"extendWithFaceLandmarks",function(){return xa}),n.d(M,"isWithAge",function(){return g1}),n.d(M,"extendWithAge",function(){return U0}),n.d(M,"isWithGender",function(){return Rp}),n.d(M,"extendWithGender",function(){return _h}),n.d(M,"allFacesSsdMobilenetv1",function(){return Qg}),n.d(M,"allFacesTinyYolov2",function(){return $p}),n.d(M,"allFacesMtcnn",function(){return Zg}),n.d(M,"allFaces",function(){return X0}),n.d(M,"ComposableTask",function(){return If}),n.d(M,"ComputeFaceDescriptorsTaskBase",function(){return ng}),n.d(M,"ComputeAllFaceDescriptorsTask",function(){return Tl}),n.d(M,"ComputeSingleFaceDescriptorTask",function(){return Nh}),n.d(M,"detectSingleFace",function(){return Jg}),n.d(M,"detectAllFaces",function(){return Ad}),n.d(M,"DetectFacesTaskBase",function(){return Yg}),n.d(M,"DetectAllFacesTask",function(){return Xg}),n.d(M,"DetectSingleFaceTask",function(){return oy}),n.d(M,"DetectFaceLandmarksTaskBase",function(){return Ih}),n.d(M,"DetectAllFaceLandmarksTask",function(){return rg}),n.d(M,"DetectSingleFaceLandmarksTask",function(){return Kg}),n.d(M,"FaceMatcher",function(){return ig}),n.d(M,"nets",function(){return Ao}),n.d(M,"ssdMobilenetv1",function(){return kd}),n.d(M,"tinyFaceDetector",function(){return zp}),n.d(M,"tinyYolov2",function(){return b1}),n.d(M,"mtcnn",function(){return x1}),n.d(M,"detectFaceLandmarks",function(){return Hg}),n.d(M,"detectFaceLandmarksTiny",function(){return Ed}),n.d(M,"computeFaceDescriptor",function(){return Mf}),n.d(M,"recognizeFaceExpressions",function(){return eg}),n.d(M,"predictAgeAndGender",function(){return Up}),n.d(M,"loadSsdMobilenetv1Model",function(){return Ah}),n.d(M,"loadTinyFaceDetectorModel",function(){return Cd}),n.d(M,"loadMtcnnModel",function(){return Sd}),n.d(M,"loadTinyYolov2Model",function(){return Wc}
8212),n.d(M,"loadFaceLandmarkModel",function(){return Wp}),n.d(M,"loadFaceLandmarkTinyModel",function(){return Oh}),n.d(M,"loadFaceRecognitionModel",function(){return Ff}),n.d(M,"loadFaceExpressionModel",function(){return ef}),n.d(M,"loadAgeGenderModel",function(){return Dh}),n.d(M,"loadFaceDetectionModel",function(){return qg}),n.d(M,"locateFaces",function(){return Th}),n.d(M,"detectLandmarks",function(){return tf}),n.d(M,"Mtcnn",function(){return Eh}),n.d(M,"MtcnnOptions",function(){return Ql}),n.d(M,"iou",function(){return Ku}),n.d(M,"minBbox",function(){return Fc}),n.d(M,"nonMaxSuppression",function(){return il}),n.d(M,"normalize",function(){return Sl}),n.d(M,"padToSquare",function(){return Rc}),n.d(M,"shuffleArray",function(){return Cf}),n.d(M,"SsdMobilenetv1",function(){return Jm}),n.d(M,"SsdMobilenetv1Options",function(){return Zl}),n.d(M,"TinyFaceDetector",function(){return Sh}),n.d(M,"TinyFaceDetectorOptions",function(){return Vg}),n.d(M,"TinyYolov2SizeType",function(){return H0}),n.d(M,"TinyYolov2Options",function(){return Pp}),n.d(M,"validateConfig",function(){return Zv});var P={};n.d(P,"getRobin",function(){return gg}),n.d(P,"getImageData",function(){return S1});var L=n(18),V=n.n(L),N=n(2),ee=n(67),J=n(6),K=n.n(J),re=n(10),ce=n.n(re),pe=n(9),ke=n.n(pe),Ce=n(4),be=n.n(Ce);function $e(q,R){return R?new Promise(function(F,I){q.then(function(U){R(void 0,U),F(U)}).catch(function(U){R(U),I(U)})}):q}var ht=function(){function q(R,F,I,U){ce()(this,q),this.model=R,this.audioContext=F,this.stream=I,this.frequency=null,this.ready=$e(this.loadModel(R),U)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return U.next=2,N.loadLayersModel("".concat(I,"/model.json"));case 2:if(this.model=U.sent,!this.audioContext){U.next=8;break}return U.next=6,this.processStream();case 6:U.next=9;break;case 8:throw new Error("Could not access microphone - getUserMedia not available");case 9:return U.abrupt("return",this);case 10:case"end":return U.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"processStream",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,N.nextFrame();case 2:for(I=this.audioContext.createMediaStreamSource(this.stream),U=this.audioContext.sampleRate/16e3*1024,X=4;X<U;)X*=2;(oe=this.audioContext.createScriptProcessor(X,1,1)).onaudioprocess=this.processMicrophoneBuffer.bind(this),(me=this.audioContext.createGain()).gain.setValueAtTime(0,this.audioContext.currentTime),I.connect(oe),oe.connect(me),me.connect(this.audioContext.destination),this.audioContext.state!=="running"&&console.warn("User gesture needed to start AudioContext, please click");case 14:case"end":return Se.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"processMicrophoneBuffer",value:function(){var R=K()(be.a.mark(function F(I){var U=this;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,N.nextFrame();case 2:this.results={},q.resample(I.inputBuffer,function(oe){N.tidy(function(){var me=N.add(N.linspace(0,7180,360),N.tensor(1997.379408437619));U.running=!0;var Se=N.tensor(oe.slice(0,1024)),Me=N.sub(Se,N.mean(Se)),Te=N.tensor(N.norm(Me).dataSync()/Math.sqrt(1024)),tt=N.div(Me,Te).reshape([1,1024]),at=U.model.predict([tt]).reshape([360]),jt=at.max().dataSync()[0],$t=at.argMax().dataSync()[0];U.results.confidence=jt.toFixed(3);var vn=Math.max(0,$t-4),wn=Math.min(360,$t+5),Nn=at.slice([vn],[wn-vn]),In=me.slice([vn],[wn-vn]),Ln=N.mul(Nn,In).dataSync().reduce(function(wr,Fr){return wr+Fr},0)/Nn.dataSync().reduce(function(wr,Fr){return wr+Fr},0),qn=10*Math.pow(2,Ln/1200),Cn=jt>.5?qn:null;U.frequency=Cn})});case 4:case"end":return X.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"getPitch",value:function(){var R=K()(be.a.mark(function F(I){var U;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,this.ready;case 2:return X.next=4,N.nextFrame();case 4:return U=this.frequency,I&&I(void 0,U),X.abrupt("return",U);case 7:case"end":return X.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()}],[{key:"resample",value:function(R,F){for(var I=R.sampleRate%16e3!=0,U=R.sampleRate/16e3,X=R.getChannelData(0),oe=new Float32Array(1024),me=0;me<1024;me+=1)if(I){var Se=Math.floor(me*U),Me=Se+1,Te=me*U-Se;oe[me]=(1-Te)*X[Se]+Te*X[Me]}else oe[me]=X[me*U];F(oe)}}]),q}(),Dt=function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"./",R=arguments.length>1?arguments[1]:void 0,F=arguments.length>2?arguments[2]:void 0,I=arguments.length>3?arguments[3]:void 0;return new ht(q,R,F,I)},Ut=n(7),Ee=n.n(Ut),Ot=n(17),zt=n.n(Ot),Mt=n(20),Ke=n(0);/** 8213 * @license 8214 * Copyright 2019 Google LLC. All Rights Reserved. 8215 * Licensed under the Apache License, Version 2.0 (the "License");
8216 * you may not use this file except in compliance with the License. 8217 * You may obtain a copy of the License at 8218 * 8219 * http://www.apache.org/licenses/LICENSE-2.0 8220 * 8221 * Unless required by applicable law or agreed to in writing, software 8222 * distributed under the License is distributed on an "AS IS" BASIS, 8223 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8224 * See the License for the specific language governing permissions and 8225 * limitations under the License. 8226 * ============================================================================= 8227 */function Tt(q,R,F,I){return new(F||(F=Promise))(function(U,X){function oe(Me){try{Se(I.next(Me))}catch(Te){X(Te)}}function me(Me){try{Se(I.throw(Me))}catch(Te){X(Te)}}function Se(Me){Me.done?U(Me.value):new F(function(Te){Te(Me.value)}).then(oe,me)}Se((I=I.apply(q,R||[])).next())})}function vt(q,R){var F,I,U,X,oe={label:0,sent:function(){if(1&U[0])throw U[1];return U[1]},trys:[],ops:[]};return X={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function me(Se){return function(Me){return function(Te){if(F)throw new TypeError("Generator is already executing.");for(;oe;)try{if(F=1,I&&(U=2&Te[0]?I.return:Te[0]?I.throw||((U=I.return)&&U.call(I),0):I.next)&&!(U=U.call(I,Te[1])).done)return U;switch(I=0,U&&(Te=[2&Te[0],U.value]),Te[0]){case 0:case 1:U=Te;break;case 4:return oe.label++,{value:Te[1],done:!1};case 5:oe.label++,I=Te[1],Te=[0];continue;case 7:Te=oe.ops.pop(),oe.trys.pop();continue;default:if(!(U=(U=oe.trys).length>0&&U[U.length-1])&&(Te[0]===6||Te[0]===2)){oe=0;continue}if(Te[0]===3&&(!U||Te[1]>U[0]&&Te[1]<U[3])){oe.label=Te[1];break}if(Te[0]===6&&oe.label<U[1]){oe.label=U[1],U=Te;break}if(U&&oe.label<U[2]){oe.label=U[2],oe.ops.push(Te);break}U[2]&&oe.ops.pop(),oe.trys.pop();continue}Te=R.call(q,oe)}catch(tt){Te=[6,tt],I=0}finally{F=U=0}if(5&Te[0])throw Te[1];return{value:Te[0]?Te[1]:void 0,done:!0}}([Se,Me])}}}var yt
vendor: 27,569 bytes, line 8227
8227={0:"tench, Tinca tinca",1:"goldfish, Carassius auratus",2:"great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",3:"tiger shark, Galeocerdo cuvieri",4:"hammerhead, hammerhead shark",5:"electric ray, crampfish, numbfish, torpedo",6:"stingray",7:"cock",8:"hen",9:"ostrich, Struthio camelus",10:"brambling, Fringilla montifringilla",11:"goldfinch, Carduelis carduelis",12:"house finch, linnet, Carpodacus mexicanus",13:"junco, snowbird",14:"indigo bunting, indigo finch, indigo bird, Passerina cyanea",15:"robin, American robin, Turdus migratorius",16:"bulbul",17:"jay",18:"magpie",19:"chickadee",20:"water ouzel, dipper",21:"kite",22:"bald eagle, American eagle, Haliaeetus leucocephalus",23:"vulture",24:"great grey owl, great gray owl, Strix nebulosa",25:"European fire salamander, Salamandra salamandra",26:"common newt, Triturus vulgaris",27:"eft",28:"spotted salamander, Ambystoma maculatum",29:"axolotl, mud puppy, Ambystoma mexicanum",30:"bullfrog, Rana catesbeiana",31:"tree frog, tree-frog",32:"tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",33:"loggerhead, loggerhead turtle, Caretta caretta",34:"leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",35:"mud turtle",36:"terrapin",37:"box turtle, box tortoise",38:"banded gecko",39:"common iguana, iguana, Iguana iguana",40:"American chameleon, anole, Anolis carolinensis",41:"whiptail, whiptail lizard",42:"agama",43:"frilled lizard, Chlamydosaurus kingi",44:"alligator lizard",45:"Gila monster, Heloderma suspectum",46:"green lizard, Lacerta viridis",47:"African chameleon, Chamaeleo chamaeleon",48:"Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",49:"African crocodile, Nile crocodile, Crocodylus niloticus",50:"American alligator, Alligator mississipiensis",51:"triceratops",52:"thunder snake, worm snake, Carphophis amoenus",53:"ringneck snake, ring-necked snake, ring snake",54:"hognose snake, puff adder, sand viper",55:"green snake, grass snake",56:"king snake, kingsnake",57:"garter snake, grass snake",58:"water snake",59:"vine snake",60:"night snake, Hypsiglena torquata",61:"boa constrictor, Constrictor constrictor",62:"rock python, rock snake, Python sebae",63:"Indian cobra, Naja naja",64:"green mamba",65:"sea snake",66:"horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",67:"diamondback, diamondback rattlesnake, Crotalus adamanteus",68:"sidewinder, horned rattlesnake, Crotalus cerastes",69:"trilobite",70:"harvestman, daddy longlegs, Phalangium opilio",71:"scorpion",72:"black and gold garden spider, Argiope aurantia",73:"barn spider, Araneus cavaticus",74:"garden spider, Aranea diademata",75:"black widow, Latrodectus mactans",76:"tarantula",77:"wolf spider, hunting spider",78:"tick",79:"centipede",80:"black grouse",81:"ptarmigan",82:"ruffed grouse, partridge, Bonasa umbellus",83:"prairie chicken, prairie grouse, prairie fowl",84:"peacock",85:"quail",86:"partridge",87:"African grey, African gray, Psittacus erithacus",88:"macaw",89:"sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",90:"lorikeet",91:"coucal",92:"bee eater",93:"hornbill",94:"hummingbird",95:"jacamar",96:"toucan",97:"drake",98:"red-breasted merganser, Mergus serrator",99:"goose",100:"black swan, Cygnus atratus",101:"tusker",102:"echidna, spiny anteater, anteater",103:"platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",104:"wallaby, brush kangaroo",105:"koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",106:"wombat",107:"jelly fish",108:"sea anemone, anemone",109:"brain coral",110:"flatworm, platyhelminth",111:"nematode, nematode worm, roundworm",112:"conch",113:"snail",114:"slug",115:"sea slug, nudibranch",116:"chiton, coat-of-mail shell, sea cradle, polyplacophore",117:"chambered nautilus, pearly nautilus, nautilus",118:"Dungeness crab, Cancer magister",119:"rock crab, Cancer irroratus",120:"fiddler crab",121:"king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",122:"American lobster, Northern lobster, Maine lobster, Homarus americanus",123:"spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",124:"crayfish, crawfish, crawdad, crawdaddy",125:"hermit crab",126:"isopod",127:"white stork, Ciconia ciconia",128:"black stork, Ciconia nigra",129:"spoonbill",130:"flamingo",131:"little blue heron, Egretta caerulea",132:"American egret, great white heron, Egretta albus",133:"bittern",134:"crane",135:"limpkin, Aramus pictus",136:"European gallinule, Porphyrio porphyrio",137:"American coot, marsh hen, mud hen, water hen, Fulica americana",138:"bustard",139:"ruddy turnstone, Arenaria interpres",140:"red-backed sandpiper, dunlin, Erolia alpina",141:"redshank, Tringa totanus",142:"dowitcher",143:"oystercatcher, oyster catcher",144:"pelican",145:"king penguin, Aptenodytes patagonica",146:"albatross, mollymawk",147:"grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",148:"killer whale, killer, orca, grampus, sea wolf, Orcinus orca",149:"dugong, Dugong dugon",150:"sea lion",151:"Chihuahua",152:"Japanese spaniel",153:"Maltese dog, Maltese terrier, Maltese",154:"Pekinese, Pekingese, Peke",155:"Shih-Tzu",156:"Blenheim spaniel",157:"papillon",158:"toy terrier",159:"Rhodesian ridgeback",160:"Afghan hound, Afghan",161:"basset, basset hound",162:"beagle",163:"bloodhound, sleuthhound",164:"bluetick",165:"black-and-tan coonhound",166:"Walker hound, Walker foxhound",167:"English foxhound",168:"redbone",169:"borzoi, Russian wolfhound",170:"Irish wolfhound",171:"Italian greyhound",172:"whippet",173:"Ibizan hound, Ibizan Podenco",174:"Norwegian elkhound, elkhound",175:"otterhound, otter hound",176:"Saluki, gazelle hound",177:"Scottish deerhound, deerhound",178:"Weimaraner",179:"Staffordshire bullterrier, Staffordshire bull terrier",180:"American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",181:"Bedlington terrier",182:"Border terrier",183:"Kerry blue terrier",184:"Irish terrier",185:"Norfolk terrier",186:"Norwich terrier",187:"Yorkshire terrier",188:"wire-haired fox terrier",189:"Lakeland terrier",190:"Sealyham terrier, Sealyham",191:"Airedale, Airedale terrier",192:"cairn, cairn terrier",193:"Australian terrier",194:"Dandie Dinmont, Dandie Dinmont terrier",195:"Boston bull, Boston terrier",196:"miniature schnauzer",197:"giant schnauzer",198:"standard schnauzer",199:"Scotch terrier, Scottish terrier, Scottie",200:"Tibetan terrier, chrysanthemum dog",201:"silky terrier, Sydney silky",202:"soft-coated wheaten terrier",203:"West Highland white terrier",204:"Lhasa, Lhasa apso",205:"flat-coated retriever",206:"curly-coated retriever",207:"golden retriever",208:"Labrador retriever",209:"Chesapeake Bay retriever",210:"German short-haired pointer",211:"vizsla, Hungarian pointer",212:"English setter",213:"Irish setter, red setter",214:"Gordon setter",215:"Brittany spaniel",216:"clumber, clumber spaniel",217:"English springer, English springer spaniel",218:"Welsh springer spaniel",219:"cocker spaniel, English cocker spaniel, cocker",220:"Sussex spaniel",221:"Irish water spaniel",222:"kuvasz",223:"schipperke",224:"groenendael",225:"malinois",226:"briard",227:"kelpie",228:"komondor",229:"Old English sheepdog, bobtail",230:"Shetland sheepdog, Shetland sheep dog, Shetland",231:"collie",232:"Border collie",233:"Bouvier des Flandres, Bouviers des Flandres",234:"Rottweiler",235:"German shepherd, German shepherd dog, German police dog, alsatian",236:"Doberman, Doberman pinscher",237:"miniature pinscher",238:"Greater Swiss Mountain dog",239:"Bernese mountain dog",240:"Appenzeller",241:"EntleBucher",242:"boxer",243:"bull mastiff",244:"Tibetan mastiff",245:"French bulldog",246:"Great Dane",247:"Saint Bernard, St Bernard",248:"Eskimo dog, husky",249:"malamute, malemute, Alaskan malamute",250:"Siberian husky",251:"dalmatian, coach dog, carriage dog",252:"affenpinscher, monkey pinscher, monkey dog",253:"basenji",254:"pug, pug-dog",255:"Leonberg",256:"Newfoundland, Newfoundland dog",257:"Great Pyrenees",258:"Samoyed, Samoyede",259:"Pomeranian",260:"chow, chow chow",261:"keeshond",262:"Brabancon griffon",263:"Pembroke, Pembroke Welsh corgi",264:"Cardigan, Cardigan Welsh corgi",265:"toy poodle",266:"miniature poodle",267:"standard poodle",268:"Mexican hairless",269:"timber wolf, grey wolf, gray wolf, Canis lupus",270:"white wolf, Arctic wolf, Canis lupus tundrarum",271:"red wolf, maned wolf, Canis rufus, Canis niger",272:"coyote, prairie wolf, brush wolf, Canis latrans",273:"dingo, warrigal, warragal, Canis dingo",274:"dhole, Cuon alpinus",275:"African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",276:"hyena, hyaena",277:"red fox, Vulpes vulpes",278:"kit fox, Vulpes macrotis",279:"Arctic fox, white fox, Alopex lagopus",280:"grey fox, gray fox, Urocyon cinereoargenteus",281:"tabby, tabby cat",282:"tiger cat",283:"Persian cat",284:"Siamese cat, Siamese",285:"Egyptian cat",286:"cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",287:"lynx, catamount",288:"leopard, Panthera pardus",289:"snow leopard, ounce, Panthera uncia",290:"jaguar, panther, Panthera onca, Felis onca",291:"lion, king of beasts, Panthera leo",292:"tiger, Panthera tigris",293:"cheetah, chetah, Acinonyx jubatus",294:"brown bear, bruin, Ursus arctos",295:"American black bear, black bear, Ursus americanus, Euarctos americanus",296:"ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",297:"sloth bear, Melursus ursinus, Ursus ursinus",298:"mongoose",299:"meerkat, mierkat",300:"tiger beetle",301:"ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",302:"ground beetle, carabid beetle",303:"long-horned beetle, longicorn, longicorn beetle",304:"leaf beetle, chrysomelid",305:"dung beetle",306:"rhinoceros beetle",307:"weevil",308:"fly",309:"bee",310:"ant, emmet, pismire",311:"grasshopper, hopper",312:"cricket",313:"walking stick, walkingstick, stick insect",314:"cockroach, roach",315:"mantis, mantid",316:"cicada, cicala",317:"leafhopper",318:"lacewing, lacewing fly",319:"dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",320:"damselfly",321:"admiral",322:"ringlet, ringlet butterfly",323:"monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",324:"cabbage butterfly",325:"sulphur butterfly, sulfur butterfly",326:"lycaenid, lycaenid butterfly",327:"starfish, sea star",328:"sea urchin",329:"sea cucumber, holothurian",330:"wood rabbit, cottontail, cottontail rabbit",331:"hare",332:"Angora, Angora rabbit",333:"hamster",334:"porcupine, hedgehog",335:"fox squirrel, eastern fox squirrel, Sciurus niger",336:"marmot",337:"beaver",338:"guinea pig, Cavia cobaya",339:"sorrel",340:"zebra",341:"hog, pig, grunter, squealer, Sus scrofa",342:"wild boar, boar, Sus scrofa",343:"warthog",344:"hippopotamus, hippo, river horse, Hippopotamus amphibius",345:"ox",346:"water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",347:"bison",348:"ram, tup",349:"bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",350:"ibex, Capra ibex",351:"hartebeest",352:"impala, Aepyceros melampus",353:"gazelle",354:"Arabian camel, dromedary, Camelus dromedarius",355:"llama",356:"weasel",357:"mink",358:"polecat, fitch, foulmart, foumart, Mustela putorius",359:"black-footed ferret, ferret, Mustela nigripes",360:"otter",361:"skunk, polecat, wood pussy",362:"badger",363:"armadillo",364:"three-toed sloth, ai, Bradypus tridactylus",365:"orangutan, orang, orangutang, Pongo pygmaeus",366:"gorilla, Gorilla gorilla",367:"chimpanzee, chimp, Pan troglodytes",368:"gibbon, Hylobates lar",369:"siamang, Hylobates syndactylus, Symphalangus syndactylus",370:"guenon, guenon monkey",371:"patas, hussar monkey, Erythrocebus patas",372:"baboon",373:"macaque",374:"langur",375:"colobus, colobus monkey",376:"proboscis monkey, Nasalis larvatus",377:"marmoset",378:"capuchin, ringtail, Cebus capucinus",379:"howler monkey, howler",380:"titi, titi monkey",381:"spider monkey, Ateles geoffroyi",382:"squirrel monkey, Saimiri sciureus",383:"Madagascar cat, ring-tailed lemur, Lemur catta",384:"indri, indris, Indri indri, Indri brevicaudatus",385:"Indian elephant, Elephas maximus",386:"African elephant, Loxodonta africana",387:"lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",388:"giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",389:"barracouta, snoek",390:"eel",391:"coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",392:"rock beauty, Holocanthus tricolor",393:"anemone fish",394:"sturgeon",395:"gar, garfish, garpike, billfish, Lepisosteus osseus",396:"lionfish",397:"puffer, pufferfish, blowfish, globefish",398:"abacus",399:"abaya",400:"academic gown, academic robe, judge's robe",401:"accordion, piano accordion, squeeze box",402:"acoustic guitar",403:"aircraft carrier, carrier, flattop, attack aircraft carrier",404:"airliner",405:"airship, dirigible",406:"altar",407:"ambulance",408:"amphibian, amphibious vehicle",409:"analog clock",410:"apiary, bee house",411:"apron",412:"ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",413:"assault rifle, assault gun",414:"backpack, back pack, knapsack, packsack, rucksack, haversack",415:"bakery, bakeshop, bakehouse",416:"balance beam, beam",417:"balloon",418:"ballpoint, ballpoint pen, ballpen, Biro",419:"Band Aid",420:"banjo",421:"bannister, banister, balustrade, balusters, handrail",422:"barbell",423:"barber chair",424:"barbershop",425:"barn",426:"barometer",427:"barrel, cask",428:"barrow, garden cart, lawn cart, wheelbarrow",429:"baseball",430:"basketball",431:"bassinet",432:"bassoon",433:"bathing cap, swimming cap",434:"bath towel",435:"bathtub, bathing tub, bath, tub",436:"beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",437:"beacon, lighthouse, beacon light, pharos",438:"beaker",439:"bearskin, busby, shako",440:"beer bottle",441:"beer glass",442:"bell cote, bell cot",443:"bib",444:"bicycle-built-for-two, tandem bicycle, tandem",445:"bikini, two-piece",446:"binder, ring-binder",447:"binoculars, field glasses, opera glasses",448:"birdhouse",449:"boathouse",450:"bobsled, bobsleigh, bob",451:"bolo tie, bolo, bola tie, bola",452:"bonnet, poke bonnet",453:"bookcase",454:"bookshop, bookstore, bookstall",455:"bottlecap",456:"bow",457:"bow tie, bow-tie, bowtie",458:"brass, memorial tablet, plaque",459:"brassiere, bra, bandeau",460:"breakwater, groin, groyne, mole, bulwark, seawall, jetty",461:"breastplate, aegis, egis",462:"broom",463:"bucket, pail",464:"buckle",465:"bulletproof vest",466:"bullet train, bullet",467:"butcher shop, meat market",468:"cab, hack, taxi, taxicab",469:"caldron, cauldron",470:"candle, taper, wax light",471:"cannon",472:"canoe",473:"can opener, tin opener",474:"cardigan",475:"car mirror",476:"carousel, carrousel, merry-go-round, roundabout, whirligig",477:"carpenter's kit, tool kit",478:"carton",479:"car wheel",480:"cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",481:"cassette",482:"cassette player",483:"castle",484:"catamaran",485:"CD player",486:"cello, violoncello",487:"cellular telephone, cellular phone, cellphone, cell, mobile phone",488:"chain",489:"chainlink fence",490:"chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",491:"chain saw, chainsaw",492:"chest",493:"chiffonier, commode",494:"chime, bell, gong",495:"china cabinet, china closet",496:"Christmas stocking",497:"church, church building",498:"cinema, movie theater, movie theatre, movie house, picture palace",499:"cleaver, meat cleaver, chopper",500:"cliff dwelling",501:"cloak",502:"clog, geta, patten, sabot",503:"cocktail shaker",504:"coffee mug",505:"coffeepot",506:"coil, spiral, volute, whorl, helix",507:"combination lock",508:"computer keyboard, keypad",509:"confectionery, confectionary, candy store",510:"container ship, containership, container vessel",511:"convertible",512:"corkscrew, bottle screw",513:"cornet, horn, trumpet, trump",514:"cowboy boot",515:"cowboy hat, ten-gallon hat",516:"cradle",517:"crane",518:"crash helmet",519:"crate",520:"crib, cot",521:"Crock Pot",522:"croquet ball",523:"crutch",524:"cuirass",525:"dam, dike, dyke",526:"desk",527:"desktop computer",528:"dial telephone, dial phone",529:"diaper, nappy, napkin",530:"digital clock",531:"digital watch",532:"dining table, board",533:"dishrag, dishcloth",534:"dishwasher, dish washer, dishwashing machine",535:"disk brake, disc brake",536:"dock, dockage, docking facility",537:"dogsled, dog sled, dog sleigh",538:"dome",539:"doormat, welcome mat",540:"drilling platform, offshore rig",541:"drum, membranophone, tympan",542:"drumstick",543:"dumbbell",544:"Dutch oven",545:"electric fan, blower",546:"electric guitar",547:"electric locomotive",548:"entertainment center",549:"envelope",550:"espresso maker",551:"face powder",552:"feather boa, boa",553:"file, file cabinet, filing cabinet",554:"fireboat",555:"fire engine, fire truck",556:"fire screen, fireguard",557:"flagpole, flagstaff",558:"flute, transverse flute",559:"folding chair",560:"football helmet",561:"forklift",562:"fountain",563:"fountain pen",564:"four-poster",565:"freight car",566:"French horn, horn",567:"frying pan, frypan, skillet",568:"fur coat",569:"garbage truck, dustcart",570:"gasmask, respirator, gas helmet",571:"gas pump, gasoline pump, petrol pump, island dispenser",572:"goblet",573:"go-kart",574:"golf ball",575:"golfcart, golf cart",576:"gondola",577:"gong, tam-tam",578:"gown",579:"grand piano, grand",580:"greenhouse, nursery, glasshouse",581:"grille, radiator grille",582:"grocery store, grocery, food market, market",583:"guillotine",584:"hair slide",585:"hair spray",586:"half track",587:"hammer",588:"hamper",589:"hand blower, blow dryer, blow drier, hair dryer, hair drier",590:"hand-held computer, hand-held microcomputer",591:"handkerchief, hankie, hanky, hankey",592:"hard disc, hard disk, fixed disk",593:"harmonica, mouth organ, harp, mouth harp",594:"harp",595:"harvester, reaper",596:"hatchet",597:"holster",598:"home theater, home theatre",599:"honeycomb",600:"hook, claw",601:"hoopskirt, crinoline",602:"horizontal bar, high bar",603:"horse cart, horse-cart",604:"hourglass",605:"iPod",606:"iron, smoothing iron",607:"jack-o'-lantern",608:"jean, blue jean, denim",609:"jeep, landrover",610:"jersey, T-shirt, tee shirt",611:"jigsaw puzzle",612:"jinrikisha, ricksha, rickshaw",613:"joystick",614:"kimono",615:"knee pad",616:"knot",617:"lab coat, laboratory coat",618:"ladle",619:"lampshade, lamp shade",620:"laptop, laptop computer",621:"lawn mower, mower",622:"lens cap, lens cover",623:"letter opener, paper knife, paperknife",624:"library",625:"lifeboat",626:"lighter, light, igniter, ignitor",627:"limousine, limo",628:"liner, ocean liner",629:"lipstick, lip rouge",630:"Loafer",631:"lotion",632:"loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",633:"loupe, jeweler's loupe",634:"lumbermill, sawmill",635:"magnetic compass",636:"mailbag, postbag",637:"mailbox, letter box",638:"maillot",639:"maillot, tank suit",640:"manhole cover",641:"maraca",642:"marimba, xylophone",643:"mask",644:"matchstick",645:"maypole",646:"maze, labyrinth",647:"measuring cup",648:"medicine chest, medicine cabinet",649:"megalith, megalithic structure",650:"microphone, mike",651:"microwave, microwave oven",652:"military uniform",653:"milk can",654:"minibus",655:"miniskirt, mini",656:"minivan",657:"missile",658:"mitten",659:"mixing bowl",660:"mobile home, manufactured home",661:"Model T",662:"modem",663:"monastery",664:"monitor",665:"moped",666:"mortar",667:"mortarboard",668:"mosque",669:"mosquito net",670:"motor scooter, scooter",671:"mountain bike, all-terrain bike, off-roader",672:"mountain tent",673:"mouse, computer mouse",674:"mousetrap",675:"moving van",676:"muzzle",677:"nail",678:"neck brace",679:"necklace",680:"nipple",681:"notebook, notebook computer",682:"obelisk",683:"oboe, hautboy, hautbois",684:"ocarina, sweet potato",685:"odometer, hodometer, mileometer, milometer",686:"oil filter",687:"organ, pipe organ",688:"oscilloscope, scope, cathode-ray oscilloscope, CRO",689:"overskirt",690:"oxcart",691:"oxygen mask",692:"packet",693:"paddle, boat paddle",694:"paddlewheel, paddle wheel",695:"padlock",696:"paintbrush",697:"pajama, pyjama, pj's, jammies",698:"palace",699:"panpipe, pandean pipe, syrinx",700:"paper towel",701:"parachute, chute",702:"parallel bars, bars",703:"park bench",704:"parking meter",705:"passenger car, coach, carriage",706:"patio, terrace",707:"pay-phone, pay-station",708:"pedestal, plinth, footstall",709:"pencil box, pencil case",710:"pencil sharpener",711:"perfume, essence",712:"Petri dish",713:"photocopier",714:"pick, plectrum, plectron",715:"pickelhaube",716:"picket fence, paling",717:"pickup, pickup truck",718:"pier",719:"piggy bank, penny bank",720:"pill bottle",721:"pillow",722:"ping-pong ball",723:"pinwheel",724:"pirate, pirate ship",725:"pitcher, ewer",726:"plane, carpenter's plane, woodworking plane",727:"planetarium",728:"plastic bag",729:"plate rack",730:"plow, plough",731:"plunger, plumber's helper",732:"Polaroid camera, Polaroid Land camera",733:"pole",734:"police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",735:"poncho",736:"pool table, billiard table, snooker table",737:"pop bottle, soda bottle",738:"pot, flowerpot",739:"potter's wheel",740:"power drill",741:"prayer rug, prayer mat",742:"printer",743:"prison, prison house",744:"projectile, missile",745:"projector",746:"puck, hockey puck",747:"punching bag, punch bag, punching ball, punchball",748:"purse",749:"quill, quill pen",750:"quilt, comforter, comfort, puff",751:"racer, race car, racing car",752:"racket, racquet",753:"radiator",754:"radio, wireless",755:"radio telescope, radio reflector",756:"rain barrel",757:"recreational vehicle, RV, R.V.",758:"reel",759:"reflex camera",760:"refrigerator, icebox",761:"remote control, remote",762:"restaurant, eating house, eating place, eatery",763:"revolver, six-gun, six-shooter",764:"rifle",765:"rocking chair, rocker",766:"rotisserie",767:"rubber eraser, rubber, pencil eraser",768:"rugby ball",769:"rule, ruler",770:"running shoe",771:"safe",772:"safety pin",773:"saltshaker, salt shaker",774:"sandal",775:"sarong",776:"sax, saxophone",777:"scabbard",778:"scale, weighing machine",779:"school bus",780:"schooner",781:"scoreboard",782:"screen, CRT screen",783:"screw",784:"screwdriver",785:"seat belt, seatbelt",786:"sewing machine",787:"shield, buckler",788:"shoe shop, shoe-shop, shoe store",789:"shoji",790:"shopping basket",791:"shopping cart",792:"shovel",793:"shower cap",794:"shower curtain",795:"ski",796:"ski mask",797:"sleeping bag",798:"slide rule, slipstick",799:"sliding door",800:"slot, one-armed bandit",801:"snorkel",802:"snowmobile",803:"snowplow, snowplough",804:"soap dispenser",805:"soccer ball",806:"sock",807:"solar dish, solar collector, solar furnace",808:"sombrero",809:"soup bowl",810:"space bar",811:"space heater",812:"space shuttle",813:"spatula",814:"speedboat",815:"spider web, spider's web",816:"spindle",817:"sports car, sport car",818:"spotlight, spot",819:"stage",820:"steam locomotive",821:"steel arch bridge",822:"steel drum",823:"stethoscope",824:"stole",825:"stone wall",826:"stopwatch, stop watch",827:"stove",828:"strainer",829:"streetcar, tram, tramcar, trolley, trolley car",830:"stretcher",831:"studio couch, day bed",832:"stupa, tope",833:"submarine, pigboat, sub, U-boat",834:"suit, suit of clothes",835:"sundial",836:"sunglass",837:"sunglasses, dark glasses, shades",838:"sunscreen, sunblock, sun blocker",839:"suspension bridge",840:"swab, swob, mop",841:"sweatshirt",842:"swimming trunks, bathing trunks",843:"swing",844:"switch, electric switch, electrical switch",845:"syringe",846:"table lamp",847:"tank, army tank, armored combat vehicle, armoured combat vehicle",848:"tape player",849:"teapot",850:"teddy, teddy bear",851:"television, television system",852:"tennis ball",853:"thatch, thatched roof",854:"theater curtain, theatre curtain",855:"thimble",856:"thresher, thrasher, threshing machine",857:"throne",858:"tile roof",859:"toaster",860:"tobacco shop, tobacconist shop, tobacconist",861:"toilet seat",862:"torch",863:"totem pole",864:"tow truck, tow car, wrecker",865:"toyshop",866:"tractor",867:"trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",868:"tray",869:"trench coat",870:"tricycle, trike, velocipede",871:"trimaran",872:"tripod",873:"triumphal arch",874:"trolleybus, trolley coach, trackless trolley",875:"trombone",876:"tub, vat",877:"turnstile",878:"typewriter keyboard",879:"umbrella",880:"unicycle, monocycle",881:"upright, upright piano",882:"vacuum, vacuum cleaner",883:"vase",884:"vault",885:"velvet",886:"vending machine",887:"vestment",888:"viaduct",889:"violin, fiddle",890:"volleyball",891:"waffle iron",892:"wall clock",893:"wallet, billfold, notecase, pocketbook",894:"wardrobe, closet, press",895:"warplane, military plane",896:"washbasin, handbasin, washbowl, lavabo, wash-hand basin",897:"washer, automatic washer, washing machine",898:"water bottle",899:"water jug",900:"water tower",901:"whiskey jug",902:"whistle",903:"wig",904:"window screen",905:"window shade",906:"Windsor tie",907:"wine bottle",908:"wing",909:"wok",910:"wooden spoon",911:"wool, woolen, woollen",912:"worm fence, snake fence, snake-rail fence, Virginia fence",913:"wreck",914:"yawl",915:"yurt",916:"web site, website, internet site, site",917:"comic book",918:"crossword puzzle, crossword",919:"street sign",920:"traffic light, traffic signal, stoplight",921:"book jacket, dust cover, dust jacket, dust wrapper",922:"menu",923:"plate",924:"guacamole",925:"consomme",926:"hot pot, hotpot",927:"trifle",928:"ice cream, icecream",929:"ice lolly, lolly, lollipop, popsicle",930:"French loaf",931:"bagel, beigel",932:"pretzel",933:"cheeseburger",934:"hotdog, hot dog, red hot",935:"mashed potato",936:"head cabbage",937:"broccoli",938:"cauliflower",939:"zucchini, courgette",940:"spaghetti squash",941:"acorn squash",942:"butternut squash",943:"cucumber, cuke",944:"artichoke, globe artichoke",945:"bell pepper",946:"cardoon",947:"mushroom",948:"Granny Smith",949:"strawberry",950:"orange",951:"lemon",952:"fig",953:"pineapple, ananas",954:"banana",955:"jackfruit, jak, jack",956:"custard apple",957:"pomegranate",958:"hay",959:"carbonara",960:"chocolate sauce, chocolate syrup",961:"dough",962:"meat loaf, meatloaf",963:"pizza, pizza pie",964:"potpie",965:"burrito",966:"red wine",967:"espresso",968:"cup",969:"eggnog",970:"alp",971:"bubble",972:"cliff, drop, drop-off",973:"coral reef",974:"geyser",975:"lakeside, lakeshore",976:"promontory, headland, head, foreland",977:"sandbar, sand bar",978:"seashore, coast, seacoast, sea-coast",979:"valley, vale",980:"volcano",981:"ballplayer, baseball player",982:"groom, bridegroom",983:"scuba diver",984:"rapeseed",985:"daisy",986:"yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",987:"corn",988:"acorn",989:"hip, rose hip, rosehip",990:"buckeye, horse chestnut, conker",991:"coral fungus",992:"agaric",993:"gyromitra",994:"stinkhorn, carrion fungus",995:"earthstar",996:"hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",997:"bolete",998:"ear, spike, capitulum",999:"toilet tissue, toilet paper, bathroom tissue"},
8227bt={"1.00":"module_apply_default/MobilenetV1/Logits/global_pool","2.00":"module_apply_default/MobilenetV2/Logits/AvgPool"},Ht={"1.00":{.25:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_025_224/classification/1",inputRange:[0,1]},"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_050_224/classification/1",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_075_224/classification/1",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1",inputRange:[0,1]}},"2.00":{"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_050_224/classification/2",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_075_224/classification/2",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2",inputRange:[0,1]}}};function _t(q){return q===void 0&&(q={version:1,alpha:1}),Tt(this,void 0,void 0,function(){var R,F,I,U,X,oe;return vt(this,function(me){switch(me.label){case 0:if(Ke==null)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");if(F=q.version.toFixed(2),I=q.alpha?q.alpha.toFixed(2):"",U=-1,X=1,q.modelUrl==null){if(!(F in Ht))throw new Error("Invalid version of MobileNet. Valid versions are: "+Object.keys(Ht));if(!(I in Ht[F]))throw new Error("MobileNet constructed with invalid alpha "+q.alpha+". Valid multipliers for this version are: "+Object.keys(Ht[F])+".");R=Ht[F][I].inputRange,U=R[0],X=R[1]}return[4,(oe=new Ze(F,I,q.modelUrl,U,X)).load()];case 1:return me.sent(),[2,oe]}})})}var Ze=function(){function q(R,F,I,U,X){U===void 0&&(U=-1),X===void 0&&(X=1),this.version=R,this.alpha=F,this.modelUrl=I,this.inputMin=U,this.inputMax=X,this.inputRange=X-U}return q.prototype.load=function(){return Tt(this,void 0,void 0,function(){var R,F,I,U,X=this;return vt(this,function(oe){switch(oe.label){case 0:return this.modelUrl?(R=this,[4,Object(Mt.loadGraphModel)(this.modelUrl)]):[3,2];case 1:return R.model=oe.sent(),[3,4];case 2:return F=Ht[this.version][this.alpha].url,I=this,[4,Object(Mt.loadGraphModel)(F,{fromTFHub:!0})];case 3:I.model=oe.sent(),oe.label=4;case 4:return[4,(U=Object(Ke.tidy)(function(){return X.model.predict(Object(Ke.zeros)([1,224,224,3]))})).data()];case 5:return oe.sent(),U.dispose(),[2]}})})},q.prototype.infer=function(R,F){var I=this;return F===void 0&&(F=!1),Object(Ke.tidy)(function(){R instanceof Ke.Tensor||(R=Ke.browser.fromPixels(R));var U=R.toFloat().mul(I.inputRange).add(I.inputMin),X=U;R.shape[0]===224&&R.shape[1]===224||(X=Ke.image.resizeBilinear(U,[224,224],!0));var oe,me=X.reshape([-1,224,224,3]);if(F){var Se=bt[I.version];oe=I.model.execute(me,Se).squeeze([1,2])}else oe=I.model.predict(me).slice([0,1],[-1,1e3]);return oe})},q.prototype.classify=function(R,F){return F===void 0&&(F=3),Tt(this,void 0,void 0,function(){var I,U;return vt(this,function(X){switch(X.label){case 0:return[4,function(oe,me){return Tt(this,void 0,void 0,function(){var Se,Me,Te,tt,at,jt,$t;return vt(this,function(vn){switch(vn.label){case 0:return[4,(Se=oe.softmax()).data()];case 1:for(Me=vn.sent(),Se.dispose(),Te=[],$t=0;$t<Me.length;$t++)Te.push({value:Me[$t],index:$t});for(Te.sort(function(wn,Nn){return Nn.value-wn.value}),tt=new Float32Array(me),at=new Int32Array(me),$t=0;$t<me;$t++)tt[$t]=Te[$t].value,at[$t]=Te[$t].index;for(jt=[],$t=0;$t<at.length;$t++)jt.push({className:yt[at[$t]],probability:tt[$t]});return[2,jt]}})})}(I=this.infer(R),F)];case 1:return U=X.sent(),I.dispose(),[2,U]}})})},q}();function Vt(q,R,F){for(var I=[],U=0;U<q.length;U+=1)I.push({value:q[U],index:U});I.sort(function(Te,tt){return tt.value-Te.value});for(var X=new Float32Array(R),oe=new Int32Array(R),me=0;me<R;me+=1)X[me]=I[me].value,oe[me]=I[me].index;for(var Se=[],Me=0;Me<oe.length;Me+=1)Se.push({className:F[oe[Me]],probability:X[Me]});return Se}function sn(q,R,F){return yn.apply(this,arguments)}function yn(){return(yn=K()(be.a.mark(function q(R,F,I){var U;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,R.data();case 2:return U=X.sent,X.abrupt("return",Vt(U,F,I));case 4:case"end":return X.stop()}},q)}))).apply(this,arguments)}var Yt=["kit fox","English setter","Siberian husky","Australian terrier","English springer","grey whale","lesser panda","Egyptian cat","
8227ibex","Persian cat","cougar","gazelle","porcupine","sea lion","malamute","badger","Great Dane","Walker hound","Welsh springer spaniel","whippet","Scottish deerhound","killer whale","mink","African elephant","Weimaraner","soft-coated wheaten terrier","Dandie Dinmont","red wolf","Old English sheepdog","jaguar","otterhound","bloodhound","Airedale","hyena","meerkat","giant schnauzer","titi","three-toed sloth","sorrel","black-footed ferret","dalmatian","black-and-tan coonhound","papillon","skunk","Staffordshire bullterrier","Mexican hairless","Bouvier des Flandres","weasel","miniature poodle","Cardigan","malinois","bighorn","fox squirrel","colobus","tiger cat","Lhasa","impala","coyote","Yorkshire terrier","Newfoundland","brown bear","red fox","Norwegian elkhound","Rottweiler","hartebeest","Saluki","grey fox","schipperke","Pekinese","Brabancon griffon","West Highland white terrier","Sealyham terrier","guenon","mongoose","indri","tiger","Irish wolfhound","wild boar","EntleBucher","zebra","ram","French bulldog","orangutan","basenji","leopard","Bernese mountain dog","Maltese dog","Norfolk terrier","toy terrier","vizsla","cairn","squirrel monkey","groenendael","clumber","Siamese cat","chimpanzee","komondor","Afghan hound","Japanese spaniel","proboscis monkey","guinea pig","white wolf","ice bear","gorilla","borzoi","toy poodle","Kerry blue terrier","ox","Scotch terrier","Tibetan mastiff","spider monkey","Doberman","Boston bull","Greater Swiss Mountain dog","Appenzeller","Shih-Tzu","Irish water spaniel","Pomeranian","Bedlington terrier","warthog","Arabian camel","siamang","miniature schnauzer","collie","golden retriever","Irish terrier","affenpinscher","Border collie","hare","boxer","silky terrier","beagle","Leonberg","German short-haired pointer","patas","dhole","baboon","macaque","Chesapeake Bay retriever","bull mastiff","kuvasz","capuchin","pug","curly-coated retriever","Norwich terrier","flat-coated retriever","hog","keeshond","Eskimo dog","Brittany spaniel","standard poodle","Lakeland terrier","snow leopard","Gordon setter","dingo","standard schnauzer","hamster","Tibetan terrier","Arctic fox","wire-haired fox terrier","basset","water buffalo","American black bear","Angora","bison","howler monkey","hippopotamus","chow","giant panda","American Staffordshire terrier","Shetland sheepdog","Great Pyrenees","Chihuahua","tabby","marmoset","Labrador retriever","Saint Bernard","armadillo","Samoyed","bluetick","redbone","polecat","marmot","kelpie","gibbon","llama","miniature pinscher","wood rabbit","Italian greyhound","lion","cocker spaniel","Irish setter","dugong","Indian elephant","beaver","Sussex spaniel","Pembroke","Blenheim spaniel","Madagascar cat","Rhodesian ridgeback","lynx","African hunting dog","langur","Ibizan hound","timber wolf","cheetah","English foxhound","briard","sloth bear","Border terrier","German shepherd","otter","koala","tusker","echidna","wallaby","platypus","wombat","revolver","umbrella","schooner","soccer ball","accordion","ant","starfish","chambered nautilus","grand piano","laptop","strawberry","airliner","warplane","airship","balloon","space shuttle","fireboat","gondola","speedboat","lifeboat","canoe","yawl","catamaran","trimaran","container ship","liner","pirate","aircraft carrier","submarine","wreck","half track","tank","missile","bobsled","dogsled","bicycle-built-for-two","mountain bike","freight car","passenger car","barrow","shopping cart","motor scooter","forklift","electric locomotive","steam locomotive","amphibian","ambulance","beach wagon","cab","convertible","jeep","limousine","minivan","Model T","racer","sports car","go-kart","golfcart","moped","snowplow","fire engine","garbage truck","pickup","tow truck","trailer truck","moving van","police van","recreational vehicle","streetcar","snowmobile","tractor","mobile home","tricycle","unicycle","horse cart","jinrikisha","oxcart","bassinet","cradle","crib","four-poster","bookcase","china cabinet","medicine chest","chiffonier","table lamp","file","park bench","barber chair","throne","folding chair","rocking chair","studio couch","toilet seat","desk","pool table","dining table","entertainment center","wardrobe","Granny Smith","orange","lemon","fig","pineapple","banana","jackfruit","custard apple","pomegranate","acorn","hip","ear","rapeseed","corn","buckeye","organ","upright","chime","drum","gong","maraca","marimba","steel drum","banjo","cello","violin","harp","acoustic guitar","electric guitar","cornet","French horn","trombone","harmonica","ocarina","panpipe","bassoon","oboe","sax","flute","daisy","yellow lady's slipper","cliff","valley","alp","volcano","promontory","sandbar","coral reef","lakeside","seashore","geyser","hatchet","cleaver","letter opener","plane","power drill","lawn mower","hammer","corkscrew","can opener","plunger","screwdriver","shovel","plow","chain saw","cock","hen","ostrich","brambling","goldfinch","house finch","junco","indigo bunting","robin","bulbul","jay","magpie","chickadee","water ouzel","kite","bald eagle","vulture","great grey owl","black grouse","ptarmigan","ruffed grouse","prairie chicken","peacock","quail","partridge","African grey","macaw","sulphur-crested cockatoo","lorikeet","coucal","bee eater","hornbill","hummingbird","jacamar","toucan","drake","red-breasted merganser","goose","black swan","white stork","black stork","spoonbill","flamingo","American egret","little blue heron","bittern","crane","limpkin","American coot","bustard","ruddy turnstone","red-backed sandpiper","redshank","dowitcher","oystercatcher","European gallinule","pelican","king penguin","albatross","great white shark","tiger shark","hammerhead","electric ray","stingray","barracouta","coho","tench","goldfish","eel","rock beauty","anemone fish","lionfish","puffer","sturgeon","gar","loggerhead","leatherback turtle","mud turtle","terrapin","box turtle","banded gecko","common iguana","American chameleon","whiptail","agama","frilled lizard","alligator lizard","Gila monster","green lizard","African chameleon","Komodo dragon","triceratops","African crocodile","American alligator","thunder snake","ringneck snake","hognose snake","green snake","king snake","garter snake","water snake","vine snake","night snake","boa constrictor","rock python","Indian cobra","green mamba","sea snake","horned viper","diamondback","sidewinder","European fire salamander","common newt","eft","spotted salamander","axolotl","bullfrog","tree frog","tailed frog","whistle","wing","paintbrush","hand blower","oxygen mask","snorkel","loudspeaker","microphone","screen","mouse","electric fan","oil filter","strainer","space heater","stove","guillotine","barometer","rule","odometer","scale","analog clock","digital clock","wall clock","hourglass","sundial","parking meter","stopwatch","digital watch","stethoscope","syringe","magnetic compass","binoculars","projector","sunglasses","loupe","radio telescope","bow","cannon","assault rifle","rifle","projectile","computer keyboard","typewriter keyboard","crane","lighter","abacus","cash machine","slide rule","desktop computer","hand-held computer","notebook","web site","harvester","thresher","printer","slot","vending machine","sewing machine","joystick","switch","hook","car wheel","paddlewheel","pinwheel","potter's wheel","gas pump","carousel","swing","reel","radiator","puck","hard disc","sunglass","pick","car mirror","solar dish","remote control","disk brake","buckle","hair slide","knot","combination lock","padlock","nail","safety pin","screw","muzzle","seat belt","ski","candle","jack-o'-lantern","spotlight","torch","neck brace","pier","tripod","maypole","mousetrap","spider web","trilobite","harvestman","scorpion","black and gold garden spider","barn spider","garden spider","black widow","tarantula","wolf spider","tick","centipede","isopod","Dungeness crab","rock crab","fiddler crab","king crab","American lobster","spiny lobster","crayfish","hermit crab","tiger beetle","ladybug","ground beetle","long-horned beetle","leaf beetle","dung beetle","rhinoceros beetle","weevil","fly","bee","grasshopper","cricket","walking stick","cockroach","mantis","cicada","leafhopper","lacewing","dragonfly","damselfly","admiral","ringlet","monarch","cabbage butterfly","sulphur butterfly","lycaenid","jellyfish","sea anemone","brain coral","flatworm","nematode","conch","snail","slug","sea slug","chiton","sea urchin","sea cucumber","iron","espresso maker","microwave","Dutch oven","rotisserie","toaster","waffle iron","vacuum","dishwasher","refrigerator","washer","Crock Pot","frying pan","wok","caldron","coffeepot","teapot","spatula","altar","triumphal arch","patio","steel arch bridge","suspension bridge","viaduct","barn","greenhouse","palace","monastery","library","apiary","boathouse","church","mosque","stupa","planetarium","restaurant","cinema","home theater","lumbermill","coil","obelisk","totem pole","castle","prison","grocery store","bakery","barbershop","bookshop","butcher shop","confectionery","shoe shop","tobacco shop","toyshop","fountain","cliff dwelling","yurt","dock","brass","megalith","bannister","breakwater","dam","chainlink fence","picket fence","worm fence","stone wall","grille","sliding door","turnstile","mountain tent","scoreboard","honeycomb","plate rack","pedestal","beacon","mashed potato","bell pepper","head cabbage","broccoli","cauliflower","zucchini","spaghetti squash","acorn squash","butternut squash","cucumber","artichoke","cardoon","mushroom","shower curtain","jean","carton","handkerchief","sandal","ashcan","safe","plate","necklace","croquet ball","fur coat","thimble","pajama","running shoe","cocktail shaker","chest","manhole cover","modem","tub","tray","balance beam","bagel","prayer rug","kimono","hot pot","whiskey jug","knee pad","book jacket","spindle","ski mask","beer bottle","crash helmet","bottlecap","tile roof","mask","maillot","Petri dish","football helmet","bathing cap","teddy","holster","pop bottle","photocopier","vestment","crossword puzzle","golf ball","trifle","suit","water tower","feather boa","cloak","red wine","drumstick","shield","Christmas stocking","hoopskirt","menu","stage","bonnet","meat loaf","baseball","face powder","scabbard","
8227sunscreen","beer glass","hen-of-the-woods","guacamole","lampshade","wool","hay","bow tie","mailbag","water jug","bucket","dishrag","soup bowl","eggnog","mortar","trench coat","paddle","chain","swab","mixing bowl","potpie","wine bottle","shoji","bulletproof vest","drilling platform","binder","cardigan","sweatshirt","pot","birdhouse","hamper","ping-pong ball","pencil box","pay-phone","consomme","apron","punching bag","backpack","groom","bearskin","pencil sharpener","broom","mosquito net","abaya","mortarboard","poncho","crutch","Polaroid camera","space bar","cup","racket","traffic light","quill","radio","dough","cuirass","military uniform","lipstick","shower cap","monitor","oscilloscope","mitten","brassiere","French loaf","vase","milk can","rugby ball","paper towel","earthstar","envelope","miniskirt","cowboy hat","trolleybus","perfume","bathtub","hotdog","coral fungus","bullet train","pillow","toilet tissue","cassette","carpenter's kit","ladle","stinkhorn","lotion","hair spray","academic gown","dome","crate","wig","burrito","pill bottle","chain mail","theater curtain","window shade","barrel","washbasin","ballpoint","basketball","bath towel","cowboy boot","gown","window screen","agaric","cellular telephone","nipple","barbell","mailbox","lab coat","fire screen","minibus","packet","maze","pole","horizontal bar","sombrero","pickelhaube","rain barrel","wallet","cassette player","comic book","piggy bank","street sign","bell cote","fountain pen","Windsor tie","volleyball","overskirt","sarong","purse","bolo tie","bib","parachute","sleeping bag","television","swimming trunks","measuring cup","espresso","pizza","breastplate","shopping basket","wooden spoon","saltshaker","chocolate sauce","ballplayer","goblet","gyromitra","stretcher","water bottle","dial telephone","soap dispenser","jersey","school bus","jigsaw puzzle","plastic bag","reflex camera","diaper","Band Aid","ice lolly","velvet","tennis ball","gasmask","doormat","Loafer","ice cream","pretzel","quilt","maillot","tape player","clog","iPod","bolete","scuba diver","pitcher","matchstick","bikini","sock","CD player","lens cap","thatch","vault","beaker","bubble","cheeseburger","parallel bars","flagpole","coffee mug","rubber eraser","stole","carbonara","dumbbell"],We={DARKNET_URL:"https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknetreference/model.json",DARKNET_TINY_URL:"https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknettiny/model.json",IMAGE_SIZE_DARKNET:256,IMAGE_SIZE_DARKNET_TINY:224};function Ye(q,R){var F;q instanceof N.Tensor?F=q:q instanceof HTMLImageElement||q instanceof HTMLVideoElement||q instanceof HTMLCanvasElement||q instanceof ImageData?F=N.browser.fromPixels(q):Ee()(q)==="object"&&(q.elt instanceof HTMLImageElement||q.elt instanceof HTMLVideoElement||q.elt instanceof HTMLCanvasElement||q.elt instanceof ImageData)&&(F=N.browser.fromPixels(q.elt));
8227var I=F.toFloat().div(N.scalar(255)),U=I;return(I.shape[0]!==R||I.shape[1]!==R)&&(U=N.image.resizeBilinear(I,[R,R],!0)),U.reshape([1,R,R,3])}var He=function(){function q(R){switch(ce()(this,q),this.version=R,this.version){case"reference":this.imgSize=We.IMAGE_SIZE_DARKNET;break;case"tiny":this.imgSize=We.IMAGE_SIZE_DARKNET_TINY}}return ke()(q,[{key:"load",value:function(){var R=K()(be.a.mark(function F(){var I,U=this;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:X.t0=this.version,X.next=X.t0==="reference"?3:X.t0==="tiny"?7:11;break;case 3:return X.next=5,N.loadLayersModel(We.DARKNET_URL);case 5:return this.model=X.sent,X.abrupt("break",12);case 7:return X.next=9,N.loadLayersModel(We.DARKNET_TINY_URL);case 9:return this.model=X.sent,X.abrupt("break",12);case 11:return X.abrupt("break",12);case 12:return I=N.tidy(function(){return U.model.predict(N.zeros([1,U.imgSize,U.imgSize,3]))}),X.next=15,I.data();case 15:I.dispose();case 16:case"end":return X.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"classify",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me=this,Se=arguments;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return U=Se.length>1&&Se[1]!==void 0?Se[1]:3,X=N.tidy(function(){var Te=Ye(I,me.imgSize),tt=me.model.predict(Te);return N.softmax(tt)}),Me.next=4,sn(X,U,Yt);case 4:return oe=Me.sent,X.dispose(),Me.abrupt("return",oe);case 7:case"end":return Me.stop()}},F)}));return function(F){return R.apply(this,arguments)}}()}]),q}();function dt(q){return It.apply(this,arguments)}function It(){return(It=K()(be.a.mark(function q(R){var F,I;return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:if((F=R.version)==="reference"||F==="tiny"){U.next=3;break}throw new Error("Please select a version: darknet-reference or darknet-tiny");case 3:return I=new He(F),U.next=6,I.load();case 6:return U.abrupt("return",I);case 7:case"end":return U.stop()}},q)}))).apply(this,arguments)}var ct=n(23),on=n.n(ct),Xt=["flashlight","belt","mushroom","pond","strawberry","pineapple","sun","cow","ear","bush","pliers","watermelon","apple","baseball","feather","shoe","leaf","lollipop","crown","ocean","horse","mountain","mosquito","mug","hospital","saw","castle","angel","underwear","traffic_light","cruise_ship","marker","blueberry","flamingo","face","hockey_stick","bucket","campfire","asparagus","skateboard","door","suitcase","skull","cloud","paint_can","hockey_puck","steak","house_plant","sleeping_bag","bench","snowman","arm","crayon","fan","shovel","leg","washing_machine","harp","toothbrush","tree","bear","rake","megaphone","knee","guitar","calculator","hurricane","grapes","paintbrush","couch","nose","square","wristwatch","penguin","bridge","octagon","submarine","screwdriver","rollerskates","ladder","wine_bottle","cake","bracelet","broom","yoga","finger","fish","line","truck","snake","bus","stitches","snorkel","shorts","bowtie","pickup_truck","tooth","snail","foot","crab","school_bus","train","dresser","sock","tractor","map","hedgehog","coffee_cup","computer","matches","beard","frog","crocodile","bathtub","rain","moon","bee","knife","boomerang","lighthouse","chandelier","jail","pool","stethoscope","frying_pan","cell_phone","binoculars","purse","lantern","birthday_cake","clarinet","palm_tree","aircraft_carrier","vase","eraser","shark","skyscraper","bicycle","sink","teapot","circle","tornado","bird","stereo","mouth","key","hot_dog","spoon","laptop","cup","bottlecap","The_Great_Wall_of_China","The_Mona_Lisa","smiley_face","waterslide","eyeglasses","ceiling_fan","lobster","moustache","carrot","garden","police_car","postcard","necklace","helmet","blackberry","beach","golf_club","car","panda","alarm_clock","t-shirt","dog","bread","wine_glass","lighter","flower","bandage","drill","butterfly","swan","owl","raccoon","squiggle","calendar","giraffe","elephant","trumpet","rabbit","trombone","sheep","onion","church","flip_flops","spreadsheet","pear","clock","roller_coaster","parachute","kangaroo","duck","remote_control","compass","monkey","rainbow","tennis_racquet","lion","pencil","string_bean","oven","star","cat","pizza","soccer_ball","syringe","flying_saucer","eye","cookie","floor_lamp","mouse","toilet","toaster","The_Eiffel_Tower","airplane","stove","cello","stop_sign","tent","diving_board","light_bulb","hammer","scorpion","headphones","basket","spider","paper_clip","sweater","ice_cream","envelope","sea_turtle","donut","hat","hourglass","broccoli","jacket","backpack","book","lightning","drums","snowflake","radio","banana","camel","canoe","toothpaste","chair","picture_frame","parrot","sandwich","lipstick","pants","violin","brain","power_outlet","triangle","hamburger","dragon","bulldozer","cannon","dolphin","zebra","animal_migration","camouflage","scissors","basketball","elbow","umbrella","windmill","table","rifle","hexagon","potato","anvil","sword","peanut","axe","television","rhinoceros","baseball_bat","speedboat","sailboat","zigzag","garden_hose","river","house","pillow","ant","tiger","stairs","cooler","see_saw","piano","fireplace","popsicle","dumbbell","mailbox","barn","hot_tub","teddy-bear","fork","dishwasher","peas","hot_air_balloon","keyboard","microwave","wheel","fire_hydrant","van","camera","whale","candle","octopus","pig","swing_set","helicopter","saxophone","passport","bat","ambulance","diamond","goatee","fence","grass","mermaid","motorbike","microphone","toe","cactus","nail","telephone","hand","squirrel","streetlight","bed","firetruck"],En={DOODLENET_URL:"https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/doodlenet/model.json",IMAGE_SIZE_DOODLENET:28};function xe(q,R){var F;q instanceof N.Tensor?F=q:q instanceof HTMLImageElement||q instanceof HTMLVideoElement||q instanceof HTMLCanvasElement||q instanceof ImageData?F=N.browser.fromPixels(q):Ee()(q)==="object"&&(q.elt instanceof HTMLImageElement||q.elt instanceof HTMLVideoElement||q.elt instanceof HTMLCanvasElement||q.elt instanceof ImageData)&&(F=N.browser.fromPixels(q.elt));
8227var I=N.scalar(1).sub(F.toFloat().div(N.scalar(255))),U=I;I.shape[0]===R&&I.shape[1]===R||(U=N.image.resizeBilinear(I,[R,R]));var X=N.split(U,3,3),oe=on()(X,3),me=oe[0],Se=oe[1],Me=oe[2];return me.add(Se).add(Me).div(N.scalar(3)).floor().reshape([1,R,R,1])}var jn=function(){function q(){ce()(this,q),this.imgSize=En.IMAGE_SIZE_DOODLENET}return ke()(q,[{key:"load",value:function(){var R=K()(be.a.mark(function F(){var I,U=this;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,N.loadLayersModel(En.DOODLENET_URL);case 2:return this.model=X.sent,I=N.tidy(function(){return U.model.predict(N.zeros([1,U.imgSize,U.imgSize,1]))}),X.next=6,I.data();case 6:I.dispose();case 7:case"end":return X.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"classify",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me=this,Se=arguments;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return U=Se.length>1&&Se[1]!==void 0?Se[1]:10,X=N.tidy(function(){var Te=xe(I,me.imgSize);return me.model.predict(Te)}),Me.next=4,sn(X,U,Xt);case 4:return oe=Me.sent,X.dispose(),Me.abrupt("return",oe);case 7:case"end":return Me.stop()}},F)}));return function(F){return R.apply(this,arguments)}}()}]),q}();function nr(){return ar.apply(this,arguments)}function ar(){return(ar=K()(be.a.mark(function q(){var R;return be.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return R=new jn,F.next=3,R.load();case 3:return F.abrupt("return",R);case 4:case"end":return F.stop()}},q)}))).apply(this,arguments)}var cr=new(function(){function q(){ce()(this,q),typeof window<"u"&&(this.m_p5Instance=window)}return ke()(q,[{key:"setP5Instance",value:function(R){this.m_p5Instance=R}},{key:"p5Instance",get:function(){return this.m_p5Instance!==void 0&&typeof this.m_p5Instance.loadImage=="function"?this.m_p5Instance:this.m_p5Instance.p5!==void 0&&this.m_p5Instance.p5.Image!==void 0&&typeof this.m_p5Instance.p5.Image=="function"?this.m_p5Instance.p5:void 0}},{key:"checkP5",value:function(){return!!this.p5Instance}},{key:"getBlob",value:function(R){return new Promise(function(F,I){R.toBlob(function(U){U?F(U):I(new Error("Canvas could not be converted to Blob."))})})}},{key:"loadAsync",value:function(R){var F=this;return new Promise(function(I,U){F.p5Instance.loadImage(R,function(X){I(X)},function(){U(new Error("Could not load image from url ".concat(R)))})})}},{key:"rawToBlob",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se,Me,Te,tt;return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:for(oe=Array.from(I),me=document.createElement("canvas"),Se=me.getContext("2d"),me.width=U,me.height=X,Me=Se.createImageData(U,X),Te=Me.data,tt=0;tt<U*X*4;tt+=1)Te[tt]=oe[tt];return Se.putImageData(Me,0,0),at.abrupt("return",this.getBlob(me));case 10:case"end":return at.stop()}},F,this)}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"blobToP5Image",value:function(){var R=K()(be.a.mark(function F(I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:if(!this.checkP5()||typeof URL>"u"){U.next=2;break}return U.abrupt("return",this.loadAsync(URL.createObjectURL(I)));case 2:return U.abrupt("return",null);case 3:case"end":return U.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()}]),q}()),Er=function(q,R){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},I=q,U=document.createElement("video");return I.onplay=function(){var X=I.captureStream();U.srcObject=X,U.width=R,U.height=R,U.autoplay=!0,U.playsinline=!0,U.muted=!0,F()},U},hn=function(q){var R=on()(q.shape,2),F=R[0],I=R[1],U=q.dataSync(),X=document.createElement("canvas");X.width=I,X.height=F;for(var oe=X.getContext("2d"),me=oe.getImageData(0,0,X.width,X.height),Se=0;Se<I*F;Se+=1){var Me=4*Se,Te=3*Se;me.data[Me+0]=Math.floor(256*U[Te+0]),me.data[Me+1]=Math.floor(256*U[Te+1]),me.data[Me+2]=Math.floor(256*U[Te+2]),me.data[Me+3]=255}oe.putImageData(me,0,0);var tt=X.toDataURL(),at=document.createElement("img");return at.src=tt,at.style.width=I,at.style.height=F,q.dispose(),at},rn=function(q){var R=Math.min(q.shape[0],q.shape[1]),F=q.shape[0]/2-R/2,I=q.shape[1]/2-R/2;return q.slice([F,I,0],[R,R,3])},fn=function(q){var R,F,I;if(I=q instanceof HTMLImageElement||q instanceof HTMLCanvasElement||q instanceof HTMLVideoElement||q instanceof ImageData?q:Ee()(q)==="object"&&(q.elt instanceof HTMLImageElement||q.elt instanceof HTMLCanvasElement||q.elt instanceof HTMLVideoElement||q.elt instanceof ImageData)?q.elt:Ee()(q)==="object"&&q.canvas instanceof HTMLCanvasElement?q.canvas:q,R=I.width,F=I.height,cr.checkP5()){var U=cr.p5Instance.createGraphics(R,F);return U.push(),U.translate(R,0),U.scale(-1,1),U.image(q,0,0,R,F),U.pop(),U}var X=document.createElement("canvas");X.width=R,X.height=F;var oe=X.getContext("2d");return oe.drawImage(I,0,0,R,F),oe.translate(R,0),oe.scale(-1,1),oe.drawImage(X,-1*R,0,R,F),X};function Xn(q){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return N.tidy(function(){var F=N.browser.fromPixels(q);return R&&(F=N.image.resizeBilinear(F,R)),rn(F).expandDims(0).toFloat
8227().div(N.scalar(127)).sub(N.scalar(1))})}function Fn(q){return q instanceof HTMLVideoElement||q instanceof HTMLImageElement||q instanceof HTMLCanvasElement||q instanceof ImageData}function Ar(q){var R,F,I;I=q instanceof HTMLImageElement||q instanceof HTMLCanvasElement||q instanceof HTMLVideoElement||q instanceof ImageData?q:Ee()(q)==="object"&&(q.elt instanceof HTMLImageElement||q.elt instanceof HTMLCanvasElement||q.elt instanceof HTMLVideoElement||q.elt instanceof ImageData)?q.elt:Ee()(q)==="object"&&q.canvas instanceof HTMLCanvasElement?q.canvas:q,R=I.width,F=I.height;var U=document.createElement("canvas");U.width=R,U.height=F;var X=U.getContext("2d");X.drawImage(I,0,0,R,F);var oe=X.getImageData(0,0,R,F);return Array.from(oe.data)}var Dr={mobilenet:{version:2,alpha:1,topk:3}},xr=["mobilenet","darknet","darknet-tiny","doodlenet"],fi=function(){function q(R,F,I,U){if(ce()(this,q),this.video=F,this.model=null,this.mapStringToIndex=[],typeof R=="string")if(xr.includes(R))switch(this.modelName=R,this.modelUrl=null,this.modelName){case"mobilenet":this.modelToUse=s,this.version=I.version||Dr.mobilenet.version,this.alpha=I.alpha||Dr.mobilenet.alpha,this.topk=I.topk||Dr.mobilenet.topk;break;case"darknet":this.version="reference",this.modelToUse=h;break;case"darknet-tiny":this.version="tiny",this.modelToUse=h;break;case"doodlenet":this.modelToUse=v;break;default:this.modelToUse=null}else this.modelUrl=R,this.modelUrl.endsWith("/")&&(this.modelUrl+="model.json");this.ready=$e(this.loadModel(this.modelUrl),U)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:if(!I){U.next=6;break}return U.next=3,this.loadModelFrom(I);case 3:this.model=U.sent,U.next=9;break;case 6:return U.next=8,this.modelToUse.load({version:this.version,alpha:this.alpha});case 8:this.model=U.sent;case 9:return U.abrupt("return",this);case 10:case"end":return U.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"loadModelFrom",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me,Se,Me,Te,tt=arguments;return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:if(I=tt.length>0&&tt[0]!==void 0?tt[0]:null,at.prev=1,I===null){at.next=7;break}return at.next=5,zt.a.get(I);case 5:X=at.sent,U=X.data;case 7:if(U.ml5Specs&&(this.mapStringToIndex=U.ml5Specs.mapStringToIndex),this.mapStringToIndex.length!==0){at.next=16;break}return oe=I.split("/"),me=oe.slice(0,oe.length-1).join("/"),Se="".concat(me,"/metadata.json"),at.next=14,zt.a.get(Se).catch(function(jt){console.log("Tried to fetch metadata.json, but it seems to be missing.",jt)});case 14:(Me=at.sent)&&(Te=Me.data).labels&&(this.mapStringToIndex=Te.labels);case 16:return at.next=18,N.loadLayersModel(I);case 18:return this.model=at.sent,at.abrupt("return",this.model);case 22:return at.prev=22,at.t0=at.catch(1),console.error(at.t0),at.abrupt("return",at.t0);case 26:case"end":return at.stop()}},F,this,[[1,22]])}));return function(){return R.apply(this,arguments)}}()},{key:"classifyInternal",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se,Me,Te,tt=this;return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return at.next=2,this.ready;case 2:return at.next=4,N.nextFrame();case 4:if(!(I instanceof HTMLVideoElement&&I.readyState===0)){at.next=8;break}return X=I,at.next=8,new Promise(function(jt){X.onloadeddata=function(){return jt()}});case 8:if(!this.video||this.video.readyState!==0){at.next=11;break}return at.next=11,new Promise(function(jt){tt.video.onloadeddata=function(){return jt()}});case 11:if(oe=[224,224],!this.modelUrl){at.next=20;break}return at.next=15,N.nextFrame();case 15:return me=N.tidy(function(){var jt=Xn(I,oe),$t=tt.model.predict(jt);return Array.from($t.as1D().dataSync())}),at.next=18,me.map(function(jt,$t){return{label:tt.mapStringToIndex.length>0&&tt.mapStringToIndex[$t]?tt.mapStringToIndex[$t]:$t,confidence:jt}}).sort(function(jt,$t){return $t.confidence-jt.confidence});case 18:return Se=at.sent,at.abrupt("return",Se);case 20:return Me=Xn(I,oe),Te=this.model.classify(Me,U).then(function(jt){return jt.map(function($t){return{label:$t.className,confidence:$t.probability}})}),Me.dispose(),at.abrupt("return",Te);case 24:case"end":return at.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"classify",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me=arguments;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:if(U=Me.length>1&&Me[1]!==void 0?Me[1]:null,X=Me.length>2?Me[2]:void 0,oe=this.video,me=this.topk,typeof I!="function"){Te.next=9;break}oe=this.video,Se=I,Te.next=28;break;case 9:if(typeof I!="number"){Te.next=14;break}oe=this.video,me=I,Te.next=28;break;case 14:if(!(I instanceof HTMLVideoElement||I instanceof HTMLImageElement||I instanceof HTMLCanvasElement||I instanceof ImageData)){Te.next=18;break}oe=I,Te.next=28;break;case 18:if(Ee()(I)!=="object"||!(I.elt instanceof HTMLVideoElement||I.elt instanceof HTMLImageElement||I.elt instanceof HTMLCanvasElement||I.elt instanceof ImageData)){Te.next=22;break}oe=I.elt,Te.next=28;break;case 22:if(!(Ee()(I)==="object"&&I.canvas instanceof HTMLCanvasElement)){Te.next=26;break}oe=I.canvas,Te.next=28;break;case 26:if(this.video instanceof HTMLVideoElement){Te.next=28;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 28:return typeof U=="number"?me=U:typeof U=="function"&&(Se=U),typeof X=="function"&&(Se=X),Te.abrupt("return",$e(this.classifyInternal(oe,me),Se));case 31:case"end":return Te.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"predict",value:function(){var R=K()(be.a.mark(function F(I,U,X){return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.abrupt("return",this.classify(I,U||null,X));case 1:case"end":return oe.stop()}},F,this)}));return function(F,I,U){return R.apply(this,arguments)}}()}]),q}(),ci=function(q,R,F,I){var U,X={},oe=I,me=q;if(typeof me!="string")throw new Error('Please specify a model to use. E.g: "MobileNet"');me.indexOf("http")===-1&&(me=q.toLowerCase()),R instanceof HTMLVideoElement?U=R:Ee()(R)==="object"&&R.elt instanceof HTMLVideoElement?U=R.elt:Ee()(R)==="object"?X=R:typeof R=="function"&&(oe=R),Ee()(F)==="object"?X=F:typeof F=="function"&&(oe=F);var Se=new fi(me,U,X,oe);return oe?Se:Se.ready},qr=function(q,R){return(qr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,I){F.__proto__=I}||function(F,I){for(var U in I)I.hasOwnProperty(U)&&(F[U]=I[U])})(q,R)},mi=function(){return(mi=Object.assign||function(q){for(var R,F=1,I=arguments.length;F<I;F++)for(var U in R=arguments[F])Object.prototype.hasOwnProperty.call(R,U)&&(q[U]=R[U]);return q}).apply(this,arguments)};
8227function Ir(q,R,F,I){return new(F||(F=Promise))(function(U,X){function oe(Me){try{Se(I.next(Me))}catch(Te){X(Te)}}function me(Me){try{Se(I.throw(Me))}catch(Te){X(Te)}}function Se(Me){Me.done?U(Me.value):new F(function(Te){Te(Me.value)}).then(oe,me)}Se((I=I.apply(q,R||[])).next())})}function ti(q,R){var F,I,U,X,oe={label:0,sent:function(){if(1&U[0])throw U[1];return U[1]},trys:[],ops:[]};return X={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function me(Se){return function(Me){return function(Te){if(F)throw new TypeError("Generator is already executing.");for(;oe;)try{if(F=1,I&&(U=2&Te[0]?I.return:Te[0]?I.throw||((U=I.return)&&U.call(I),0):I.next)&&!(U=U.call(I,Te[1])).done)return U;switch(I=0,U&&(Te=[2&Te[0],U.value]),Te[0]){case 0:case 1:U=Te;break;case 4:return oe.label++,{value:Te[1],done:!1};case 5:oe.label++,I=Te[1],Te=[0];continue;case 7:Te=oe.ops.pop(),oe.trys.pop();continue;default:if(!(U=(U=oe.trys).length>0&&U[U.length-1])&&(Te[0]===6||Te[0]===2)){oe=0;continue}if(Te[0]===3&&(!U||Te[1]>U[0]&&Te[1]<U[3])){oe.label=Te[1];break}if(Te[0]===6&&oe.label<U[1]){oe.label=U[1],U=Te;break}if(U&&oe.label<U[2]){oe.label=U[2],oe.ops.push(Te);break}U[2]&&oe.ops.pop(),oe.trys.pop();continue}Te=R.call(q,oe)}catch(tt){Te=[6,tt],I=0}finally{F=U=0}if(5&Te[0])throw Te[1];return{value:Te[0]?Te[1]:void 0,done:!0}}([Se,Me])}}}function ri(q){var R=typeof Symbol=="function"&&q[Symbol.iterator],F=0;return R?R.call(q):{next:function(){return q&&F>=q.length&&(q=void 0),{value:q&&q[F++],done:!q}}}}function yi(q,R){var F=typeof Symbol=="function"&&q[Symbol.iterator];if(!F)return q;var I,U,X=F.call(q),oe=[];try{for(;(R===void 0||R-- >0)&&!(I=X.next()).done;)oe.push(I.value)}catch(me){U={error:me}}finally{try{I&&!I.done&&(F=X.return)&&F.call(X)}finally{if(U)throw U.error}}return oe}function na(){for(var q=[],R=0;R<arguments.length;R++)q=q.concat(yi(arguments[R]));return q}var co=null;function $i(q){return co==null&&(co=Object(N.backend)().epsilon()),Object(N.tidy)(function(){var R=Object(N.moments)(q),F=R.mean,I=R.variance;return q.sub(F).div(I.sqrt().add(co))})}var Ft=function(){function q(R){var F=this;if(R==null)throw new Error("Required configuration object is missing for BrowserFftFeatureExtractor constructor");if(R.spectrogramCallback==null)throw new Error("spectrogramCallback cannot be null or undefined");if(!(R.numFramesPerSpectrogram>0))throw new Error("Invalid value in numFramesPerSpectrogram: "+R.numFramesPerSpectrogram);if(R.suppressionTimeMillis<0)throw new Error("Expected suppressionTimeMillis to be >= 0, but got "+R.suppressionTimeMillis);if(this.suppressionTimeMillis=R.suppressionTimeMillis,this.spectrogramCallback=R.spectrogramCallback,this.numFrames=R.numFramesPerSpectrogram,this.sampleRateHz=R.sampleRateHz||44100,this.fftSize=R.fftSize||1024,this.frameDurationMillis=this.fftSize/this.sampleRateHz*1e3,this.columnTruncateLength=R.columnTruncateLength||this.fftSize,this.overlapFactor=R.overlapFactor,this.includeRawAudio=R.includeRawAudio,N.util.assert(this.overlapFactor>=0&&this.overlapFactor<1,function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+F.overlapFactor}),this.columnTruncateLength>this.fftSize)throw new Error("columnTruncateLength "+this.columnTruncateLength+" exceeds fftSize ("+this.fftSize+").");this.audioContextConstructor=window.AudioContext||window.webkitAudioContext}return q.prototype.start=function(R){return Ir(this,void 0,void 0,function(){var F,I,U;return ti(this,function(X){switch(X.label){case 0:if(this.frameIntervalTask!=null)throw new Error("Cannot start already-started BrowserFftFeatureExtractor");return F=this,[4,function(oe){return Ir(this,void 0,void 0,function(){return ti(this,function(me){switch(me.label){case 0:return[4,navigator.mediaDevices.getUserMedia({audio:oe==null||oe,video:!1})];case 1:return[2,me.sent()]}})})}(R)];case 1:return F.stream=X.sent(),this.audioContext=new this.audioContextConstructor,this.audioContext.sampleRate!==this.sampleRateHz&&console.warn("Mismatch in sampling rate: Expected: "+this.sampleRateHz
8227+"; Actual: "+this.audioContext.sampleRate),I=this.audioContext.createMediaStreamSource(this.stream),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=0,I.connect(this.analyser),this.freqDataQueue=[],this.freqData=new Float32Array(this.fftSize),this.includeRawAudio&&(this.timeDataQueue=[],this.timeData=new Float32Array(this.fftSize)),U=Math.max(1,Math.round(this.numFrames*(1-this.overlapFactor))),this.tracker=new _e(U,Math.round(this.suppressionTimeMillis/this.frameDurationMillis)),this.frameIntervalTask=setInterval(this.onAudioFrame.bind(this),this.fftSize/this.sampleRateHz*1e3),[2]}})})},q.prototype.onAudioFrame=function(){return Ir(this,void 0,void 0,function(){var R,F,I,U;return ti(this,function(X){switch(X.label){case 0:return this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-1/0?[2]:(this.freqDataQueue.push(this.freqData.slice(0,this.columnTruncateLength)),this.includeRawAudio&&(this.analyser.getFloatTimeDomainData(this.timeData),this.timeDataQueue.push(this.timeData.slice())),this.freqDataQueue.length>this.numFrames&&this.freqDataQueue.shift(),this.tracker.tick()?(R=Qr(this.freqDataQueue),F=Zt(R,[1,this.numFrames,this.columnTruncateLength,1]),I=void 0,this.includeRawAudio&&(U=Qr(this.timeDataQueue),I=Zt(U,[1,this.numFrames*this.fftSize])),[4,this.spectrogramCallback(F,I)]):[3,2]);case 1:X.sent()&&this.tracker.suppress(),Object(N.dispose)([F,I]),X.label=2;case 2:return[2]}})})},q.prototype.stop=function(){return Ir(this,void 0,void 0,function(){return ti(this,function(R){if(this.frameIntervalTask==null)throw new Error("Cannot stop because there is no ongoing streaming activity.");return clearInterval(this.frameIntervalTask),this.frameIntervalTask=null,this.analyser.disconnect(),this.audioContext.close(),this.stream!=null&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop(),[2]})})},q.prototype.setConfig=function(R){throw new Error("setConfig() is not implemented for BrowserFftFeatureExtractor.")},q.prototype.getFeatures=function(){throw new Error("getFeatures() is not implemented for BrowserFftFeatureExtractor. Use the spectrogramCallback field of the constructor config instead.")},q}();function Qr(q){var R=q[0].length,F=new Float32Array(q.length*R);return q.forEach(function(I,U){return F.set(I,U*R)}),F}function Zt(q,R){var F=new Float32Array(N.util.sizeFromShape(R));return F.set(q,F.length-q.length),Object(N.tensor)(F,R)}var _e=function(){function q(R,F){var I=this;this.period=R,this.suppressionTime=F??0,this.counter=0,N.util.assert(this.period>0,function(){return"Expected period to be positive, but got "+I.period})}return q.prototype.tick=function(){return this.counter++,this.counter%this.period==0&&(this.suppressionOnset==null||this.counter-this.suppressionOnset>this.suppressionTime)},q.prototype.suppress=function(){this.suppressionOnset=this.counter},q}();function ge(q){var R=0;q.forEach(function(U){R+=U.byteLength});var F=new Uint8Array(R),I=0;return q.forEach(function(U){F.set(new Uint8Array(U),I),I+=U.byteLength}),F.buffer}function Ae(q){var R=0;q.forEach(function(U){return R+=U.length});var F=new Float32Array(R),I=0;return q.forEach(function(U){F.set(U,I),I+=U.length}),F}function Ie(q){if(q==null)throw new Error("Received null or undefind string");for(var R=unescape(encodeURIComponent(q)),F=new Uint8Array(R.length),I=0;I<R.length;++I)F[I]=R.charCodeAt(I);return F.buffer}function it(q){if(q==null)throw new Error("Received null or undefind buffer");var R=new Uint8Array(q);return decodeURIComponent(escape(String.fromCharCode.apply(String,na(R))))}var St="TFJSSCDS",Jt=1,kn=function(){function q(R){if(this.examples={},this.label2Ids={},R!=null)for(var F=function(me){N.util.assert(me!=null,function(){return"Received null or undefined buffer"});var Se=0,Me=it(me.slice(Se,St.length));N.util.assert(Me===St,function(){return"Deserialization error: Invalid descriptor"}),Se+=St.length,Se+=4;var Te=new Uint32Array(me,Se,1),tt=Se+=4;Se=tt+Te[0];var at=it(me.slice(tt,Se));return{manifest:JSON.parse(at),data:me.slice(Se)}}(R),I=0,U=0;U<F.manifest.length;++U){var X=F.manifest[U],oe=X.spectrogramNumFrames*X.spectrogramFrameSize;X.rawAudioNumSamples!=null&&(oe+=X.rawAudioNumSamples),oe*=4,this.addExample(Bn({spec:X,data:F.data.slice(I,I+oe)})),I+=oe}}return q.prototype.addExample=function(R){N.util.assert(R!=null,function(){return"Got null or undefined example"}),N.util.assert(R.label!=null&&R.label.length>0,function(){return"Expected label to be a non-empty string, but got "+JSON.stringify(R.label)});var F=function(){function I(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return I()+I()+"-"+I()+"-"+I()+"-"+I()+"-"+I()+I()+I()}();return this.examples[F]=R,R.label in this.label2Ids||(this.label2Ids[R.label]=[]),this.label2Ids[R.label].push(F),F},q.prototype.merge=function(R){var F,I,U,X;N.util.assert(R!==this,function(){return"Cannot merge a dataset into itself"});var oe=R.getVocabulary();try{for(var me=ri(oe),Se=me.next();!Se.done;Se=me.next()){var Me=Se.value,Te=R.getExamples(Me);try{for(var tt=ri(Te),at=tt.next();!at.done;at=tt.next()){var jt=at.value;this.addExample(jt.example)}}catch($t){U={error:$t}}finally{try{at&&!at.done&&(X=tt.return)&&X.call(tt)}finally{if(U)throw U.error}}}}catch($t){F={error:$t}}finally{try{Se&&!Se.done&&(I=me.return)&&I.call(me)}finally{if(F)throw F.error}}}
8227,q.prototype.getExampleCounts=function(){var R={};for(var F in this.examples){var I=this.examples[F];I.label in R||(R[I.label]=0),R[I.label]++}return R},q.prototype.getExamples=function(R){var F=this;N.util.assert(R!=null,function(){return"Expected label to be a string, but got "+JSON.stringify(R)}),N.util.assert(R in this.label2Ids,function(){return'No example of label "'+R+'" exists in dataset'});var I=[];return this.label2Ids[R].forEach(function(U){I.push({uid:U,example:F.examples[U]})}),I},q.prototype.getData=function(R,F){var I=this;N.util.assert(this.size()>0,function(){return"Cannot get spectrograms as tensors because the dataset is empty"});var U=this.getVocabulary();R!=null?N.util.assert(U.indexOf(R)!==-1,function(){return"Label "+R+" is not in the vocabulary ("+JSON.stringify(U)+")"}):N.util.assert(U.length>1,function(){return"One-hot encoding of labels requires the vocabulary to have at least two words, but it has only "+U.length+" word."}),F==null&&(F={});var X,oe,me=this.getSortedUniqueNumFrames();me.length===1?(X=F.numFrames==null?me[0]:F.numFrames,oe=F.hopFrames==null?1:F.hopFrames):(X=F.numFrames,N.util.assert(X!=null&&Number.isInteger(X)&&X>0,function(){return"There are "+me.length+" unique lengths among the "+I.size()+" examples of this Dataset, hence numFrames is required. But it is not provided."}),N.util.assert(X<=me[0],function(){return"numFrames ("+X+") exceeds the minimum numFrames ("+me[0]+") among the examples of the Dataset."}),oe=F.hopFrames,N.util.assert(oe!=null&&Number.isInteger(oe)&&oe>0,function(){return"There are "+me.length+" unique lengths among the "+I.size()+" examples of this Dataset, hence hopFrames is required. But it is not provided."}));var Se=F.normalize==null||F.normalize;return Object(N.tidy)(function(){for(var Me,Te,tt,at=[],jt=[],$t=[],vn=0;vn<U.length;++vn){var wn=U[vn];if(R==null||wn===R){var Nn=I.label2Ids[wn],In=function(Hi){var Ts,Us,Zu=I.examples[Hi].spectrogram,Au=Zu.frameSize;tt==null?tt=Au:N.util.assert(Au===tt,function(){return"Mismatch in frameSize ("+Au+" vs "+tt+")"});var xc=Zu.data.length/Au,wc=null;wn!=="_background_noise_"&&(wc=Zu.keyFrameIndex==null?Zn(Zu).dataSync()[0]:Zu.keyFrameIndex);var _c=Object(N.tensor3d)(Zu.data,[xc,Au,1]),Jp=Gn(xc,wc,X,oe),Lh=function(Uf){var sl=Object(N.tidy)(function(){var ks=_c.slice([Uf[0],0,0],[Uf[1]-Uf[0],-1,-1]);return Se?$i(ks):ks});F.getDataset?jt.push(sl.dataSync()):at.push(sl),R==null&&$t.push(vn)};try{for(var zf=ri(Jp),Fd=zf.next();!Fd.done;Fd=zf.next())Lh(Fd.value)}catch(Uf){Ts={error:Uf}}finally{try{Fd&&!Fd.done&&(Us=zf.return)&&Us.call(zf)}finally{if(Ts)throw Ts.error}}Object(N.dispose)(_c)};try{for(var Ln=ri(Nn),qn=Ln.next();!qn.done;qn=Ln.next())In(qn.value)}catch(Hi){Me={error:Hi}}finally{try{qn&&!qn.done&&(Te=Ln.return)&&Te.call(Ln)}finally{if(Me)throw Me.error}}}}F.augmentByMixingNoiseRatio!=null&&I.augmentByMixingNoise(F.getDataset?jt:at,$t,F.augmentByMixingNoiseRatio);var Cn=F.shuffle==null||F.shuffle;if(F.getDataset){var wr=F.datasetBatchSize==null?32:F.datasetBatchSize,Fr=F.datasetValidationSplit==null?.15:F.datasetValidationSplit;N.util.assert(Fr>0&&Fr<1,function(){return"Invalid dataset validation split: "+Fr});var Rr=jt.map(function(Hi,Ts){return[Hi,$t[Ts]]});N.util.shuffle(Rr),jt=Rr.map(function(Hi){return Hi[0]});var Xr=Rr.map(function(Hi){return Hi[1]}),zr=function(Hi,Ts,Us){var Zu,Au,xc,wc,_c,Jp,Lh,zf;N.util.assert(Us>0&&Us<1,function(){return"validationSplit is expected to be >0 and <1, but got "+Us});for(var Fd=!Array.isArray(Hi[0]),Uf=Ts,sl=[],ks=0;ks<Uf.length;++ks){var Rd=Uf[ks];sl[Rd]==null&&(sl[Rd]=[]),sl[Rd].push(ks)}var zh=sl.length,Qp=[],Bd=[];for(sl.map(function(fc){return N.util.shuffle(fc)}),ks=0;ks<zh;++ks)for(var ou=sl[ks],Uh=Math.round(ou.length*(1-Us)),Zp=0;Zp<ou.length;++Zp)Zp<Uh?Qp.push(ou[Zp]):Bd.push(ou[Zp]);if(Fd){var em=[],af=[],vg=[],ul=[];try{for(var Ou=ri(Qp),$c=Ou.next();!$c.done;$c=Ou.next()){var au=$c.value;em.push(Hi[au]),af.push(Ts[au])}}catch(fc){Zu={error:fc}}finally{try{$c&&!$c.done&&(Au=Ou.return)&&Au.call(Ou)}finally{if(Zu)throw Zu.error}}try{for(var Wf=ri(Bd),Wh=Wf.next();!Wh.done;Wh=Wf.next())au=Wh.value,vg.push(Hi[au]),ul.push(Ts[au])}catch(fc){xc={error:fc}}finally{try{Wh&&!Wh.done&&(wc=Wf.return)&&wc.call(Wf)}finally{if(xc)throw xc.error}}return{trainXs:em,trainYs:af,valXs:vg,valYs:ul}}em=[],af=[],vg=[],ul=[];try{for(var tm=ri(Qp),Vh=tm.next();!Vh.done;Vh=tm.next())au=Vh.value,em.push(Hi[au]),af.push(Ts[au])}catch(fc){_c={error:fc}}finally{try{Vh&&!Vh.done&&(Jp=tm.return)&&Jp.call(tm)}finally{if(_c)throw _c.error}}try{for(var yg=ri(Bd),Vf=yg.next();!Vf.done;Vf=yg.next())au=Vf.value,vg.push(Hi[au]),ul.push(Ts[au])}catch(fc){Lh={error:fc}}finally{try{Vf&&!Vf.done&&(zf=yg.return)&&zf.call(yg)}finally{if(Lh)throw Lh.error}}return{trainXs:em,trainYs:af,valXs:vg,valYs:ul}}(jt,Xr,Fr),Ti=zr.trainXs,Wi=zr.trainYs,zi=zr.valXs,Xo=zr.valYs,wa=N.data.array(Ti).map(function(Hi){return Object(N.tensor3d)(Hi,[X,tt,1])}),ua=N.data.array(Wi).map(function(Hi){return Object(N.oneHot)([Hi],U.length).squeeze([0])}),oa=N.data.zip({xs:wa,ys:ua});Cn&&(oa=oa.shuffle(jt.length)),oa=oa.batch(wr).prefetch(4);var ha=N.data.array(zi).map(function(Hi){return Object(N.tensor3d)(Hi,[X,tt,1])}),Ma=N.data.array(Xo).map(function(Hi){return Object(N.oneHot)([Hi],U.length).squeeze([0])}),Wa=N.data.zip({xs:ha,ys:Ma});return[oa,Wa=Wa.batch(wr).prefetch(4)]}if(Cn){var us=[];at.forEach(function(Hi,Ts){us.push({x:Hi,y:$t[Ts]})}),N.util.shuffle(us),at=us.map(function(Hi){return Hi.x}),$t=us.map(function(Hi){return Hi.y})}
8227var Qu=R==null?Object(N.oneHot)(Object(N.tensor1d)($t,"int32"),U.length).asType("float32"):void 0;return{xs:Object(N.stack)(at),ys:Qu}})},q.prototype.augmentByMixingNoise=function(R,F,I){var U,X;if(R==null||R.length===0)throw new Error("Cannot perform augmentation because data is null or empty");for(var oe=R[0]instanceof Float32Array,me=this.getVocabulary(),Se=[],Me=[],Te=0;Te<F.length;++Te)me[F[Te]]==="_background_noise_"?Se.push(Te):Me.push(Te);if(Se.length===0)throw new Error("Cannot perform augmentation by mixing with noise when there is no example with label _background_noise_");var tt=[],at=[],jt=function(wn){var Nn=Se[function(Cn,wr){return Math.floor((wr-Cn)*Math.random())+Cn}(0,Se.length)],In=oe?Object(N.tensor1d)(R[wn]):R[wn],Ln=oe?Object(N.tensor1d)(R[Nn]):R[Nn],qn=Object(N.tidy)(function(){return $i(In.add(Ln.mul(I)))});oe?tt.push(qn.dataSync()):tt.push(qn),at.push(F[wn])};try{for(var $t=ri(Me),vn=$t.next();!vn.done;vn=$t.next())jt(vn.value)}catch(wn){U={error:wn}}finally{try{vn&&!vn.done&&(X=$t.return)&&X.call($t)}finally{if(U)throw U.error}}console.log("Data augmentation: mixing noise: added "+tt.length+" examples"),tt.forEach(function(wn){return R.push(wn)}),F.push.apply(F,na(at))},q.prototype.getSortedUniqueNumFrames=function(){for(var R,F,I=new Set,U=this.getVocabulary(),X=0;X<U.length;++X){var oe=U[X],me=this.label2Ids[oe];try{for(var Se=ri(me),Me=Se.next();!Me.done;Me=Se.next()){var Te=Me.value,tt=this.examples[Te].spectrogram,at=tt.data.length/tt.frameSize;I.add(at)}}catch($t){R={error:$t}}finally{try{Me&&!Me.done&&(F=Se.return)&&F.call(Se)}finally{if(R)throw R.error}}}var jt=na(I);return jt.sort(),jt},q.prototype.removeExample=function(R){if(!(R in this.examples))throw new Error("Nonexistent example UID: "+R);var F=this.examples[R].label;delete this.examples[R];var I=this.label2Ids[F].indexOf(R);this.label2Ids[F].splice(I,1),this.label2Ids[F].length===0&&delete this.label2Ids[F]},q.prototype.setExampleKeyFrameIndex=function(R,F){if(!(R in this.examples))throw new Error("Nonexistent example UID: "+R);var I=this.examples[R].spectrogram,U=I.data.length/I.frameSize;N.util.assert(F>=0&&F<U&&Number.isInteger(F),function(){return"Invalid keyFrameIndex: "+F+". Must be >= 0, < "+U+", and an integer."}),I.keyFrameIndex=F},q.prototype.size=function(){return Object.keys(this.examples).length},q.prototype.durationMillis=function(){var R=0;for(var F in this.examples){var I=this.examples[F].spectrogram,U=23.22|I.frameDurationMillis;R+=I.data.length/I.frameSize*U}return R},q.prototype.empty=function(){return this.size()===0},q.prototype.clear=function(){this.examples={}},q.prototype.getVocabulary=function(){var R=new Set;for(var F in this.examples){var I=this.examples[F];R.add(I.label)}var U=na(R);return U.sort(),U},q.prototype.serialize=function(R){var F,I,U,X,oe=this.getVocabulary();N.util.assert(!this.empty(),function(){return"Cannot serialize empty Dataset"}),R!=null&&(Array.isArray(R)||(R=[R]),R.forEach(function(Nn){if(oe.indexOf(Nn)===-1)throw new Error('Word label "'+Nn+'" does not exist in the vocabulary of this dataset. The vocabulary is: '+JSON.stringify(oe)+".")}));var me=[],Se=[];try{for(var Me=ri(oe),Te=Me.next();!Te.done;Te=Me.next()){var tt=Te.value;if(R==null||R.indexOf(tt)!==-1){var at=this.label2Ids[tt];try{for(var jt=ri(at),$t=jt.next();!$t.done;$t=jt.next()){var vn=$t.value,wn=rr(this.examples[vn]);me.push(wn.spec),Se.push(wn.data)}}catch(Nn){U={error:Nn}}finally{try{$t&&!$t.done&&(X=jt.return)&&X.call(jt)}finally{if(U)throw U.error}}}}}catch(Nn){F={error:Nn}}finally{try{Te&&!Te.done&&(I=Me.return)&&I.call(Me)}finally{if(F)throw F.error}}return function(Nn){var In=Ie(JSON.stringify(Nn.manifest)),Ln=Ie(St),qn=new Uint32Array([Jt]),Cn=new Uint32Array([In.byteLength]);return ge([ge([Ln,qn.buffer,Cn.buffer]),In,Nn.data])}({manifest:me,data:ge(Se)})},q}();function rr(q){var R=q.rawAudio!=null,F={label:q.label,spectrogramNumFrames:q.spectrogram.data.length/q.spectrogram.frameSize,spectrogramFrameSize:q.spectrogram.frameSize};q.spectrogram.keyFrameIndex!=null&&(F.spectrogramKeyFrameIndex=q.spectrogram.keyFrameIndex);var I=q.spectrogram.data.buffer.slice(0);return R&&(F.rawAudioNumSamples=q.rawAudio.data.length,F.rawAudioSampleRateHz=q.rawAudio.sampleRateHz,I=ge([I,q.rawAudio.data.buffer])),{spec:F,data:I}}function Bn(q){var R={frameSize:q.spec.spectrogramFrameSize,data:new Float32Array(q.data.slice(0,4*q.spec.spectrogramFrameSize*q.spec.spectrogramNumFrames))};q.spec.spectrogramKeyFrameIndex!=null&&(R.keyFrameIndex=q.spec.spectrogramKeyFrameIndex);var F={label:q.spec.label,spectrogram:R};return q.spec.rawAudioNumSamples!=null&&(F.rawAudio={sampleRateHz:q.spec.rawAudioSampleRateHz,data:new Float32Array(q.data.slice(4*q.spec.spectrogramFrameSize*q.spec.spectrogramNumFrames))}),F}function Gn(q,R,F,I){if(N.util.assert(Number.isInteger(q)&&q>0,function(){return"snippetLength must be a positive integer, but got "+q}),R!=null&&N.util.assert(Number.isInteger(R)&&R>=0,function(){return"focusIndex must be a non-negative integer, but got "+R}),N.util.assert(Number.isInteger(F)&&F>0,function(){return"windowLength must be a positive integer, but got "+F}),N.util.assert(Number.isInteger(I)&&I>0,function(){return"windowHop must be a positive integer, but got "+I}),N.util.assert(F<=q,function(){return"windowLength ("+F+") exceeds snippetLength ("+q+")"}),N.util.assert(R<q,function(){return"focusIndex ("+R+") equals or exceeds snippetLength ("+q+")"}),F===q)return[[0,q]];var U=[];if(R==null){for(var X=0;X+F<=q;)U.push([X,X+F]),X+=I;return U}var oe=Math.floor(F/2),me=R-oe;for(me<0?me=0:me+F>q&&(me=q-F);!(me-I<0||R>=me-I+F);)me-=I;for(;me+F<=q&&!(R<me);)U.push([me,me+F]),me+=I;return U}function Zn(q){return Object(N.tidy)(function(){return function(R){return Object(N.tidy)(function(){var F=R.data.length/R.frameSize;return Object(N.tensor2d)(R.data,[F,R.frameSize]).mean(-1)})}(q).argMax()})}var Gt="0.3.9",Wt="tfjs-speech-commands-saved-model-metadata",Sn="indexeddb://tfjs-speech-commands-model/",un={localStorage:typeof window>"u"?null:window.localStorage},qe=function(){function q(R,F,I){this.MODEL_URL_PREFIX="https://storage.googleapis.com/tfjs-models/tfjs/speech-commands/v"+function(U){return U.split(".").slice(0,2).join(".")}(Gt)+"/browser_fft",this.SAMPLE_RATE_HZ=44100,this.FFT_SIZE=1024,this.DEFAULT_SUPPRESSION_TIME_MILLIS=0,this.streaming=!1,this.transferRecognizers={},N.util.assert(F==null&&I==null||F!=null&&I!=null,function(){return"modelURL and metadataURL must be both provided or both not provided."}),F==null?(R==null?R=q.DEFAULT_VOCABULARY_NAME:N.util.assert(q.VALID_VOCABULARY_NAMES.indexOf(R)!==-1,function(){return"Invalid vocabulary name: '"+R+"'"}),this.vocabulary=R,this.modelArtifactsOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/model.json",this.metadataOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/metadata.json"):(N.util.assert(R==null,function(){return"vocabulary name must be null or undefined when modelURL is provided"}),this.modelArtifactsOrURL=F,this.metadataOrURL=I),this.parameters={sampleRateHz:this.SAMPLE_RATE_HZ,fftSize:this.FFT_SIZE}}return q.prototype.listen=function(R,F){return Ir(this,void 0,void 0,function(){var I,U,X,oe,me,Se=this;return ti(this,function(Me){switch(Me.label){case 0:if(this.streaming)throw new Error("Cannot start streaming again when streaming is ongoing.");return[4,this.ensureModelLoaded()];case 1:if(Me.sent(),F==null&&(F={}),I=F.probabilityThreshold==null?0:F.probabilityThreshold,F.includeEmbedding&&(I=0),N.util.assert(I>=0&&I<=1,function(){return"Invalid probabilityThreshold value: "+I}),U=F.invokeCallbackOnNoiseAndUnknown!=null&&F.invokeCallbackOnNoiseAndUnknown,F.includeEmbedding&&(U=!0),F.suppressionTimeMillis<0)throw new Error("suppressionTimeMillis is expected to be >= 0, but got "+F.suppressionTimeMillis);return X=F.overlapFactor==null?.5:F.overlapFactor,N.util.assert(X>=0&&X<1,function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+X}),oe=function(Te,tt){return Ir(Se,void 0,void 0,function(){var at,jt,$t,vn,wn,Nn,In,Ln,qn,Cn,wr;return ti(this,function(Fr){switch(Fr.label){case 0:return jt=$i(Te),F.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,2];case 1:return Fr.sent(),at=yi(this.modelWithEmbeddingOutput.predict(jt),2),$t=at[0],vn=at[1],[3,3];case 2:$t=this.model.predict(jt),Fr.label=3;case 3:return[4,$t.data()];case 4:return wn=Fr.sent(),[4,(Nn=$t.argMax(-1)).data()];
8227case 5:return In=Fr.sent()[0],Ln=Math.max.apply(Math,na(wn)),Object(N.dispose)([$t,Nn,jt]),Ln<I?[2,!1]:[3,6];case 6:return qn=void 0,F.includeSpectrogram?(Cn={},[4,Te.data()]):[3,8];case 7:Cn.data=Fr.sent(),Cn.frameSize=this.nonBatchInputShape[1],qn=Cn,Fr.label=8;case 8:return wr=!0,U||this.words[In]!=="_background_noise_"&&this.words[In]!=="_unknown_"||(wr=!1),wr&&R({scores:wn,spectrogram:qn,embedding:vn}),[2,wr]}})})},me=F.suppressionTimeMillis==null?this.DEFAULT_SUPPRESSION_TIME_MILLIS:F.suppressionTimeMillis,this.audioDataExtractor=new Ft({sampleRateHz:this.parameters.sampleRateHz,numFramesPerSpectrogram:this.nonBatchInputShape[0],columnTruncateLength:this.nonBatchInputShape[1],suppressionTimeMillis:me,spectrogramCallback:oe,overlapFactor:X}),[4,this.audioDataExtractor.start(F.audioTrackConstraints)];case 2:return Me.sent(),this.streaming=!0,[2]}})})},q.prototype.ensureModelLoaded=function(){return Ir(this,void 0,void 0,function(){var R,F,I,U,X=this;return ti(this,function(oe){switch(oe.label){case 0:return this.model!=null?[2]:[4,this.ensureMetadataLoaded()];case 1:return oe.sent(),typeof this.modelArtifactsOrURL!="string"?[3,3]:[4,Object(N.loadLayersModel)(this.modelArtifactsOrURL)];case 2:return R=oe.sent(),[3,5];case 3:return[4,Object(N.loadLayersModel)(N.io.fromMemory(this.modelArtifactsOrURL.modelTopology,this.modelArtifactsOrURL.weightSpecs,this.modelArtifactsOrURL.weightData))];case 4:R=oe.sent(),oe.label=5;case 5:if(R.inputs.length!==1)throw new Error("Expected model to have 1 input, but got a model with "+R.inputs.length+" inputs");if(R.inputs[0].shape.length!==4)throw new Error("Expected model to have an input shape of rank 4, but got an input shape of rank "+R.inputs[0].shape.length);if(R.inputs[0].shape[3]!==1)throw new Error("Expected model to have an input shape with 1 as the last dimension, but got input shape"+JSON.stringify(R.inputs[0].shape[3])+"}");if((F=R.outputShape).length!==2)throw new Error("Expected loaded model to have an output shape of rank 2,but received shape "+JSON.stringify(F));if(F[1]!==this.words.length)throw new Error("Mismatch between the last dimension of model's output shape ("+F[1]+") and number of words ("+this.words.length+").");return this.model=R,this.freezeModel(),this.nonBatchInputShape=R.inputs[0].shape.slice(1),this.elementsPerExample=1,R.inputs[0].shape.slice(1).forEach(function(me){return X.elementsPerExample*=me}),this.warmUpModel(),I=this.parameters.fftSize/this.parameters.sampleRateHz*1e3,U=R.inputs[0].shape[1],this.parameters.spectrogramDurationMillis=U*I,[2]}})})},q.prototype.ensureModelWithEmbeddingOutputCreated=function(){return Ir(this,void 0,void 0,function(){var R,F;return ti(this,function(I){switch(I.label){case 0:return this.modelWithEmbeddingOutput!=null?[2]:[4,this.ensureModelLoaded()];case 1:for(I.sent(),F=this.model.layers.length-2;F>=0;--F)if(this.model.layers[F].getClassName()==="Dense"){R=this.model.layers[F];break}if(R==null)throw new Error("Failed to find second last dense layer in the original model.");return this.modelWithEmbeddingOutput=Object(N.model)({inputs:this.model.inputs,outputs:[this.model.outputs[0],R.output]}),[2]}})})},q.prototype.warmUpModel=function(){var R=this;Object(N.tidy)(function(){for(var F=Object(N.zeros)([1].concat(R.nonBatchInputShape)),I=0;I<3;++I)R.model.predict(F)})},q.prototype.ensureMetadataLoaded=function(){return Ir(this,void 0,void 0,function(){var R,F,I;return ti(this,function(U){switch(U.label){case 0:return this.words!=null?[2]:typeof this.metadataOrURL!="string"?[3,2]:[4,function(X){return Ir(this,void 0,void 0,function(){return ti(this,function(oe){return[2,new Promise(function(me,Se){X.indexOf("http://")===0||X.indexOf("https://")===0?fetch(X).then(function(Me){Me.json().then(function(Te){return me(Te)})}):X.indexOf("file://")===0?n(185).readFile(X.slice(7),{encoding:"utf-8"},function(Me,Te){return me(JSON.parse(Te))}):Se(new Error("Unsupported URL scheme in metadata URL: "+X+". Supported schemes are: http://, https://, and (node.js-only) file://"))})]})})}(this.metadataOrURL)];case 1:return F=U.sent(),[3,3];case 2:F=this.metadataOrURL,U.label=3;case 3:if((R=F).wordLabels==null){if((I=R.words)==null)throw new Error('Cannot find field "words" or "wordLabels" in metadata JSON file');this.words=I}else this.words=R.wordLabels;return[2]}})})},q.prototype.stopListening=function(){return Ir(this,void 0,void 0,function(){return ti(this,function(R){switch(R.label){case 0:if(!this.streaming)throw new Error("Cannot stop streaming when streaming is not ongoing.");return[4,this.audioDataExtractor.stop()];case 1:return R.sent(),this.streaming=!1,[2]}})})},q.prototype.isListening=function(){return this.streaming},q.prototype.wordLabels=function(){return this.words},q.prototype.params=function(){return this.parameters},q.prototype.modelInputShape=function(){if(this.model==null)throw new Error("Model has not been loaded yet. Load model by calling ensureModelLoaded(), recognize(), or listen().");return this.model.inputs[0].shape},q.prototype.recognize=function(R,F){return Ir(this,void 0,void 0,function(){var I,U,X,oe,me,Se,Me,Te,tt,at,jt,$t,vn;return ti(this,function(wn){switch(wn.label){case 0:return F==null&&(F={}),[4,this.ensureModelLoaded()];case 1:return wn.sent(),R!=null?[3,3]:[4,this.recognizeOnline()];case 2:I=wn.sent(),R=I.data,wn.label=3;case 3:if(R instanceof N.Tensor)this.checkInputTensorShape(R),X=R,U=R.shape[0];else{if((R=R).length%this.elementsPerExample)throw new Error("The length of the input Float32Array "+R.length+" is not divisible by the number of tensor elements per per example expected by the model "+this.elementsPerExample+".");
8227U=R.length/this.elementsPerExample,X=Object(N.tensor4d)(R,[U].concat(this.nonBatchInputShape))}return me={scores:null},F.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,5];case 4:return wn.sent(),Se=this.modelWithEmbeddingOutput.predict(X),oe=Se[0],me.embedding=Se[1],[3,6];case 5:oe=this.model.predict(X),wn.label=6;case 6:return U!==1?[3,8]:(Me=me,[4,oe.data()]);case 7:return Me.scores=wn.sent(),[3,10];case 8:return Te=Object(N.unstack)(oe),tt=Te.map(function(Nn){return Nn.data()}),at=me,[4,Promise.all(tt)];case 9:at.scores=wn.sent(),Object(N.dispose)(Te),wn.label=10;case 10:return F.includeSpectrogram?(jt=me,$t={},R instanceof N.Tensor?[4,R.data()]:[3,12]):[3,14];case 11:return vn=wn.sent(),[3,13];case 12:vn=R,wn.label=13;case 13:jt.spectrogram=($t.data=vn,$t.frameSize=this.nonBatchInputShape[1],$t),wn.label=14;case 14:return[2,me]}})})},q.prototype.recognizeOnline=function(){return Ir(this,void 0,void 0,function(){var R=this;return ti(this,function(F){return[2,new Promise(function(I,U){R.audioDataExtractor=new Ft({sampleRateHz:R.parameters.sampleRateHz,numFramesPerSpectrogram:R.nonBatchInputShape[0],columnTruncateLength:R.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(X){return Ir(R,void 0,void 0,function(){var oe,me,Se;return ti(this,function(Me){switch(Me.label){case 0:return oe=$i(X),[4,this.audioDataExtractor.stop()];case 1:return Me.sent(),me=I,Se={},[4,oe.data()];case 2:return me.apply(void 0,[(Se.data=Me.sent(),Se.frameSize=this.nonBatchInputShape[1],Se)]),oe.dispose(),[2,!1]}})})},overlapFactor:0}),R.audioDataExtractor.start()})]})})},q.prototype.createTransfer=function(R){if(this.model==null)throw new Error("Model has not been loaded yet. Load model by calling ensureModelLoaded(), recognizer(), or listen().");N.util.assert(R!=null&&typeof R=="string"&&R.length>1,function(){return"Expected the name for a transfer-learning recognized to be a non-empty string, but got "+JSON.stringify(R)}),N.util.assert(this.transferRecognizers[R]==null,function(){return"There is already a transfer-learning model named '"+R+"'"});var F=new $n(R,this.parameters,this.model);return this.transferRecognizers[R]=F,F},q.prototype.freezeModel=function(){var R,F;try{for(var I=ri(this.model.layers),U=I.next();!U.done;U=I.next())U.value.trainable=!1}catch(X){R={error:X}}finally{try{U&&!U.done&&(F=I.return)&&F.call(I)}finally{if(R)throw R.error}}},q.prototype.checkInputTensorShape=function(R){var F=this.model.inputs[0].shape.length;if(R.shape.length!==F)throw new Error("Expected input Tensor to have rank "+F+", but got rank "+R.shape.length+" that differs ");var I=R.shape.slice(1),U=this.model.inputs[0].shape.slice(1);if(!N.util.arraysEqual(I,U))throw new Error("Expected input to have shape [null,"+U+"], but got shape [null,"+I+"]")},q.VALID_VOCABULARY_NAMES=["18w","directional4w"],q.DEFAULT_VOCABULARY_NAME="18w",q}(),$n=function(q){function R(F,I,U){var X=q.call(this)||this;return X.name=F,X.parameters=I,X.baseModel=U,N.util.assert(F!=null&&typeof F=="string"&&F.length>0,function(){return"The name of a transfer model must be a non-empty string, but got "+JSON.stringify(F)}),X.nonBatchInputShape=X.baseModel.inputs[0].shape.slice(1),X.words=null,X.dataset=new kn,X}return function(F,I){function U(){this.constructor=F}qr(F,I),F.prototype=I===null?Object.create(I):(U.prototype=I.prototype,new U)}(R,q),R.prototype.collectExample=function(F,I){return Ir(this,void 0,void 0,function(){var U,X,oe,me,Se=this;return ti(this,function(Me){if(N.util.assert(!this.streaming,function(){return"Cannot start collection of transfer-learning example because a streaming recognition or transfer-learning example collection is ongoing"}),N.util.assert(F!=null&&typeof F=="string"&&F.length>0,function(){return"Must provide a non-empty string when collecting transfer-learning example"}),I==null&&(I={}),I.durationMultiplier!=null&&I.durationSec!=null)throw new Error("durationMultiplier and durationSec are mutually exclusive, but are both specified.");return I.durationSec!=null?(N.util.assert(I.durationSec>0,function(){return"Expected durationSec to be > 0, but got "+I.durationSec}),X=this.parameters.fftSize/this.parameters.sampleRateHz,U=Math.ceil(I.durationSec/X)):I.durationMultiplier!=null?(N.util.assert(I.durationMultiplier>=1,function(){return"Expected duration multiplier to be >= 1, but got "+I.durationMultiplier}),U=Math.round(this.nonBatchInputShape[0]*I.durationMultiplier)):U=this.nonBatchInputShape[0],I.snippetDurationSec!=null&&(N.util.assert(I.snippetDurationSec>0,function(){return"snippetDurationSec is expected to be > 0, but got "+I.snippetDurationSec}),N.util.assert(I.onSnippet!=null,function(){return"onSnippet must be provided if snippetDurationSec is provided."})),I.onSnippet!=null&&N.util.assert(I.snippetDurationSec!=null,function(){return"snippetDurationSec must be provided if onSnippet is provided."}),oe=this.parameters.fftSize/this.parameters.sampleRateHz,me=oe*U,this.streaming=!0,[2,new Promise(function(Te){var tt=I.snippetDurationSec==null?1:I.snippetDurationSec/me,at=1-tt,jt=Math.round(1/tt),$t=0,vn=-1,wn=[];Se.audioDataExtractor=new Ft({sampleRateHz:Se.parameters.sampleRateHz,numFramesPerSpectrogram:U,columnTruncateLength:Se.n
8227onBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(Nn,In){return Ir(Se,void 0,void 0,function(){var Ln,qn,Cn,wr,Fr,Rr,Xr,zr,Ti,Wi,zi,Xo,wa,ua,oa,ha,Ma,Wa,us,Qu;return ti(this,function(Hi){switch(Hi.label){case 0:return I.onSnippet!=null?[3,7]:(Ln=$i(Nn),Cn=(qn=this.dataset).addExample,wr={label:F},Fr={},[4,Ln.data()]);case 1:return wr.spectrogram=(Fr.data=Hi.sent(),Fr.frameSize=this.nonBatchInputShape[1],Fr),I.includeRawAudio?(Xr={},[4,In.data()]):[3,3];case 2:return Xr.data=Hi.sent(),Xr.sampleRateHz=this.audioDataExtractor.sampleRateHz,Rr=Xr,[3,4];case 3:Rr=void 0,Hi.label=4;case 4:return Cn.apply(qn,[(wr.rawAudio=Rr,wr)]),Ln.dispose(),[4,this.audioDataExtractor.stop()];case 5:return Hi.sent(),this.streaming=!1,this.collateTransferWords(),zr=Te,Ti={},[4,Nn.data()];case 6:return zr.apply(void 0,[(Ti.data=Hi.sent(),Ti.frameSize=this.nonBatchInputShape[1],Ti)]),[3,13];case 7:return[4,Nn.data()];case 8:for(Wi=Hi.sent(),vn===-1&&(vn=Wi.length),zi=vn-1;Wi[zi]!==0&&zi>=0;)zi--;return Xo=vn-zi-1,vn=zi+1,wa=Wi.slice(Wi.length-Xo,Wi.length),wn.push(wa),I.onSnippet!=null&&I.onSnippet({data:wa,frameSize:this.nonBatchInputShape[1]}),$t++!==jt?[3,13]:[4,this.audioDataExtractor.stop()];case 9:return Hi.sent(),this.streaming=!1,this.collateTransferWords(),ua=function(Ts){if(Ts.length<2)throw new Error("Cannot normalize a Float32Array with fewer than 2 elements.");return co==null&&(co=Object(N.backend)().epsilon()),Object(N.tidy)(function(){var Us=Object(N.moments)(Object(N.tensor1d)(Ts)),Zu=Us.mean,Au=Us.variance,xc=Zu.arraySync(),wc=Math.sqrt(Au.arraySync()),_c=Array.from(Ts).map(function(Jp){return(Jp-xc)/(wc+co)});return new Float32Array(_c)})}(Ae(wn)),oa={data:ua,frameSize:this.nonBatchInputShape[1]},Ma=(ha=this.dataset).addExample,Wa={label:F,spectrogram:oa},I.includeRawAudio?(Qu={},[4,In.data()]):[3,11];case 10:return Qu.data=Hi.sent(),Qu.sampleRateHz=this.audioDataExtractor.sampleRateHz,us=Qu,[3,12];case 11:us=void 0,Hi.label=12;case 12:Ma.apply(ha,[(Wa.rawAudio=us,Wa)]),Te(oa),Hi.label=13;case 13:return[2,!1]}})})},overlapFactor:at,includeRawAudio:I.includeRawAudio}),Se.audioDataExtractor.start(I.audioTrackConstraints)})]})})},R.prototype.clearExamples=function(){var F=this;N.util.assert(this.words!=null&&this.words.length>0&&!this.dataset.empty(),function(){return"No transfer learning examples exist for model name "+F.name}),this.dataset.clear(),this.words=null},R.prototype.countExamples=function(){if(this.dataset.empty())throw new Error("No examples have been collected for transfer-learning model named '"+this.name+"' yet.");return this.dataset.getExampleCounts()},R.prototype.getExamples=function(F){return this.dataset.getExamples(F)},R.prototype.setExampleKeyFrameIndex=function(F,I){this.dataset.setExampleKeyFrameIndex(F,I)},R.prototype.removeExample=function(F){this.dataset.removeExample(F),this.collateTransferWords()},R.prototype.isDatasetEmpty=function(){return this.dataset.empty()},R.prototype.loadExamples=function(F,I){var U,X,oe,me;I===void 0&&(I=!1);var Se=new kn(F);I&&this.clearExamples();var Me=Se.getVocabulary();try{for(var Te=ri(Me),tt=Te.next();!tt.done;tt=Te.next()){var at=tt.value,jt=Se.getExamples(at);try{for(var $t=ri(jt),vn=$t.next();!vn.done;vn=$t.next()){var wn=vn.value;this.dataset.addExample(wn.example)}}catch(Nn){oe={error:Nn}}finally{try{vn&&!vn.done&&(me=$t.return)&&me.call($t)}finally{if(oe)throw oe.error}}}}catch(Nn){U={error:Nn}}finally{try{tt&&!tt.done&&(X=Te.return)&&X.call(Te)}finally{if(U)throw U.error}}this.collateTransferWords()},R.prototype.serializeExamples=function(F){return this.dataset.serialize(F)},R.prototype.collateTransferWords=function(){this.words=this.dataset.getVocabulary()},R.prototype.collectTransferDataAsTensors=function(F,I){var U=this.nonBatchInputShape[0];F=F||.25;var X=Math.round(F*U),oe=this.dataset.getData(null,mi({numFrames:U,hopFrames:X},I));return{xs:oe.xs,ys:oe.ys}},R.prototype.collectTransferDataAsTfDataset=function(F,I,U,X){I===void 0&&(I=.15),U===void 0&&(U=32);var oe=this.nonBatchInputShape[0];F=F||.25;var me=Math.round(F*oe);return this.dataset.getData(null,mi({numFrames:oe,hopFrames:me,getDataset:!0,datasetBatchSize:U,datasetValidationSplit:I},X))},R.prototype.train=function(F){return Ir(this,void 0,void 0,function(){var I,U=this;return ti(this,function(X){switch(X.label){case 0:return N.util.assert(this.words!=null&&this.words.length>0,function(){return"Cannot train transfer-learning model '"+U.name+"' be
8227cause no transfer learning example has been collected."}),N.util.assert(this.words.length>1,function(){return"Cannot train transfer-learning model '"+U.name+"' because only 1 word label ('"+JSON.stringify(U.words)+"') has been collected for transfer learning. Requires at least 2."}),F.fineTuningEpochs!=null&&N.util.assert(F.fineTuningEpochs>=0&&Number.isInteger(F.fineTuningEpochs),function(){return"If specified, fineTuningEpochs must be a non-negative integer, but received "+F.fineTuningEpochs}),F==null&&(F={}),this.model==null&&this.createTransferModelFromBaseModel(),this.secondLastBaseDenseLayer.trainable=!1,this.model.compile({loss:"categoricalCrossentropy",optimizer:F.optimizer||"sgd",metrics:["acc"]}),I=F.fitDatasetDurationMillisThreshold==null?6e4:F.fitDatasetDurationMillisThreshold,this.dataset.durationMillis()>I?(console.log("Detected large dataset: total duration = "+this.dataset.durationMillis()+" ms > "+I+" ms. Training transfer model using fitDataset() instead of fit()"),[4,this.trainOnDataset(F)]):[3,2];case 1:return[2,X.sent()];case 2:return[4,this.trainOnTensors(F)];case 3:return[2,X.sent()]}})})},R.prototype.trainOnDataset=function(F){return Ir(this,void 0,void 0,function(){var I,U,X,oe,me,Se,Me,Te,tt;return ti(this,function(at){switch(at.label){case 0:return N.util.assert(F.epochs>0,function(){return"Invalid config.epochs"}),I=F.batchSize==null?32:F.batchSize,U=F.windowHopRatio||.25,X=yi(this.collectTransferDataAsTfDataset(U,F.validationSplit,I,{augmentByMixingNoiseRatio:F.augmentByMixingNoiseRatio}),2),oe=X[0],me=X[1],Se=N.util.now(),[4,this.model.fitDataset(oe,{epochs:F.epochs,validationData:F.validationSplit>0?me:null,callbacks:F.callback==null?null:[F.callback]})];case 1:return Me=at.sent(),console.log("fitDataset() took "+(N.util.now()-Se).toFixed(2)+" ms"),F.fineTuningEpochs!=null&&F.fineTuningEpochs>0?(Te=N.util.now(),[4,this.fineTuningUsingTfDatasets(F,oe,me)]):[3,3];case 2:return tt=at.sent(),console.log("fitDataset() (fine-tuning) took "+(N.util.now()-Te).toFixed(2)+" ms"),[2,[Me,tt]];case 3:return[2,Me]}})})},R.prototype.trainOnTensors=function(F){return Ir(this,void 0,void 0,function(){var I,U,X,oe,me,Se,Me,Te,tt,at;return ti(this,function(jt){switch(jt.label){case 0:I=F.windowHopRatio||.25,U=this.collectTransferDataAsTensors(I,{augmentByMixingNoiseRatio:F.augmentByMixingNoiseRatio}),X=U.xs,oe=U.ys,console.log("Training data: xs.shape = "+X.shape+", ys.shape = "+oe.shape),jt.label=1;case 1:return jt.trys.push([1,,6,7]),F.validationSplit!=null?(Te=function($t,vn,wn){return N.util.assert(wn>0&&wn<1,function(){return"validationSplit is expected to be >0 and <1, but got "+wn}),Object(N.tidy)(function(){for(var Nn=vn.argMax(-1).dataSync(),In=[],Ln=0;Ln<Nn.length;++Ln){var qn=Nn[Ln];In[qn]==null&&(In[qn]=[]),In[qn].push(Ln)}var Cn=In.length,wr=[],Fr=[];for(In.map(function(Ti){return N.util.shuffle(Ti)}),Ln=0;Ln<Cn;++Ln)for(var Rr=In[Ln],Xr=Math.round(Rr.length*(1-wn)),zr=0;zr<Rr.length;++zr)zr<Xr?wr.push(Rr[zr]):Fr.push(Rr[zr]);return{trainXs:Object(N.gather)($t,wr),trainYs:Object(N.gather)(vn,wr),valXs:Object(N.gather)($t,Fr),valYs:Object(N.gather)(vn,Fr)}})}(X,oe,F.validationSplit),me=Te.trainXs,Se=Te.trainYs,Me=[Te.valXs,Te.valYs]):(me=X,Se=oe),[4,this.model.fit(me,Se,{epochs:F.epochs==null?20:F.epochs,validationData:Me,batchSize:F.batchSize,callbacks:F.callback==null?null:[F.callback]})];case 2:return tt=jt.sent(),F.fineTuningEpochs!=null&&F.fineTuningEpochs>0?[4,this.fineTuningUsingTensors(F,me,Se,Me)]:[3,4];case 3:return at=jt.sent(),[2,[tt,at]];case 4:return[2,tt];case 5:return[3,7];case 6:return Object(N.dispose)([X,oe,me,Se,Me]),[7];case 7:return[2]}})})},R.prototype.fineTuningUsingTfDatasets=function(F,I,U){return Ir(this,void 0,void 0,function(){var X,oe,me;return ti(this,function(Se){switch(Se.label){case 0:return X=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=!0,oe=F.fineTuningOptimizer==null?"sgd":F.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:oe,metrics:["acc"]}),[4,this.model.fitDataset(I,{epochs:F.fineTuningEpochs,validationData:U,callbacks:F.callback==null?null:[F.callback]})];case 1:return me=Se.sent(),this.secondLastBaseDenseLayer.trainable=X,[2,me]}})})},R.prototype.fineTuningUsingTensors=function(F,I,U,X){return Ir(this,void 0,void 0,function(){var oe,me,Se;return ti(this,function(Me){switch(Me.label){case 0:return oe=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=!0,me=F.fineTuningOptimizer==null?"sgd":F.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:me,metrics:["acc"]}),[4,this.model.fit(I,U,{epochs:F.fineTuningEpochs,validationData:X,batchSize:F.batchSize,callbacks:F.fineTuningCallback==null?null:[F.fineTuningCallback]})];case 1:return Se=Me.sent(),this.secondLastBaseDenseLayer.trainable=oe,[2,Se]}})})},R.prototype.evaluate=function(F){return Ir(this,void 0,void 0,function(){var I,U=this;return ti(this,function(X){return N.util.assert(F.wordProbThresholds!=null&&F.wordProbThresholds.length>0,function(){return"Received null or empty wordProbThresholds"}),I=0,N.util.assert(this.words[I]==="_background_noise_",function(){return"Cannot perform evaluation when the first tag is not _background_noise_"}),[2,Object(N.tidy)(function(){for(var oe=[],me=0,Se=U.collectTransferDataAsTensors(F.windowHopRatio),Me=Se.xs,Te=Se.ys.argMax(-1).dataSync(),tt=U.model.predict(Me),at=tt.slice([0,1],[tt.shape[0],tt.shape[1]-1]).max(-1),jt=tt.shape[0],$t=0;$t<F.wordProbThresholds.length;++$t){for(var vn=F.wordProbThresholds[$t],wn=at.greater(Object(N.scalar)(vn)).dataSync(),Nn=0,In=0,Ln=0,qn=0,Cn=0;Cn<jt;++Cn)Te[Cn]===I?(Nn++,wn[Cn]&&Ln++):(In++,wn[Cn]&&qn++);var wr=Ln/Nn,Fr=qn/In;oe.push({probThreshold:vn,fpr:wr,tpr:Fr}),console.log("ROC thresh="+vn+": fpr="+wr.toFixed(4)+", tpr="+Fr.toFixed(4)),$t>0&&(me+=Math.abs(oe[$t-1].fpr-oe[$t].fpr)*(oe[$t-1].tpr+oe[$t].tpr)/2)}return{rocCurve:oe,auc:me}})]})})},R.prototype.createTransferModelFromBaseModel=function(){var F=this;N.util.assert(this.words!=null,function(){return"No word example is available for tranfer-learning model of name "+F.name});for(var I=this.baseModel.layers,U=I.length-2;U>=0&&I[U].getClassName().toLowerCase()!=="dense";)U--;if(U<0)throw new Error("Cannot find a hidden dense layer in the base model.");this.secondLastBaseDenseLayer=I[U];var X=this.secondLastBaseDenseLayer.output;this.transferHead=Object(N.sequential)(),this.transferHead.add(N.layers.dense({units:this.words.length,activation:"softmax",inputShape:X.shape.slice(1),name:"NewHeadDense"}));var oe=this.transferHead.apply(X);
8227this.model=Object(N.model)({inputs:this.baseModel.inputs,outputs:oe})},R.prototype.modelInputShape=function(){return this.baseModel.inputs[0].shape},R.prototype.getMetadata=function(){return{tfjsSpeechCommandsVersion:Gt,modelName:this.name,timeStamp:new Date().toISOString(),wordLabels:this.wordLabels()}},R.prototype.save=function(F){return Ir(this,void 0,void 0,function(){var I,U,X;return ti(this,function(oe){return I=F!=null,F=F||er(this.name),I||(U=un.localStorage.getItem(Wt),(X=U==null?{}:JSON.parse(U))[this.name]=this.getMetadata(),un.localStorage.setItem(Wt,JSON.stringify(X))),console.log("Saving model to "+F),[2,this.model.save(F)]})})},R.prototype.load=function(F){return Ir(this,void 0,void 0,function(){var I,U,X;return ti(this,function(oe){switch(oe.label){case 0:if(I=F!=null,F=F||er(this.name),!I){if((U=JSON.parse(un.localStorage.getItem(Wt)))==null||U[this.name]==null)throw new Error("Cannot find metadata for transfer model named "+this.name+'"');this.words=U[this.name].wordLabels,console.log("Loaded word list for model named "+this.name+": "+this.words)}return X=this,[4,Object(N.loadLayersModel)(F)];case 1:return X.model=oe.sent(),console.log("Loaded model from "+F+":"),this.model.summary(),[2]}})})},R.prototype.createTransfer=function(F){throw new Error("Creating transfer-learned recognizer from a transfer-learned recognizer is not supported.")},R}(qe);function er(q){return""+Sn+q}function sr(q,R,F,I){if(N.util.assert(F==null&&I==null||F!=null&&I!=null,function(){return"customModelURL and customMetadataURL must be both provided or both not provided."}),F!=null&&N.util.assert(R==null,function(){return"vocabulary name must be null or undefined when modelURL is provided."}),q==="BROWSER_FFT")return new qe(R,F,I);throw q==="SOFT_FFT"?new Error("SOFT_FFT SpeechCommandRecognizer has not been implemented yet."):new Error("Invalid fftType: '"+q+"'")}var pr=function(){function q(R){ce()(this,q),this.options=R}return ke()(q,[{key:"load",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return I?(U=I.split("/"),X=U.slice(0,U.length-1).join("/"),oe="".concat(X,"/metadata.json"),this.model=sr("BROWSER_FFT",void 0,I,oe)):this.model=sr("BROWSER_FFT"),me.next=3,this.model.ensureModelLoaded();case 3:this.allLabels=this.model.wordLabels();case 4:case"end":return me.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"classify",value:function(){var R=this,F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.allLabels.length,I=arguments.length>1?arguments[1]:void 0;return this.model.listen(function(U){if(U.scores){var X=Vt(U.scores,F,R.allLabels).map(function(oe){return{label:oe.className,confidence:oe.probability}});return I(null,X)}return I("ERROR: Cannot find scores in result: ".concat(U))},this.options).catch(function(U){return I("ERROR: ".concat(U.message))})}}]),q}();function Zr(q,R){return Mr.apply(this,arguments)}function Mr(){return(Mr=K()(be.a.mark(function q(R,F){var I;return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return I=new pr(R),U.next=3,I.load(F);case 3:return U.abrupt("return",I);case 4:case"end":return U.stop()}},q)}))).apply(this,arguments)}var Ii=["speechcommands18w"],Lo=function(){function q(R,F,I){if(ce()(this,q),this.model=null,this.options=F,typeof R=="string")if(Ii.includes(R))switch(this.modelName=R,this.modelUrl=null,this.modelName){case"speechcommands18w":this.modelToUse=O;break;default:this.modelToUse=null}else this.modelToUse=O,this.modelUrl=R;this.ready=$e(this.loadModel(F,this.modelUrl),I)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return U.next=2,this.modelToUse.load(I,this.modelUrl);case 2:return this.model=U.sent,U.abrupt("return",this);case 4:case"end":return U.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"classifyInternal",value:function(){var R=K()(be.a.mark(function F(I,U){return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,this.ready;case 2:return X.next=4,N.nextFrame();case 4:return X.abrupt("return",this.model.classify(I,U));case 5:case"end":return X.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"classify",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me=arguments;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return I=me.length>0&&me[0]!==void 0?me[0]:null,U=me.length>1?me[1]:void 0,X=this.topk,typeof I=="number"?X=I:typeof I=="function"&&(oe=I),typeof U=="function"&&(oe=U),Se.abrupt("return",this.classifyInternal(X,oe));case 6:case"end":return Se.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()}]),q}(),Ai=function(q,R,F){var I={},U=F,X=q;if(typeof X!="string")throw new Error('Please specify a model to use. E.g: "SpeechCommands18w"');X.indexOf("http")===-1&&(X=q.toLowerCase()),Ee()(R)==="object"?I=R:typeof R=="function"&&(U=R);var oe=new Lo(X,I,U);return U?oe:oe.ready};function ko(q,R){return q==null&&R==null?null:q==null?R.clone():R===null?q.clone():q.concat(R,0)}function Ji(q,R){for(var F=[],I=0;I<q.length;I++)F.push({value:q[I],index:I});F.sort(function(oe,me){return me.value-oe.value});var U=new Float32Array(R),X=new Int32Array(R);for(I=0;I<R;I++)U[I]=F[I].value,X[I]=F[I].index;return{values:U,indices:X}}var ai=function(){function q(){this.classDatasetMatrices={},this.classExampleCount={},this.labelToClassId={},this.nextClassId=0}return q.prototype.addExample=function(R,F){var I=this;if(this.exampleShape==null&&(this.exampleShape=R.shape),!Ke.util.arraysEqual(this.exampleShape,R.shape))throw new Error("Example shape provided, "+R.shape+" does not match previously provided example shapes "+this.exampleShape+".");this.clearTrainDatasetMatrix(),F in this.labelToClassId||(this.labelToClassId[F]=this.nextClassId++),Object(Ke.ti
8227dy)(function(){var U=I.normalizeVectorToUnitLength(R.flatten()),X=U.shape[0];if(I.classDatasetMatrices[F]==null)I.classDatasetMatrices[F]=U.as2D(1,X);else{var oe=I.classDatasetMatrices[F].as2D(I.classExampleCount[F],X).concat(U.as2D(1,X),0);I.classDatasetMatrices[F].dispose(),I.classDatasetMatrices[F]=oe}Object(Ke.keep)(I.classDatasetMatrices[F]),I.classExampleCount[F]==null&&(I.classExampleCount[F]=0),I.classExampleCount[F]++})},q.prototype.similarities=function(R){var F=this;return Object(Ke.tidy)(function(){var I=F.normalizeVectorToUnitLength(R.flatten()),U=I.shape[0];if(F.trainDatasetMatrix==null){var X=null;for(var oe in F.classDatasetMatrices)X=ko(X,F.classDatasetMatrices[oe]);F.trainDatasetMatrix=X}if(F.trainDatasetMatrix==null)return console.warn("Cannot predict without providing training examples."),null;Object(Ke.keep)(F.trainDatasetMatrix);var me=F.getNumExamples();return F.trainDatasetMatrix.as2D(me,U).matMul(I.as2D(U,1)).as1D()})},q.prototype.predictClass=function(R,F){return F===void 0&&(F=3),function(I,U,X,oe){return new(X||(X=Promise))(function(me,Se){function Me(at){try{tt(oe.next(at))}catch(jt){Se(jt)}}function Te(at){try{tt(oe.throw(at))}catch(jt){Se(jt)}}function tt(at){at.done?me(at.value):new X(function(jt){jt(at.value)}).then(Me,Te)}tt((oe=oe.apply(I,U||[])).next())})}(this,void 0,void 0,function(){var I,U,X,oe,me=this;return function(Se,Me){var Te,tt,at,jt,$t={label:0,sent:function(){if(1&at[0])throw at[1];return at[1]},trys:[],ops:[]};return jt={next:vn(0),throw:vn(1),return:vn(2)},typeof Symbol=="function"&&(jt[Symbol.iterator]=function(){return this}),jt;function vn(wn){return function(Nn){return function(In){if(Te)throw new TypeError("Generator is already executing.");for(;$t;)try{if(Te=1,tt&&(at=2&In[0]?tt.return:In[0]?tt.throw||((at=tt.return)&&at.call(tt),0):tt.next)&&!(at=at.call(tt,In[1])).done)return at;switch(tt=0,at&&(In=[2&In[0],at.value]),In[0]){case 0:case 1:at=In;break;case 4:return $t.label++,{value:In[1],done:!1};case 5:$t.label++,tt=In[1],In=[0];continue;case 7:In=$t.ops.pop(),$t.trys.pop();continue;default:if(!(at=(at=$t.trys).length>0&&at[at.length-1])&&(In[0]===6||In[0]===2)){$t=0;continue}if(In[0]===3&&(!at||In[1]>at[0]&&In[1]<at[3])){$t.label=In[1];break}if(In[0]===6&&$t.label<at[1]){$t.label=at[1],at=In;break}if(at&&$t.label<at[2]){$t.label=at[2],$t.ops.push(In);break}at[2]&&$t.ops.pop(),$t.trys.pop();continue}In=Me.call(Se,$t)}catch(Ln){In=[6,Ln],tt=0}finally{Te=at=0}if(5&In[0])throw In[1];return{value:In[0]?In[1]:void 0,done:!0}}([wn,Nn])}}}(this,function(Se){switch(Se.label){case 0:if(F<1)throw new Error("Please provide a positive integer k value to predictClass.");if(this.getNumExamples()===0)throw new Error("You have not added any examples to the KNN classifier. Please add examples before calling predictClass.");return I=Object(Ke.tidy)(function(){return me.similarities(R).asType("float32")}),U=Math.min(F,this.getNumExamples()),oe=Ji,[4,I.data()];case 1:return X=oe.apply(void 0,[Se.sent(),U]).indices,I.dispose(),[2,this.calculateTopClass(X,U)]}})})},q.prototype.clearClass=function(R){if(this.classDatasetMatrices[R]==null)throw new Error("Cannot clear invalid class "+R);delete this.classDatasetMatrices[R],delete this.classExampleCount[R],this.clearTrainDatasetMatrix()},q.prototype.clearAllClasses=function(){for(var R in this.classDatasetMatrices)this.clearClass(R)},q.prototype.getClassExampleCount=function(){return this.classExampleCount},q.prototype.getClassifierDataset=function(){return this.classDatasetMatrices},q.prototype.getNumClasses=function(){return Object.keys(this.classExampleCount).length},q.prototype.setClassifierDataset=function(R){for(var F in this.clearTrainDatasetMatrix(),this.classDatasetMatrices=R,R)this.classExampleCount[F]=R[F].shape[0]},q.prototype.calculateTopClass=function(R,F){var I,U={};if(R==null)return{classIndex:this.labelToClassId[I],label:I,confidences:U};var X={},oe=0;for(var me in this.classDatasetMatrices)oe+=this.classExampleCount[me],X[me]=oe;var Se={};for(var me in this.classDatasetMatrices)Se[me]=0;for(var Me=0;Me<R.length;Me++){var Te=R[Me];for(var me in this.classDatasetMatrices)if(Te<X[me]){Se[me]++;break}}var tt=0;for(var me in this.classDatasetMatrices){var at=Se[me]/F;at>tt&&(tt=at,I=me),U[me]=at}
8227return{classIndex:this.labelToClassId[I],label:I,confidences:U}},q.prototype.clearTrainDatasetMatrix=function(){this.trainDatasetMatrix!=null&&(this.trainDatasetMatrix.dispose(),this.trainDatasetMatrix=null)},q.prototype.normalizeVectorToUnitLength=function(R){return Object(Ke.tidy)(function(){var F=R.norm();return Object(Ke.div)(R,F)})},q.prototype.getNumExamples=function(){var R=0;for(var F in this.classDatasetMatrices)R+=this.classExampleCount[F];return R},q.prototype.dispose=function(){for(var R in this.clearTrainDatasetMatrix(),this.classDatasetMatrices)this.classDatasetMatrices[R].dispose()},q}(),Yr=function(){var q=K()(be.a.mark(function R(F,I,U){var X,oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:(X=document.createElement("a")).style.display="none",document.body.appendChild(X),oe=new Blob([F],{type:U}),X.href=URL.createObjectURL(oe),X.download=I,X.click();case 7:case"end":return me.stop()}},R)}));return function(R,F,I){return q.apply(this,arguments)}}(),Hn=function(){var q=K()(be.a.mark(function R(F,I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return U.abrupt("return",zt.a.get(F).then(function(X){return X.data}).then(function(X){return I&&I(null,X),X}).catch(function(X){throw I&&I(X),console.error("There has been a problem loading the file: ".concat(X.message)),X}));case 1:case"end":return U.stop()}},R)}));return function(R,F){return q.apply(this,arguments)}}(),ki=function(){function q(){ce()(this,q),this.knnClassifier=new ai,this.mapStringToIndex=[]}return ke()(q,[{key:"addExample",value:function(R,F){var I,U;typeof F=="string"?I=this.mapStringToIndex.includes(F)?this.mapStringToIndex.indexOf(F):this.mapStringToIndex.push(F)-1:typeof F=="number"&&(I=F),U=Array.isArray(R)?N.tensor(R):R,this.knnClassifier.addExample(U,I)}},{key:"classify",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return oe=3,me=X,typeof U=="number"?oe=U:typeof U=="function"&&(me=U),Se=Array.isArray(I)?N.tensor(I):I,Me.abrupt("return",$e(this.classifyInternal(Se,oe),me));case 5:case"end":return Me.stop()}},F,this)}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"classifyInternal",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se=this;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(!(this.knnClassifier.getNumClasses()<=0)){Me.next=5;break}throw new Error("There is no example in any class");case 5:return Me.next=7,this.knnClassifier.predictClass(I,U);case 7:return X=Me.sent,this.mapStringToIndex.length>0&&((X.classIndex||X.classIndex===0)&&(oe=this.mapStringToIndex[X.classIndex])&&(X.label=oe),X.confidences&&(X.confidencesByLabel={},me=X.confidences,Object.keys(me).forEach(function(Te){var tt=Se.mapStringToIndex[Te];X.confidencesByLabel[tt]=me[Te]}))),Me.abrupt("return",X);case 10:case"end":return Me.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"clearLabel",value:function(R){var F;typeof R=="string"?this.mapStringToIndex.includes(R)&&(F=this.mapStringToIndex.indexOf(R)):typeof R=="number"&&(F=R),this.knnClassifier.clearClass(F)}},{key:"clearAllLabels",value:function(){this.mapStringToIndex=[],this.knnClassifier.clearAllClasses()}},{key:"getCountByLabel",value:function(){var R=this,F=this.knnClassifier.getClassExampleCount();if(this.mapStringToIndex.length>0){var I={};return Object.keys(F).forEach(function(U){if(R.mapStringToIndex[U]){var X=R.mapStringToIndex[U];I[X]=F[U]}}),I}return F}},{key:"getCount",value:function(){return this.knnClassifier.getClassExampleCount()}},{key:"getClassifierDataset",value:function(){return this.knnClassifier.getClassifierDataset()}},{key:"setClassifierDataset",value:function(R){this.knnClassifier.setClassifierDataset(R)}},{key:"getNumLabels",value:function(){return this.knnClassifier.getNumClasses()}},{key:"dispose",value:function(){this.knnClassifier.dispose()}},{key:"save",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me=this;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return U=this.knnClassifier.getClassifierDataset(),this.mapStringToIndex.length>
82270&&Object.keys(U).forEach(function(Me){me.mapStringToIndex[Me]&&(U[Me].label=me.mapStringToIndex[Me])}),X=Object.keys(U).map(function(Me){var Te=U[Me];return Te?Te.dataSync():null}),oe="myKNN.json",I&&(oe=I.endsWith(".json")?I:"".concat(I,".json")),Se.next=7,Yr(JSON.stringify({dataset:U,tensors:X}),oe,"application/octet-stream");case 7:case"end":return Se.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"load",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se,Me;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:if(Ee()(I)!=="object"){Te.next=4;break}X=I,Te.next=7;break;case 4:return Te.next=6,Hn(I);case 6:X=Te.sent;case 7:X&&(me=(oe=X).dataset,Se=oe.tensors,this.mapStringToIndex=Object.keys(me).map(function(tt){return me[tt].label}),Me=Se.map(function(tt,at){if(tt){var jt=Object.keys(tt).map(function($t){return tt[$t]});return N.tensor(jt,me[at].shape,me[at].dtype)}return null}).reduce(function(tt,at,jt){return tt[jt]=at,tt},{}),this.knnClassifier.setClassifierDataset(Me),U&&U());case 8:case"end":return Te.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()}]),q}(),lo=function(){return new ki},Kr=function(){function q(R,F){ce()(this,q),this.videoElt=null,this.size=F,this.videoReady=!1,typeof HTMLVideoElement<"u"&&(R instanceof HTMLVideoElement?this.videoElt=R:R!==null&&Ee()(R)==="object"&&R.elt instanceof HTMLVideoElement&&(this.videoElt=R.elt))}return ke()(q,[{key:"loadVideo",value:function(){var R=K()(be.a.mark(function F(){var I,U=this;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.abrupt("return",new Promise(function(oe,me){U.videoElt||me(new Error("No video was passed to the constructor.")),U.video=document.createElement("video");var Se=navigator.userAgent;I=Se.indexOf("Firefox")>-1?U.videoElt.mozCaptureStream():U.videoElt.captureStream(),U.video.srcObject=I,U.size&&(U.video.width=U.size,U.video.height=U.size),U.video.autoplay=!0,U.video.playsinline=!0,U.video.muted=!0;var Me=U.video.play();Me!==void 0&&Me.then(function(){U.videoReady=!0,oe(U.video)})}));case 1:case"end":return X.stop()}},F)}));return function(){return R.apply(this,arguments)}}()}]),q}(),Io=224,Ko=[Io,Io],Eo="https://storage.googleapis.com/tfjs-models/tfjs/mobilenet_v",Yo={version:1,alpha:.25,topk:3,learningRate:1e-4,hiddenUnits:100,epochs:20,numLabels:2,batchSize:.4,layer:"conv_pw_13_relu"},vs={1:{.25:"https://tfhub.dev/google/imagenet/mobilenet_v1_025_224/classification/1",.5:"https://tfhub.dev/google/imagenet/mobilenet_v1_050_224/classification/1",.75:"https://tfhub.dev/google/imagenet/mobilenet_v1_075_224/classification/1",1:"https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1"},2:{.5:"https://tfhub.dev/google/imagenet/mobilenet_v2_050_224/classification/2",.75:"https://tfhub.dev/google/imagenet/mobilenet_v2_075_224/classification/2",1:"https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2"}},gu={1:"module_apply_default/MobilenetV1/Logits/global_pool",2:"module_apply_default/MobilenetV2/Logits/AvgPool"},pp=function(){function q(R,F){ce()(this,q),this.mobilenet=null,this.topKPredictions=10,this.hasAnyTrainedClass=!1,this.customModel=null,this.jointModel=null,this.config={epochs:R.epochs||Yo.epochs,version:R.version||Yo.version,hiddenUnits:R.hiddenUnits||Yo.hiddenUnits,numLabels:R.numLabels||Yo.numLabels,learningRate:R.learningRate||Yo.learningRate,batchSize:R.batchSize||Yo.batchSize,layer:R.layer||Yo.layer,alpha:R.alpha||Yo.alpha},this.model=null,this.url=vs[this.config.version][this.config.alpha],this.normalizationOffset=N.scalar(127.5),this.mobilenetURL=R.mobilenetURL||"".concat(Eo).concat(this.config.version,"_").concat(this.config.alpha,"_").concat(Io,"/model.json"),this.graphModelURL=R.graphModelURL||this.url,this.isPredicting=!1,this.mapStringToIndex=[],this.usageType=null,this.ready=$e(this.loadModel(),F)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(){var I;return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return U.next=2,N.loadLayersModel(this.mobilenetURL);case 2:if(this.mobilenet=U.sent,!this.graphModelURL.includes("https://tfhub.dev/")){U.next=9;break}return U.next=6,N.loadGraphModel(this.graphModelURL,{fromTFHub:!0});case 6:this.model=U.sent,U.next=12;break;case 9:return U.next=11,N.loadGraphModel(this.graphModelURL,{fromTFHub:!1});case 11:this.model=U.sent;case 12:return I=this.mobilenet.getLayer(this.config.layer),U.next=15,N.model({inputs:this.mobilenet.inputs,outputs:I.output});case 15:if(this.mobilenetFeatures=U.sent,!this.video){U.next=19;break}return U.next=19,this.mobilenetFeatures.predict(Xn(this.video,Ko));case 19:return U.abrupt("return",this);case 20:case"end":return U.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"classification",value:function(R){var F,I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,U=arguments.length>2?arguments[2]:void 0;return this.usageType="classifier",Ee()(I)==="object"?Object.assign(this.config,I):typeof I=="function"&&(F=I),typeof U=="function"&&(F=U),R&&$e(this.loadVideo(R),F),this}},{key:"regression",value:function(R,F){return this.usageType="regressor",R&&$e(this.loadVideo(R),F),this}},{key:"loadVideo",value:function(){var R=K()(be.a.mark(function F(I){var U,X;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:if(U=null,I instanceof HTMLVideoElement?U=I:Ee()(I)==="object"&&I.elt instanceof HTMLVideoElement&&(U=I.elt),!U){oe.next=7;break}return X=new Kr(U,Io),oe.next=6,X.loadVideo();case 6:this.video=oe.sent;case 7:return oe.abrupt("return",this);case 8:case"end":return oe.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"addImage",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se;return be.a.wrap(function(Me){for(;;
8227)switch(Me.prev=Me.next){case 0:return Se=X,I instanceof HTMLImageElement||I instanceof HTMLVideoElement||I instanceof HTMLCanvasElement||I.elt instanceof ImageData?oe=I:Ee()(I)==="object"&&(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLVideoElement||I.elt instanceof HTMLCanvasElement||I.elt instanceof ImageData)?oe=I.elt:typeof I!="string"&&typeof I!="number"||(oe=this.video,me=I),typeof U=="string"||typeof U=="number"?me=U:typeof U=="function"&&(Se=U),typeof me=="string"&&(me=this.mapStringToIndex.includes(me)?this.mapStringToIndex.indexOf(me):this.mapStringToIndex.push(me)-1),Me.abrupt("return",$e(this.addImageInternal(oe,me),Se));case 5:case"end":return Me.stop()}},F,this)}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"addImageInternal",value:function(){var R=K()(be.a.mark(function F(I,U){var X=this;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.next=2,this.ready;case 2:return N.tidy(function(){var me,Se=Xn(I,Ko),Me=X.mobilenetFeatures.predict(Se);if(X.usageType==="classifier"?me=N.tidy(function(){return N.oneHot(N.tensor1d([U],"int32"),X.config.numLabels)}):X.usageType==="regressor"&&(me=N.tensor2d([[U]])),X.xs==null)X.xs=N.keep(Me),X.ys=N.keep(me),X.hasAnyTrainedClass=!0;else{var Te=X.xs;X.xs=N.keep(Te.concat(Me,0));var tt=X.ys;X.ys=N.keep(tt.concat(me,0)),Te.dispose(),tt.dispose(),me.dispose()}}),oe.abrupt("return",this);case 4:case"end":return oe.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"train",value:function(){var R=K()(be.a.mark(function F(I){var U,X;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:if(this.hasAnyTrainedClass){oe.next=2;break}throw new Error("Add some examples before training!");case 2:if(this.isPredicting=!1,this.usageType==="classifier"?(this.loss="categoricalCrossentropy",this.customModel=N.sequential({layers:[N.layers.flatten({inputShape:[7,7,256]}),N.layers.dense({units:this.config.hiddenUnits,activation:"relu",kernelInitializer:"varianceScaling",useBias:!0}),N.layers.dense({units:this.config.numLabels,kernelInitializer:"varianceScaling",useBias:!1,activation:"softmax"})]})):this.usageType==="regressor"&&(this.loss="meanSquaredError",this.customModel=N.sequential({layers:[N.layers.flatten({inputShape:[7,7,256]}),N.layers.dense({units:this.config.hiddenUnits,activation:"relu",kernelInitializer:"varianceScaling",useBias:!0}),N.layers.dense({units:1,useBias:!1,kernelInitializer:"Zeros",activation:"linear"})]})),this.jointModel=N.sequential(),this.jointModel.add(this.mobilenetFeatures),this.jointModel.add(this.customModel),U=N.train.adam(this.config.learningRate),this.customModel.compile({optimizer:U,loss:this.loss}),(X=Math.floor(this.xs.shape[0]*this.config.batchSize))>0){oe.next=12;break}throw new Error("Batch size is 0 or NaN. Please choose a non-zero fraction.");case 12:return oe.abrupt("return",this.customModel.fit(this.xs,this.ys,{batchSize:X,epochs:this.config.epochs,callbacks:{onBatchEnd:function(){var me=K()(be.a.mark(function Se(Me,Te){return be.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:return I(Te.loss.toFixed(5)),tt.next=3,N.nextFrame();case 3:case"end":return tt.stop()}},Se)}));return function(Se,Me){return me.apply(this,arguments)}}(),onTrainEnd:function(){return I(null)}}}));case 13:case"end":return oe.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"classify",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return I instanceof HTMLImageElement||I instanceof HTMLVideoElement||I instanceof HTMLCanvasElement||I instanceof ImageData?X=I:Ee()(I)==="object"&&(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLVideoElement||I.elt instanceof HTMLCanvasElement||I.elt instanceof ImageData)?X=I.elt:typeof I=="function"&&(X=this.video,oe=I),typeof U=="function"&&(oe=U),me.abrupt("return",$e(this.classifyInternal(X),oe));case 3:case"end":return me.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"classifyInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe=this;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:if(this.usageType==="classifier"){me.next=2;break}throw new Error("Mobilenet Feature Extraction has not been set to be a classifier.");case 2:return me.next=4,N.nextFrame();case 4:return this.isPredicting=!0,U=N.tidy(function(){var Se=Xn(I,Ko),Me=oe.jointModel.predict(Se);return Array.from(Me.as1D().dataSync())}),me.next=8,U.map(function(Se,Me){return{label:oe.mapStringToIndex.length>0&&oe.mapStringToIndex[Me]?oe.mapStringToIndex[Me]:Me,confidence:Se}}).sort(function(Se,Me){return Me.confidence-Se.confidence});case 8:return X=me.sent,me.abrupt("return",X);case 10:case"end":return me.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"predict",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return I instanceof HTMLImageElement||I instanceof HTMLVideoElement||I instanceof HTMLCanvasElement||I instanceof ImageData?X=I:Ee()(I)==="object"&&(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLVideoElement||I.elt instanceof HTMLCanvasElement||I.elt instanceof ImageData)?X=I.elt:typeof I=="function"&&(X=this.video,oe=I),typeof U=="function"&&(oe=U),me.abrupt("return",$e(this.predictInternal(X),oe));case 3:case"end":return me.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"predictInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe=this;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:if(this.usageType==="regressor"){me.next=2;break}throw new Error("Mobilenet Feature Extraction has not been set to be a regressor.");case 2:return me.next=4,N.nextFrame();case 4:return this.isPredicting=!0,U=N.tidy(function(){var Se=Xn(I,Ko);return oe.jointModel.predict(Se).as1D()}),me.next=8,U.data();case 8:return X=me.sent,U.dispose(),me.abrupt("return",{value:X[0]});case 11:case"end":return me.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"load",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me,Se,Me=this,Te=arguments;return be.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:if(I=Te.length>0&&Te[0]!==void 0?Te[0]:null,U=Te.length>
82271?Te[1]:void 0,typeof I=="string"){tt.next=11;break}return X=null,oe=null,Array.from(I).forEach(function(at){if(at.name.includes(".json")){X=at;var jt=new FileReader;jt.onload=function($t){JSON.parse($t.target.result).ml5Specs&&(Me.mapStringToIndex=JSON.parse($t.target.result).ml5Specs.mapStringToIndex)},jt.readAsText(at)}else at.name.includes(".bin")&&(oe=at)}),tt.next=8,N.loadLayersModel(N.io.browserFiles([X,oe]));case 8:this.jointModel=tt.sent,tt.next=20;break;case 11:return tt.next=13,zt.a.get(I);case 13:return me=tt.sent,(Se=me.data).ml5Specs&&(this.mapStringToIndex=Se.ml5Specs.mapStringToIndex),tt.next=18,N.loadLayersModel(I);case 18:this.jointModel=tt.sent,U&&U();case 20:return tt.abrupt("return",this.jointModel);case 21:case"end":return tt.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"save",value:function(){var R=K()(be.a.mark(function F(I,U){var X=this;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:if(this.jointModel){oe.next=2;break}throw new Error("No model found.");case 2:this.jointModel.save(N.io.withSaveHandler(function(){var me=K()(be.a.mark(function Se(Me){var Te;return be.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:return Te="model",U&&(Te=U),X.weightsManifest={modelTopology:Me.modelTopology,weightsManifest:[{paths:["./".concat(Te,".weights.bin")],weights:Me.weightSpecs}],ml5Specs:{mapStringToIndex:X.mapStringToIndex}},tt.next=5,Yr(Me.weightData,"".concat(Te,".weights.bin"),"application/octet-stream");case 5:return tt.next=7,Yr(JSON.stringify(X.weightsManifest),"".concat(Te,".json"),"text/plain");case 7:I&&I();case 8:case"end":return tt.stop()}},Se)}));return function(Se){return me.apply(this,arguments)}}()));case 3:case"end":return oe.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"mobilenetInfer",value:function(R){var F=this,I=arguments.length>1&&arguments[1]!==void 0&&arguments[1],U=R;return U instanceof N.Tensor||U instanceof ImageData||U instanceof HTMLImageElement||U instanceof HTMLCanvasElement||U instanceof HTMLVideoElement?N.tidy(function(){U instanceof N.Tensor||(U=N.browser.fromPixels(U));var X=U.toFloat().sub(F.normalizationOffset).div(F.normalizationOffset),oe=X;(U.shape[0]!==Io||U.shape[1]!==Io)&&(oe=N.image.resizeBilinear(X,Ko,!0));var me,Se=oe.reshape([-1,Io,Io,3]);if(I){var Me=gu[F.config.version];me=F.model.execute(Se,Me).squeeze([1,2])}else me=F.model.predict(Se).slice([0,1],[-1,1e3]);return me}):null}},{key:"infer",value:function(R,F){var I,U;if(R instanceof HTMLImageElement||R instanceof HTMLVideoElement||R instanceof HTMLCanvasElement||R instanceof ImageData)I=R;else{if(Ee()(R)!=="object"||!(R.elt instanceof HTMLImageElement||R.elt instanceof HTMLVideoElement||R.elt instanceof HTMLCanvasElement||R.elt instanceof ImageData))throw new Error("No input image found.");I=R.elt}return U=F&&typeof F=="string"?F:"conv_preds",this.mobilenetInfer(I,U)}}]),q}(),fo=function(q,R,F){var I;if(typeof q!="string")throw new Error('Please specify a model to use. E.g: "MobileNet"');I=q.toLowerCase();var U={},X=F;if(Ee()(R)==="object"?U=R:typeof R=="function"&&(X=R),I==="mobilenet")return new pp(U,X);throw new Error("".concat(I," is not a valid model."))},yl=function(){console.log("%cword2vec has been disabled","color: #A155FF; font-size: 16px"),console.log("We've intentionally disabled the word2vec function after recognizing it has the potential to produce harmful outputs while using the model files included in our examples. We'll consider reenabling the word2vec function along with changes to address these issues in a future release of ml5.js. You can find further updates about this topic on our Twitter account (https://twitter.com/ml5js/status/1445762321444315147) and GitHub (https://github.com/ml5js/ml5-library/issues/1238).")},Tc=n(58),Wl=n.n(Tc),Jc=n(57),Vl=n.n(Jc),Sm=n(35),Qs=n.n(Sm),Zd=["person","bicycle","car","motorbike","aeroplane","bus","train","truck","boat","traffic light","fire hydrant","stop sign","parking meter","bench","bird","cat","dog","horse","sheep","cow","elephant","bear","zebra","giraffe","backpack","umbrella","handbag","tie","suitcase","frisbee","skis","snowboard","sports ball","kite","baseball bat","baseball glove","skateboard","surfboard","tennis racket","bottle","wine glass","cup","fork","knife","spoon","bowl","banana","apple","sandwich","orange","broccoli","carrot","hot dog","pizza","donut","cake","chair","sofa","pottedplant","bed","diningtable","toilet","tvmonitor","laptop","mouse","remote","keyboard","cell phone","microwave","oven","toaster","sink","refrigerator","book","clock","vase","scissors","teddy bear","hair drier","toothbrush"];function Am(q){return new RegExp("^(?:[a-z]+:)?//","i").test(q)}var Qc={isAbsoluteURL:Am,getModelPath:function(q){return Am(q)||typeof window>"u"?q:window.location.pathname+q}},eh=function(q,R){var F=Math.min(q[3],R[3])-Math.max(q[1],R[1]),I=Math.min(q[2],R[2])-Math.max(q[0],R[0]);return F<0||I<0?0:F*I},mp=function(q,R){return eh(q,R)/function(F,I){var U=eh(F,I);return(F[3]-F[1])*(F[2]-F[0])+(I[3]-I[1])*(I[2]-I[0])-U}(q,R)};function $l(q,R,F,I){return nd.apply(this,arguments)}
8227function nd(){return(nd=K()(be.a.mark(function q(R,F,I,U){return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.abrupt("return",N.tidy(function(){for(var oe=N.mul(F,I),me=N.argMax(oe,-1),Se=N.max(oe,-1),Me=N.greaterEqual(Se,N.scalar(U)).dataSync(),Te=[],tt=0;tt<Me.length;tt+=1)Me[tt]&&Te.push(tt);if(Te.length===0)return[null,null,null];var at=N.tensor1d(Te,"int32");return[N.gather(R.reshape([Me.length,4]),at),N.gather(Se.flatten(),at),N.gather(me.flatten(),at)]}));case 1:case"end":return X.stop()}},q)}))).apply(this,arguments)}var ys=function(q,R){return N.tidy(function(){var F=N.tensor1d([2]),I=N.sub(q,N.div(R,F)),U=N.add(q,N.div(R,F)),X=[I.shape[0],I.shape[1],I.shape[2],1];return N.concat([I.slice([0,0,0,1],X),I.slice([0,0,0,0],X),U.slice([0,0,0,1],X),U.slice([0,0,0,0],X)],3)})},vf=function(q,R,F){return N.tidy(function(){for(var I=[],U=0;U<R.length;U+=1)I.push([R[U],[q[4*U],q[4*U+1],q[4*U+2],q[4*U+3]],U]);var X=[];return I.sort(function(oe,me){return me[0]-oe[0]}).forEach(function(oe){for(var me=!0,Se=0;Se<X.length;Se+=1)if(mp(oe[1],X[Se][1])>F){me=!1;break}me&&X.push(oe)}),[X.map(function(oe){return oe[2]}),X.map(function(oe){return oe[1]}),X.map(function(oe){return oe[0]})]})};function Ha(q,R,F){return N.tidy(function(){var I=R.shape[0],U=N.reshape(R,[1,1,I,2]),X=q.shape.slice(1,3),oe=X[0],me=X[1],Se=N.range(0,X[0]),Me=N.range(0,X[1]);Se=N.tile(Se,[X[1]]),Me=N.tile(N.expandDims(Me,0),[X[0],1]),Me=N.transpose(Me).flatten();var Te=N.transpose(N.stack([Se,Me]));Te=N.reshape(Te,[X[0],X[1],1,2]),Te=N.cast(Te,q.dtype),q=N.reshape(q,[X[0],X[1],I,F+5]),X=N.cast(N.reshape(N.tensor1d(X),[1,1,1,2]),q.dtype);var tt=N.sigmoid(q.slice([0,0,0,0],[oe,me,I,2])),at=N.exp(q.slice([0,0,0,2],[oe,me,I,2])),jt=N.sigmoid(q.slice([0,0,0,4],[oe,me,I,1])),$t=N.softmax(q.slice([0,0,0,5],[oe,me,I,F]));return[tt=N.div(N.add(tt,Te),X),at=N.div(N.mul(at,U),X),jt,$t]})}function bl(q){var R=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var F,I=Qs()(q);if(R){var U=Qs()(this).constructor;F=Reflect.construct(I,arguments,U)}else F=I.apply(this,arguments);return Vl()(this,F)}}var Zs={modelUrl:"https://raw.githubusercontent.com/ml5js/ml5-data-and-training/master/models/YOLO/model.json",filterBoxesThreshold:.01,IOUThreshold:.4,classProbThreshold:.4},ls=416,xl=function(q){Wl()(F,q);var R=bl(F);function F(I,U,X){var oe;return ce()(this,F),(oe=R.call(this,I,ls)).modelUrl=U.modelUrl||Zs.modelUrl,oe.filterBoxesThreshold=U.filterBoxesThreshold||Zs.filterBoxesThreshold,oe.IOUThreshold=U.IOUThreshold||Zs.IOUThreshold,oe.classProbThreshold=U.classProbThreshold||Zs.classProbThreshold,oe.modelReady=!1,oe.isPredicting=!1,oe.callback=X,oe.ready=$e(oe.loadModel(),oe.callback),U.disableDeprecationNotice||console.warn("WARNING! Function YOLO has been deprecated, please use the new ObjectDetector function instead"),oe}return ke()(F,[{key:"loadModel",value:function(){var I=K()(be.a.mark(function U(){var X;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:if(!this.videoElt||this.video){oe.next=4;break}return oe.next=3,this.loadVideo();case 3:this.video=oe.sent;case 4:if(Qc.isAbsoluteURL(this.modelUrl)!==!0){oe.next=10;break}return oe.next=7,N.loadLayersModel(this.modelUrl);case 7:this.model=oe.sent,oe.next=15;break;case 10:return X=Qc.getModelPath(this.modelUrl),this.modelUrl="".concat(X,"/model.json"),oe.next=14,N.loadLayersModel(this.modelUrl);case 14:this.model=oe.sent;case 15:return this.modelReady=!0,oe.abrupt("return",this);case 17:case"end":return oe.stop()}},U,this)}));return function(){return I.apply(this,arguments)}}()},{key:"detect",value:function(){var I=K()(be.a.mark(function U(X,oe){var me,Se;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return Me.next=2,this.ready;case 2:if(Se=oe,!Fn(X)){Me.next=7;break}me=X,Me.next=21;break;case 7:if(Ee()(X)!=="object"||!Fn(X.elt)){Me.next=11;break}me=X.elt,Me.next=21;break;case 11:if(Ee()(X)!=="object"||!Fn(X.canvas)){Me.next=15;break}me=X.canvas,Me.next=21;break;case 15:if(typeof X!="function"){Me.next=20;break}me=this.video,Se=X,Me.next=21;break;case 20:throw new Error("Detection subject not supported");case 21:return Me.abrupt("return",$e(this.detectInternal(me),Se));case 22:case"end":return Me.stop()}},U,this)}));return function(U,X){return I.apply(this,arguments)}}()},{key:"detectInternal",value:function(){var I=K()(be.a.mark(function U(X){var oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn=this;return be.a.wrap(function(In){for(;;)switch(In.prev=In.next){case 0:return In.next=2,this.ready;case 2:return In.next=4,N.nextFrame();case 4:return oe=N.tensor2d([[.57273,.677385],[1.87446,2.06253],[3.33843,5.47434],[7.88282,3.52778],[9.77052,9.16828]]),this.isPredicting=!0,me=N.tidy(function(){var Ln=Xn(X,[ls,ls]),qn=Ha(Nn.model.predict(Ln),oe,80),Cn=on()(qn,4),wr=Cn[0],Fr=Cn[1],Rr=Cn[2],Xr=Cn[3];return[ys(wr,Fr),Rr,Xr]}),Se=on()(me,3),Me=Se[0],Te=Se[1],tt=Se[2],In.next=9,$l(Me,Te,tt,this.filterBoxesThreshold);
8227case 9:if(at=In.sent,jt=on()(at,3),$t=jt[0],vn=jt[1],wn=jt[2],Me.dispose(),Te.dispose(),tt.dispose(),$t!=null){In.next=19;break}return In.abrupt("return",[]);case 19:return In.abrupt("return",N.tidy(function(){var Ln=N.scalar(ls),qn=N.scalar(ls),Cn=N.stack([qn,Ln,qn,Ln]).reshape([1,4]),wr=N.mul($t,Cn),Fr=wr.dataSync(),Rr=vn.dataSync(),Xr=vf(Fr,Rr,Nn.IOUThreshold),zr=on()(Xr,3),Ti=zr[0],Wi=zr[1],zi=zr[2],Xo=[];return wn.gather(N.tensor1d(Ti,"int32")).dataSync().forEach(function(wa,ua){var oa=zi[ua];if(!(oa<Nn.classProbThreshold)){var ha=Zd[wa],Ma=on()(Wi[ua],4),Wa=Ma[0],us=Ma[1],Qu=Ma[2],Hi=Ma[3];Wa=Math.max(0,Wa),us=Math.max(0,us),Qu=Math.min(ls,Qu)-Wa;var Ts={label:ha,confidence:oa,x:us,y:Wa,width:Hi=Math.min(ls,Hi)-us,height:Qu,normalized:{x:us/ls,y:Wa/ls,width:Hi/ls,height:Qu/ls}};Xo.push(Ts)}}),Nn.isPredicting=!1,Ln.dispose(),qn.dispose(),Cn.dispose(),wr.dispose(),$t.dispose(),vn.dispose(),wn.dispose(),oe.dispose(),Xo}));case 20:case"end":return In.stop()}},U,this)}));return function(U){return I.apply(this,arguments)}}()}]),F}(Kr),rd=function(q,R,F){var I=null,U={},X=F;return q instanceof HTMLVideoElement?I=q:Ee()(q)==="object"&&q.elt instanceof HTMLVideoElement?I=q.elt:typeof q=="function"?X=q:Ee()(q)==="object"&&(U=q),Ee()(R)==="object"?U=R:typeof R=="function"&&(X=R),new xl(I,U,X)},wl=n(242),vc={base:"lite_mobilenet_v2",modelUrl:void 0},gp=function(){function q(R,F,I){ce()(this,q),this.video=R||null,this.modelReady=!1,this.isPredicting=!1,this.config={base:F.base||vc.base,modelUrl:F.modelUrl||vc.modelUrl},this.callback=I,this.ready=$e(this.loadModel(),this.callback)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(){return be.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,wl.load(this.config);case 2:return this.model=I.sent,this.modelReady=!0,I.abrupt("return",this);case 5:case"end":return I.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"detectInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return this.isPredicting=!0,oe.next=3,this.model.detect(I);case 3:return U=oe.sent,X=U.map(function(me){return{label:me.class,confidence:me.score,x:me.bbox[0],y:me.bbox[1],width:me.bbox[2],height:me.bbox[3],normalized:{x:me.bbox[0]/I.width,y:me.bbox[1]/I.height,width:me.bbox[2]/I.width,height:me.bbox[3]/I.height}}}),this.isPredicting=!1,oe.abrupt("return",X);case 7:case"end":return oe.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"detect",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return me.next=2,this.ready;case 2:return me.next=4,N.nextFrame();case 4:if(oe=U,!Fn(I)){me.next=9;break}X=I,me.next=23;break;case 9:if(Ee()(I)!=="object"||!Fn(I.elt)){me.next=13;break}X=I.elt,me.next=23;break;case 13:if(Ee()(I)!=="object"||!Fn(I.canvas)){me.next=17;break}X=I.canvas,me.next=23;break;case 17:if(typeof I!="function"){me.next=22;break}X=this.video,oe=I,me.next=23;break;case 22:throw new Error("Detection subject not supported");case 23:return me.abrupt("return",$e(this.detectInternal(X),oe));case 24:case"end":return me.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()}]),q}(),th=function(q,R,F){var I=null,U={},X=F;return q instanceof HTMLVideoElement?I=q:Ee()(q)==="object"&&q.elt instanceof HTMLVideoElement?I=q.elt:typeof q=="function"?X=q:Ee()(q)==="object"&&(U=q),Ee()(R)==="object"?U=R:typeof R=="function"&&(X=R),new gp(I,U,X)};function nh(q,R){var F=Object.keys(q);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(q);R&&(I=I.filter(function(U){return Object.getOwnPropertyDescriptor(q,U).enumerable})),F.push.apply(F,I)}return F}var Ja=ke()(function q(R,F,I,U){switch(ce()(this,q),this.video=F,this.modelNameOrUrl=R,this.options=I||{},this.callback=U,R){case"yolo":return this.model=new rd(this.video,function(X){for(var oe=1;oe<arguments.length;oe++){var me=arguments[oe]!=null?arguments[oe]:{};
8227oe%2?nh(Object(me),!0).forEach(function(Se){V()(X,Se,me[Se])}):Object.getOwnPropertyDescriptors?Object.defineProperties(X,Object.getOwnPropertyDescriptors(me)):nh(Object(me)).forEach(function(Se){Object.defineProperty(X,Se,Object.getOwnPropertyDescriptor(me,Se))})}return X}({disableDeprecationNotice:!0},this.options),U),this;case"cocossd":default:return this.model=new th(this.video,this.options,U),this}}),vp=function(q,R,F,I){var U,X={},oe=I,me=q;if(typeof me!="string")throw new Error('Please specify a model to use. E.g: "YOLO"');me.indexOf("http")===-1&&(me=q.toLowerCase()),R instanceof HTMLVideoElement?U=R:Ee()(R)==="object"&&R.elt instanceof HTMLVideoElement?U=R.elt:Ee()(R)==="object"?X=R:typeof R=="function"&&(oe=R),Ee()(F)==="object"?X=F:typeof F=="function"&&(oe=F);var Se=new Ja(me,U,X,oe);return Se.model.callback?Se.model:Se.model.ready},Om=n(99),rh=n.n(Om),ih=function(q,R){return(ih=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,I){F.__proto__=I}||function(F,I){for(var U in I)I.hasOwnProperty(U)&&(F[U]=I[U])})(q,R)};function vu(q,R){function F(){this.constructor=q}ih(q,R),q.prototype=R===null?Object.create(R):(F.prototype=R.prototype,new F)}var oh=function(){return(oh=Object.assign||function(q){for(var R,F=1,I=arguments.length;F<I;F++)for(var U in R=arguments[F])Object.prototype.hasOwnProperty.call(R,U)&&(q[U]=R[U]);return q}).apply(this,arguments)};function gr(q,R,F,I){return new(F||(F=Promise))(function(U,X){function oe(Me){try{Se(I.next(Me))}catch(Te){X(Te)}}function me(Me){try{Se(I.throw(Me))}catch(Te){X(Te)}}function Se(Me){Me.done?U(Me.value):new F(function(Te){Te(Me.value)}).then(oe,me)}Se((I=I.apply(q,R||[])).next())})}function Nc(q,R){var F,I,U,X,oe={label:0,sent:function(){if(1&U[0])throw U[1];return U[1]},trys:[],ops:[]};return X={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function me(Se){return function(Me){return function(Te){if(F)throw new TypeError("Generator is already executing.");for(;oe;)try{if(F=1,I&&(U=2&Te[0]?I.return:Te[0]?I.throw||((U=I.return)&&U.call(I),0):I.next)&&!(U=U.call(I,Te[1])).done)return U;switch(I=0,U&&(Te=[2&Te[0],U.value]),Te[0]){case 0:case 1:U=Te;break;case 4:return oe.label++,{value:Te[1],done:!1};case 5:oe.label++,I=Te[1],Te=[0];continue;case 7:Te=oe.ops.pop(),oe.trys.pop();continue;default:if(!(U=(U=oe.trys).length>0&&U[U.length-1])&&(Te[0]===6||Te[0]===2)){oe=0;continue}if(Te[0]===3&&(!U||Te[1]>U[0]&&Te[1]<U[3])){oe.label=Te[1];break}if(Te[0]===6&&oe.label<U[1]){oe.label=U[1],U=Te;break}if(U&&oe.label<U[2]){oe.label=U[2],oe.ops.push(Te);break}U[2]&&oe.ops.pop(),oe.trys.pop();continue}Te=R.call(q,oe)}catch(tt){Te=[6,tt],I=0}finally{F=U=0}if(5&Te[0])throw Te[1];return{value:Te[0]?Te[1]:void 0,done:!0}}([Se,Me])}}}var Rg=function(){function q(R,F){this.model=R,this.outputStride=F;var I=this.model.inputs[0].shape;Ke.util.assert(I[1]===-1&&I[2]===-1,function(){return"Input shape ["+I[1]+", "+I[2]+"] must both be equal to or -1"})}return q.prototype.predict=function(R){var F=this;return Object(Ke.tidy)(function(){var I=F.preprocessInput(Object(Ke.cast)(R,"float32")),U=Object(Ke.expandDims)(I,0),X=F.model.predict(U).map(function(me){return Object(Ke.squeeze)(me,[0])}),oe=F.nameOutputResults(X);return{heatmapScores:Object(Ke.sigmoid)(oe.heatmap),offsets:oe.offsets,displacementFwd:oe.displacementFwd,displacementBwd:oe.displacementBwd}})},q.prototype.dispose=function(){this.model.dispose()},q}(),Bg=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return vu(R,q),R.prototype.preprocessInput=function(F){return Object(Ke.tidy)(function(){return Object(Ke.sub)(Object(Ke.div)(F,127.5),1)})},R.prototype.nameOutputResults=function(F){return{offsets:F[0],heatmap:F[1],displacementFwd:F[2],displacementBwd:F[3]}},R}(Rg);function ah(q){return Math.floor(q/2)}var id=function(){function q(R,F){this.priorityQueue=new Array(R),this.numberOfElements=-1,this.getElementValue=F}return q.prototype.enqueue=function(R){this.priorityQueue[++this.numberOfElements]=R,this.swim(this.numberOfElements)},q.prototype.dequeue=function(){var R=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,R},q.prototype.empty=function(){return this.numberOfElements===-1},q.prototype.size=function(){return this.numberOfElements+1},q.prototype.all=function(){return this.priorityQueue.slice(0,this.numberOfElements+1)},q.prototype.max=function(){return this.priorityQueue[0]},q.prototype.swim=function(R){for(;R>0&&this.less(ah(R),R);)this.exchange(R,ah(R)),R=ah(R)},q.prototype.sink=function(R){for(;2*R<=this.numberOfElements;){var F=2*R;if(F<this.numberOfElements&&this.less(F,F+1)&&F++,!this.less(R,F))break;this.exchange(R,F),R=F}},q.prototype.getValueAt=function(R){return this.getElementValue(this.priorityQueue[R])},q.prototype.less=function(R,F){return this.getValueAt(R)<this.getValueAt(F)},q.prototype.exchange=function(R,F){var I=this.priorityQueue[R];this.priorityQueue[R]=this.priorityQueue[F],this.priorityQueue[F]=I},q}();
8227function Dm(q,R,F,I,U,X){for(var oe=X.shape,me=oe[0],Se=oe[1],Me=!0,Te=Math.max(F-U,0),tt=Math.min(F+U+1,me),at=Te;at<tt;++at){for(var jt=Math.max(I-U,0),$t=Math.min(I+U+1,Se),vn=jt;vn<$t;++vn)if(X.get(at,vn,q)>R){Me=!1;break}if(!Me)break}return Me}var yp=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],bp=yp.length,eo=yp.reduce(function(q,R,F){return q[R]=F,q},{}),ca=[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]].map(function(q){var R=q[0],F=q[1];return[eo[R],eo[F]]});function xp(q,R,F,I){return{y:I.get(q,R,F),x:I.get(q,R,F+bp)}}function N0(q,R,F){var I=xp(q.heatmapY,q.heatmapX,q.id,F),U=I.y,X=I.x;return{x:q.heatmapX*R+X,y:q.heatmapY*R+U}}function sh(q,R,F){return q<R?R:q>F?F:q}function Tm(q,R){return{x:q.x+R.x,y:q.y+R.y}}var yu=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]].map(function(q){var R=q[0],F=q[1];return[eo[R],eo[F]]}),_l=yu.map(function(q){return q[1]}),Nm=yu.map(function(q){return q[0]});function Pg(q,R,F,I){return{y:sh(Math.round(q.y/R),0,F-1),x:sh(Math.round(q.x/R),0,I-1)}}function jg(q,R,F,I,U,X,oe,me){me===void 0&&(me=2);for(var Se=I.shape,Me=Se[0],Te=Se[1],tt=function(In,Ln,qn){var Cn=qn.shape[2]/2;return{y:qn.get(Ln.y,Ln.x,In),x:qn.get(Ln.y,Ln.x,Cn+In)}}(q,Pg(R.position,X,Me,Te),oe),at=Tm(R.position,tt),jt=0;jt<me;jt++){var $t=Pg(at,X,Me,Te),vn=xp($t.y,$t.x,F,U);at=Tm({x:$t.x*X,y:$t.y*X},{x:vn.x,y:vn.y})}var wn=Pg(at,X,Me,Te),Nn=I.get(wn.y,wn.x,F);return{position:at,part:yp[F],score:Nn}}function I0(q,R,F,I,U,X){var oe=R.shape[2],me=_l.length,Se=new Array(oe),Me=q.part,Te=q.score,tt=N0(Me,I,F);Se[Me.id]={score:Te,part:yp[Me.id],position:tt};for(var at=me-1;at>=0;--at){var jt=_l[at],$t=Nm[at];Se[jt]&&!Se[$t]&&(Se[$t]=jg(at,Se[jt],$t,R,F,I,X))}for(at=0;at<me;++at)jt=Nm[at],$t=_l[at],Se[jt]&&!Se[$t]&&(Se[$t]=jg(at,Se[jt],$t,R,F,I,U));return Se}function M0(q,R,F,I){var U=F.x,X=F.y;return q.some(function(oe){var me=oe.keypoints[I].position;return function(Se,Me,Te,tt){var at=Te-Se,jt=tt-Me;return at*at+jt*jt}(X,U,me.y,me.x)<=R})}function yf(q,R,F){return F.reduce(function(I,U,X){var oe=U.position,me=U.score;return M0(q,R,oe,X)||(I+=me),I},0)/F.length}var As=1;function wp(q,R,F,I,U,X,oe,me){oe===void 0&&(oe=.5),me===void 0&&(me=20);for(var Se=[],Me=function($t,vn,wn){for(var Nn=wn.shape,In=Nn[0],Ln=Nn[1],qn=Nn[2],Cn=new id(In*Ln*qn,function(zr){return zr.score}),wr=0;wr<In;++wr)for(var Fr=0;Fr<Ln;++Fr)for(var Rr=0;Rr<qn;++Rr){var Xr=wn.get(wr,Fr,Rr);Xr<$t||Dm(Rr,Xr,wr,Fr,vn,wn)&&Cn.enqueue({score:Xr,part:{heatmapY:wr,heatmapX:Fr,id:Rr}})}return Cn}(oe,As,q),Te=me*me;Se.length<X&&!Me.empty();){var tt=Me.dequeue();if(!M0(Se,Te,N0(tt.part,U,R),tt.part.id)){var at=I0(tt,q,R,U,F,I),jt=yf(Se,Te,at);Se.push({keypoints:at,score:jt})}}return Se}function et(q){var R=q.shape,F=R[0],I=R[1],U=R[2];return Object(Ke.tidy)(function(){var X=Object(Ke.reshape)(q,[F*I,U]),oe=Object(Ke.argMax)(X,0),me=Object(Ke.expandDims)(Object(Ke.div)(oe,Object(Ke.scalar)(I,"int32")),1),Se=Object(Ke.expandDims)(function(Me,Te){return Object(Ke.tidy)(function(){var tt=Object(Ke.div)(Me,Object(Ke.scalar)(Te,"int32"));return Object(Ke.sub)(Me,Object(Ke.mul)(tt,Object(Ke.scalar)(Te,"int32")))})}(oe,I),1);return Object(Ke.concat)([me,Se],1)})}function Zc(q,R,F,I){return{y:I.get(q,R,F),x:I.get(q,R,F+bp)}}function uh(q,R,F){return Object(Ke.tidy)(function(){var I=function(U,X){for(var oe=[],me=0;me<bp;me++){var Se=Zc(U.get(me,0).valueOf(),U.get(me,1).valueOf(),me,X),Me=Se.x,Te=Se.y;oe.push(Te),oe.push(Me)}return Object(Ke.tensor2d)(oe,[bp,2])}(q,F);return Object(Ke.add)(Object(Ke.cast)(Object(Ke.mul)(q.toTensor(),Object(Ke.scalar)(R,"int32")),"float32"),I)})}function Im(q,R,F){return gr(this,void 0,void 0,function(){var I,U,X,oe,me,Se,Me,Te,tt,at;return Nc(this,function(jt){switch(jt.label){case 0:return I=0,U=et(q),[4,Promise.all([q.buffer(),R.buffer(),U.buffer()])];case 1:return X=jt.sent(),oe=X[0],me=X[1],Se=X[2],[4,(Me=uh(Se,F,me)).buffer()];case 2:return Te=jt.sent(),tt=Array.from(function($t,vn){for(var wn=vn.shape[0],Nn=new Float32Array(wn),In=0;In<wn;In++){var Ln=vn.get(In,0),qn=vn.get(In,1);Nn[In]=$t.get(Ln,qn,In)}return Nn}(oe,Se)),at=tt.map(function($t,vn){return I+=$t,{position:{y:Te.get(vn,0),x:Te.get(vn,1)},part:yp[vn],score:$t}}),U.dispose(),Me.dispose(),[2,{keypoints:at,score:I/at.length}]}})})}var ra="https://storage.googleapis.com/tfjs-models/savedmodel/posenet/mobilenet/",ia="https://storage.googleapis.com/tfjs-models/savedmodel/posenet/resnet50/",Aa=[-123.15,-115.9,-103.06],fs=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return vu(R,q),R.prototype.preprocessInput=function(F){return Object(Ke.add)(F,Aa)},R.prototype.nameOutputResults=function(F){var I=F[0],U=F[1];return{offsets:F[2],heatmap:F[3],displacementFwd:I,displacementBwd:U}},R}(Rg);function Ic(q,R){return Bt(q,R)?q:Math.floor(q/R)*R+1}function ds(q){Ke.util.assert(typeof q=="number"||typeof q=="object",function(){return"Invalid inputResolution "+q+". Should be a number or an object with width and height"}),typeof q=="object"&&(Ke.util.assert(typeof q.width=="number",function(){return"inputResolution.width has a value of "+q.width+" which is invali
8227d; it must be a number"}),Ke.util.assert(typeof q.height=="number",function(){return"inputResolution.height has a value of "+q.height+" which is invalid; it must be a number"}))}function Hl(q,R){return ds(q),typeof q=="object"?[Ic(q.height,R),Ic(q.width,R)]:[Ic(q,R),Ic(q,R)]}var sc=[8,16,32];function Bt(q,R){return(q-1)%R==0}function zo(q){return q instanceof Ke.Tensor?[q.shape[0],q.shape[1]]:[q.height,q.width]}function qa(q,R){var F=R[0],I=R[1],U=zo(q),X=U[0],oe=U[1],me=I/F,Se=[0,0,0,0],Me=Se[0],Te=Se[1],tt=Se[2],at=Se[3];return oe/X<me?(Me=0,Te=0,tt=Math.round(.5*(me*X-oe)),at=Math.round(.5*(me*X-oe))):(Me=Math.round(.5*(1/me*oe-X)),Te=Math.round(.5*(1/me*oe-X)),tt=0,at=0),{resized:Object(Ke.tidy)(function(){var jt=function($t){return $t instanceof Ke.Tensor?$t:Ke.browser.fromPixels($t)}(q);return jt=Object(Ke.pad3d)(jt,[[Me,Te],[tt,at],[0,0]]),Ke.image.resizeBilinear(jt,[F,I])}),padding:{top:Me,left:tt,right:at,bottom:Te}}}function Os(q,R,F,I,U){var X=R[0],oe=R[1],me=F[0],Se=F[1],Me=function(Te,tt,at,jt,$t){return jt===void 0&&(jt=0),$t===void 0&&($t=0),at===1&&tt===1&&jt===0&&$t===0?Te:Te.map(function(vn){return function(wn,Nn,In,Ln,qn){return Ln===void 0&&(Ln=0),qn===void 0&&(qn=0),{score:wn.score,keypoints:wn.keypoints.map(function(Cn){var wr=Cn.score,Fr=Cn.part,Rr=Cn.position;return{score:wr,part:Fr,position:{x:Rr.x*In+qn,y:Rr.y*Nn+Ln}}})}}(vn,tt,at,jt,$t)})}(q,(X+I.top+I.bottom)/me,(oe+I.left+I.right)/Se,-I.top,-I.left);return U?function(Te,tt){return tt<=0?Te:Te.map(function(at){return function(jt,$t){return{score:jt.score,keypoints:jt.keypoints.map(function(vn){var wn=vn.score,Nn=vn.part,In=vn.position;return{score:wn,part:Nn,position:{x:$t-1-In.x,y:In.y}}})}}(at,tt)})}(Me,oe):Me}var Qo={architecture:"MobileNetV1",outputStride:16,multiplier:.75,inputResolution:257},bu=["MobileNetV1","ResNet50"],Or={MobileNetV1:[8,16,32],ResNet50:[32,16]},Vu={MobileNetV1:[.5,.75,1],ResNet50:[1]},uc=[1,2,4],bf={flipHorizontal:!1},$u={flipHorizontal:!1,maxDetections:5,scoreThreshold:.5,nmsRadius:20},_p=function(){function q(R,F){(function(I){Ke.util.assert(typeof I=="number",function(){return"outputStride is not a number"}),Ke.util.assert(sc.indexOf(I)>=0,function(){return"outputStride of "+I+" is invalid. It must be either 8, 16, or 32"})})(R.outputStride),function(I,U){Ke.util.assert(typeof I[0]=="number"&&typeof I[1]=="number",function(){return"both resolution values must be a number but had values "+I}),Ke.util.assert(Bt(I[0],U),function(){return"height of "+I[0]+" is invalid for output stride "+U+"."}),Ke.util.assert(Bt(I[1],U),function(){return"width of "+I[1]+" is invalid for output stride "+U+"."})}(F,R.outputStride),this.baseModel=R,this.inputResolution=F}return q.prototype.estimateMultiplePoses=function(R,F){return F===void 0&&(F=$u),gr(this,void 0,void 0,function(){var I,U,X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn,In,Ln,qn,Cn,wr,Fr;return Nc(this,function(Rr){switch(Rr.label){case 0:return I=oh({},$u,F),function(Xr){var zr=Xr.maxDetections,Ti=Xr.scoreThreshold,Wi=Xr.nmsRadius;if(zr<=0)throw new Error("Invalid maxDetections "+zr+". Should be > 0");if(Ti<0||Ti>1)throw new Error("Invalid scoreThreshold "+Ti+". Should be in range [0.0, 1.0]");if(Wi<=0)throw new Error("Invalid nmsRadius "+Wi+".")}(F),U=this.baseModel.outputStride,X=this.inputResolution,oe=zo(R),me=oe[0],Se=oe[1],Me=qa(R,X),Te=Me.resized,tt=Me.padding,at=this.baseModel.predict(Te),jt=at.heatmapScores,$t=at.offsets,vn=at.displacementFwd,wn=at.displacementBwd,[4,function(Xr){return gr(this,void 0,void 0,function(){return Nc(this,function(zr){return[2,Promise.all(Xr.map(function(Ti){return Ti.buffer()}))]})})}([jt,$t,vn,wn])];case 1:return Nn=Rr.sent(),In=Nn[0],Ln=Nn[1],qn=Nn[2],Cn=Nn[3],[4,wp(In,Ln,qn,Cn,U,I.maxDetections,I.scoreThreshold,I.nmsRadius)];case 2:return wr=Rr.sent(),Fr=Os(wr,[me,Se],X,tt,I.flipHorizontal),jt.dispose(),$t.dispose(),vn.dispose(),wn.dispose(),Te.dispose(),[2,Fr]}})})},q.prototype.estimateSinglePose=function(R,F){return F===void 0&&(F=bf),gr(this,void 0,void 0,function(){var I,U,X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn,In;return Nc(this,function(Ln){switch(Ln.label){case 0:return I=oh({},bf,F),U=this.baseModel.outputStride,X=this.inputResolution,oe=zo(R),me=oe[0],Se=oe[1],Me=qa(R,X),Te=Me.resized,tt=Me.padding,at=this.baseModel.predict(Te),jt=at.heatmapScores,$t=at.offsets,vn=at.displacementFwd,wn=at.displacementBwd,[4,Im(jt,$t,U)];case 1:return Nn=Ln.sent(),In=Os([Nn],[me,Se],X,tt,I.flipHorizontal),jt.dispose(),$t.dispose(),vn.dispose(),wn.dispose(),Te.dispose(),[2,In[0]]}})})},q.prototype.estimatePoses=function(R,F){return gr(this,void 0,void 0,function(){return Nc(this,function(I){switch(I.label){case 0:return F.decodingMethod!=="single-person"?[3,2]:[4,this.estimateSinglePose(R,F)];case 1:return[2,[I.sent()]];case 2:return[2,this.estimateMultiplePoses(R,F)]}})})},q.prototype.dispose=function(){this.baseModel.dispose()},q}();function Mm(q){return gr(this,void 0,void 0,function(){var R,F,I,U,X,oe,me;return Nc(this,function(Se){switch(Se.label){case 0:if(R=q.outputStride,F=q.quantBytes,I=q.multiplier,Ke==null)throw new Error(`Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this 8228 model.`);return U=function(Me,Te,tt){var at={1:"100",.75:"075",.5:"050"},jt="model-stride"+Me+".json";return tt===4?ra+"float/"+at[Te]+"/"+jt:ra+"quant"+tt+"/"+at[Te]+"/"+jt}(R,I,F),[4,Object(Mt.loadGraphModel)(q.modelUrl||U)];case 1:return X=Se.sent(),oe=new Bg(X,R),me=Hl(q.inputResolution,oe.outputStride),[2,new _p(oe,me)]}})})}function Fm(q){return gr(this,void 0,void 0,function(){var R,F,I,U,X,oe;return Nc(this,function(me){switch(me.label){case 0:if(R=q.outputStride,F=q.quantBytes,Ke==null)throw new Error(`Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this 8229 model.`);return I=function(Se,Me){var Te="model-stride"+Se+".json";return Me===4?ia+"float/"+Te:ia+"quant"+Me+"/"+Te}(R,F),[4,Object(Mt.loadGraphModel)(q.modelUrl||I)];case 1:return U=me.sent(),X=new fs(U,R),oe=Hl(q.inputResolution,X.outputStride),[2,new _p(X,oe)]}})})}function yc(q){return q===void 0&&(q=Qo),gr(this,void 0,void 0,function(){return Nc(this,function(R){return(q=function(F){if((F=F||Qo).architecture==null&&(F.architecture="MobileNetV1"),bu.indexOf(F.ar
8229chitecture)<0)throw new Error("Invalid architecture "+F.architecture+". Should be one of "+bu);if(F.inputResolution==null&&(F.inputResolution=257),ds(F.inputResolution),F.outputStride==null&&(F.outputStride=16),Or[F.architecture].indexOf(F.outputStride)<0)throw new Error("Invalid outputStride "+F.outputStride+". Should be one of "+Or[F.architecture]+" for architecture "+F.architecture+".");if(F.multiplier==null&&(F.multiplier=1),Vu[F.architecture].indexOf(F.multiplier)<0)throw new Error("Invalid multiplier "+F.multiplier+". Should be one of "+Vu[F.architecture]+" for architecture "+F.architecture+".");if(F.quantBytes==null&&(F.quantBytes=4),uc.indexOf(F.quantBytes)<0)throw new Error("Invalid quantBytes "+F.quantBytes+". Should be one of "+uc+" for architecture "+F.architecture+".");if(F.architecture==="MobileNetV1"&&F.outputStride===32&&F.multiplier!==1)throw new Error("When using an output stride of 32, you must select 1 as the multiplier.");return F}(q)).architecture==="ResNet50"?[2,Fm(q)]:q.architecture==="MobileNetV1"?[2,Mm(q)]:[2,null]})})}function go(q){var R=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var F,I=Qs()(q);if(R){var U=Qs()(this).constructor;F=Reflect.construct(I,arguments,U)}else F=I.apply(this,arguments);return Vl()(this,F)}}var xu={architecture:"MobileNetV1",outputStride:16,flipHorizontal:!1,minConfidence:.5,maxPoseDetections:5,scoreThreshold:.5,nmsRadius:20,detectionType:"multiple",inputResolution:256,multiplier:.75,quantBytes:2,modelUrl:null},kp=function(q){Wl()(F,q);var R=go(F);function F(I,U,X,oe){var me;return ce()(this,F),(me=R.call(this)).video=I,me.modelUrl=U.modelUrl||null,me.architecture=U.architecture||xu.architecture,me.detectionType=X||U.detectionType||xu.detectionType,me.outputStride=U.outputStride||xu.outputStride,me.flipHorizontal=U.flipHorizontal||xu.flipHorizontal,me.scoreThreshold=U.scoreThreshold||xu.scoreThreshold,me.minConfidence=U.minConfidence||xu.minConfidence,me.maxPoseDetections=U.maxPoseDetections||xu.maxPoseDetections,me.multiplier=U.multiplier||xu.multiplier,me.inputResolution=U.inputResolution||xu.inputResolution,me.quantBytes=U.quantBytes||xu.quantBytes,me.nmsRadius=U.nmsRadius||xu.nmsRadius,me.ready=$e(me.load(),oe),me}return ke()(F,[{key:"load",value:function(){var I=K()(be.a.mark(function U(){var X,oe=this;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return X=this.architecture.toLowerCase()==="mobilenetv1"?{architecture:this.architecture,outputStride:this.outputStride,inputResolution:this.inputResolution,multiplier:this.multiplier,quantBytes:this.quantBytes,modelUrl:this.modelUrl}:{architecture:this.architecture,outputStride:this.outputStride,inputResolution:this.inputResolution,quantBytes:this.quantBytes},me.next=3,yc(X);case 3:if(this.net=me.sent,!this.video){me.next=9;break}if(this.video.readyState!==0){me.next=8;break}return me.next=8,new Promise(function(Se){oe.video.onloadeddata=function(){return Se()}});case 8:this.detectionType==="single"?this.singlePose():this.multiPose();case 9:return me.abrupt("return",this);case 10:case"end":return me.stop()}},U,this)}));return function(){return I.apply(this,arguments)}}()},{key:"skeleton",value:function(I){return function(U,X){return ca.reduce(function(oe,me){var Se=me[0],Me=me[1];return function(Te,tt,at){return Te<at||tt<at}(U[Se].score,U[Me].score,X)||oe.push([U[Se],U[Me]]),oe},[])}(I,arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.minConfidence)}},{key:"mapParts",value:function(I){var U=JSON.parse(JSON.stringify(I));return U.keypoints.forEach(function(X){U[X.part]={x:X.position.x,y:X.position.y,confidence:X.score}}),U}},{key:"getInput",value:function(I){return I instanceof HTMLImageElement||I instanceof HTMLVideoElement||I instanceof HTMLCanvasElement||I instanceof ImageData?I:Ee()(I)==="object"&&(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLVideoElement||I.elt instanceof ImageData)?I.elt:Ee()(I)==="object"&&I.canvas instanceof HTMLCanvasElement?I.canvas:this.video}},{key:"singlePose",value:function(){var I=K()(be.a.mark(function U(X,oe){var me,Se,Me,Te,tt=this;return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return me=this.getInput(X),at.next=3,this.net.estimateSinglePose(me,{flipHorizontal:this.flipHorizontal});case 3:if(Se=at.sent,Me=this.mapParts(Se),Te=[{pose:Me,skeleton:this.skeleton(Se.ke
8229ypoints)}],this.emit("pose",Te),!this.video){at.next=9;break}return at.abrupt("return",N.nextFrame().then(function(){return tt.singlePose()}));case 9:return typeof oe=="function"&&oe(Te),at.abrupt("return",Te);case 11:case"end":return at.stop()}},U,this)}));return function(U,X){return I.apply(this,arguments)}}()},{key:"multiPose",value:function(){var I=K()(be.a.mark(function U(X,oe){var me,Se,Me,Te,tt=this;return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return me=this.getInput(X),at.next=3,this.net.estimateMultiplePoses(me,{flipHorizontal:this.flipHorizontal,maxDetections:this.maxPoseDetections,scoreThreshold:this.scoreThreshold,nmsRadius:this.nmsRadius});case 3:if(Se=at.sent,Me=Se.map(function(jt){return tt.mapParts(jt)}),Te=Me.map(function(jt){return{pose:jt,skeleton:tt.skeleton(jt.keypoints)}}),this.emit("pose",Te),!this.video){at.next=9;break}return at.abrupt("return",N.nextFrame().then(function(){return tt.multiPose()}));case 9:return typeof oe=="function"&&oe(Te),at.abrupt("return",Te);case 11:case"end":return at.stop()}},U,this)}));return function(U,X){return I.apply(this,arguments)}}()}]),F}(rh.a),kl=function(q,R,F){var I,U={},X=F,oe=null;return q instanceof HTMLVideoElement?I=q:Ee()(q)==="object"&&q.elt instanceof HTMLVideoElement?I=q.elt:Ee()(q)==="object"?U=q:typeof q=="function"&&(X=q),Ee()(R)==="object"?U=R:typeof R=="string"&&(oe=R),typeof R=="function"&&(X=R),new kp(I,U,oe,X)},eu=function(){function q(R){ce()(this,q),this.urlPath=R.endsWith("/")?R:"".concat(R,"/"),this.variables={}}return ke()(q,[{key:"loadManifest",value:function(){var R=K()(be.a.mark(function F(){var I;return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return U.prev=0,U.next=3,zt.a.get(this.urlPath+"manifest.json");case 3:return I=U.sent,U.abrupt("return",I.data);case 7:throw U.prev=7,U.t0=U.catch(0),new Error("".concat("manifest.json"," not found at ").concat(this.urlPath,". ").concat(U.t0));case 10:case"end":return U.stop()}},F,this,[[0,7]])}));return function(){return R.apply(this,arguments)}}()},{key:"loadVariable",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me,Te;return be.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:return tt.next=2,this.getCheckpointManifest();case 2:if(U=tt.sent,I in U){tt.next=5;break}throw new Error("Cannot load non-existent variable ".concat(I));case 5:return X=U[I],oe=X.filename,me=X.shape,Se=this.urlPath+oe,tt.prev=7,tt.next=10,zt.a.get(Se,{responseType:"arraybuffer"});case 10:return Me=tt.sent,Te=new Float32Array(Me.data),tt.abrupt("return",N.tensor(Te,me));case 15:throw tt.prev=15,tt.t0=tt.catch(7),new Error("Error loading variable ".concat(I," from URL ").concat(Se,": ").concat(tt.t0));case 18:case"end":return tt.stop()}},F,this,[[7,15]])}));return function(F){return R.apply(this,arguments)}}()},{key:"getCheckpointManifest",value:function(){var R=K()(be.a.mark(function F(){return be.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:if(this.checkpointManifest){I.next=4;break}return I.next=3,this.loadManifest();case 3:this.checkpointManifest=I.sent;case 4:return I.abrupt("return",this.checkpointManifest);case 5:case"end":return I.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"getKeys",value:function(){var R=K()(be.a.mark(function F(){var I;return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return U.next=2,this.getCheckpointManifest();case 2:return I=U.sent,U.abrupt("return",Object.keys(I));case 4:case"end":return U.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"getAllVariables",value:function(){var R=K()(be.a.mark(function F(){var I,U,X=this;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.next=2,this.getKeys();case 2:return I=oe.sent,U=I.map(function(me){return X.getVariable(me)}),oe.next=6,Promise.all(U);case 6:return oe.abrupt("return",this.variables);case 7:case"end":return oe.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"getVariable",value:function(){var R=K()(be.a.mark(function F(I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:if(this.variables[I]){U.next=4;break}return U.next=3,this.loadVariable(I);case 3:this.variables[I]=U.sent;case 4:return U.abrupt("return",this.variables[I]);case 5:case"end":return U.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()}]),q}();function Ei(q){var R=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var F,I=Qs()(q);if(R){var U=Qs()(this).constructor;F=Reflect.construct(I,arguments,U)}else F=I.apply(this,arguments);return Vl()(this,F)}}var va=200,Ep=function(q){return new Promise(function(R){var F=new Image(va,va);F.onload=function(){return R(F)},F.src=q.toDataURL()})},Rm=function(q){Wl()(F,q);var R=Ei(F);function F(I,U,X){var oe;return ce()(this,F),(oe=R.call(this,U,va)).ready=!1,oe.variableDictionary={},oe.timesScalar=N.scalar(150),oe.plusScalar=N.scalar(127.5),oe.epsilonScalar=N.scalar(.001),oe.video=null,oe.ready=$e(oe.load(I),X),oe}return ke()(F,[{key:"load",value:function(){var I=K()(be.a.mark(function U(X){return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:if(!this.videoElt){oe.next=3;break}return oe.next=3,this.loadVideo();case 3:return oe.next=5,this.loadCheckpoints(X);case 5:return oe.abrupt("return",this);case 6:case"end":return oe.stop()}},U,this)}));return function(U){return I.apply(this,arguments)}}()},{key:"loadCheckpoints",value:function(){var I=K()(be.a.mark(function U(X){var oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return oe=new eu(X),me.next=3,oe.getAllVariables();case 3:this.variables=me.sent;case 4:case"end":return me.stop()}},U,this)}));return function(U){return I.apply(this,arguments)}}()},{key:"instanceNorm",value:function(I,U){var X=this;return N.tidy(function(){var oe=on()(I.shape,3),me=oe[0],Se=oe[1],Me=oe[2],Te=N.moments(I,[0,1]),tt=Te.mean,at=Te.variance,jt=X.variables[F.getVariableName(U)],$t=X.variables[F.getVariableName(U+1)],vn=X.epsilonScalar,wn=N.div(N.sub(I.asType("float32"),tt),N.sqrt(N.add(at,vn)));return N.add(N.mul($t,wn),jt).as3D(me,Se,Me)})}},{key:"convLayer",value:function(I,U,X,oe){var me=N.conv2d(I,this.variables[F.getVariableName(oe)],[U,U],"same"),Se=this.instanceNorm(me,oe+1);return X?N.relu(Se):Se}},{key:"residualBlock",value:function(I,U){var X=this.convLayer(I,1,!0,U),oe=this.convLayer(X,1,!1,U+3);return N.add(oe,I)}},{key:"convTransposeLayer",value:function(I,U,X,oe){var me=on()(I.shape,2),Se=[me[0]*X,me[1]*X,U],Me=N.conv2dTranspose(I,this.variables[F.getVariableName(oe)],Se,[X,X],"same"),Te=this.instanceNorm(Me,oe+1);return N.relu(Te)}},{key:"transfer",value:function(){var I=K()(be.a.mark(function U(X,oe){var me,Se;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(Se=oe,!(X instanceof HTMLVideoElement||X instanceof HTMLImageElement||X instanceof ImageData)){Me.next=5;break}me=X,Me.next=18;break;case 5:if(!(X instanceof HTMLCanvasElement)){Me.next=11;break}return Me.next=8,Ep(X);case 8:me=Me.sent,Me.next=18;break;case 11:if(!(Ee()(X)==="object"&&X.elt instanceof HTMLCanvasElement)){Me.next=17;break}return Me.next=14,Ep(X.elt);case 14:me=Me.sent,Me.next=18;break;case 17:Ee()(X)==="object"&&(X.elt instanceof HTMLVideoElement||X.elt instanceof HTMLImageElement||X.elt instanceof ImageData)?me=X.elt:typeof X=="function"&&(me=this.video,Se=X);case 18:return Me.abrupt("return",$e(this.transferInternal(me),Se));case 19:case"end":return Me.stop()}},U,this)}));return function(U,X){return I.apply(this,arguments)}}()},{key:"transferInternal",value:function(){var I=K()(be.a.mark(function U(X){var oe,me,Se=this;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return oe=N.browser.fromPixels(X),me=hn(N.tidy(function(){var Te=Se.convLayer(oe,1,!0,0),tt=Se.convLayer(Te,2,!0,3),at=Se.convLayer(tt,2,!0,6),jt=Se.residualBlock(at,9),$t=Se.residualBlock(jt,15),vn=Se.residualBlock($t,21),wn=Se.residualBlock(vn,27),Nn=Se.residualBlock(wn,33),In=Se.convTransposeLayer(Nn,64,2,39),Ln=Se.convTransposeLayer(In,32,2,42),qn=Se.convLayer(Ln,1,!1,45),Cn=N.tanh(qn),wr=N.mul(Se.timesScalar,Cn),Fr=N.add(Se.plusScalar,wr),Rr=N.clipByValue(Fr,0,255);return N.div(Rr,N.scalar(255))})),oe.dispose(),Me.next=5,N.nextFrame();case 5:return Me.abrupt("return",me);case 6:case"end":return Me.stop()}},U)}));return function(U){return I.apply(this,arguments)}}()}],[{key:"getVariableName",value:function(I){return I===0?"Variable":"Variable_".concat(I
8229)}}]),F}(Kr),od=function(q,R,F){var I=F;typeof R=="function"&&(I=R);var U=new Rm(q,R,I);return I?U:U.ready},Cp=function(q){for(var R,F=Math.random(),I=0,U=0;U<q.length;U+=1)if(F<(I+=q[U])){R=U;break}return R},to=/cell_[0-9]|lstm_[0-9]/gi,Li=/weights|weight|kernel|kernels|w/gi,za=/softmax/gi,Bm=function(){function q(R,F){ce()(this,q),this.ready=!1,this.model={},this.cellsAmount=0,this.cells=[],this.zeroState={c:[],h:[]},this.state={c:[],h:[]},this.vocab={},this.vocabSize=0,this.probabilities=[],this.defaults={seed:"a",length:20,temperature:.5,stateful:!1},this.ready=$e(this.loadCheckpoints(R),F)}return ke()(q,[{key:"resetState",value:function(){this.state=this.zeroState}},{key:"setState",value:function(R){this.state=R}},{key:"getState",value:function(){return this.state}},{key:"loadCheckpoints",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe=this;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return U=new eu(I),me.next=3,U.getAllVariables();case 3:return X=me.sent,Object.keys(X).forEach(function(Se){Se.match(to)?Se.match(Li)?(oe.model["Kernel_".concat(Se.match(/[0-9]/)[0])]=X[Se],oe.cellsAmount+=1):oe.model["Bias_".concat(Se.match(/[0-9]/)[0])]=X[Se]:Se.match(za)?Se.match(Li)?oe.model.fullyConnectedWeights=X[Se]:oe.model.fullyConnectedBiases=X[Se]:oe.model[Se]=X[Se]}),me.next=7,this.loadVocab(I);case 7:return me.next=9,this.initCells();case 9:return me.abrupt("return",this);case 10:case"end":return me.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"loadVocab",value:function(){var R=K()(be.a.mark(function F(I){var U,X;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.prev=0,oe.next=3,zt.a.get("".concat(I,"/vocab.json"));case 3:return U=oe.sent,X=U.data,this.vocab=X,this.vocabSize=Object.keys(X).length,oe.abrupt("return",this.vocab);case 10:return oe.prev=10,oe.t0=oe.catch(0),oe.abrupt("return",oe.t0);case 13:case"end":return oe.stop()}},F,this,[[0,10]])}));return function(F){return R.apply(this,arguments)}}()},{key:"initCells",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe=this;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:for(this.cells=[],this.zeroState={c:[],h:[]},I=N.tensor(1),U=function(Se){return function(Me,Te,tt){return N.basicLSTMCell(I,oe.model["Kernel_".concat(Se)],oe.model["Bias_".concat(Se)],Me,Te,tt)}},X=0;X<this.cellsAmount;X+=1)this.zeroState.c.push(N.zeros([1,this.model["Bias_".concat(X)].shape[0]/4])),this.zeroState.h.push(N.zeros([1,this.model["Bias_".concat(X)].shape[0]/4])),this.cells.push(U(X));this.state=this.zeroState;case 6:case"end":return me.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"generateInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn,In,Ln,qn,Cn,wr,Fr=this;return be.a.wrap(function(Rr){for(;;)switch(Rr.prev=Rr.next){case 0:return Rr.next=2,this.ready;case 2:U=I.seed||this.defaults.seed,X=+I.length||this.defaults.length,oe=+I.temperature||this.defaults.temperature,I.stateful||this.defaults.stateful||(this.state=this.zeroState),me=[],Se=Array.from(U),Me=[],Se.forEach(function(Xr){Me.push(Fr.vocab[Xr])}),Te=Me[0],tt=[],at=0;case 14:if(!(at<Se.length+X+-1)){Rr.next=36;break}return Rr.next=17,N.buffer([1,this.vocabSize]);case 17:return(jt=Rr.sent).set(1,0,Te),$t=jt.toTensor(),vn=void 0,this.model.embedding?(wn=N.matMul($t,this.model.embedding),vn=N.multiRNNCell(this.cells,wn,this.state.c,this.state.h)):vn=N.multiRNNCell(this.cells,$t,this.state.c,this.state.h),this.state.c=vn[0],this.state.h=vn[1],Nn=this.state.h[1],In=N.matMul(Nn,this.model.fullyConnectedWeights),Ln=N.add(In,this.model.fullyConnectedBiases),qn=N.div(Ln,N.tensor(oe)),Cn=N.exp(qn),Rr.next=31,N.div(Cn,N.sum(Cn)).data();case 31:tt=Rr.sent,at<Se.length-1?Te=Me[at+1]:(Te=Cp(tt),me.push(Te));case 33:at+=1,Rr.next=14;break;case 36:return wr="",me.forEach(function(Xr){var zr=Object.keys(Fr.vocab).find(function(Ti){return Fr.vocab[Ti]===Xr});zr&&(wr+=zr)}),this.probabilities=tt,Rr.abrupt("return",{sample:wr,state:this.state});case 40:case"end":return Rr.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"reset",value:function(){this.state=this.zeroState}},{key:"generate",value:function(){var R=K()(be.a.mark(function F(I,U){return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return this.reset(),X.abrupt("return",$e(this.generateInternal(I),U));case 2:case"end":return X.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"predict",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se,Me,Te,tt,at,jt,$t,vn=this;return be.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:return X=[],oe=I>0?I:.1,me=this.state.h[1],Se=N.matMul(me,this.model.fullyConnectedWeights),Me=N.add(Se,this.model.fullyConnectedBiases),Te=N.div(Me,N.tensor(oe)),tt=N.exp(Te),wn.next=9,N.div(tt,N.sum(tt)).data();case 9:return X=wn.sent,at=Cp(X),jt=Object.keys(this.vocab).find(function(Nn){return vn.vocab[Nn]===at}),this.probabilities=X,U&&U(jt),$t=Object.keys(this.vocab).map(function(Nn){return{char:Nn,probability:vn.probabilities[vn.vocab[Nn]]}}),wn.abrupt("return",{sample:jt,probabilities:$t});case 16:case"end":return wn.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"feed",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se,Me,Te,tt,at,jt=this;return be.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:return $t.next=2,this.ready;
8229case 2:X=Array.from(I),oe=[],X.forEach(function(vn){oe.push(jt.vocab[vn])}),me=oe[0],Se=0;case 7:if(!(Se<X.length)){$t.next=21;break}return $t.next=10,N.buffer([1,this.vocabSize]);case 10:(Me=$t.sent).set(1,0,me),Te=Me.toTensor(),tt=void 0,this.model.embedding?(at=N.matMul(Te,this.model.embedding),tt=N.multiRNNCell(this.cells,at,this.state.c,this.state.h)):tt=N.multiRNNCell(this.cells,Te,this.state.c,this.state.h),this.state.c=tt[0],this.state.h=tt[1],me=oe[Se];case 18:Se+=1,$t.next=7;break;case 21:U&&U();case 22:case"end":return $t.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()}]),q}(),Pm=function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"./",R=arguments.length>1?arguments[1]:void 0;return new Bm(q,R)},jm=function(){function q(R){ce()(this,q),this.urlPath=R}return ke()(q,[{key:"getAllVariables",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me,Se,Me,Te,tt,at;return be.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return jt.next=2,zt.a.get(this.urlPath,{responseType:"arraybuffer"}).catch(function($t){throw new Error("No model found. Failed with error ".concat($t))});case 2:for(I=jt.sent,U=I.data,X=[],oe=0;oe<U.byteLength;)me=new Uint8Array(U.slice(oe,oe+4)),oe+=4,Se=(me[0]<<24)+(me[1]<<16)+(me[2]<<8)+me[3],X.push(U.slice(oe,oe+Se)),oe+=Se;return Me=JSON.parse(new TextDecoder("utf8").decode(X[0])),Te=new Float32Array(X[1]),tt=new Uint8Array(X[2]),at={},oe=0,Me.forEach(function($t){var vn=$t.shape,wn=$t.name,Nn=vn.reduce(function(qn,Cn){return qn*Cn}),In=tt.slice(oe,oe+Nn),Ln=new Float32Array(In.length);In.forEach(function(qn,Cn){Ln[Cn]=Te[qn]}),at[wn]=N.tensor(Ln,vn,"float32"),oe+=Nn}),jt.abrupt("return",at);case 14:case"end":return jt.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()}]),q}(),Lg=function(){function q(R,F){ce()(this,q),this.ready=$e(this.loadCheckpoints(R),F)}return ke()(q,[{key:"loadCheckpoints",value:function(){var R=K()(be.a.mark(function F(I){var U;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return U=new jm(I),X.next=3,U.getAllVariables();case 3:return this.variables=X.sent,X.abrupt("return",this);case 5:case"end":return X.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"transfer",value:function(){var R=K()(be.a.mark(function F(I,U){return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.abrupt("return",$e(this.transferInternal(I),U));case 1:case"end":return X.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"transferInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X=this;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return U=hn(N.tidy(function(){var me=N.browser.fromPixels(I),Se=me.dataSync(),Me=N.tensor3d(Se,me.shape),Te=N.div(Me,N.scalar(255)),tt=q.preprocess(Te),at=[],jt=X.variables["generator/encoder_1/conv2d/kernel"],$t=X.variables["generator/encoder_1/conv2d/bias"],vn=q.conv2d(tt,jt,$t);at.push(vn);for(var wn=2;wn<=8;wn+=1){var Nn="generator/encoder_".concat(wn.toString());jt=X.variables["".concat(Nn,"/conv2d/kernel")];var In=X.variables["".concat(Nn,"/conv2d/bias")],Ln=at[at.length-1],qn=N.leakyRelu(Ln,.2);vn=q.conv2d(qn,jt,In);var Cn=X.variables["".concat(Nn,"/batch_normalization/gamma")],wr=X.variables["".concat(Nn,"/batch_normalization/beta")],Fr=q.batchnorm(vn,Cn,wr);at.push(Fr)}for(var Rr=8;Rr>=2;Rr-=1){var Xr=void 0;if(Rr===8)Xr=at[at.length-1];else{var zr=Rr-1;Xr=N.concat([at[at.length-1],at[zr]],2)}var Ti=N.relu(Xr),Wi="generator/decoder_".concat(Rr.toString());jt=X.variables["".concat(Wi,"/conv2d_transpose/kernel")],$t=X.variables["".concat(Wi,"/conv2d_transpose/bias")],vn=q.deconv2d(Ti,jt,$t);var zi=X.variables["".concat(Wi,"/batch_normalization/gamma")],Xo=X.variables["".concat(Wi,"/batch_normalization/beta")],wa=q.batchnorm(vn,zi,Xo);at.push(wa)}var ua=N.concat([at[at.length-1],at[0]],2),oa=N.relu(ua);jt=X.variables["generator/decoder_1/conv2d_transpose/kernel"];var ha=X.variables["generator/decoder_1/conv2d_transpose/bias"];vn=q.deconv2d(oa,jt,ha),oa=N.tanh(vn),at.push(oa);var Ma=at[at.length-1];return q.deprocess(Ma)})),oe.next=3,N.nextFrame();case 3:return oe.abrupt("return",U);case 4:case"end":return oe.stop()}},F)}));return function(F){return R.apply(this,arguments)}}()}],[{key:"preprocess",value:function(R){var F=N.tidy(function(){return N.sub(N.mul(R,N.scalar(2)),N.scalar(1))});return R.dispose(),F}},{key:"deprocess",value:function(R){var F=N.tidy(function(){return N.div(N.add(R,N.scalar(1)),N.scalar(2))});return R.dispose(),F}},{key:"batchnorm",value:function(R,F,I){var U=N.tidy(function(){var X=N.moments(R,[0,1]);return N.batchNorm(R,X.mean,X.variance,I,F,1e-5)});return R.dispose(),U}},{key:"conv2d",value:function(R,F){var I=F.clone(),U=N.tidy(function(){return N.conv2d(R,I,[2,2],"same")});return R.dispose(),I.dispose(),U}},{key:"deconv2d",value:function(R,F,I){var U=N.tidy(function(){var X=N.conv2dTranspose(R,F,[2*R.shape[0],2*R.shape[1],F.shape[2]],[2,2],"same");return N.add(X,I)});return R.dispose(),F.dispose(),I.dispose(),U}}]),q}(),el=function(q,R){var F=new Lg(q,R);return R?F:F.ready},wu=n(241),xf=new Set(["alarm_clock","ambulance","angel","ant","antyoga","backpack","barn","basket","bear","bee","beeflower","bicycle","bird","book","brain","bridge","bulldozer","bus","butterfly","cactus","calendar","castle","cat","catbus","catpig","chair","couch","crab","crabchair","crabrabbitfacepig","cruise_ship","diving_board","dog","dogbunny","dolphin","duck","elephant","elephantpig","eye","face","fan","fire_hydrant","firetruck","flamingo","flower","floweryoga","frog","frogsofa","garden","hand","hedgeberry","hedgehog","helicopter","kangaroo","key","lantern","lighthouse","lion","lionsheep","lobster","map","mermaid","monapassport","monkey","mosquito","octopus","owl","paintbrush","palm_tree","parrot","passport","peas","penguin","pig","pigsheep","pineapple","pool","postcard","power_outlet","rabbit","rabbitturtle","radio","radioface","rain","rhinoceros","rifle","roller_coaster","sandwich","scorpion","sea_turtle","sheep","skull","snail","snowflake","speedboat","spider","squirrel","steak","stove","strawberry","swan","swing_set","the_mona_lisa","tiger","toothbrush","toothpaste","tractor","trombone","truck","whale","windmill","yoga","yogabicycle","everything"]),Iu={modelPath:"https://storage.googleapis.com/quickdraw-models/sketchRNN/large_models/",modelPath_large:"https://storage.googleapis.com/quickdraw-models/sketchRNN/models/",modelPath_small:"https://storage.googleapis.com/quickdraw-models/sketchRNN/models/",PATH_END:".gen.json",temperature:.65,pixelFactor:3},cc=function(){function q(R,F){var I=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];ce()(this,q);var U=R;if(this.config={temperature:.65,pixelFactor:3,modelPath:Iu.modelPath,modelPath_small:Iu.modelPath_small,modelPath_large:Iu.modelPath_large,PATH_END:Iu.PATH_END},Qc.isAbsoluteURL(U)===!0){var X=Qc.getModelPath(U);this.config.modelPath=X}else{if(!xf.has(U))return console.log("no model found!"),this;U=(I?this.config.modelPath:this.config.modelPath_small)+U+this.config.PATH_END,this.config.modelPath=U}this.model=new wu.SketchRNN(this.config.modelPath),this.penState=this.model.zeroInput(),this.ready=$e(this.model.initialize(),F)}return ke()(q,[{key:"generateInternal",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return X=+I.temperature||this.config.temperature,oe
8229=+I.pixelFactor||this.config.pixelFactor,Me.next=4,this.ready;case 4:return this.rnnState||(this.rnnState=this.model.zeroState(),this.model.setPixelFactor(oe)),Array.isArray(U)&&U.length&&(this.rnnState=this.model.updateStrokes(U,this.rnnState)),this.rnnState=this.model.update(this.penState,this.rnnState),me=this.model.getPDF(this.rnnState,X),this.penState=this.model.sample(me),Se={dx:this.penState[0],dy:this.penState[1]},this.penState[2]===1?Se.pen="down":this.penState[3]===1?Se.pen="up":this.penState[4]===1&&(Se.pen="end"),Me.abrupt("return",Se);case 12:case"end":return Me.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"generate",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se,Me;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return typeof I=="function"?(me={},Se=[],oe=I):Array.isArray(I)?(me={},Se=I,oe=U):typeof U=="function"?(me=I||{},Se=[],oe=U):(me=I||{},Se=U||[],oe=X),Me=Se.map(function(tt){var at=tt.pen==="up"?1:0,jt=tt.pen==="down"?1:0,$t=tt.pen==="end"?1:0;return[tt.dx,tt.dy,jt,at,$t]}),Te.abrupt("return",$e(this.generateInternal(me,Me),oe));case 3:case"end":return Te.stop()}},F,this)}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"reset",value:function(){this.penState=this.model.zeroInput(),this.rnnState&&(this.rnnState=this.model.zeroState())}}]),q}(),Sp=function(q,R){var F=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return new cc(q,R,F)},Qi={modelPath:"https://raw.githubusercontent.com/zaidalyafeai/HostedModels/master/unet-128/model.json",imageSize:128,returnTensors:!1},ch=function(){function q(R,F,I){ce()(this,q),this.modelReady=!1,this.isPredicting=!1,this.config={modelPath:F.modelPath!==void 0?F.modelPath:Qi.modelPath,imageSize:F.imageSize!==void 0?F.imageSize:Qi.imageSize,returnTensors:F.returnTensors!==void 0?F.returnTensors:Qi.returnTensors},this.ready=$e(this.loadModel(),I)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(){return be.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,N.loadLayersModel(this.config.modelPath);case 2:return this.model=I.sent,this.modelReady=!0,I.abrupt("return",this);case 5:case"end":return I.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"segment",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return me.next=2,this.ready;case 2:return oe=U,I instanceof HTMLImageElement||I instanceof HTMLVideoElement||I instanceof HTMLCanvasElement||I instanceof ImageData?X=I:Ee()(I)==="object"&&(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLVideoElement||I.elt instanceof HTMLCanvasElement||I.elt instanceof ImageData)?X=I.elt:typeof I=="function"&&(X=this.video,oe=I),me.abrupt("return",$e(this.segmentInternal(X),oe));case 5:case"end":return me.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"convertToP5Image",value:function(){var R=K()(be.a.mark(function F(I){var U,X;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.next=2,cr.rawToBlob(I,this.config.imageSize,this.config.imageSize);case 2:return U=oe.sent,oe.next=5,cr.blobToP5Image(U);case 5:return X=oe.sent,oe.abrupt("return",X);case 7:case"end":return oe.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"segmentInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn,In=this;return be.a.wrap(function(Ln){for(;;)switch(Ln.prev=Ln.next){case 0:return Ln.next=2,this.ready;case 2:if(!(I instanceof HTMLVideoElement)){Ln.next=5;break}return Ln.next=5,N.nextFrame();case 5:return this.isPredicting=!0,U=N.tidy(function(){var qn=N.browser.fromPixels(I).toFloat(),Cn=N.image.resizeBilinear(qn,[In.config.imageSize,In.config.imageSize]).div(N.scalar(255)),wr=Cn.expandDims(0),Fr=In.model.predict(wr),Rr=N.ones([128,128,1]).tile([1,1,1]);Cn=Cn.concat(Rr,2);var Xr=Fr.squeeze([0]),zr=(Xr=(Xr=Xr.tile([1,1,4])).sub(.3).sign().relu().neg().add(1)).mul(Cn),Ti=Fr.squeeze([0]),Wi=(Ti=(Ti=Ti.tile([1,1,4])).sub(.3).sign().relu()).mul(Cn),zi=N.ones([128,128,1]).tile([1,1,1]).mul(255),Xo=Fr.squeeze([0]);return{featureMask:zr,backgroundMask:Wi,segmentation:Xo=(Xo=N.cast(Xo.tile([1,1,3]).sub(.3).sign().relu().mul(255),"int32")).concat(zi,2)}}),X=U.featureMask,oe=U.backgroundMask,me=U.segmentation,this.isPredicting=!1,Ln.next=10,N.browser.toPixels(X);case 10:return Se=Ln.sent,Ln.next=13,N.browser.toPixels(oe);case 13:return Me=Ln.sent,Ln.next=16,N.browser.toPixels(me);case 16:if(Te=Ln.sent,tt=hn(X),at=hn(oe),jt=q.dataURLtoBlob(tt.src),$t=q.dataURLtoBlob(at.src),!cr.checkP5()){Ln.next=31;break}return Ln.next=24,this.convertToP5Image(Se);case 24:return vn=Ln.sent,Ln.next=27,this.convertToP5Image(Me);case 27:return wn=Ln.sent,Ln.next=30,this.convertToP5Image(Te);case 30:Nn=Ln.sent;case 31:return this.config.returnTensors||(X.dispose(),oe.dispose(),me.dispose()),Ln.abrupt("return",{segmentation:Te,blob:{featureMask:jt,backgroundMask:$t},tensor:{featureMask:X,backgroundMask:oe},raw:{featureMask:Se,backgroundMask:Me},featureMask:vn,backgroundMask:wn,mask:Nn});case 33:case"end":return Ln.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()}],[{key:"dataURLtoBlob",value:function(R){for(var F=R.split(","),I=F[0].match(/:(.*?);/)[1],U=atob(F[1]),X=U.length,oe=new Uint8Array(X);X;)oe[X]=U.charCodeAt(X),X-=1;return new Blob([oe],{type:I})}}]),q}(),wf=function(q,R,F){var I=null,U={},X=F;return q instanceof HTMLVideoElement?I=q:Ee()(q)==="object"&&q.elt instanceof HTMLVideoElement?I=q.elt:typeof q=="function"?X=q:Ee()(q)==="object"&&(U=q),Ee()(R)==="object"?U=R:typeof R=="function"&&(X=R),new ch(I,U,X)},ad=function(){function q(R,F){var I=this;ce()(this,q),this.ready=!1,this.model={},this.latentDim=N.randomUniform([1,16]);var U=R.split("manifest.json"),X=on()(U,1)[0];zt.a.get(R).then(function(oe){var me=oe.data;I.ready=$e(I.loadCVAEModel(X+me.model),F),I.labels=me.labels,I.labelVector=Array(I.labels.length+1).fill(0)})}return ke()(q,[{key:"loadCVAEModel",value:function(){var R=K()(be.a.mark(function F(I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return U.next=2,N.loadLayersModel(I);case 2:return this.model=U.sent,U.abrupt("return",this);case 4:case"end":return U.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"generate",value:function(){var R=K()(be.a.mark(function F(I,U){return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.abrupt("return",$e(this.generateInternal(I),U));case 1:case"end":return X.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"loadAsync",value:function(R){var F=this;return new Promise(function(I,U){F.ready||U(),loadImage(R,function(X){I(X)})})}},{key:"getBlob",value:function(R){var F=this;return new Promise(function(I,U){F.ready||U(),R.toBlob(function(X){I(X)})})}},{key:"generateInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn=this;return be.a.wrap(function(Nn){for(;;)switch(Nn.prev=Nn.next){case 0:return U=N.tidy(function(){wn.latentDim=N.randomUniform([1,16]);var In=wn.labels.indexOf(I);if(In<0)return console.log("Wrong input of the label!"),[void 0,void 0];wn.labelVector=wn.labelVector.map(function(){return 0}),wn.labelVector[In+1]=1;var Ln=N.tensor([wn.labelVector]),qn=wn.model.predict([wn.latentDim,Ln]);return qn.reshape([qn.shape[1],qn.shape[2],qn.shape[3]])}),Nn.next=3,N.browser.toPixels(U);case 3:for(X=Nn.sent,U.dispose(),oe=document.createElement("canvas"),me=oe.getContext("2d"),Se=on()(U.shape,2),Me=Se[0],Te=Se[1],oe.width=Me,oe.height=Te,tt=me.createImageData(Me,Te),at=tt.data,jt=0;jt<Me*Te*4;jt+=1)at[jt]=X[jt];return me.putImageData(tt,0,0),Nn.t0=URL,Nn.next=17,this.getBlob(oe);case 17:if(Nn.t1=Nn.sent,$t=Nn.t0.createObjectURL.call(Nn.t0,Nn.t1),!cr.checkP5()){Nn.next=23;break}return Nn.next=22,this.loadAsync($t);case 22:vn=Nn.sent;case 23:return Nn.abrupt("return",{src:$t,raws:X,image:vn});case 24:case"end":return Nn.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()}]),q}(),Lm=function(q,R){return new ad(q,R)},zg=function(){function q(R,F,I){ce()(this,q),this.model={},this.modelPath=R,this.modelInfo={},this.modelPathPrefix="",this.modelReady=!1,this.config={returnTensors:F.returnTensors||!1},this.ready=$e(this.loadModel(),I)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me,Se;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return Me.next=2,zt.a.get(this.modelPath);case 2:return I=Me.sent,U=I.data,this.modelInfo=U,X=this.modelPath.split("manifest.json"),oe=on()(X,1),me=oe[0],Se=this.isAbsoluteURL(me)?this.modelInfo.model:this.modelPathPrefix+this.modelInfo.model,Me.next=9,N.loadLayersModel(Se);case 9:return this.model=Me.sent,this.modelReady=!0,Me.abrupt("return",this);case 12:case"end":return Me.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"generate",value:function(){var R=K()(be.a.mark(function F(I,U){return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,this.ready;case 2:return X.abrupt("return",$e(this.generateInternal(U),I));case 3:case"end":return X.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"compute",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe=this;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return X=N.tidy(function(){var Se;if(Array.isArray(U)===!1)Se=N.randomNormal([1,I]);else{for(var Me=N.buffer([1,I]),Te=0;Te<I;Te+=1)Me.set(U[Te],0,Te);Se=Me.toTensor()}return oe.model.predict(Se).squeeze().transpose([1,2,0]).div(N.scalar(2)).add(N.scalar(.5))}),me.abrupt("return",X);case 2:case"end":return me.stop()}},F)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"generateInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me,Te,tt,at;return be.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return U=this.modelInfo.modelLatentDim,jt.next=3,this.compute(U,I);case 3:return X=jt.sent,jt.next=6,N.browser.toPixels(X);case 6:return oe=jt.sent,me=on()(X.shape,2),Se=me[0],Me=me[1],jt.next=10,cr.rawToBlob(oe,Me,Se);case 10:if(Te=jt.sent,!cr.checkP5()){jt.next=15;break}return jt.next=14,cr.blobToP5Image(Te);case 14:tt=jt.sent;case 15:return(at={}).blob=Te,at.raw=oe,cr.checkP5()&&(at.image=tt),this.config.returnTensors?at.tensor=X:(at.tensor=null,X.dispose()),jt.abrupt("return",at);case 21:case"end":return jt.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"isAbsoluteURL",value:function(R){return!!new RegExp("^(?:[a-z]+:)?//","i").test(R)}}]),q}(),sd=function(q,R,F){var I,U={};if(typeof q!="string")throw new Error(`Please specify a path to a "manifest.json" file: 8230 8231 "models/face/manifest.json" 8232 8233 8234 This "manifest.json" file should include: 8235 8236 { 8237 "description": "DCGAN, human faces, 64x64", 8238 "model": "https://raw.githubusercontent.com/viztopia/ml5dcgan/master/model/model.json", // "https://github.com/viztopia/ml5dcgan/blob/master/model/model.json", 8239 "modelSize": 64, 8240 "modelLatentDim": 128 8241 } 8242 `);typeof R=="function"?I=R:Ee()(R)==="object"&&(U=R,I=F);var X=new zg(q,U,I);return I?X:X.ready},Ap=n(30),ya=n.n(Ap),Op=n(132),ud=0,Dp=function(){function q(R,F){ce()(this,q),this.ready=$e(this.loadModel(R),F)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:if(U={model:null,metadata:null},I.toLowerCase()!=="moviereviews"){Se.next=6;break}U.model="https://storage.googleapis.com/tfjs-models/tfjs/sentiment_cnn_v1/model.json",U.metadata="https://storage.googleapis.com/tfjs-models/tfjs/sentiment_cnn_v1/metadata.json",Se.next=14;break;case 6:if(Qc.isAbsoluteURL(I)!==!0){Se.next=12;break}X=Qc.getModelPath(I),U.model="".concat(X,"/model.json"),U.metadata="".concat(X,"/metadata.json"),Se.next=14;break;case 12:return console.error("problem loading model"),Se.abrupt("return",this);case 14:return Se.next=16,N.loadLayersModel(U.model);case 16:return this.model=Se.sent,Se.next=19,zt.a.get(U.metadata);case 19:return oe=Se.sent,me=oe.data,this.indexFrom=me.index_from,this.maxLen=me.max_len,this.wordIndex=me.word_index,this.vocabularySize=me.vocabulary_size,Se.abrupt("return",this);case 26:case"end":return Se.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"predict",value:function(R){var F=this,I=function(me,Se){var Me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"pre",Te=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"pre",tt=arguments.length>4&&arguments[4]!==void 0?arguments[4]:ud;return me.map(function(at){if(at.length>Se&&(Te==="pre"?at.splice(0,at.length-Se):at.splice(Se,at.length-Se)),at.length<Se){for(var jt=[],$t=0;$t<Se-at.length;$t+=1)jt.push(tt);
8242at=Me==="pre"?jt.concat(at):at.concat(jt)}return at})}([R.trim().toLowerCase().replace(/[.,?!]/g,"").split(" ").map(function(me){var Se=F.wordIndex[me]+F.indexFrom;return Se>F.vocabularySize&&(Se=2),Se})],this.maxLen),U=N.tensor2d(I,[1,this.maxLen]),X=this.model.predict(U),oe=X.dataSync()[0];return X.dispose(),U.dispose(),{score:oe}}}]),q}(),cd=function(q,R){return new Dp(q,R)};/** 8243 * @license 8244 * Copyright 2019 Google LLC. All Rights Reserved. 8245 * Licensed under the Apache License, Version 2.0 (the "License"); 8246 * you may not use this file except in compliance with the License. 8247 * You may obtain a copy of the License at 8248 * 8249 * http://www.apache.org/licenses/LICENSE-2.0 8250 * 8251 * Unless required by applicable law or agreed to in writing, software 8252 * distributed under the License is distributed on an "AS IS" BASIS, 8253 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8254 * See the License for the specific language governing permissions and 8255 * limitations under the License. 8256 * ============================================================================= 8257 */function _f(q,R,F,I){return new(F||(F=Promise))(function(U,X){function oe(Me){try{Se(I.next(Me))}catch(Te){X(Te)}}function me(Me){try{Se(I.throw(Me))}catch(Te){X(Te)}}function Se(Me){Me.done?U(Me.value):new F(function(Te){Te(Me.value)}).then(oe,me)}Se((I=I.apply(q,R||[])).next())})}function ql(q,R){var F,I,U,X,oe={label:0,sent:function(){if(1&U[0])throw U[1];return U[1]},trys:[],ops:[]};return X={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function me(Se){return function(Me){return function(Te){if(F)throw new TypeError("Generator is already executing.");for(;oe;)try{if(F=1,I&&(U=2&Te[0]?I.return:Te[0]?I.throw||((U=I.return)&&U.call(I),0):I.next)&&!(U=U.call(I,Te[1])).done)return U;switch(I=0,U&&(Te=[2&Te[0],U.value]),Te[0]){case 0:case 1:U=Te;break;case 4:return oe.label++,{value:Te[1],done:!1};case 5:oe.label++,I=Te[1],Te=[0];continue;case 7:Te=oe.ops.pop(),oe.trys.pop();continue;default:if(!(U=(U=oe.trys).length>0&&U[U.length-1])&&(Te[0]===6||Te[0]===2)){oe=0;continue}if(Te[0]===3&&(!U||Te[1]>U[0]&&Te[1]<U[3])){oe.label=Te[1];break}if(Te[0]===6&&oe.label<U[1]){oe.label=U[1],U=Te;break}if(U&&oe.label<U[2]){oe.label=U[2],oe.ops.push(Te);break}U[2]&&oe.ops.pop(),oe.trys.pop();continue}Te=R.call(q,oe)}catch(tt){Te=[6,tt],I=0}finally{F=U=0}if(5&Te[0])throw Te[1];return{value:Te[0]?Te[1]:void 0,done:!0}}([Se,Me])}}}var Tp=[["conv2d",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1]],lh=[8,16,32];function ld(q){Ke.util.assert(typeof q=="number",function(){return"outputStride is not a number"}),Ke.util.assert(lh.indexOf(q)>=0,function(){return"outputStride of "+q+" is invalid. It must be either 8, 16, or 32"})}var Gl={100:[["conv2d",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",2],["separableConv",1]],75:[["conv2d",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1]],50:Tp,25:Tp},F0=function(){function q(R,F){this.PREPROCESS_DIVISOR=Object(Ke.scalar)(127.5),this.ONE=Object(Ke.scalar)(1),this.modelWeights=R,this.convolutionDefinitions=F}return q.prototype.predict=function(R,F){var I=this,U=Object(Ke.div)(R.toFloat(),this.PREPROCESS_DIVISOR),X=Object(Ke.sub)(U,this.ONE);return function(oe,me){var Se=1,Me=1;return oe.map(function(Te,tt){var at,jt,$t=Te[0],vn=Te[1];return Se===me?(at=1,jt=Me,Me*=vn):(at=vn,jt=1,Se*=vn),{blockId:tt,convType:$t,stride:at,rate:jt,outputStride:Se}})}(this.convolutionDefinitions,F).reduce(function(oe,me){var Se=me.blockId,Me=me.stride,Te=me.convType,tt=me.rate;if(Te==="conv2d")return I.conv(oe,Me,Se);
8257if(Te==="separableConv")return I.separableConv(oe,Me,Se,tt);throw Error("Unknown conv type of "+Te)},X)},q.prototype.convToOutput=function(R,F){return R.conv2d(this.weights(F),1,"same").add(this.convBias(F,!1))},q.prototype.conv=function(R,F,I){var U=this.weights("Conv2d_"+String(I));return R.conv2d(U,F,"same").add(this.convBias("Conv2d_"+String(I))).clipByValue(0,6)},q.prototype.separableConv=function(R,F,I,U){U===void 0&&(U=1);var X="Conv2d_"+String(I)+"_depthwise",oe="Conv2d_"+String(I)+"_pointwise";return R.depthwiseConv2D(this.depthwiseWeights(X),F,"same","NHWC",U).add(this.depthwiseBias(X)).clipByValue(0,6).conv2d(this.weights(oe),[1,1],"same").add(this.convBias(oe)).clipByValue(0,6)},q.prototype.weights=function(R){return this.modelWeights.weights(R)},q.prototype.convBias=function(R,F){return F===void 0&&(F=!0),this.modelWeights.convBias(R,F)},q.prototype.depthwiseBias=function(R){return this.modelWeights.depthwiseBias(R)},q.prototype.depthwiseWeights=function(R){return this.modelWeights.depthwiseWeights(R)},q.prototype.dispose=function(){this.modelWeights.dispose()},q}(),fd="https://storage.googleapis.com/tfjs-models/savedmodel/",Pa={1:{url:fd+"posenet_mobilenet_100_partmap/",architecture:Gl[100]},.75:{url:fd+"posenet_mobilenet_075_partmap/",architecture:Gl[75]},.5:{url:fd+"posenet_mobilenet_050_partmap/",architecture:Gl[50]},.25:{url:fd+"posenet_mobilenet_025_partmap/",architecture:Gl[25]}};function hs(q,R){return Object(Ke.tidy)(function(){return q.greater(Object(Ke.scalar)(R)).toInt()})}function bs(q,R){var F=R.shape,I=F[0],U=F[1],X=F[2];return Object(Ke.tidy)(function(){var oe=function(Se){var Me=Se.shape[2],Te=Se.argMax(2).reshape([-1]);return Object(Ke.oneHot)(Te,Me)}(R),me=Object(Ke.range)(0,X,1,"int32").expandDims(1);return function(Se,Me){return Se.mul(Me)}(oe.matMul(me).toInt().reshape([I,U]).add(Object(Ke.scalar)(1,"int32")),q).sub(Object(Ke.scalar)(1,"int32"))})}var no=function(){function q(R){this.graphModel=R}return q.prototype.weights=function(R){return this.getVariable("MobilenetV1/"+R+"/weights")},q.prototype.convBias=function(R,F){return this.getVariable("MobilenetV1/"+R+"/Conv2D_bias")},q.prototype.depthwiseBias=function(R){return this.getVariable("MobilenetV1/"+R+"/depthwise_bias")},q.prototype.depthwiseWeights=function(R){return this.getVariable("MobilenetV1/"+R+"/depthwise_weights")},q.prototype.getVariable=function(R){return this.graphModel.weights[""+R][0]},q.prototype.dispose=function(){this.graphModel.dispose()},q}();function _u(q){return q instanceof Ke.Tensor?q:Ke.browser.fromPixels(q)}function Kl(q,R,F){var I=R[0],U=R[1];F===void 0&&(F=!1);var X,oe,me,Se,Me,Te,tt=q.shape,at=tt[0],jt=tt[1]/at;if(jt>U/I){X=U;var $t=I-(oe=Math.ceil(X/jt));me=0,Se=0,Me=Math.floor($t/2),Te=I-(oe+Me)}else{oe=I;var vn=U-(X=Math.ceil(I*jt));me=Math.floor(vn/2),Se=U-(X+me),Me=0,Te=0}return{resizedAndPadded:Object(Ke.tidy)(function(){var wn;return wn=F?q.reverse(1).resizeBilinear([oe,X]):q.resizeBilinear([oe,X]),Object(Ke.pad3d)(wn,[[Me,Te],[me,Se],[0,0]])}),paddedBy:[[Me,Te],[me,Se]]}}function xs(q,R,F,I){var U=R[0],X=R[1],oe=F[0],me=F[1],Se=I[0],Me=Se[0],Te=Se[1],tt=I[1],at=tt[0],jt=tt[1];return Object(Ke.tidy)(function(){return function($t,vn,wn){var Nn=vn[0],In=vn[1],Ln=wn[0],qn=Ln[0],Cn=Ln[1],wr=wn[1],Fr=wr[0],Rr=wr[1],Xr=$t.shape,zr=Xr[0],Ti=Xr[1],Wi=zr-(qn+Cn),zi=Ti-(Fr+Rr);return Object(Ke.tidy)(function(){return Object(Ke.slice3d)($t,[qn,Fr,0],[Wi,zi,$t.shape[2]]).resizeBilinear([Nn,In],!0)})}(q.resizeBilinear([oe,me],!0),[U,X],[[Me,Te],[at,jt]])})}var Yl=[353,257],tl=function(){function q(R){this.mobileNet=R}return q.prototype.predictForSegmentation=function(R,F){var I=this;return F===void 0&&(F=16),ld(F),Object(Ke.tidy)(function(){var U=I.mobileNet.predict(R,F);return I.mobileNet.convToOutput(U,"segment_2").sigmoid()})},q.prototype.predictForPartMap=function(R,F){var I=this;return F===void 0&&(F=16),ld(F),Object(Ke.tidy)(function(){var U=I.mobileNet.predict(R,F),X=I.mobileNet.convToOutput(U,"segment_2"),oe=I.mobileNet.convToOutput(U,"part_heatmap_2");return{segmentScores:X.sigmoid(),partHeatmapScores:oe.sigmoid()}})},q.prototype.estimatePersonSegmentationActivation=function(R,F,I){var U=this;
8257return F===void 0&&(F=16),I===void 0&&(I=.5),ld(F),Object(Ke.tidy)(function(){var X=_u(R),oe=Kl(X,Yl),me=oe.resizedAndPadded,Se=oe.paddedBy,Me=U.predictForSegmentation(me,F),Te=me.shape,tt=Te[0],at=Te[1],jt=X.shape;return hs(xs(Me,[jt[0],jt[1]],[tt,at],Se).squeeze(),I)})},q.prototype.estimatePersonSegmentation=function(R,F,I){return F===void 0&&(F=16),I===void 0&&(I=.5),_f(this,void 0,void 0,function(){var U,X,oe,me,Se;return ql(this,function(Me){switch(Me.label){case 0:return U=this.estimatePersonSegmentationActivation(R,F,I),X=U.shape,oe=X[0],me=X[1],[4,U.data()];case 1:return Se=Me.sent(),U.dispose(),[2,{height:oe,width:me,data:Se}]}})})},q.prototype.estimatePartSegmentationActivation=function(R,F,I){var U=this;return F===void 0&&(F=16),I===void 0&&(I=.5),ld(F),Object(Ke.tidy)(function(){var X=_u(R),oe=Kl(X,Yl),me=oe.resizedAndPadded,Se=oe.paddedBy,Me=U.predictForPartMap(me,F),Te=Me.segmentScores,tt=Me.partHeatmapScores,at=me.shape,jt=at[0],$t=at[1],vn=X.shape,wn=vn[0],Nn=vn[1],In=xs(Te,[wn,Nn],[jt,$t],Se),Ln=xs(tt,[wn,Nn],[jt,$t],Se);return bs(hs(In.squeeze(),I),Ln)})},q.prototype.estimatePartSegmentation=function(R,F,I){return F===void 0&&(F=16),I===void 0&&(I=.5),_f(this,void 0,void 0,function(){var U,X,oe,me,Se;return ql(this,function(Me){switch(Me.label){case 0:return U=this.estimatePartSegmentationActivation(R,F,I),X=U.shape,oe=X[0],me=X[1],[4,U.data()];case 1:return Se=Me.sent(),U.dispose(),[2,{height:oe,width:me,data:Se}]}})})},q.prototype.dispose=function(){this.mobileNet.dispose()},q}();function fh(q){return q===void 0&&(q=.75),_f(this,void 0,void 0,function(){var R,F;return ql(this,function(I){switch(I.label){case 0:if(Ke==null)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");return R=Object.keys(Pa),Ke.util.assert(typeof q=="number",function(){return"got multiplier type of "+typeof q+" when it should be a number."}),Ke.util.assert(R.indexOf(q.toString())>=0,function(){return"invalid multiplier value of "+q+". No checkpoint exists for that multiplier. Must be one of "+R.join(",")+"."}),[4,dh.load(q)];case 1:return F=I.sent(),[2,new tl(F)]}})})}var dh={load:function(q){return _f(void 0,void 0,void 0,function(){var R,F,I,U;return ql(this,function(X){switch(X.label){case 0:return R=Pa[q],F=R.url,[4,Object(Mt.loadGraphModel)(F+"model.json")];case 1:return I=X.sent(),U=new no(I),[2,new F0(U,R.architecture)]}})})}};function kf(q,R){R===void 0&&(R=!0);for(var F=q.width,I=q.height,U=q.data,X=new Uint8ClampedArray(F*I*4),oe=0;oe<I*F;++oe){var me=255*(R?1-U[oe]:U[oe]),Se=4*oe;X[Se+0]=0,X[Se+1]=0,X[Se+2]=0,X[Se+3]=Math.round(me)}return new ImageData(X,F,I)}function zm(q,R){for(var F=q.width,I=q.height,U=q.data,X=new Uint8ClampedArray(F*I*4),oe=0;oe<I*F;++oe){var me=Math.round(U[oe]),Se=4*oe;if(me===-1)X[Se+0]=255,X[Se+1]=255,X[Se+2]=255,X[Se+3]=255;else{var Me=R[me];if(!Me)throw new Error("No color could be found for part id "+me);X[Se+0]=Me[0],X[Se+1]=Me[1],X[Se+2]=Me[2],X[Se+3]=255}}return new ImageData(X,F,I)}var nl={multiplier:.75,outputStride:16,segmentationThreshold:.5,palette:{leftFace:{i
8257d:0,color:[110,64,170]},rightFace:{id:1,color:[106,72,183]},rightUpperLegFront:{id:2,color:[100,81,196]},rightLowerLegBack:{id:3,color:[92,91,206]},rightUpperLegBack:{id:4,color:[84,101,214]},leftLowerLegFront:{id:5,color:[75,113,221]},leftUpperLegFront:{id:6,color:[66,125,224]},leftUpperLegBack:{id:7,color:[56,138,226]},leftLowerLegBack:{id:8,color:[48,150,224]},rightFeet:{id:9,color:[40,163,220]},rightLowerLegFront:{id:10,color:[33,176,214]},leftFeet:{id:11,color:[29,188,205]},torsoFront:{id:12,color:[26,199,194]},torsoBack:{id:13,color:[26,210,182]},rightUpperArmFront:{id:14,color:[28,219,169]},rightUpperArmBack:{id:15,color:[33,227,155]},rightLowerArmBack:{id:16,color:[41,234,141]},leftLowerArmFront:{id:17,color:[51,240,128]},leftUpperArmFront:{id:18,color:[64,243,116]},leftUpperArmBack:{id:19,color:[79,246,105]},leftLowerArmBack:{id:20,color:[96,247,97]},rightHand:{id:21,color:[115,246,91]},rightLowerArmFront:{id:22,color:[134,245,88]},leftHand:{id:23,color:[155,243,88]}},returnTensors:!1},R0=function(){function q(R,F,I){ce()(this,q),this.video=R,this.model=null,this.modelReady=!1,this.modelPath="",this.config={multiplier:F.multiplier||nl.multiplier,outputStride:F.outputStride||nl.outputStride,segmentationThreshold:F.segmentationThreshold||nl.segmentationThreshold,palette:F.palette||nl.palette,returnTensors:F.returnTensors||nl.returnTensors},this.ready=$e(this.loadModel(),I)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(){return be.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,fh(this.config.multiplier);case 2:return this.model=I.sent,this.modelReady=!0,I.abrupt("return",this);case 5:case"end":return I.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"p5Color2RGB",value:function(R){var F=/\(([^)]+)\)/.exec(R.toString("rgb"))[1].split(","),I=on()(F,3);return[I[0],I[1],I[2]]}},{key:"convertToP5Image",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,cr.rawToBlob(I,U,X);case 2:return oe=Se.sent,Se.next=5,cr.blobToP5Image(oe);case 5:return me=Se.sent,Se.abrupt("return",me);case 7:case"end":return Se.stop()}},F)}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"bodyPartsSpec",value:function(R){var F=this,I=R!==void 0||Object.keys(R).length>=24?R:this.config.palette,U=cr.p5Instance;return U&&I!==void 0&&Object.keys(I).length>=24&&Object.keys(I).forEach(function(X){I[X].color instanceof U.Color&&(I[X].color=F.p5Color2RGB(I[X].color))}),I}},{key:"segmentWithPartsInternal",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn=this;return be.a.wrap(function(Nn){for(;;)switch(Nn.prev=Nn.next){case 0:return Nn.next=2,this.ready;case 2:return Nn.next=4,N.nextFrame();case 4:if(!this.video||this.video.readyState!==0){Nn.next=7;break}return Nn.next=7,new Promise(function(In){wn.video.onloadeddata=function(){return In()}});case 7:return this.config.palette=U.palette||this.config.palette,this.config.outputStride=U.outputStride||this.config.outputStride,this.config.segmentationThreshold=U.segmentationThreshold||this.config.segmentationThreshold,Nn.next=12,this.model.estimatePartSegmentation(I,this.config.outputStride,this.config.segmentationThreshold);case 12:return X=Nn.sent,oe=this.bodyPartsSpec(this.config.palette),me=Object.keys(oe).map(function(In){return oe[In].color}),(Se={segmentation:X,raw:{personMask:null,backgroundMask:null,partMask:null},tensor:{personMask:null,backgroundMask:null,partMask:null},personMask:null,backgroundMask:null,partMask:null,bodyParts:oe}).raw.backgroundMask=kf(X,!0),Se.raw.personMask=kf(X,!1),Se.raw.partMask=zm(X,me),Me=N.tidy(function(){var In=N.browser.fromPixels(I),Ln=N.ones([X.height,X.width,1]).tile([1,1,1]).mul(255);In=In.concat(Ln,2);var qn=N.tensor(X.data,[X.height,X.width,1]),Cn=N.tensor(X.data,[X.height,X.width,1]),wr=N.tensor(ya()(Se.raw.partMask.data),[X.height,X.width,4]);return{personMask:qn=N.cast(qn.add(.2).sign().relu().mul(In),"int32"),backgroundMask:Cn=N.cast(Cn.add(.2).sign().neg().relu().mul(In),"int32"),partMask:wr=N.cast(wr,"int32")}}),Te=Me.personMask,tt=Me.backgroundMask,at=Me.partMask,Nn.next=22,N.browser.toPixels(Te);case 22:return jt=Nn.sent,Nn.next=25,N.browser.toPixels(tt);case 25:return $t=Nn.sent,Nn.next=28,N.browser.toPixels(at);case 28:if(vn=Nn.sent,Se.personMask=jt,Se.backgroundMask=$t,Se.partMask=vn,!cr.checkP5()){Nn.next=42;break}return Nn.next=35,this.convertToP5Image(jt,X.width,X.height);case 35:return Se.personMask=Nn.sent,Nn.next=38,this.convertToP5Image($t,X.width,X.height);case 38:return Se.backgroundMask=Nn.sent,Nn.next=41,this.convertToP5Image(vn,X.width,X.height);case 41:Se.partMask=Nn.sent;case 42:return this.config.returnTensors?(Se.tensor.personMask=Te,Se.tensor.backgroundMask=tt,Se.tensor.partMask=at):(Te.dispose(),tt.dispose(),at.dispose()),Nn.abrupt("return",Se);case 44:case"end":return Nn.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"segmentWithParts",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(oe=this.video,Se=this.config,typeof I!="function"){Me.next=7;break}oe=this.video,me=I,Me.next=25;break;case 7:if(!(I instanceof HTMLImageElement||I instanceof HTMLCanvasElement||I instanceof HTMLVideoElement||I instanceof ImageData)){Me.next=11;break}oe=I,Me.next=25;break;case 11:if(Ee()(I)!=="object"||!(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLCanvasElement||I.elt instanceof ImageData)){Me.next=15;break}oe=I.elt,Me.next=25;break;case 15:if(!(Ee()(I)==="object"&&I.canvas instanceof HTMLCanvasElement)){Me.next=19;break}oe=I.canvas,Me.next=25;break;case 19:if(!(Ee()(I)==="object"&&I.elt instanceof HTMLVideoElement)){Me.next=23;break}oe=I.elt,Me.next=25;break;case 23:if(this.video instanceof HTMLVideoElement){Me.next=25;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 25:return Ee()(U)==="object"?Se=U:typeof U=="function"&&(me=U),typeof X=="function"&&(me=X),Me.abrupt("return",$e(this.segmentWithPartsInternal(oe,Se),me));case 28:case"end":return Me.stop()}},F,this)}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"segmentInternal",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se,Me,Te,tt,at=this;return be.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return jt.next=2,this.ready;case 2:return jt.next=4,N.nextFrame();case 4:if(!this.video||this.video.readyState!==0){jt.next=7;break}return jt.next=7,new Promise(function($t){at.video.onloadeddata=function(){return $t()}});case 7:return this.config.outputStride=U.outputStride||this.config.outputStride,this.config.segmentationThreshold=U.segmentationThreshold||this.config.segmentationThreshold,jt.next=11,this.model.estimatePersonSegmentation(I,this.config.outputStride,this.config.segmentationThreshold);case 11:return X=jt.sent,(oe={segmentation:X,raw:{personMask:null,backgroundMask:null},tensor:{personMask:null,backgroundMask:null},personMask:null,backgroundMask:null}).raw.backgroundMask=kf(X,!0),oe.raw.personMask=kf(X,!1),me=N.tidy(function(){var $t=N.browser.fromPixels(I),vn=N.ones([X.height,X.width,1]).tile([1,1,1]).mul(255);$t=$t.concat(vn,2);var wn=N.tensor(X.data,[X.height,X.width,1]),Nn=N.tensor(X.data,[X.height,X.width,1]);return{personMask:wn=N.cast(wn.neg().add(1).mul($t),"int32"),backgroundMask:Nn=N.cast(Nn.mul($t),"int32")}}),Se=me.personMask,Me=me.backgroundMask,jt.next=18,N.browser.toPixels(Se);case 18:return Te=jt.sent,jt.next=21,N.browser.toPixels(Me);case 21:if(tt=jt.sent,!cr.checkP5()){jt.next=31;break}return jt.next=25,this.convertToP5Image(Te,X.width,X.height);case 25:return oe.personMask=jt.sent,jt.next=28,this.convertToP5Image(tt,X.width,X.height);case 28:oe.backgroundMask=jt.sent,jt.next=33;break;case 31:oe.personMask=Te,oe.backgroundMask=tt;case 33:return this.config.returnTensors?(oe.tensor.personMask=Se,oe.tensor.backgroundMask=Me):(Se.dispose(),Me.dispose()),jt.abrupt("return",oe);case 35:case"end":return jt.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"segment",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(oe=this.video,Se=this.config,typeof I!="function"){Me.next=7;break}oe=this.video,me=I,Me.next=25;break;case 7:if(!(I instanceof HTMLImageElement||I instanceof HTMLCanvasElement||I instanceof HTMLVideoElement||I instanceof ImageData)){Me.next=11;break}oe=I,Me.next=25;break;case 11:if(Ee()(I)!=="object"||!(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLCanvasElement||I.elt instanceof ImageData)){Me.next=15;break}oe=I.elt,Me.next=25;break;case 15:if(!(Ee()(I)==="object"&&I.canvas instanceof HTMLCanvasElement)){Me.next=19;break}oe=I.canvas,Me.next=25;break;case 19:if(!(Ee()(I)==="object"&&I.elt instanceof HTMLVideoElement)){Me.next=23;break}oe=I.elt,Me.next=25;break;case 23:if(this.video instanceof HTMLVideoElement){Me.next=25;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 25:return Ee()(U)==="object"?Se=U:typeof U=="function"&&(me=U),typeof X=="function"&&(me=X),Me.abrupt("return",$e(this.segmentInternal(oe,Se),me));case 28:case"end":return Me.stop()}},F,this)}));return function(F,I,U){return R.apply(this,arguments)}}()}]),q}(),Um=function(q,R,F){var I,U={},X=F;q instanceof HTMLVideoElement?I=q:Ee()(q)==="object"&&q.elt instanceof HTMLVideoElement?I=q.elt:Ee()(q)==="object"?U=q:typeof q=="function"&&(X=q),Ee()(R)==="object"?U=R:typeof R=="function"&&(X=R);var oe=new R0(I,U,X);return X?oe:oe.ready},dd=function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Math.random()*(R-q)+q},Ug=function(){var q,R,F,I,U,X,oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;if(X)q=R,X=!1;else{do U=(F=dd(0,2)-1)*F+(I=dd(0,2)-1)*I;while(U>=1);q=F*(U=Math.sqrt(-2*Math.log(U)/U)),R=I*U,X=!0}return q*me+oe},hh=function(q,R){var F;if((arguments.length>2&&arguments[2]!==void 0&&arguments[2])===!0)F=Array.from({length:R},function(){return q[Math.floor(Math.random()*q.length)]});else{if(R>q.length)throw new RangeError("Sample size must be less than or equal to array length
8257when sampling without replacement.");F=q.map(function(I){return[I,Math.random()]}).sort(function(I,U){return I[1]<U[1]?-1:1}).slice(0,R).map(function(I){return I[0]})}return F},Ef=function(){function q(){ce()(this,q),this.isTrained=!1,this.isCompiled=!1,this.isLayered=!1,this.model=null,this.init=this.init.bind(this),this.createModel=this.createModel.bind(this),this.addLayer=this.addLayer.bind(this),this.compile=this.compile.bind(this),this.setOptimizerFunction=this.setOptimizerFunction.bind(this),this.train=this.train.bind(this),this.trainInternal=this.trainInternal.bind(this),this.predict=this.predict.bind(this),this.classify=this.classify.bind(this),this.save=this.save.bind(this),this.load=this.load.bind(this),this.init()}return ke()(q,[{key:"init",value:function(){this.createModel()}},{key:"createModel",value:function(){switch((arguments.length>0&&arguments[0]!==void 0?arguments[0]:"sequential").toLowerCase()){case"sequential":default:return this.model=N.sequential(),this.model}}},{key:"addLayer",value:function(R){var F=R||{};this.model.add(F),this.model.layers.length>=2&&(this.isLayered=!0)}},{key:"compile",value:function(R){this.model.compile(R),this.isCompiled=!0}},{key:"setOptimizerFunction",value:function(R,F){return F.call(this,R)}},{key:"train",value:function(R,F){return $e(this.trainInternal(R),F)}},{key:"trainInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me,Te,tt;return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return X=(U=I).inputs,oe=U.outputs,me=U.batchSize,Se=U.epochs,Me=U.shuffle,Te=U.validationSplit,tt=U.whileTraining,at.next=6,this.model.fit(X,oe,{batchSize:me,epochs:Se,shuffle:Me,validationSplit:Te,callbacks:tt});case 6:X.dispose(),oe.dispose(),this.isTrained=!0;case 9:case"end":return at.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"predictSync",value:function(R){var F=this,I=N.tidy(function(){return F.model.predict(R)}),U=I.arraySync();return I.dispose(),R.dispose(),U}},{key:"predict",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe=this;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return U=N.tidy(function(){return oe.model.predict(I)}),me.next=3,U.array();case 3:return X=me.sent,U.dispose(),I.dispose(),me.abrupt("return",X);case 7:case"end":return me.stop()}},F)}));return function(F){return R.apply(this,arguments)}}()},{key:"classify",value:function(){var R=K()(be.a.mark(function F(I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return U.abrupt("return",this.predict(I));case 1:case"end":return U.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"classifySync",value:function(R){return this.predictSync(R)}},{key:"save",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me=this;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:typeof I=="function"?(X="model",oe=I):typeof I=="string"?(X=I,typeof U=="function"&&(oe=U)):X="model",this.model.save(N.io.withSaveHandler(function(){var Me=K()(be.a.mark(function Te(tt){return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return me.weightsManifest={modelTopology:tt.modelTopology,weightsManifest:[{paths:["./".concat(X,".weights.bin")],weights:tt.weightSpecs}]},at.next=3,Yr(tt.weightData,"".concat(X,".weights.bin"),"application/octet-stream");case 3:return at.next=5,Yr(JSON.stringify(me.weightsManifest),"".concat(X,".json"),"text/plain");case 5:oe&&oe();case 6:case"end":return at.stop()}},Te)}));return function(Te){return Me.apply(this,arguments)}}()));case 2:case"end":return Se.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"load",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me,Se,Me,Te,tt,at,jt,$t=arguments;return be.a.wrap(function(vn){for(;;)switch(vn.prev=vn.next){case 0:if(I=$t.length>0&&$t[0]!==void 0?$t[0]:null,U=$t.length>1?$t[1]:void 0,!(I instanceof FileList)){vn.next=13;break}return vn.next=5,Promise.all(Array.from(I).map(function(){var wn=K()(be.a.mark(function Nn(In){var Ln;return be.a.wrap(function(qn){for(;;)switch(qn.prev=qn.next){case 0:if(!In.name.includes(".json")||In.name.includes("_meta")){qn.next=4;break}return qn.abrupt("return",{name:"model",file:In});case 4:if(!In.name.includes(".json")||!In.name.includes("_meta.json")){qn.next=11;break}return qn.next=7,In.text();case 7:return Ln=qn.sent,qn.abrupt("return",{name:"metadata",file:Ln}
8257);case 11:if(!In.name.includes(".bin")){qn.next=13;break}return qn.abrupt("return",{name:"weights",file:In});case 13:return qn.abrupt("return",{name:null,file:null});case 14:case"end":return qn.stop()}},Nn)}));return function(Nn){return wn.apply(this,arguments)}}()));case 5:return X=vn.sent,oe=X.find(function(wn){return wn.name==="model"}).file,me=X.find(function(wn){return wn.name==="weights"}).file,vn.next=10,N.loadLayersModel(N.io.browserFiles([oe,me]));case 10:this.model=vn.sent,vn.next=32;break;case 13:if(!(I instanceof Object)){vn.next=29;break}return vn.next=16,zt.a.get(I.model,{responseType:"text"});case 16:return Se=vn.sent,Me=JSON.stringify(Se.data),Te=new File([Me],"model.json",{type:"application/json"}),vn.next=21,zt.a.get(I.weights,{responseType:"blob"});case 21:return tt=vn.sent,at=tt.data,jt=new File([at],"model.weights.bin",{type:"application/macbinary"}),vn.next=26,N.loadLayersModel(N.io.browserFiles([Te,jt]));case 26:this.model=vn.sent,vn.next=32;break;case 29:return vn.next=31,N.loadLayersModel(I);case 31:this.model=vn.sent;case 32:return this.isCompiled=!0,this.isLayered=!0,this.isTrained=!0,U&&U(),vn.abrupt("return",this.model);case 37:case"end":return vn.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"dispose",value:function(){this.model.dispose()}},{key:"mutate",value:function(){var R=this,F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:.1,I=arguments.length>1?arguments[1]:void 0;N.tidy(function(){for(var U=R.model.getWeights(),X=[],oe=0;oe<U.length;oe+=1){for(var me=U[oe],Se=U[oe].shape,Me=me.dataSync().slice(),Te=0;Te<Me.length;Te+=1)Math.random()<F&&(Me[Te]=I?I(Me[Te]):Math.min(Math.max(Me[Te]+Ug(),-1),1));var tt=N.tensor(Me,Se);X[oe]=tt}R.model.setWeights(X)})}},{key:"crossover",value:function(R){var F=this;return N.tidy(function(){for(var I=F.model.getWeights(),U=R.model.getWeights(),X=[],oe=0;oe<I.length;oe+=1){for(var me=I[oe],Se=U[oe],Me=I[oe].shape,Te=me.dataSync().slice(),tt=Se.dataSync().slice(),at=0;at<Te.length;at+=1)Math.random()<.5&&(Te[at]=tt[at]);var jt=N.tensor(Te,Me);X[oe]=jt}F.model.setWeights(X)})}}]),q}();function Wm(q,R){var F=Object.keys(q);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(q);R&&(I=I.filter(function(U){return Object.getOwnPropertyDescriptor(q,U).enumerable})),F.push.apply(F,I)}return F}function Np(q){for(var R=1;R<arguments.length;R++){var F=arguments[R]!=null?arguments[R]:{};R%2?Wm(Object(F),!0).forEach(function(I){V()(q,I,F[I])}):Object.getOwnPropertyDescriptors?Object.defineProperties(q,Object.getOwnPropertyDescriptors(F)):Wm(Object(F)).forEach(function(I){Object.defineProperty(q,I,Object.getOwnPropertyDescriptor(F,I))})}return q}var os=new(function(){function q(R){ce()(this,q),this.options=R||{}}return ke()(q,[{key:"normalizeValue",value:function(R,F,I){return(R-F)/(I-F)}},{key:"unnormalizeValue",value:function(R,F,I){return R*(I-F)+F}},{key:"getMin",value:function(R){return R.reduce(function(F,I){return Math.min(F,I)})}},{key:"getMax",value:function(R){return R.reduce(function(F,I){return Math.max(F,I)})}},{key:"isJsonOrString",value:function(R){try{JSON.parse(R)}catch{return!1}return!0}},{key:"zipArrays",value:function(R,F){return R.length!==F.length?(console.error("arrays do not have the same length"),[]):ya()(new Array(R.length).fill(null)).map(function(I,U){return Np(Np({},R[U]),F[U])})}},{key:"createLabelsFromArrayValues",value:function(R,F){var I;return Array.isArray(R)&&(I=R.map(function(U,X){return"".concat(F,"_").concat(X)})),I}},{key:"formatDataAsObject",value:function(R,F){var I={};if(Array.isArray(R))return R.forEach(function(U,X){var oe=F[X];I[oe]=U}),I;if(Ee()(R)==="object")return I=R;throw new Error("input provided is not supported or does not match your output label specifications")}},{key:"getDataType",value:function(R){var F=Ee()(R);return F==="object"&&Array.isArray(R)&&(F="array"),F}}]),q}());function hd(q,R){var F=Object.keys(q);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(q);R&&(I=I.filter(function(U){return Object.getOwnPropertyDescriptor(q,U).enumerable})),F.push.apply(F,I)}return F}function ku(q){for(var R=1;R<arguments.length;R++){var F=arguments[R]!=null?arguments[R]:{};
8257R%2?hd(Object(F),!0).forEach(function(I){V()(q,I,F[I])}):Object.getOwnPropertyDescriptors?Object.defineProperties(q,Object.getOwnPropertyDescriptors(F)):hd(Object(F)).forEach(function(I){Object.defineProperty(q,I,Object.getOwnPropertyDescriptor(F,I))})}return q}var pd=function(){function q(){ce()(this,q),this.meta={inputUnits:null,outputUnits:null,inputs:{},outputs:{},isNormalized:!1},this.isMetadataReady=!1,this.isWarmedUp=!1,this.data={raw:[]},this.createMetadata=this.createMetadata.bind(this),this.getDataStats=this.getDataStats.bind(this),this.getInputMetaStats=this.getInputMetaStats.bind(this),this.getDataUnits=this.getDataUnits.bind(this),this.getInputMetaUnits=this.getInputMetaUnits.bind(this),this.getDTypesFromData=this.getDTypesFromData.bind(this),this.addData=this.addData.bind(this),this.convertRawToTensors=this.convertRawToTensors.bind(this),this.normalizeDataRaw=this.normalizeDataRaw.bind(this),this.normalizeInputData=this.normalizeInputData.bind(this),this.normalizeArray=this.normalizeArray.bind(this),this.unnormalizeArray=this.unnormalizeArray.bind(this),this.applyOneHotEncodingsToDataRaw=this.applyOneHotEncodingsToDataRaw.bind(this),this.getDataOneHot=this.getDataOneHot.bind(this),this.getInputMetaOneHot=this.getInputMetaOneHot.bind(this),this.createOneHotEncodings=this.createOneHotEncodings.bind(this),this.loadDataFromUrl=this.loadDataFromUrl.bind(this),this.loadJSON=this.loadJSON.bind(this),this.loadCSV=this.loadCSV.bind(this),this.loadBlob=this.loadBlob.bind(this),this.loadData=this.loadData.bind(this),this.saveData=this.saveData.bind(this),this.saveMeta=this.saveMeta.bind(this),this.loadMeta=this.loadMeta.bind(this),this.findEntries=this.findEntries.bind(this),this.formatRawData=this.formatRawData.bind(this),this.csvToJSON=this.csvToJSON.bind(this)}return ke()(q,[{key:"createMetadata",value:function(R){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return this.getDTypesFromData(R),this.getDataStats(R),this.getDataOneHot(R),this.getDataUnits(R,F),this.isMetadataReady=!0,ku({},this.meta)}},{key:"getDataStats",value:function(R){var F=Object.assign({},this.meta),I=this.getInputMetaStats(R,F.inputs,"xs"),U=this.getInputMetaStats(R,F.outputs,"ys");return F.inputs=I,F.outputs=U,this.meta=ku(ku({},this.meta),F),F}},{key:"getInputMetaStats",value:function(R,F,I){var U=Object.assign({},F);return Object.keys(U).forEach(function(X){if(U[X].dtype==="string")U[X].min=0,U[X].max=1;else if(U[X].dtype==="number"){var oe=R.map(function(Se){return Se[I][X]});U[X].min=os.getMin(oe),U[X].max=os.getMax(oe)}else if(U[X].dtype==="array"){var me=R.map(function(Se){return Se[I][X]}).flat();U[X].min=os.getMin(me),U[X].max=os.getMax(me)}}),U}},{key:"getDataUnits",value:function(R){var F,I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,U=I!==null?I:void 0,X=Object.assign({},this.meta);F=U||[this.getInputMetaUnits(R,X.inputs)].flat();var oe=this.getInputMetaUnits(R,X.outputs);return X.inputUnits=F,X.outputUnits=oe,this.meta=ku(ku({},this.meta),X),X}},{key:"getInputMetaUnits",value:function(R,F){var I=0,U=Object.assign({},F);
8257return Object.entries(U).forEach(function(X){var oe=X[1].dtype;if(oe==="number")I+=1;else if(oe==="string"){var me=X[1].uniqueValues.length;I+=me}else oe==="array"&&(I=[])}),I}},{key:"getDTypesFromData",value:function(R){var F=ku(ku({},this.meta),{},{inputs:{},outputs:{}}),I=R[0],U=Object.keys(I.xs),X=Object.keys(I.ys);return U.forEach(function(oe){F.inputs[oe]={dtype:os.getDataType(I.xs[oe])}}),X.forEach(function(oe){F.outputs[oe]={dtype:os.getDataType(I.ys[oe])}}),this.meta=F,F}},{key:"addData",value:function(R,F){this.data.raw.push({xs:R,ys:F})}},{key:"convertRawToTensors",value:function(R){var F=Object.assign({},this.meta),I=R.length;return N.tidy(function(){var U=[],X=[];return R.forEach(function(oe){var me=Object.keys(F.inputs).map(function(Me){return oe.xs[Me]}).flat();U.push(me);var Se=Object.keys(F.outputs).map(function(Me){return oe.ys[Me]}).flat();X.push(Se)}),{inputs:N.tensor(U.flat(),[I].concat(ya()(F.inputUnits))),outputs:N.tensor(X.flat(),[I,F.outputUnits])}})}},{key:"normalizeDataRaw",value:function(R){var F=Object.assign({},this.meta),I=this.normalizeInputData(R,F.inputs,"xs"),U=this.normalizeInputData(R,F.outputs,"ys");return os.zipArrays(I,U)}},{key:"normalizeInputData",value:function(R,F,I){var U=this,X=R.length,oe=Object.assign({},F),me={};return Object.keys(oe).forEach(function(Se){var Me={min:oe[Se].min,max:oe[Se].max},Te=R.map(function(tt){return tt[I][Se]});oe[Se].dtype==="string"?(Me.legend=oe[Se].legend,me[Se]=U.normalizeArray(Te,Me)):oe[Se].dtype==="number"?me[Se]=U.normalizeArray(Te,Me):oe[Se].dtype==="array"&&(me[Se]=Te.map(function(tt){return U.normalizeArray(tt,Me)}))}),ya()(new Array(X).fill(null)).map(function(Se,Me){var Te=V()({},I,{});return Object.keys(oe).forEach(function(tt){Te[I][tt]=me[tt][Me]}),Te})}},{key:"normalizeArray",value:function(R,F){var I=F.min,U=F.max;if(F.legend)return R.map(function(X){return F.legend[X]?F.legend[X]:X});if(R.every(function(X){return typeof X=="number"}))return R.map(function(X){return os.normalizeValue(X,I,U)});throw new Error("error in inputArray of normalizeArray() function")}},{key:"unnormalizeArray",value:function(R,F){var I=F.min,U=F.max;if(F.legend)return R.map(function(X){var oe;return Object.entries(F.legend).forEach(function(me){var Se=me[0],Me=me[1];X.map(function(Te,tt){return Te===Me[tt]}).every(function(Te){return Te===!0})&&(oe=Se)}),oe});if(R.every(function(X){return typeof X=="number"}))return R.map(function(X){return os.unnormalizeValue(X,I,U)});throw new Error("error in inputArray of normalizeArray() function")}},{key:"applyOneHotEncodingsToDataRaw",value:function(R){var F=Object.assign({},this.meta);return R.map(function(I){var U=ku({},I.xs),X=ku({},I.ys);return Object.keys(F.inputs).forEach(function(oe){F.inputs[oe].legend&&(U[oe]=F.inputs[oe].legend[I.xs[oe]])}),Object.keys(F.outputs).forEach(function(oe){F.outputs[oe].legend&&(X[oe]=F.outputs[oe].legend[I.ys[oe]])}),{xs:U,ys:X}})}},{key:"getDataOneHot",value:function(R){var F=Object.assign({},this.meta),I=this.getInputMetaOneHot(R,F.inputs,"xs"),U=this.getInputMetaOneHot(R,F.outputs,"ys");return F.inputs=I,F.outputs=U,this.meta=ku(ku({},this.meta),F),F}},{key:"getInputMetaOneHot",value:function(R,F,I){var U=this,X=Object.assign({},F);return Object.entries(X).forEach(function(oe){var me=oe[0];if(oe[1].dtype==="string"){var Se=ya()(new Set(R.map(function(Te){return Te[I][me]}))),Me=U.createOneHotEncodings(Se);X[me]=ku(ku({},X[me]),Me)}}),X}},{key:"createOneHotEncodings",value:function(R){return N.tidy(function(){var F={uniqueValues:R,legend:{}},I=R,U=I.map(function(oe,me){return me}),X=N.oneHot(N.tensor1d(U,"int32"),I.length).arraySync();return I.forEach(function(oe,me){F.legend[oe]=X[me]}),F})}},{key:"loadDataFromUrl",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:if(me.prev=0,!I.endsWith(".csv")){me.next=7;break}return me.next=4,this.loadCSV(I,U,X);case 4:oe=me.sent,me.next=20;break;case 7:if(!I.endsWith(".json")){me.next=13;break}return me.next=10,this.loadJSON(I,U,X);case 10:oe=me.sent,me.next=20;break;case 13:if(!I.includes("blob")){me.next=19;break}return me.next=16,this.loadBlob(I,U,X);case 16:oe=me.sent,me.next=20;break;case 19:throw new Error("Not a valid data format. Must be csv or json");case 20:return me.abrupt("return",oe);case 23:throw me.prev=23,me.t0=me.catch(0),console.error(me.t0),new Error(me.t0);case 27:case"end":return me.stop()}},F,this,[[0,23]])}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"loadJSON",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se,Me;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:if(Te.prev=0,!(I instanceof Object)){Te.next=5;break}oe=Object.assign({},I),Te.next=10;break;case 5:return Te.next=7,zt.a.get(I);case 7:me=Te.sent,Se=me.data,oe=Se;case 10:return Me=this.formatRawData(oe,U,X),Te.abrupt("return",Me);case 14:throw Te.prev=14,Te.t0=Te.catch(0),console.error("error loading json"),new Error(Te.t0);case 18:case"end":return Te.stop()}},F,this,[[0,14]])}
8257));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"loadCSV",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se,Me;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return Te.prev=0,oe=N.data.csv(I),Te.next=4,oe.toArray();case 4:return me=Te.sent,Se={entries:me},Me=this.formatRawData(Se,U,X),Te.abrupt("return",Me);case 10:throw Te.prev=10,Te.t0=Te.catch(0),console.error("error loading csv",Te.t0),new Error(Te.t0);case 14:case"end":return Te.stop()}},F,this,[[0,10]])}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"loadBlob",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se,Me,Te,tt;return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:return at.prev=0,at.next=3,zt.a.get(I);case 3:if(oe=at.sent,me=oe.data,Se=me,!os.isJsonOrString(Se)){at.next=13;break}return Te=JSON.parse(Se),at.next=10,this.loadJSON(Te,U,X);case 10:Me=at.sent,at.next=17;break;case 13:return tt=this.csvToJSON(Se),at.next=16,this.loadJSON(tt,U,X);case 16:Me=at.sent;case 17:return at.abrupt("return",Me);case 20:throw at.prev=20,at.t0=at.catch(0),console.log("mmm might be passing in a string or something!",at.t0),new Error(at.t0);case 24:case"end":return at.stop()}},F,this,[[0,20]])}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"loadData",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me,Se,Me=arguments;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:if(I=Me.length>0&&Me[0]!==void 0?Me[0]:null,U=Me.length>1?Me[1]:void 0,Te.prev=2,typeof I=="string"){Te.next=17;break}if(oe=I[0],new FileReader().readAsText(oe),!oe.name.includes(".json")){Te.next=14;break}return Te.next=10,oe.text();case 10:me=Te.sent,X=JSON.parse(me),Te.next=15;break;case 14:console.log('data must be a json object containing an array called "data" or "entries');case 15:Te.next=22;break;case 17:return Te.next=19,zt.a.get(I,{responseType:"text"});case 19:X=Te.sent,Se=JSON.stringify(X.data),os.isJsonOrString(Se)?X=JSON.parse(Se):console.log("Whoops! something went wrong. Either this kind of data is not supported yet or there is an issue with .loadData");case 22:this.data.raw=this.findEntries(X),!this.data.raw.length>0&&console.log('data must be a json object containing an array called "data" '),U&&U(),Te.next=30;break;case 27:throw Te.prev=27,Te.t0=Te.catch(2),new Error(Te.t0);case 30:case"end":return Te.stop()}},F,this,[[2,27]])}));return function(){return R.apply(this,arguments)}}()},{key:"saveData",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return U=new Date,X="".concat(String(U.getFullYear()),"-").concat(String(U.getMonth()+1),"-").concat(String(U.getDate())),oe="".concat(String(U.getHours()),"-").concat(String(U.getMinutes()),"-").concat(String(U.getSeconds())),me="".concat(X,"_").concat(oe),Se=me,I&&(Se=I),Me={data:this.data.raw},Te.next=9,Yr(JSON.stringify(Me),"".concat(Se,".json"),"text/plain");case 9:case"end":return Te.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"saveMeta",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:return typeof I=="function"?(X="model",oe=I):typeof I=="string"?(X=I,typeof U=="function"&&(oe=U)):X="model",me.next=3,Yr(JSON.stringify(this.meta),"".concat(X,"_meta.json"),"text/plain");case 3:oe&&oe();case 4:case"end":return me.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"loadMeta",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me,Se,Me,Te=arguments;return be.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:if(I=Te.length>0&&Te[0]!==void 0?Te[0]:null,U=Te.length>1?Te[1]:void 0,!(I instanceof FileList)){tt.next=10;break}return tt.next=5,Promise.all(Array.from(I).map(function(){var at=K()(be.a.mark(function jt($t){var vn;return be.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:if(!$t.name.includes(".json")||$t.name.includes("_meta")){wn.next=4;break}return wn.abrupt("return",{name:"model",file:$t});case 4:if(!$t.name.includes(".json")||!$t.name.includes("_meta.json")){wn.next=11;break}return wn.next=7,$t.text();case 7:return vn=wn.sent,wn.abrupt("return",{name:"metadata",file:vn});case 11:if(!$t.name.includes(".bin")){wn.next=13;break}return wn.abrupt("return",{name:"weights",file:$t});case 13:return wn.abrupt("return",{name:null,file:null});case 14:case"end":return wn.stop()}},jt)}));
8257return function(jt){return at.apply(this,arguments)}}()));case 5:X=tt.sent,oe=JSON.parse(X.find(function(at){return at.name==="metadata"}).file),this.meta=oe,tt.next=25;break;case 10:if(!(I instanceof Object)){tt.next=19;break}return tt.next=13,zt.a.get(I.metadata,{responseType:"text"});case 13:me=tt.sent,me=JSON.stringify(me.data),me=JSON.parse(me),this.meta=me,tt.next=25;break;case 19:return Se="".concat(I.substring(0,I.lastIndexOf("/")),"/model_meta.json"),tt.next=22,zt.a.get(Se);case 22:Me=(Me=tt.sent).data,this.meta=Me;case 25:return this.isMetadataReady=!0,this.isWarmedUp=!0,U&&U(),tt.abrupt("return",this.meta);case 29:case"end":return tt.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"formatRawData",value:function(R,F,I){var U=this.findEntries(R);!U.length>0&&console.log(`your data must be contained in an array in 8258 8259 a property called 'entries' or 'data' of your json object`);var X=U.map(function(oe,me){var Se={xs:{},ys:{}};return F.forEach(function(Me){oe[Me]!==void 0?Se.xs[Me]=oe[Me]:console.error("the input label ".concat(Me," does not exist at row ").concat(me))}),I.forEach(function(Me){oe[Me]!==void 0?Se.ys[Me]=oe[Me]:console.error("the output label ".concat(Me," does not exist at row ").concat(me))}),Se});return this.data.raw=X,X}},{key:"csvToJSON",value:function(R){for(var F=R.split(` 8260`),I=[],U=F[0].split(","),X=function(me){var Se={},Me=F[me].split(",");U.forEach(function(Te,tt){Se[Te]=Me[tt]}),I.push(Se)},oe=1;oe<F.length;oe+=1)X(oe);return{entries:I}}},{key:"findEntries",value:function(R){var F=this,I=Object.assign({},R);return I.entries&&I.entries instanceof Array?I.entries:I.data&&I.data instanceof Array?I.data:(Object.keys(I).forEach(function(U){if(Ee()(I[U])==="object")return F.findEntries(I[U])}),I)}},{key:"getData",value:function(){return this.data.raw}}]),q}();function ph(q,R){var F=Object.keys(q);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(q);R&&(I=I.filter(function(U){return Object.getOwnPropertyDescriptor(q,U).enumerable})),F.push.apply(F,I)}return F}var Ip=function(){function q(){ce()(this,q),this.config={height:300}}return ke()(q,[{key:"modelSummary",value:function(R,F){var I=function(U){for(var X=1;X<arguments.length;X++){var oe=arguments[X]!=null?arguments[X]:{};X%2?ph(Object(oe),!0).forEach(function(me){V()(U,me,oe[me])}):Object.getOwnPropertyDescriptors?Object.defineProperties(U,Object.getOwnPropertyDescriptors(oe)):ph(Object(oe)).forEac
8260h(function(me){Object.defineProperty(U,me,Object.getOwnPropertyDescriptor(oe,me))})}return U}({},R);ee.show.modelSummary(I,F)}},{key:"scatterplot",value:function(R,F,I){var U=I.map(function(oe){return{x:oe.xs[R],y:oe.ys[F]}}),X={xLabel:"X",yLabel:"Y",height:this.config.height};ee.render.scatterplot({name:"debug mode"},U,X)}},{key:"scatterplotAll",value:function(R,F,I){var U=[];R.forEach(function(oe){F.forEach(function(me){var Se=I.map(function(Me){return{x:Me.xs[oe],y:Me.ys[me]}});U=[].concat(ya()(U),ya()(Se))})});var X={xLabel:"X",yLabel:"Y",height:this.config.height};ee.render.scatterplot({name:"debug mode"},U,X)}},{key:"barchart",value:function(R,F,I){var U=I.map(function(oe){return{value:oe.xs[R],index:oe.ys[F]}}),X={xLabel:"label",yLabel:"value",height:this.config.height};console.log(X),ee.render.barchart({name:"Bar chart"},U)}},{key:"trainingVis",value:function(){return ee.show.fitCallbacks({name:"Training Performance"},["loss","accuracy"],{height:this.config.height,callbacks:["onEpochEnd"]})}}]),q}();function Vm(q,R){var F=Object.keys(q);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(q);R&&(I=I.filter(function(U){return Object.getOwnPropertyDescriptor(q,U).enumerable})),F.push.apply(F,I)}return F}function mh(q){for(var R=1;R<arguments.length;R++){var F=arguments[R]!=null?arguments[R]:{};R%2?Vm(Object(F),!0).forEach(function(I){V()(q,I,F[I])}):Object.getOwnPropertyDescriptors?Object.defineProperties(q,Object.getOwnPropertyDescriptors(F)):Vm(Object(F)).forEach(function(I){Object.defineProperty(q,I,Object.getOwnPropertyDescriptor(F,I))})}return q}var md={inputs:[],outputs:[],dataUrl:null,modelUrl:null,layers:[],task:null,debug:!1,learningRate:.2,hiddenUnits:16,noTraining:!1},$m=function(){function q(R,F){ce()(this,q),this.callback=F,R.task==="imageClassification"&&(md.learningRate=.02),this.options=mh(mh({},md),R)||md,this.neuralNetwork=new Ef,this.neuralNetworkData=new pd,this.neuralNetworkVis=new Ip,this.data={training:[]},this.ready=!1,this.init=this.init.bind(this),this.addData=this.addData.bind(this),this.loadDataFromUrl=this.loadDataFromUrl.bind(this),this.loadDataInternal=this.loadDataInternal.bind(this),this.createMetaData=this.createMetaData.bind(this),this.prepareForTraining=this.prepareForTraining.bind(this),this.normalizeData=this.normalizeData.bind(this),this.normalizeInput=this.normalizeInput.bind(this),this.searchAndFormat=this.searchAndFormat.bind(this),this.formatInputItem=this.formatInputItem.bind(this),this.convertTrainingDataToTensors=this.convertTrainingDataToTensors.bind(this),this.formatInputsForPrediction=this.formatInputsForPrediction.bind(this),this.formatInputsForPredictionAll=this.formatInputsForPredictionAll.bind(this),this.isOneHotEncodedOrNormalized=this.isOneHotEncodedOrNormalized.bind(this),this.train=this.train.bind(this),this.trainInternal=this.trainInternal.bind(this),this.addLayer=this.addLayer.bind(this),this.createNetworkLayers=this.createNetworkLayers.bind(this),this.addDefaultLayers=this.addDefaultLayers.bind(this),this.compile=this.compile.bind(this),this.predict=this.predict.bind(this),this.predictMultiple=this.predictMultiple.bind(this),this.classify=this.classify.bind(this),this.classifyMultiple=this.classifyMultiple.bind(this),this.predictInternal=this.predictInternal.bind(this),this.classifyInternal=this.classifyInternal.bind(this),this.saveData=this.saveData.bind(this),this.loadData=this.loadData.bind(this),this.save=this.save.bind(this),this.load=this.load.bind(this),this.dispose=this.dispose.bind(this),this.mutate=this.mutate.bind(this),this.crossover=this.crossover.bind(this),this.init(this.callback)}return ke()(q,[{key:"init",value:function(R){this.options.noTraining===!0&&this.createLayersNoTraining(),this.options.dataUrl!==null?this.ready=this.loadDataFromUrl(this.options,R):this.options.modelUrl!==null?this.ready=this.load(this.options.modelUrl,R):this.ready=!0}},{key:"createLayersNoTraining",value:function(){var R=this.options,F=R.inputs,I=R.outputs;if(R.task==="classification")for(var U=0;U<I.length;U+=1){var X=new Array(F).fill(0);this.addData(X,[I[U]])}else{var oe=new Array(F).fill(0),me=new Array(I).fill(0);this.addData(oe,me)}this.neuralNetworkData.createMetadata(this.neuralNetworkData.data.raw),this.addDefaultLayers(this.options.task,this.neuralNetworkData.meta)}},{key:"copy",value:function(){var R=this,F=new q(this.options);return N.tidy(function(){for(var I=R.neuralNetwork.model.getWeights(),U=[],X=0;X<I.length;X+=1)U[X]=I[X].clone();return F.neuralNetwork.model.setWeights(U),F}
8260)}},{key:"addData",value:function(R,F){var I,U,X=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,oe=this.options,me=oe.inputs,Se=oe.outputs;if(X!==null?(I=X.inputLabels,U=X.outputLabels):me.length>0&&Se.length>0?(me.every(function(at){return typeof at=="string"})&&(I=me),Se.every(function(at){return typeof at=="string"})&&(U=Se)):Ee()(R)==="object"&&Ee()(F)==="object"?(I=Object.keys(R),U=Object.keys(F)):(I=os.createLabelsFromArrayValues(R,"input"),U=os.createLabelsFromArrayValues(F,"output")),!(I instanceof Array))throw new Error("inputLabels must be an array");if(!(U instanceof Array))throw new Error("outputLabels must be an array");var Me=this.searchAndFormat(R),Te=os.formatDataAsObject(Me,I),tt=os.formatDataAsObject(F,U);this.neuralNetworkData.addData(Te,tt)}},{key:"loadDataFromUrl",value:function(R,F){return $e(this.loadDataInternal(R),F)}},{key:"loadDataInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return U=I.dataUrl,X=I.inputs,oe=I.outputs,Se.next=3,this.neuralNetworkData.loadDataFromUrl(U,X,oe);case 3:me=Se.sent,this.createMetadata(me),this.prepareForTraining(me);case 6:case"end":return Se.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"createMetaData",value:function(R){var F,I=this.options.inputs;Array.isArray(I)&&I.length>0&&(F=I.every(function(U){return typeof U=="number"})&&I.length>0?I:null),this.neuralNetworkData.createMetadata(R,F)}},{key:"prepareForTraining",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,F=R===null?this.neuralNetworkData.data.raw:R,I=this.neuralNetworkData.applyOneHotEncodingsToDataRaw(F);return this.data.training=I,this.neuralNetworkData.isWarmedUp=!0,I}},{key:"normalizeData",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,F=R===null?this.neuralNetworkData.data.raw:R;this.neuralNetworkData.isMetadataReady||this.createMetaData(F),this.neuralNetworkData.isWarmedUp||this.prepareForTraining(F);var I=this.neuralNetworkData.normalizeDataRaw(F);return this.data.training=I,this.neuralNetworkData.meta.isNormalized=!0,I}},{key:"normalizeInput",value:function(R,F,I){var U=I[F],X=U.min,oe=U.max;return os.normalizeValue(R,X,oe)}},{key:"searchAndFormat",value:function(R){var F,I=this;if(Array.isArray(R))F=R.map(function(X){return I.formatInputItem(X)});else if(Ee()(R)==="object"){var U=Object.assign({},R);Object.keys(R).forEach(function(X){var oe=R[X];U[X]=I.formatInputItem(oe)}),F=U}return F}},{key:"formatInputItem",value:function(R){var F;return Fn(R)?F=R:Ee()(R)==="object"&&Fn(R.elt)?F=R.elt:Ee()(R)==="object"&&Fn(R.canvas)&&(F=R.canvas),F?Ar(F):R}},{key:"convertTrainingDataToTensors",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,I=R===null?this.data.training:R,U=F===null?this.neuralNetworkData.meta:F;return this.neuralNetworkData.convertRawToTensors(I,U)}},{key:"formatInputsForPrediction",value:function(R,F,I){var U=this,X=[];return R instanceof Array?X=I.map(function(oe,me){return U.isOneHotEncodedOrNormalized(R[me],oe,F.inputs)}):R instanceof Object&&(X=I.map(function(oe){return U.isOneHotEncodedOrNormalized(R[oe],oe,F.inputs)})),X=X.flat()}},{key:"formatInputsForPredictionAll",value:function(R,F,I){var U,X=this;return R instanceof Array&&R.every(function(oe){return Array.isArray(oe)})?(U=R.map(function(oe){return X.formatInputsForPrediction(oe,F,I)}),N.tensor(U,[R.length,I.length])):(U=this.formatInputsForPrediction(R,F,I),N.tensor([U]))}},{key:"isOneHotEncodedOrNormalized",value:function(R,F,I){var U,X=R,oe=F;return typeof R!="number"?U=I[oe].legend[X]:(U=R,this.neuralNetworkData.meta.isNormalized&&(U=this.normalizeInput(R,oe,I))),U}},{key:"train",value:function(R,F,I){var U,X,oe;Ee()(R)==="object"&&typeof F=="function"&&typeof I=="function"?(U=R,X=F,oe=I):Ee()(R)==="object"&&typeof F=="function"?(U=R,X=null,oe=F):typeof R=="function"&&typeof F=="function"?(U={},X=R,oe=F):(U={},X=null,oe=R),this.trainInternal(U,X,oe)}},{key:"trainInternal",value:function(R,F,I){var U=mh({epochs:10,batchSize:32,validationSplit:.1,whileTraining:null},R);if(this.options.debug===!0||this.options.debug==="true"?U.whileTraining=[this.neuralNetworkVis.trainingVis(),{onEpochEnd:F}
8260]:U.whileTraining=[{onEpochEnd:F}],this.neuralNetworkData.isMetadataReady||this.createMetaData(this.neuralNetworkData.data.raw),this.neuralNetworkData.isWarmedUp||this.prepareForTraining(this.neuralNetworkData.data.raw),!U.inputs&&!U.outputs){var X=this.convertTrainingDataToTensors(),oe=X.inputs,me=X.outputs;U.inputs=oe,U.outputs=me}this.neuralNetwork.isLayered||(this.options.layers=this.createNetworkLayers(this.options.layers,this.neuralNetworkData.meta)),this.neuralNetwork.isLayered||(this.options.layers=this.addDefaultLayers(this.options.task,this.neuralNetworkData.meta)),this.neuralNetwork.isCompiled||this.compile(),this.neuralNetwork.train(U,I)}},{key:"addLayer",value:function(R){this.neuralNetwork.addLayer(R)}},{key:"createNetworkLayers",value:function(R,F){var I=this,U=ya()(R),X=Object.assign({},F),oe=X.inputUnits,me=X.outputUnits,Se=U.length;if(!(U.length>=2))return!1;U[0].inputShape=U[0].inputShape?U[0].inputShape:oe;var Me=U[Se-1];return Me.units=Me.units?Me.units:me,U.forEach(function(Te){I.addLayer(N.layers[Te.type](Te))}),U}},{key:"addDefaultLayers",value:function(R,F){var I;switch(R.toLowerCase()){case"classification":return I=[{type:"dense",units:this.options.hiddenUnits,activation:"relu"},{type:"dense",activation:"softmax"}],this.createNetworkLayers(I,F);case"regression":return I=[{type:"dense",units:this.options.hiddenUnits,activation:"relu"},{type:"dense",activation:"sigmoid"}],this.createNetworkLayers(I,F);case"imageclassification":return I=[{type:"conv2d",filters:8,kernelSize:5,strides:1,activation:"relu",kernelInitializer:"varianceScaling"},{type:"maxPooling2d",poolSize:[2,2],strides:[2,2]},{type:"conv2d",filters:16,kernelSize:5,strides:1,activation:"relu",kernelInitializer:"varianceScaling"},{type:"maxPooling2d",poolSize:[2,2],strides:[2,2]},{type:"flatten"},{type:"dense",kernelInitializer:"varianceScaling",activation:"softmax"}],this.createNetworkLayers(I,F);default:return console.log("no imputUnits or outputUnits defined"),I=[{type:"dense",units:this.options.hiddenUnits,activation:"relu"},{type:"dense",activation:"sigmoid"}],this.createNetworkLayers(I,F)}}},{key:"compile",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,I=F===null?this.options.learningRate:F,U={};R!==null?U=mh({},R):this.options.task==="classification"||this.options.task==="imageClassification"?U={loss:"categoricalCrossentropy",optimizer:N.train.sgd,metrics:["accuracy"]}:this.options.task==="regression"&&(U={loss:"meanSquaredError",optimizer:N.train.adam,metrics:["accuracy"]}),U.optimizer=U.optimizer?this.neuralNetwork.setOptimizerFunction(I,U.optimizer):this.neuralNetwork.setOptimizerFunction(I,N.train.sgd),this.neuralNetwork.compile(U),this.options.debug&&this.neuralNetworkVis.modelSummary({name:"Model Summary"},this.neuralNetwork.model)}},{key:"predictSync",value:function(R){return this.predictSyncInternal(R)}},{key:"predict",value:function(R,F){return $e(this.predictInternal(R),F)}},{key:"predictMultiple",value:function(R,F){return $e(this.predictInternal(R),F)}},{key:"classifySync",value:function(R){return this.classifySyncInternal(R)}},{key:"classify",value:function(R,F){return $e(this.classifyInternal(R),F)}},{key:"classifyMultiple",value:function(R,F){return $e(this.classifyInternal(R),F)}},{key:"predictSyncInternal",value:function(R){var F=this.neuralNetworkData.meta,I=Object.keys(F.inputs),U=this.formatInputsForPredictionAll(R,F,I),X=this.neuralNetwork.predictSync(U);if(U.dispose(),F!==null){var oe=Object.keys(F.outputs),me=X.map(function(Se){return oe.map(function(Me,Te){var tt,at,jt;if(F.isNormalized){var $t=F.outputs[Me],vn=$t.min,wn=$t.max;at=os.unnormalizeValue(Se[Te],vn,wn),jt=Se[Te]}else at=Se[Te];var Nn=(tt={},V()(tt,oe[Te],at),V()(tt,"label",Me),V()(tt,"value",at),tt);return jt&&(Nn.unNormalizedValue=jt),Nn})});return me.length<2?me[0]:me}return X}},{key:"predictInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return U=this.neuralNetworkData.meta,X=Object.keys(U.inputs),oe=this.formatInputsForPredictionAll(I,U,X),Te.next=5,this.neuralNetwork.predict(oe);case 5:if(me=Te.sent,oe.dispose(),U===null){Te.next=13;break}if(Se=Object.keys(U.outputs),!((Me=me.map(function(tt){return Se.map(function(at,jt){var $t,vn,wn;if(U.isNormalized){var Nn=U.outputs[at],In=Nn.min,Ln=Nn.max;vn=os.unnormalizeValue(tt[jt],In,Ln),wn=tt[jt]}else vn=tt[jt];var qn=($t={},V()($t,Se[jt],vn),V()($t,"label",at),V()($t,"value",vn),$t);return wn&&(qn.unNormalizedValue=wn),qn})})).length<2)){Te.next=12;break}return Te.abrupt("return",Me[0]);case 12:return Te.abrupt("return",Me);case 13:return Te.abrupt("return",me);case 14:case"end":return Te.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"classifySyncInternal",value:function(R){var F,I=this.neuralNetworkData.meta,U=Object.keys(I.inputs);if(this.options.task==="imageClassification"){if(F=this.searchAndFormat(R),F=Array.isArray(F)?F.flat():F[U[0]],I.isNormalized){var X=I.inputs[U[0]],oe=X.min,me=X.max;F=this.neuralNetworkData.normalizeArray(Array.from(F),{min:oe,max:me})}else F=Array.from(F);F=N.tensor([F],[1].concat(ya()(I.inputUnits)))}else F=this.formatInputsForPredictionAll(R,I,U);var Se=this.neuralNetwork.classifySync(F);if(F.dispose(),I!==null){var Me=Object.keys(I.outputs)[0],Te=Object.entries(I.outputs[Me].legend),tt=Se.map(function(at){return Te.map(function(jt,$t){var vn;return vn={},V()(vn,jt[0],at[$t]),V()(vn,"label",jt[0]),V()(vn,"confidence",at[$t]),vn}).sort(function(jt,$t){return $t.confidence-jt.confidence})});return tt.length<2?tt[0]:tt}return Se}},{key:"classifyInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me,Se,Me,Te,tt,at,jt;return be.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:return U=this.neuralNetworkData.meta,X=Object.keys(U.inputs),this.options.task==="imageClassification"?(oe=this.searchAndFormat(I),oe=Array.isArray(oe)?oe.flat():oe[X[0]],U.isNormalized?(me=U.inputs[X[0]],Se=me.min,Me=me.max,oe=this.neuralNetworkData.normalizeArray(Array.from(oe),{min:Se,max:Me})):oe=Array.from(oe),oe=N.tensor([oe],[1].concat(ya()(U.inputUnits)))):oe=this.formatInputsForPredictionAll(I,U,X),$t.next=5,this.neuralNetwork.classify(oe);case 5:if(Te=$t.sent,oe.dispose(),U===null){$t.next=14;break}if(tt=Object.keys(U.outputs)[0],at=Object.entries(U.outputs[tt].legend),!((jt=Te.map(function(vn){return at.map(function(wn,Nn){var In;return In={},V()(In,wn[0],vn[Nn]),V()(In,"label",wn[0]),V()(In,"confidence",vn[Nn]),In}).sort(function(wn,Nn){return Nn.confidence-wn.confidence})})).length<2)){$t.next=13;break}return $t.abrupt("return",jt[0]);case 13:return $t.abrupt("return",jt);case 14:return $t.abrupt("return",Te);case 15:case"end":return $t.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"saveData",value:function(R){this.neuralNetworkData.saveData(R)}},{key:"loadData",value:function(){var R=K()(be.a.mark(function F(){var I,U,X=arguments;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:I=X.length>0&&X[0]!==void 0?X[0]:null,U=X.length>1?X[1]:void 0,this.neuralNetworkData.loadData(I,U);case 3:case"end":return oe.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"save",value:function(R,F){var I,U,X=this;
8260typeof R=="function"?(I="model",U=R):typeof R=="string"?(I=R,typeof F=="function"&&(U=F)):I="model",this.neuralNetwork.save(I,function(){X.neuralNetworkData.saveMeta(I,U)})}},{key:"load",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe=this,me=arguments;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:I=me.length>0&&me[0]!==void 0?me[0]:null,(U=me.length>1?me[1]:void 0)&&(X=U),this.neuralNetwork.load(I,function(){return oe.neuralNetworkData.loadMeta(I,X),oe.neuralNetwork.model});case 4:case"end":return Se.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"dispose",value:function(){this.neuralNetwork.dispose()}},{key:"mutate",value:function(R,F){this.neuralNetwork.mutate(R,F)}},{key:"crossover",value:function(R){var F=this.copy();return F.neuralNetwork.crossover(R.neuralNetwork),F}}]),q}(),Hm=function(q,R,F){var I,U;return q instanceof Object?(I=q,U=R):(I={inputs:q,outputs:R},U=F),new $m(I,U)},gn=n(3);function Hu(q,R,F){if(F===void 0&&(F=!1),q.beginPath(),R.slice(1).forEach(function(X,oe){var me=X.x,Se=X.y,Me=R[oe];q.moveTo(Me.x,Me.y),q.lineTo(me,Se)}),F){var I=R[R.length-1],U=R[0];if(!I||!U)return;q.moveTo(I.x,I.y),q.lineTo(U.x,U.y)}q.stroke()}var Yn=n(5),Eu=function(){function q(R,F){if(!rl(R)||!rl(F))throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have "+JSON.stringify({width:R,height:F}));this._width=R,this._height=F}return Object.defineProperty(q.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),q.prototype.reverse=function(){return new q(1/this.width,1/this.height)},q}();function Oo(q,R){return q instanceof gn.Tensor&&q.shape.length===R}function gd(q){return Oo(q,1)}function gh(q){return Oo(q,2)}function fr(q){return Oo(q,3)}function js(q){return Oo(q,4)}function as(q){return q%1!=0}function ho(q){return q%2==0}function Mc(q,R){R===void 0&&(R=2);var F=Math.pow(10,R);return Math.floor(q*F)/F}function El(q){return q&&q.width&&q.height}function qu(q,R){var F=q.width,I=q.height,U=R/Math.max(I,F);return new Eu(Math.round(F*U),Math.round(I*U))}function Cl(q){return q.reduce(function(R,F){return R.add(F)},new Mo(0,0)).div(new Mo(q.length,q.length))}function Oa(q,R,F){return Array(q).fill(0).map(function(I,U){return R+U*F})}function rl(q){return!!q&&q!==1/0&&q!==-1/0&&!isNaN(q)||q===0}function Gu(q){return rl(q)&&0<=q&&q<=1}var Mo=function(){function q(R,F){this._x=R,this._y=F}return Object.defineProperty(q.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),q.prototype.add=function(R){return new q(this.x+R.x,this.y+R.y)},q.prototype.sub=function(R){return new q(this.x-R.x,this.y-R.y)},q.prototype.mul=function(R){return new q(this.x*R.x,this.y*R.y)},q.prototype.div=function(R){return new q(this.x/R.x,this.y/R.y)},q.prototype.abs=function(){return new q(Math.abs(this.x),Math.abs(this.y))},q.prototype.magnitude=function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},q.prototype.floor=function(){return new q(Math.floor(this.x),Math.floor(this.y))},q}(),tu=function(){function q(R,F){F===void 0&&(F=!0);var I=R||{},U=[I.left,I.top,I.right,I.bottom].every(rl),X=[I.x,I.y,I.width,I.height].every(rl);if(!X&&!U)throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have "+JSON.stringify(I));var oe=X?[I.x,I.y,I.width,I.height]:[I.left,I.top,I.right-I.left,I.bottom-I.top],me=oe[0],Se=oe[1],Me=oe[2],Te=oe[3];q.assertIsValidBox({x:me,y:Se,width:Me,height:Te},"Box.constructor",F),this._x=me,this._y=Se,this._width=Me,this._height=Te}return q.isRect=function(R){return!!R&&[R.x,R.y,R.width,R.height].every(rl)},q.assertIsValidBox=function(R,F,I){if(I===void 0&&(I=!1),!q.isRect(R))throw new Error(F+" - invalid box: "+JSON.stringify(R)+", expected object with properties x, y, width, height");if(!I&&(R.width<0||R.height<0))throw new Error(F+" - width ("+R.width+") and height ("+R.height+") must be positive numbers")},Object.defineProperty(q.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"topLeft",{get:function(){return new Mo(this.left,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"topRight",{get:function(){return new Mo(this.right,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"bottomLeft",{get:function(){return new Mo(this.left,this.bottom)},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"bottomRight",{get:function(){return new Mo(this.right,this.bottom)},enumerable:!0,configurable:!0}),q.prototype.round=function(){var R=[this.x,this.y,this.width,this.height].map(function(F){return Math.round(F)});return new q({x:R[0],y:R[1],width:R[2],height:R[3]})},q.prototype.floor=function(){var R=[this.x,this.y,this.width,this.height].map(function(F){return Math.floor(F)});return new q({x:R[0],y:R[1],width:R[2],height:R[3]})},q.prototype.toSquare=function(){var R=this.x,F=this.y,I=this.width,U=this.height,X=Math.abs(I-U);return I<U&&(R-=X/2,I+=X),U<I&&(F-=X/2,U+=X),new q({x:R,y:F,width:I,height:U})},q.prototype.rescale=function(R){var F=El(R)?R.width:R,I=El(R)?R.height:R;return new q({x:this.x*F,y:this.y*I,width:this.width*F,height:this.height*I})},q.prototype.pad=function(R,F){var I=[this.x-R/2,this.y-F/2,this.width+R,this.height+F];return new q({x:I[0],y:I[1],width:I[2],height:I[3]})},q.prototype.clipAtImageBorders=function(R,F){var I=this.x,U=this.y,X=this.right,oe=this.bottom,me=Math.max(I,0),Se=Math.max(U,0),Me=X-me,Te=oe-Se;return new q({x:me,y:Se,width:Math.min(Me,R-me),height:Math.min(Te,F-Se)}).floor()},q.prototype.shift=function(R,F){var I=this.width,U=this.height;return new q({x:this.x+R,y:this.y+F,width:I,height:U})},q.prototype.padAtBorders=function(R,F){var I=this.width+1,U=this.height+1,X=I,oe=U,me=this.left,Se=this.top,Me=this.right,Te=this.bottom;return Me>F&&(X=-Me+F+I,Me=F),Te>R&&(oe=-Te+R+U,Te=R),me<1&&(oe=2-me,me=1),Se<1&&(oe=2-Se,Se=1),{dy:1,edy:oe,dx:1,edx:X,y:Se,ey:Te,x:me,ex:Me,w:I,h:U}},q.prototype.calibrate=function(R){return new q({left:this.left+R.left*this.width,top:this.top+R.top*this.height,right:this.right+R.right*this.width,bottom:this.bottom+R.bottom*this.height}
8260).toSquare().round()},q}(),ps=function(q){function R(F,I,U,X,oe){return oe===void 0&&(oe=!1),q.call(this,{left:F,top:I,right:U,bottom:X},oe)||this}return Object(Yn.c)(R,q),R}(tu),nu=function(){function q(R,F,I,U,X){this._imageDims=new Eu(X.width,X.height),this._score=R,this._classScore=F,this._className=I,this._box=new tu(U).rescale(this._imageDims)}return Object.defineProperty(q.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"className",{get:function(){return this._className},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"box",{get:function(){return this._box},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"imageDims",{get:function(){return this._imageDims},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"imageWidth",{get:function(){return this.imageDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"imageHeight",{get:function(){return this.imageDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"relativeBox",{get:function(){return new tu(this._box).rescale(this.imageDims.reverse())},enumerable:!0,configurable:!0}),q.prototype.forSize=function(R,F){return new q(this.score,this.classScore,this.className,this.relativeBox,{width:R,height:F})},q}(),Da=function(q){function R(F,I,U){return q.call(this,F,F,"",I,U)||this}return Object(Yn.c)(R,q),R.prototype.forSize=function(F,I){var U=q.prototype.forSize.call(this,F,I);return new R(U.score,U.relativeBox,U.imageDims)},R}(nu);function Ku(q,R,F){F===void 0&&(F=!0);var I=Math.max(0,Math.min(q.right,R.right)-Math.max(q.left,R.left))*Math.max(0,Math.min(q.bottom,R.bottom)-Math.max(q.top,R.top));return F?I/(q.area+R.area-I):I/Math.min(q.area,R.area)}function Fc(q){var R=q.map(function(me){return me.x}),F=q.map(function(me){return me.y}),I=R.reduce(function(me,Se){return Se<me?Se:me},1/0),U=F.reduce(function(me,Se){return Se<me?Se:me},1/0),X=R.reduce(function(me,Se){return me<Se?Se:me},0),oe=F.reduce(function(me,Se){return me<Se?Se:me},0);return new ps(I,U,X,oe)}function il(q,R,F,I){I===void 0&&(I=!0);for(var U=R.map(function(me,Se){return{score:me,boxIndex:Se}}).sort(function(me,Se){return me.score-Se.score}).map(function(me){return me.boxIndex}),X=[],oe=function(){var me=U.pop();X.push(me);for(var Se=U,Me=[],Te=0;Te<Se.length;Te++){var tt=Se[Te],at=q[me],jt=q[tt];Me.push(Ku(at,jt,I))}U=U.filter(function($t,vn){return Me[vn]<=F})};U.length>0;)oe();return X}function Sl(q,R){return gn.tidy(function(){var F=R[0],I=R[1],U=R[2],X=gn.fill(Object(Yn.e)(q.shape.slice(0,3),[1]),F),oe=gn.fill(Object(Yn.e)(q.shape.slice(0,3),[1]),I),me=gn.fill(Object(Yn.e)(q.shape.slice(0,3),[1]),U),Se=gn.concat([X,oe,me],3);return gn.sub(q,Se)})}function Rc(q,R){return R===void 0&&(R=!1),gn.tidy(function(){var F=q.shape.slice(1),I=F[0],U=F[1];if(I===U)return q;var X=Math.abs(I-U),oe=Math.round(X*(R?.5:1)),me=I>U?2:1,Se=function(at){var jt=q.shape.slice();return jt[me]=at,gn.fill(jt,0)},Me=Se(oe),Te=X-Me.shape[me],tt=[R&&Te?Se(Te):null,q,Me].filter(function(at){return!!at}).map(function(at){return at.toFloat()});return gn.concat(tt,me)})}function Cf(q){for(var R=q.slice(),F=R.length-1;F>0;F--){var I=Math.floor(Math.random()*(F+1)),U=R[F];R[F]=R[I],R[I]=U}return R}function Sf(q){return 1/(1+Math.exp(-q))}function Mp(q){return Math.log(q/(1-q))}var Af=function(q){function R(F,I,U,X,oe){return oe===void 0&&(oe=!1),q.call(this,{x:F,y:I,width:U,height:X},oe)||this}return Object(Yn.c)(R,q),R}(tu),Yu=function(){function q(R,F,I){I===void 0&&(I=new Mo(0,0));var U=F.width,X=F.height;this._imgDims=new Eu(U,X),this._shift=I,this._positions=R.map(function(oe){return oe.mul(new Mo(U,X)).add(I)})}return Object.defineProperty(q.prototype,"shift",{get:function(){return new Mo(this._shift.x,this._shift.y)},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"imageWidth",{get:function(){return this._imgDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"imageHeight",{get:function(){return this._imgDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"positions",{get:function(){return this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"relativePositions",{get:function(){var R=this;return this._positions.map(function(F){return F.sub(R._shift).div(new Mo(R.imageWidth,R.imageHeight))})},enumerable:!0,configurable:!0}),q.prototype.forSize=function(R,F){return new this.constructor(this.relativePositions,{width:R,height:F})},q.prototype.shiftBy=function(R,F){return new this.constructor(this.relativePositions,this._imgDims,new Mo(R,F))},q.prototype.shiftByPoint=function(R){return this.shiftBy(R.x,R.y)},q.prototype.align=function(R,F){if(F===void 0&&(F={}),R){var I=R instanceof Da?R.box.floor():new tu(R);return this.shiftBy(I.x,I.y).align(null,F)}var U=Object.assign({},{useDlibAlignment:!1,minBoxPadding:.2},F),X=U.useDlibAlignment,oe=U.minBoxPadding;return X?this.alignDlib():this.alignMinBbox(oe)},q.prototype.alignDlib=function(){var R=this.getRefPointsForAlignment(),F=R[0],I=R[1],U=R[2],X=function(tt){return U.sub(tt).magnitude()}
8260,oe=(X(F)+X(I))/2,me=Math.floor(oe/.45),Se=Cl(R),Me=Math.floor(Math.max(0,Se.x-.5*me)),Te=Math.floor(Math.max(0,Se.y-.43*me));return new Af(Me,Te,Math.min(me,this.imageWidth+Me),Math.min(me,this.imageHeight+Te))},q.prototype.alignMinBbox=function(R){var F=Fc(this.positions);return F.pad(F.width*R,F.height*R)},q.prototype.getRefPointsForAlignment=function(){throw new Error("getRefPointsForAlignment not implemented by base class")},q}(),Bc=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.getRefPointsForAlignment=function(){var F=this.positions;return[F[0],F[1],Cl([F[3],F[4]])]},R}(Yu),Pc=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.getJawOutline=function(){return this.positions.slice(0,17)},R.prototype.getLeftEyeBrow=function(){return this.positions.slice(17,22)},R.prototype.getRightEyeBrow=function(){return this.positions.slice(22,27)},R.prototype.getNose=function(){return this.positions.slice(27,36)},R.prototype.getLeftEye=function(){return this.positions.slice(36,42)},R.prototype.getRightEye=function(){return this.positions.slice(42,48)},R.prototype.getMouth=function(){return this.positions.slice(48,68)},R.prototype.getRefPointsForAlignment=function(){return[this.getLeftEye(),this.getRightEye(),this.getMouth()].map(Cl)},R}(Yu),lc=function(){function q(R,F){this._label=R,this._distance=F}return Object.defineProperty(q.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"distance",{get:function(){return this._distance},enumerable:!0,configurable:!0}),q.prototype.toString=function(R){return R===void 0&&(R=!0),this.label+(R?" ("+Mc(this.distance)+")":"")},q}(),Fp=function(q){function R(F,I){var U=q.call(this,F)||this;return U._label=I,U}return Object(Yn.c)(R,q),R.assertIsValidLabeledBox=function(F,I){if(tu.assertIsValidBox(F,I),!rl(F.label))throw new Error(I+" - expected property label ("+F.label+") to be a number")},Object.defineProperty(R.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),R}(tu),vh=function(){function q(R,F){if(typeof R!="string")throw new Error("LabeledFaceDescriptors - constructor expected label to be a string");if(!Array.isArray(F)||F.some(function(I){return!(I instanceof Float32Array)}))throw new Error("LabeledFaceDescriptors - constructor expected descriptors to be an array of Float32Array");this._label=R,this._descriptors=F}return Object.defineProperty(q.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"descriptors",{get:function(){return this._descriptors},enumerable:!0,configurable:!0}),q.prototype.toJSON=function(){return{label:this.label,descriptors:this.descriptors.map(function(R){return Array.from(R)})}},q.fromJSON=function(R){var F=R.descriptors.map(function(I){return new Float32Array(I)});return new q(R.label,F)},q}(),yh=function(q){function R(F,I,U,X){var oe=q.call(this,F,I)||this;return oe._score=U,oe._classScore=X,oe}return Object(Yn.c)(R,q),R.assertIsValidPredictedBox=function(F,I){if(Fp.assertIsValidLabeledBox(F,I),!Gu(F.score)||!Gu(F.classScore))throw new Error(I+" - expected properties score ("+F.score+") and ("+F.classScore+") to be a number between [0, 1]")},Object.defineProperty(R.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),R}(Fp);function vd(q){return q.detection instanceof Da}function bh(q,R){var F={detection:R};return Object.assign({},q,F)}function ae(){var q=window.fetch||function(){throw new Error("fetch - missing fetch implementation for browser environment")};return{Canvas:HTMLCanvasElement,CanvasRenderingContext2D,Image:HTMLImageElement,ImageData,Video:HTMLVideoElement,createCanvasElement:function(){return document.createElement("canvas")},createImageElement:function(){return document.createElement("img")},fetch:q,readFile:function(){throw new Error("readFile - filesystem not available for browser environment")}}}var ne=n(131),B=n(178);function H(){return typeof window=="object"&&typeof document<"u"&&typeof HTMLImageElement<"u"&&typeof HTMLCanvasElement<"u"&&typeof HTMLVideoElement<"u"&&typeof ImageData<"u"&&typeof CanvasRenderingContext2D<"u"}var ue,Le=n(177);function Qe(q){ue=q}function wt(){H()&&Qe(ae()),Object(Le.a)()&&Qe(Object(B.a)())}var qt,en={getEnv:function(){if(!ue)throw new Error("getEnv - environment is not defined, check isNodejs() and isBrowser()");return ue},setEnv:Qe,initialize:wt,createBrowserEnv:ae,createFileSystem:ne.a,createNodejsEnv:B.a,monkeyPatch:function(q){if(ue||wt(),!ue)throw new Error("monkeyPatch - environment is not defined, check isNodejs() and isBrowser()");var R=q.Canvas,F=R===void 0?ue.Canvas:R,I=q.Image,U=I===void 0?ue.Image:I;ue.Canvas=F,ue.Image=U,ue.createCanvasElement=q.createCanvasElement||function(){return new F},ue.createImageElement=q.createImageElement||function(){return new U},ue.ImageData=q.ImageData||ue.ImageData,ue.Video=q.Video||ue.Video,ue.fetch=q.fetch||ue.fetch,ue.readFile=q.readFile||ue.readFile},isBrowser:H,isNodejs:Le.a};function gt(q){return en.isNodejs()||typeof q!="string"?q:document.getElementById(q)}function Tn(q){var R=en.getEnv(),F=R.Canvas;if(q instanceof R.CanvasRenderingContext2D)return q;var I=gt(q);if(!(I instanceof F))throw new Error("resolveContext2d - expected canvas to be of instance of Canvas");var U=I.getContext("2d");if(!U)throw new Error("resolveContext2d - canvas 2d context is null");return U}wt(),function(q){q.TOP_LEFT="TOP_LEFT",q.TOP_RIGHT="TOP_RIGHT",q.BOTTOM_LEFT="BOTTOM_LEFT",q.BOTTOM_RIGHT="BOTTOM_RIGHT"}(qt||(qt={}));var Pn=function(){return function(q){q===void 0&&(q={});var R=q.anchorPosition,F=q.backgroundColor,I=q.fontColor,U=q.fontSize,X=q.fontStyle,oe=q.padding;this.anchorPosition=R||qt.TOP_LEFT,this.backgroundColor=F||"rgba(0, 0, 0, 0.5)",this.fontColor=I||"rgba(255, 255, 255, 1)",this.fontSize=U||14,this.fontStyle=X||"Georgia",this.padding=oe||4}}(),zn=function(){function q(R,F,I){I===void 0&&(I={}
vendor: 4,639 bytes, line 8260
8260),this.text=typeof R=="string"?[R]:R instanceof q?R.text:R,this.anchor=F,this.options=new Pn(I)}return q.prototype.measureWidth=function(R){var F=this.options.padding;return this.text.map(function(I){return R.measureText(I).width}).reduce(function(I,U){return I<U?U:I},0)+2*F},q.prototype.measureHeight=function(){var R=this.options,F=R.fontSize,I=R.padding;return this.text.length*F+2*I},q.prototype.getUpperLeft=function(R,F){var I=this.options.anchorPosition,U=I===qt.BOTTOM_RIGHT||I===qt.TOP_RIGHT,X=I===qt.BOTTOM_LEFT||I===qt.BOTTOM_RIGHT,oe=this.measureWidth(R),me=this.measureHeight(),Se=U?this.anchor.x-oe:this.anchor.x,Me=X?this.anchor.y-me:this.anchor.y;if(F){var Te=F.width,tt=F.height;return{x:Math.max(Math.min(Se,Te-oe),0),y:Math.max(Math.min(Me,tt-me),0)}}return{x:Se,y:Me}},q.prototype.draw=function(R){var F=gt(R),I=Tn(F),U=this.options,X=U.backgroundColor,oe=U.fontColor,me=U.fontSize,Se=U.fontStyle,Me=U.padding;I.font=me+"px "+Se;var Te=this.measureWidth(I),tt=this.measureHeight();I.fillStyle=X;var at=this.getUpperLeft(I,F);I.fillRect(at.x,at.y,Te,tt),I.fillStyle=oe,this.text.forEach(function(jt,$t){var vn=Me+at.x,wn=Me+at.y+($t+1)*me;I.fillText(jt,vn,wn)})},q}(),Jn=function(){return function(q){q===void 0&&(q={});var R=q.boxColor,F=q.lineWidth,I=q.label,U=q.drawLabelOptions;this.boxColor=R||"rgba(0, 0, 255, 1)",this.lineWidth=F||2,this.label=I;var X={anchorPosition:qt.BOTTOM_LEFT,backgroundColor:this.boxColor};this.drawLabelOptions=new Pn(Object.assign({},X,U))}}(),Vn=function(){function q(R,F){F===void 0&&(F={}),this.box=new tu(R),this.options=new Jn(F)}return q.prototype.draw=function(R){var F=Tn(R),I=this.options,U=I.boxColor,X=I.lineWidth,oe=this.box,me=oe.x,Se=oe.y,Me=oe.width,Te=oe.height;F.strokeStyle=U,F.lineWidth=X,F.strokeRect(me,Se,Me,Te);var tt=this.options.label;tt&&new zn([tt],{x:me-X/2,y:Se},this.options.drawLabelOptions).draw(R)},q}();function lr(q,R){(Array.isArray(R)?R:[R]).forEach(function(F){var I=F instanceof Da?F.score:vd(F)?F.detection.score:void 0,U=F instanceof Da?F.box:vd(F)?F.detection.box:new tu(F),X=I?""+Mc(I):void 0;new Vn(U,{label:X}).draw(q)})}function dr(q){var R=en.getEnv(),F=R.Image,I=R.Video;return q instanceof F&&q.complete||q instanceof I&&q.readyState>=3}function Tr(q){return new Promise(function(R,F){if(q instanceof en.getEnv().Canvas||dr(q))return R();function I(X){X.currentTarget&&(X.currentTarget.removeEventListener("load",I),X.currentTarget.removeEventListener("error",U),R(X))}function U(X){X.currentTarget&&(X.currentTarget.removeEventListener("load",I),X.currentTarget.removeEventListener("error",U),F(X))}q.addEventListener("load",I),q.addEventListener("error",U)})}function Hr(q){return new Promise(function(R,F){if(!(q instanceof Blob))return F("bufferToImage - expected buf to be of type: Blob");var I=new FileReader;I.onload=function(){if(typeof I.result!="string")return F("bufferToImage - expected reader.result to be a string, in onload");var U=en.getEnv().createImageElement();U.onload=function(){return R(U)},U.onerror=F,U.src=I.result},I.onerror=F,I.readAsDataURL(q)})}function oi(q){var R=en.getEnv(),F=R.Image,I=R.Video;return q instanceof F?new Eu(q.naturalWidth,q.naturalHeight):q instanceof I?new Eu(q.videoWidth,q.videoHeight):new Eu(q.width,q.height)}function Br(q){var R=q.width,F=q.height,I=(0,en.getEnv().createCanvasElement)();return I.width=R,I.height=F,I}function ui(q,R){var F=en.getEnv().ImageData;if(!(q instanceof F||dr(q)))throw new Error("createCanvasFromMedia - media has not finished loading yet");var I=R||oi(q),U=I.width,X=I.height,oe=Br({width:U,height:X});return q instanceof F?Tn(oe).putImageData(q,0,0):Tn(oe).drawImage(q,0,0,U,X),oe}function ii(q,R){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U,X,oe,me;return Object(Yn.d)(this,function(Se){switch(Se.label){case 0:return F=R||en.getEnv().createCanvasElement(),I=q.shape.slice(js(q)?1:0),U=I[0],X=I[1],oe=I[2],me=gn.tidy(function(){return q.as3D(U,X,oe).toInt()}),[4,gn.browser.toPixels(me,F)];case 1:return Se.sent(),me.dispose(),[2,F]}})})}function Ci(q){var R=en.getEnv(),F=R.Image,I=R.Canvas,U=R.Video;return q instanceof F||q instanceof I||q instanceof U}function Di(q,R,F){F===void 0&&(F=!1);var I=en.getEnv(),U=I.Image,X=I.Canvas;if(!(q instanceof U||q instanceof X))throw new Error("imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement");var oe=oi(q),me=R/Math.max(oe.height,oe.width),Se=me*oe.width,Me=me*oe.height,Te=Br({width:R,height:R}),tt=q instanceof X?q:ui(q),at=Math.abs(Se-Me)/2,jt=F&&Se<Me?at:0,$t=F&&Me<Se?at:0;return Tn(Te).drawImage(tt,jt,$t,Se,Me),Te}var si=function(){function q(R,F){var I=this;
8260if(F===void 0&&(F=!1),this._imageTensors=[],this._canvases=[],this._treatAsBatchInput=!1,this._inputDimensions=[],!Array.isArray(R))throw new Error("NetInput.constructor - expected inputs to be an Array of TResolvedNetInput or to be instanceof tf.Tensor4D, instead have "+R);this._treatAsBatchInput=F,this._batchSize=R.length,R.forEach(function(U,X){if(fr(U))return I._imageTensors[X]=U,void(I._inputDimensions[X]=U.shape);if(js(U)){var oe=U.shape[0];if(oe!==1)throw new Error("NetInput - tf.Tensor4D with batchSize "+oe+" passed, but not supported in input array");return I._imageTensors[X]=U,void(I._inputDimensions[X]=U.shape.slice(1))}var me=U instanceof en.getEnv().Canvas?U:ui(U);I._canvases[X]=me,I._inputDimensions[X]=[me.height,me.width,3]})}return Object.defineProperty(q.prototype,"imageTensors",{get:function(){return this._imageTensors},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"canvases",{get:function(){return this._canvases},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"isBatchInput",{get:function(){return this.batchSize>1||this._treatAsBatchInput},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"batchSize",{get:function(){return this._batchSize},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"inputDimensions",{get:function(){return this._inputDimensions},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"reshapedInputDimensions",{get:function(){var R=this;return Oa(this.batchSize,0,1).map(function(F,I){return R.getReshapedInputDimensions(I)})},enumerable:!0,configurable:!0}),q.prototype.getInput=function(R){return this.canvases[R]||this.imageTensors[R]},q.prototype.getInputDimensions=function(R){return this._inputDimensions[R]},q.prototype.getInputHeight=function(R){return this._inputDimensions[R][0]},q.prototype.getInputWidth=function(R){return this._inputDimensions[R][1]},q.prototype.getReshapedInputDimensions=function(R){if(typeof this.inputSize!="number")throw new Error("getReshapedInputDimensions - inputSize not set, toBatchTensor has not been called yet");return qu({width:this.getInputWidth(R),height:this.getInputHeight(R)},this.inputSize)},q.prototype.toBatchTensor=function(R,F){var I=this;return F===void 0&&(F=!0),this._inputSize=R,gn.tidy(function(){var U=Oa(I.batchSize,0,1).map(function(X){var oe=I.getInput(X);if(oe instanceof gn.Tensor){var me=js(oe)?oe:oe.expandDims();return(me=Rc(me,F)).shape[1]===R&&me.shape[2]===R||(me=gn.image.resizeBilinear(me,[R,R])),me.as3D(R,R,3)}if(oe instanceof en.getEnv().Canvas)return gn.browser.fromPixels(Di(oe,R,F));throw new Error("toBatchTensor - at batchIdx "+X+", expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have "+oe)});return gn.stack(U.map(function(X){return X.toFloat()})).as4D(I.batchSize,R,R,3)})},q}();function wi(q){return Object(Yn.b)(this,void 0,void 0,function(){var R,F,I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:if(q instanceof si)return[2,q];if(!(R=Array.isArray(q)?q:[q]).length)throw new Error("toNetInput - empty array passed as input");return F=function(X){return Array.isArray(q)?" at input index "+X+":":""}
8260,(I=R.map(gt)).forEach(function(X,oe){if(!Ci(X)&&!fr(X)&&!js(X))throw typeof R[oe]=="string"?new Error("toNetInput -"+F(oe)+" string passed, but could not resolve HTMLElement for element id "+R[oe]):new Error("toNetInput -"+F(oe)+" expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id");if(js(X)){var me=X.shape[0];if(me!==1)throw new Error("toNetInput -"+F(oe)+" tf.Tensor4D with batchSize "+me+" passed, but not supported in input array")}}),[4,Promise.all(I.map(function(X){return Ci(X)&&Tr(X)}))];case 1:return U.sent(),[2,new si(I,Array.isArray(q))]}})})}function Co(q,R){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U,X,oe,me;return Object(Yn.d)(this,function(Se){switch(Se.label){case 0:return F=en.getEnv().Canvas,I=q,q instanceof F?[3,5]:[4,wi(q)];case 1:if((U=Se.sent()).batchSize>1)throw new Error("extractFaces - batchSize > 1 not supported");return(X=U.getInput(0))instanceof F?(oe=X,[3,4]):[3,2];case 2:return[4,ii(X)];case 3:oe=Se.sent(),Se.label=4;case 4:I=oe,Se.label=5;case 5:return me=Tn(I),[2,R.map(function(Me){return Me instanceof Da?Me.forSize(I.width,I.height).box.floor():Me}).map(function(Me){return Me.clipAtImageBorders(I.width,I.height)}).map(function(Me){var Te=Me.x,tt=Me.y,at=Me.width,jt=Me.height,$t=Br({width:at,height:jt});return Tn($t).putImageData(me.getImageData(Te,tt,at,jt),0,0),$t})]}})})}function _o(q,R){return Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(F){if(!fr(q)&&!js(q))throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");if(js(q)&&q.shape[0]>1)throw new Error("extractFaceTensors - batchSize > 1 not supported");return[2,gn.tidy(function(){var I=q.shape.slice(js(q)?1:0),U=I[0],X=I[1],oe=I[2];return R.map(function(me){return me instanceof Da?me.forSize(X,U).box:me}).map(function(me){return me.clipAtImageBorders(X,U)}).map(function(me){var Se=me.x,Me=me.y,Te=me.width,tt=me.height;return gn.slice3d(q.as3D(U,X,oe),[Me,Se,0],[tt,Te,oe])})})]})})}function ba(q,R){return Object(Yn.b)(this,void 0,void 0,function(){var F;return Object(Yn.d)(this,function(I){switch(I.label){case 0:return[4,(0,en.getEnv().fetch)(q,R)];case 1:if(!((F=I.sent()).status<400))throw new Error("failed to fetch: ("+F.status+") "+F.statusText+", from url: "+F.url);return[2,F]}})})}function ro(q){return Object(Yn.b)(this,void 0,void 0,function(){var R,F;return Object(Yn.d)(this,function(I){switch(I.label){case 0:return[4,ba(q)];case 1:return[4,(R=I.sent()).blob()];case 2:if(!(F=I.sent()).type.startsWith("image/"))throw new Error("fetchImage - expected blob type to be of type image/*, instead have: "+F.type+", for url: "+R.url);return[2,Hr(F)]}})})}function So(q){return Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(R){switch(R.label){case 0:return[4,ba(q)];case 1:return[2,R.sent().json()]}})})}function ja(q){return Object(Yn.b)(this,void 0,void 0,function(){var R;return Object(Yn.d)(this,function(F){switch(F.label){case 0:return R=Float32Array.bind,[4,ba(q)];case 1:return[4,F.sent().arrayBuffer()];case 2:return[2,new(R.apply(Float32Array,[void 0,F.sent()]))]}})})}function pa(q,R){var F=R+"-weights_manifest.json";if(!q)return{modelBaseUri:"",manifestUri:F};if(q==="/")return{modelBaseUri:"/",manifestUri:"/"+F};var I=q.startsWith("http://")?"http://":q.startsWith("https://")?"https://":"",U=(q=q.replace(I,"")).split("/").filter(function(me){return me}),X=q.endsWith(".json")?U[U.length-1]:F,oe=I+(q.endsWith(".json")?U.slice(0,U.length-1):U).join("/");return{modelBaseUri:oe=q.startsWith("/")?"/"+oe:oe,manifestUri:oe==="/"?"/"+X:oe+"/"+X}}function Ta(q,R){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U,X;return Object(Yn.d)(this,function(oe){switch(oe.label){case 0:return F=pa(q,R),I=F.manifestUri,U=F.modelBaseUri,[4,So(I)];case 1:return X=oe.sent(),[2,gn.io.loadWeights(X,U)]}})})}function Zi(q,R,F){F===void 0&&(F=!1);var I=F?oi(R):R,U=I.width,X=I.height;return q.width=U,q.height=X,{width:U,height:X}}var Xi=function(){function q(R){this._name=R,this._params=void 0,this._paramMappings=[]}return Object.defineProperty(q.prototype,"params",{get:function(){return this._params},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"paramMappings",{get:function(){return this._paramMappings},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"isLoaded",{get:function(){return!!this.params},enumerable:!0,configurable:!0}),q.prototype.getParamFromPath=function(R){var F=this.traversePropertyPath(R);return F.obj[F.objProp]},q.prototype.reassignParamFromPath=function(R,F){var I=this.traversePropertyPath(R),U=I.obj,X=I.objPro
8260p;U[X].dispose(),U[X]=F},q.prototype.getParamList=function(){var R=this;return this._paramMappings.map(function(F){var I=F.paramPath;return{path:I,tensor:R.getParamFromPath(I)}})},q.prototype.getTrainableParams=function(){return this.getParamList().filter(function(R){return R.tensor instanceof gn.Variable})},q.prototype.getFrozenParams=function(){return this.getParamList().filter(function(R){return!(R.tensor instanceof gn.Variable)})},q.prototype.variable=function(){var R=this;this.getFrozenParams().forEach(function(F){var I=F.path,U=F.tensor;R.reassignParamFromPath(I,U.variable())})},q.prototype.freeze=function(){var R=this;this.getTrainableParams().forEach(function(F){var I=F.path,U=F.tensor,X=gn.tensor(U.dataSync());U.dispose(),R.reassignParamFromPath(I,X)})},q.prototype.dispose=function(R){R===void 0&&(R=!0),this.getParamList().forEach(function(F){if(R&&F.tensor.isDisposed)throw new Error("param tensor has already been disposed for path "+F.path);F.tensor.dispose()}),this._params=void 0},q.prototype.serializeParams=function(){return new Float32Array(this.getParamList().map(function(R){var F=R.tensor;return Array.from(F.dataSync())}).reduce(function(R,F){return R.concat(F)}))},q.prototype.load=function(R){return Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(F){switch(F.label){case 0:return R instanceof Float32Array?(this.extractWeights(R),[2]):[4,this.loadFromUri(R)];case 1:return F.sent(),[2]}})})},q.prototype.loadFromUri=function(R){return Object(Yn.b)(this,void 0,void 0,function(){var F;return Object(Yn.d)(this,function(I){switch(I.label){case 0:if(R&&typeof R!="string")throw new Error(this._name+".loadFromUri - expected model uri");return[4,Ta(R,this.getDefaultModelName())];case 1:return F=I.sent(),this.loadFromWeightMap(F),[2]}})})},q.prototype.loadFromDisk=function(R){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U,X,oe,me,Se,Me,Te,tt;return Object(Yn.d)(this,function(at){switch(at.label){case 0:if(R&&typeof R!="string")throw new Error(this._name+".loadFromDisk - expected model file path");return F=en.getEnv().readFile,I=pa(R,this.getDefaultModelName()),U=I.manifestUri,X=I.modelBaseUri,oe=function(jt){return Promise.all(jt.map(function($t){return F($t).then(function(vn){return vn.buffer})}))},me=gn.io.weightsLoaderFactory(oe),Te=(Me=JSON).parse,[4,F(U)];case 1:return Se=Te.apply(Me,[at.sent().toString()]),[4,me(Se,X)];case 2:return tt=at.sent(),this.loadFromWeightMap(tt),[2]}})})},q.prototype.loadFromWeightMap=function(R){var F=this.extractParamsFromWeigthMap(R),I=F.paramMappings,U=F.params;this._paramMappings=I,this._params=U},q.prototype.extractWeights=function(R){var F=this.extractParams(R),I=F.paramMappings,U=F.params;this._paramMappings=I,this._params=U},q.prototype.traversePropertyPath=function(R){if(!this.params)throw new Error("traversePropertyPath - model has no loaded params");var F=R.split("/").reduce(function(X,oe){if(!X.nextObj.hasOwnProperty(oe))throw new Error("traversePropertyPath - object does not have property "+oe+", for path "+R);return{obj:X.nextObj,objProp:oe,nextObj:X.nextObj[oe]}},{nextObj:this.params}),I=F.obj,U=F.objProp;if(!(I&&U&&I[U]instanceof gn.Tensor))throw new Error("traversePropertyPath - parameter is not a tensor, for path "+R);return{obj:I,objProp:U}},q}();function Ho(q,R,F){return gn.tidy(function(){var I=gn.separableConv2d(q,R.depthwise_filter,R.pointwise_filter,F,"same");return I=gn.add(I,R.bias)})}function Ga(q,R,F){return F===void 0&&(F=!1),gn.tidy(function(){var I=gn.relu(F?gn.add(gn.conv2d(q,R.conv0.filters,[2,2],"same"),R.conv0.bias):Ho(q,R.conv0,[2,2])),U=Ho(I,R.conv1,[1,1]),X=Ho(gn.relu(gn.add(I,U)),R.conv2,[1,1]);return gn.relu(gn.add(I,gn.add(U,X)))})}function Qa(q,R,F,I){return F===void 0&&(F=!1),I===void 0&&(I=!0),gn.tidy(function(){var U=gn.relu(F?gn.add(gn.conv2d(q,R.conv0.filters,I?[2,2]:[1,1],"same"),R.conv0.bias):Ho(q,R.conv0,I?[2,2]:[1,1])),X=Ho(U,R.conv1,[1,1]),oe=Ho(gn.relu(gn.add(U,X)),R.conv2,[1,1]),me=Ho(gn.relu(gn.add(U,gn.add(X,oe))),R.conv3,[1,1]);return gn.relu(gn.add(U,gn.add(X,gn.add(oe,me))))})}function Ua(q,R,F,I){return F===void 0&&(F="same"),I===void 0&&(I=!1),gn.tidy(function(){var U=gn.add(gn.conv2d(q,R.filters,[1,1],F),R.bias);return I?gn.relu(U):U})}function Na(q,R){Object.keys(q).forEach(function(F){R.some(function(I){return I.originalPath===F})||q[F].dispose()})}function Hs(q,R){return function(F,I,U,X){var oe=gn.tensor4d(q(F*I*U*U),[U,U,F,I]),me=gn.tensor1d(q(I));return R.push({paramPath:X+"/filters"},{paramPath:X+"/bias"}
8260),{filters:oe,bias:me}}}function Za(q,R){return function(F,I,U){var X=gn.tensor2d(q(F*I),[F,I]),oe=gn.tensor1d(q(I));return R.push({paramPath:U+"/weights"},{paramPath:U+"/bias"}),{weights:X,bias:oe}}}var qo=function(){return function(q,R,F){this.depthwise_filter=q,this.pointwise_filter=R,this.bias=F}}();function ss(q,R){return function(F,I,U){var X=gn.tensor4d(q(9*F),[3,3,F,1]),oe=gn.tensor4d(q(F*I),[1,1,F,I]),me=gn.tensor1d(q(I));return R.push({paramPath:U+"/depthwise_filter"},{paramPath:U+"/pointwise_filter"},{paramPath:U+"/bias"}),new qo(X,oe,me)}}function jc(q){return function(R){var F=q(R+"/depthwise_filter",4),I=q(R+"/pointwise_filter",4),U=q(R+"/bias",1);return new qo(F,I,U)}}function ru(q,R){return function(F,I,U){var X=q[F];if(!Oo(X,I))throw new Error("expected weightMap["+F+"] to be a Tensor"+I+"D, instead have "+X);return R.push({originalPath:F,paramPath:U||F}),X}}function ws(q){var R=q;return{extractWeights:function(F){var I=R.slice(0,F);return R=R.slice(F),I},getRemainingWeights:function(){return R}}}function la(q,R){var F=Hs(q,R),I=ss(q,R);function U(X,oe,me,Se){return Se===void 0&&(Se=!1),{conv0:Se?F(X,oe,3,me+"/conv0"):I(X,oe,me+"/conv0"),conv1:I(oe,oe,me+"/conv1"),conv2:I(oe,oe,me+"/conv2")}}return{extractDenseBlock3Params:U,extractDenseBlock4Params:function(X,oe,me,Se){Se===void 0&&(Se=!1);var Me=U(X,oe,me,Se);return{conv0:Me.conv0,conv1:Me.conv1,conv2:Me.conv2,conv3:I(oe,oe,me+"/conv3")}}}}function Al(q){return function(R){return{filters:q(R+"/filters",4),bias:q(R+"/bias",1)}}}function Xu(q,R){var F=ru(q,R),I=Al(F),U=jc(F);return{extractDenseBlock3Params:function(X,oe){return oe===void 0&&(oe=!1),{conv0:oe?I(X+"/conv0"):U(X+"/conv0"),conv1:U(X+"/conv1"),conv2:U(X+"/conv2")}},extractDenseBlock4Params:function(X,oe){return oe===void 0&&(oe=!1),{conv0:oe?I(X+"/conv0"):U(X+"/conv0"),conv1:U(X+"/conv1"),conv2:U(X+"/conv2"),conv3:U(X+"/conv3")}}}}var Mu=function(q){function R(){return q.call(this,"FaceFeatureExtractor")||this}return Object(Yn.c)(R,q),R.prototype.forwardInput=function(F){var I=this.params;if(!I)throw new Error("FaceFeatureExtractor - load model before inference");return gn.tidy(function(){var U=Qa(Sl(F.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(gn.scalar(255)),I.dense0,!0);return U=Qa(U=Qa(U=Qa(U,I.dense1),I.dense2),I.dense3),U=gn.avgPool(U,[7,7],[2,2],"valid")})},R.prototype.forward=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return I=this.forwardInput,[4,wi(F)];case 1:return[2,I.apply(this,[U.sent()])]}})})},R.prototype.getDefaultModelName=function(){return"face_feature_extractor_model"},R.prototype.extractParamsFromWeigthMap=function(F){return function(I){var U=[],X=Xu(I,U).extractDenseBlock4Params,oe={dense0:X("dense0",!0),dense1:X("dense1"),dense2:X("dense2"),dense3:X("dense3")};return Na(I,U),{params:oe,paramMappings:U}}(F)},R.prototype.extractParams=function(F){return function(I){var U=[],X=ws(I),oe=X.extractWeights,me=X.getRemainingWeights,Se=la(oe,U).extractDenseBlock4Params,Me=Se(3,32,"dense0",!0),Te=Se(32,64,"dense1"),tt=Se(64,128,"dense2"),at=Se(128,256,"dense3");if(me().length!==0)throw new Error("weights remaing after extract: "+me().length);return{paramMappings:U,params:{dense0:Me,dense1:Te,dense2:tt,dense3:at}}}(F)},R}(Xi);function Ia(q,R){return gn.tidy(function(){return gn.add(gn.matMul(q,R.weights),R.bias)})}function Fu(q){var R={},F={};return Object.keys(q).forEach(function(I){(I.startsWith("fc")?F:R)[I]=q[I]}),{featureExtractorMap:R,classifierMap:F}}var fa=function(q){function R(F,I){var U=q.call(this,F)||this;return U._faceFeatureExtractor=I,U}return Object(Yn.c)(R,q),Object.defineProperty(R.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),R.prototype.runNet=function(F){var I=this,U=this.params;if(!U)throw new Error(this._name+" - load model before inference");return gn.tidy(function(){var X=F instanceof si?I.faceFeatureExtractor.forwardInput(F):F;return Ia(X.as2D(X.shape[0],-1),U.fc)})},R.prototype.dispose=function(F){F===void 0&&(F=!0),this.faceFeatureExtractor.dispose(F),q.prototype.dispose.call(this,F)},R.prototype.loadClassifierParams=function(F){var I=this.extractClassifierParams(F),U=I.params,X=I.paramMappings;this._params=U,this._paramMappings=X},R.prototype.extractClassifierParams=function(F){return function(I,U,X){var oe=[],me=ws(I),Se=me.extractWeights,Me=me.getRemainingWeights,Te=Za(Se,oe)(U,X,"fc");if(Me().length!==0)throw new Error("weights remaing after extract: "+Me().length);return{paramMappings:oe,params:{fc:Te}}}(F,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())},R.prototype.extractParamsFromWeigthMap=function(F){var I=Fu(F),U=I.featureExtractorMap,X=I.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(U),function(oe){var me=[],Se=ru(oe,me),Me={fc:function(Te){return{weights:Se(Te+"/weights",2),bias:Se(Te+"/bias",1)}}("fc")};return Na(oe,me),{params:Me,paramMappings:me}}(X)},R.prototype.extractParams=function(F){var I=this.getClassifierChannelsIn(),U=this.getClassifierChannelsOut(),X=U*I+U,oe=F.slice(0,F.length-X),me=F.slice(F.length-X);return this.faceFeatureExtractor.extractWeights(oe),this.extractClassifierParams(me)},R}(Xi),Cu=["neutral","happy","sad","angry","fearful","disgusted","surprised"],iu=function(){function q(R){var F=this;if(R.length!==7)throw new Error("FaceExpressions.constructor - expected probabilities.length to be 7, have: "+R.length);Cu.forEach(function(I,U){F[I]=R[U]})}return q.prototype.asSortedArray=function(){var R=this;return Cu.map(function(F){return{expression:F,probability:R[F]}}).sort(function(F,I){return I.probability-F.probability})},q}(),Do=function(q){function R(F){return F===void 0&&(F=new Mu),q.call(this,"FaceExpressionNet",F)||this}return Object(Yn.c)(R,q),R.prototype.forwardInput=function(F){var I=this;return gn.tidy(function(){return gn.softmax(I.runNet(F))})},R.prototype.forward=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return I=this.forwardInput,[4,wi(F)];case 1:return[2,I.apply(this,[U.sent()])]}})})},R.prototype.predictExpressions=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I,U,X,oe,me=this;return Object(Yn.d)(this,function(Se){switch(Se.label){case 0:return[4,wi(F)];case 1:return I=Se.sent(),[4,this.forwardInput(I)];case 2:return U=Se.sent(),[4,Promise.all(gn.unstack(U).map(function(Me){return Object(Yn.b)(me,void 0,void 0,function(){var Te;return Object(Yn.d)(this,function(tt){switch(tt.label){case 0:return[4,Me.data()];case 1:return Te=tt.sent(),Me.dispose(),[2,Te]}})})}))];case 3:return X=Se.sent(),U.dispose(),oe=X.map(function(Me){return new iu(Me)}),[2,I.isBatchInput?oe:oe[0]]}})})},R.prototype.getDefaultModelName=function(){return"face_expression_model"},R.prototype.getClassifierChannelsIn=function(){return 256},R.prototype.getClassifierChannelsOut=function(){return 7},R}(fa);function Su(q){return q.expressions instanceof iu}function Ls(q,R){var F={expressions:R};return Object.assign({},q,F)}function Ju(q,R,F,I){F===void 0&&(F=.1),(Array.isArray(R)?R:[R]).forEac
vendor: 4,125 bytes, line 8260
8260h(function(U){var X=U instanceof iu?U:Su(U)?U.expressions:void 0;if(!X)throw new Error("drawFaceExpressions - expected faceExpressions to be FaceExpressions | WithFaceExpressions<{}> or array thereof");var oe=X.asSortedArray().filter(function(Se){return Se.probability>F}),me=vd(U)?U.detection.box.bottomLeft:I||new Mo(0,0);new zn(oe.map(function(Se){return Se.expression+" ("+Mc(Se.probability)+")"}),me).draw(q)})}function Xl(q){return vd(q)&&q.landmarks instanceof Yu&&q.unshiftedLandmarks instanceof Yu&&q.alignedRect instanceof Da}function xa(q,R){var F=q.detection.box,I=R.shiftBy(F.x,F.y),U=I.align(),X=q.detection.imageDims,oe={landmarks:I,unshiftedLandmarks:R,alignedRect:new Da(q.detection.score,U.rescale(X.reverse()),X)};return Object.assign({},q,oe)}var qs=function(){return function(q){q===void 0&&(q={});var R=q.drawLines,F=R===void 0||R,I=q.drawPoints,U=I===void 0||I,X=q.lineWidth,oe=q.lineColor,me=q.pointSize,Se=q.pointColor;this.drawLines=F,this.drawPoints=U,this.lineWidth=X||1,this.pointSize=me||2,this.lineColor=oe||"rgba(0, 255, 255, 1)",this.pointColor=Se||"rgba(255, 0, 255, 1)"}}(),_s=function(){function q(R,F){F===void 0&&(F={}),this.faceLandmarks=R,this.options=new qs(F)}return q.prototype.draw=function(R){var F=Tn(R),I=this.options,U=I.drawLines,X=I.drawPoints,oe=I.lineWidth,me=I.lineColor,Se=I.pointSize,Me=I.pointColor;U&&this.faceLandmarks instanceof Pc&&(F.strokeStyle=me,F.lineWidth=oe,Hu(F,this.faceLandmarks.getJawOutline()),Hu(F,this.faceLandmarks.getLeftEyeBrow()),Hu(F,this.faceLandmarks.getRightEyeBrow()),Hu(F,this.faceLandmarks.getNose()),Hu(F,this.faceLandmarks.getLeftEye(),!0),Hu(F,this.faceLandmarks.getRightEye(),!0),Hu(F,this.faceLandmarks.getMouth(),!0)),X&&(F.strokeStyle=Me,F.fillStyle=Me,this.faceLandmarks.positions.forEach(function(Te){F.beginPath(),F.arc(Te.x,Te.y,Se,0,2*Math.PI),F.fill()}))},q}();function Ol(q,R){(Array.isArray(R)?R:[R]).forEach(function(F){var I=F instanceof Yu?F:Xl(F)?F.landmarks:void 0;if(!I)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks<WithFaceDetection<{}>> or array thereof");new _s(I).draw(q)})}function Of(q,R){var F=[],I=ws(q),U=I.extractWeights,X=I.getRemainingWeights,oe=function($t,vn){var wn=Hs($t,vn),Nn=ss($t,vn);return{extractConvParams:wn,extractSeparableConvParams:Nn,extractReductionBlockParams:function(In,Ln,qn){return{separable_conv0:Nn(In,Ln,qn+"/separable_conv0"),separable_conv1:Nn(Ln,Ln,qn+"/separable_conv1"),expansion_conv:wn(In,Ln,1,qn+"/expansion_conv")}},extractMainBlockParams:function(In,Ln){return{separable_conv0:Nn(In,In,Ln+"/separable_conv0"),separable_conv1:Nn(In,In,Ln+"/separable_conv1"),separable_conv2:Nn(In,In,Ln+"/separable_conv2")}}}}(U,F),me=oe.extractConvParams,Se=oe.extractSeparableConvParams,Me=oe.extractReductionBlockParams,Te=oe.extractMainBlockParams,tt={conv_in:me(3,32,3,"entry_flow/conv_in"),reduction_block_0:Me(32,64,"entry_flow/reduction_block_0"),reduction_block_1:Me(64,128,"entry_flow/reduction_block_1")},at={};Oa(R,0,1).forEach(function($t){at["main_block_"+$t]=Te(128,"middle_flow/main_block_"+$t)});var jt={reduction_block:Me(128,256,"exit_flow/reduction_block"),separable_conv:Se(256,512,"exit_flow/separable_conv")};if(X().length!==0)throw new Error("weights remaing after extract: "+X().length);return{paramMappings:F,params:{entry_flow:tt,middle_flow:at,exit_flow:jt}}}function Oi(q,R){var F=[],I=function(tt,at){var jt=ru(tt,at),$t=Al(jt),vn=jc(jt);return{extractConvParams:$t,extractSeparableConvParams:vn,extractReductionBlockParams:function(wn){return{separable_conv0:vn(wn+"/separable_conv0"),separable_conv1:vn(wn+"/separable_conv1"),expansion_conv:$t(wn+"/expansion_conv")}},extractMainBlockParams:function(wn){return{separable_conv0:vn(wn+"/separable_conv0"),separable_conv1:vn(wn+"/separable_conv1"),separable_conv2:vn(wn+"/separable_conv2")}}}}(q,F),U=I.extractConvParams,X=I.extractSeparableConvParams,oe=I.extractReductionBlockParams,me=I.extractMainBlockParams,Se={conv_in:U("entry_flow/conv_in"),reduction_block_0:oe("entry_flow/reduction_block_0"),reduction_block_1:oe("entry_flow/reduction_block_1")}
8260,Me={};Oa(R,0,1).forEach(function(tt){Me["main_block_"+tt]=me("middle_flow/main_block_"+tt)});var Te={reduction_block:oe("exit_flow/reduction_block"),separable_conv:X("exit_flow/separable_conv")};return Na(q,F),{params:{entry_flow:Se,middle_flow:Me,exit_flow:Te},paramMappings:F}}function qm(q,R,F){return gn.add(gn.conv2d(q,R.filters,F,"same"),R.bias)}function Df(q,R,F){F===void 0&&(F=!0);var I=F?gn.relu(q):q;return I=Ho(I,R.separable_conv0,[1,1]),I=Ho(gn.relu(I),R.separable_conv1,[1,1]),I=gn.maxPool(I,[3,3],[2,2],"same"),I=gn.add(I,qm(q,R.expansion_conv,[2,2]))}var yd,Wv=function(q){function R(F){var I=q.call(this,"TinyXception")||this;return I._numMainBlocks=F,I}return Object(Yn.c)(R,q),R.prototype.forwardInput=function(F){var I=this,U=this.params;if(!U)throw new Error("TinyXception - load model before inference");return gn.tidy(function(){var X=Sl(F.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(gn.scalar(256)),oe=gn.relu(qm(X,U.entry_flow.conv_in,[2,2]));return oe=Df(oe=Df(oe,U.entry_flow.reduction_block_0,!1),U.entry_flow.reduction_block_1),Oa(I._numMainBlocks,0,1).forEach(function(me){oe=function(Se,Me){var Te=Ho(gn.relu(Se),Me.separable_conv0,[1,1]);return Te=Ho(gn.relu(Te),Me.separable_conv1,[1,1]),Te=Ho(gn.relu(Te),Me.separable_conv2,[1,1]),Te=gn.add(Te,Se)}(oe,U.middle_flow["main_block_"+me])}),oe=Df(oe,U.exit_flow.reduction_block),oe=gn.relu(Ho(oe,U.exit_flow.separable_conv,[1,1]))})},R.prototype.forward=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return I=this.forwardInput,[4,wi(F)];case 1:return[2,I.apply(this,[U.sent()])]}})})},R.prototype.getDefaultModelName=function(){return"tiny_xception_model"},R.prototype.extractParamsFromWeigthMap=function(F){return Oi(F,this._numMainBlocks)},R.prototype.extractParams=function(F){return Of(F,this._numMainBlocks)},R}(Xi);(function(q){q.FEMALE="female",q.MALE="male"})(yd||(yd={}));var Vv=function(q){function R(F){F===void 0&&(F=new Wv(2));var I=q.call(this,"AgeGenderNet")||this;return I._faceFeatureExtractor=F,I}return Object(Yn.c)(R,q),Object.defineProperty(R.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),R.prototype.runNet=function(F){var I=this,U=this.params;if(!U)throw new Error(this._name+" - load model before inference");return gn.tidy(function(){var X=F instanceof si?I.faceFeatureExtractor.forwardInput(F):F,oe=gn.avgPool(X,[7,7],[2,2],"valid").as2D(X.shape[0],-1);return{age:Ia(oe,U.fc.age).as1D(),gender:Ia(oe,U.fc.gender)}})},R.prototype.forwardInput=function(F){var I=this;return gn.tidy(function(){var U=I.runNet(F),X=U.age,oe=U.gender;return{age:X,gender:gn.softmax(oe)}})},R.prototype.forward=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return I=this.forwardInput,[4,wi(F)];case 1:return[2,I.apply(this,[U.sent()])]}})})},R.prototype.predictAgeAndGender=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I,U,X,oe,me,Se,Me=this;return Object(Yn.d)(this,function(Te){switch(Te.label){case 0:return[4,wi(F)];case 1:return I=Te.sent(),[4,this.forwardInput(I)];case 2:return U=Te.sent(),X=gn.unstack(U.age),oe=gn.unstack(U.gender),me=X.map(function(tt,at){return{ageTensor:tt,genderTensor:oe[at]}}),[4,Promise.all(me.map(function(tt){var at=tt.ageTensor,jt=tt.genderTensor;return Object(Yn.b)(Me,void 0,void 0,function(){var $t,vn,wn,Nn,In;return Object(Yn.d)(this,function(Ln){switch(Ln.label){case 0:return[4,at.data()];case 1:return $t=Ln.sent()[0],[4,jt.data()];case 2:return vn=Ln.sent()[0],Nn=(wn=vn>.5)?yd.MALE:yd.FEMALE,In=wn?vn:1-vn,at.dispose(),jt.dispose(),[2,{age:$t,gender:Nn,genderProbability:In}]}})})}))];case 3:return Se=Te.sent(),U.age.dispose(),U.gender.dispose(),[2,I.isBatchInput?Se:Se[0]]}})})},R.prototype.getDefaultModelName=function(){return"age_gender_model"},R.prototype.dispose=function(F){F===void 0&&(F=!0),this.faceFeatureExtractor.dispose(F),q.prototype.dispose.call(this,F)},R.prototype.loadClassifierParams=function(F){var I=this.extractClassifierParams(F),U=I.params,X=I.paramMappings;this._params=U,this._paramMappings=X},R.prototype.extractClassifierParams=function(F){return function(I){var U=[],X=ws(I),oe=X.extractWeights,me=X.getRemainingWeights,Se=Za(oe,U),Me=Se(512,1,"fc/age"),Te=Se(512,2,"fc/gender");if(me().length!==0)throw new Error("weights remaing after extract: "+me().length);return{paramMappings:U,params:{fc:{age:Me,gender:Te}}}}(F)},R.prototype.extractParamsFromWeigthMap=function(F){var I=Fu(F),U=I.featureExtractorMap,X=I.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(U),function(oe){var me=[],Se=ru(oe,me);function Me(tt){return{weights:Se(tt+"/weights",2),bias:Se(tt+"/bias",1)}}var Te={fc:{age:Me("fc/age"),gender:Me("fc/gender")}};return Na(oe,me),{params:Te,paramMappings:me}}(X)},R.prototype.extractParams=function(F){var I=F.slice(0,F.length-1539),U=F.slice(F.length-1539);return this.faceFeatureExtractor.extractWeights(I),this.extractClassifierParams(U)},R}(Xi),B0=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.postProcess=function(F,I,U){var X=U.map(function(me){var Se=me.width,Me=me.height,Te=I/Math.max(Me,Se);return{width:Se*Te,height:Me*Te}}),oe=X.length;return gn.tidy(function(){var me=function(Me,Te){return gn.stack([gn.fill([68],Me),gn.fill([68],Te)],1).as2D(1,136).as1D()},Se=function(Me,Te){var tt=X[Me],at=tt.width,jt=tt.height;return Te(at,jt)?Math.abs(at-jt)/2:0};return F.mul(gn.fill([oe,136],I)).sub(gn.stack(Array.from(Array(oe),function(Me,Te){return me(function(tt){return Se(tt,function(at,jt){return at<jt})}(Te),function(tt){return Se(tt,function(at,jt){return jt<at})}(Te))}))).div(gn.stack(Array.from(Array(oe),function(Me,Te){return me(X[Te].width,X[Te].height)})))})},R.prototype.forwardInput=function(F){var I=this;return gn.tidy(function(){var U=I.runNet(F);return I.postProcess(U,F.inputSize,F.inputDimensions.map(function(X){return{height:X[0],width:X[1]}}))})},R.prototype.forward=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return I=this.forwardInput,[4,wi(F)];case 1:return[2,I.apply(this,[U.sent()])]}})})},R.prototype.detectLandmarks=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I,U,X,oe=this;return Object(Yn.d)(this,function(me){switch(me.label){case 0:return[4,wi(F)];
8260case 1:return I=me.sent(),U=gn.tidy(function(){return gn.unstack(oe.forwardInput(I))}),[4,Promise.all(U.map(function(Se,Me){return Object(Yn.b)(oe,void 0,void 0,function(){var Te,tt,at,jt,$t;return Object(Yn.d)(this,function(vn){switch(vn.label){case 0:return at=(tt=Array).from,[4,Se.data()];case 1:return Te=at.apply(tt,[vn.sent()]),jt=Te.filter(function(wn,Nn){return ho(Nn)}),$t=Te.filter(function(wn,Nn){return!ho(Nn)}),[2,new Pc(Array(68).fill(0).map(function(wn,Nn){return new Mo(jt[Nn],$t[Nn])}),{height:I.getInputHeight(Me),width:I.getInputWidth(Me)})]}})})}))];case 2:return X=me.sent(),U.forEach(function(Se){return Se.dispose()}),[2,I.isBatchInput?X:X[0]]}})})},R.prototype.getClassifierChannelsOut=function(){return 136},R}(fa),P0=function(q){function R(F){return F===void 0&&(F=new Mu),q.call(this,"FaceLandmark68Net",F)||this}return Object(Yn.c)(R,q),R.prototype.getDefaultModelName=function(){return"face_landmark_68_model"},R.prototype.getClassifierChannelsIn=function(){return 256},R}(B0),$v=function(q){function R(){return q.call(this,"TinyFaceFeatureExtractor")||this}return Object(Yn.c)(R,q),R.prototype.forwardInput=function(F){var I=this.params;if(!I)throw new Error("TinyFaceFeatureExtractor - load model before inference");return gn.tidy(function(){var U=Ga(Sl(F.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(gn.scalar(255)),I.dense0,!0);return U=Ga(U=Ga(U,I.dense1),I.dense2),U=gn.avgPool(U,[14,14],[2,2],"valid")})},R.prototype.forward=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return I=this.forwardInput,[4,wi(F)];case 1:return[2,I.apply(this,[U.sent()])]}})})},R.prototype.getDefaultModelName=function(){return"face_feature_extractor_tiny_model"},R.prototype.extractParamsFromWeigthMap=function(F){return function(I){var U=[],X=Xu(I,U).extractDenseBlock3Params,oe={dense0:X("dense0",!0),dense1:X("dense1"),dense2:X("dense2")};return Na(I,U),{params:oe,paramMappings:U}}(F)},R.prototype.extractParams=function(F){return function(I){var U=[],X=ws(I),oe=X.extractWeights,me=X.getRemainingWeights,Se=la(oe,U).extractDenseBlock3Params,Me=Se(3,32,"dense0",!0),Te=Se(32,64,"dense1"),tt=Se(64,128,"dense2");if(me().length!==0)throw new Error("weights remaing after extract: "+me().length);return{paramMappings:U,params:{dense0:Me,dense1:Te,dense2:tt}}}(F)},R}(Xi),j0=function(q){function R(F){return F===void 0&&(F=new $v),q.call(this,"FaceLandmark68TinyNet",F)||this}return Object(Yn.c)(R,q),R.prototype.getDefaultModelName=function(){return"face_landmark_68_tiny_model"},R.prototype.getClassifierChannelsIn=function(){return 128},R}(B0),Hv=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R}(P0);function xh(q,R,F,I,U){U===void 0&&(U="same");var X=R.conv,oe=X.filters,me=X.bias,Se=gn.conv2d(q,oe,F,U);return Se=function(Me,Te){return gn.add(gn.mul(Me,Te.weights),Te.biases)}(Se=gn.add(Se,me),R.scale),I?gn.relu(Se):Se}function Gm(q,R){return xh(q,R,[1,1],!1)}function qv(q,R){return xh(q,R,[2,2],!0,"valid")}function Gv(q,R){function F(U,X,oe,me){var Se=function(Te,tt,at){var jt=q(Te),$t=jt.length/(tt*at*at);if(as($t))throw new Error("depth has to be an integer: "+$t+", weights.length: "+jt.length+", numFilters: "+tt+", filterSize: "+at);return gn.tidy(function(){return gn.transpose(gn.tensor4d(jt,[tt,$t,at,at]),[2,3,1,0])})}(U,X,oe),Me=gn.tensor1d(q(X));return R.push({paramPath:me+"/filters"},{paramPath:me+"/bias"}),{filters:Se,bias:Me}}function I(U,X,oe,me){return{conv:F(U,X,oe,me+"/conv"),scale:function(Se,Me){var Te=gn.tensor1d(q(Se)),tt=gn.tensor1d(q(Se));return R.push({paramPath:Me+"/weights"},{paramPath:Me+"/biases"}),{weights:Te,biases:tt}}(X,me+"/scale")}}return{extractConvLayerParams:I,extractResidualLayerParams:function(U,X,oe,me,Se){return Se===void 0&&(Se=!1),{conv1:I((Se?.5:1)*U,X,oe,me+"/conv1"),conv2:I(U,X,oe,me+"/conv2")}}}}function Kv(q,R){var F=ru(q,R);function I(U){return{conv:{filters:F(U+"/conv/filters",4),bias:F(U+"/conv/bias",1)},scale:function(X){return{weights:F(X+"/scale/weights",1),biases:
8260F(X+"/scale/biases",1)}}(U)}}return{extractConvLayerParams:I,extractResidualLayerParams:function(U){return{conv1:I(U+"/conv1"),conv2:I(U+"/conv2")}}}}function Jl(q,R){var F=function(I,U){return xh(I,U,[1,1],!0)}(q,R.conv1);return F=Gm(F,R.conv2),F=gn.add(F,q),F=gn.relu(F)}function wh(q,R){var F=qv(q,R.conv1);F=Gm(F,R.conv2);var I=gn.avgPool(q,2,2,"valid"),U=gn.zeros(I.shape),X=I.shape[3]!==F.shape[3];if(I.shape[1]!==F.shape[1]||I.shape[2]!==F.shape[2]){var oe=Object(Yn.e)(F.shape);oe[1]=1;var me=gn.zeros(oe);F=gn.concat([F,me],1);var Se=Object(Yn.e)(F.shape);Se[2]=1;var Me=gn.zeros(Se);F=gn.concat([F,Me],2)}return I=X?gn.concat([I,U],3):I,F=gn.add(I,F),F=gn.relu(F)}var Km=function(q){function R(){return q.call(this,"FaceRecognitionNet")||this}return Object(Yn.c)(R,q),R.prototype.forwardInput=function(F){var I=this.params;if(!I)throw new Error("FaceRecognitionNet - load model before inference");return gn.tidy(function(){var U=qv(Sl(F.toBatchTensor(150,!0).toFloat(),[122.782,117.001,104.298]).div(gn.scalar(256)),I.conv32_down),X=(U=wh(U=Jl(U=Jl(U=wh(U=Jl(U=Jl(U=wh(U=Jl(U=Jl(U=Jl(U=wh(U=Jl(U=Jl(U=Jl(U=gn.maxPool(U,3,2,"valid"),I.conv32_1),I.conv32_2),I.conv32_3),I.conv64_down),I.conv64_1),I.conv64_2),I.conv64_3),I.conv128_down),I.conv128_1),I.conv128_2),I.conv256_down),I.conv256_1),I.conv256_2),I.conv256_down_out)).mean([1,2]);return gn.matMul(X,I.fc)})},R.prototype.forward=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return I=this.forwardInput,[4,wi(F)];case 1:return[2,I.apply(this,[U.sent()])]}})})},R.prototype.computeFaceDescriptor=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I,U,X,oe=this;return Object(Yn.d)(this,function(me){switch(me.label){case 0:return[4,wi(F)];case 1:return I=me.sent(),U=gn.tidy(function(){return gn.unstack(oe.forwardInput(I))}),[4,Promise.all(U.map(function(Se){return Se.data()}))];case 2:return X=me.sent(),U.forEach(function(Se){return Se.dispose()}),[2,I.isBatchInput?X:X[0]]}})})},R.prototype.getDefaultModelName=function(){return"face_recognition_model"},R.prototype.extractParamsFromWeigthMap=function(F){return function(I){var U=[],X=Kv(I,U),oe=X.extractConvLayerParams,me=X.extractResidualLayerParams,Se=oe("conv32_down"),Me=me("conv32_1"),Te=me("conv32_2"),tt=me("conv32_3"),at=me("conv64_down"),jt=me("conv64_1"),$t=me("conv64_2"),vn=me("conv64_3"),wn=me("conv128_down"),Nn=me("conv128_1"),In=me("conv128_2"),Ln=me("conv256_down"),qn=me("conv256_1"),Cn=me("conv256_2"),wr=me("conv256_down_out"),Fr=I.fc;if(U.push({originalPath:"fc",paramPath:"fc"}),!gh(Fr))throw new Error("expected weightMap[fc] to be a Tensor2D, instead have "+Fr);var Rr={conv32_down:Se,conv32_1:Me,conv32_2:Te,conv32_3:tt,conv64_down:at,conv64_1:jt,conv64_2:$t,conv64_3:vn,conv128_down:wn,conv128_1:Nn,conv128_2:In,conv256_down:Ln,conv256_1:qn,conv256_2:Cn,conv256_down_out:wr,fc:Fr};return Na(I,U),{params:Rr,paramMappings:U}}(F)},R.prototype.extractParams=function(F){return function(I){var U=ws(I),X=U.extractWeights,oe=U.getRemainingWeights,me=[],Se=Gv(X,me),Me=Se.extractConvLayerParams,Te=Se.extractResidualLayerParams,tt=Me(4704,32,7,"conv32_down"),at=Te(9216,32,3,"conv32_1"),jt=Te(9216,32,3,"conv32_2"),$t=Te(9216,32,3,"conv32_3"),vn=Te(36864,64,3,"conv64_down",!0),wn=Te(36864,64,3,"conv64_1"),Nn=Te(36864,64,3,"conv64_2"),In=Te(36864,64,3,"conv64_3"),Ln=Te(147456,128,3,"conv128_down",!0),qn=Te(147456,128,3,"conv128_1"),Cn=Te(147456,128,3,"conv128_2"),wr=Te(589824,256,3,"conv256_down",!0),Fr=Te(589824,256,3,"conv256_1"),Rr=Te(589824,256,3,"conv256_2"),Xr=Te(589824,256,3,"conv256_down_out"),zr=gn.tidy(function(){return gn.transpose(gn.tensor2d(X(32768),[128,256]),[1,0])});if(me.push({paramPath:"fc"}),oe().length!==0)throw new Error("weights remaing after extract: "+oe().length);return{params:{conv32_down:tt,conv32_1:at,conv32_2:jt,conv32_3:$t,conv64_down:vn,conv64_1:wn,conv64_2:Nn,conv64_3:In,conv128_down:Ln,conv128_1:qn,conv128_2:Cn,conv256_down:wr,conv256_1:Fr,conv256_2:Rr,conv256_down_out:Xr,fc:zr},paramMappings:me}}(F)},R}(Xi);function L0(q){var R=new Km;return R.extractWeights(q),R}function z0(q,R){var F={descriptor:R};return Object.assign({},q,F)}function g1(q){return typeof q.age=="number"}function U0(q,R){var F={age:R};return Object.assign({},q,F)}function Rp(q){return(q.gender===yd.MALE||q.gender===yd.FEMALE)&&Gu(q.genderProbability)}function _h(q,R,F){var I={gender:R,genderProbability:F};return Object.assign({},q,I)}var Ql=function(){function q(R){var F=R===void 0?{}:R,I=F.minFaceSize,U=F.scaleFactor,X=F.maxNumScales,oe=F.scoreThresholds,me=F.scaleSteps;if(this._name="MtcnnOptions",this._minFaceSize=I||20,this._scaleFactor=U||.709,this._maxNumScales=X||10,this._scoreThresholds=oe||[.6,.7,.7],this._scaleSteps=me,typeof this._minFaceSize!="number"||this._minFaceSize<0)throw new Error(this._name+" - expected minFaceSize to be a number > 0");if(typeof this._scaleFactor!="number"||this._scaleFactor<=0||this._scaleFactor>=1)throw new Error(this._name+" - expected scaleFactor to be a number between 0 and 1");if(typeof this._maxNumScales!="number"||this._maxNumScales<0)throw new Error(this._name+" - expected maxNumScales to be a number > 0");if(!Array.isArray(this._scoreThresholds)||this._scoreThresholds.length!==3||this._scoreThresholds.some(function(Se){return typeof Se!="number"}))throw new Error(this._name+" - expected scoreThresholds to be an array of numbers of length 3");
vendor: 6,563 bytes, line 8260
8260if(this._scaleSteps&&(!Array.isArray(this._scaleSteps)||this._scaleSteps.some(function(Se){return typeof Se!="number"})))throw new Error(this._name+" - expected scaleSteps to be an array of numbers")}return Object.defineProperty(q.prototype,"minFaceSize",{get:function(){return this._minFaceSize},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"scaleFactor",{get:function(){return this._scaleFactor},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"maxNumScales",{get:function(){return this._maxNumScales},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"scoreThresholds",{get:function(){return this._scoreThresholds},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"scaleSteps",{get:function(){return this._scaleSteps},enumerable:!0,configurable:!0}),q}();function W0(q,R){function F(X,oe,me,Se,Me){var Te=gn.tensor4d(q(X*oe*me*me),[me,me,X,oe]),tt=gn.tensor1d(q(oe));return R.push({paramPath:Se+"/filters"},{paramPath:Se+"/"+(Me?"batch_norm_offset":"bias")}),{filters:Te,bias:tt}}function I(X,oe,me,Se){var Me=F(X,oe,me,Se,!0);return{filters:Me.filters,batch_norm_offset:Me.bias}}function U(X,oe,me){return{depthwise_conv:function(Se,Me){var Te=gn.tensor4d(q(9*Se),[3,3,Se,1]),tt=gn.tensor1d(q(Se)),at=gn.tensor1d(q(Se)),jt=gn.tensor1d(q(Se)),$t=gn.tensor1d(q(Se));return R.push({paramPath:Me+"/filters"},{paramPath:Me+"/batch_norm_scale"},{paramPath:Me+"/batch_norm_offset"},{paramPath:Me+"/batch_norm_mean"},{paramPath:Me+"/batch_norm_variance"}),{filters:Te,batch_norm_scale:tt,batch_norm_offset:at,batch_norm_mean:jt,batch_norm_variance:$t}}(X,me+"/depthwise_conv"),pointwise_conv:I(X,oe,1,me+"/pointwise_conv")}}return{extractMobilenetV1Params:function(){return{conv_0:I(3,32,3,"mobilenetv1/conv_0"),conv_1:U(32,64,"mobilenetv1/conv_1"),conv_2:U(64,128,"mobilenetv1/conv_2"),conv_3:U(128,128,"mobilenetv1/conv_3"),conv_4:U(128,256,"mobilenetv1/conv_4"),conv_5:U(256,256,"mobilenetv1/conv_5"),conv_6:U(256,512,"mobilenetv1/conv_6"),conv_7:U(512,512,"mobilenetv1/conv_7"),conv_8:U(512,512,"mobilenetv1/conv_8"),conv_9:U(512,512,"mobilenetv1/conv_9"),conv_10:U(512,512,"mobilenetv1/conv_10"),conv_11:U(512,512,"mobilenetv1/conv_11"),conv_12:U(512,1024,"mobilenetv1/conv_12"),conv_13:U(1024,1024,"mobilenetv1/conv_13")}},extractPredictionLayerParams:function(){return{conv_0:I(1024,256,1,"prediction_layer/conv_0"),conv_1:I(256,512,3,"prediction_layer/conv_1"),conv_2:I(512,128,1,"prediction_layer/conv_2"),conv_3:I(128,256,3,"prediction_layer/conv_3"),conv_4:I(256,128,1,"prediction_layer/conv_4"),conv_5:I(128,256,3,"prediction_layer/conv_5"),conv_6:I(256,64,1,"prediction_layer/conv_6"),conv_7:I(64,128,3,"prediction_layer/conv_7"),box_predictor_0:{box_encoding_predictor:F(512,12,1,"prediction_layer/box_predictor_0/box_encoding_predictor"),class_predictor:F(512,9,1,"prediction_layer/box_predictor_0/class_predictor")},box_predictor_1:{box_encoding_predictor:F(1024,24,1,"prediction_layer/box_predictor_1/box_encoding_predictor"),class_predictor:F(1024,18,1,"prediction_layer/box_predictor_1/class_predictor")},box_predictor_2:{box_encoding_predictor:F(512,24,1,"prediction_layer/box_predictor_2/box_encoding_predictor"),class_predictor:F(512,18,1,"prediction_layer/box_predictor_2/class_predictor")},box_predictor_3:{box_encoding_predictor:F(256,24,1,"prediction_layer/box_predictor_3/box_encoding_predictor"),class_predictor:F(256,18,1,"prediction_layer/box_predictor_3/class_predictor")},box_predictor_4:{box_encoding_predictor:F(256,24,1,"prediction_layer/box_predictor_4/box_encoding_predictor"),class_predictor:F(256,18,1,"prediction_layer/box_predictor_4/class_predictor")},box_predictor_5:{box_encoding_predictor:F(128,24,1,"prediction_layer/box_predictor_5/box_encoding_predictor"),class_predictor:F(128,18,1,"prediction_layer/box_predictor_5/class_predictor")}}}}}function V0(q){var R=[],F=function(me,Se){var Me=ru(me,Se);function Te($t,vn,wn){return{filters:Me($t+"/Conv2d_"+vn+"_pointwise/weights",4,wn+"/filters"),batch_norm_offset:Me($t+"/Conv2d_"+vn+"_pointwise/convolution_bn_offset",1,wn+"/batch_norm_offset")}}function tt($t){var vn="mobilenetv1/conv_"+$t,wn="MobilenetV1/Conv2d_"+$t+"_depthwise",Nn=vn+"/depthwise_conv",In=vn+"/pointwise_conv";return{depthwise_conv:{filters:Me(wn+"/depthwise_weights",4,Nn+"/filters"),batch_norm_scale:Me(wn+"/BatchNorm/gamma",1,Nn+"/batch_norm_scale"),batch_norm_offset:Me(wn+"/BatchNorm/beta",1,Nn+"/batch_norm_offset"),batch_norm_mean:Me(wn+"/BatchNorm/moving_mean",1,Nn+"/batch_norm_mean"),batch_norm_variance:Me(wn+"/BatchNorm/moving_variance",1,Nn+"/batch_norm_variance")},pointwise_conv:Te("MobilenetV1",$t,In)}}function at($t,vn){return{filters:Me($t+"/weights",4,vn+"/filters"),bias:Me($t+"/biases",1,vn+"/bias")}}function jt($t){return{box_encoding_predictor:at("Prediction/BoxPredictor_"+$t+"/BoxEncodingPredictor","prediction_layer/box_predictor_"+$t+"/box_encoding_predictor"),class_predictor:at("Prediction/BoxPredictor_"+$t+"/ClassPredictor","prediction_layer/box_predictor_"+$t+"/class_predictor")}}return{extractMobilenetV1Params:function(){return{conv_0:Te("MobilenetV1",0,"mobilenetv1/conv_0"),conv_1:tt(1),conv_2:tt(2),conv_3:tt(3),conv_4:tt(4),conv_5:tt(5),conv_6:tt(6),conv_7:tt(7),conv_8:tt(8),conv_9:tt(9),conv_10:tt(10),conv_11:tt(11),conv_12:tt(12),conv_13:tt(13)}},extractPredictionLayerParams:function(){return{conv_0:Te("Prediction",0,"prediction_layer/conv_0"),conv_1:Te("Prediction",1,"prediction_layer/conv_1"),conv_2:Te("Prediction",2,"prediction_layer/conv_2"),conv_3:Te("Prediction",3,"prediction_layer/conv_3"),conv_4:Te("Prediction",4,"prediction_layer/conv_4"),conv_5:Te("Prediction",5,"prediction_layer/conv_5"),conv_6:Te("Prediction",6,"prediction_layer/conv_6"),conv_7:Te("Prediction",7,"prediction_layer/conv_7"),box_predictor_0:jt(0),box_predictor_1:jt(1),box_predictor_2:jt(2),box_predictor_3:jt(3),box_predictor_4:jt(4),box_predictor_5:jt(5)}}}}(q,R),I=F.extractMobilenetV1Params,U=F.extractPredictionLayerParams,X=q["Output/extra_dim"];if(R.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!fr(X))throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have "+X);var oe={mobilenetv1:I(),prediction_layer:U(),output_layer:{extra_dim:X}};return Na(q,R),{params:oe,paramMappings:R}}function Lc(q,R,F){return gn.tidy(function(){var I=gn.conv2d(q,R.filters,F,"same");return I=gn.add(I,R.batch_norm_offset),gn.clipByValue(I,0,6)})}var $0=.0010000000474974513;function Bp(q,R){return gn.tidy(function(){var F=null,I=Lc(q,R.conv_0,[2,2]);
8260if([R.conv_1,R.conv_2,R.conv_3,R.conv_4,R.conv_5,R.conv_6,R.conv_7,R.conv_8,R.conv_9,R.conv_10,R.conv_11,R.conv_12,R.conv_13].forEach(function(U,X){var oe=X+1,me=function(Se){return[2,4,6,12].some(function(Me){return Me===Se})?[2,2]:[1,1]}(oe);I=Lc(I=function(Se,Me,Te){return gn.tidy(function(){var tt=gn.depthwiseConv2d(Se,Me.filters,Te,"same");return tt=gn.batchNorm(tt,Me.batch_norm_mean,Me.batch_norm_variance,Me.batch_norm_offset,Me.batch_norm_scale,$0),gn.clipByValue(tt,0,6)})}(I,U.depthwise_conv,me),U.pointwise_conv,[1,1]),oe===11&&(F=I)}),F===null)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:I,conv11:F}})}function Ym(q,R,F){var I=q.arraySync(),U=Math.min(I[R][0],I[R][2]),X=Math.min(I[R][1],I[R][3]),oe=Math.max(I[R][0],I[R][2]),me=Math.max(I[R][1],I[R][3]),Se=Math.min(I[F][0],I[F][2]),Me=Math.min(I[F][1],I[F][3]),Te=Math.max(I[F][0],I[F][2]),tt=Math.max(I[F][1],I[F][3]),at=(oe-U)*(me-X),jt=(Te-Se)*(tt-Me);if(at<=0||jt<=0)return 0;var $t=Math.max(U,Se),vn=Math.max(X,Me),wn=Math.min(oe,Te),Nn=Math.min(me,tt),In=Math.max(wn-$t,0)*Math.max(Nn-vn,0);return In/(at+jt-In)}function v1(q,R){var F=function(Te){var tt=gn.unstack(gn.transpose(Te,[1,0])),at=[gn.sub(tt[2],tt[0]),gn.sub(tt[3],tt[1])];return{sizes:at,centers:[gn.add(tt[0],gn.div(at[0],gn.scalar(2))),gn.add(tt[1],gn.div(at[1],gn.scalar(2)))]}}(q),I=F.sizes,U=F.centers,X=gn.unstack(gn.transpose(R,[1,0])),oe=gn.div(gn.mul(gn.exp(gn.div(X[2],gn.scalar(5))),I[0]),gn.scalar(2)),me=gn.add(gn.mul(gn.div(X[0],gn.scalar(10)),I[0]),U[0]),Se=gn.div(gn.mul(gn.exp(gn.div(X[3],gn.scalar(5))),I[1]),gn.scalar(2)),Me=gn.add(gn.mul(gn.div(X[1],gn.scalar(10)),I[1]),U[1]);return gn.transpose(gn.stack([gn.sub(me,oe),gn.sub(Me,Se),gn.add(me,oe),gn.add(Me,Se)]),[1,0])}function Xm(q,R){return gn.tidy(function(){var F=q.shape[0];return{boxPredictionEncoding:gn.reshape(Ua(q,R.box_encoding_predictor),[F,-1,1,4]),classPrediction:gn.reshape(Ua(q,R.class_predictor),[F,-1,3])}})}var Zl=function(){function q(R){var F=R===void 0?{}:R,I=F.minConfidence,U=F.maxResults;if(this._name="SsdMobilenetv1Options",this._minConfidence=I||.5,this._maxResults=U||100,typeof this._minConfidence!="number"||this._minConfidence<=0||this._minConfidence>=1)throw new Error(this._name+" - expected minConfidence to be a number between 0 and 1");if(typeof this._maxResults!="number")throw new Error(this._name+" - expected maxResults to be a number")}return Object.defineProperty(q.prototype,"minConfidence",{get:function(){return this._minConfidence},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"maxResults",{get:function(){return this._maxResults},enumerable:!0,configurable:!0}),q}(),Jm=function(q){function R(){return q.call(this,"SsdMobilenetv1")||this}return Object(Yn.c)(R,q),R.prototype.forwardInput=function(F){var I=this.params;if(!I)throw new Error("SsdMobilenetv1 - load model before inference");return gn.tidy(function(){var U=F.toBatchTensor(512,!1).toFloat(),X=Bp(gn.sub(gn.mul(U,gn.scalar(.007843137718737125)),gn.scalar(1)),I.mobilenetv1),oe=function(me,Se,Me){return gn.tidy(function(){var Te=Lc(Lc(me,Me.conv_0,[1,1]),Me.conv_1,[2,2]),tt=Lc(Lc(Te,Me.conv_2,[1,1]),Me.conv_3,[2,2]),at=Lc(Lc(tt,Me.conv_4,[1,1]),Me.conv_5,[2,2]),jt=Lc(Lc(at,Me.conv_6,[1,1]),Me.conv_7,[2,2]),$t=Xm(Se,Me.box_predictor_0),vn=Xm(me,Me.box_predictor_1),wn=Xm(Te,Me.box_predictor_2),Nn=Xm(tt,Me.box_predictor_3),In=Xm(at,Me.box_predictor_4),Ln=Xm(jt,Me.box_predictor_5);return{boxPredictions:gn.concat([$t.boxPredictionEncoding,vn.boxPredictionEncoding,wn.boxPredictionEncoding,Nn.boxPredictionEncoding,In.boxPredictionEncoding,Ln.boxPredictionEncoding],1),classPredictions:gn.concat([$t.classPrediction,vn.classPrediction,wn.classPrediction,Nn.classPrediction,In.classPrediction,Ln.classPrediction],1)}})}(X.out,X.conv11,I.prediction_layer);return function(me,Se,Me){return gn.tidy(function(){var Te=me.shape[0],tt=v1(gn.reshape(gn.tile(Me.extra_dim,[Te,1,1]),[-1,4]),gn.reshape(me,[-1,4]));tt=gn.reshape(tt,[Te,tt.shape[0]/Te,4]);var at=gn.sigmoid(gn.slice(Se,[0,0,1],[-1,-1,-1])),jt=gn.slice(at,[0,0,0],[-1,-1,1]);
8260return jt=gn.reshape(jt,[Te,jt.shape[1]]),{boxes:gn.unstack(tt),scores:gn.unstack(jt)}})}(oe.boxPredictions,oe.classPredictions,I.output_layer)})},R.prototype.forward=function(F){return Object(Yn.b)(this,void 0,void 0,function(){var I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return I=this.forwardInput,[4,wi(F)];case 1:return[2,I.apply(this,[U.sent()])]}})})},R.prototype.locateFaces=function(F,I){return I===void 0&&(I={}),Object(Yn.b)(this,void 0,void 0,function(){var U,X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn,In,Ln,qn,Cn,wr,Fr;return Object(Yn.d)(this,function(Rr){switch(Rr.label){case 0:return U=new Zl(I),X=U.maxResults,oe=U.minConfidence,[4,wi(F)];case 1:for(me=Rr.sent(),Se=this.forwardInput(me),Me=Se.boxes,Te=Se.scores,tt=Me[0],at=Te[0],jt=1;jt<Me.length;jt++)Me[jt].dispose(),Te[jt].dispose();return wn=(vn=Array).from,[4,at.data()];case 2:return $t=wn.apply(vn,[Rr.sent()]),Nn=function(Xr,zr,Ti,Wi,zi){var Xo=Xr.shape[0],wa=Math.min(Ti,Xo),ua=function(ha){return ha<=Wi?1:0},oa=[];return zr.map(function(ha,Ma){return{score:ha,boxIndex:Ma}}).filter(function(ha){return ha.score>zi}).sort(function(ha,Ma){return Ma.score-ha.score}
8260).forEach(function(ha){if(!(oa.length>=wa)){for(var Ma=ha.score,Wa=oa.length-1;Wa>=0;--Wa){var us=Ym(Xr,ha.boxIndex,oa[Wa]);if(us!==0&&(ha.score*=ua(us),ha.score<=zi))break}Ma===ha.score&&oa.push(ha.boxIndex)}}),oa}(tt,$t,X,.5,oe),In=me.getReshapedInputDimensions(0),Ln=me.inputSize,qn=Ln/In.width,Cn=Ln/In.height,wr=tt.arraySync(),Fr=Nn.map(function(Xr){var zr=[Math.max(0,wr[Xr][0]),Math.min(1,wr[Xr][2])].map(function(ua){return ua*Cn}),Ti=zr[0],Wi=zr[1],zi=[Math.max(0,wr[Xr][1]),Math.min(1,wr[Xr][3])].map(function(ua){return ua*qn}),Xo=zi[0],wa=zi[1];return new Da($t[Xr],new Af(Xo,Ti,wa-Xo,Wi-Ti),{height:me.getInputHeight(0),width:me.getInputWidth(0)})}),tt.dispose(),at.dispose(),[2,Fr]}})})},R.prototype.getDefaultModelName=function(){return"ssd_mobilenetv1_model"},R.prototype.extractParamsFromWeigthMap=function(F){return V0(F)},R.prototype.extractParams=function(F){return function(I){var U=[],X=ws(I),oe=X.extractWeights,me=X.getRemainingWeights,Se=W0(oe,U),Me=Se.extractMobilenetV1Params,Te=Se.extractPredictionLayerParams,tt=Me(),at=Te(),jt={extra_dim:gn.tensor3d(oe(20472),[1,5118,4])};if(U.push({paramPath:"output_layer/extra_dim"}),me().length!==0)throw new Error("weights remaing after extract: "+me().length);return{params:{mobilenetv1:tt,prediction_layer:at,output_layer:jt},paramMappings:U}}(F)},R}(Xi);function Yv(q){var R=new Jm;return R.extractWeights(q),R}function Xv(q){return Yv(q)}var H0,Db=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R}(Jm),Tb=.4,Fo=[new Mo(.738768,.874946),new Mo(2.42204,2.65704),new Mo(4.30971,7.04493),new Mo(10.246,4.59428),new Mo(12.6868,11.8741)],Jv=[new Mo(1.603231,2.094468),new Mo(6.041143,7.080126),new Mo(2.882459,3.518061),new Mo(4.266906,5.178857),new Mo(9.041765,10.66308)],Qv=[117.001,114.697,97.404],Wg=function(q){return typeof q=="number"};function Zv(q){if(!q)throw new Error("invalid config: "+q);if(typeof q.withSeparableConvs!="boolean")throw new Error("config.withSeparableConvs has to be a boolean, have: "+q.withSeparableConvs);if(!Wg(q.iouThreshold)||q.iouThreshold<0||q.iouThreshold>1)throw new Error("config.iouThreshold has to be a number between [0, 1], have: "+q.iouThreshold);if(!Array.isArray(q.classes)||!q.classes.length||!q.classes.every(function(R){return typeof R=="string"}))throw new Error("config.classes has to be an array class names: string[], have: "+JSON.stringify(q.classes));if(!Array.isArray(q.anchors)||!q.anchors.length||!q.anchors.map(function(R){return R||{}}).every(function(R){return Wg(R.x)&&Wg(R.y)}))throw new Error("config.anchors has to be an array of { x: number, y: number }, have: "+JSON.stringify(q.anchors));if(q.meanRgb&&(!Array.isArray(q.meanRgb)||q.meanRgb.length!==3||!q.meanRgb.every(Wg)))throw new Error("config.meanRgb has to be an array of shape [number, number, number], have: "+JSON.stringify(q.meanRgb))}function Qm(q){return gn.tidy(function(){var R=gn.mul(q,gn.scalar(.10000000149011612));return gn.add(gn.relu(gn.sub(q,R)),R)})}function Tf(q,R){return gn.tidy(function(){var F=gn.pad(q,[[0,0],[1,1],[1,1],[0,0]]);return F=gn.conv2d(F,R.conv.filters,[1,1],"valid"),F=gn.sub(F,R.bn.sub),F=gn.mul(F,R.bn.truediv),Qm(F=gn.add(F,R.conv.bias))})}function Nf(q,R){return gn.tidy(function(){var F=gn.pad(q,[[0,0],[1,1],[1,1],[0,0]]);return F=gn.separableConv2d(F,R.depthwise_filter,R.pointwise_filter,[1,1],"valid"),Qm(F=gn.add(F,R.bias))})}function ey(q,R){var F=Hs(q,R),I=ss(q,R);return{extractConvParams:F,extractConvWithBatchNormParams:function(U,X,oe){return{conv:F(U,X,3,oe+"/conv"),bn:function(me,Se){var Me=gn.tensor1d(q(me)),Te=gn.tensor1d(q(me));return R.push({paramPath:Se+"/sub"},{paramPath:Se+"/truediv"}),{sub:Me,truediv:Te}}(X,oe+"/bn")}},extractSeparableConvParams:I}}function ty(q,R){var F=ru(q,R);function I(U){return{filters:F(U+"/filters",4),bias:F(U+"/bias",1)}}return{extractConvParams:I,extractConvWithBatchNormParams:function(U){return{conv:I(U+"/conv"),bn:function(X){return{sub:F(X+"/sub",1),truediv:F(X+"/truediv",1)}}(U+"/bn")}},extractSeparableConvParams:jc(F)}}(function(q){q[q.XS=224]="XS",q[q.SM=320]="SM",q[q.MD=416]="MD",q[q.LG=608]="LG"})(H0||(H0={}));var Pp=function(){function q(R){var F=R===void 0?{}:R,I=F.inputSize,U=F.scoreThreshold;if(this._name="TinyYolov2Options",this._inputSize=I||416,this._scoreThreshold=U||.5,typeof this._inputSize!="number"||this._inputSize%32!=0)throw new Error(this._name+" - expected inputSize to be a number divisible by 32");if(typeof this._scoreThreshold!="number"||this._scoreThreshold<=0||this._scoreThreshold>=1)throw new Error(this._name+" - expected scoreThreshold to be a number between 0 and 1")}return Object.defineProperty(q.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"scoreThreshold",{get:function(){return this._scoreThreshold},enumerable:!0,configurable:!0}),q}(),kh=function(q){function R(F){var I=q.call(this,"TinyYolov2")||this;return Zv(F),I._config=F,I}return Object(Yn.c)(R,q),Object.defineProperty(R.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"withClassScores",{get:function(){return this.config.withClassScores||this.config.classes.length>1},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"boxEncodingSize",{get:function(){return 5+(this.withClassScores?this.config.classes.length:0)},enumerable:!0,configurable:!0}),R.prototype.runTinyYolov2=function(F,I){var U=Tf(F,I.conv0);return U=Tf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv1),U=Tf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv2),U=Tf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv3),U=Tf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv4),U=Tf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv5),Ua(U=Tf(U=Tf(U=gn.maxPool(U,[2,2],[1,1],"same"),I.conv6),I.conv7),I.conv8,"valid",!1)},R.prototype.runMobilenet=function(F,I){var U=this.config.isFirstLayerConv2d?Qm(Ua(F,I.conv0,"valid",!1)):Nf(F,I.conv0);return U=Nf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv1),U=Nf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv2),U=Nf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv3),U=Nf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv4),U=Nf(U=gn.maxPool(U,[2,2],[2,2],"same"),I.conv5),U=gn.maxPool(U,[2,2],[1,1],"same"),U=I.conv6?Nf(U,I.conv6):U,Ua(U=I.conv7?Nf(U,I.conv7):U,I.conv8,"valid",!1)},R.prototype.forwardInput=function(F,I){var U=this,X=this.params;if(!X)throw new Error("TinyYolov2 - load model before inference");
8260return gn.tidy(function(){var oe=F.toBatchTensor(I,!1).toFloat();return oe=(oe=U.config.meanRgb?Sl(oe,U.config.meanRgb):oe).div(gn.scalar(256)),U.config.withSeparableConvs?U.runMobilenet(oe,X):U.runTinyYolov2(oe,X)})},R.prototype.forward=function(F,I){return Object(Yn.b)(this,void 0,void 0,function(){var U;return Object(Yn.d)(this,function(X){switch(X.label){case 0:return U=this.forwardInput,[4,wi(F)];case 1:return[4,U.apply(this,[X.sent(),I])];case 2:return[2,X.sent()]}})})},R.prototype.detect=function(F,I){return I===void 0&&(I={}),Object(Yn.b)(this,void 0,void 0,function(){var U,X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn=this;return Object(Yn.d)(this,function(In){switch(In.label){case 0:return U=new Pp(I),X=U.inputSize,oe=U.scoreThreshold,[4,wi(F)];case 1:return me=In.sent(),[4,this.forwardInput(me,X)];case 2:return Se=In.sent(),Me=gn.tidy(function(){return gn.unstack(Se)[0].expandDims()}),Te={width:me.getInputWidth(0),height:me.getInputHeight(0)},[4,this.extractBoxes(Me,me.getReshapedInputDimensions(0),oe)];case 3:return tt=In.sent(),Se.dispose(),Me.dispose(),at=tt.map(function(Ln){return Ln.box}),jt=tt.map(function(Ln){return Ln.score}),$t=tt.map(function(Ln){return Ln.classScore}),vn=tt.map(function(Ln){return Nn.config.classes[Ln.label]}),wn=il(at.map(function(Ln){return Ln.rescale(X)}),jt,this.config.iouThreshold,!0),[2,wn.map(function(Ln){return new nu(jt[Ln],$t[Ln],vn[Ln],at[Ln],Te)})]}})})},R.prototype.getDefaultModelName=function(){return""},R.prototype.extractParamsFromWeigthMap=function(F){return function(I,U){var X,oe=[],me=ty(I,oe),Se=me.extractConvParams,Me=me.extractConvWithBatchNormParams,Te=me.extractSeparableConvParams;if(U.withSeparableConvs){var tt=U.filterSizes&&U.filterSizes.length||9;X={conv0:U.isFirstLayerConv2d?Se("conv0"):Te("conv0"),conv1:Te("conv1"),conv2:Te("conv2"),conv3:Te("conv3"),conv4:Te("conv4"),conv5:Te("conv5"),conv6:tt>7?Te("conv6"):void 0,conv7:tt>8?Te("conv7"):void 0,conv8:Se("conv8")}}else X={conv0:Me("conv0"),conv1:Me("conv1"),conv2:Me("conv2"),conv3:Me("conv3"),conv4:Me("conv4"),conv5:Me("conv5"),conv6:Me("conv6"),conv7:Me("conv7"),conv8:Se("conv8")};return Na(I,oe),{params:X,paramMappings:oe}}(F,this.config)},R.prototype.extractParams=function(F){var I=this.config.filterSizes||R.DEFAULT_FILTER_SIZES,U=I?I.length:void 0;if(U!==7&&U!==8&&U!==9)throw new Error("TinyYolov2 - expected 7 | 8 | 9 convolutional filters, but found "+U+" filterSizes in config");return function(X,oe,me,Se){var Me,Te=ws(X),tt=Te.extractWeights,at=Te.getRemainingWeights,jt=[],$t=ey(tt,jt),vn=$t.extractConvParams,wn=$t.extractConvWithBatchNormParams,Nn=$t.extractSeparableConvParams;if(oe.withSeparableConvs){var In=Se[0],Ln=Se[1],qn=Se[2],Cn=Se[3],wr=Se[4],Fr=Se[5],Rr=Se[6],Xr=Se[7],zr=Se[8];Me={conv0:oe.isFirstLayerConv2d?vn(In,Ln,3,"conv0"):Nn(In,Ln,"conv0"),conv1:Nn(Ln,qn,"conv1"),conv2:Nn(qn,Cn,"conv2"),conv3:Nn(Cn,wr,"conv3"),conv4:Nn(wr,Fr,"conv4"),conv5:Nn(Fr,Rr,"conv5"),conv6:Xr?Nn(Rr,Xr,"conv6"):void 0,conv7:zr?Nn(Xr,zr,"conv7"):void 0,conv8:vn(zr||Xr||Rr,5*me,1,"conv8")}}else In=Se[0],Ln=Se[1],qn=Se[2],Cn=Se[3],wr=Se[4],Fr=Se[5],Rr=Se[6],Xr=Se[7],zr=Se[8],Me={conv0:wn(In,Ln,"conv0"),conv1:wn(Ln,qn,"conv1"),conv2:wn(qn,Cn,"conv2"),conv3:wn(Cn,wr,"conv3"),conv4:wn(wr,Fr,"conv4"),conv5:wn(Fr,Rr,"conv5"),conv6:wn(Rr,Xr,"conv6"),conv7:wn(Xr,zr,"conv7"),conv8:vn(zr,5*me,1,"conv8")};if(at().length!==0)throw new Error("weights remaing after extract: "+at().length);return{params:Me,paramMappings:jt}}(F,this.config,this.boxEncodingSize,I)},R.prototype.extractBoxes=function(F,I,U){return Object(Yn.b)(this,void 0,void 0,function(){var X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn,In,Ln,qn,Cn,wr,Fr,Rr,Xr,zr,Ti,Wi,zi,Xo,wa,ua,oa,ha=this;return Object(Yn.d)(this,function(Ma){switch(Ma.label){case 0:return X=I.width,oe=I.height,me=Math.max(X,oe),Se=me/X,Me=me/oe,Te=F.shape[1],tt=this.config.anchors.length,at=gn.tidy(function(){var Wa=F.reshape([Te,Te,tt,ha.boxEncodingSize]);return[Wa.slice([0,0,0,0],[Te,Te,tt,4]),Wa.slice([0,0,0,4],[Te,Te,tt,1]),ha.withClassScores?gn.softmax(Wa.slice([0,0,0,5],[Te,Te,tt,ha.config.classes.length]),3):gn.scalar(0)]}),jt=at[0],$t=at[1],vn=at[2],wn=[],[4,$t.array()];case 1:return Nn=Ma.sent(),[4,jt.array()];case 2:In=Ma.sent(),Ln=0,Ma.label=3;case 3:if(!(Ln<Te))return[3,12];qn=0,Ma.label=4;case 4:if(!(qn<Te))return[3,11];Cn=0,Ma.label=5;case 5:return Cn<tt?(wr=Sf(Nn[Ln][qn][Cn][0]),!U||wr>U?(Fr=(qn+Sf(In[Ln][qn][Cn][0]))/Te*Se,Rr=(Ln+Sf(In[Ln][qn][Cn][1]))/Te*Me,Xr=Math.exp(In[Ln][qn][Cn][2])*this.config.anchors[Cn].x/Te*Se,zr=Math.exp(In[Ln][qn][Cn][3])*this.config.anchors[Cn].y/Te*Me,Ti=Fr-Xr/2,Wi=Rr-zr/2,zi={row:Ln,col:qn,anchor:Cn},this.withClassScores?[4,this.extractPredictedClass(vn,zi)]:[3,7]):[3,9]):[3,10];case 6:return oa=Ma.sent(),[3,8];case 7:oa={classScore:1,label:0},Ma.label=8;case 8:wa=(Xo=oa).classScore,ua=Xo.label,wn.push(Object(Yn.a)({box:new ps(Ti,Wi,Ti+Xr,Wi+zr),score:wr,classScore:wr*wa,label:ua},zi)),Ma.label=9;case 9:return Cn++,[3,5];case 10:return qn++,[3,4];case 11:return Ln++,[3,3];case 12:return jt.dispose(),$t.dispose(),vn.dispose(),[2,wn]}})})},R.prototype.extractPredictedClass=function(F,I){return Object(Yn.b)(this,void 0,void 0,function(){var U,X,oe,me;return Object(Yn.d)(this,function(Se){switch(Se.label){case 0:return U=I.row,X=I.col,oe=I.anchor,[4,F.array()];case 1:return me=Se.sent(),[2,Array(this.config.classes.length).fill(0).map(function(Me,Te){return me[U][X][oe][Te]}).map(function(Me,Te){return{classScore:Me,label:Te}}).reduce(function(Me,Te){return Me.classScore>Te.classScore?Me:Te})]}})})},R.DEFAULT_FILTER_SIZES=[3,16,32,64,128,256,512,1024,1024],R}(Xi),jp=function(q){function R(F){F===void 0&&(F=!0);var I=Object.assign({},{withSeparableConvs:F,iouThreshold:Tb,classes:["face"]},F?{anchors:Jv,meanRgb:Qv}:{anchors:Fo,withClassScores:!0});return q.call(this,I)||this}return Object(Yn.c)(R,q),Object.defineProperty(R.prototype,"withSeparableConvs",{get:function(){return this.config.withSeparableConvs},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),R.prototype.locateFaces=function(F,I){return Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(U){switch(U.label){case 0:return[4,this.detect(F,I)];case 1:return[2,U.sent().map(function(X){return new Da(X.score,X.relativeBox,{width:X.imageWidth,height:X.imageHeight})})]}})})},R.prototype.getDefaultModelName=function(){return this.withSeparableConvs?"tiny_yolov2_separable_conv_model":"tiny_yolov2_model"},R.prototype.extractParamsFromWeigthMap=function(F){return q.prototype.extractParamsFromWeigthMap.call(this,F)},R}(kh);function Nb(q,R){R===void 0&&(R=!0);var F=new jp(R);return F.extractWeights(q),F}var Vg=function(q){function R(){var F=q!==null&&q.apply(this,arguments)||this;return F._name="TinyFaceDetectorOptions",F}return Object(Yn.c)(R,q),R}(Pp),If=function(){function q(){}return q.prototype.then=function(R){return Object(Yn.b)(this,void 0,void 0,function(){var F;return Object(Yn.d)(this,function(I){switch(I.label){case 0:return F=R,[4,this.run()];case 1:return[2,F.apply(void 0,[I.sent()])]}})})},q.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(R){throw new Error("ComposableTask - run is not implemented")})})},q}();function zc(q,R,F,I,U){return U===void 0&&(U=function(X){return X.alignedRect}
8260),Object(Yn.b)(this,void 0,void 0,function(){var X,oe,me,Se,Me;return Object(Yn.d)(this,function(Te){switch(Te.label){case 0:return X=q.map(function(tt){return Xl(tt)?U(tt):tt.detection}),(me=I)?[3,5]:R instanceof gn.Tensor?[4,_o(R,X)]:[3,2];case 1:return Se=Te.sent(),[3,4];case 2:return[4,Co(R,X)];case 3:Se=Te.sent(),Te.label=4;case 4:me=Se,Te.label=5;case 5:return[4,F(oe=me)];case 6:return Me=Te.sent(),oe.forEach(function(tt){return tt instanceof gn.Tensor&&tt.dispose()}),[2,Me]}})})}function bd(q,R,F,I,U){return Object(Yn.b)(this,void 0,void 0,function(){var X=this;return Object(Yn.d)(this,function(oe){return[2,zc([q],R,function(me){return Object(Yn.b)(X,void 0,void 0,function(){return Object(Yn.d)(this,function(Se){return[2,F(me[0])]})})},I,U)]})})}var xd=2,wd=12;function ny(q){var R=ws(q),F=R.extractWeights,I=R.getRemainingWeights,U=[],X=function(at,jt){var $t=Hs(at,jt),vn=Za(at,jt);function wn(In,Ln){var qn=gn.tensor1d(at(In));return jt.push({paramPath:Ln}),qn}function Nn(In,Ln,qn){return qn===void 0&&(qn=!1),{conv1:$t(In[0],In[1],3,Ln+"/conv1"),prelu1_alpha:wn(In[1],Ln+"/prelu1_alpha"),conv2:$t(In[1],In[2],3,Ln+"/conv2"),prelu2_alpha:wn(In[2],Ln+"/prelu2_alpha"),conv3:$t(In[2],In[3],qn?2:3,Ln+"/conv3"),prelu3_alpha:wn(In[3],Ln+"/prelu3_alpha")}}return{extractPNetParams:function(){var In=Nn([3,10,16,32],"pnet"),Ln=$t(32,2,1,"pnet/conv4_1"),qn=$t(32,4,1,"pnet/conv4_2");return Object(Yn.a)(Object(Yn.a)({},In),{conv4_1:Ln,conv4_2:qn})},extractRNetParams:function(){var In=Nn([3,28,48,64],"rnet",!0),Ln=vn(576,128,"rnet/fc1"),qn=wn(128,"rnet/prelu4_alpha"),Cn=vn(128,2,"rnet/fc2_1"),wr=vn(128,4,"rnet/fc2_2");return Object(Yn.a)(Object(Yn.a)({},In),{fc1:Ln,prelu4_alpha:qn,fc2_1:Cn,fc2_2:wr})},extractONetParams:function(){var In=Nn([3,32,64,64],"onet"),Ln=$t(64,128,2,"onet/conv4"),qn=wn(128,"onet/prelu4_alpha"),Cn=vn(1152,256,"onet/fc1"),wr=wn(256,"onet/prelu5_alpha"),Fr=vn(256,2,"onet/fc2_1"),Rr=vn(256,4,"onet/fc2_2"),Xr=vn(256,10,"onet/fc2_3");return Object(Yn.a)(Object(Yn.a)({},In),{conv4:Ln,prelu4_alpha:qn,fc1:Cn,prelu5_alpha:wr,fc2_1:Fr,fc2_2:Rr,fc2_3:Xr})}}}(F,U),oe=X.extractPNetParams,me=X.extractRNetParams,Se=X.extractONetParams,Me=oe(),Te=me(),tt=Se();if(I().length!==0)throw new Error("weights remaing after extract: "+I().length);return{params:{pnet:Me,rnet:Te,onet:tt},paramMappings:U}}function $g(q){var R=[],F=function(Me,Te){var tt=ru(Me,Te);function at(wn){return{filters:tt(wn+"/weights",4,wn+"/filters"),bias:tt(wn+"/bias",1)}}function jt(wn){return{weights:tt(wn+"/weights",2),bias:tt(wn+"/bias",1)}}function $t(wn){return tt(wn,1)}function vn(wn){return{conv1:at(wn+"/conv1"),prelu1_alpha:$t(wn+"/prelu1_alpha"),conv2:at(wn+"/conv2"),prelu2_alpha:$t(wn+"/prelu2_alpha"),conv3:at(wn+"/conv3"),prelu3_alpha:$t(wn+"/prelu3_alpha")}}return{extractPNetParams:function(){var wn=vn("pnet"),Nn=at("pnet/conv4_1"),In=at("pnet/conv4_2");return Object(Yn.a)(Object(Yn.a)({},wn),{conv4_1:Nn,conv4_2:In})},extractRNetParams:function(){var wn=vn("rnet"),Nn=jt("rnet/fc1"),In=$t("rnet/prelu4_alpha"),Ln=jt("rnet/fc2_1"),qn=jt("rnet/fc2_2");return Object(Yn.a)(Object(Yn.a)({},wn),{fc1:Nn,prelu4_alpha:In,fc2_1:Ln,fc2_2:qn})},extractONetParams:function(){var wn=vn("onet"),Nn=at("onet/conv4"),In=$t("onet/prelu4_alpha"),Ln=jt("onet/fc1"),qn=$t("onet/prelu5_alpha"),Cn=jt("onet/fc2_1"),wr=jt("onet/fc2_2"),Fr=jt("onet/fc2_3");return Object(Yn.a)(Object(Yn.a)({},wn),{conv4:Nn,prelu4_alpha:In,fc1:Ln,prelu5_alpha:qn,fc2_1:Cn,fc2_2:wr,fc2_3:Fr})}}}(q,R),I=F.extractPNetParams,U=F.extractRNetParams,X=F.extractONetParams,oe=I(),me=U(),Se=X();return Na(q,R),{params:{pnet:oe,rnet:me,onet:Se},paramMappings:R}}function Uc(q,R){var F=R[0],I=R[1];return{height:Math.floor(F*q),width:Math.floor(I*q)}}var ol=function(q){function R(F,I,U,X){return q.call(this,{left:F,top:I,right:U,bottom:X},!0)||this}return Object(Yn.c)(R,q),R}(tu);function ry(q){return gn.tidy(function(){return gn.mul(gn.sub(q,gn.scalar(127.5)),gn.scalar(.0078125))})}function Zm(q,R){return gn.tidy(function(){return gn.add(gn.relu(q),gn.mul(R,gn.neg(gn.relu(gn.neg(q)))))})}function q0(q,R,F){return F===void 0&&(F=!1),gn.tidy(function(){var I=Ua(q,R.conv1,"valid");
vendor: 4,895 bytes, line 8260
8260return I=Zm(I,R.prelu1_alpha),I=Zm(I=Ua(I=gn.maxPool(I,F?[2,2]:[3,3],[2,2],"same"),R.conv2,"valid"),R.prelu2_alpha),I=Zm(I=Ua(I=F?I:gn.maxPool(I,[3,3],[2,2],"valid"),R.conv3,"valid"),R.prelu3_alpha)})}function Ib(q,R,F,I,U){U.stage1=[];var X=R.map(function(Te){return gn.tidy(function(){var tt={scale:Te},at=function(Nn,In){return gn.tidy(function(){var Ln=Uc(In,Nn.shape.slice(1)),qn=Ln.height,Cn=Ln.width,wr=ry(gn.image.resizeBilinear(Nn,[qn,Cn]));return gn.transpose(wr,[0,2,1,3])})}(q,Te),jt=Date.now(),$t=function(Nn,In){return gn.tidy(function(){var Ln=q0(Nn,In,!0),qn=Ua(Ln,In.conv4_1,"valid"),Cn=gn.expandDims(gn.max(qn,3),3);return{prob:gn.softmax(gn.sub(qn,Cn),3),regions:Ua(Ln,In.conv4_2,"valid")}})}(at,I),vn=$t.prob,wn=$t.regions;return tt.pnet=Date.now()-jt,{scoresTensor:gn.unstack(gn.unstack(vn,3)[1])[0],regionsTensor:gn.unstack(wn)[0],scale:Te,statsForScale:tt}})}).map(function(Te){var tt=Te.scoresTensor,at=Te.regionsTensor,jt=Te.scale,$t=Te.statsForScale,vn=function(In,Ln,qn,Cn){for(var wr=[],Fr=In.arraySync(),Rr=0;Rr<In.shape[0];Rr++)for(var Xr=0;Xr<In.shape[1];Xr++)Fr[Rr][Xr]>=Cn&&wr.push(new Mo(Xr,Rr));return wr.map(function(zr){var Ti=new ps(Math.round((zr.y*xd+1)/qn),Math.round((zr.x*xd+1)/qn),Math.round((zr.y*xd+wd)/qn),Math.round((zr.x*xd+wd)/qn)),Wi=Fr[zr.y][zr.x],zi=Ln.arraySync();return{cell:Ti,score:Wi,region:new ol(zi[zr.y][zr.x][0],zi[zr.y][zr.x][1],zi[zr.y][zr.x][2],zi[zr.y][zr.x][3])}})}(tt,at,jt,F);if(tt.dispose(),at.dispose(),!vn.length)return U.stage1.push($t),[];var wn=Date.now(),Nn=il(vn.map(function(In){return In.cell}),vn.map(function(In){return In.score}),.5);return $t.nms=Date.now()-wn,$t.numBoxes=Nn.length,U.stage1.push($t),Nn.map(function(In){return vn[In]})}).reduce(function(Te,tt){return Te.concat(tt)},[]),oe=[],me=[];if(X.length>0){var Se=Date.now(),Me=il(X.map(function(Te){return Te.cell}),X.map(function(Te){return Te.score}),.7);U.stage1_nms=Date.now()-Se,me=Me.map(function(Te){return X[Te].score}),oe=Me.map(function(Te){return X[Te]}).map(function(Te){var tt=Te.cell,at=Te.region;return new ps(tt.left+at.left*tt.width,tt.top+at.top*tt.height,tt.right+at.right*tt.width,tt.bottom+at.bottom*tt.height).toSquare().round()})}return{boxes:oe,scores:me}}function y1(q,R,F){var I=F.width,U=F.height;return Object(Yn.b)(this,void 0,void 0,function(){var X,oe,me,Se=this;return Object(Yn.d)(this,function(Me){switch(Me.label){case 0:return X=Tn(q),[4,Promise.all(R.map(function(Te){return Object(Yn.b)(Se,void 0,void 0,function(){var tt,at,jt,$t,vn,wn,Nn,In;return Object(Yn.d)(this,function(Ln){return tt=Te.padAtBorders(q.height,q.width),at=tt.y,jt=tt.ey,$t=tt.x,vn=tt.ex,wn=$t-1,Nn=at-1,In=X.getImageData(wn,Nn,vn-wn,jt-Nn),[2,en.isNodejs()?ui(In):createImageBitmap(In)]})})}))];case 1:return oe=Me.sent(),me=[],oe.forEach(function(Te){var tt=Tn(Br({width:I,height:U}));tt.drawImage(Te,0,0,I,U);for(var at=tt.getImageData(0,0,I,U).data,jt=[],$t=0;$t<at.length;$t+=4)jt.push(at[$t+2]),jt.push(at[$t+1]),jt.push(at[$t]);me.push(jt)}),[2,me.map(function(Te){return gn.tidy(function(){return ry(gn.transpose(gn.tensor4d(Te,[1,I,U,3]),[0,2,1,3]).toFloat())})})]}})})}function _d(q,R,F,I,U){return Object(Yn.b)(this,void 0,void 0,function(){var X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn,In;return Object(Yn.d)(this,function(Ln){switch(Ln.label){case 0:return X=Date.now(),[4,y1(q,R,{width:24,height:24})];case 1:return oe=Ln.sent(),U.stage2_extractImagePatches=Date.now()-X,X=Date.now(),me=oe.map(function(qn){var Cn=function(wr,Fr){return gn.tidy(function(){var Rr=q0(wr,Fr),Xr=Zm(Ia(gn.reshape(Rr,[Rr.shape[0],Fr.fc1.weights.shape[0]]),Fr.fc1),Fr.prelu4_alpha),zr=Ia(Xr,Fr.fc2_1),Ti=gn.expandDims(gn.max(zr,1),1),Wi=gn.softmax(gn.sub(zr,Ti),1),zi=Ia(Xr,Fr.fc2_2);return{scores:gn.unstack(Wi,1)[1],regions:zi}})}(qn,I);return qn.dispose(),Cn}),U.stage2_rnet=Date.now()-X,Se=me.length>1?gn.concat(me.map(function(qn){return qn.scores})):me[0].scores,tt=(Te=Array).from,[4,Se.data()];case 2:return Me=tt.apply(Te,[Ln.sent()]),Se.dispose(),at=Me.map(function(qn,Cn){return{score:qn,idx:Cn}}).filter(function(qn){return qn.score>F}).map(function(qn){return qn.idx}),jt=at.map(function(qn){return R[qn]}),$t=at.map(function(qn){return Me[qn]}),vn=[],wn=[],jt.length>0&&(X=Date.now(),Nn=il(jt,$t,.7),U.stage2_nms=Date.now()-X,In=Nn.map(function(qn){var Cn=me[at[qn]].regions.arraySync();return new ol(Cn[0][0],Cn[0][1],Cn[0][2],Cn[0][3])}),wn=Nn.map(function(qn){return $t[qn]}),vn=Nn.map(function(qn,Cn){return jt[qn].calibrate(In[Cn])})),me.forEach(function(qn){qn.regions.dispose(),qn.scores.dispose()}),[2,{boxes:vn,scores:wn}]}})})}function Lp(q,R,F,I,U){return Object(Yn.b)(this,void 0,void 0,function(){var X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn,In,Ln;return Object(Yn.d)(this,function(qn){switch(qn.label){case 0:return X=Date.now(),[4,y1(q,R,{width:48,height:48})];case 1:return oe=qn.sent(),U.stage3_extractImagePatches=Date.now()-X,
8260X=Date.now(),me=oe.map(function(Cn){var wr=function(Fr,Rr){return gn.tidy(function(){var Xr=q0(Fr,Rr);Xr=Zm(Xr=Ua(Xr=gn.maxPool(Xr,[2,2],[2,2],"same"),Rr.conv4,"valid"),Rr.prelu4_alpha);var zr=Zm(Ia(gn.reshape(Xr,[Xr.shape[0],Rr.fc1.weights.shape[0]]),Rr.fc1),Rr.prelu5_alpha),Ti=Ia(zr,Rr.fc2_1),Wi=gn.expandDims(gn.max(Ti,1),1),zi=gn.softmax(gn.sub(Ti,Wi),1),Xo=Ia(zr,Rr.fc2_2),wa=Ia(zr,Rr.fc2_3);return{scores:gn.unstack(zi,1)[1],regions:Xo,points:wa}})}(Cn,I);return Cn.dispose(),wr}),U.stage3_onet=Date.now()-X,Se=me.length>1?gn.concat(me.map(function(Cn){return Cn.scores})):me[0].scores,tt=(Te=Array).from,[4,Se.data()];case 2:return Me=tt.apply(Te,[qn.sent()]),Se.dispose(),at=Me.map(function(Cn,wr){return{score:Cn,idx:wr}}).filter(function(Cn){return Cn.score>F}).map(function(Cn){return Cn.idx}),jt=at.map(function(Cn){var wr=me[Cn].regions.arraySync();return new ol(wr[0][0],wr[0][1],wr[0][2],wr[0][3])}),$t=at.map(function(Cn,wr){return R[Cn].calibrate(jt[wr])}),vn=at.map(function(Cn){return Me[Cn]}),wn=[],Nn=[],In=[],$t.length>0&&(X=Date.now(),Ln=il($t,vn,.7,!1),U.stage3_nms=Date.now()-X,wn=Ln.map(function(Cn){return $t[Cn]}),Nn=Ln.map(function(Cn){return vn[Cn]}),In=Ln.map(function(Cn,wr){return Array(5).fill(0).map(function(Fr,Rr){var Xr=me[Cn].points.arraySync();return new Mo(Xr[0][Rr]*(wn[wr].width+1)+wn[wr].left,Xr[0][Rr+5]*(wn[wr].height+1)+wn[wr].top)})})),me.forEach(function(Cn){Cn.regions.dispose(),Cn.scores.dispose(),Cn.points.dispose()}),[2,{boxes:wn,scores:Nn,points:In}]}})})}var Eh=function(q){function R(){return q.call(this,"Mtcnn")||this}return Object(Yn.c)(R,q),R.prototype.load=function(F){return Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(I){return console.warn("mtcnn is deprecated and will be removed soon"),[2,q.prototype.load.call(this,F)]})})},R.prototype.loadFromDisk=function(F){return Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(I){return console.warn("mtcnn is deprecated and will be removed soon"),[2,q.prototype.loadFromDisk.call(this,F)]})})},R.prototype.forwardInput=function(F,I){return I===void 0&&(I={}),Object(Yn.b)(this,void 0,void 0,function(){var U,X,oe,me,Se,Me,Te,tt,at,jt,$t,vn,wn,Nn,In,Ln,qn,Cn,wr,Fr,Rr;return Object(Yn.d)(this,function(Xr){switch(Xr.label){case 0:if(!(U=this.params))throw new Error("Mtcnn - load model before inference");if(!(X=F.canvases[0]))throw new Error("Mtcnn - inputCanvas is not defined, note that passing tensors into Mtcnn.forwardInput is not supported yet.");return oe={},me=Date.now(),Se=gn.tidy(function(){return function(zr){return gn.tidy(function(){return gn.stack(gn.unstack(zr,3).reverse(),3)})}(gn.expandDims(gn.browser.fromPixels(X)).toFloat())}),Me=function(zr){return Se.dispose(),oe.total=Date.now()-me,zr},Te=Se.shape.slice(1),tt=Te[0],at=Te[1],jt=new Ql(I),$t=jt.minFaceSize,vn=jt.scaleFactor,wn=jt.maxNumScales,Nn=jt.scoreThresholds,In=jt.scaleSteps,Ln=(In||function(zr,Ti,Wi){for(var zi=Wi[0],Xo=Wi[1],wa=wd/zr,ua=[],oa=Math.min(zi,Xo)*wa,ha=0;oa>=12;)ua.push(wa*Math.pow(Ti,ha)),oa*=Ti,ha+=1;return ua}($t,vn,[tt,at])).filter(function(zr){var Ti=Uc(zr,[tt,at]);return Math.min(Ti.width,Ti.height)>wd}).slice(0,wn),oe.scales=Ln,oe.pyramid=Ln.map(function(zr){return Uc(zr,[tt,at])}),qn=Date.now(),[4,Ib(Se,Ln,Nn[0],U.pnet,oe)];case 1:return Cn=Xr.sent(),oe.total_stage1=Date.now()-qn,Cn.boxes.length?(oe.stage2_numInputBoxes=Cn.boxes.length,qn=Date.now(),[4,_d(X,Cn.boxes,Nn[1],U.rnet,oe)]):[2,Me({results:[],stats:oe})];case 2:return wr=Xr.sent(),oe.total_stage2=Date.now()-qn,wr.boxes.length?(oe.stage3_numInputBoxes=wr.boxes.length,qn=Date.now(),[4,Lp(X,wr.boxes,Nn[2],U.onet,oe)]):[2,Me({results:[],stats:oe})];case 3:return Fr=Xr.sent(),oe.total_stage3=Date.now()-qn,Rr=Fr.boxes.map(function(zr,Ti){return xa(bh({},new Da(Fr.scores[Ti],new Af(zr.left/at,zr.top/tt,zr.width/at,zr.height/tt),{height:tt,width:at})),new Bc(Fr.points[Ti].map(function(Wi){return Wi.sub(new Mo(zr.left,zr.top)).div(new Mo(zr.width,zr.height))}),{width:zr.width,height:zr.height}))}),[2,Me({results:Rr,stats:oe})]}})})},R.prototype.forward=function(F,I){return I===void 0&&(I={}),Object(Yn.b)(this,void 0,void 0,function(){var U;return Object(Yn.d)(this,function(X){switch(X.label){case 0:return U=this.forwardInput,[4,wi(F)];case 1:return[4,U.apply(this,[X.sent(),I])];case 2:return[2,X.sent().results]}})})},R.prototype.forwardWithStats=function(F,I){return I===void 0&&(I={}),Object(Yn.b)(this,void 0,void 0,function(){var U;return Object(Yn.d)(this,function(X){switch(X.label){case 0:return U=this.forwardInput,[4,wi(F)];case 1:return[2,U.apply(this,[X.sent(),I])]}})})},R.prototype.getDefaultModelName=function(){return"mtcnn_model"},R.prototype.extractParamsFromWeigthMap=function(F){return $g(F)},R.prototype.extractParams=function(F){return ny(F)},R}(Xi),Ch=.4,iy=[new Mo(1.603231,2.094468),new Mo(6.041143,7.080126
8260),new Mo(2.882459,3.518061),new Mo(4.266906,5.178857),new Mo(9.041765,10.66308)],G0=[117.001,114.697,97.404],Sh=function(q){function R(){var F={withSeparableConvs:!0,iouThreshold:Ch,classes:["face"],anchors:iy,meanRgb:G0,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};return q.call(this,F)||this}return Object(Yn.c)(R,q),Object.defineProperty(R.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),R.prototype.locateFaces=function(F,I){return Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(U){switch(U.label){case 0:return[4,this.detect(F,I)];case 1:return[2,U.sent().map(function(X){return new Da(X.score,X.relativeBox,{width:X.imageWidth,height:X.imageHeight})})]}})})},R.prototype.getDefaultModelName=function(){return"tiny_face_detector_model"},R.prototype.extractParamsFromWeigthMap=function(F){return q.prototype.extractParamsFromWeigthMap.call(this,F)},R}(kh),Ao={ssdMobilenetv1:new Jm,tinyFaceDetector:new Sh,tinyYolov2:new jp,mtcnn:new Eh,faceLandmark68Net:new P0,faceLandmark68TinyNet:new j0,faceRecognitionNet:new Km,faceExpressionNet:new Do,ageGenderNet:new Vv},kd=function(q,R){return Ao.ssdMobilenetv1.locateFaces(q,R)},zp=function(q,R){return Ao.tinyFaceDetector.locateFaces(q,R)},b1=function(q,R){return Ao.tinyYolov2.locateFaces(q,R)},x1=function(q,R){return Ao.mtcnn.forward(q,R)},Hg=function(q){return Ao.faceLandmark68Net.detectLandmarks(q)},Ed=function(q){return Ao.faceLandmark68TinyNet.detectLandmarks(q)},Mf=function(q){return Ao.faceRecognitionNet.computeFaceDescriptor(q)},eg=function(q){return Ao.faceExpressionNet.predictExpressions(q)},Up=function(q){return Ao.ageGenderNet.predictAgeAndGender(q)},Ah=function(q){return Ao.ssdMobilenetv1.load(q)},Cd=function(q){return Ao.tinyFaceDetector.load(q)},Sd=function(q){return Ao.mtcnn.load(q)},Wc=function(q){return Ao.tinyYolov2.load(q)},Wp=function(q){return Ao.faceLandmark68Net.load(q)},Oh=function(q){return Ao.faceLandmark68TinyNet.load(q)},Ff=function(q){return Ao.faceRecognitionNet.load(q)},ef=function(q){return Ao.faceExpressionNet.load(q)},Dh=function(q){return Ao.ageGenderNet.load(q)},qg=Ah,Th=kd,tf=Hg,Gs=function(q){function R(F,I,U){var X=q.call(this)||this;return X.parentTask=F,X.input=I,X.extractedFaces=U,X}return Object(Yn.c)(R,q),R}(If),Dl=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U=this;return Object(Yn.d)(this,function(X){switch(X.label){case 0:return[4,this.parentTask];case 1:return[4,zc(F=X.sent(),this.input,function(oe){return Object(Yn.b)(U,void 0,void 0,function(){return Object(Yn.d)(this,function(me){switch(me.label){case 0:return[4,Promise.all(oe.map(function(Se){return Ao.faceExpressionNet.predictExpressions(Se)}))];case 1:return[2,me.sent()]}})})},this.extractedFaces)];case 2:return I=X.sent(),[2,F.map(function(oe,me){return Ls(oe,I[me])})]}})})},R.prototype.withAgeAndGender=function(){return new K0(this,this.input)},R}(Gs),Vc=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F,I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return[4,this.parentTask];case 1:return(F=U.sent())?[4,bd(F,this.input,function(X){return Ao.faceExpressionNet.predictExpressions(X)},this.extractedFaces)]:[2];case 2:return I=U.sent(),[2,Ls(F,I)]}})})},R.prototype.withAgeAndGender=function(){return new Y0(this,this.input)},R}(Gs),bc=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.withAgeAndGender=function(){return new tg(this,this.input)},R.prototype.withFaceDescriptors=function(){return new Tl(this,this.input)},R}(Dl),Vp=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.withAgeAndGender=function(){return new da(this,this.input)},R.prototype.withFaceDescriptor=function(){return new Nh(this,this.input)},R}(Vc),Gg=function(q){function R(F,I,U){var X=q.call(this)||this;return X.parentTask=F,X.input=I,X.extractedFaces=U,X}return Object(Yn.c)(R,q),R}(If),K0=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U=this;return Object(Yn.d)(this,function(X){switch(X.label){case 0:return[4,this.parentTask];case 1:return[4,zc(F=X.sent(),this.input,function(oe){return Object(Yn.b)(U,void 0,void 0,function(){return Object(Yn.d)(this,function(me){switch(me.label){case 0:return[4,Promise.all(oe.map(function(Se){return Ao.ageGenderNet.predictAgeAndGender(Se)}))];case 1:return[2,me.sent()]}})})},this.extractedFaces)];case 2:return I=X.sent(),[2,F.map(function(oe,me){var Se=I[me],Me=Se.age;return U0(_h(oe,Se.gender,Se.genderProbability),Me)})]}})})},R.prototype.withFaceExpressions=function(){return new Dl(this,this.input)},R}(Gg),Y0=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U,X,oe;return Object(Yn.d)(this,function(me){switch(me.label){case 0:return[4,this.parentTask];case 1:return(F=me.sent())?[4,bd(F,this.input,function(Se){return Ao.ageGenderNet.predictAgeAndGender(Se)},this.extractedFaces)]:[2];
8260case 2:return I=me.sent(),U=I.age,X=I.gender,oe=I.genderProbability,[2,U0(_h(F,X,oe),U)]}})})},R.prototype.withFaceExpressions=function(){return new Vc(this,this.input)},R}(Gg),tg=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.withFaceExpressions=function(){return new bc(this,this.input)},R.prototype.withFaceDescriptors=function(){return new Tl(this,this.input)},R}(K0),da=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.withFaceExpressions=function(){return new Vp(this,this.input)},R.prototype.withFaceDescriptor=function(){return new Nh(this,this.input)},R}(Y0),ng=function(q){function R(F,I){var U=q.call(this)||this;return U.parentTask=F,U.input=I,U}return Object(Yn.c)(R,q),R}(If),Tl=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F;return Object(Yn.d)(this,function(I){switch(I.label){case 0:return[4,this.parentTask];case 1:return[4,zc(F=I.sent(),this.input,function(U){return Promise.all(U.map(function(X){return Ao.faceRecognitionNet.computeFaceDescriptor(X)}))},null,function(U){return U.landmarks.align(null,{useDlibAlignment:!0})})];case 2:return[2,I.sent().map(function(U,X){return z0(F[X],U)})]}})})},R.prototype.withFaceExpressions=function(){return new bc(this,this.input)},R.prototype.withAgeAndGender=function(){return new tg(this,this.input)},R}(ng),Nh=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F,I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return[4,this.parentTask];case 1:return(F=U.sent())?[4,bd(F,this.input,function(X){return Ao.faceRecognitionNet.computeFaceDescriptor(X)},null,function(X){return X.landmarks.align(null,{useDlibAlignment:!0})})]:[2];case 2:return I=U.sent(),[2,z0(F,I)]}})})},R.prototype.withFaceExpressions=function(){return new Vp(this,this.input)},R.prototype.withAgeAndGender=function(){return new da(this,this.input)},R}(ng),Ih=function(q){function R(F,I,U){var X=q.call(this)||this;return X.parentTask=F,X.input=I,X.useTinyLandmarkNet=U,X}return Object(Yn.c)(R,q),Object.defineProperty(R.prototype,"landmarkNet",{get:function(){return this.useTinyLandmarkNet?Ao.faceLandmark68TinyNet:Ao.faceLandmark68Net},enumerable:!0,configurable:!0}),R}(If),rg=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U,X,oe,me=this;return Object(Yn.d)(this,function(Se){switch(Se.label){case 0:return[4,this.parentTask];case 1:return F=Se.sent(),I=F.map(function(Me){return Me.detection}),this.input instanceof gn.Tensor?[4,_o(this.input,I)]:[3,3];case 2:return X=Se.sent(),[3,5];case 3:return[4,Co(this.input,I)];case 4:X=Se.sent(),Se.label=5;case 5:return U=X,[4,Promise.all(U.map(function(Me){return me.landmarkNet.detectLandmarks(Me)}))];case 6:return oe=Se.sent(),U.forEach(function(Me){return Me instanceof gn.Tensor&&Me.dispose()}),[2,F.map(function(Me,Te){return xa(Me,oe[Te])})]}})})},R.prototype.withFaceExpressions=function(){return new bc(this,this.input)},R.prototype.withAgeAndGender=function(){return new tg(this,this.input)},R.prototype.withFaceDescriptors=function(){return new Tl(this,this.input)},R}(Ih),Kg=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U,X,oe;return Object(Yn.d)(this,function(me){switch(me.label){case 0:return[4,this.parentTask];case 1:return(F=me.sent())?(I=F.detection,this.input instanceof gn.Tensor?[4,_o(this.input,[I])]:[3,3]):[2];case 2:return X=me.sent(),[3,5];case 3:return[4,Co(this.input,[I])];case 4:X=me.sent(),me.label=5;case 5:return U=X,[4,this.landmarkNet.detectLandmarks(U[0])];case 6:return oe=me.sent(),U.forEach(function(Se){return Se instanceof gn.Tensor&&Se.dispose()}),[2,xa(F,oe)]}})})},R.prototype.withFaceExpressions=function(){return new Vp(this,this.input)},R.prototype.withAgeAndGender=function(){return new da(this,this.input)},R.prototype.withFaceDescriptor=function(){return new Nh(this,this.input)},R}(Ih),Yg=function(q){function R(F,I){I===void 0&&(I=new Zl);var U=q.call(this)||this;return U.input=F,U.options=I,U}return Object(Yn.c)(R,q),R}(If),Xg=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F,I,U,X;return Object(Yn.d)(this,function(oe){switch(oe.label){case 0:return I=(F=this).input,(U=F.options)instanceof Ql?[4,Ao.mtcnn.forward(I,U)]:[3,2];case 1:return[2,oe.sent().map(function(me){return me.detection})];case 2:if(!(X=U instanceof Vg?function(me){return Ao.tinyFaceDetector.locateFaces(me,U)}:U instanceof Zl?function(me){return Ao.ssdMobilenetv1.locateFaces(me,U)}:U instanceof Pp?function(me){return Ao.tinyYolov2.locateFaces(me,U)}:null))throw new Error("detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | MtcnnOptions | TinyYolov2Options");return[2,X(I)]}})})},R.prototype.runAndExtendWithFaceDetections=function(){var F=this;return new Promise(function(I){return Object(Yn.b)(F,void 0,void 0,function(){var U;return Object(Yn.d)(this,function(X){switch(X.label){case 0:return[4,this.run()];case 1:return U=X.sent(),[2,I(U.map(function(oe){return bh({},oe)}))]}})})})},R.prototype.withFaceLandmarks=function(F){return F===void 0&&(F=!1),new rg(this.runAndExtendWithFaceDetections(),this.input,F)},R.prototype.withFaceExpressions=function(){return new Dl(this.runAndExtendWithFaceDetections(),this.input)},R.prototype.withAgeAndGender=function(){return new K0(this.runAndExtendWithFaceDetections(),this.input)},R}(Yg),oy=function(q){function R(){return q!==null&&q.apply(this,arguments)||this}return Object(Yn.c)(R,q),R.prototype.run=function(){return Object(Yn.b)(this,void 0,void 0,function(){var F,I;return Object(Yn.d)(this,function(U){switch(U.label){case 0:return[4,new Xg(this.input,this.options)];case 1:return F=U.sent(),I=F[0],F.forEach(function(X){X.score>I.score&&(I=X)}),[2,I]}})})},R.prototype.runAndExtendWithFaceDetection=function(){var F=this;return new Promise(function(I){return Object(Yn.b)(F,void 0,void 0,function(){var U;return Object(Yn.d)(this,function(X){switch(X.label){case 0:return[4,this.run()];case 1:return U=X.sent(),[2,I(U?bh({},U):void 0)]}})})})},R.prototype.withFaceLandmarks=function(F){return F===void 0&&(F=!1),new Kg(this.runAndExtendWithFaceDetection(),this.input,F)},R.prototype.withFaceExpressions=function(){return new Vc(this.runAndExtendWithFaceDetection(),this.input)},R.prototype.withAgeAndGender=function(){return new Y0(this.runAndExtendWithFaceDetection(),this.input)},R}(Yg);function Jg(q,R){return R===void 0&&(R=new Zl),new oy(q,R)}function Ad(q,R){return R===void 0&&(R=new Zl),new Xg(q,R)}function Qg(q,R){return Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(F){switch(F.label){case 0:return console.warn("allFacesSsdMobilenetv1 is deprecated and will be removed soon, use the high level api instead"),[4,Ad(q,new Zl(R?{minConfidence:R}:{})).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,F.sent()]}})})}function $p(q,R){return R===void 0&&(R={}),Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(F){switch(F.label){case 0:return console.warn("allFacesTinyYolov2 is deprecated and will be removed soon, use the high level api instead"),[4,Ad(q,new Pp(R)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,F.sent()]}})})}function Zg(q,R){return R===void 0&&(R={}),Object(Yn.b)(this,void 0,void 0,function(){return Object(Yn.d)(this,function(F){switch(F.label){case 0:return console.warn("allFacesMtcnn is deprecated and will be removed soon, use the high level api instead"),[4,Ad(q,new Ql(R)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,F.sent()]}})})}var X0=Qg;function J0(q,R){if(q.length!==R.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");var F=Array.from(q),I=Array.from(R);return Math.sqrt(F.map(function(U,X){return U-I[X]}).reduce(function(U,X){return U+Math.pow(X,2)},0))}var ig=function(){function q(R,F){F===void 0&&(F=.6),this._distanceThreshold=F;var I=Array.isArray(R)?R:[R];if(!I.length)throw new Error("FaceRecognizer.constructor - expected atleast one input");var U=1,X=function(){return"person "+U++};this._labeledDescriptors=I.map(function(oe){if(oe instanceof vh)return oe;if(oe instanceof Float32Array)return new vh(X(),[oe]);if(oe.descriptor&&oe.descriptor instanceof Float32Array)return new vh(X(),[oe.descriptor]);throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array | Array<LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array>")})}return Object.defineProperty(q.prototype,"labeledDescriptors",{get:function(){return this._labeledDescriptors},enumerable:!0,configurable:!0}),Object.defineProperty(q.prototype,"distanceThreshold",{get:function(){return this._distanceThreshold},enumerable:!0,configurable:!0}),q.prototype.computeMeanDistance=function(R,F){return F.map(function(I){return J0(I,R)}).reduce(function(I,U){return I+U},0)/(F.length||1)},q.prototype.matchDescriptor=function(R){var F=this;return this.labeledDescriptors.map(function(I){var U=I.descriptors,X=I.label;return new lc(X,F.computeMeanDistance(R,U))}).reduce(function(I,U){return I.distance<U.distance?I:U})},q.prototype.findBestMatch=function(R){var F=this.matchDescriptor(R);return F.distance<this.distanceThreshold?F:new lc("unknown",F.distance)},q.prototype.toJSON=function(){return{distanceThreshold:this.distanceThreshold,labeledDescriptors:this.labeledDescriptors.map(function(R){return R.toJSON()})}},q.fromJSON=function(R){return new q(R.labeledDescriptors.map(function(F){return vh.fromJSON(F)}),R.distanceThreshold)},q}();function Q0(q){var R=new Eh;return R.extractWeights(q),R}function e0(q){var R=new Sh;return R.extractWeights(q),R}function ay(q,R){var F=new Eu(R.width,R.height),I=F.width,U=F.height;if(I<=0||U<=0)throw new Error("resizeResults - invalid dimensions: "+JSON.stringify({width:I,height:U}));if(Array.isArray(q))return q.map(function(me){return ay(me,{width:I,height:U})});if(Xl(q)){var X=q.detection.forSize(I,U),oe=q.unshiftedLandmarks.forSize(X.box.width,X.box.height);return xa(bh(q,X),oe)}return vd(q)?bh(q,q.detection.forSize(I,U)):q instanceof Yu||q instanceof Da?q.forSize(I,U):q}var Rf={withLandmarks:!0,withDescriptors:!0,minConfidence:.5,withTinyNet:!0,MODEL_URLS:{Mobilenetv1Model:"https://raw.githubusercontent.com/ml5js/ml5-data-and-models/main/models/faceapi/ssd_mobilenetv1_model-weights_manifest.json",TinyFaceDetectorModel:"https://raw.githubusercontent.com/ml5js/ml5-data-and-models/main/models/faceapi/tiny_face_detector_model-weights_manifest.json",FaceLandmarkModel:"https://raw.githubusercontent.com/ml5js/ml5-data-and-models/main/models/faceapi/face_landmark_68_model-weights_manifest.json",FaceLandmark68TinyNet:"https://raw.githubusercontent.com/ml5js/ml5-data-and-models/main/models/faceapi/face_landmark_68_tiny_model-weights_manifest.json",FaceRecognitionModel:"https://raw.githubusercontent.com/ml5js/ml5-data-and-models/main/models/faceapi/face_recognition_model-weights_manifest.json"}},w1=function(){function q(R,F,I){ce()(this,q),this.video=R,this.model=null,this.modelReady=!1,this.detectorOptions=null,this.config={minConfidence:this.checkUndefined(F.minConfidence,Rf.minConfidence),withLandmarks:this.checkUndefined(F.withLandmarks,Rf.withLandmarks),withDescriptors:this.checkUndefined(F.withDescriptors,Rf.withDescriptors),withTinyNet:this.checkUndefined(F.withTinyNet,Rf.withTinyNet),MODEL_URLS:{Mobilenetv1Model:this.checkUndefined(F.Mobilenetv1Model,Rf.MODEL_URLS.Mobilenetv1Model),TinyFaceDetectorModel:this.checkUndefined(F.TinyFaceDetectorModel,Rf.MODEL_URLS.TinyFaceDetectorModel),FaceLandmarkModel:this.checkUndefined(F.FaceLandmarkModel,Rf.MODEL_URLS.FaceLandmarkModel),FaceLandmark68TinyNet:this.checkUndefined(F.FaceLandmark68TinyNet,Rf.MODEL_URLS.FaceLandmark68TinyNet),FaceRecognitionModel:this.checkUndefined(F.FaceRecognitionModel,Rf.MODEL_URLS.FaceRecognitionModel)}},this.ready=$e(this.loadModel(),I)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(){var I,U,X,oe,me,Se,Me,Te=this;return be.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:if(I=["Mobilenetv1Model","TinyFaceDetectorModel","FaceLandmarkModel","FaceLandmark68TinyNet","FaceRecognitionModel"],Object.keys(this.config.MODEL_URLS).forEac
8260h(function(at){I.includes(at)&&(Te.config.MODEL_URLS[at]=Qc.getModelPath(Te.config.MODEL_URLS[at]))}),U=this.config.MODEL_URLS,X=U.Mobilenetv1Model,oe=U.TinyFaceDetectorModel,me=U.FaceLandmarkModel,Se=U.FaceRecognitionModel,Me=U.FaceLandmark68TinyNet,this.model=M,this.config.withTinyNet===!0?this.detectorOptions=new Vg({minConfidence:this.minConfidence,inputSize:512}):this.detectorOptions=new Zl({minConfidence:this.minConfidence}),this.config.withTinyNet!==!0){tt.next=12;break}return tt.next=8,this.model.loadFaceLandmarkTinyModel(Me);case 8:return tt.next=10,this.model.loadTinyFaceDetectorModel(oe);case 10:tt.next=16;break;case 12:return tt.next=14,this.model.loadFaceLandmarkModel(me);case 14:return tt.next=16,this.model.loadSsdMobilenetv1Model(X);case 16:return tt.next=18,this.model.loadFaceRecognitionModel(Se);case 18:return this.modelReady=!0,tt.abrupt("return",this);case 20:case"end":return tt.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"detect",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(oe=this.video,Se=this.config,typeof I!="function"){Me.next=7;break}oe=this.video,me=I,Me.next=21;break;case 7:if(!(I instanceof HTMLImageElement||I instanceof HTMLCanvasElement||I instanceof HTMLVideoElement||I instanceof ImageData)){Me.next=11;break}oe=I,Me.next=21;break;case 11:if(Ee()(I)!=="object"||!(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLCanvasElement||I.elt instanceof HTMLVideoElement||I.elt instanceof ImageData)){Me.next=15;break}oe=I.elt,Me.next=21;break;case 15:if(!(Ee()(I)==="object"&&I.canvas instanceof HTMLCanvasElement)){Me.next=19;break}oe=I.canvas,Me.next=21;break;case 19:if(this.video instanceof HTMLVideoElement){Me.next=21;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 21:return Ee()(U)==="object"?Se=U:typeof U=="function"&&(me=U),typeof X=="function"&&(me=X),Me.abrupt("return",$e(this.detectInternal(oe,Se),me));case 24:case"end":return Me.stop()}},F,this)}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"detectInternal",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se,Me=this;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return Te.next=2,this.ready;case 2:return Te.next=4,N.nextFrame();case 4:if(!this.video||this.video.readyState!==0){Te.next=7;break}return Te.next=7,new Promise(function(tt){Me.video.onloadeddata=function(){return tt()}});case 7:if(this.config=this.setReturnOptions(U),X=this.config,oe=X.withLandmarks,me=X.withDescriptors,!oe){Te.next=21;break}if(!me){Te.next=16;break}return Te.next=13,this.model.detectAllFaces(I,this.detectorOptions).withFaceLandmarks(this.config.withTinyNet).withFaceDescriptors();case 13:Se=Te.sent,Te.next=19;break;case 16:return Te.next=18,this.model.detectAllFaces(I,this.detectorOptions).withFaceLandmarks(this.config.withTinyNet);case 18:Se=Te.sent;case 19:Te.next=30;break;case 21:if(oe){Te.next=27;break}return Te.next=24,this.model.detectAllFaces(I);case 24:Se=Te.sent,Te.next=30;break;case 27:return Te.next=29,this.model.detectAllFaces(I,this.detectorOptions).withFaceLandmarks(this.config.withTinyNet).withFaceDescriptors();case 29:Se=Te.sent;case 30:return Se=this.resizeResults(Se,I.width,I.height),Se=this.landmarkParts(Se),Te.abrupt("return",Se);case 33:case"end":return Te.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"detectSingle",value:function(){var R=K()(be.a.mark(function F(I,U,X){var oe,me,Se;return be.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(oe=this.video,Se=this.config,typeof I!="function"){Me.next=7;break}oe=this.video,me=I,Me.next=21;break;case 7:if(!(I instanceof HTMLImageElement||I instanceof HTMLCanvasElement||I instanceof HTMLVideoElement||I instanceof ImageData)){Me.next=11;break}oe=I,Me.next=21;break;case 11:if(Ee()(I)!=="object"||!(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLCanvasElement||I.elt instanceof HTMLVideoElement||I.elt instanceof ImageData)){Me.next=15;break}oe=I.elt,Me.next=21;break;case 15:if(!(Ee()(I)==="object"&&I.canvas instanceof HTMLCanvasElement)){Me.next=19;break}oe=I.canvas,Me.next=21;break;case 19:if(this.video instanceof HTMLVideoElement){Me.next=21;break}throw new Error("No input image provided. If you want to classify a video, pass the video element in the constructor. ");case 21:return Ee()(U)==="object"?Se=U:typeof U=="function"&&(me=U),typeof X=="function"&&(me=X),Me.abrupt("return",$e(this.detectSingleInternal(oe,Se),me));case 24:case"end":return Me.stop()}},F,this)}));return function(F,I,U){return R.apply(this,arguments)}}()},{key:"detectSingleInternal",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe,me,Se,Me=this;return be.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return Te.next=2,this.ready;case 2:return Te.next=4,N.nextFrame();case 4:if(!this.video||this.video.readyState!==0){Te.next=7;break}return Te.next=7,new Promise(function(tt){Me.video.onloadeddata=function(){return tt()}});case 7:if(this.config=this.setReturnOptions(U),X=this.config,oe=X.withLandmarks,me=X.withDescriptors,!oe){Te.next=21;break}if(!me){Te.next=16;break}return Te.next=13,this.model.detectSingleFace(I,this.detectorOptions).withFaceLandmarks(this.config.withTinyNet).withFaceDescriptor();case 13:Se=Te.sent,Te.next=19;break;case 16:return Te.next=18,this.model.detectSingleFace(I,this.detectorOptions).withFaceLandmarks(this.config.withTinyNet);case 18:Se=Te.sent;case 19:Te.next=30;break;case 21:if(oe){Te.next=27;break}return Te.next=24,this.model.detectSingleFace(I);case 24:Se=Te.sent,Te.next=30;break;case 27:return Te.next=29,this.model.detectSingleFace(I,this.detectorOptions).withFaceLandmarks(this.config.withTinyNet).withFaceDescriptor();case 29:Se=Te.sent;case 30:return Se=this.resizeResults(Se,I.width,I.height),Se=this.landmarkParts(Se),Te.abrupt("return",Se);case 33:case"end":return Te.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"checkUndefined",value:function(R,F){return R!==void 0?R:F}},{key:"setReturnOptions",value:function(R){var F=this,I=Object.assign({},this.config);return["withLandmarks","withDescriptors"].forEach(function(U){R[U]!==void 0?F.config[U]=R[U]:I[U]=F.config[U]}),I}},{key:"resizeResults",value:function(R,F,I){if(F===void 0||I===void 0)throw new Error("width and height must be defined");return this.model.resizeResults(R,{width:F,height:I})}},{key:"landmarkParts",value:function(R){var F;if(Array.isArray(R)===!0)F=R.map(function(U){var X=Object.assign({},U);if(X.landmarks){var oe=X.landmarks;X.parts={mouth:oe.getMouth(),nose:oe.getNose(),leftEye:oe.getLeftEye(),leftEyeBrow:oe.getLeftEyeBrow(),rightEye:oe.getRightEye(),rightEyeBrow:oe.getRightEyeBrow(),jawOutline:oe.getJawOutline()}}else X.parts={mouth:[],nose:[],leftEye:[],leftEyeBrow:[],rightEye:[],rightEyeBrow:[],jawOutline:[]};return X});else if((F=Object.assign({},R)).landmarks){var I=R.landmarks;F.parts={mouth:I.getMouth(),nose:I.getNose(),leftEye:I.getLeftEye(),leftEyeBrow:I.getLeftEyeBrow(),rightEye:I.getRightEye(),rightEyeBrow:I.getRightEyeBrow()}}else F.parts={mouth:[],nose:[],leftEye:[],leftEyeBrow:[],rightEye:[],rightEyeBrow:[]};return F}}]),q}(),sy=function(q,R,F){var I,U={},X=F;q instanceof HTMLVideoElement?I=q:Ee()(q)==="object"&&q.elt instanceof HTMLVideoElement?I=q.elt:Ee()(q)==="object"?U=q:typeof q=="function"&&(X=q),Ee()(R)==="object"?(U=R,console.log(U)):typeof R=="function"&&(X=R);var oe=new w1(I,U,X);return X?oe:oe.ready},og={k:3,maxIter:5,threshold:.5};function uy(q){return Od.apply(this,arguments)}function Od(){return(Od=K()(be.a.mark(function q(R){var F,I;return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return F=N.data.csv(R),U.next=3,F.toArray();case 3:return I=U.sent,U.abrupt("return",I);case 5:case"end":return U.stop()}},q)}))).apply(this,arguments)}function cy(q){return ag.apply(this,arguments)}function ag(){return(ag=K()(be.a.mark(function q(R){var F,I;return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:if(typeof R!="string"){U.next=6;break}return U.next=3,uy(R);case 3:F=U.sent,U.next=7;break;case 6:F=R;case 7:return I=F.map(function(X){return Object.values(X)}),U.abrupt("return",I);case 9:case"end":return U.stop()}},q)}))).apply(this,arguments)}var t0=function(){function q(R,F,I){ce()(this,q),this.config={k:F.k||og.k,maxIter:F.maxIter||og.maxIter,threshold:F.threshold||og.threshold},this.ready=$e(this.load(R),I)}return ke()(q,[{key:"load",value:function(){var R=K()(be.a.mark(function F(I){var U=this;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,cy(I);case 2:return this.dataset=X.sent,N.tidy(function(){U.dataTensor=N.tensor2d(U.dataset),U.dataset.forEach(function(oe){var me=N.tensor1d(Object.values(oe));oe.tensor=me}),U.centroids=N.tensor2d(hh(U.dataset,U.config.k,!1)),U.fit()}),X.abrupt("return",this);case 5:case"end":return X.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"fit",value:function(){this.getClosestCentroids(),this.recenterCentroids();for(var R=q.getEuclidianDistance(this.centroids,this.centroidsOld),F=0;R>this.config.threshold&&F<this.config.maxIter;)this.getClosestCentroids(),this.recenterCentroids(),R=q.getEuclidianDistance(this.centroids,this.centroidsOld),F+=1}},{key:"getClosestCentroids",value:function(){var R=this;this.dataset.forEach(function(F){var I=R.closestCentroid(F.tensor);F.centroid=I})}},{key:"closestCentroid",value:function(R){var F=this;return N.tidy(function(){return F.centroids.squaredDifference(R).sum(1).sqrt().argMin().arraySync()})}},{key:"classify",value:function(R){var F=this;return N.tidy(function(){var I=N.tensor1d(Object.values(R));return F.closestCentroid(I)})}},{key:"recenterCentroids",value:function(){var R=this,F=N.tidy(function(){return R.centroidsOld=R.centroids,N.stack(R.centroids.unstack().map(function(I,U){var X=R.dataset.f
8260ilter(function(oe){return oe.centroid===U}).map(function(oe){return oe.tensor});return X.length===0?I:X.length===1?X[0]:N.tidy(function(){return N.stack(X).mean(0)})}))});this.centroids=F}}],[{key:"getEuclidianDistance",value:function(R,F){return N.tidy(function(){return N.squaredDifference(R,F).sum().sqrt().dataSync()})[0]}}]),q}(),ly=function(q,R,F){return new t0(q,R,F)};function fy(q){return Z0.apply(this,arguments)}function Z0(){return(Z0=K()(be.a.mark(function q(R){var F,I;return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return F=N.data.csv(R),U.next=3,F.toArray();case 3:return I=U.sent,U.abrupt("return",I);case 5:case"end":return U.stop()}},q)}))).apply(this,arguments)}function dy(q){return hy.apply(this,arguments)}function hy(){return(hy=K()(be.a.mark(function q(R){var F,I;return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:if(typeof R!="string"){U.next=6;break}return U.next=3,fy(R);case 3:F=U.sent,U.next=7;break;case 6:F=R;case 7:return I=F.map(function(X){return Object.values(X)}),U.abrupt("return",I);case 9:case"end":return U.stop()}},q)}))).apply(this,arguments)}var Mh={eps:50,minPts:3},_1=function(){function q(R,F,I){ce()(this,q),this.config={eps:F.eps||Mh.eps,minPts:F.minPts||Mh.minPts},this.lastClusterId=0,this.status=[],this.ready=$e(this.load(R),I)}return ke()(q,[{key:"load",value:function(){var R=K()(be.a.mark(function F(I){var U=this;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return X.next=2,dy(I);case 2:return this.dataset=X.sent,N.tidy(function(){U.dataTensor=N.tensor2d(U.dataset),U.dataset.forEach(function(oe){var me=N.tensor1d(Object.values(oe));oe.tensor=me}),U.fit()}),X.abrupt("return",this);case 5:case"end":return X.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"fit",value:function(){var R=this;this.dataset.forEach(function(F,I){if(F.status===void 0){F.status=0;var U=R.getNeighboursIndices(F);U.length<R.config.minPts?F.status=0:(R.incrementClusterId(),R.extend(I,U))}})}},{key:"extend",value:function(R,F){var I=this;this.dataset[R].clusterid=this.getClusterId(),this.dataset[R].status=this.dataset[R].clusterid,F.forEach(function(U){if(I.dataset[U].status===void 0){I.dataset[U].status=0;var X=I.getNeighboursIndices(I.dataset[U]);X.length>=I.config.minPts&&I.extend(U,X)}I.dataset[U].status<1&&(I.dataset[U].status=I.dataset[R].clusterid,I.dataset[U].clusterid=I.dataset[R].clusterid)})}},{key:"getClusterId",value:function(){return this.lastClusterId}},{key:"incrementClusterId",value:function(){this.lastClusterId+=1}},{key:"getNeighboursIndices",value:function(R){var F=this;try{return N.tidy(function(){var I=N.squaredDifference(R.tensor,F.dataTensor).sum(1).sqrt().topk(F.dataTensor.shape[0],!0),U=I.values,X=I.indices;return N.stack([U.asType("float32"),X.asType("float32")],1).arraySync().filter(function(oe){return oe[0]<=F.config.eps}).reduce(function(oe,me){return oe.push(me[1]),oe},[])})||[]}catch(I){console.log("error ".concat(I))}return[]}}]),q}(),py=function(q,R,F){return new _1(q,R,F)},Bf={hosoda:"https://raw.githubusercontent.com/leemengtaiwan/tfjs-models/master/cartoongan/tfjs_json_models/hosoda/model.json",miyazaki:"https://raw.githubusercontent.com/Derek-Wds/training_CartoonGAN/master/tfModels/Miyazaki/model.json"},ev=function(){function q(R,F){ce()(this,q),this.config={modelUrl:R.modelUrl?R.modelUrl:Bf.miyazaki,returnTensors:!!R.returnTensors&&R.returnTensors},this.model={},this.ready=!1,this.ready=$e(this.loadModel(this.config.modelUrl),F)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return U.next=2,N.loadGraphModel(I);case 2:return this.model=U.sent,U.abrupt("return",this);case 4:case"end":return U.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"generate",value:function(){var R=K()(be.a.mark(function F(I,U){var X,oe;return be.a.wrap(function(me){for(;;)switch(me.prev=me.next){case 0:if(oe=U,!Fn(I)){me.next=5;break}X=I,me.next=19;break;case 5:if(Ee()(I)!=="object"||!Fn(I.elt)){me.next=9;break}X=I.elt,me.next=19;break;case 9:if(Ee()(I)!=="object"||!Fn(I.canvas)){me.next=13;break}X=I.canvas,me.next=19;break;case 13:if(typeof I!="function"){me.next=18;break}X=this.video,oe=I,me.next=19;break;case 18:throw new Error("Detection subject not supported");case 19:return me.abrupt("return",$e(this.generateInternal(X),oe));case 20:case"end":return me.stop()}},F,this)}));return function(F,I){return R.apply(this,arguments)}}()},{key:"generateInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,this.ready;case 2:return Se.next=4,N.nextFrame();case 4:if((U=N.browser.fromPixels(I).resizeBilinear([256,256])).shape[0]===256&&U.shape[1]===256){Se.next=9;break}throw new Error("Input size should be ".concat(256,"*").concat(256," but ").concat(U.shape," is found"));case 9:if(U.shape[2]===3){Se.next=11;break}throw new Error("Input color channel number should be 3 but ".concat(U.shape[2]," is found"));case 11:if(U=U.sub(127.5).div(127.5).reshape([1,256,256,3]),X=N.ones([256,256,1]).tile([1,1,1]).mul(255),oe=(oe=(oe=this.model.predict(U)).add(1).mul(127.5).reshape([256,256,3]).floor()).concat(X,2),me=this.resultFinalize(oe),!this.config.returnTensors){Se.next=19;break}return Se.abrupt("return",me);case 19:return U.dispose(),oe.dispose(),Se.abrupt("return",me);case 22:case"end":return Se.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()},{key:"resultFinalize",value:function(){var R=K()(be.a.mark(function F(I){var U,X,oe,me;return be.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return U=I,Se.next=3,I.data();case 3:return X=Se.sent,Se.next=6,cr.rawToBlob(X,I.shape[0],I.shape[1]);case 6:return oe=Se.sent,Se.next=9,cr.blobToP5Image(oe);case 9:if(me=Se.sent,!this.config.returnTensors){Se.next=12;break}return Se.abrupt("return",{tensor:U,raw:X,blob:oe,image:me});case 12:return Se.abrupt("return",{raw:X,blob:oe,image:me});case 13:case"end":return Se.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()}]),q}(),my=function(q,R){var F=Ee()(q)==="object"?q:{},I=typeof q=="function"?q:R;return typeof q=="string"&&(F.modelUrl=q),new ev(F,I)};/** 8261 * @license 8262 * Copyright 2021 Google LLC. All Rights Reserved. 8263 * Licensed under the Apache License, Version 2.0 (the "License");
8264 * you may not use this file except in compliance with the License. 8265 * You may obtain a copy of the License at 8266 * 8267 * http://www.apache.org/licenses/LICENSE-2.0 8268 * 8269 * Unless required by applicable law or agreed to in writing, software 8270 * distributed under the License is distributed on an "AS IS" BASIS, 8271 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8272 * See the License for the specific language governing permissions and 8273 * limitations under the License. 8274 * ============================================================================= 8275 */function Fh(q,R,F,I){return new(F||(F=Promise))(function(U,X){function oe(Me){try{Se(I.next(Me))}catch(Te){X(Te)}}function me(Me){try{Se(I.throw(Me))}catch(Te){X(Te)}}function Se(Me){var Te;Me.done?U(Me.value):(Te=Me.value,Te instanceof F?Te:new F(function(tt){tt(Te)})).then(oe,me)}Se((I=I.apply(q,R||[])).next())})}function Pf(q,R){var F,I,U,X,oe={label:0,sent:function(){if(1&U[0])throw U[1];return U[1]},trys:[],ops:[]};return X={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function me(Se){return function(Me){return function(Te){if(F)throw new TypeError("Generator is already executing.");for(;oe;)try{if(F=1,I&&(U=2&Te[0]?I.return:Te[0]?I.throw||((U=I.return)&&U.call(I),0):I.next)&&!(U=U.call(I,Te[1])).done)return U;switch(I=0,U&&(Te=[2&Te[0],U.value]),Te[0]){case 0:case 1:U=Te;break;case 4:return oe.label++,{value:Te[1],done:!1};case 5:oe.label++,I=Te[1],Te=[0];continue;case 7:Te=oe.ops.pop(),oe.trys.pop();continue;default:if(!(U=(U=oe.trys).length>0&&U[U.length-1])&&(Te[0]===6||Te[0]===2)){oe=0;continue}if(Te[0]===3&&(!U||Te[1]>U[0]&&Te[1]<U[3])){oe.label=Te[1];break}if(Te[0]===6&&oe.label<U[1]){oe.label=U[1],U=Te;break}if(U&&oe.label<U[2]){oe.label=U[2],oe.ops.push(Te);break}U[2]&&oe.ops.pop(),oe.trys.pop();continue}Te=R.call(q,oe)}catch(tt){Te=[6,tt],I=0}finally{F=U=0}if(5&Te[0])throw Te[1];return{value:Te[0]?Te[1]:void 0,done:!0}}([Se,Me])}}}var n0=function(q){for(var R=[],F=0,I=q;F<I.length;F++){var U=I[F];R.push(U)}return R},tv=function(){this.parent=null,this.children={},this.end=!1,this.word=[[],0,0]},Nl=function(){function q(){this.root=new tv}return q.prototype.insert=function(R,F,I){for(var U=this.root,X=n0(R),oe=0;oe<X.length;oe++)U.children[X[oe]]||(U.children[X[oe]]=new tv,U.children[X[oe]].parent=U,U.children[X[oe]].word[0]=U.word[0].concat(X[oe])),U=U.children[X[oe]],oe===X.length-1&&(U.end=!0,U.word[1]=F,U.word[2]=I)},q.prototype.commonPrefixSearch=function(R){for(var F=[],I=this.root.children[R[0]],U=0;U<R.length&&I;U++)I.end&&F.push(I.word),I=I.children[R[U+1]];return F.length||F.push([[R[0]],0,0]),F},q}(),nv="â",gy=6,Dd=function(){function q(R,F){F===void 0&&(F=gy),this.vocabulary=R,this.reservedSymbolsCount=F,this.trie=new Nl;for(var I=this.reservedSymbolsCount;I<this.vocabulary.length;I++)this.trie.insert(this.vocabulary[I][0],this.vocabulary[I][1],I)}return q.prototype.encode=function(R){var F=[],I=[],U=[];R=function(Cn){var wr=Cn.normalize("NFKC");return wr.length>0?nv+wr.replace(/ /g,nv):wr}(R);for(var X=n0(R),oe=0;oe<=X.length;oe++)F.push({}),I.push(0),U.push(0);for(oe=0;oe<X.length;oe++)for(var me=this.trie.commonPrefixSearch(X.slice(oe)),Se=0;Se<me.length;Se++){var Me=me[Se],Te={key:Me[0],score:Me[1],index:Me[2]};F[oe+(tt=Me[0].length)][oe]==null&&(F[oe+tt][oe]=[]),F[oe+tt][oe].push(Te)}for(var tt=0;tt<=X.length;tt++)for(var at in F[tt]){var jt=F[tt][at];for(Se=0;Se<jt.length;Se++){var $t=jt[Se],vn=$t.score+U[tt-$t.key.length];(U[tt]===0||vn>=U[tt])&&(U[tt]=vn,I[tt]=jt[Se].index)}}for(var wn=[],Nn=I.length-1;Nn>0;)wn.push(I[Nn]),Nn-=this.vocabulary[I[Nn]][0].length;var In=[],Ln=!1;for(oe=0;oe<wn.length;oe++){var qn=wn[oe];Ln&&qn===0||In.push(qn),Ln=qn===0}return In.reverse()},q}();function k1(q){return Fh(this,void 0,void 0,function(){var R;return Pf(this,function(F){switch(F.label){case 0:return[4,Hp(q)];case 1:return R=F.sent(),[2,new Dd(R)]}})})}function Hp(q){return Fh(this,void 0,void 0,function(){return Pf(this,function(R){switch(R.label){case 0:return[4,Ke.util.fetch(q)];case 1:return[2,R.sent().json()]}})})}function qp(q){return Fh(this,void 0,void 0,function(){var R;return Pf(this,function(F){switch(F.label){case 0:return[4,(R=new Td).load(q)];case 1:return F.sent(),[2,R]}})})}var Td=function(){function q(){}return q.prototype.loadModel=function(R){return Fh(this,void 0,void 0,function(){return Pf(this,function(F){return[2,R?Object(Mt.loadGraphModel)(R):Object(Mt.loadGraphModel)("https://tfhub.dev/tensorflow/tfjs-model/universal-sentence-encoder-lite/1/default/1",{fromTFHub:!0})]})})},q.prototype.load=function(R){return R===void 0&&(R={}),Fh(this,void 0,void 0,function(){var F,I,U;return Pf(this,function(X){switch(X.label){case 0:return[4,Promise.all([this.loadModel(R.modelUrl),Hp(R.vocabUrl||"https://storage.googleapis.com/tfjs-models/savedmodel/universal_sentence_encoder/vocab.json")])];case 1:return F=X.sent(),I=F[0],U=F[1],this.model=I,this.tokenizer=new Dd(U),[2]}})})},q.prototype.embed=function(R){return Fh(this,void 0,void 0,function(){var F,I,U,X,oe,me,Se,Me,Te=this;return Pf(this,function(tt){switch(tt.label){case 0:for(typeof R=="str
8275ing"&&(R=[R]),F=R.map(function(at){return Te.tokenizer.encode(at)}),I=F.map(function(at,jt){return at.map(function($t,vn){return[jt,vn]})}),U=[],X=0;X<I.length;X++)U=U.concat(I[X]);return oe=Object(Ke.tensor2d)(U,[U.length,2],"int32"),me=Object(Ke.tensor1d)(Ke.util.flatten(F),"int32"),Se={indices:oe,values:me},[4,this.model.executeAsync(Se)];case 1:return Me=tt.sent(),oe.dispose(),me.dispose(),[2,Me]}})})},q}(),vy={withTokenizer:!1},Rh=function(){function q(R,F){ce()(this,q),this.model=null,this.tokenizer=null,this.config={withTokenizer:R.withTokenizer||vy.withTokenizer},$e(this.loadModel(),F)}return ke()(q,[{key:"loadModel",value:function(){var R=K()(be.a.mark(function F(){return be.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:if(this.config.withTokenizer!==!0){I.next=4;break}return I.next=3,k1();case 3:this.tokenizer=I.sent;case 4:return I.next=6,qp();case 6:return this.model=I.sent,I.abrupt("return",this);case 8:case"end":return I.stop()}},F,this)}));return function(){return R.apply(this,arguments)}}()},{key:"predict",value:function(R,F){return $e(this.predictInternal(R),F)}},{key:"predictInternal",value:function(){var R=K()(be.a.mark(function F(I){var U,X;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.prev=0,oe.next=3,this.model.embed(I);case 3:return U=oe.sent,oe.next=6,U.array();case 6:return X=oe.sent,U.dispose(),oe.abrupt("return",X);case 11:return oe.prev=11,oe.t0=oe.catch(0),console.error(oe.t0),oe.abrupt("return",oe.t0);case 15:case"end":return oe.stop()}},F,this,[[0,11]])}));return function(F){return R.apply(this,arguments)}}()},{key:"encode",value:function(R,F){return $e(this.encodeInternal(R),F)}},{key:"encodeInternal",value:function(){var R=K()(be.a.mark(function F(I){return be.a.wrap(function(U){for(;;)switch(U.prev=U.next){case 0:if(this.config.withTokenizer!==!0){U.next=2;break}return U.abrupt("return",this.tokenizer.encode(I));case 2:return console.error('withTokenizer must be set to true - please pass "withTokenizer:true" as an option in the constructor'),U.abrupt("return",!1);case 4:case"end":return U.stop()}},F,this)}));return function(F){return R.apply(this,arguments)}}()}]),q}(),Il=function(q,R){var F=Ee()(q)==="object"?q:{};return new Rh(F,typeof q=="function"?q:R)};/** 8276 * @license 8277 * Copyright 2020 Google LLC. All Rights Reserved. 8278 * Licensed under the Apache License, Version 2.0 (the "License"); 8279 * you may not use this file except in compliance with the License. 8280 * You may obtain a copy of the License at 8281 * 8282 * http://www.apache.org/licenses/LICENSE-2.0 8283 * 8284 * Unless required by applicable law or agreed to in writing, software 8285 * distributed under the License is distributed on an "AS IS" BASIS, 8286 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8287 * See the License for the specific language governing permissions and 8288 * limitations under the License. 8289 * ============================================================================= 8290 */const Gp=q=>{q.startEndTensor.dispose(),q.startPoint.dispose(),q.endPoint.dispose()},sg=q=>({startEndTensor:q,startPoint:Object(Ke.slice)(q,[0,0],[-1,2]),endPoint:Object(Ke.slice)(q,[0,2],[-1,2])}),r0=(q,R)=>{const F=Object(Ke.mul)(q.startPoint,R),I=Object(Ke.mul)(q.endPoint,R),U=Object(Ke.concat2d)([F,I],1);return sg(U)},rv={strides:[8,16],anchors:[2,6]},yy=6;function Ks(q,R){let F,I,U;if(q.topLeft instanceof Ke.Tensor&&q.bottomRight instanceof Ke.Tensor){const[oe,me]=Object(Ke.tidy)(()=>[Object(Ke.concat)([Object(Ke.sub)(R-1,q.topLeft.slice(0,1)),q.topLeft.slice(1,1)]),Object(Ke.concat)([Object(Ke.sub)(R-1,q.bottomRight.slice(0,1)),q.bottomRight.slice(1,1)])]);F=oe,I=me,q.landmarks!=null&&(U=Object(Ke.tidy)(()=>{const Se=Object(Ke.sub)(Object(Ke.tensor1d)([R-1,0]),q.landmarks),Me=Object(Ke.tensor1d)([1,-1]);return Object(Ke.mul)(Se,Me)}))}else{const[oe,me]=q.topLeft,[Se,Me]=q.bottomRight;F=[R-1-oe,me],I=[R-1-Se,Me],q.landmarks!=null&&(U=q.landmarks.map(Te=>[R-1-Te[0],Te[1]]))}const X={topLeft:F,bottomRight:I};return U!=null&&(X.landmarks=U),q.probability!=null&&(X.probability=q.probability instanceof Ke.Tensor?q.probability.clone():q.probability),X}
8290function by(q,R){return Object(Ke.tidy)(()=>{let F;return F=q.hasOwnProperty("box")?q.box:q,r0(F,R).startEndTensor.squeeze()})}class Kp{constructor(R,F,I,U,X,oe){this.blazeFaceModel=R,this.width=F,this.height=I,this.maxFaces=U,this.anchorsData=function(me,Se,Me){const Te=[];for(let tt=0;tt<Me.strides.length;tt++){const at=Me.strides[tt],jt=Math.floor((Se+at-1)/at),$t=Math.floor((me+at-1)/at),vn=Me.anchors[tt];for(let wn=0;wn<jt;wn++){const Nn=at*(wn+.5);for(let In=0;In<$t;In++){const Ln=at*(In+.5);for(let qn=0;qn<vn;qn++)Te.push([Ln,Nn])}}}return Te}(F,I,rv),this.anchors=Object(Ke.tensor2d)(this.anchorsData),this.inputSizeData=[F,I],this.inputSize=Object(Ke.tensor1d)([F,I]),this.iouThreshold=X,this.scoreThreshold=oe}async getBoundingBoxes(R,F,I=!0){const[U,X,oe]=Object(Ke.tidy)(()=>{const vn=R.resizeBilinear([this.width,this.height]),wn=Object(Ke.mul)(Object(Ke.sub)(vn.div(255),.5),2),Nn=this.blazeFaceModel.predict(wn).squeeze(),In=function(qn,Cn,wr){const Fr=Object(Ke.slice)(qn,[0,1],[-1,2]),Rr=Object(Ke.add)(Fr,Cn),Xr=Object(Ke.slice)(qn,[0,3],[-1,2]),zr=Object(Ke.div)(Xr,wr),Ti=Object(Ke.div)(Rr,wr),Wi=Object(Ke.div)(zr,2),zi=Object(Ke.sub)(Ti,Wi),Xo=Object(Ke.add)(Ti,Wi),wa=Object(Ke.mul)(zi,wr),ua=Object(Ke.mul)(Xo,wr);return Object(Ke.concat2d)([wa,ua],1)}(Nn,this.anchors,this.inputSize),Ln=Object(Ke.slice)(Nn,[0,0],[-1,1]);return[Nn,In,Object(Ke.sigmoid)(Ln).squeeze()]}),me=console.warn;console.warn=()=>{};const Se=Ke.image.nonMaxSuppression(X,oe,this.maxFaces,this.iouThreshold,this.scoreThreshold);console.warn=me;const Me=await Se.array();Se.dispose();let Te=Me.map(vn=>Object(Ke.slice)(X,[vn,0],[1,-1]));F||(Te=await Promise.all(Te.map(async vn=>{const wn=await vn.array();return vn.dispose(),wn})));const tt=R.shape[1],at=R.shape[2];let jt;jt=F?Object(Ke.div)([at,tt],this.inputSize):[at/this.inputSizeData[0],tt/this.inputSizeData[1]];const $t=[];for(let vn=0;vn<Te.length;vn++){const wn=Te[vn],Nn=Object(Ke.tidy)(()=>{const In=sg(wn instanceof Ke.Tensor?wn:Object(Ke.tensor2d)(wn));if(!I)return In;const Ln=Me[vn];let qn;return qn=F?this.anchors.slice([Ln,0],[1,2]):this.anchorsData[Ln],{box:In,landmarks:Object(Ke.slice)(U,[Ln,yy-1],[1,-1]).squeeze().reshape([yy,-1]),probability:Object(Ke.slice)(oe,[Ln],[1]),anchor:qn}});$t.push(Nn)}return X.dispose(),oe.dispose(),U.dispose(),{boxes:$t,scaleFactor:jt}}async estimateFaces(R,F=!1,I=!1,U=!0){const[,X]=function(Me){return Me instanceof Ke.Tensor?[Me.shape[0],Me.shape[1]]:[Me.height,Me.width]}(R),oe=Object(Ke.tidy)(()=>(R instanceof Ke.Tensor||(R=Ke.browser.fromPixels(R)),R.toFloat().expandDims(0))),{boxes:me,scaleFactor:Se}=await this.getBoundingBoxes(oe,F,U);return oe.dispose(),F?me.map(Me=>{const Te=by(Me,Se);let tt={topLeft:Te.slice([0],[2]),bottomRight:Te.slice([2],[2])};if(U){const{landmarks:at,probability:jt,anchor:$t}=Me,vn=at.add($t).mul(Se);tt.landmarks=vn,tt.probability=jt}return I&&(tt=Ks(tt,X)),tt}):Promise.all(me.map(async Me=>{const Te=by(Me,Se);let tt;if(U){const[at,jt,$t]=await Promise.all([Me.landmarks,Te,Me.probability].map(async Ln=>Ln.array())),vn=Me.anchor,[wn,Nn]=Se,In=at.map(Ln=>[(Ln[0]+vn[0])*wn,(Ln[1]+vn[1])*Nn]);tt={topLeft:jt.slice(0,2),bottomRight:jt.slice(2),landmarks:In,probability:$t},Gp(Me.box),Me.landmarks.dispose(),Me.probability.dispose()}else{const at=await Te.array();tt={topLeft:at.slice(0,2),bottomRight:at.slice(2)}}return Te.dispose(),I&&(tt=Ks(tt,X)),tt}))}}const xy="https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1",i0={silhouette:[10,338,297,332,284,251,389,356,454,323,361,288,397,365,379,378,400,377,152,148,176,149,150,136,172,58,132,93,234,127,162,21,54,103,67,109],lipsUpperOuter:[61,185,40,39,37,0,267,269,270,409,291],lipsLowerOuter:[146,91,181,84,17,314,405,321,375,291],lipsUpperInner:[78,191,80,81,82,13,312,311,310,415,308],lipsLowerInner:[78,95,88,178,87,14,317,402,318,324,308],rightEyeUpper0:[246,161,160,159,158,157,173],rightEyeLower0:[33,7,163,144,145,153,154,155,133],rightEyeUpper1:[247,30,29,27,28,56,190],rightEyeLower1:[130,25,110,24,23,22,26,112,243],rightEyeUpper2:[113,225,224,223,222,221,189],rightEyeLower2:[226,31,228,229,230,231,232,233,244],rightEyeLower3:[143,111,117,118,119,120,121,128,245],rightEyebrowUpper:[156,70,63,105,66,107,55,193],rightEyebrowLower:[35,124,46,53,52,65],leftEyeUpper0:[466,388,387,386,385,384,398],leftEyeLower0:[263,249,390,373,374,380,381,382,362],leftEyeUpper1:[467,260,259,257,258,286,414],leftEyeLower1:[359,255,339,254,253,252,256,341,463],leftEyeUpper2:[342,445,444,443,442,441,413],leftEyeLower2:[446,261,448,449,450,451,452,453,464],leftEyeLower3:[372,340,346,347,348,349,350,357,465],leftEyebrowUpper:[383,300,293,334,296,336,285,417],leftEyebrowLower:[265,353,276,283,282,295],midwayBetweenEyes:[168],noseTip:[1],noseBottom:[2],noseRightCorner:[98],noseLeftCorner:[327],rightCheek:[205],leftCheek:[425]};function Nd(q){q!=null&&q.startPoint!=null&&(q.startEndTensor.dispose(),q.startPoint.dispose(),q.endPoint.dispose())}function ug(q,R,F){return{startEndTensor:q,startPoint:R??Object(Ke.slice)(q,[0,0],[-1,2]),endPoint:F??Object(Ke.slice)(q,[0,2],[-1,2])}}
8290function jf(q){return Object(Ke.tidy)(()=>{const R=Object(Ke.sub)(q.endPoint,q.startPoint);return Object(Ke.abs)(R)})}function wy(q,R=1.5){return Object(Ke.tidy)(()=>{const F=function(me){return Object(Ke.tidy)(()=>{const Se=Object(Ke.div)(Object(Ke.sub)(me.endPoint,me.startPoint),2);return Object(Ke.add)(me.startPoint,Se)})}(q),I=jf(q),U=Object(Ke.mul)(Object(Ke.div)(I,2),R),X=Object(Ke.sub)(F,U),oe=Object(Ke.add)(F,U);return ug(Object(Ke.concat2d)([X,oe],1),X,oe)})}const o0=468,a0=.25;class iv{constructor(R,F,I,U,X,oe){this.regionsOfInterest=[],this.runsWithoutFaceDetector=0,this.boundingBoxDetector=R,this.meshDetector=F,this.meshWidth=I,this.meshHeight=U,this.maxContinuousChecks=X,this.maxFaces=oe}async predict(R){if(this.shouldUpdateRegionsOfInterest()){const{boxes:U,scaleFactor:X}=await this.boundingBoxDetector.getBoundingBoxes(R,!0,!1);if(U.length===0)return X.dispose(),this.clearAllRegionsOfInterest(),null;const oe=U.map(me=>wy(function(Se,Me){const Te=Object(Ke.mul)(Se.startPoint,Me),tt=Object(Ke.mul)(Se.endPoint,Me);return ug(Object(Ke.concat2d)([Te,tt],1))}(me,X)));U.forEach(Nd),this.updateRegionsOfInterest(oe),this.runsWithoutFaceDetector=0}else this.runsWithoutFaceDetector++;return Object(Ke.tidy)(()=>this.regionsOfInterest.map((F,I)=>{const U=function(tt,at,jt){const $t=at.shape[1],vn=at.shape[2],wn=tt.startEndTensor;return Object(Ke.tidy)(()=>{const Nn=Object(Ke.concat2d)([wn.slice([0,1],[-1,1]),wn.slice([0,0],[-1,1]),wn.slice([0,3],[-1,1]),wn.slice([0,2],[-1,1])],0),In=Object(Ke.div)(Nn.transpose(),[$t,vn,$t,vn]);return Ke.image.cropAndResize(at,In,[0],jt)})}(F,R,[this.meshHeight,this.meshWidth]).div(255),[,X,oe]=this.meshDetector.predict(U),me=Object(Ke.reshape)(oe,[-1,3]),Se=Object(Ke.div)(jf(F),[this.meshWidth,this.meshHeight]),Me=Object(Ke.mul)(me,Se.concat(Object(Ke.tensor2d)([1],[1,1]),1)).add(F.startPoint.concat(Object(Ke.tensor2d)([0],[1,1]),1)),Te=this.calculateLandmarksBoundingBox(Me);return Nd(this.regionsOfInterest[I]),this.regionsOfInterest[I]=Te,{coords:me,scaledCoords:Me,box:Te,flag:X.squeeze()}}))}updateRegionsOfInterest(R){for(let F=0;F<R.length;F++){const I=R[F],U=this.regionsOfInterest[F];let X=0;if(U&&U.startPoint){const[oe,me,Se,Me]=I.startEndTensor.arraySync()[0],[Te,tt,at,jt]=U.startEndTensor.arraySync()[0],$t=Math.max(oe,Te),vn=Math.max(me,tt),wn=(Math.min(Se,at)-$t)*(Math.min(Me,jt)-vn);X=wn/((Se-oe)*(Me-me)+(at-Te)*(jt-me)-wn)}X>a0?Nd(I):(this.regionsOfInterest[F]=I,Nd(U))}for(let F=R.length;F<this.regionsOfInterest.length;F++)Nd(this.regionsOfInterest[F]);this.regionsOfInterest=this.regionsOfInterest.slice(0,R.length)}clearRegionOfInterest(R){this.regionsOfInterest[R]!=null&&(Nd(this.regionsOfInterest[R]),this.regionsOfInterest=[...this.regionsOfInterest.slice(0,R),...this.regionsOfInterest.slice(R+1)])}clearAllRegionsOfInterest(){for(let R=0;R<this.regionsOfInterest.length;R++)Nd(this.regionsOfInterest[R]);this.regionsOfInterest=[]}shouldUpdateRegionsOfInterest(){const R=this.regionsOfInterest.length,F=R===0;return this.maxFaces===1||F?F:R!==this.maxFaces&&this.runsWithoutFaceDetector>=this.maxContinuousChecks}calculateLandmarksBoundingBox(R){const F=R.slice([0,0],[o0,1]),I=R.slice([0,1],[o0,1]);return wy(ug(Object(Ke.stack)([F.min(),I.min(),F.max(),I.max()]).expandDims(0)))}}const nf
vendor: 16,761 bytes, line 8290
8290=[[.499976992607117,.652534008026123],[.500025987625122,.547487020492554],[.499974012374878,.602371990680695],[.482113003730774,.471979022026062],[.500150978565216,.527155995368958],[.499909996986389,.498252987861633],[.499523013830185,.40106201171875],[.289712011814117,.380764007568359],[.499954998493195,.312398016452789],[.499987006187439,.269918978214264],[.500023007392883,.107050001621246],[.500023007392883,.666234016418457],[.5000159740448,.679224014282227],[.500023007392883,.692348003387451],[.499976992607117,.695277988910675],[.499976992607117,.70593398809433],[.499976992607117,.719385027885437],[.499976992607117,.737019002437592],[.499967992305756,.781370997428894],[.499816000461578,.562981009483337],[.473773002624512,.573909997940063],[.104906998574734,.254140973091125],[.365929991006851,.409575998783112],[.338757991790771,.41302502155304],[.311120003461838,.409460008144379],[.274657994508743,.389131009578705],[.393361985683441,.403706014156342],[.345234006643295,.344011008739471],[.370094001293182,.346076011657715],[.319321990013123,.347265005111694],[.297903001308441,.353591024875641],[.24779200553894,.410809993743896],[.396889001131058,.842755019664764],[.280097991228104,.375599980354309],[.106310002505779,.399955987930298],[.2099249958992,.391353011131287],[.355807989835739,.534406006336212],[.471751004457474,.65040397644043],[.474155008792877,.680191993713379],[.439785003662109,.657229006290436],[.414617002010345,.66654098033905],[.450374007225037,.680860996246338],[.428770989179611,.682690978050232],[.374971002340317,.727805018424988],[.486716985702515,.547628998756409],[.485300987958908,.527395009994507],[.257764995098114,.314490020275116],[.401223003864288,.455172002315521],[.429818987846375,.548614978790283],[.421351999044418,.533740997314453],[.276895999908447,.532056987285614],[.483370006084442,.499586999416351],[.33721199631691,.282882988452911],[.296391993761063,.293242990970612],[.169294998049736,.193813979625702],[.447580009698868,.302609980106354],[.392390012741089,.353887975215912],[.354490011930466,.696784019470215],[.067304998636246,.730105042457581],[.442739009857178,.572826027870178],[.457098007202148,.584792017936707],[.381974011659622,.694710969924927],[.392388999462128,.694203019142151],[.277076005935669,.271932005882263],[.422551989555359,.563233017921448],[.385919004678726,.281364023685455],[.383103013038635,.255840003490448],[.331431001424789,.119714021682739],[.229923993349075,.232002973556519],[.364500999450684,.189113974571228],[.229622006416321,.299540996551514],[.173287004232407,.278747975826263],[.472878992557526,.666198015213013],[.446828007698059,.668527007102966],[.422762006521225,.673889994621277],[.445307999849319,.580065965652466],[.388103008270264,.693961024284363],[.403039008378983,.706539988517761],[.403629004955292,.693953037261963],[.460041999816895,.557139039039612],[.431158006191254,.692366003990173],[.452181994915009,.692366003990173],[.475387006998062,.692366003990173],[.465828001499176,.779190003871918],[.472328990697861,.736225962638855],[.473087012767792,.717857003211975],[.473122000694275,.704625964164734],[.473033010959625,.695277988910675],[.427942007780075,.695277988910675],[.426479011774063,.703539967536926],[.423162013292313,.711845993995667],[.4183090031147,.720062971115112],[.390094995498657,.639572978019714],[.013953999616206,.560034036636353],[.499913990497589,.58014702796936],[.413199990987778,.69539999961853],[.409626007080078,.701822996139526],[.468080013990402,.601534962654114],[.422728985548019,.585985004901886],[.463079988956451,.593783974647522],[.37211999297142,.47341400384903],[.334562003612518,.496073007583618],[.411671012639999,.546965003013611],[.242175996303558,.14767599105835],[.290776997804642,.201445996761322],[.327338010072708,.256527006626129],[.399509996175766,.748921036720276],[.441727995872498,.261676013469696],[.429764986038208,.187834024429321],[.412198007106781,.108901023864746],[.288955003023148,.398952007293701],[.218936994671822,.435410976409912],[.41278201341629,.398970007896423],[.257135003805161,.355440020561218],[.427684992551804,.437960982322693],[.448339998722076,.536936044692993],[.178560003638268,.45755398273468],[.247308000922203,.457193970680237],[.286267012357712,.467674970626831],[.332827985286713,.460712015628815],[.368755996227264,.447206974029541],[.398963987827301,.432654976844788],[.476410001516342,.405806005001068],[.189241006970406,.523923993110657],[.228962004184723,.348950982093811],[.490725994110107,.562400996685028],[.404670000076294,.485132992267609],[.019469000399113,.401564002037048],[.426243007183075,.420431017875671],[.396993011236191,.548797011375427],[.266469985246658,.376977026462555],[.439121007919312,.51895797252655],[.032313998788595,.644356966018677],[.419054001569748,.387154996395111],[.462783008813858,.505746960639954],[.238978996872902,.779744982719421],[.198220998048782,.831938028335571],[.107550002634525,.540755033493042],[.183610007166862,.740257024765015],[.134409993886948,.333683013916016],[.385764002799988,.883153975009918],[.490967005491257,.579378008842468],[.382384985685349,.508572995662689],[.174399003386497,.397670984268188],[.318785011768341,.39623498916626],[.343364000320435,.400596976280212],[.396100014448166,.710216999053955],[.187885001301765,.588537991046906],[.430987000465393,.944064974784851],[.318993002176285,.898285031318665],[.266247987747192,.869701027870178],[.500023007392883,.190576016902924],[.499976992607117,.954452991485596],[.366169989109039,.398822009563446],[.393207013607025,.39553701877594],[.410373002290726,.391080021858215],[.194993004202843,.342101991176605],[.388664990663528,.362284004688263],[.365961998701096,.355970978736877],[.343364000320435,.355356991291046],[.318785011768341,.35834002494812],[.301414996385574,.363156020641327],[.058132998645306,.319076001644135],[.301414996385574,.387449026107788],[.499987989664078,.618434011936188],[.415838003158569,.624195992946625],[.445681989192963,.566076993942261],[.465844005346298,.620640993118286],[.49992299079895,.351523995399475],[.288718998432159,.819945991039276],[.335278987884521,.852819979190826],[.440512001514435,.902418971061707],[.128294005990028,.791940987110138],[.408771991729736,.373893976211548],[.455606997013092,.451801002025604],[.499877005815506,.908990025520325],[.375436991453171,.924192011356354],[.11421000212431,.615022003650665],[.448662012815475,.695277988910675],[.4480200111866,.704632043838501],[.447111994028091,.715808033943176],[.444831997156143,.730794012546539],[.430011987686157,.766808986663818],[.406787008047104,.685672998428345],[.400738000869751,.681069016456604],[.392399996519089,.677703022956848],[.367855995893478,.663918972015381],[.247923001646996,.601333022117615],[.452769994735718,.420849978923798],[.43639200925827,.359887003898621],[.416164010763168,.368713974952698],[.413385987281799,.692366003990173],[.228018000721931,.683571994304657],[.468268007040024,.352671027183533],[.411361992359161,.804327011108398],[.499989002943039,.469825029373169],[.479153990745544,.442654013633728],[.499974012374878,.439637005329132],[.432112008333206,.493588984012604],[.499886006116867,.866917014122009],[.49991300702095,.821729004383087],[.456548988819122,.819200992584229],[.344549000263214,.745438992977142],[.37890899181366,.574010014533997],[.374292999505997,.780184984207153],[.319687992334366,.570737957954407],[.357154995203018,.604269981384277],[.295284003019333,.621580958366394],[.447750002145767,.862477004528046],[.410986006259918,.508723020553589],[.31395098567009,.775308012962341],[.354128003120422,.812552988529205],[.324548006057739,.703992962837219],[.189096003770828,.646299958229065],[.279776990413666,.71465802192688],[.1338230073452,.682700991630554],[.336768001317978,.644733011722565],[.429883986711502,.466521978378296],[.455527991056442,.548622965812683],[.437114000320435,.558896005153656],[.467287987470627,.529924988746643],[.414712011814117,.335219979286194],[.37704598903656,.322777986526489],[.344107985496521,.320150971412659],[.312875986099243,.32233202457428],[.283526003360748,.333190023899078],[.241245999932289,.382785975933075],[.102986000478268,.468762993812561],[.267612010240555,.424560010433197],[.297879010438919,.433175981044769],[.333433985710144,.433878004550934],[.366427004337311,.426115989685059],[.396012008190155,.416696012020111],[.420121014118195,.41022801399231],[.007561000064015,.480777025222778],[.432949006557465,.569517970085144],[.458638995885849,.479089021682739],[.473466008901596,.545744001865387],[.476087987422943,.563830018043518],[.468472003936768,.555056989192963],[.433990985155106,.582361996173859],[.483518004417419,.562983989715576],[.482482999563217,.57784903049469],[.42645001411438,.389798998832703],[.438998997211456,.39649498462677],[.450067013502121,.400434017181396],[.289712011814117,.368252992630005],[.276670008897781,.363372981548309],[.517862021923065,.471948027610779],[.710287988185883,.380764007568359],[.526226997375488,.573909997940063],[.895093023777008,.254140973091125],[.634069979190826,.409575998783112],[.661242008209229,.41302502155304],[.688880026340485,.409460008144379],[.725341975688934,.389131009578705],[.606630027294159,.40370500087738],[.654766023159027,.344011008739471],[.629905998706818,.346076011657715],[.680678009986877,.347265005111694],[.702096998691559,.353591024875641],[.75221198797226,.410804986953735],[.602918028831482,.842862963676453],[.719901978969574,.375599980354309],[.893692970275879,.399959981441498],[.790081977844238,.391354024410248],[.643998026847839,.534487962722778],[.528249025344849,.65040397644043],[.525849997997284,.680191040039062],[.560214996337891,.657229006290436],[.585384011268616,.66654098033905],[.549625992774963,.680860996246338],[.57122802734375,.682691991329193],[.624852001667023,.72809898853302],[.513050019741058,.547281980514526],[.51509702205658,.527251958847046],[.742246985435486,.314507007598877],[.598631024360657,.454979002475739],[.570338010787964,.548575043678284],[.578631997108459,.533622980117798],[.723087012767792,.532054007053375],[.516445994377136,.499638974666595],[.662801027297974,.282917976379395],[.70362401008606,.293271005153656],[.830704987049103,.193813979625702],[.552385985851288,.302568018436432],[.607609987258911,.353887975215912],[.645429015159607,.696707010269165],[.932694971561432,.730105042457581],[.557260990142822,.572826027870178],[.542901992797852,.584792017936707],[.6180260181427,.694710969924927],[.607590973377228,.694203019142151],[.722943007946014,.271963000297546],[.577413976192474,.563166975975037],[.614082992076874,.281386971473694],[.616907000541687,.255886018276215],[.668509006500244,.119913995265961],[.770092010498047,.232020974159241],[.635536015033722,.189248979091644],[.77039098739624,.299556016921997],[.826722025871277,.278755009174347],[.527121007442474,.666198015213013],[.553171992301941,.668527007102966],[.577238023281097,.673889994621277],[.554691970348358,.580065965652466],[.611896991729736,.693961024284363],[.59696102142334,.706539988517761],[.596370995044708,.693953037261963],[.539958000183105,.557139039039612],[.568841993808746,.692366003990173],[.547818005084991,.692366003990173],[.52461302280426,.692366003990173],[.534089982509613,.779141008853912],[.527670979499817,.736225962638855],[.526912987232208,.717857003211975],[.526877999305725,.704625964164734],[.526966989040375,.695277988910675],[.572058022022247,.695277988910675],[.573521018028259,.703539967536926],[.57683801651001,.711845993995667],[.581691026687622,.720062971115112],[.609944999217987,.639909982681274],[.986046016216278,.560034036636353],[.5867999792099,.69539999961853],[.590372025966644,.701822996139526],[.531915009021759,.601536989212036],[.577268004417419,.585934996604919],[.536915004253387,.593786001205444],[.627542972564697,.473352015018463],[.665585994720459,.495950996875763],[.588353991508484,.546862006187439],[.757824003696442,.14767599105835],[.709249973297119,.201507985591888],[.672684013843536,.256581008434296],[.600408971309662,.74900496006012],[.55826598405838,.261672019958496],[.570303976535797,.187870979309082],[.588165998458862,.109044015407562],[.711045026779175,.398952007293701],[.781069993972778,.435405015945435],[.587247014045715,.398931980133057],[.742869973182678,.355445981025696],[.572156012058258,.437651991844177],[.55186802148819,.536570012569427],[.821442008018494,.457556009292603],[.752701997756958,.457181990146637],[.71375697851181,.467626988887787],[.66711300611496,.460672974586487],[.631101012229919,.447153985500336],[.6008620262146,.432473003864288],[.523481011390686,.405627012252808],[.810747981071472,.523926019668579],[.771045982837677,.348959028720856],[.509127020835876,.562718033790588],[.595292985439301,.485023975372314],[.980530977249146,.401564002037048],[.573499977588654,.420000016689301],[.602994978427887,.548687994480133],[.733529984951019,.376977026462555],[.560611009597778,.519016981124878],[.967685997486115,.644356966018677],[.580985009670258,.387160003185272],[.537728011608124,.505385041236877],[.760966002941132,.779752969741821],[.801778972148895,.831938028335571],[.892440974712372,.54076099395752],[.816350996494293,.740260004997253],[.865594983100891,.333687007427216],[.614073991775513,.883246004581451],[.508952975273132,.579437971115112],[.617941975593567,.508316040039062],[.825608015060425,.397674977779388],[.681214988231659,.39623498916626],[.656635999679565,.400596976280212],[.603900015354156,.710216999053955],[.81208598613739,.588539004325867],[.56801301240921,.944564998149872],[.681007981300354,.898285031318665],[.733752012252808,.869701027870178],[.633830010890961,.398822009563446],[.606792986392975,.39553701877594],[.589659988880157,.391062021255493],[.805015981197357,.342108011245728],[.611334979534149,.362284004688263],[.634037971496582,.355970978736877],[.656635999679565,.355356991291046],[.681214988231659,.35834002494812],[.698584973812103,.363156020641327],[.941866993904114,.319076001644135],[.698584973812103,.387449026107788],[.584177017211914,.624107003211975],[.554318010807037,.566076993942261],[.534153997898102,.62064003944397],[.711217999458313,.819975018501282],[.664629995822906,.852871000766754],[.559099972248077,.902631998062134],[.871706008911133,.791940987110138],[.591234028339386,.373893976211548],[.544341027736664,.451583981513977],[.624562978744507,.924192011356354],[.88577002286911,.615028977394104],[.551338016986847,.695277988910675],[.551980018615723,.704632043838501],[.552887976169586,.715808033943176],[.555167973041534,.730794012546539],[.569944024085999,.767035007476807],[.593203008174896,.685675978660583],[.599261999130249,.681069016456604],[.607599973678589,.677703022956848],[.631937980651855,.663500010967255],[.752032995223999,.601315021514893],[.547226011753082,.420395016670227],[.563543975353241,.359827995300293],[.583841025829315,.368713974952698],[.586614012718201,.692366003990173],[.771915018558502,.683578014373779],[.531597018241882,.352482974529266],[.588370978832245,.804440975189209],[.52079701423645,.442565023899078],[.567984998226166,.493479013442993],[.543282985687256,.819254994392395],[.655317008495331,.745514988899231],[.621008992195129,.574018001556396],[.625559985637665,.78031200170517],[.680198013782501,.570719003677368],[.64276397228241,.604337990283966],[.704662978649139,.621529996395111],[.552012026309967,.862591981887817],[.589071989059448,.508637011051178],[.685944974422455,.775357007980347],[.645735025405884,.812640011310577],[.675342977046967,.703978002071381],[.810858011245728,.646304965019226],[.72012197971344,.714666962623596],[.866151988506317,.682704985141754],[.663187026977539,.644596993923187],[.570082008838654,.466325998306274],[.544561982154846,.548375964164734],[.562758982181549,.558784961700439],[.531987011432648,.530140042304993],[.585271000862122,.335177004337311],[.622952997684479,.32277899980545],[.655896008014679,.320163011550903],[.687132000923157,.322345972061157],[.716481983661652,.333200991153717],[.758756995201111,.382786989212036],[.897013008594513,.468769013881683],[.732392013072968,.424547016620636],[.70211398601532,.433162987232208],[.66652500629425,.433866024017334],[.633504986763,.426087975502014],[.603875994682312,.416586995124817],[.579657971858978,.409945011138916],[.992439985275269,.480777025222778],[.567192018032074,.569419980049133],[.54136598110199,.478899002075195],[.526564002037048,.546118021011353],[.523913025856018,.563830018043518],[.531529009342194,.555056989192963],[.566035985946655,.582329034805298],[.51631098985672,.563053965568542],[.5174720287323,.577877044677734],[.573594987392426,.389806985855103],[.560697972774506,.395331978797913],[.549755990505219,.399751007556915],[.710287988185883,.368252992630005],[.723330020904541,.363372981548309]]
8290,s0="https://tfhub.dev/mediapipe/tfjs-model/facemesh/1/default/1",_y=192,Lf=192;async function cg({maxContinuousChecks:q=5,detectionConfidence:R=.9,maxFaces:F=10,iouThreshold:I=.3,scoreThreshold:U=.75}={}){const[X,oe]=await Promise.all([async function(me,Se,Me){return async function({maxFaces:Te=10,inputWidth:tt=128,inputHeight:at=128,iouThreshold:jt=.3,scoreThreshold:$t=.75}={}){const vn=await Object(Mt.loadGraphModel)(xy,{fromTFHub:!0});return new Kp(vn,tt,at,Te,jt,$t)}({maxFaces:me,iouThreshold:Se,scoreThreshold:Me})}(F,I,U),async function(){return Object(Mt.loadGraphModel)(s0,{fromTFHub:!0})}()]);return new lg(X,oe,q,R,F)}function Bh(q,R){if(q.mesh instanceof Ke.Tensor){const[F,I,U,X]=Object(Ke.tidy)(()=>{const oe=Object(Ke.tensor1d)([R-1,0,0]),me=Object(Ke.tensor1d)([1,-1,1]);return Object(Ke.tidy)(()=>[Object(Ke.concat)([Object(Ke.sub)(R-1,q.boundingBox.topLeft.slice(0,1)),q.boundingBox.topLeft.slice(1,1)]),Object(Ke.concat)([Object(Ke.sub)(R-1,q.boundingBox.bottomRight.slice(0,1)),q.boundingBox.bottomRight.slice(1,1)]),Object(Ke.sub)(oe,q.mesh).mul(me),Object(Ke.sub)(oe,q.scaledMesh).mul(me)])});return Object.assign({},q,{boundingBox:{topLeft:F,bottomRight:I},mesh:U,scaledMesh:X})}return Object.assign({},q,{boundingBox:{topLeft:[R-1-q.boundingBox.topLeft[0],q.boundingBox.topLeft[1]],bottomRight:[R-1-q.boundingBox.bottomRight[0],q.boundingBox.bottomRight[1]]},mesh:q.mesh.map(F=>{const I=F.slice(0);return I[0]=R-1-F[0],I}),scaledMesh:q.scaledMesh.map(F=>{const I=F.slice(0);return I[0]=R-1-F[0],I})})}class lg{constructor(R,F,I,U,X){this.pipeline=new iv(R,F,_y,Lf,I,X),this.detectionConfidence=U}static getAnnotations(){return i0}static getUVCoords(){return nf}async estimateFaces(R,F=!1,I=!1){const[,U]=function(Se){return Se instanceof Ke.Tensor?[Se.shape[0],Se.shape[1]]:[Se.height,Se.width]}(R),X=Object(Ke.tidy)(()=>(R instanceof Ke.Tensor||(R=Ke.browser.fromPixels(R)),R.toFloat().expandDims(0))),oe=Object(Ke.env)().get("WEBGL_PACK_DEPTHWISECONV");Object(Ke.env)().set("WEBGL_PACK_DEPTHWISECONV",!0);const me=await this.pipeline.predict(X);return Object(Ke.env)().set("WEBGL_PACK_DEPTHWISECONV",oe),X.dispose(),me!=null&&me.length>0?Promise.all(me.map(async(Se,Me)=>{const{coords:Te,scaledCoords:tt,box:at,flag:jt}=Se;let $t=[jt];F||($t=$t.concat([Te,tt,at.startPoint,at.endPoint]));const vn=await Promise.all($t.map(async Fr=>Fr.array())),wn=vn[0];if(jt.dispose(),wn<this.detectionConfidence&&this.pipeline.clearRegionOfInterest(Me),F){const Fr={faceInViewConfidence:wn,mesh:Te,scaledMesh:tt,boundingBox:{topLeft:at.startPoint.squeeze(),bottomRight:at.endPoint.squeeze()}};return I?Bh(Fr,U):Fr}const[Nn,In,Ln,qn]=vn.slice(1);tt.dispose(),Te.dispose();let Cn={faceInViewConfidence:wn,boundingBox:{topLeft:Ln,bottomRight:qn},mesh:Nn,scaledMesh:In};I&&(Cn=Bh(Cn,U));const wr={};for(const Fr in i0)wr[Fr]=i0[Fr].map(Rr=>Cn.scaledMesh[Rr]);return Cn.annotations=wr,Cn})):[]}}function Ys(q){var R=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var F,I=Qs()(q);if(R){var U=Qs()(this).constructor;F=Reflect.construct(I,arguments,U)}else F=I.apply(this,arguments);return Vl()(this,F)}}var u0=function(q){Wl()(F,q);var R=Ys(F);function F(I,U,X){var oe;return ce()(this,F),(oe=R.call(this)).video=I,oe.model=null,oe.modelReady=!1,oe.config=U,oe.ready=$e(oe.loadModel(),X),oe}return ke()(F,[{key:"loadModel",value:function(){var I=K()(be.a.mark(function U(){var X=this;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.next=2,cg(this.config);case 2:if(this.model=oe.sent,this.modelReady=!0,!this.video||this.video.readyState!==0){oe.next=7;break}return oe.next=7,new Promise(function(me){X.video.onloadeddata=function(){me()}});case 7:return this.video&&this.predict(),oe.abrupt("return",this);case 9:case"end":return oe.stop()}},U,this)}));return function(){return I.apply(this,arguments)}}()},{key:"predict",value:function(){var I=K()(be.a.mark(function U(X,oe){var me,Se,Me,Te,tt=this;return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:if(me=this.getInput(X)){at.next=3;break}throw new Error("No input image found.");case 3:return Se=this.config.flipHorizontal,at.next=6,this.model.estimateFaces(me,Se);
8290case 6:if(Me=at.sent,Te=Me,this.emit("predict",Te),this.emit("face",Te),!this.video){at.next=12;break}return at.abrupt("return",N.nextFrame().then(function(){return tt.predict()}));case 12:return typeof oe=="function"&&oe(Te),at.abrupt("return",Te);case 14:case"end":return at.stop()}},U,this)}));return function(U,X){return I.apply(this,arguments)}}()},{key:"getInput",value:function(I){return I instanceof HTMLImageElement||I instanceof HTMLVideoElement||I instanceof HTMLCanvasElement||I instanceof ImageData?I:Ee()(I)==="object"&&(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLVideoElement||I.elt instanceof ImageData)?I.elt:Ee()(I)==="object"&&I.canvas instanceof HTMLCanvasElement?I.canvas:this.video}}]),F}(Om.EventEmitter),ov=function(q,R,F){var I,U={},X=F;q instanceof HTMLVideoElement?I=q:Ee()(q)==="object"&&q.elt instanceof HTMLVideoElement?I=q.elt:Ee()(q)==="object"?U=q:typeof q=="function"&&(X=q),Ee()(R)==="object"?U=R:typeof R=="function"&&(X=R);var oe=new u0(I,U,X);return X?oe:oe.ready};/** 8291 * @license 8292 * Copyright 2020 Google LLC. All Rights Reserved. 8293 * Licensed under the Apache License, Version 2.0 (the "License"); 8294 * you may not use this file except in compliance with the License. 8295 * You may obtain a copy of the License at 8296 * 8297 * http://www.apache.org/licenses/LICENSE-2.0 8298 * 8299 * Unless required by applicable law or agreed to in writing, software 8300 * distributed under the License is distributed on an "AS IS" BASIS, 8301 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8302 * See the License for the specific language governing permissions and 8303 * limitations under the License. 8304 * ============================================================================= 8305 */function fg(q){return[Math.abs(q.endPoint[0]-q.startPoint[0]),Math.abs(q.endPoint[1]-q.startPoint[1])]}function dg(q){return[q.startPoint[0]+(q.endPoint[0]-q.startPoint[0])/2,q.startPoint[1]+(q.endPoint[1]-q.startPoint[1])/2]}function av(q,R=1.5){const F=dg(q),I=fg(q),U=[R*I[0]/2,R*I[1]/2];return{startPoint:[F[0]-U[0],F[1]-U[1]],endPoint:[F[0]+U[0],F[1]+U[1]],palmLandmarks:q.palmLandmarks}}function ky(q){const R=dg(q),F=fg(q),I=Math.max(...F)/2;return{startPoint:[R[0]-I,R[1]-I],endPoint:[R[0]+I,R[1]+I],palmLandmarks:q.palmLandmarks}}function E1(q,R){const F=[q.endPoint[0]-q.startPoint[0],q.endPoint[1]-q.startPoint[1]],I=[F[0]*R[0],F[1]*R[1]];return{startPoint:[q.startPoint[0]+I[0],q.startPoint[1]+I[1]],endPoint:[q.endPoint[0]+I[0],q.endPoint[1]+I[1]],palmLandmarks:q.palmLandmarks}}class rf{constructor(R,F,I,U,X,oe){this.model=R,this.width=F,this.height=I,this.iouThreshold=X,this.scoreThreshold=oe,this.anchors=U.map(me=>[me.x_center,me.y_center]),this.anchorsTensor=Object(Ke.tensor2d)(this.anchors),this.inputSizeTensor=Object(Ke.tensor1d)([F,I]),this.doubleInputSizeTensor=Object(Ke.tensor1d)([2*F,2*I])}normalizeBoxes(R){return Object(Ke.tidy)(()=>{const F=Object(Ke.slice)(R,[0,0],[-1,2]),I=Object(Ke.slice)(R,[0,2],[-1,2]),U=Object(Ke.add)(Object(Ke.div)(F,this.inputSizeTensor),this.anchorsTensor),X=Object(Ke.div)(I,this.doubleInputSizeTensor),oe=Object(Ke.mul)(Object(Ke.sub)(U,X),this.inputSizeTensor),me=Object(Ke.mul)(Object(Ke.add)(U,X),this.inputSizeTensor);return Object(Ke.concat2d)([oe,me],1)})}normalizeLandmarks(R,F){return Object(Ke.tidy)(()=>{const I=Object(Ke.add)(Object(Ke.div)(R.reshape([-1,7,2]),this.inputSizeTensor),this.anchors[F]);return Object(Ke.mul)(I,this.inputSizeTensor)})}getBoundingBoxes(R){return Object(Ke.tidy)(()=>{const F=Object(Ke.mul)(Object(Ke.sub)(R,.5),2),I=Object(Ke.env)().get("WEBGL_PACK_DEPTHWISECONV");Object(Ke.env)().set("WEBGL_PACK_DEPTHWISECONV",!0);const U=this.model.predict(F).squeeze();Object(Ke.env)().set("WEBGL_PACK_DEPTHWISECONV",I);const X=Object(Ke.sigmoid)(Object(Ke.slice)(U,[0,0],[-1,1])).squeeze(),oe=Object(Ke.slice)(U,[0,1],[-1,4]),me=this.normalizeBoxes(oe),Se=console.warn;console.warn=()=>{};const Me=Ke.image.nonMaxSuppression(me,X,1,this.iouThreshold,this.scoreThreshold).arraySync();if(console.warn=Se,Me.length===0)return null;const Te=Me[0],tt=Object(Ke.slice)(me,[Te,0],[1,-1]),at=Object(Ke.slice)(U,[Te,5],[1,14]);return{boxes:tt,palmLandmarks:this.normalizeLandmarks(at,Te).reshape([-1,2])}})}estimateHandBounds(R){const F=R.shape[1],I=R.shape[2],U=Object(Ke.ti
8305dy)(()=>R.resizeBilinear([this.width,this.height]).div(255)),X=this.getBoundingBoxes(U);if(X===null)return U.dispose(),null;const oe=X.boxes.arraySync(),me=oe[0].slice(0,2),Se=oe[0].slice(2,4),Me=X.palmLandmarks.arraySync();return U.dispose(),X.boxes.dispose(),X.palmLandmarks.dispose(),function(Te,tt){return{startPoint:[Te.startPoint[0]*tt[0],Te.startPoint[1]*tt[1]],endPoint:[Te.endPoint[0]*tt[0],Te.endPoint[1]*tt[1]],palmLandmarks:Te.palmLandmarks.map(at=>[at[0]*tt[0],at[1]*tt[1]])}}({startPoint:me,endPoint:Se,palmLandmarks:Me},[I/this.width,F/this.height])}}const Ph={thumb:[1,2,3,4],indexFinger:[5,6,7,8],middleFinger:[9,10,11,12],ringFinger:[13,14,15,16],pinky:[17,18,19,20],palmBase:[0]};function C1(q,R){return function(F){return F-2*Math.PI*Math.floor((F+Math.PI)/(2*Math.PI))}(Math.PI/2-Math.atan2(-(R[1]-q[1]),R[0]-q[0]))}const Ey=(q,R)=>[[1,0,q],[0,1,R],[0,0,1]];function of(q,R){let F=0;for(let I=0;I<q.length;I++)F+=q[I]*R[I];return F}function zs(q,R){const F=[];for(let I=0;I<q.length;I++)F.push(q[I][R]);return F}function Yp(q,R){const F=[],I=q.length;for(let U=0;U<I;U++){F.push([]);for(let X=0;X<I;X++)F[U].push(of(q[U],zs(R,X)))}return F}function hg(q,R){const F=Math.cos(q),I=Math.sin(q),U=[[F,-I,0],[I,F,0],[0,0,1]];return Yp(Yp(Ey(R[0],R[1]),U),Ey(-R[0],-R[1]))}function c0(q,R){return[of(q,R[0]),of(q,R[1])]}const Cy=.8,l0=[0,-.4],Id=3,Mb=[0,-.1],f0=1.65,Ds=[0,5,9,13,17,1,2],pg=0,jh=2;class d0{constructor(R,F,I,U,X,oe){this.regionsOfInterest=[],this.runsWithoutHandDetector=0,this.boundingBoxDetector=R,this.meshDetector=F,this.maxContinuousChecks=X,this.detectionConfidence=oe,this.meshWidth=I,this.meshHeight=U,this.maxHandsNumber=1}getBoxForPalmLandmarks(R,F){const I=R.map(U=>c0([...U,1],F));return av(ky(E1(this.calculateLandmarksBoundingBox(I),l0)),Id)}getBoxForHandLandmarks(R){const F=av(ky(E1(this.calculateLandmarksBoundingBox(R),Mb)),f0),I=[];for(let U=0;U<Ds.length;U++)I.push(R[Ds[U]].slice(0,2));return F.palmLandmarks=I,F}transformRawCoords(R,F,I,U){const X=fg(F),oe=[X[0]/this.meshWidth,X[1]/this.meshHeight],me=R.map(jt=>[oe[0]*(jt[0]-this.meshWidth/2),oe[1]*(jt[1]-this.meshHeight/2),jt[2]]),Se=hg(I,[0,0]),Me=me.map(jt=>[...c0(jt,Se),jt[2]]),Te=function(jt){const $t=[[jt[0][0],jt[1][0]],[jt[0][1],jt[1][1]]],vn=[jt[0][2],jt[1][2]],wn=[-of($t[0],vn),-of($t[1],vn)];return[$t[0].concat(wn[0]),$t[1].concat(wn[1]),[0,0,1]]}(U),tt=[...dg(F),1],at=[of(tt,Te[0]),of(tt,Te[1])];return Me.map(jt=>[jt[0]+at[0],jt[1]+at[1],jt[2]])}async estimateHand(R){const F=this.shouldUpdateRegionsOfInterest();if(F===!0){const Cn=this.boundingBoxDetector.estimateHandBounds(R);if(Cn===null)return R.dispose(),this.regionsOfInterest=[],null;this.updateRegionsOfInterest(Cn,!0),this.runsWithoutHandDetector=0}else this.runsWithoutHandDetector++;const I=this.regionsOfInterest[0],U=C1(I.palmLandmarks[pg],I.palmLandmarks[jh]),X=dg(I),oe=[X[0]/R.shape[2],X[1]/R.shape[1]];let me;const Se=Object(Ke.getBackend)();if(Se==="webgl")me=function(Cn,wr,Fr,Rr){const Xr=Cn.shape,zr=Xr[1],Ti=Xr[2],Wi=Math.sin(wr),zi=Math.cos(wr),Xo=Math.floor(Ti*(typeof Rr=="number"?Rr:Rr[0])),wa=Math.floor(zr*(typeof Rr=="number"?Rr:Rr[1])),ua={variableNames:["Image"],outputShape:Xr,userCode:` 8306 void main() { 8307 ivec4 coords = getOutputCoords(); 8308 int x = coords[2]; 8309 int y = coords[1]; 8310 int coordX = int(float(x - ${Xo}) * ${zi} - 8311 float(y - ${wa}) * ${Wi}); 8312 int coordY = int(float(x - ${Xo}) * ${Wi} + 8313 float(y - ${wa}) * ${zi}); 8314 coordX = int(coordX + ${Xo}); 8315 coordY = int(coordY + ${wa}); 8316 8317 ${typeof Fr=="number"?`float outputValue = ${Fr.toFixed(2)};`:` 8318 vec3 fill = vec3(${Fr.join(",")}); 8319 float outputValue = fill[coords[3]];`} 8320 8321 if(coordX > 0 && coordX < ${Ti} && coordY > 0 && coordY < ${zr}) { 8322 outputValue = getImage(coords[0], coordY, coordX, coords[3]); 8323 } 8324 8325 setOutput(outputValue); 8326 }`};return Object(Ke.backend)().compileAndRun(ua,[Cn])}(R,U,0,oe);else{if(Se!=="cpu")throw new Error(`Handpose is not yet supported by the ${Se} backend - rotation kernel is not defined.`);me=function(Cn,wr,Fr,Rr){const Xr=Object(Ke.backend)(),zr=Object(Ke.buffer)(Cn.shape,Cn.dtype),[Ti,Wi,zi,Xo]=Cn.shape,wa=zi*(typeof Rr=="number"?Rr:Rr[0]),ua=Wi*(typeof Rr=="number"?Rr:Rr[1]),oa=Math.sin(-wr),ha=Math.cos(-wr),Ma=Xr.readSync(Cn.dataId);for(let Wa=0;Wa<Ti;Wa++)for(let us=0;us<Wi;us++)for(let Qu=0;Qu<zi;Qu++)for(let Hi=0;Hi<Xo;Hi++){const Ts=[Ti,us,Qu,Hi],Us=Ts[2],Zu=Ts[1];let Au=(Us-wa)*ha-(Zu-ua)*oa,xc=(Us-wa)*oa+(Zu-ua)*ha;Au=Math.round(Au+wa),xc=Math.round(xc+ua);let wc=Fr;typeof Fr!="number"&&(wc=Hi===3?255:Fr[Hi]),Au>=0&&Au<zi&&xc>=0&&xc<Wi&&(wc=Ma[Wa*zi*Wi*Xo+xc*(zi*Xo)+Au*Xo+Hi]);const _c=Wa*zi*Wi*Xo+us*(zi*Xo)+Qu*Xo+Hi;zr.values[_c]=wc}return zr.toTensor()}(R,U,0,oe)}const Me=hg(-U,X);let Te;const tt=function(Cn,wr,Fr){const Rr=wr.shape[1],Xr=wr.shape[2],zr=[[Cn.startPoint[1]/Rr,Cn.startPoint[0]/Xr,Cn.endPoint[1]/Rr,Cn.endPoint[0]/Xr]];return Ke.image.cropAndResize(wr,zr,[0],Fr)}(Te=F===!0?this.getBoxForPalmLandmarks(I.palmLandmarks,Me):I,me,[this.meshWidth,this.meshHeight]),at=tt.div(255);tt.dispose(),me.dispose();const jt=Object(Ke.env)().get("WEBGL_PACK_DEPTHWISECONV");Object(Ke.env)().set("WEBGL_PACK_DEPTHWISECONV",!0);const[$t,vn]=this.meshDetector.predict(at);Object(Ke.env)().set("WEBGL_PACK_DEPTHWISECONV",jt),at.dispose();const wn=$t.dataSync()[0];if($t.dispose(),wn<this.detectionConfidence)return vn.dispose(),this.regionsOfInterest=[],null;const Nn=Object(Ke.reshape)(vn,[-1,3]),In=Nn.arraySync();vn.dispose(),Nn.dispose();const Ln=this.transformRawCoords(In,Te,U,Me),qn=this.getBoxForHandLandmarks(Ln);return this.updateRegionsOfInterest(qn,!1),{landmarks:Ln,handInViewConfidence:wn,boundingBox:{topLeft:qn.startPoint,bottomRight:qn.endPoint}}}calculateLandmarksBoundingBox(R){const F=R.map(U=>U[0]),I=R.map(U=>U[1]);return{startPoint:[Math.min(...F),Math.min(...I)],endPoint:[Math.max(...F),Math.max(...I)]}}updateRegionsOfInterest(R,F){if(F)this.regionsOfInterest=[R];else{const I=this.regionsOfInterest[0];let U=0;if(I!=null&&I.startPoint!=null){const[X,oe]=R.startPoint,[me,Se]=R.endPoint,[Me,Te]=I.startPoint,[tt,at]=I.endPoint,jt=Math.max(X,Me),$t=Math.max(oe,Te),vn=(Math.min(me,tt)-jt)*(Math.min(Se,at)-$t);U=vn/((me-X)*(Se-oe)+(tt-Me)*(at-oe)-vn)}this.regionsOfInterest[0]=U>Cy?I:R}}shouldUpdateRegionsOfInterest(){return this.regionsOfInterest.length!==this.maxHandsNumber||this.runsWithoutHandDetector>=this.maxContinuousChecks}}const mg=256,sv=256;async function uv({maxContinuousChecks:q=1/0,detectionConfidence:R=.8,iouThreshold:F=.3,scoreThreshold:I=.5}={}
8326){const[U,X,oe]=await Promise.all([async function(){return Ke.util.fetch("https://tfhub.dev/mediapipe/tfjs-model/handskeleton/1/default/1/anchors.json?tfjs-format=file").then(Me=>Me.json())}(),async function(){return Object(Mt.loadGraphModel)("https://tfhub.dev/mediapipe/tfjs-model/handdetector/1/default/1",{fromTFHub:!0})}(),async function(){return Object(Mt.loadGraphModel)("https://tfhub.dev/mediapipe/tfjs-model/handskeleton/1/default/1",{fromTFHub:!0})}()]),me=new rf(X,mg,sv,U,F,I),Se=new d0(me,oe,mg,sv,q,R);return new Md(Se)}class Md{constructor(R){this.pipeline=R}static getAnnotations(){return Ph}async estimateHands(R,F=!1){const[,I]=function(Se){return Se instanceof Ke.Tensor?[Se.shape[0],Se.shape[1]]:[Se.height,Se.width]}(R),U=Object(Ke.tidy)(()=>(R instanceof Ke.Tensor||(R=Ke.browser.fromPixels(R)),R.toFloat().expandDims(0))),X=await this.pipeline.estimateHand(U);if(U.dispose(),X===null)return[];let oe=X;F===!0&&(oe=function(Se,Me){const{handInViewConfidence:Te,landmarks:tt,boundingBox:at}=Se;return{handInViewConfidence:Te,landmarks:tt.map(jt=>[Me-1-jt[0],jt[1],jt[2]]),boundingBox:{topLeft:[Me-1-at.topLeft[0],at.topLeft[1]],bottomRight:[Me-1-at.bottomRight[0],at.bottomRight[1]]}}}(X,I));const me={};for(const Se of Object.keys(Ph))me[Se]=Ph[Se].map(Me=>oe.landmarks[Me]);return[{handInViewConfidence:oe.handInViewConfidence,boundingBox:oe.boundingBox,landmarks:oe.landmarks,annotations:me}]}}function al(q){var R=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var F,I=Qs()(q);if(R){var U=Qs()(this).constructor;F=Reflect.construct(I,arguments,U)}else F=I.apply(this,arguments);return Vl()(this,F)}}var Sy=function(q){Wl()(F,q);var R=al(F);function F(I,U,X){var oe;return ce()(this,F),(oe=R.call(this)).video=I,oe.model=null,oe.modelReady=!1,oe.config=U,oe.ready=$e(oe.loadModel(),X),oe}return ke()(F,[{key:"loadModel",value:function(){var I=K()(be.a.mark(function U(){var X=this;return be.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return oe.next=2,uv(this.config);case 2:if(this.model=oe.sent,this.modelReady=!0,!this.video||this.video.readyState!==0){oe.next=7;break}return oe.next=7,new Promise(function(me){X.video.onloadeddata=function(){me()}});case 7:return this.video&&this.predict(),oe.abrupt("return",this);case 9:case"end":return oe.stop()}},U,this)}));return function(){return I.apply(this,arguments)}}()},{key:"predict",value:function(){var I=K()(be.a.mark(function U(X,oe){var me,Se,Me,Te,tt=this;return be.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:if(me=this.getInput(X)){at.next=3;break}throw new Error("No input image found.");case 3:return Se=this.config.flipHorizontal,at.next=6,this.model.estimateHands(me,Se);case 6:if(Me=at.sent,Te=Me,this.emit("predict",Te),this.emit("hand",Te),!this.video){at.next=12;break}return at.abrupt("return",N.nextFrame().then(function(){return tt.predict()}));case 12:return typeof oe=="function"&&oe(Te),at.abrupt("return",Te);case 14:case"end":return at.stop()}},U,this)}));return function(U,X){return I.apply(this,arguments)}}()},{key:"getInput",value:function(I){return I instanceof HTMLImageElement||I instanceof HTMLVideoElement||I instanceof HTMLCanvasElement||I instanceof ImageData?I:Ee()(I)==="object"&&(I.elt instanceof HTMLImageElement||I.elt instanceof HTMLVideoElement||I.elt instanceof ImageData)?I.elt:Ee()(I)==="object"&&I.canvas instanceof HTMLCanvasElement?I.canvas:this.video}}]),F}(Om.EventEmitter),Ay=function(q,R,F){var I,U={},X=F;q instanceof HTMLVideoElement?I=q:Ee()(q)==="object"&&q.elt instanceof HTMLVideoElement?I=q.elt:Ee()(q)==="object"?U=q:typeof q=="function"&&(X=q),Ee()(R)==="object"?U=R:typeof R=="function"&&(X=R);var oe=new Sy(I,U,X);return X?oe:oe.ready},Xp=function(){console.log(` 8327ðððððððððððððððððððððð 8328ð Thank you for using ml5.js v`.concat(Op.a,` ð 8329 8330Please read our community statement to ensure 8331that the use of this software reflects the values 8332of the ml5.js community: 8333â³ https://ml5js.org/about 8334 8335Reporting: 8336â³ https://github.com/ml5js/ml5-library/issues 8337â³ Email: [email protected] 8338ðððððððððððððððððððððð`))},gg=function(){var q=K()(be.a.mark(function R(){var F;return be.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return(F=new Image).crossOrigin="",F.src="https://cdn.jsdelivr.net/gh/ml5js/ml5-library@main/assets/bird.jpg",I.next=5,new Promise(function(U){F.onload=U});case 5:return I.abrupt("return",F);case 6:case"end":return I.stop()}},R)}));return function(){return q.apply(this,arguments)}}(),S1=function(){var q=K()(be.a.mark(function R(){var F,I,U;return be.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:for(F=new Uint8ClampedArray(2e4),I=0;I<F.length;I+=4)F[I+0]=0,F[I+1]=190,F[I+2]=0,F[I+3]=255;
8338return U=new ImageData(F,200),X.abrupt("return",U);case 4:case"end":return X.stop()}},R)}));return function(){return q.apply(this,arguments)}}();function cv(q,R){var F=Object.keys(q);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(q);R&&(I=I.filter(function(U){return Object.getOwnPropertyDescriptor(q,U).enumerable})),F.push.apply(F,I)}return F}function h0(q){for(var R=1;R<arguments.length;R++){var F=arguments[R]!=null?arguments[R]:{};R%2?cv(Object(F),!0).forEach(function(I){V()(q,I,F[I])}):Object.getOwnPropertyDescriptors?Object.defineProperties(q,Object.getOwnPropertyDescriptors(F)):cv(Object(F)).forEach(function(I){Object.defineProperty(q,I,Object.getOwnPropertyDescriptor(F,I))})}return q}var Gr={charRNN:Pm,CVAE:Lm,cartoon:my,DCGAN:sd,featureExtractor:fo,imageClassifier:ci,kmeans:ly,dbscan:py,soundClassifier:Ai,pitchDetection:Dt,pix2pix:el,poseNet:kl,sketchRNN:Sp,styleTransfer:od,word2vec:yl,YOLO:rd,CocoSsd:th,objectDetector:vp,uNet:wf,sentiment:cd,bodyPix:Um,faceApi:sy,universalSentenceEncoder:Il,facemesh:ov,handpose:Ay};Xp(),i.default=Object.assign({p5Utils:cr},function(q){if(typeof window>"u"||window.p5===void 0||window.p5.prototype===void 0||window.p5.prototype.registerPreloadMethod===void 0)return q;var R=q;return Object.keys(q).forEach(function(F){var I=q[F];R[F]=function(){for(var U=null,X=arguments.length,oe=new Array(X),me=0;me<X;me++)oe[me]=arguments[me];var Se=oe.length;return typeof oe[Se-1]=="function"&&(U=oe[Se-1],Se-=1),I.apply(q,[].concat(ya()(oe.slice(0,Se)),[function(){try{U&&U()}catch(Me){console.error(Me)}return window._decrementPreload?window._decrementPreload():null}]))},window.p5.prototype.registerPreloadMethod("".concat(F),q)}),q}(Gr),h0(h0({KNNClassifier:lo,communityStatement:Xp},g),{},{tf:N,tfvis:ee,version:Op.a,neuralNetwork:Hm,testingUtils:P}))},function(a,i){},function(a,i){},function(a,i){},function(a,i){a.exports=function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 8339In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i){a.exports=function(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){var s=n(186);a.exports=function(h){if(Array.isArray(h))return s(h)},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){function s(M){return new Uint8Array(atob(M).split("").map(function(P){return P.charCodeAt(0)}))}Object.defineProperty(i,"__esModule",{value:!0}),i.stringToUint8array=s,i.stringToArray=function(M){var P=s(M);return new Int16Array(P.buffer)};var h=!1,v=0;function g(){if(h)return h=!1,v;var M=2*Math.random()-1,P=2*Math.random()-1,L=M*M+P*P;if(L===0||L>1)return g();var V=Math.sqrt(-2*Math.log(L)/L);return v=P*V,h=!0,M*V}function O(M,P){return Math.random()*(P-M)+M}function A(M,P){return M+g()*P}function S(M,P){P===void 0&&(P=2);var L=P;function V(Dt,Ut){return[Dt[0]-Ut[0],Dt[1]-Ut[1]]}function N(Dt,Ut){return Dt[0]*Ut[0]+Dt[1]*Ut[1]}function ee(Dt){return Dt[0]*Dt[0]+Dt[1]*Dt[1]}function J(Dt,Ut){return ee(V(Dt,Ut))}var K,re,ce,pe,ke=M.length,Ce=[],be=L*L,$e=[],ht=[];for($e[0]=M[0],K=re=1,pe=0;K<ke;K++)J(M[K],M[pe])<be||($e[re++]=M[K],pe=K);for(pe<ke-1&&($e[re++]=M[ke-1]),ht[0]=ht[re-1]=1,function Dt(Ut,Ee,Ot,zt,Mt){if(!(zt<=Ot+1)){for(var Ke,Tt,vt,yt,bt=Ot,Ht=0,_t=Ut*Ut,Ze=[Ee[Ot],Ee[zt]],Vt=V(Ze[1],Ze[0]),sn=ee(Vt),yn=Ot+1;yn<zt;yn++)(vt=N(V(Ee[yn],Ze[0]),Vt))<=0?yt=J(Ee[yn],Ze[0]):sn<=vt?yt=J(Ee[yn],Ze[1]):(Tt=vt/sn,Ke=[Ze[0][0]+Tt*Vt[0],Ze[0][1]+Tt*Vt[1]],yt=J(Ee[yn],Ke)),yt<=Ht||(bt=yn,Ht=yt);Ht>_t&&(Mt[bt]=1,Dt(Ut,Ee,Ot,bt,Mt),Dt(Ut,Ee,bt,zt,Mt))}}(L,$e,0,re-1,ht),K=ce=0;K<re;K++)ht[K]&&(Ce[ce++]=$e[K]);return Ce}i.gaussRandom=g,i.randf=O,i.randi=function(M,P){return Math.floor(Math.random()*(P-M)+M)},i.randn=A,i.birandn=function(M,P,L,V,N){var ee=A(0,1),J=A(0,1);return[Math.sqrt(1-N*N)*L*ee+N*L*J+M,V*J+P]},i.sampleSoftmax=function(M){var P,L=O(0,1),V=M.length,N=0;for(P=0;P<V;P++)if((N+=M[P])>=L)return P;return console.log("error sampling pi index"),-1},i.simplifyLine=S,i.simplifyLines=function(M,P){var L=[],V=2;P&&(V=P);for(var N=0;N<M.length;N++)L.push(S(M[N],V));return L},i.linesToStrokes=function(M){var P,L,V,N,ee,J,K,re,ce,pe,ke=0,Ce=0,be=[];for(K=0;K<M.length;K++)if((ce=M[K].length)>1)for(re=0;re<ce;
8339re++)P=(pe=M[K][re])[0],L=pe[1],re===ce-1?(J=1,ee=0):(J=0,ee=1),V=P-ke,N=L-Ce,ke=P,Ce=L,be.push([V,N,ee,J,0]);return be.push([0,0,0,0,1]),be.slice(1)},i.lineToStroke=function(M,P){var L,V,N,ee,J,K,re,ce,pe,ke,Ce,be=[];if(pe=P[0],ke=P[1],(N=M.length)>1)for(Ce=0;Ce<N;Ce++)re=(ee=M[Ce])[0],ce=ee[1],Ce===N-1?(V=1,L=0):(V=0,L=1),J=re-pe,K=ce-ke,pe=re,ke=ce,be.push([J,K,L,V,0]);return be}},function(a,i,n){var s=this&&this.__awaiter||function(A,S,M,P){return new(M||(M=Promise))(function(L,V){function N(K){try{J(P.next(K))}catch(re){V(re)}}function ee(K){try{J(P.throw(K))}catch(re){V(re)}}function J(K){K.done?L(K.value):new M(function(re){re(K.value)}).then(N,ee)}J((P=P.apply(A,S||[])).next())})},h=this&&this.__generator||function(A,S){var M,P,L,V,N={label:0,sent:function(){if(1&L[0])throw L[1];return L[1]},trys:[],ops:[]};return V={next:ee(0),throw:ee(1),return:ee(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function ee(J){return function(K){return function(re){if(M)throw new TypeError("Generator is already executing.");for(;N;)try{if(M=1,P&&(L=2&re[0]?P.return:re[0]?P.throw||((L=P.return)&&L.call(P),0):P.next)&&!(L=L.call(P,re[1])).done)return L;switch(P=0,L&&(re=[2&re[0],L.value]),re[0]){case 0:case 1:L=re;break;case 4:return N.label++,{value:re[1],done:!1};case 5:N.label++,P=re[1],re=[0];continue;case 7:re=N.ops.pop(),N.trys.pop();continue;default:if(!(L=(L=N.trys).length>0&&L[L.length-1])&&(re[0]===6||re[0]===2)){N=0;continue}if(re[0]===3&&(!L||re[1]>L[0]&&re[1]<L[3])){N.label=re[1];break}if(re[0]===6&&N.label<L[1]){N.label=L[1],L=re;break}if(L&&N.label<L[2]){N.label=L[2],N.ops.push(re);break}L[2]&&N.ops.pop(),N.trys.pop();continue}re=S.call(A,N)}catch(ce){re=[6,ce],P=0}finally{M=L=0}if(5&re[0])throw re[1];return{value:re[0]?re[1]:void 0,done:!0}}([J,K])}}};Object.defineProperty(i,"__esModule",{value:!0});var v=n(0),g=n(255),O=function(){function A(S){this.NMIXTURE=20,this.checkpointURL=S,this.initialized=!1}return A.prototype.isInitialized=function(){return this.initialized},A.prototype.instantiateFromJSON=function(S,M,P){var L;this.forgetBias=v.scalar(1),this.info=S,this.setPixelFactor(2),this.weightDims=M,this.numUnits=this.weightDims[0][0],this.weights=[];for(var V=0;V<P.length;V++){for(var N=(L=new Float32Array(g.stringToArray(P[V]))).length,ee=0;ee<N;ee++)L[ee]=10*L[ee]/32767;this.weights.push(L)}this.outputKernel=v.tensor2d(this.weights[0],[this.weightDims[0][0],this.weightDims[0][1]]),this.outputBias=v.tensor1d(this.weights[1]);var J=v.tensor2d(this.weights[2],[this.weightDims[2][0],this.weightDims[2][1]]),K=v.tensor2d(this.weights[3],[this.weightDims[3][0],this.weightDims[3][1]]);this.lstmKernel=v.concat2d([J,K],0),this.lstmBias=v.tensor1d(this.weights[4]),this.rawVars=[this.outputKernel,this.outputBias,this.lstmKernel,this.lstmBias]},A.prototype.initialize=function(){return s(this,void 0,void 0,function(){var S;return h(this,function(M){switch(M.label){case 0:return this.dispose(),[4,fetch(this.checkpointURL).then(function(P){return P.json()})];case 1:return S=M.sent(),this.instantiateFromJSON(S[0],S[1],S[2]),this.initialized=!0,console.log("Initialized SketchRNN."),[2]}})})},A.prototype.dispose=function(){if(this.rawVars){for(var S=0;S<this.rawVars.length;S++)this.rawVars[S].dispose();this.rawVars=void 0}this.forgetBias&&(this.forgetBias.dispose(),this.forgetBias=void 0),this.initialized=!1},A.prototype.setPixelFactor=function(S){this.pixelFactor=S,this.scaleFactor=this.info.scale_factor/this.pixelFactor},A.prototype.update=function(S,M){var P=this,L=v.tidy(function(){var J=P.numUnits,K=P.scaleFactor,re=[S[0]/K,S[1]/K,S[2],S[3],S[4]],ce=v.tensor2d(re,[1,5]),pe=v.tensor2d(M.c,[1,J]),ke=v.tensor2d(M.h,[1,J]),Ce=v.basicLSTMCell(P.forgetBias,P.lstmKernel,P.lstmBias,ce,pe,ke);return v.concat(Ce,1)}),V=L.dataSync();L.dispose();var N=V.slice(0,this.numUnits),ee=V.slice(this.numUnits,2*this.numUnits);return{c:new Float32Array(N),h:new Float32Array(ee)}},A.prototype.updateStrokes=function(S,M,P){var L=this,V=v.tidy(function(){var K,re,ce,pe,ke,Ce=L.numUnits,be=L.scaleFactor,$e=S.length;P&&($e=P),ce=v.tensor2d(M.c,[1,Ce]),pe=v.tensor2d(M.h,[1,Ce]);for(var ht=0;ht<$e;ht++)K=[S[ht][0]/be,S[ht][1]/be,S[ht][2],S[ht][3],S[ht][4]],re=v.tensor2d(K,[1,5]),ce=(ke=v.basicLSTMCell(L.forgetBias,L.lstmKernel,L.lstmBias,re,ce,pe))[0],pe=ke[1];return v.concat(ke,1)}),N=V.dataSync();V.dispose();var ee=N.slice(0,this.numUnits),J=N.slice(this.numUnits,2*this.numUnits);return{c:new Float32Array(ee),h:new Float32Array(J)}},A.prototype.getPDF=function(S,M,P){var L=this;M===void 0&&(M=.65);var V=M,N=.5+.5*V;P&&(N=P);var ee=this.NMIXTURE,J=v.tidy(function(){var re=L.numUnits,ce=v.tensor2d(S.h,[1,re]),pe=v.scalar(Math.sqrt(V)),ke=v.scalar(N),Ce=v.add(v.matMul(ce,L.outputKernel),L.outputBias).squeeze(),be=v.split(Ce,[3,6*ee]),$e=be[0],ht=be[1],Dt=v.split(ht,6),Ut=Dt[0],Ee=Dt[1],Ot=Dt[2],zt=Dt[3],Mt=Dt[4],Ke=Dt[5],Tt=v.softmax($e.div(ke)),vt=[v.softmax(Ut.div(ke)),Ee,Ot,v.exp(zt).mul(pe),v.exp(Mt).mul(pe),v.tanh(Ke),Tt];return v.concat(vt)}),K=J.dataSync();return J.dispose(),{pi:new Float32Array(K.slice(0,ee)),muX:new Float32Array(K.slice(1*ee,2*ee)),muY:new Float32Array(K.slice(2*ee,3*ee)),sigmaX:new Float32Array(K.slice(3*ee,4*ee)),sigmaY:new Float32Array(K.slice(4*ee,15*ee)),corr:new Float32Array(K.slice(5*ee,6*ee)),pen:new Float32Array(K.slice(6*ee,6*ee+3))}},A.prototype.zeroState=function(){return{c:new Float32Array(this.numUnits),h:new Float32Array(this.numUnits)}},A.prototype.copyState=function(S){return{c:new Float32Array(S.c),h:new Float32Array(S.h)}},A.prototype.zeroInput=function(){return[0,0,1,0,0]},A.prototype.sample=function(S){var M=g.sampleSoftmax(S.pi),P=S.muX[M],L=S.muY[M],V=S.sigmaX[M],N=S.sigmaY[M],ee=S.corr[M],J=[0,0,0];J[g.sampleSoftmax(S.pen)]=1;var K=g.birandn(P,L,V,N,ee);return[K[0]*this.scaleFactor,K[1]*this.scaleFactor,J[0],J[1],J[2]]},A.prototype.simplifyLine=function(S,M){return g.simplifyLine(S,M)},A.prototype.simplifyLines=function(S,M){return g.simplifyLines(S,M)},A.prototype.linesToStroke=function(S){return g.linesToStrokes(S)},A.prototype.lineToStroke=function(S,M){return g.lineToStroke(S,M)},A}();i.SketchRNN=O},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(256);i.SketchRNN=s.SketchRNN},function(a,i){a.exports=function(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n},a.exports.__esModule=!0,a.exports.default=a.exports}
8339,function(a,i){function n(s,h){return a.exports=n=Object.setPrototypeOf||function(v,g){return v.__proto__=g,v},a.exports.__esModule=!0,a.exports.default=a.exports,n(s,h)}a.exports=n,a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i){a.exports=function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 8340In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i){a.exports=function(n,s){var h=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(h!=null){var v,g,O=[],A=!0,S=!1;try{for(h=h.call(n);!(A=(v=h.next()).done)&&(O.push(v.value),!s||O.length!==s);A=!0);}catch(M){S=!0,g=M}finally{try{A||h.return==null||h.return()}finally{if(S)throw g}}return O}},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i){a.exports=function(n){if(Array.isArray(n))return n},a.exports.__esModule=!0,a.exports.default=a.exports},function(a,i,n){a.exports=function(s){return typeof s=="object"&&s.isAxiosError===!0}},function(a,i,n){a.exports=function(s){return function(h){return s.apply(null,h)}}},function(a,i,n){var s=n(188);function h(v){if(typeof v!="function")throw new TypeError("executor must be a function.");var g;this.promise=new Promise(function(A){g=A});var O=this;v(function(A){O.reason||(O.reason=new s(A),g(O.reason))})}h.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},h.source=function(){var v;return{token:new h(function(g){v=g}),cancel:v}},a.exports=h},function(a){a.exports={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}],_resolved:"https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",_integrity:"sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",_from:"[email protected]"}},function(a,i,n){var s=n(266),h={};["object","boolean","number","function","string","symbol"].forEach(function(A,S){h[A]=function(M){return typeof M===A||"a"+(S<1?"n ":" ")+A}});var v={},g=s.version.split(".");function O(A,S){for(var M=S?S.split("."):g,P=A.split("."),L=0;L<3;L++){if(M[L]>P[L])return!0;if(M[L]<P[L])return!1}return!1}h.transitional=function(A,S,M){var P=S&&O(S);function L(V,N){return"[Axios v"+s.version+"] Transitional option '"+V+"'"+N+(M?". "+M:"")}return function(V,N,ee){if(A===!1)throw new Error(L(N," has been removed in "+S));return P&&!v[N]&&(v[N]=!0,console.warn(L(N," has been deprecated since v"+S+" and will be removed in the near future"))),!A||A(V,N,ee)}},a.exports={isOlderVersion:O,assertOptions:function(A,S,M){if(typeof A!="object")throw new TypeError("options must be an object");for(var P=Object.keys(A),L=P.length;L-- >0;){var V=P[L],N=S[V];if(N){var ee=A[V],J=ee===void 0||N(ee,V,A);if(J!==!0)throw new TypeError("option "+V+" must be "+J)}else if(M!==!0)throw Error("Unknown option "+V)}},validators:h}},function(a,i,n){var s=n(36);a.exports=s.isStandardBrowserEnv()?function(){var h,v=/(msie|trident)/i.test(navigator.userAgent),g=document.createElement("a");function O(A){var S=A;return v&&(g.setAttribute("href",S),S=g.href),g.setAttribute("href",S),{href:g.href,protocol:g.protocol?g.protocol.replace(/:$/,""):"",host:g.host,search:g.search?g.search.replace(/^\?/,""):"",hash:g.hash?g.hash.replace(/^#/,""):"",hostname:g.hostname,port:g.port,pathname:g.pathname.charAt(0)==="/"?g.pathname:"/"+g.pathname}}return h=O(window.location.href),function(A){var S=s.isString(A)?O(A):A;return S.protocol===h.protocol&&S.host===h.host}}():function(){return!0}},function(a,i,n){var s=n(36),h=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];a.exports=function(v){var g,O,A,S={};
vendor: 2,129 bytes, lines 8340-8341
8340return v&&s.forEach(v.split(` 8341`),function(M){if(A=M.indexOf(":"),g=s.trim(M.substr(0,A)).toLowerCase(),O=s.trim(M.substr(A+1)),g){if(S[g]&&h.indexOf(g)>=0)return;S[g]=g==="set-cookie"?(S[g]?S[g]:[]).concat([O]):S[g]?S[g]+", "+O:O}}),S}},function(a,i,n){a.exports=function(s,h){return h?s.replace(/\/+$/,"")+"/"+h.replace(/^\/+/,""):s}},function(a,i,n){a.exports=function(s){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(s)}},function(a,i,n){var s=n(271),h=n(270);a.exports=function(v,g){return v&&!s(g)?h(v,g):g}},function(a,i,n){var s=n(36);a.exports=s.isStandardBrowserEnv()?{write:function(h,v,g,O,A,S){var M=[];M.push(h+"="+encodeURIComponent(v)),s.isNumber(g)&&M.push("expires="+new Date(g).toGMTString()),s.isString(O)&&M.push("path="+O),s.isString(A)&&M.push("domain="+A),S===!0&&M.push("secure"),document.cookie=M.join("; ")},read:function(h){var v=document.cookie.match(new RegExp("(^|;\\s*)("+h+")=([^;]*)"));return v?decodeURIComponent(v[3]):null},remove:function(h){this.write(h,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(a,i,n){var s=n(191);a.exports=function(h,v,g){var O=g.config.validateStatus;g.status&&O&&!O(g.status)?v(s("Request failed with status code "+g.status,g.config,null,g.request,g)):h(g)}},function(a,i,n){var s=n(36);a.exports=function(h,v){s.forEach(h,function(g,O){O!==v&&O.toUpperCase()===v.toUpperCase()&&(h[v]=g,delete h[O])})}},function(a,i,n){var s=n(36),h=n(136);a.exports=function(v,g,O){var A=this||h;return s.forEach(O,function(S){v=S.call(A,v,g)}),v}},function(a,i,n){var s=n(36),h=n(276),v=n(190),g=n(136);function O(A){A.cancelToken&&A.cancelToken.throwIfRequested()}a.exports=function(A){return O(A),A.headers=A.headers||{},A.data=h.call(A,A.data,A.headers,A.transformRequest),A.headers=s.merge(A.headers.common||{},A.headers[A.method]||{},A.headers),s.forEach(["delete","get","head","post","put","patch","common"],function(S){delete A.headers[S]}),(A.adapter||g.adapter)(A).then(function(S){return O(A),S.data=h.call(A,S.data,S.headers,A.transformResponse),S},function(S){return v(S)||(O(A),S&&S.response&&(S.response.data=h.c
8341all(A,S.response.data,S.response.headers,A.transformResponse))),Promise.reject(S)})}},function(a,i,n){var s=n(36);function h(){this.handlers=[]}h.prototype.use=function(v,g,O){return this.handlers.push({fulfilled:v,rejected:g,synchronous:!!O&&O.synchronous,runWhen:O?O.runWhen:null}),this.handlers.length-1},h.prototype.eject=function(v){this.handlers[v]&&(this.handlers[v]=null)},h.prototype.forEach=function(v){s.forEach(this.handlers,function(g){g!==null&&v(g)})},a.exports=h},function(a,i,n){var s=n(36),h=n(194),v=n(278),g=n(277),O=n(189),A=n(267),S=A.validators;function M(P){this.defaults=P,this.interceptors={request:new v,response:new v}}M.prototype.request=function(P){typeof P=="string"?(P=arguments[1]||{}).url=arguments[0]:P=P||{},(P=O(this.defaults,P)).method?P.method=P.method.toLowerCase():this.defaults.method?P.method=this.defaults.method.toLowerCase():P.method="get";var L=P.transitional;L!==void 0&&A.assertOptions(L,{silentJSONParsing:S.transitional(S.boolean,"1.0.0"),forcedJSONParsing:S.transitional(S.boolean,"1.0.0"),clarifyTimeoutError:S.transitional(S.boolean,"1.0.0")},!1);var V=[],N=!0;this.interceptors.request.forEach(function(ke){typeof ke.runWhen=="function"&&ke.runWhen(P)===!1||(N=N&&ke.synchronous,V.unshift(ke.fulfilled,ke.rejected))});var ee,J=[];if(this.interceptors.response.forEach(function(ke){J.push(ke.fulfilled,ke.rejected)}),!N){var K=[g,void 0];for(Array.prototype.unshift.apply(K,V),K=K.concat(J),ee=Promise.resolve(P);K.length;)ee=ee.then(K.shift(),K.shift());return ee}for(var re=P;V.length;){var ce=V.shift(),pe=V.shift();try{re=ce(re)}catch(ke){pe(ke);break}}try{ee=g(re)}catch(ke){return Promise.reject(ke)}for(;J.length;)ee=ee.then(J.shift(),J.shift());return ee},M.prototype.getUri=function(P){return P=O(this.defaults,P),h(P.url,P.params,P.paramsSerializer).replace(/^\?/,"")},s.forEach(["delete","get","head","options"],function(P){M.prototype[P]=function(L,V){return this.request(O(V||{},{method:P,url:L,data:(V||{}).data}))}}),s.forEach(["post","put","patch"],function(P){M.prototype[P]=function(L,V,N){return this.request(O(N||{},{method:P,url:L,data:V}))}}),a.exports=M},function(a,i,n){var s=n(36),h=n(195),v=n(279),g=n(189);function O(S){var M=new v(S),P=h(v.prototype.request,M);return s.extend(P,v.prototype,M),s.extend(P,M),P}var A=O(n(136));A.Axios=v,A.create=function(S){return O(g(A.defaults,S))},A.Cancel=n(188),A.CancelToken=n(265),A.isCancel=n(190),A.all=function(S){return Promise.all(S)},A.spread=n(264),A.isAxiosError=n(263),a.exports=A,a.exports.default=A},function(a,i,n){var s=function(h){var v,g=Object.prototype,O=g.hasOwnProperty,A=typeof Symbol=="function"?Symbol:{},S=A.iterator||"@@iterator",M=A.asyncIterator||"@@asyncIterator",P=A.toStringTag||"@@toStringTag";function L(yt,bt,Ht){return Object.defineProperty(yt,bt,{value:Ht,enumerable:!0,configurable:!0,writable:!0}),yt[bt]}try{L({},"")}catch{L=function(bt,Ht,_t){return bt[Ht]=_t}}function V(yt,bt,Ht,_t){var Ze=bt&&bt.prototype instanceof pe?bt:pe,Vt=Object.create(Ze.prototype),sn=new Ke(_t||[]);return Vt._invoke=function(yn,Yt,We){var Ye=ee;return function(He,dt){if(Ye===K)throw new Error("Generator is already running");if(Ye===re){if(He==="throw")throw dt;return vt()}for(We.method=He,We.arg=dt;;){var It=We.delegate;if(It){var ct=Ot(It,We);if(ct){if(ct===ce)continue;return ct}}if(We.method==="next")We.sent=We._sent=We.arg;else if(We.method==="throw"){if(Ye===ee)throw Ye=re,We.arg;We.dispatchException(We.arg)}else We.method==="return"&&We.abrupt("return",We.arg);Ye=K;var on=N(yn,Yt,We);if(on.type==="normal"){if(Ye=We.done?re:J,on.arg===ce)continue;return{value:on.arg,done:We.done}}on.type==="throw"&&(Ye=re,We.method="throw",We.arg=on.arg)}}}(yt,Ht,sn),Vt}function N(yt,bt,Ht){try{return{type:"normal",arg:yt.call(bt,Ht)}}catch(_t){return{type:"throw",arg:_t}}}h.wrap=V;var ee="suspendedStart",J="suspendedYield",K="executing",re="completed",ce={};function pe(){}function ke(){}function Ce(){}var be={};L(be,S,function(){return this});var $e=Object.getPrototypeOf,ht=$e&&$e($e(Tt([])));ht&&ht!==g&&O.call(ht,S)&&(be=ht);var Dt=Ce.prototype=pe.prototype=Object.create(be);function Ut(yt){["next","throw","return"].forEach(function(bt){L(yt,bt,function(Ht){return this._invoke(bt,Ht)})})}function Ee(yt,bt){var Ht;this._invoke=function(_t,Ze){function Vt(){return new bt(function(sn,yn){(function Yt(We,Ye,He,dt){var It=N(yt[We],yt,Ye);
vendor: 4,988 bytes, line 8341
8341if(It.type!=="throw"){var ct=It.arg,on=ct.value;return on&&typeof on=="object"&&O.call(on,"__await")?bt.resolve(on.__await).then(function(Xt){Yt("next",Xt,He,dt)},function(Xt){Yt("throw",Xt,He,dt)}):bt.resolve(on).then(function(Xt){ct.value=Xt,He(ct)},function(Xt){return Yt("throw",Xt,He,dt)})}dt(It.arg)})(_t,Ze,sn,yn)})}return Ht=Ht?Ht.then(Vt,Vt):Vt()}}function Ot(yt,bt){var Ht=yt.iterator[bt.method];if(Ht===v){if(bt.delegate=null,bt.method==="throw"){if(yt.iterator.return&&(bt.method="return",bt.arg=v,Ot(yt,bt),bt.method==="throw"))return ce;bt.method="throw",bt.arg=new TypeError("The iterator does not provide a 'throw' method")}return ce}var _t=N(Ht,yt.iterator,bt.arg);if(_t.type==="throw")return bt.method="throw",bt.arg=_t.arg,bt.delegate=null,ce;var Ze=_t.arg;return Ze?Ze.done?(bt[yt.resultName]=Ze.value,bt.next=yt.nextLoc,bt.method!=="return"&&(bt.method="next",bt.arg=v),bt.delegate=null,ce):Ze:(bt.method="throw",bt.arg=new TypeError("iterator result is not an object"),bt.delegate=null,ce)}function zt(yt){var bt={tryLoc:yt[0]};1 in yt&&(bt.catchLoc=yt[1]),2 in yt&&(bt.finallyLoc=yt[2],bt.afterLoc=yt[3]),this.tryEntries.push(bt)}function Mt(yt){var bt=yt.completion||{};bt.type="normal",delete bt.arg,yt.completion=bt}function Ke(yt){this.tryEntries=[{tryLoc:"root"}],yt.forEach(zt,this),this.reset(!0)}function Tt(yt){if(yt){var bt=yt[S];if(bt)return bt.call(yt);if(typeof yt.next=="function")return yt;if(!isNaN(yt.length)){var Ht=-1,_t=function Ze(){for(;++Ht<yt.length;)if(O.call(yt,Ht))return Ze.value=yt[Ht],Ze.done=!1,Ze;return Ze.value=v,Ze.done=!0,Ze};return _t.next=_t}}return{next:vt}}function vt(){return{value:v,done:!0}}return ke.prototype=Ce,L(Dt,"constructor",Ce),L(Ce,"constructor",ke),ke.displayName=L(Ce,P,"GeneratorFunction"),h.isGeneratorFunction=function(yt){var bt=typeof yt=="function"&&yt.constructor;return!!bt&&(bt===ke||(bt.displayName||bt.name)==="GeneratorFunction")},h.mark=function(yt){return Object.setPrototypeOf?Object.setPrototypeOf(yt,Ce):(yt.__proto__=Ce,L(yt,P,"GeneratorFunction")),yt.prototype=Object.create(Dt),yt},h.awrap=function(yt){return{__await:yt}},Ut(Ee.prototype),L(Ee.prototype,M,function(){return this}),h.AsyncIterator=Ee,h.async=function(yt,bt,Ht,_t,Ze){Ze===void 0&&(Ze=Promise);var Vt=new Ee(V(yt,bt,Ht,_t),Ze);return h.isGeneratorFunction(bt)?Vt:Vt.next().then(function(sn){return sn.done?sn.value:Vt.next()})},Ut(Dt),L(Dt,P,"Generator"),L(Dt,S,function(){return this}),L(Dt,"toString",function(){return"[object Generator]"}),h.keys=function(yt){var bt=[];for(var Ht in yt)bt.push(Ht);return bt.reverse(),function _t(){for(;bt.length;){var Ze=bt.pop();if(Ze in yt)return _t.value=Ze,_t.done=!1,_t}return _t.done=!0,_t}},h.values=Tt,Ke.prototype={constructor:Ke,reset:function(yt){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(Mt),!yt)for(var bt in this)bt.charAt(0)==="t"&&O.call(this,bt)&&!isNaN(+bt.slice(1))&&(this[bt]=v)},stop:function(){this.done=!0;var yt=this.tryEntries[0].completion;if(yt.type==="throw")throw yt.arg;return this.rval},dispatchException:function(yt){if(this.done)throw yt;var bt=this;function Ht(Yt,We){return Vt.type="throw",Vt.arg=yt,bt.next=Yt,We&&(bt.method="next",bt.arg=v),!!We}for(var _t=this.tryEntries.length-1;_t>=0;--_t){var Ze=this.tryEntries[_t],Vt=Ze.completion;if(Ze.tryLoc==="root")return Ht("end");if(Ze.tryLoc<=this.prev){var sn=O.call(Ze,"catchLoc"),yn=O.call(Ze,"finallyLoc");if(sn&&yn){if(this.prev<Ze.catchLoc)return Ht(Ze.catchLoc,!0);if(this.prev<Ze.finallyLoc)return Ht(Ze.finallyLoc)}else if(sn){if(this.prev<Ze.catchLoc)return Ht(Ze.catchLoc,!0)}else{if(!yn)throw new Error("try statement without catch or finally");if(this.prev<Ze.finallyLoc)return Ht(Ze.finallyLoc)}}}},abrupt:function(yt,bt){for(var Ht=this.tryEntries.length-1;Ht>=0;--Ht){var _t=this.tryEntries[Ht];if(_t.tryLoc<=this.prev&&O.call(_t,"finallyLoc")&&this.prev<_t.finallyLoc){var Ze=_t;break}}Ze&&(yt==="break"||yt==="continue")&&Ze.tryLoc<=bt&&bt<=Ze.finallyLoc&&(Ze=null);var Vt=Ze?Ze.completion:{};return Vt.type=yt,Vt.arg=bt,Ze?(this.method="next",this.next=Ze.finallyLoc,ce):this.complete(Vt)},complete:function(yt,bt){if(yt.type==="throw")throw yt.arg;return yt.type==="break"||yt.type==="continue"?this.next=yt.arg:yt.type==="return"?(this.rval=this.arg=yt.arg,this.method="return",this.next="end"):yt.type==="normal"&&bt&&(this.next=bt),ce},finish:function(yt){for(var bt=this.tryEntries.length-1;bt>=0;--bt){var Ht=this.tryEntries[bt];if(Ht.finallyLoc===yt)return this.complete(Ht.completion,Ht.afterLoc),Mt(Ht),ce}},catch:function(yt){for(var bt=this.tryEntries.length-1;bt>=0;--bt){var Ht=this.tryEntries[bt];if(Ht.tryLoc===yt){var _t=Ht.completion;if(_t.type==="throw"){var Ze=_t.arg;Mt(Ht)}return Ze}}throw new Error("illegal catch attempt")},delegateYield:function(yt,bt,Ht){return this.delegate={iterator:Tt(yt),resultName:bt,nextLoc:Ht},this.method==="next"&&(this.arg=v),ce}},h}
8341(a.exports);try{regeneratorRuntime=s}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=s:Function("r","regeneratorRuntime = r")(s)}},function(a,i,n){/** @license See the LICENSE file. */Object.defineProperty(i,"__esModule",{value:!0}),i.version="1.5.1"},function(a,i,n){/** 8342* @license 8343* Copyright 2018 Google LLC. All Rights Reserved. 8344* Licensed under the Apache License, Version 2.0 (the "License"); 8345* you may not use this file except in compliance with the License. 8346* You may obtain a copy of the License at 8347* 8348* http://www.apache.org/licenses/LICENSE-2.0 8349* 8350* Unless required by applicable law or agreed to in writing, software 8351* distributed under the License is distributed on an "AS IS" BASIS, 8352* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8353* See the License for the specific language governing permissions and 8354* limitations under the License. 8355* ============================================================================= 8356*/var s=this&&this.__awaiter||function(O,A,S,M){return new(S||(S=Promise))(function(P,L){function V(J){try{ee(M.next(J))}catch(K){L(K)}}function N(J){try{ee(M.throw(J))}catch(K){L(K)}}function ee(J){J.done?P(J.value):new S(function(K){K(J.value)}).then(V,N)}ee((M=M.apply(O,A||[])).next())})};Object.defineProperty(i,"__esModule",{value:!0});const h=n(137),v=n(46),g=n(110);i.valuesDistribution=function(O,A){return s(this,void 0,void 0,function*(){const S=v.getDrawArea(O),M=yield g.tensorStats(A),P=yield A.data();h.histogram(S,P,{height:150,stats:M})})}},function(a,i,n){/** 8357* @license 8358* Copyright 2018 Google LLC. All Rights Reserved. 8359* Licensed under the Apache License, Version 2.0 (the "License"); 8360* you may not use this file except in compliance with the License. 8361* You may obtain a copy of the License at 8362* 8363* http://www.apache.org/licenses/LICENSE-2.0 8364* 8365* Unless required by applicable law or agreed to in writing, software 8366* distributed under the License is distributed on an "AS IS" BASIS, 8367* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8368* See the License for the specific language governing permissions and 8369* limitations under the License. 8370* ============================================================================= 8371*/var s=this&&this.__awaiter||function(g,O,A,S){return new(A||(A=Promise))(function(M,P){function L(ee){try{N(S.next(ee))}catch(J){P(J)}}function V(ee){try{N(S.throw(ee))}catch(J){P(J)}}function N(ee){ee.done?M(ee.value):new A(function(J){J(ee.value)}).then(L,V)}N((S=S.apply(g,O||[])).next())})};Object.defineProperty(i,"__esModule",{value:!0});const h=n(46),v=n(109);i.perClassAccuracy=function(g,O,A){return s(this,void 0,void 0,function*(){const S=h.getDrawArea(g),M=[];for(let P=0;P<O.length;P++){const L=A?A[P]:P.toString(),V=O[P];M.push([L,V.accuracy,V.count])}return v.table(S,{headers:["Class","Accuracy","# Samples"],values:M})})}},function(a,i,n){/** 8372* @license 8373* Copyright 2018 Google LLC. All Rights Reserved. 8374* Licensed under the Apache License, Version 2.0 (the "License"); 8375* you may not use this file except in compliance with the License. 8376* You may obtain a copy of the License at 8377* 8378* http://www.apache.org/licenses/LICENSE-2.0 8379* 8380* Unless required by applicable law or agreed to in writing, software 8381* distributed under the License is distributed on an "AS IS" BASIS, 8382* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8383* See the License for the specific language governing permissions and 8384* limitations under the License. 8385* ============================================================================= 8386*/var s=this&&this.__awaiter||function(P,L,V,N){return new(V||(V=Promise))(function(ee,J){function K(pe){try{ce(N.next(pe))}catch(ke){J(ke)}}function re(pe){try{ce(N.throw(pe))}catch(ke){J(ke)}}function ce(pe){pe.done?ee(pe.value):new V(function(ke){ke(pe.value)}).then(K,re)}ce((N=N.apply(P,L||[])).next())})};Object.defineProperty(i,"__esModule",{value:!0});const h=n(137),v=n(46),g=n(109),O=n(64),A=n(110);function S(P){let L;return Array.isArray(P.outputShape[0])?L=`[${P.outputShape.map(V=>M(V)).join(", ")}]`:L=M(P.outputShape),{name:P.name,trainable:P.trainable,parameters:P.countParams(),outputShape:L}}function M(P){const L=P.slice();return L.length===0?"Scalar":(L[0]===null&&(L[0]="batch"),`[${L.join(",")}]`)}i.modelSummary=function(P,L){return s(this,void 0,void 0,function*(){const V=v.getDrawArea(P),N=function(ee){return{layers:ee.layers.map(S)}}(L).layers.map(ee=>[ee.name,ee.outputShape,ee.parameters,ee.trainable]);
8386g.table(V,{headers:["Layer Name","Output Shape","# Of Params","Trainable"],values:N})})},i.layer=function(P,L){return s(this,void 0,void 0,function*(){const V=v.getDrawArea(P),N=yield function(ce){return s(this,void 0,void 0,function*(){const pe=ce.getWeights(),ke=ce.weights,Ce=pe.map(A.tensorStats),be=yield Promise.all(Ce),$e=pe.map(ht=>ht.shape);return pe.map((ht,Dt)=>({name:ke[Dt].name,stats:be[Dt],shape:M($e[Dt]),weight:ht}))})}(L),ee=O.subSurface(V,"layer-weights-info"),J=N.map(ce=>[ce.name,ce.shape,ce.stats.min,ce.stats.max,ce.weight.size,ce.stats.numZeros,ce.stats.numNans,ce.stats.numInfs]);g.table(ee,{headers:["Weight Name","Shape","Min","Max","# Params","# Zeros","# NaNs","# Infinity"],values:J});const K=O.subSurface(V,"select-layer"),re=O.subSurface(V,"param-distribution");(function(ce,pe,ke){const Ce=`<div><button>Show Values Distribution for:</button>${` 8387 <select> 8388 ${ce.map(ht=>`<option value=${ht}>${ht}</option>`)} 8389 </select> 8390 `}</div>`;pe.innerHTML=Ce;const be=pe.querySelector("button"),$e=pe.querySelector("select");be.addEventListener("click",()=>{ke($e.selectedOptions[0].label)})})(N.map(ce=>ce.name),K,ce=>s(this,void 0,void 0,function*(){const pe=yield N.filter(ke=>ke.name===ce)[0].weight.data();h.histogram(re,pe,{height:150,width:460,stats:!1})}))})}},function(a,i,n){/** 8391* @license 8392* Copyright 2018 Google LLC. All Rights Reserved. 8393* Licensed under the Apache License, Version 2.0 (the "License"); 8394* you may not use this file except in compliance with the License. 8395* You may obtain a copy of the License at 8396* 8397* http://www.apache.org/licenses/LICENSE-2.0 8398* 8399* Unless required by applicable law or agreed to in writing, software 8400* distributed under the License is distributed on an "AS IS" BASIS, 8401* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8402* See the License for the specific language governing permissions and 8403* limitations under the License. 8404* ============================================================================= 8405*/var s=this&&this.__awaiter||function(P,L,V,N){return new(V||(V=Promise))(function(ee,J){function K(pe){try{ce(N.next(pe))}catch(ke){J(ke)}}function re(pe){try{ce(N.throw(pe))}catch(ke){J(ke)}}function ce(pe){pe.done?ee(pe.value):new V(function(ke){ke(pe.value)}).then(K,re)}ce((N=N.apply(P,L||[])).next())})};Object.defineProperty(i,"__esModule",{value:!0});const h=n(196),v=n(46),g=n(64);function O(P,L,V,N={}){return s(this,void 0,void 0,function*(){const ee=v.getDrawArea(P),J={};for(const pe of V)if(/val_/.test(pe)){const ke=pe.replace("val_","");A(J,ke);const Ce=S(L,pe,V.indexOf(pe));J[ke].series.push(pe),J[ke].values.push(Ce)}else{const ke=S(L,pe,V.indexOf(pe));A(J,pe),J[pe].series.push(pe),J[pe].values.push(ke)}const K=Object.keys(J),re=Object.assign({},{xLabel:"Iteration",yLabel:"Value"},N),ce=[];for(const pe of K){const ke=g.subSurface(ee,pe),Ce=J[pe].series,be=J[pe].values;Ce.every(ht=>!!ht.match("acc"))&&(re.zoomToFitAccuracy?re.zoomToFit=!0:(re.yAxisDomain=[0,1],delete re.zoomToFit));const $e=h.linechart(ke,{values:be,series:Ce},re);ce.push($e)}yield Promise.all(ce)})}function A(P,L){P[L]==null&&(P[L]={series:[],values:[]})}function S(P,L,V){if(Array.isArray(P)){const N=Array.isArray(P[0])?P[V]:P,ee=[];for(let J=0;J<N.length;J++){const K=N[J];ee.push({x:J,y:K[L]})}return ee}return P.history[L].map((N,ee)=>({x:ee,y:N}))}function M(P,L,V){return P[L]==null&&(P[L]={}),P[L][V]==null&&(P[L][V]=[]),P[L][V]}i.history=O,i.fitCallbacks=function(P,L,V={}){const N={},ee=V.callbacks||["onEpochEnd","onBatchEnd"],J=v.getDrawArea(P),K=Object.assign({},V);delete K.callbacks;const re={};return ee.forEach(ce=>{re[ce]=function(pe){return(ke,Ce)=>s(this,void 0,void 0,function*(){/batch/i.test(pe)?K.xLabel="Batch":/epoch/i.test(pe)&&(K.xLabel="Epoch");const be=[],$e=[];for(const ht of L)if(Ce[ht]!=null){$e.push(ht);const Dt=M(N,pe,ht);Dt.push({[ht]:Ce[ht]}),be.push(Dt)}O(g.subSurface(J,pe,{title:pe}),be,$e,K),yield v.nextFrame()})}(ce)}),re}},function(a,i,n){/** 8406* @license 8407* Copyright 2018 Google LLC. All Rights Reserved. 8408* Licensed under the Apache License, Version 2.0 (the "License");
8409* you may not use this file except in compliance with the License. 8410* You may obtain a copy of the License at 8411* 8412* http://www.apache.org/licenses/LICENSE-2.0 8413* 8414* Unless required by applicable law or agreed to in writing, software 8415* distributed under the License is distributed on an "AS IS" BASIS, 8416* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8417* See the License for the specific language governing permissions and 8418* limitations under the License. 8419* ============================================================================= 8420*/var s=this&&this.__awaiter||function(M,P,L,V){return new(L||(L=Promise))(function(N,ee){function J(ce){try{re(V.next(ce))}catch(pe){ee(pe)}}function K(ce){try{re(V.throw(ce))}catch(pe){ee(pe)}}function re(ce){ce.done?N(ce.value):new L(function(pe){pe(ce.value)}).then(J,K)}re((V=V.apply(M,P||[])).next())})},h=this&&this.__importDefault||function(M){return M&&M.__esModule?M:{default:M}};Object.defineProperty(i,"__esModule",{value:!0});const v=h(n(88)),g=n(64),O=n(111),A=n(46);i.scatterplot=function(M,P,L={}){return s(this,void 0,void 0,function*(){let V=P.values;const N=P.series==null?[]:P.series,ee=[];(V=Array.isArray(V[0])?V:[V]).forEach((ce,pe)=>{const ke=N[pe]!=null?N[pe]:`Series ${pe+1}`,Ce=ce.map(be=>Object.assign({},be,{series:ke}));ee.push(...Ce)}),L.seriesColors!=null&&O.assert(L.seriesColors.length===V.length,"Must have an equal number of series colors as there are data series");const J=A.getDrawArea(M),K=Object.assign({},S,L),re={width:K.width||g.getDefaultWidth(J),height:K.height||g.getDefaultHeight(J),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:K.fontSize,titleFontSize:K.fontSize},text:{fontSize:K.fontSize},legend:{labelFontSize:K.fontSize,titleFontSize:K.fontSize}},data:{values:ee},mark:{type:"point",clip:!0,tooltip:{content:"data"}},encoding:{x:{field:"x",type:K.xType,title:K.xLabel,scale:K.zoomToFit?{zero:!1}:K.xAxisDomain!=null?{domain:K.xAxisDomain}:void 0},y:{field:"y",type:K.yType,title:K.yLabel,scale:K.zoomToFit?{zero:!1}:K.yAxisDomain!=null?{domain:K.yAxisDomain}:void 0},color:{field:"series",type:"nominal",scale:{range:K.seriesColors}},shape:{field:"series",type:"nominal"}}};return yield v.default(J,re,{actions:!1,mode:"vega-lite",defaultStyle:!1}),Promise.resolve()})};const S={xLabel:"x",yLabel:"y",xType:"quantitative",yType:"quantitative",zoomToFit:!1,fontSize:11}},function(a,i,n){/** 8421* @license 8422* Copyright 2018 Google LLC. All Rights Reserved. 8423* Licensed under the Apache License, Version 2.0 (the "License"); 8424* you may not use this file except in compliance with the License. 8425* You may obtain a copy of the License at 8426* 8427* http://www.apache.org/licenses/LICENSE-2.0 8428* 8429* Unless required by applicable law or agreed to in writing, software 8430* distributed under the License is distributed on an "AS IS" BASIS, 8431* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8432* See the License for the specific language governing permissions and 8433* limitations under the License. 8434* ============================================================================= 8435*/var s=this&&this.__awaiter||function(V,N,ee,J){return new(ee||(ee=Promise))(function(K,re){function ce(Ce){try{ke(J.next(Ce))}catch(be){re(be)}}function pe(Ce){try{ke(J.throw(Ce))}catch(be){re(be)}}function ke(Ce){Ce.done?K(Ce.value):new ee(function(be){be(Ce.value)}).then(ce,pe)}ke((J=J.apply(V,N||[])).next())})},h=this&&this.__importStar||function(V){if(V&&V.__esModule)return V;var N={};if(V!=null)for(var ee in V)Object.hasOwnProperty.call(V,ee)&&(N[ee]=V[ee]);return N.default=V,N},v=this&&this.__importDefault||function(V){return V&&V.__esModule?V:{default:V}};Object.defineProperty(i,"__esModule",{value:!0});const g=h(n(0)),O=v(n(88)),A=n(64),S=n(111),M=n(46);function P(V,N,ee){const J=V instanceof g.Tensor?V.shape:[V.length,V[0].length];ee===0?S.assert(J[0]===N.length,`Length of xTickLabels (${N.length}) must match number of rows (${J[0]})`):ee===1&&S.assert(J[1]===N.length,`Length of yTickLabels (${N.length}) must match number of columns (${J[1]})`)}i.heatmap=function(V,N,ee={}){return s(this,void 0,void 0,function*(){const J=Object.assign({},L,ee),K=M.getDrawArea(V);let re=N.values;J.rowMajor&&(re=yield function(Dt){return s(this,void 0,void 0,function*(){let Ut,Ee;Dt instanceof g.Tensor?(Ut=Dt.shape,Ee=Dt.transpose()):(Ut=[Dt.length,Dt[0].length],Ee=g.tidy(()=>g.tensor2d(Dt).transpose())),S.assert(Ee.rank===2,"Input to renderHeatmap must be a 2d array or Tensor2d");const Ot=yield Ee.array();
8435Ee.dispose();const zt=[Ot.length,Ot[0].length];return S.assert(Ut[0]===zt[1]&&Ut[1]===zt[0],`Unexpected transposed shape. Original ${Ut} : Transposed ${zt}`),Ot})}(N.values));const{xTickLabels:ce,yTickLabels:pe}=N;ce!=null&&P(re,ce,0),pe!=null&&P(re,pe,1);const ke=[];if(re instanceof g.Tensor){S.assert(re.rank===2,"Input to renderHeatmap must be a 2d array or Tensor2d");const Dt=yield re.data(),[Ut,Ee]=re.shape;for(let Ot=0;Ot<Ut;Ot++){const zt=ce?`${ce[Ot]}@tfidx@${Ot}`:Ot;for(let Mt=0;Mt<Ee;Mt++){const Ke=pe?`${pe[Mt]}@tfidx@${Mt}`:Mt,Tt=Dt[Ot*Ee+Mt];ke.push({x:zt,y:Ke,value:Tt})}}}else{const Dt=re;for(let Ut=0;Ut<Dt.length;Ut++){const Ee=ce?`${ce[Ut]}@tfidx@${Ut}`:Ut;for(let Ot=0;Ot<Dt[Ut].length;Ot++){const zt=pe?`${pe[Ot]}@tfidx@${Ot}`:Ot,Mt=Dt[Ut][Ot];ke.push({x:Ee,y:zt,value:Mt})}}}const Ce={actions:!1,mode:"vega-lite",defaultStyle:!1},be={width:J.width||A.getDefaultWidth(K),height:J.height||A.getDefaultHeight(K),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:J.fontSize,titleFontSize:J.fontSize},text:{fontSize:J.fontSize},legend:{labelFontSize:J.fontSize,titleFontSize:J.fontSize},scale:{bandPaddingInner:0,bandPaddingOuter:0}},data:{values:ke},mark:{type:"rect",tooltip:!0},encoding:{x:{field:"x",type:J.xType,title:J.xLabel,sort:!1},y:{field:"y",type:J.yType,title:J.yLabel,sort:!1},fill:{field:"value",type:"quantitative"}}},$e=new RegExp("@tfidx@\\d+$");let ht;switch(ce&&(be.encoding.x.axis={labelExpr:"replace(datum.value, regexp(/@tfidx@\\d+$/), '')"}),pe&&(be.encoding.y.axis={labelExpr:"replace(datum.value, regexp(/@tfidx@\\d+$/), '')"}),(ce||pe)&&(Ce.tooltip={sanitize:Dt=>String(Dt).replace($e,"")}),J.colorMap){case"blues":ht=["#f7fbff","#4292c6"];break;case"greyscale":ht=["#000000","#ffffff"];break;case"viridis":default:ht="viridis"}if(ht!=="viridis"&&(be.encoding.fill.scale={range:ht}),J.domain){const Dt=be.encoding.fill;Dt.scale!=null?Dt.scale=Object.assign({},Dt.scale,{domain:J.domain}):Dt.scale={domain:J.domain}}yield O.default(K,be,Ce)})};const L={xLabel:null,yLabel:null,xType:"ordinal",yType:"ordinal",colorMap:"viridis",fontSize:12,domain:null,rowMajor:!1}},function(a,i,n){/** 8436* @license 8437* Copyright 2018 Google LLC. All Rights Reserved. 8438* Licensed under the Apache License, Version 2.0 (the "License"); 8439* you may not use this file except in compliance with the License. 8440* You may obtain a copy of the License at 8441* 8442* http://www.apache.org/licenses/LICENSE-2.0 8443* 8444* Unless required by applicable law or agreed to in writing, software 8445* distributed under the License is distributed on an "AS IS" BASIS, 8446* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8447* See the License for the specific language governing permissions and 8448* limitations under the License. 8449* ============================================================================= 8450*/var s=this&&this.__awaiter||function(S,M,P,L){return new(P||(P=Promise))(function(V,N){function ee(re){try{K(L.next(re))}catch(ce){N(ce)}}function J(re){try{K(L.throw(re))}catch(ce){N(ce)}}function K(re){re.done?V(re.value):new P(function(ce){ce(re.value)}).then(ee,J)}K((L=L.apply(S,M||[])).next())})},h=this&&this.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(i,"__esModule",{value:!0});const v=h(n(88)),g=n(64),O=n(46);i.confusionMatrix=function(S,M,P={}){return s(this,void 0,void 0,function*(){const L=Object.assign({},A,P),V=O.getDrawArea(S),N=[],ee=M.values,J=M.tickLabels||[],K=J.length===0;let re=!0;for(let ke=0;ke<ee.length;ke++){const Ce=K?`Class ${ke}`:J[ke];K&&J.push(Ce);for(let be=0;be<ee[ke].length;be++){const $e=K?`Class ${be}`:J[be],ht=ee[ke][be];ke!==be||L.shadeDiagonal?(N.push({label:Ce,prediction:$e,count:ht,scaleCount:ht}),ht!==0&&(re=!1)):N.push({label:Ce,prediction:$e,count:ht,noFill:!0})}}if(!L.shadeDiagonal&&re)for(const ke of N)ke.noFill===!0&&(ke.noFill=!1,ke.scaleCount=ke.count);const ce={width:L.width||g.getDefaultWidth(V),height:L.height||g.getDefaultHeight(V),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:L.fontSize,titleFontSize:L.fontSize},text:{fontSize:L.fontSize},legend:{labelFontSize:L.fontSize,titleFontSize:L.fontSize}},data:{values:N},encoding:{x:{field:"prediction",type:"ordinal",title:L.xLabel||"prediction",scale:{domain:J}},y:{field:"label",type:"ordinal",title:L.yLabel||"label",scale:{domain:J}}},layer:[{transform:[{filter:"datum.noFill != true"}],mark:{type:"rect"},encoding:{color:{field:"scaleCount",type:"quantitative",scale:{range:L.colorMap}},tooltip:[{field:"label",type:"nominal"},{field:"prediction",type:"nominal"},{field:"count",type:"quantitative"}]}}]};L.shadeDiagonal===!1&&ce.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"}]}}),L.showTextOverlay&&ce.layer.push({mark:{type:"text",baseline:"middle"},encoding:{text:{field:"count",type:"nominal"}}});const pe=typeof L.colorMap=="string"?{scheme:L.colorMap}:L.colorMap;ce.layer[0].encoding.color.scale.range=pe,yield v.default(V,ce,{actions:!1,mode:"vega-lite",defaultStyle:!1})})};const A={xLabel:null,yLabel:null,xType:"nominal",yType:"nominal",shadeDiagonal:!0,fontSize:12,showTextOverlay:!0,height:400,colorMap:["#f7fbff","#4292c6"]}},function(a,i,n){/** 8451* @license 8452* Copyright 2018 Google LLC. All Rights Reserved. 8453* Licensed under the Apache License, Version 2.0 (the "License");
8454* you may not use this file except in compliance with the License. 8455* You may obtain a copy of the License at 8456* 8457* http://www.apache.org/licenses/LICENSE-2.0 8458* 8459* Unless required by applicable law or agreed to in writing, software 8460* distributed under the License is distributed on an "AS IS" BASIS, 8461* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8462* See the License for the specific language governing permissions and 8463* limitations under the License. 8464* ============================================================================= 8465*/Object.defineProperty(i,"__esModule",{value:!0});const s=n(138),h=n(102);i.Tabs=class extends s.Component{render(){const{tabNames:g,activeTab:O,handleClick:A}=this.props,S=g.length>0?g.map(P=>s.h(v,{key:P,id:P,handleClick:A,isActive:P===O},P)):null,M=h.css({overflowX:"scroll",overflowY:"hidden",whiteSpace:"nowrap",borderBottomStyle:"solid",borderBottomWidth:"1px",borderColor:"#eee",paddingBottom:"1rem",marginTop:"1rem"});return s.h("div",{className:`${M} visor-tabs`},S)}};class v extends s.Component{render(){const{children:O,isActive:A,handleClick:S,id:M}=this.props,P=h.css({borderBottomColor:A?"#357EDD":"#AAAAAA",borderBottomWidth:"1px",borderBottomStyle:"solid",cursor:"pointer",":hover":{color:"#357EDD"},display:"inline-block",marginRight:"1rem",padding:".5rem",fontSize:"1rem",fontWeight:"bold"});return s.h("a",{className:`${P} tf-tab`,"data-isactive":A,onClick:()=>S(M)},O)}}},function(a,i,n){/** 8466* @license 8467* Copyright 2018 Google LLC. All Rights Reserved. 8468* Licensed under the Apache License, Version 2.0 (the "License"); 8469* you may not use this file except in compliance with the License. 8470* You may obtain a copy of the License at 8471* 8472* http://www.apache.org/licenses/LICENSE-2.0 8473* 8474* Unless required by applicable law or agreed to in writing, software 8475* distributed under the License is distributed on an "AS IS" BASIS, 8476* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8477* See the License for the specific language governing permissions and 8478* limitations under the License. 8479* ============================================================================= 8480*/Object.defineProperty(i,"__esModule",{value:!0});const s=n(138),h=n(102);class v extends s.Component{componentDidMount(){const{name:O,tab:A}=this.props;this.props.registerSurface(O,A,this)}componentDidUpdate(){return!1}render(){const{name:O,visible:A,styles:S}=this.props,M=Object.assign({},v.defaultStyles,S),{width:P,height:L}=M;let{maxHeight:V,maxWidth:N}=M;V=L===v.defaultStyles.height?V:L,N=P===v.defaultStyles.width?N:P;const ee=h.css({display:A?"block":"none",backgroundColor:"white",marginTop:"10px",marginBottom:"10px",boxShadow:"0 0 6px -3px #777",padding:"10px !important",height:L,width:P,maxHeight:V,maxWidth:N,overflow:"auto"}),J=h.css({backgroundColor:"white",boxSizing:"border-box",borderBottom:"1px solid #357EDD",lineHeight:"2em",marginBottom:"20px",fontWeight:"600",textAlign:"center"}),K=h.css({boxSizing:"border-box"});return s.h("div",{className:`${ee} tf-surface`,ref:re=>this.container=re,"data-visible":A},s.h("div",{className:`${J} tf-label`,ref:re=>this.label=re},O),s.h("div",{className:`${K} tf-draw-area`,ref:re=>this.drawArea=re}))}}v.defaultStyles={maxWidth:"550px",maxHeight:"580px",height:"auto",width:"auto"},i.SurfaceComponent=v},function(a,i,n){/** 8481* @license 8482* Copyright 2018 Google LLC. All Rights Reserved. 8483* Licensed under the Apache License, Version 2.0 (the "License"); 8484* you may not use this file except in compliance with the License. 8485* You may obtain a copy of the License at 8486* 8487* http://www.apache.org/licenses/LICENSE-2.0 8488* 8489* Unless required by applicable law or agreed to in writing, software 8490* distributed under the License is distributed on an "AS IS" BASIS, 8491* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8492* See the License for the specific language governing permissions and 8493* limitations under the License. 8494* ============================================================================= 8495*/Object.defineProperty(i,"__esModule",{value:!0});const s=n(138),h=n(102),v=n(291),g=n(290);class O extends s.Component{static render(M,P,L){return s.render(s.h(O,Object.assign({},L)),M,P)}constructor(M){super(M),this.surfaces=new Map;const P=M.startOpen==null||M.startOpen;this.state={isOpen:P,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(M,P){const L=this.surfaceId(M,P);let V;if(!this.surfaces.has(L))throw Error(`Surface not found with id: ${L}`);return{container:(V=this.surfaces.get(L)).container,label:V.label,drawArea:V.drawArea}}bindKeys(){document.addEventListener("keydown",this.keyHandler,!1)}unbindKeys(){document.removeEventListener("keydown",this.keyHandler)}surfaceId(M,P){return M+P}setTabs(M){const P=M.map(N=>N.tab),L=this.state.tabs;let V;for(const N of P)L.has(N)||(L.add(N),V=N);V!=null&&this.setState({tabs:L,activeTab:V}
8495)}getTabs(){return this.state.tabs}registerSurface(M,P,L){const V=this.surfaceId(M,P);this.surfaces.set(V,L)}keyHandler(M){M.keyCode===192&&(M.shiftKey?this.toggleFullScreen():this.toggle())}setActiveTab(M){this.setState({activeTab:M})}componentDidMount(){this.bindKeys()}componentWillMount(){this.setTabs(this.props.surfaceList)}componentWillReceiveProps(M){this.setTabs(M.surfaceList)}render(){const{isOpen:M,isFullscreen:P,activeTab:L}=this.state,{surfaceList:V}=this.props,N=Array.from(this.getTabs().values()),ee=P?"90vw":"550px",J=h.css({width:ee,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}),K=h.css({right:"0"}),re=h.css({right:`calc(-${ee} - 10px)`}),ce=M?K:re,pe=h.css({});return s.h("div",{className:`${J} ${ce} visor`,"data-isopen":M,"data-isfullscreen":P},s.h(A,{fullScreenHandler:this.toggleFullScreen.bind(this),closeHandler:this.close.bind(this),isFullScreen:P}),s.h(g.Tabs,{tabNames:N,activeTab:L,handleClick:this.setActiveTab.bind(this)}),s.h("div",{className:`${pe} visor-surfaces`},V.map(ke=>s.h(v.SurfaceComponent,{key:ke.name+ke.tab,name:ke.name,tab:ke.tab,styles:ke.styles,registerSurface:this.registerSurface.bind(this),visible:L===ke.tab}))))}}function A(S){const{isFullScreen:M,fullScreenHandler:P,closeHandler:L}=S,V=h.css({display:"flex",backgroundColor:"white",border:"1px solid white",padding:"6px",paddingTop:"10px",marginBottom:"10px",borderRadius:"6px",marginTop:"-16px"}),N=h.css({fontSize:".875rem",borderRadius:".25rem",paddingLeft:"1rem",paddingRight:"1rem",paddingTop:".5rem",paddingBottom:".5rem",textDecoration:"none",transition:"color .15s ease-in",color:"#111"}),ee=h.css({marginLeft:"auto"});return s.h("div",{className:`${V} visor-controls`},s.h("button",{className:`${N}`,onClick:P},M?"Minimize":"Maximize"),s.h("button",{className:`${N} ${ee}`,onClick:L},"Hide"))}i.VisorComponent=O},function(a,i,n){function s(g,O){return g.charCodeAt(O++)+(g.charCodeAt(O++)<<8)+(g.charCodeAt(O++)<<16)+(g.charCodeAt(O)<<24)}function h(g,O){return g.charCodeAt(O++)+(g.charCodeAt(O++)<<8)}function v(g,O){return(65535&(g|=0))*(O|=0)+(((g>>>16)*O&65535)<<16)|0}Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(g,O){for(var A=1540483477,S=O^g.length,M=g.length,P=0;M>=4;){var L=s(g,P);L=v(L,A),L=v(L^=L>>>24,A),S=v(S,A),S^=L,P+=4,M-=4}switch(M){case 3:S^=h(g,P),S=v(S^=g.charCodeAt(P+2)<<16,A);break;case 2:S=v(S^=h(g,P),A);break;case 1:S=v(S^=g.charCodeAt(P),A)}return S=v(S^=S>>>13,A),(S^=S>>>15)>>>0}},function(a,i,n){n.r(i);var s=/[A-Z]/g,h=/^ms-/,v={};function g(O){return"-"+O.toLowerCase()}i.default=function(O){if(v.hasOwnProperty(O))return v[O];var A=O.replace(s,g);return v[O]=h.test(A)?"-"+A:A}},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(h){return(0,s.default)(h)};var s=function(h){return h&&h.__esModule?h:{default:h}}(n(294));a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(S,M,P,L){if(typeof M=="string"&&O.hasOwnProperty(S)){var V=function(J,K){if((0,h.default)(J))return J;for(var re=J.split(/,(?![^()]*(?:\([^()]*\))?\))/g),ce=0,pe=re.length;ce<pe;++ce){var ke=re[ce],Ce=[ke];for(var be in K){var $e=(0,s.default)(be);if(ke.indexOf($e)>-1&&$e!=="order")for(var ht=K[be],Dt=0,Ut=ht.length;Dt<Ut;++Dt)Ce.unshift(ke.replace($e,A[ht[Dt]]+$e))}re[ce]=Ce.join(",")}return re.join(",")}(M,L),N=V.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(J){return!/-moz-|-ms-/.test(J)}).join(",");if(S.indexOf("Webkit")>-1)return N;var ee=V.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(J){return!/-webkit-|-ms-/.test(J)}).join(",");return S.indexOf("Moz")>-1?ee:(P["Webkit"+(0,v.default)(S)]=N,P["Moz"+(0,v.default)(S)]=ee,V)}};var s=g(n(295)),h=g(n(101)),v=g(n(199));function g(S){return S&&S.__esModule?S:{default:S}}var O={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},A={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(g,O){if(h.hasOwnProperty(g)&&v.hasOwnProperty(O))return s.map(function(A){return A+O})};var s=["-webkit-","-moz-",""],h={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},v={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(s,h){if(s==="position"&&h==="sticky")return["-webkit-sticky","sticky"]},a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(v,g){if(typeof g=="string"&&!(0,s.default)(g)&&g.indexOf("image-set(")>-1)return h.map(function(O){return g.replace(/image-set\(/g,O+"image-set(")})};
8495var s=function(v){return v&&v.__esModule?v:{default:v}}(n(101)),h=["-webkit-",""];a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(g,O){if(typeof O=="string"&&!(0,s.default)(O)&&v.test(O))return h.map(function(A){return A+O})};var s=function(g){return g&&g.__esModule?g:{default:g}}(n(101)),h=["-webkit-","-moz-",""],v=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(v,g,O){v==="flexDirection"&&typeof g=="string"&&(g.indexOf("column")>-1?O.WebkitBoxOrient="vertical":O.WebkitBoxOrient="horizontal",g.indexOf("reverse")>-1?O.WebkitBoxDirection="reverse":O.WebkitBoxDirection="normal"),h.hasOwnProperty(v)&&(O[h[v]]=s[g]||g)};var s={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},h={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"};a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(h,v){if(h==="display"&&s.hasOwnProperty(v))return s[v]};var s={flex:["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex","flex"],"inline-flex":["-webkit-inline-box","-moz-inline-box","-ms-inline-flexbox","-webkit-inline-flex","inline-flex"]};a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(v,g){if(typeof g=="string"&&!(0,s.default)(g)&&g.indexOf("filter(")>-1)return h.map(function(O){return g.replace(/filter\(/g,O+"filter(")})};var s=function(v){return v&&v.__esModule?v:{default:v}}(n(101)),h=["-webkit-",""];a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(v,g){if(typeof g=="string"&&!(0,s.default)(g)&&g.indexOf("cross-fade(")>-1)return h.map(function(O){return g.replace(/cross-fade\(/g,O+"cross-fade(")})};var s=function(v){return v&&v.__esModule?v:{default:v}}(n(101)),h=["-webkit-",""];a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(v,g){if(v==="cursor"&&h.hasOwnProperty(g))return s.map(function(O){return O+g})};var s=["-webkit-","-moz-",""],h={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(s,h,v,g,O){for(var A=0,S=s.length;A<S;++A){var M=s[A](h,v,g,O);if(M)return M}},a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(h,v,g){if(h.hasOwnProperty(v))for(var O=h[v],A=0,S=O.length;A<S;++A)g[O[A]+(0,s.default)(v)]=g[v]};var s=function(h){return h&&h.__esModule?h:{default:h}}(n(199));a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=["Webkit"],h=["Moz"],v=["ms"],g=["Webkit","Moz"],O=["Webkit","ms"],A=["Webkit","Moz","ms"];i.default={plugins:[],prefixMap:{appearance:g,userSelect:A,textEmphasisPosition:s,textEmphasis:s,textEmphasisStyle:s,textEmphasisColor:s,boxDecorationBreak:s,clipPath:s,maskImage:s,maskMode:s,maskRepeat:s,maskPosition:s,maskClip:s,maskOrigin:s,maskSize:s,maskComposite:s,mask:s,maskBorderSource:s,maskBorderMode:s,maskBorderSlice:s,maskBorderWidth:s,maskBorderOutset:s,maskBorderRepeat:s,maskBorder:s,maskType:s,textDecorationStyle:s,textDecorationSkip:s,textDecorationLine:s,textDecorationColor:s,filter:s,fontFeatureSettings:s,breakAfter:A,breakBefore:A,breakInside:A,columnCount:g,columnFill:g,columnGap:g,columnRule:g,columnRuleColor:g,columnRuleStyle:g,columnRuleWidth:g,columns:g,columnSpan:g,columnWidth:g,writingMode:O,flex:s,flexBasis:s,flexDirection:s,flexGrow:s,flexFlow:s,flexShrink:s,flexWrap:s,alignContent:s,alignItems:s,alignSelf:s,justifyContent:s,order:s,transform:s,transformOrigin:s,transformOriginX:s,transformOriginY:s,backfaceVisibility:s,perspective:s,perspectiveOrigin:s,transformStyle:s,transformOriginZ:s,animation:s,animationDelay:s,animationDirection:s,animationFillMode:s,animationDuration:s,animationIterationCount:s,animationName:s,animationPlayState:s,animationTimingFunction:s,backdropFilter:s,fontKerning:s,scrollSnapType:O,scrollSnapPointsX:O,scrollSnapPointsY:O,scrollSnapDestination:O,scrollSnapCoordinate:O,shapeImageThreshold:s,shapeImageMargin:s,shapeImageOutside:s,hyphens:A,flowInto:O,flowFrom:O,regionFragment:O,textAlignLast:h,tabSize:h,wrapFlow:v,wrapThrough:v,wrapMargin:v,gridTemplateColumns:v,gridTemplateRows:v,gridTemplateAreas:v,gridTemplate:v,gridAutoColumns:v,gridAutoRows:v,gridAutoFlow:v,grid:v,gridRowStart:v,gridColumnStart:v,gridRowEnd:v,gridRow:v,gridColumn:v,gridColumnEnd:v,gridColumnGap:v,gridRowGap:v,gridArea:v,gridGap:v,textSizeAdjust:O,borderImage:s,borderImageOutset:s,borderImageRepeat:s,borderImageSlice:s,borderImageSource:s,borderImageWidth:s,transitionDelay:s,transitionDuration:s,transitionProperty:s,transitionTimingFunction:s}},a.exports=i.default},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(ce){for(var pe in ce){var ke=ce[pe],Ce=(0,v.default)(K,pe,ke,ce,re);Ce&&(ce[pe]=Ce),(0,h.default)(re,pe,ce)}return ce};var s=J(n(308)),h=J(n(307)),v=J(n(306)),g=J(n(305)),O=J(n(304)),A=J(n(303)),S=J(n(302)),M=J(n(301)),P=J(n(300)),L=J(n(299)),V=J(n(298)),N=J(n(297)),ee=J(n(296));function J(ce){return ce&&ce.__esModule?ce:{default:ce}}var K=[O.default,g.default,A.default,M.default,P.default,L.default,V.default,N.default,ee.default,S.default],re=s.default.prefixMap},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=Object.assign||function(M){for(var P=1;P<arguments.length;P++){var L=arguments[P];for(var V in L)Object.prototype.hasOwnProperty.call(L,V)&&(M[V]=L[V])}return M};i.PluginSet=A,i.fallbacks=function(M){if(Object.keys(M.style).map(function(V){return Array.isArray(M.style[V])}).indexOf(!0)>=0){var P=M.style,L=Object.keys(P).reduce(function(V,N){return V[N]=Array.isArray(P[N])?P[N].join("; "+(0,v.processStyleName)(N)+": "):P[N],V},{});return(0,h.default)({},M,{style:L})}return M},i.contentWrap=function(M){if(M.style.content){var P=M.style.content;return S.indexOf(P)>=0||/^(attr|calc|counters?|url)\(/.test(P)?M:P.charAt(0)!==P.charAt(P.length-1)||P.charAt(0)!=='"'&&P.charAt(0)!=="'"?s({},M,{style:s({},M.style,{content:'"'+P+'"'})}):M}return M},i.prefixes=function(M){return(0,h.default)({},M,{style:(0,g.default)(s({},M.style))})};var h=O(n(139)),v=n(201),g=O(n(309));function O(M){return M&&M.__esModule?M:{default:M}}function A(M){this.fns=M||[]}(0,h.default)(A.prototype,{add:function(){for(var M=this,P=arguments.length,L=Array(P),V=0;V<P;V++)L[V]=arguments[V];
8495L.forEach(function(N){M.fns.indexOf(N)>=0||(M.fns=[N].concat(M.fns))})},remove:function(M){this.fns=this.fns.filter(function(P){return P!==M})},clear:function(){this.fns=[]},transform:function(M){return this.fns.reduce(function(P,L){return L(P)},M)}});var S=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit"]},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(g){return typeof g}:function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g};function h(g){if(function(V){return V==null||V===!1||(V===void 0?"undefined":s(V))==="object"&&Object.keys(V).length===0}(g))return null;if((g===void 0?"undefined":s(g))!=="object")return g;for(var O={},A=Object.keys(g),S=!1,M=0;M<A.length;M++){var P=g[A[M]],L=v(P);L!==null&&L===P||(S=!0),L!==null&&(O[A[M]]=L)}return Object.keys(O).length===0?null:S?O:g}function v(g){return Array.isArray(g)?function(O){var A=!1,S=[];return O.forEach(function(M){var P=v(M);P!==null&&P===M||(A=!0),P!==null&&S.push(P)}),S.length==0?null:A?S:O}(g):h(g)}i.default=v},function(a,i,n){a.exports=function(s){var h={};return function(v){return h.hasOwnProperty(v)||(h[v]=s.call(this,v)),h[v]}}},function(a,i,n){var s=/([A-Z])/g;a.exports=function(h){return h.replace(s,"-$1").toLowerCase()}},function(a,i,n){var s=n(313),h=/^ms-/;a.exports=function(v){return s(v).replace(h,"-ms-")}},function(a,i,n){function s(v){return function(){return v}}var h=function(){};h.thatReturns=s,h.thatReturnsFalse=s(!1),h.thatReturnsTrue=s(!0),h.thatReturnsNull=s(null),h.thatReturnsThis=function(){return this},h.thatReturnsArgument=function(v){return v},a.exports=h},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowStart:!0,gridRowEnd:!0,gridColumn:!0,gridColumnStart:!0,gridColumnEnd:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},h=["Webkit","ms","Moz","O"];Object.keys(s).forEach(function(g){h.forEach(function(O){s[function(A,S){return A+S.charAt(0).toUpperCase()+S.substring(1)}(O,g)]=s[g]})});var v={isUnitlessNumber:s,shorthandPropertyExpansions:{background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}}};i.default=v},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=h(n(316));h(n(200));function h(g){return g&&g.__esModule?g:{default:g}}var v=s.default.isUnitlessNumber;i.default=function(g,O,A){return O==null||typeof O=="boolean"||O===""?"":isNaN(O)||O===0||v.hasOwnProperty(g)&&v[g]?""+O:(typeof O=="string"&&(O=O.trim()),O+"px")}},function(a,i,n){var s=/-(.)/g;a.exports=function(h){return h.replace(s,function(v,g){return g.toUpperCase()})}},function(a,i,n){var s=n(318),h=/^-ms-/;a.exports=function(v){return s(v.replace(h,"ms-"))}},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.StyleSheet=M;var s=function(P){return P&&P.__esModule?P:{default:P}}(n(139));function h(P){return P[P.length-1]}function v(P){if(P.sheet)return P.sheet;for(var L=0;L<document.styleSheets.length;L++)if(document.styleSheets[L].ownerNode===P)return document.styleSheets[L]}var g=typeof window<"u",O=!1,A=function(){if(g){var P=document.createElement("div");return P.innerHTML="<!--[if lt IE 10]><i></i><![endif]-->",P.getElementsByTagName("i").length===1}}();function S(){var P=document.createElement("style");return P.type="text/css",P.setAttribute("data-glamor",""),P.appendChild(document.createTextNode("")),(document.head||document.getElementsByTagName("head")[0]).appendChild(P),P}function M(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},L=P.speedy,V=L===void 0?!O:L,N=P.maxLength,ee=N===void 0?g&&A?4e3:65e3:N;this.isSpeedy=V,this.sheet=void 0,this.tags=[],this.maxLength=ee,this.ctr=0}(0,s.default)(M.prototype,{getSheet:function(){return v(h(this.tags))},inject:function(){var P=this;if(this.injected)throw new Error("already injected stylesheet!");g?this.tags[0]=S():this.sheet={cssRules:[],insertRule:function(L){P.sheet.cssRules.push({cssText:L})}},this.injected=!0},speedy:function(P){if(this.ctr!==0)throw new Error("cannot change speedy mode after inserting any rule to sheet. Either call speedy("+P+") earlier in your app, or call flush() before speedy("+P+")");this.isSpeedy=!!P},_insert:function(P){try{var L=this.getSheet();L.insertRule(P,P.indexOf("@import")!==-1?0:L.cssRules.length)}catch{}}
8495,insert:function(P){if(g)if(this.isSpeedy&&this.getSheet().insertRule)this._insert(P);else if(P.indexOf("@import")!==-1){var L=h(this.tags);L.insertBefore(document.createTextNode(P),L.firstChild)}else h(this.tags).appendChild(document.createTextNode(P));else this.sheet.insertRule(P,P.indexOf("@import")!==-1?0:this.sheet.cssRules.length);return this.ctr++,g&&this.ctr%this.maxLength==0&&this.tags.push(S()),this.ctr-1},delete:function(P){return this.replace(P,"")},flush:function(){g?(this.tags.forEach(function(P){return P.parentNode.removeChild(P)}),this.tags=[],this.sheet=null,this.ctr=0):this.sheet.cssRules=[],this.injected=!1},rules:function(){if(!g)return this.sheet.cssRules;var P=[];return this.tags.forEach(function(L){return P.splice.apply(P,[P.length,0].concat(function(V){if(Array.isArray(V)){for(var N=0,ee=Array(V.length);N<V.length;N++)ee[N]=V[N];return ee}return Array.from(V)}(Array.from(v(L).cssRules))))}),P}})},function(a,i,n){n.r(i),n.d(i,"default",function(){return A});var s=n(null),h=n(87),v=n(null),g=n(null),O=n(null);function A(){var S=[],M=g.c;function P(L){if(L!=null&&!isNaN(L=+L))return M((Object(s.c)(S,L,1)-1)/(S.length-1))}return P.domain=function(L){if(!arguments.length)return S.slice();S=[];for(let V of L)V==null||isNaN(V=+V)||S.push(V);return S.sort(h.a),P},P.interpolator=function(L){return arguments.length?(M=L,P):M},P.range=function(){return S.map((L,V)=>M(V/(S.length-1)))},P.quantiles=function(L){return Array.from({length:L+1},(V,N)=>Object(v.b)(S,N/L))},P.copy=function(){return A(M).domain(S)},O.b.apply(P,arguments)}},function(a,i,n){n.r(i),n.d(i,"default",function(){return A});var s=n(null),h=n(null),v=n(null),g=n(null);function O(S){return Math.sign(S)*S*S}function A(){var S,M=Object(s.a)(),P=[0,1],L=!1;function V(N){var ee=function(J){return Math.sign(J)*Math.sqrt(Math.abs(J))}(M(N));return isNaN(ee)?S:L?Math.round(ee):ee}return V.invert=function(N){return M.invert(O(N))},V.domain=function(N){return arguments.length?(M.domain(N),V):M.domain()},V.range=function(N){return arguments.length?(M.range((P=Array.from(N,g.a)).map(O)),V):P.slice()},V.rangeRound=function(N){return V.range(N).round(!0)},V.round=function(N){return arguments.length?(L=!!N,V):L},V.clamp=function(N){return arguments.length?(M.clamp(N),V):M.clamp()},V.unknown=function(N){return arguments.length?(S=N,V):S},V.copy=function(){return A(M.domain(),P).round(L).clamp(M.clamp()).unknown(S)},h.a.apply(V,arguments),Object(v.b)(V)}},function(a,i,n){const s=n(47),h=n(113),{ANY:v}=h,g=n(112),O=n(48),A=(P,L,V)=>{if(P===L)return!0;if(P.length===1&&P[0].semver===v){if(L.length===1&&L[0].semver===v)return!0;P=V.includePrerelease?[new h(">=0.0.0-0")]:[new h(">=0.0.0")]}if(L.length===1&&L[0].semver===v){if(V.includePrerelease)return!0;L=[new h(">=0.0.0")]}const N=new Set;let ee,J,K,re,ce,pe,ke;for(const $e of P)$e.operator===">"||$e.operator===">="?ee=S(ee,$e,V):$e.operator==="<"||$e.operator==="<="?J=M(J,$e,V):N.add($e.semver);if(N.size>1||ee&&J&&((K=O(ee.semver,J.semver,V))>0||K===0&&(ee.operator!==">="||J.operator!=="<=")))return null;for(const $e of N){if(ee&&!g($e,String(ee),V)||J&&!g($e,String(J),V))return null;for(const ht of L)if(!g($e,String(ht),V))return!1;return!0}let Ce=!(!J||V.includePrerelease||!J.semver.prerelease.length)&&J.semver,be=!(!ee||V.includePrerelease||!ee.semver.prerelease.length)&&ee.semver;Ce&&Ce.prerelease.length===1&&J.operator==="<"&&Ce.prerelease[0]===0&&(Ce=!1);for(const $e of L){if(ke=ke||$e.operator===">"||$e.operator===">=",pe=pe||$e.operator==="<"||$e.operator==="<=",ee){if(be&&$e.semver.prerelease&&$e.semver.prerelease.length&&$e.semver.major===be.major&&$e.semver.minor===be.minor&&$e.semver.patch===be.patch&&(be=!1),$e.operator===">"||$e.operator===">="){if((re=S(ee,$e,V))===$e&&re!==ee)return!1}else if(ee.operator===">="&&!g(ee.semver,String($e),V))return!1}if(J){if(Ce&&$e.semver.prerelease&&$e.semver.prerelease.length&&$e.semver.major===Ce.major&&$e.semver.minor===Ce.minor&&$e.semver.patch===Ce.patch&&(Ce=!1),$e.operator==="<"||$e.operator==="<="){if((ce=M(J,$e,V))===$e&&ce!==J)return!1}else if(J.operator==="<="&&!g(J.semver,String($e),V))return!1}if(!$e.operator&&(J||ee)&&K!==0)return!1}return!(ee&&pe&&!J&&K!==0)&&!(J&&ke&&!ee&&K!==0)&&!be&&!Ce},S=(P,L,V)=>{if(!P)return L;const N=O(P.semver,L.semver,V);return N>0?P:N<0||L.operator===">"&&P.operator===">="?L:P},M=(P,L,V)=>{if(!P)return L;const N=O(P.semver,L.semver,V);return N<0?P:N>0||L.operator==="<"&&P.operator==="<="?L:P};a.exports=(P,L,V={})=>
8495{if(P===L)return!0;P=new s(P,V),L=new s(L,V);let N=!1;e:for(const ee of P.set){for(const J of L.set){const K=A(ee,J,V);if(N=N||K!==null,K)continue e}if(N)return!1}return!0}},function(a,i,n){const s=n(112),h=n(48);a.exports=(v,g,O)=>{const A=[];let S=null,M=null;const P=v.sort((ee,J)=>h(ee,J,O));for(const ee of P)s(ee,g,O)?(M=ee,S||(S=ee)):(M&&A.push([S,M]),M=null,S=null);S&&A.push([S,null]);const L=[];for(const[ee,J]of A)ee===J?L.push(ee):J||ee!==P[0]?J?ee===P[0]?L.push(`<=${J}`):L.push(`${ee} - ${J}`):L.push(`>=${ee}`):L.push("*");const V=L.join(" || "),N=typeof g.raw=="string"?g.raw:String(g);return V.length<N.length?V:g}},function(a,i,n){const s=n(47);a.exports=(h,v,g)=>(h=new s(h,g),v=new s(v,g),h.intersects(v))},function(a,i,n){const s=n(140);a.exports=(h,v,g)=>s(h,v,"<",g)},function(a,i,n){const s=n(140);a.exports=(h,v,g)=>s(h,v,">",g)},function(a,i,n){const s=n(47);a.exports=(h,v)=>{try{return new s(h,v).range||"*"}catch{return null}}},function(a,i,n){const s=n(32),h=n(47),v=n(114);a.exports=(g,O)=>{g=new h(g,O);let A=new s("0.0.0");if(g.test(A)||(A=new s("0.0.0-0"),g.test(A)))return A;A=null;for(let S=0;S<g.set.length;++S){let M=null;g.set[S].forEach(P=>{const L=new s(P.semver.version);switch(P.operator){case">":L.prerelease.length===0?L.patch++:L.prerelease.push(0),L.raw=L.format();case"":case">=":M&&!v(L,M)||(M=L);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${P.operator}`)}}),!M||A&&!v(A,M)||(A=M)}return A&&g.test(A)?A:null}},function(a,i,n){const s=n(32),h=n(47);a.exports=(v,g,O)=>{let A=null,S=null,M=null;try{M=new h(g,O)}catch{return null}return v.forEach(P=>{M.test(P)&&(A&&S.compare(P)!==1||(S=new s(A=P,O)))}),A}},function(a,i,n){const s=n(32),h=n(47);a.exports=(v,g,O)=>{let A=null,S=null,M=null;try{M=new h(g,O)}catch{return null}return v.forEach(P=>{M.test(P)&&(A&&S.compare(P)!==-1||(S=new s(A=P,O)))}),A}},function(a,i,n){const s=n(47);a.exports=(h,v)=>new s(h,v).set.map(g=>g.map(O=>O.value).join(" ").trim().split(" "))},function(a,i,n){a.exports=function(s){s.prototype[Symbol.iterator]=function*(){for(let h=this.head;h;h=h.next)yield h.value}}},function(a,i,n){function s(A){var S=this;if(S instanceof s||(S=new s),S.tail=null,S.head=null,S.length=0,A&&typeof A.forEach=="function")A.forEach(function(L){S.push(L)});else if(arguments.length>0)for(var M=0,P=arguments.length;M<P;M++)S.push(arguments[M]);return S}function h(A,S,M){var P=S===A.head?new O(M,null,S,A):new O(M,S,S.next,A);return P.next===null&&(A.tail=P),P.prev===null&&(A.head=P),A.length++,P}function v(A,S){A.tail=new O(S,A.tail,null,A),A.head||(A.head=A.tail),A.length++}function g(A,S){A.head=new O(S,null,A.head,A),A.tail||(A.tail=A.head),A.length++}function O(A,S,M,P){if(!(this instanceof O))return new O(A,S,M,P);this.list=P,this.value=A,S?(S.next=this,this.prev=S):this.prev=null,M?(M.prev=this,this.next=M):this.next=null}a.exports=s,s.Node=O,s.create=s,s.prototype.removeNode=function(A){if(A.list!==this)throw new Error("removing node which does not belong to this list");var S=A.next,M=A.prev;return S&&(S.prev=M),M&&(M.next=S),A===this.head&&(this.head=S),A===this.tail&&(this.tail=M),A.list.length--,A.next=null,A.prev=null,A.list=null,S},s.prototype.unshiftNode=function(A){if(A!==this.head){A.list&&A.list.removeNode(A);var S=this.head;A.list=this,A.next=S,S&&(S.prev=A),this.head=A,this.tail||(this.tail=A),this.length++}},s.prototype.pushNode=function(A){if(A!==this.tail){A.list&&A.list.removeNode(A);var S=this.tail;A.list=this,A.prev=S,S&&(S.next=A),this.tail=A,this.head||(this.head=A),this.length++}},s.prototype.push=function(){for(var A=0,S=arguments.length;A<S;A++)v(this,arguments[A]);return this.length},s.prototype.unshift=function(){for(var A=0,S=arguments.length;A<S;A++)g(this,arguments[A]);return this.length},s.prototype.pop=function(){if(this.tail){var A=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,A}},s.prototype.shift=function(){if(this.head){var A=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,A}},s.prototype.forEach=function(A,S){S=S||this;for(var M=this.head,P=0;M!==null;P++)A.call(S,M.value,P,this),M=M.next},s.prototype.forEachReverse=function(A,S){S=S||this;for(var M=this.tail,P=this.length-1;M!==null;P--)A.call(S,M.value,P,this),M=M.prev},s.prototype.get=function(A){for(var S=0,M=this.head;M!==null&&S<A;S++)M=M.next;if(S===A&&M!==null)return M.value},s.prototype.getReverse=function(A){for(var S=0,M=this.tail;M!==null&&S<A;S++)M=M.prev;if(S===A&&M!==null)return M.value},s.prototype.map=function(A,S){S=S||this;for(var M=new s,P=this.head;P!==null;)M.push(A.call(S,P.value,this)),P=P.next;return M},s.prototype.mapReverse=function(A,S){S=S||this;for(var M=new s,P=this.tail;P!==null;)M.push(A.call(S,P.value,this)),P=P.prev;return M},s.prototype.reduce=function(A,S){var M,P=this.head;if(arguments.length>1)M=S;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");P=this.head.next,M=this.head.value}for(var L=0;P!==null;L++)M=A(M,P.value,L),P=P.next;return M},s.prototype.reduceReverse=function(A,S){var M,P=this.tail;if(arguments.length>1)M=S;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");P=this.tail.prev,M=this.tail.value}for(var L=this.length-1;P!==null;L--)M=A(M,P.value,L),P=P.prev;return M},s.prototype.toArray=function(){for(var A=new Array(this.length),S=0,M=this.head;M!==null;S++)A[S]=M.value,M=M.next;return A},s.prototype.toArrayReverse=function(){for(var A=new Array(this.length),S=0,M=this.tail;M!==null;S++)A[S]=M.value,M=M.prev;return A},s.prototype.slice=function(A,S){(S=S||this.length)<0&&(S+=this.length),(A=A||0)<0&&(A+=this.length);var M=new s;if(S<A||S<0)return M;A<0&&(A=0),S>this.length&&(S=this.length);for(var P=0,L=this.head;L!==null&&P<A;P++)L=L.next;for(;L!==null&&P<S;P++,L=L.next)M.push(L.value);return M},s.prototype.sliceReverse=function(A,S){(S=S||this.length)<0&&(S+=this.length),(A=A||0)<0&&(A+=this.length);var M=new s;if(S<A||S<0)return M;A<0&&(A=0),S>this.length&&(S=this.length);for(var P=this.length,L=this.tail;L!==null&&P>S;P--)L=L.prev;
vendor: 4,275 bytes, line 8495
8495for(;L!==null&&P>A;P--,L=L.prev)M.push(L.value);return M},s.prototype.splice=function(A,S,...M){A>this.length&&(A=this.length-1),A<0&&(A=this.length+A);for(var P=0,L=this.head;L!==null&&P<A;P++)L=L.next;var V=[];for(P=0;L&&P<S;P++)V.push(L.value),L=this.removeNode(L);for(L===null&&(L=this.tail),L!==this.head&&L!==this.tail&&(L=L.prev),P=0;P<M.length;P++)L=h(this,L,M[P]);return V},s.prototype.reverse=function(){for(var A=this.head,S=this.tail,M=A;M!==null;M=M.prev){var P=M.prev;M.prev=M.next,M.next=P}return this.head=S,this.tail=A,this};try{n(333)(s)}catch{}},function(a,i,n){const s=n(334),h=Symbol("max"),v=Symbol("length"),g=Symbol("lengthCalculator"),O=Symbol("allowStale"),A=Symbol("maxAge"),S=Symbol("dispose"),M=Symbol("noDisposeOnSet"),P=Symbol("lruList"),L=Symbol("cache"),V=Symbol("updateAgeOnGet"),N=()=>1,ee=(ke,Ce,be)=>{const $e=ke[L].get(Ce);if($e){const ht=$e.value;if(J(ke,ht)){if(re(ke,$e),!ke[O])return}else be&&(ke[V]&&($e.value.now=Date.now()),ke[P].unshiftNode($e));return ht.value}},J=(ke,Ce)=>{if(!Ce||!Ce.maxAge&&!ke[A])return!1;const be=Date.now()-Ce.now;return Ce.maxAge?be>Ce.maxAge:ke[A]&&be>ke[A]},K=ke=>{if(ke[v]>ke[h])for(let Ce=ke[P].tail;ke[v]>ke[h]&&Ce!==null;){const be=Ce.prev;re(ke,Ce),Ce=be}},re=(ke,Ce)=>{if(Ce){const be=Ce.value;ke[S]&&ke[S](be.key,be.value),ke[v]-=be.length,ke[L].delete(be.key),ke[P].removeNode(Ce)}};class ce{constructor(Ce,be,$e,ht,Dt){this.key=Ce,this.value=be,this.length=$e,this.now=ht,this.maxAge=Dt||0}}const pe=(ke,Ce,be,$e)=>{let ht=be.value;J(ke,ht)&&(re(ke,be),ke[O]||(ht=void 0)),ht&&Ce.call($e,ht.value,ht.key,ke)};a.exports=class{constructor(ke){if(typeof ke=="number"&&(ke={max:ke}),ke||(ke={}),ke.max&&(typeof ke.max!="number"||ke.max<0))throw new TypeError("max must be a non-negative number");this[h]=ke.max||1/0;const Ce=ke.length||N;if(this[g]=typeof Ce!="function"?N:Ce,this[O]=ke.stale||!1,ke.maxAge&&typeof ke.maxAge!="number")throw new TypeError("maxAge must be a number");this[A]=ke.maxAge||0,this[S]=ke.dispose,this[M]=ke.noDisposeOnSet||!1,this[V]=ke.updateAgeOnGet||!1,this.reset()}set max(ke){if(typeof ke!="number"||ke<0)throw new TypeError("max must be a non-negative number");this[h]=ke||1/0,K(this)}get max(){return this[h]}set allowStale(ke){this[O]=!!ke}get allowStale(){return this[O]}set maxAge(ke){if(typeof ke!="number")throw new TypeError("maxAge must be a non-negative number");this[A]=ke,K(this)}get maxAge(){return this[A]}set lengthCalculator(ke){typeof ke!="function"&&(ke=N),ke!==this[g]&&(this[g]=ke,this[v]=0,this[P].forEach(Ce=>{Ce.length=this[g](Ce.value,Ce.key),this[v]+=Ce.length})),K(this)}get lengthCalculator(){return this[g]}get length(){return this[v]}get itemCount(){return this[P].length}rforEach(ke,Ce){Ce=Ce||this;for(let be=this[P].tail;be!==null;){const $e=be.prev;pe(this,ke,be,Ce),be=$e}}forEach(ke,Ce){Ce=Ce||this;for(let be=this[P].head;be!==null;){const $e=be.next;pe(this,ke,be,Ce),be=$e}}keys(){return this[P].toArray().map(ke=>ke.key)}values(){return this[P].toArray().map(ke=>ke.value)}reset(){this[S]&&this[P]&&this[P].length&&this[P].forEach(ke=>this[S](ke.key,ke.value)),this[L]=new Map,this[P]=new s,this[v]=0}dump(){return this[P].map(ke=>!J(this,ke)&&{k:ke.key,v:ke.value,e:ke.now+(ke.maxAge||0)}).toArray().filter(ke=>ke)}dumpLru(){return this[P]}set(ke,Ce,be){if((be=be||this[A])&&typeof be!="number")throw new TypeError("maxAge must be a number");const $e=be?Date.now():0,ht=this[g](Ce,ke);if(this[L].has(ke)){if(ht>this[h])return re(this,this[L].get(ke)),!1;const Ut=this[L].get(ke).value;return this[S]&&(this[M]||this[S](ke,Ut.value)),Ut.now=$e,Ut.maxAge=be,Ut.value=Ce,this[v]+=ht-Ut.length,Ut.length=ht,this.get(ke),K(this),!0}const Dt=new ce(ke,Ce,ht,$e,be);return Dt.length>this[h]?(this[S]&&this[S](ke,Ce),!1):(this[v]+=Dt.length,this[P].unshift(Dt),this[L].set(ke,this[P].head),K(this),!0)}has(ke){if(!this[L].has(ke))return!1;const Ce=this[L].get(ke).value;return!J(this,Ce)}get(ke){return ee(this,ke,!0)}peek(ke){return ee(this,ke,!1)}pop(){const ke=this[P].tail;return ke?(re(this,ke),ke.value):null}del(ke){re(this,this[L].get(ke))}load(ke){this.reset();const Ce=Date.now();for(let be=ke.length-1;be>=0;be--){const $e=ke[be],ht=$e.e||0;if(ht===0)this.set($e.k,$e.v);else{const Dt=ht-Ce;Dt>0&&this.set($e.k,$e.v,Dt)}}}
8495prune(){this[L].forEach((ke,Ce)=>ee(this,Ce,!1))}}},function(a,i,n){const s=n(32),h=n(89),{re:v,t:g}=n(90);a.exports=(O,A)=>{if(O instanceof s)return O;if(typeof O=="number"&&(O=String(O)),typeof O!="string")return null;let S=null;if((A=A||{}).rtl){let M;for(;(M=v[g.COERCERTL].exec(O))&&(!S||S.index+S[0].length!==O.length);)S&&M.index+M[0].length===S.index+S[0].length||(S=M),v[g.COERCERTL].lastIndex=M.index+M[1].length+M[2].length;v[g.COERCERTL].lastIndex=-1}else S=O.match(v[g.COERCE]);return S===null?null:h(`${S[2]}.${S[3]||"0"}.${S[4]||"0"}`,A)}},function(a,i,n){const s=n(144);a.exports=(h,v)=>h.sort((g,O)=>s(O,g,v))},function(a,i,n){const s=n(144);a.exports=(h,v)=>h.sort((g,O)=>s(g,O,v))},function(a,i,n){const s=n(48);a.exports=(h,v)=>s(h,v,!0)},function(a,i,n){const s=n(48);a.exports=(h,v,g)=>s(v,h,g)},function(a,i,n){const s=n(89);a.exports=(h,v)=>{const g=s(h,v);return g&&g.prerelease.length?g.prerelease:null}},function(a,i,n){const s=n(32);a.exports=(h,v)=>new s(h,v).patch},function(a,i,n){const s=n(32);a.exports=(h,v)=>new s(h,v).minor},function(a,i,n){const s=n(32);a.exports=(h,v)=>new s(h,v).major},function(a,i,n){const s=n(89),h=n(145);a.exports=(v,g)=>{if(h(v,g))return null;{const O=s(v),A=s(g),S=O.prerelease.length||A.prerelease.length,M=S?"pre":"",P=S?"prerelease":"";for(const L in O)if((L==="major"||L==="minor"||L==="patch")&&O[L]!==A[L])return M+L;return P}}},function(a,i,n){const s=n(32);a.exports=(h,v,g,O)=>{typeof g=="string"&&(O=g,g=void 0);try{return new s(h,g).inc(v,O).version}catch{return null}}},function(a,i,n){const s=n(89);a.exports=(h,v)=>{const g=s(h.trim().replace(/^[=v]+/,""),v);return g?g.version:null}},function(a,i,n){const s=n(89);a.exports=(h,v)=>{const g=s(h,v);return g?g.version:null}},function(a,i,n){/** 8496* @license 8497* Copyright 2018 Google LLC. All Rights Reserved. 8498* Licensed under the Apache License, Version 2.0 (the "License"); 8499* you may not use this file except in compliance with the License. 8500* You may obtain a copy of the License at 8501* 8502* http://www.apache.org/licenses/LICENSE-2.0 8503* 8504* Unless required by applicable law or agreed to in writing, software 8505* distributed under the License is distributed on an "AS IS" BASIS, 8506* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8507* See the License for the specific language governing permissions and 8508* limitations under the License. 8509* ============================================================================= 8510*/var s=this&&this.__awaiter||function(M,P,L,V){return new(L||(L=Promise))(function(N,ee){function J(ce){try{re(V.next(ce))}catch(pe){ee(pe)}}function K(ce){try{re(V.throw(ce))}catch(pe){ee(pe)}}function re(ce){ce.done?N(ce.value):new L(function(pe){pe(ce.value)}).then(J,K)}re((V=V.apply(M,P||[])).next())})},h=this&&this.__importDefault||function(M){return M&&M.__esModule?M:{default:M}};Object.defineProperty(i,"__esModule",{value:!0});const v=h(n(88)),g=n(64),O=n(46);i.barchart=function(M,P,L={}){return s(this,void 0,void 0,function*(){const V=O.getDrawArea(M),N=P,ee=Object.assign({},A,L);if(S.has(V)){const ht=S.get(V);if(O.shallowEquals(ee,ht.lastOptions)){yield O.nextFrame();const Dt=ht.view,Ut=Dt.changeset().remove(()=>!0).insert(N);return void(yield Dt.change("values",Ut).runAsync())}}const{xLabel:J,yLabel:K,xType:re,yType:ce}=ee;let pe=null;J!=null&&(pe={title:J});let ke,Ce=null;K!=null&&(Ce={title:K}),ke=ee.color!=null?Array.isArray(ee.color)?{field:"index",type:"nominal",scale:{range:ee.color}}:{value:ee.color}:{value:"#4C78A0"};const be={width:ee.width||g.getDefaultWidth(V),height:ee.height||g.getDefaultHeight(V),padding:0,autosize:{type:"fit",contains:"padding",resize:!0},config:{axis:{labelFontSize:ee.fontSize,titleFontSize:ee.fontSize},text:{fontSize:ee.fontSize},legend:{labelFontSize:ee.fontSize,titleFontSize:ee.fontSize}},data:{values:N,name:"values"},mark:{type:"bar",tooltip:!0},encoding:{x:{field:"index",type:re,axis:pe},y:{field:"value",type:ce,axis:Ce},color:ke}};yield O.nextFrame();const $e=yield v.default(V,be,{actions:!1,mode:"vega-lite",defaultStyle:!1});S.set(V,{view:$e.view,lastOptions:ee})})};const A={xLabel:"",yLabel:"",xType:"ordinal",yType:"quantitative",fontSize:11},S=new Map},function(a,i,n){/** 8511* @license 8512* Copyright 2018 Google Inc. All Rights Reserved. 8513* Licensed under the Apache License, Version 2.0 (the "License");
8514* you may not use this file except in compliance with the License. 8515* You may obtain a copy of the License at 8516* 8517* http://www.apache.org/licenses/LICENSE-2.0 8518* 8519* Unless required by applicable law or agreed to in writing, software 8520* distributed under the License is distributed on an "AS IS" BASIS, 8521* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8522* See the License for the specific language governing permissions and 8523* limitations under the License. 8524* ============================================================================= 8525*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(103),v=n(33),g=n(74);function O(A){h.env().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(A+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}i.enableProdMode=function(){h.env().set("PROD",!0)},i.enableDebugMode=function(){h.env().set("DEBUG",!0)},i.disableDeprecationWarnings=function(){h.env().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")},i.deprecationWarn=O,v.setDeprecationWarningFn(O),i.disposeVariables=function(){s.ENGINE.disposeVariables()},i.engine=function(){return s.ENGINE},i.memory=function(){return s.ENGINE.memory()},i.profile=function(A){return s.ENGINE.profile(A)},i.tidy=function(A,S){return s.ENGINE.tidy(A,S)},i.dispose=function(A){g.getTensorsInContainer(A).forEach(function(S){return S.dispose()})},i.keep=function(A){return s.ENGINE.keep(A)},i.time=function(A){return s.ENGINE.time(A)},i.setBackend=function(A){return s.ENGINE.setBackend(A)},i.ready=function(){return s.ENGINE.ready()},i.getBackend=function(){return s.ENGINE.backendName},i.removeBackend=function(A){s.ENGINE.removeBackend(A)},i.findBackend=function(A){return s.ENGINE.findBackend(A)},i.findBackendFactory=function(A){return s.ENGINE.findBackendFactory(A)},i.registerBackend=function(A,S,M){return M===void 0&&(M=1),s.ENGINE.registerBackend(A,S,M)},i.backend=function(){return s.ENGINE.backend},i.setPlatform=function(A,S){h.env().setPlatform(A,S)}},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});/** 8526 * @license 8527 * Copyright 2020 Google Inc. All Rights Reserved. 8528 * Licensed under the Apache License, Version 2.0 (the "License"); 8529 * you may not use this file except in compliance with the License. 8530 * You may obtain a copy of the License at 8531 * 8532 * http://www.apache.org/licenses/LICENSE-2.0 8533 * 8534 * Unless required by applicable law or agreed to in writing, software 8535 * distributed under the License is distributed on an "AS IS" BASIS, 8536 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8537 * See the License for the specific language governing permissions and 8538 * limitations under the License. 8539 * ============================================================================= 8540 */var s=n(350);i.warnDeprecation=function(){s.deprecationWarn("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")},i.xAs4D=function(h){return h.rank===0||h.rank===1?h.as4D(1,1,1,h.size):h.rank===2?h.as4D(1,1,h.shape[0],h.shape[1]):h.rank===3?h.as4D(1,h.shape[0],h.shape[1],h.shape[2]):h}},function(a,i,n){/** 8541* @license 8542* Copyright 2020 Google Inc. All Rights Reserved. 8543* Licensed under the Apache License, Version 2.0 (the "License"); 8544* you may not use this file except in compliance with the License. 8545* You may obtain a copy of the License at 8546* 8547* http://www.apache.org/licenses/LICENSE-2.0 8548* 8549* Unless required by applicable law or agreed to in writing, software 8550* distributed under the License is distributed on an "AS IS" BASIS, 8551* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8552* See the License for the specific language governing permissions and 8553* limitations under the License. 8554* ============================================================================= 8555*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(29),v=n(21),g=n(351),O=n(28);function A(M,P,L,V,N,ee){ee==null&&(ee=.001);
8555var J,K,re=h.convertToTensor(M,"x","batchNorm"),ce=h.convertToTensor(P,"mean","batchNorm"),pe=h.convertToTensor(L,"variance","batchNorm");N!=null&&(J=h.convertToTensor(N,"scale","batchNorm")),V!=null&&(K=h.convertToTensor(V,"offset","batchNorm")),v.assert(ce.rank===pe.rank,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),v.assert(K==null||ce.rank===K.rank,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),v.assert(J==null||ce.rank===J.rank,function(){return"Batch normalization gradient requires mean and scale to have equal ranks."});var ke={x:re,scale:J,offset:K,mean:ce,variance:pe},Ce={varianceEpsilon:ee};return s.ENGINE.runKernelFunc(function(be,$e){var ht=g.xAs4D(re),Dt=be.batchNormalization(ht,S(ce),S(pe),ee,S(J),S(K));return $e([re,ce,pe,J]),Dt},ke,null,"FusedBatchNorm",Ce).reshape(re.shape)}function S(M){return M==null?null:M.rank===0?M.as1D():M.rank===1?M:M.rank===2?M.as4D(1,1,M.shape[0],M.shape[1]):M.rank===3?M.as4D(1,M.shape[0],M.shape[1],M.shape[2]):M}i.batchNormalization=O.op({batchNormalization_:function(M,P,L,V,N,ee){return V===void 0&&(V=.001),g.warnDeprecation(),A(M,P,L,ee,N,V)}}),i.batchNorm=O.op({batchNorm_:A})},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});/** 8556 * @license 8557 * Copyright 2020 Google LLC. All Rights Reserved. 8558 * Licensed under the Apache License, Version 2.0 (the "License"); 8559 * you may not use this file except in compliance with the License. 8560 * You may obtain a copy of the License at 8561 * 8562 * http://www.apache.org/licenses/LICENSE-2.0 8563 * 8564 * Unless required by applicable law or agreed to in writing, software 8565 * distributed under the License is distributed on an "AS IS" BASIS, 8566 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8567 * See the License for the specific language governing permissions and 8568 * limitations under the License. 8569 * ============================================================================= 8570 */var s=n(352);n(33).Tensor.prototype.batchNorm=function(h,v,g,O,A){return s.batchNorm(this,h,v,g,O,A)}},function(a,i,n){/** 8571* @license 8572* Copyright 2020 Google Inc. All Rights Reserved. 8573* Licensed under the Apache License, Version 2.0 (the "License"); 8574* you may not use this file except in compliance with the License. 8575* You may obtain a copy of the License at 8576* 8577* http://www.apache.org/licenses/LICENSE-2.0 8578* 8579* Unless required by applicable law or agreed to in writing, software 8580* distributed under the License is distributed on an "AS IS" BASIS, 8581* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8582* See the License for the specific language governing permissions and 8583* limitations under the License. 8584* ============================================================================= 8585*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(73),v=n(29),g=n(28);i.pad=g.op({pad_:function(O,A,S){S===void 0&&(S=0);var M=v.convertToTensor(O,"x","pad");if(M.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var P={paddings:A,constantValue:S},L={x:M};return s.ENGINE.runKernelFunc(function(V,N){return N([M]),V.pad(M,A,S)},L,null,h.PadV2,P)}})},function(a,i,n){/** 8586* @license 8587* Copyright 2020 Google Inc. All Rights Reserved. 8588* Licensed under the Apache License, Version 2.0 (the "License"); 8589* you may not use this file except in compliance with the License. 8590* You may obtain a copy of the License at 8591* 8592* http://www.apache.org/licenses/LICENSE-2.0 8593* 8594* Unless required by applicable law or agreed to in writing, software 8595* distributed under the License is distributed on an "AS IS" BASIS, 8596* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8597* See the License for the specific language governing permissions and 8598* limitations under the License. 8599* ============================================================================= 8600*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(354);n(33).Tensor.prototype.pad=function(h,v){return s.pad(this,h,v)}},function(a,i,n){/** 8601* @license 8602* Copyright 2018 Google Inc. All Rights Reserved. 8603* Licensed under the Apache License, Version 2.0 (the "License");
8604* you may not use this file except in compliance with the License. 8605* You may obtain a copy of the License at 8606* 8607* http://www.apache.org/licenses/LICENSE-2.0 8608* 8609* Unless required by applicable law or agreed to in writing, software 8610* distributed under the License is distributed on an "AS IS" BASIS, 8611* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8612* See the License for the specific language governing permissions and 8613* limitations under the License. 8614* ============================================================================= 8615*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(29),v=n(21),g=n(28);i.transpose=g.op({transpose_:function(O,A){var S=h.convertToTensor(O,"x","transpose");if(A==null&&(A=S.shape.map(function(P,L){return L}).reverse()),v.assert(S.rank===A.length,function(){return"Error in transpose: rank of input "+S.rank+" must match length of perm "+A+"."}),A.forEach(function(P){v.assert(P>=0&&P<S.rank,function(){return"All entries in 'perm' must be between 0 and "+(S.rank-1)+" but got "+A})}),S.rank<=1)return S.clone();var M={perm:A};return s.ENGINE.runKernelFunc(function(P){return P.transpose(S,A)},{x:S},null,"Transpose",M)}})},function(a,i,n){/** 8616* @license 8617* Copyright 2020 Google LLC. All Rights Reserved. 8618* Licensed under the Apache License, Version 2.0 (the "License"); 8619* you may not use this file except in compliance with the License. 8620* You may obtain a copy of the License at 8621* 8622* http://www.apache.org/licenses/LICENSE-2.0 8623* 8624* Unless required by applicable law or agreed to in writing, software 8625* distributed under the License is distributed on an "AS IS" BASIS, 8626* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8627* See the License for the specific language governing permissions and 8628* limitations under the License. 8629* ============================================================================= 8630*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(356);n(33).Tensor.prototype.transpose=function(h){return s.transpose(this,h)}},function(a,i,n){/** 8631* @license 8632* Copyright 2020 Google Inc. All Rights Reserved. 8633* Licensed under the Apache License, Version 2.0 (the "License"); 8634* you may not use this file except in compliance with the License. 8635* You may obtain a copy of the License at 8636* 8637* http://www.apache.org/licenses/LICENSE-2.0 8638* 8639* Unless required by applicable law or agreed to in writing, software 8640* distributed under the License is distributed on an "AS IS" BASIS, 8641* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8642* See the License for the specific language governing permissions and 8643* limitations under the License. 8644* ============================================================================= 8645*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(73),v=n(29),g=n(28);i.oneHot=g.op({oneHot_:function(O,A,S,M){if(S===void 0&&(S=1),M===void 0&&(M=0),A<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+A);var P=v.convertToTensor(O,"indices","oneHot","int32"),L=P.shape.concat([A]),V={indices:P=P.flatten()},N={depth:A,onValue:S,offValue:M};return s.ENGINE.runKernelFunc(function(ee,J){return J([P]),ee.oneHot(P,A,S,M)},V,null,h.OneHot,N).reshape(L)}})},function(a,i,n){/** 8646* @license 8647* Copyright 2020 Google LLC. All Rights Reserved. 8648* Licensed under the Apache License, Version 2.0 (the "License"); 8649* you may not use this file except in compliance with the License. 8650* You may obtain a copy of the License at 8651* 8652* http://www.apache.org/licenses/LICENSE-2.0 8653* 8654* Unless required by applicable law or agreed to in writing, software 8655* distributed under the License is distributed on an "AS IS" BASIS, 8656* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8657* See the License for the specific language governing permissions and 8658* limitations under the License. 8659* ============================================================================= 8660*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(358);n(33).Tensor.prototype.oneHot=function(h,v,g){return v===void 0&&(v=1),g===void 0&&(g=0),s.oneHot(this,h,v,g)}},function(a,i,n){/** 8661* @license 8662* Copyright 2020 Google Inc. All Rights Reserved. 8663* Licensed under the Apache License, Version 2.0 (the "License");
8664* you may not use this file except in compliance with the License. 8665* You may obtain a copy of the License at 8666* 8667* http://www.apache.org/licenses/LICENSE-2.0 8668* 8669* Unless required by applicable law or agreed to in writing, software 8670* distributed under the License is distributed on an "AS IS" BASIS, 8671* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8672* See the License for the specific language governing permissions and 8673* limitations under the License. 8674* ============================================================================= 8675*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(73),v=n(29),g=n(21),O=n(28);i.tile=O.op({tile_:function(A,S){var M=v.convertToTensor(A,"x","tile",null);g.assert(M.rank===S.length,function(){return"Error in transpose: rank of input "+M.rank+" must match length of reps "+S+"."});var P=[M],L={x:M},V={reps:S};return s.ENGINE.runKernelFunc(function(N,ee){var J=N.tile(M,S);return ee([M]),J},L,null,h.Tile,V,P)}})},function(a,i,n){/** 8676* @license 8677* Copyright 2020 Google LLC. All Rights Reserved. 8678* Licensed under the Apache License, Version 2.0 (the "License"); 8679* you may not use this file except in compliance with the License. 8680* You may obtain a copy of the License at 8681* 8682* http://www.apache.org/licenses/LICENSE-2.0 8683* 8684* Unless required by applicable law or agreed to in writing, software 8685* distributed under the License is distributed on an "AS IS" BASIS, 8686* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8687* See the License for the specific language governing permissions and 8688* limitations under the License. 8689* ============================================================================= 8690*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(360);n(33).Tensor.prototype.tile=function(h){return s.tile(this,h)}},function(a,i,n){/** 8691* @license 8692* Copyright 2020 Google Inc. All Rights Reserved. 8693* Licensed under the Apache License, Version 2.0 (the "License"); 8694* you may not use this file except in compliance with the License. 8695* You may obtain a copy of the License at 8696* 8697* http://www.apache.org/licenses/LICENSE-2.0 8698* 8699* Unless required by applicable law or agreed to in writing, software 8700* distributed under the License is distributed on an "AS IS" BASIS, 8701* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8702* See the License for the specific language governing permissions and 8703* limitations under the License. 8704* ============================================================================= 8705*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(73),v=n(74),g=n(29),O=n(147),A=n(28),S=n(91);i.squaredDifference=A.op({squaredDifference_:function(M,P){var L,V=g.convertToTensor(M,"a","squaredDifference"),N=g.convertToTensor(P,"b","squaredDifference");L=v.makeTypesMatch(V,N),V=L[0],N=L[1],O.assertAndGetBroadcastShape(V.shape,N.shape);var ee={a:V,b:N},J=[V,N];return s.ENGINE.runKernelFunc(function(K,re){var ce=K.squaredDifference(V,N);return re([V,N]),ce},ee,function(K,re){var ce=re[0],pe=re[1],ke=S.scalar(2);return{a:function(){return K.mul(ce.sub(pe).mul(ke))},b:function(){return K.mul(pe.sub(ce).mul(ke))}}},h.SquaredDifference,{},J,[])}})},function(a,i,n){/** 8706* @license 8707* Copyright 2020 Google LLC. All Rights Reserved. 8708* Licensed under the Apache License, Version 2.0 (the "License"); 8709* you may not use this file except in compliance with the License. 8710* You may obtain a copy of the License at 8711* 8712* http://www.apache.org/licenses/LICENSE-2.0 8713* 8714* Unless required by applicable law or agreed to in writing, software 8715* distributed under the License is distributed on an "AS IS" BASIS, 8716* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8717* See the License for the specific language governing permissions and 8718* limitations under the License. 8719* ============================================================================= 8720*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(362);n(33).Tensor.prototype.squaredDifference=function(h){return s.squaredDifference(this,h)}},function(a,i,n){/** 8721* @license 8722* Copyright 2017 Google Inc. All Rights Reserved. 8723* Licensed under the Apache License, Version 2.0 (the "License");
8724* you may not use this file except in compliance with the License. 8725* You may obtain a copy of the License at 8726* 8727* http://www.apache.org/licenses/LICENSE-2.0 8728* 8729* Unless required by applicable law or agreed to in writing, software 8730* distributed under the License is distributed on an "AS IS" BASIS, 8731* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8732* See the License for the specific language governing permissions and 8733* limitations under the License. 8734* ============================================================================= 8735*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(21);i.assertParamsConsistent=function(h,v){var g=h[0].length;h.forEach(function(A,S){s.assert(A.length===g,function(){return"Error in concat"+g+"D: rank of tensors["+S+"] must be the same as the rank of the rest ("+g+")"})}),s.assert(v>=0&&v<g,function(){return"Error in concat"+g+"D: axis must be between 0 and "+(g-1)+"."});var O=h[0];h.forEach(function(A,S){for(var M=0;M<g;M++)s.assert(M===v||A[M]===O[M],function(){return"Error in concat"+g+"D: Shape of tensors["+S+"] ("+A+") does not match the shape of the rest ("+O+") along the non-concatenated axis "+S+"."})})},i.computeOutShape=function(h,v){for(var g=h[0].slice(),O=1;O<h.length;O++)g[v]+=h[O][v];return g}},function(a,i,n){/** 8736* @license 8737* Copyright 2018 Google Inc. All Rights Reserved. 8738* Licensed under the Apache License, Version 2.0 (the "License"); 8739* you may not use this file except in compliance with the License. 8740* You may obtain a copy of the License at 8741* 8742* http://www.apache.org/licenses/LICENSE-2.0 8743* 8744* Unless required by applicable law or agreed to in writing, software 8745* distributed under the License is distributed on an "AS IS" BASIS, 8746* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8747* See the License for the specific language governing permissions and 8748* limitations under the License. 8749* ============================================================================= 8750*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(29),v=n(21),g=n(21),O=n(364),A=n(28),S=n(91);i.concat=A.op({concat_:function(M,P){P===void 0&&(P=0),v.assert(M.length>=1,function(){return"Pass at least one tensor to concat"});var L=h.convertToTensorArray(M,"tensors","concat");
8750L[0].dtype==="complex64"&&L.forEach(function(K){if(K.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor 8751 with dtype `+K.dtype+". ")}),P=g.parseAxisParam(P,L[0].shape)[0];var V=O.computeOutShape(L.map(function(K){return K.shape}),P);if(v.sizeFromShape(V)===0)return S.tensor([],V);if((L=L.filter(function(K){return K.size>0})).length===1)return L[0];var N=L.map(function(K){return K.shape});O.assertParamsConsistent(N,P);var ee=L,J={axis:P};return s.ENGINE.runKernelFunc(function(K){return K.concat(L,P)},ee,function(K){var re=N.map(function(ce){return ce[P]});return i.split(K,re,P).map(function(ce){return function(){return ce}})},"Concat",J)}}),i.concat1d=A.op({concat1d_:function(M){return i.concat(M,0)}}),i.concat2d=A.op({concat2d_:function(M,P){return i.concat(M,P)}}),i.concat3d=A.op({concat3d_:function(M,P){return i.concat(M,P)}}),i.concat4d=A.op({concat4d_:function(M,P){return i.concat(M,P)}}),i.split=A.op({split_:function(M,P,L){L===void 0&&(L=0);var V,N=h.convertToTensor(M,"x","split");return L=g.parseAxisParam(L,N.shape)[0],typeof P=="number"?(v.assert(N.shape[L]%P==0,function(){return"Number of splits must evenly divide the axis."}),V=new Array(P).fill(N.shape[L]/P)):(v.assert(N.shape[L]===P.reduce(function(ee,J){return ee+J}),function(){return"The sum of sizes must match the size of the axis dimension."}),V=P),s.ENGINE.runKernelFunc(function(ee){return ee.split(N,V,L)},{$x:N},function(ee){return{$x:function(){return i.concat(ee,L)}}})}})},function(a,i,n){/** 8752* @license 8753* Copyright 2017 Google Inc. All Rights Reserved. 8754* Licensed under the Apache License, Version 2.0 (the "License"); 8755* you may not use this file except in compliance with the License. 8756* You may obtain a copy of the License at 8757* 8758* http://www.apache.org/licenses/LICENSE-2.0 8759* 8760* Unless required by applicable law or agreed to in writing, software 8761* distributed under the License is distributed on an "AS IS" BASIS, 8762* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8763* See the License for the specific language governing permissions and 8764* limitations under the License. 8765* ============================================================================= 8766*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(21);function h(g,O){for(var A=0;A<g.length;++A)if(g[g.length-A-1]!==O-1-A)return!1;return!0}function v(g,O,A){for(var S=g.length+O.length,M=[],P=0,L=0,V=0;V<S;V++)A.indexOf(V)===-1?M.push(g[P++]):M.push(O[L++]);return M}i.axesAreInnerMostDims=h,i.combineLocations=v,i.computeOutAndReduceShapes=function(g,O){for(var A=[],S=g.length,M=0;M<S;M++)O.indexOf(M)===-1&&A.push(g[M]);return[A,O.map(function(P){return g[P]})]},i.expandShapeToKeepDim=function(g,O){return v(g,O.map(function(A){return 1}),O)},i.assertAxesAreInnerMostDims=function(g,O,A){s.assert(h(O,A),function(){return g+" supports only inner-most axes for now. Got axes "+O+" and rank-"+A+" input."})},i.getAxesPermutation=function(g,O){if(h(g,O))return null;for(var A=[],S=0;S<O;++S)g.indexOf(S)===-1&&A.push(S);return g.forEach(function(M){return A.push(M)}),A},i.getUndoAxesPermutation=function(g){return g.map(function(O,A){return[A,O]}).sort(function(O,A){return O[1]-A[1]}).map(function(O){return O[0]})},i.getInnerMostAxes=function(g,O){for(var A=[],S=O-g;S<O;++S)A.push(S);return A}},function(a,i,n){/** 8767* @license 8768* Copyright 2018 Google Inc. All Rights Reserved. 8769* Licensed under the Apache License, Version 2.0 (the "License"); 8770* you may not use this file except in compliance with the License. 8771* You may obtain a copy of the License at 8772* 8773* http://www.apache.org/licenses/LICENSE-2.0 8774* 8775* Unless required by applicable law or agreed to in writing, software 8776* distributed under the License is distributed on an "AS IS" BASIS, 8777* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8778* See the License for the specific language governing permissions and 8779* limitations under the License. 8780* ============================================================================= 8781*/var s=this&&this.__awaiter||function(L,V,N,ee){return new(N||(N=Promise))(function(J,K){function re(ke){try{pe(ee.next(ke))}catch(Ce){K(Ce)}}function ce(ke){try{pe(ee.throw(ke))}catch(Ce){K(Ce)}}function pe(ke){ke.done?J(ke.value):new N(function(Ce){Ce(ke.value)}).then(re,ce)}pe((ee=ee.apply(L,V||[])).next())})},h=this&&this.__generator||function(L,V){var N,ee,J,K,re={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return K={next:ce(0),throw:ce(1),return:ce(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function ce(pe){return function(ke){return function(Ce){if(N)throw new TypeError("Generator is already executing.");for(;re;)try{if(N=1,ee&&(J=2&Ce[0]?ee.return:Ce[0]?ee.throw||((J=ee.return)&&J.call(ee),0):ee.next)&&!(J=J.call(ee,Ce[1])).done)return J;switch(ee=0,J&&(Ce=[2&Ce[0],J.value]),Ce[0]){case 0:case 1:J=Ce;break;case 4:return re.label++,{value:Ce[1],done:!1};case 5:re.label++,ee=Ce[1],Ce=[0];continue;case 7:Ce=re.ops.pop(),re.trys.pop();continue;default:if(!(J=(J=re.trys).length>0&&J[J.length-1])&&(Ce[0]===6||Ce[0]===2)){re=0;continue}if(Ce[0]===3&&(!J||Ce[1]>J[0]&&Ce[1]<J[3])){re.label=Ce[1];break}if(Ce[0]===6&&re.label<J[1]){re.label=J[1],J=Ce;break}if(J&&re.label<J[2]){re.label=J[2],re.ops.push(Ce);break}J[2]&&re.ops.pop(),re.trys.pop();continue}Ce=V.call(L,re)}catch(be){Ce=[6,be],ee=0}finally{N=J=0}if(5&Ce[0])throw Ce[1];return{value:Ce[0]?Ce[1]:void 0,done:!0}}([pe,ke])}}};Object.defineProperty(i,"__esModule",{value:!0});var v=n(25),g=n(33),O=n(29),A=n(21),S=n(366),M=n(365),P=n(28);i.buffer=function(L,V,N){return V===void 0&&(V="float32"),V=V||"float32",A.assertNonNegativeIntegerDimensions(L),new g.TensorBuffer(L,V,N)},i.print=function(L,V){V===void 0&&(V=!1),console.log(L.toString(V))},i.batchToSpaceND=P.op({batchToSpaceND_:function(L,V,N){var ee=O.convertToTensor(L,"x","batchToSpaceND"),J=V.reduce(function(K,re){return K*re});return A.assert(ee.rank>=1+V.length,function(){return"input rank is "+ee.rank+" but should be > than blockShape.length "+V.length}),A.assert(N.length===V.length,function(){return"crops.length is "+N.length+" but should be equal to blockShape.length "+V.length}),A.assert(ee.shape[0]%J==0,function(){return"input tensor batch is "+ee.shape[0]+" but is not divisible by the product of the elements of blockS
8781hape "+V.join(" * ")+" === "+J}),v.ENGINE.runKernelFunc(function(K){return K.batchToSpaceND(ee,V,N)},{$x:ee},function(K){return{$x:function(){return K.spaceToBatchND(V,N)}}})}}),i.cast=P.op({cast_:function(L,V){var N=O.convertToTensor(L,"x","cast");if(!A.isValidDtype(V))throw new Error("Failed to cast to unknown dtype "+V);if(V==="string"&&N.dtype!=="string"||V!=="string"&&N.dtype==="string")throw new Error("Only strings can be casted to strings");var ee={dtype:V};return v.ENGINE.runKernelFunc(function(J){return J.cast(N,V)},{x:N},function(J){return{x:function(){return J.clone()}}},"Cast",ee)}}),i.cumsum=P.op({cumsum_:function(L,V,N,ee){V===void 0&&(V=0),N===void 0&&(N=!1),ee===void 0&&(ee=!1);var J=O.convertToTensor(L,"x","cumsum");V|=0;var K=S.getAxesPermutation([V],J.rank),re=J;K!=null&&(re=J.transpose(K));var ce=S.getInnerMostAxes(1,J.rank)[0],pe=v.ENGINE.runKernelFunc(function(ke){return ke.cumsum(re,ce,N,ee)},{permutedX:re},function(ke){return{permutedX:function(){return ke.cumsum(V,N,!ee)}}});return K!=null&&(pe=pe.transpose(K)),pe}}),i.depthToSpace=P.op({depthToSpace_:function(L,V,N){N===void 0&&(N="NHWC");var ee=O.convertToTensor(L,"x","depthToSpace"),J=N==="NHWC"?ee.shape[1]:ee.shape[2],K=N==="NHWC"?ee.shape[2]:ee.shape[3],re=N==="NHWC"?ee.shape[3]:ee.shape[1];return A.assert(J*V>=0,function(){return`Negative dimension size caused by overflow when multiplying 8782 `+J+" and "+V+` for depthToSpace with input shape 8783 `+ee.shape}),A.assert(K*V>=0,function(){return`Negative dimension size caused by overflow when multiplying 8784 `+K+" and "+V+` for depthToSpace with input shape 8785 `+ee.shape}),A.assert(re%(V*V)==0,function(){return"Dimension size must be evenly divisible by "+V*V+" but is "+re+" for depthToSpace with input shape "+ee.shape}),v.ENGINE.runKernelFunc(function(ce){return ce.depthToSpace(ee,V,N)},{$x:ee})}}),i.expandDims=P.op({expandDims_:function(L,V){V===void 0&&(V=0);var N=O.convertToTensor(L,"x","expandDims",null);A.assert(V<=N.rank,function(){return"Axis must be <= rank of the tensor"});var ee=N.shape.slice();return V<0&&(A.assert(-(N.rank+1)<=V,function(){return"Axis must be in the interval ["+-(N.rank+1)+", "+N.rank+"]"}),V=N.rank+V+1),ee.splice(V,0,1),i.reshape(N,ee)}}),i.reshape=P.op({reshape_:function(L,V){var N=O.convertToTensor(L,"x","reshape",null);V=A.inferFromImplicitShape(V,N.size),A.assert(N.size===A.sizeFromShape(V),function(){return"new shape and old shape must have the same number of elements."});var ee={shape:V};return v.ENGINE.runKernelFunc(function(J){return J.reshape(N,V)},{x:N},function(J){return{x:function(){return J.reshape(N.shape)}}},"Reshape",ee)}}),i.spaceToBatchND=P.op({spaceToBatchND_:function(L,V,N){var ee=O.convertToTensor(L,"x","spaceToBatchND");return A.assert(ee.rank>=1+V.length,function(){return"input rank "+ee.rank+" should be > than [blockShape] "+V.length}),A.assert(N.length===V.length,function(){return"paddings.shape[0] "+N.length+" must be equal to [blockShape] "+V.length}),A.assert(ee.shape.reduce(function(J,K,re){return re>0&&re<=V.length?J&&(K+N[re-1][0]+N[re-1][1])%V[re-1]==0:J},!0),function(){return"input spatial dimensions "+ee.shape.slice(1)+" with paddings "+N.toString()+" must be divisible by blockShapes "+V.toString()}),v.ENGINE.runKernelFunc(function(J){return J.spaceToBatchND(ee,V,N)},{$x:ee},function(J){return{$x:function(){return J.batchToSpaceND(V,N)}}})}}),i.squeeze=P.op({squeeze_:function(L,V){var N=O.convertToTensor(L,"x","squeeze");return i.reshape(N,A.squeezeShape(N.shape,V).newShape)}}),i.stack=P.op({stack_:function(L,V){V===void 0&&(V=0);var N=O.convertToTensorArray(L,"tensors","stack");if(A.assert(N.length>=1,function(){return"Pass at least one tensor to tf.stack"}),N.length===1)return N[0].expandDims(V);var ee=N[0].rank,J=N[0].shape,K=N[0].dtype;A.assert(V<=ee,function(){return"Axis must be <= rank of the tensor"}),N.forEach(function(ce){A.assertShapesMatch(J,ce.shape,"All tensors passed to stack must have matching shapes")}),N.forEach(function(ce){A.assert(K===ce.dtype,function(){return"All tensors passed to stack must have matching dtypes"})});var re=N.map(function(ce){return ce.expandDims(V)});return M.concat(re,V)}}),i.unstack=P.op({unstack_:function(L,V){V===void 0&&(V=0),V=V||0;var N=O.convertToTensor(L,"x","unstack");A.assert(V>=-N.shape.length&&V<N.shape.length,function(){return"Axis = "+V+" is not in [-"+N.shape.length+", "+N.shape.length+")"}),V<0&&(V+=N.shape.length);var ee={axis:V};return v.ENGINE.runKernelFunc(function(J){return J.unstack(N,V)},{x:N},function(J){return{x:function(){return i.stack(J,V)}}},"Unpack",ee)}}),i.setdiff1dAsync=function(L,V){return s(this,void 0,void 0,function(){var N,ee,J,K,re,ce,pe,ke,Ce,be;return h(this,function($e){switch($e.label){case 0:return N=O.convertToTensor(L,"x","setdiff1d"),ee=O.convertToTensor(V,"y","setdiff1d"),A.assert(N.dtype===ee.dtype,function(){return"x and y should have the same dtype, but got x ("+N.dtype+") and y ("+ee.dtype+")."}),A.assert(N.rank===1,function(){return"x should be 1D tensor, but got x ("+N.shape+")."}),A.assert(ee.rank===1,function(){return"y should be 1D tensor, but got y ("+ee.shape+")."}),[4,N.data()];case 1:return J=$e.sent(),[4,ee.data()];case 2:for(K=$e.sent(),re=new Set(K),ce=0,Ce=0;Ce<J.length;Ce++)re.has(J[Ce])||ce++;for(pe=new g.TensorBuffer([ce],N.dtype),ke=new g.TensorBuffer([ce],"int32"),Ce=0,be=0;Ce<J.length;Ce++)re.has(J[Ce])||(pe.values[be]=J[Ce],ke.values[be]=Ce,be++);return[2,[pe.toTensor(),ke.toTensor()]]}})})}},function(a,i,n){/** 8786* @license 8787* Copyright 2018 Google LLC. All Rights Reserved. 8788* Licensed under the Apache License, Version 2.0 (the "License");
8789* you may not use this file except in compliance with the License. 8790* You may obtain a copy of the License at 8791* 8792* http://www.apache.org/licenses/LICENSE-2.0 8793* 8794* Unless required by applicable law or agreed to in writing, software 8795* distributed under the License is distributed on an "AS IS" BASIS, 8796* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8797* See the License for the specific language governing permissions and 8798* limitations under the License. 8799* ============================================================================= 8800*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(367);i.whereImpl=function(h,v){for(var g=[],O=0;O<v.length;O++)v[O]&&g.push(O);var A=s.buffer(h,"int32"),S=s.buffer([g.length,h.length],"int32");for(O=0;O<g.length;O++){var M=A.indexToLoc(g[O]),P=O*h.length;S.values.set(M,P)}return S.toTensor()}},function(a,i,n){/** 8801* @license 8802* Copyright 2018 Google Inc. All Rights Reserved. 8803* Licensed under the Apache License, Version 2.0 (the "License"); 8804* you may not use this file except in compliance with the License. 8805* You may obtain a copy of the License at 8806* 8807* http://www.apache.org/licenses/LICENSE-2.0 8808* 8809* Unless required by applicable law or agreed to in writing, software 8810* distributed under the License is distributed on an "AS IS" BASIS, 8811* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8812* See the License for the specific language governing permissions and 8813* limitations under the License. 8814* ============================================================================= 8815*/var s=this&&this.__awaiter||function(L,V,N,ee){return new(N||(N=Promise))(function(J,K){function re(ke){try{pe(ee.next(ke))}catch(Ce){K(Ce)}}function ce(ke){try{pe(ee.throw(ke))}catch(Ce){K(Ce)}}function pe(ke){ke.done?J(ke.value):new N(function(Ce){Ce(ke.value)}).then(re,ce)}pe((ee=ee.apply(L,V||[])).next())})},h=this&&this.__generator||function(L,V){var N,ee,J,K,re={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return K={next:ce(0),throw:ce(1),return:ce(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function ce(pe){return function(ke){return function(Ce){if(N)throw new TypeError("Generator is already executing.");for(;re;)try{if(N=1,ee&&(J=2&Ce[0]?ee.return:Ce[0]?ee.throw||((J=ee.return)&&J.call(ee),0):ee.next)&&!(J=J.call(ee,Ce[1])).done)return J;switch(ee=0,J&&(Ce=[2&Ce[0],J.value]),Ce[0]){case 0:case 1:J=Ce;break;case 4:return re.label++,{value:Ce[1],done:!1};case 5:re.label++,ee=Ce[1],Ce=[0];continue;case 7:Ce=re.ops.pop(),re.trys.pop();continue;default:if(!(J=(J=re.trys).length>0&&J[J.length-1])&&(Ce[0]===6||Ce[0]===2)){re=0;continue}if(Ce[0]===3&&(!J||Ce[1]>J[0]&&Ce[1]<J[3])){re.label=Ce[1];break}if(Ce[0]===6&&re.label<J[1]){re.label=J[1],J=Ce;break}if(J&&re.label<J[2]){re.label=J[2],re.ops.push(Ce);break}J[2]&&re.ops.pop(),re.trys.pop();continue}Ce=V.call(L,re)}catch(be){Ce=[6,be],ee=0}finally{N=J=0}if(5&Ce[0])throw Ce[1];return{value:Ce[0]?Ce[1]:void 0,done:!0}}([pe,ke])}}};Object.defineProperty(i,"__esModule",{value:!0});var v=n(368),g=n(25),O=n(29),A=n(21),S=n(147),M=n(28),P=n(91);i.logicalAnd=M.op({logicalAnd_:function(L,V){var N=O.convertToTensor(L,"a","logicalAnd","bool"),ee=O.convertToTensor(V,"b","logicalAnd","bool");return S.assertAndGetBroadcastShape(N.shape,ee.shape),g.ENGINE.runKernelFunc(function(J){return J.logicalAnd(N,ee)},{a:N,b:ee},null,"LogicalAnd")}}),i.logicalNot=M.op({logicalNot_:function(L){var V=O.convertToTensor(L,"x","logicalNot","bool");return g.ENGINE.runKernelFunc(function(N){return N.logicalNot(V)},{$x:V})}}),i.logicalOr=M.op({logicalOr_:function(L,V){var N=O.convertToTensor(L,"a","logicalOr","bool"),ee=O.convertToTensor(V,"b","logicalOr","bool");return S.assertAndGetBroadcastShape(N.shape,ee.shape),g.ENGINE.runKernelFunc(function(J){return J.logicalOr(N,ee)},{$a:N,$b:ee})}}),i.logicalXor=M.op({logicalXor_:function(L,V){var N=O.convertToTensor(L,"a","logicalXor","bool"),ee=O.convertToTensor(V,"b","logicalXor","bool");return S.assertAndGetBroadcastShape(N.shape,ee.shape),i.logicalOr(L,V).logicalAnd(i.logicalAnd(L,V).logicalNot())}}),i.where=M.op({where_:function(L,V,N){var ee=O.convertToTensor(V,"a","where"),J=O.convertToTensor(N,"b","where"),K=O.convertToTensor(L,"condition","where","bool");
8815return A.assertShapesMatch(ee.shape,J.shape,"Error in where: "),K.rank===1?A.assert(K.shape[0]===ee.shape[0],function(){return"The first dimension of `a` must match the size of `condition`."}):A.assertShapesMatch(K.shape,J.shape,"Error in where: "),g.ENGINE.runKernelFunc(function(re,ce){var pe=re.select(K,ee,J);return ce([K]),pe},{$condition:K,$a:ee,$b:J},function(re,ce){var pe=ce[0];return{$condition:function(){return P.zerosLike(pe).toFloat()},$a:function(){return re.mul(pe.cast(re.dtype))},$b:function(){return re.mul(pe.logicalNot().cast(re.dtype))}}})}}),i.whereAsync=function(L){return s(this,void 0,void 0,function(){var V,N,ee;return h(this,function(J){switch(J.label){case 0:return[4,(V=O.convertToTensor(L,"condition","whereAsync","bool")).data()];case 1:return N=J.sent(),ee=v.whereImpl(V.shape,N),L!==V&&V.dispose(),[2,ee]}})})}},function(a,i,n){/** 8816* @license 8817* Copyright 2020 Google Inc. All Rights Reserved. 8818* Licensed under the Apache License, Version 2.0 (the "License"); 8819* you may not use this file except in compliance with the License. 8820* You may obtain a copy of the License at 8821* 8822* http://www.apache.org/licenses/LICENSE-2.0 8823* 8824* Unless required by applicable law or agreed to in writing, software 8825* distributed under the License is distributed on an "AS IS" BASIS, 8826* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8827* See the License for the specific language governing permissions and 8828* limitations under the License. 8829* ============================================================================= 8830*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(74),h=n(29),v=n(205),g=n(369),O=n(28),A=n(91);i.divNoNan=O.op({divNoNan_:function(S,M){var P,L=h.convertToTensor(S,"a","div"),V=h.convertToTensor(M,"b","div");L=(P=s.makeTypesMatch(L,V))[0],V=P[1];var N=v.div(L,V),ee=A.zerosLike(N),J=V.equal(ee);return g.where(J,ee,N)}})},function(a,i,n){/** 8831* @license 8832* Copyright 2020 Google LLC. All Rights Reserved. 8833* Licensed under the Apache License, Version 2.0 (the "License"); 8834* you may not use this file except in compliance with the License. 8835* You may obtain a copy of the License at 8836* 8837* http://www.apache.org/licenses/LICENSE-2.0 8838* 8839* Unless required by applicable law or agreed to in writing, software 8840* distributed under the License is distributed on an "AS IS" BASIS, 8841* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8842* See the License for the specific language governing permissions and 8843* limitations under the License. 8844* ============================================================================= 8845*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(370);n(33).Tensor.prototype.divNoNan=function(h){return s.divNoNan(this,h)}},function(a,i,n){/** 8846* @license 8847* Copyright 2018 Google Inc. All Rights Reserved. 8848* Licensed under the Apache License, Version 2.0 (the "License"); 8849* you may not use this file except in compliance with the License. 8850* You may obtain a copy of the License at 8851* 8852* http://www.apache.org/licenses/LICENSE-2.0 8853* 8854* Unless required by applicable law or agreed to in writing, software 8855* distributed under the License is distributed on an "AS IS" BASIS, 8856* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8857* See the License for the specific language governing permissions and 8858* limitations under the License. 8859* ============================================================================= 8860*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(29),v=n(21),g=n(28),O=n(91);i.abs=g.op({abs_:function(A){var S=h.convertToTensor(A,"x","abs");return S.dtype==="complex64"?s.ENGINE.runKernelFunc(function(M){return M.complexAbs(S)},{$x:S}):s.ENGINE.runKernelFunc(function(M,P){var L=M.abs(S);return P([S]),L},{x:S},function(M,P){var L=P[0];return{x:function(){return M.mul(L.toFloat().step(-1))}}},"Abs")}}),i.acos=g.op({acos_:function(A){var S=h.convertToTensor(A,"x","acos");return s.ENGINE.runKernelFunc(function(M,P){var L=M.acos(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.divStrict(O.scalar(1).sub(L.toFloat().square()).sqrt()).neg()}}})}}),i.acosh=g.op({acosh_:function(A){var S=h.convertToTensor(A,"x","acosh");return s.ENGINE.runKernelFunc(function(M,P){var L=M.acosh(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];
8860return{$x:function(){return M.divStrict(L.toFloat().square().sub(1).sqrt())}}})}}),i.asin=g.op({asin_:function(A){var S=h.convertToTensor(A,"x","asin");return s.ENGINE.runKernelFunc(function(M,P){var L=M.asin(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.divStrict(O.scalar(1).sub(L.toFloat().square()).sqrt())}}})}}),i.asinh=g.op({asinh_:function(A){var S=h.convertToTensor(A,"x","asinh");return s.ENGINE.runKernelFunc(function(M,P){var L=M.asinh(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.divStrict(O.scalar(1).add(L.toFloat().square()).sqrt())}}})}}),i.atan=g.op({atan_:function(A){var S=h.convertToTensor(A,"x","atan");return s.ENGINE.runKernelFunc(function(M,P){var L=M.atan(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.div(L.toFloat().square().add(1))}}})}}),i.atanh=g.op({atanh_:function(A){var S=h.convertToTensor(A,"x","atanh");return s.ENGINE.runKernelFunc(function(M,P){var L=M.atanh(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.div(O.scalar(1).sub(L.toFloat().square()))}}})}}),i.ceil=g.op({ceil_:function(A){var S=h.convertToTensor(A,"x","ceil");return s.ENGINE.runKernelFunc(function(M){return M.ceil(S)},{$x:S},function(M){return{$x:function(){return O.zerosLike(M)}}})}}
8860),i.clipByValue=g.op({clipByValue_:function(A,S,M){var P=h.convertToTensor(A,"x","clipByValue");v.assert(S<=M,function(){return"Error in clip: min ("+S+") must be less than or equal to max ("+M+")."});var L=[P],V={min:S,max:M};return s.ENGINE.runKernelFunc(function(N,ee){var J=N.clip(P,S,M);return ee([P]),J},{x:P},function(N,ee){var J=ee[0];return{x:function(){return N.where(J.greaterEqual(S).logicalAnd(J.lessEqual(M)),O.zerosLike(N))}}},"ClipByValue",V,L)}}),i.cos=g.op({cos_:function(A){var S=h.convertToTensor(A,"x","cos"),M=[S];return s.ENGINE.runKernelFunc(function(P,L){var V=P.cos(S);return L([S]),V},{x:S},function(P,L){var V=L[0];return{x:function(){return V.toFloat().sin().neg().mul(P)}}},"Cos",{},M)}}),i.cosh=g.op({cosh_:function(A){var S=h.convertToTensor(A,"x","cosh");return s.ENGINE.runKernelFunc(function(M,P){var L=M.cosh(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return L.toFloat().sinh().mulStrict(M)}}})}}),i.erf=g.op({erf_:function(A){var S=h.convertToTensor(A,"x","erf");return v.assert(S.dtype==="int32"||S.dtype==="float32",function(){return"Input dtype must be `int32` or `float32`."}),S.dtype==="int32"&&(S=S.toFloat()),s.ENGINE.runKernelFunc(function(M,P){var L=M.erf(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.mul(L.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}})}}),i.exp=g.op({exp_:function(A){var S=h.convertToTensor(A,"x","exp");return s.ENGINE.runKernelFunc(function(M,P){var L=M.exp(S);return P([L]),L},{x:S},function(M,P){return{x:function(){return M.mulStrict(P[0])}}},"Exp",{},[],[!0])}}),i.expm1=g.op({expm1_:function(A){var S=h.convertToTensor(A,"x","expm1");return s.ENGINE.runKernelFunc(function(M,P){var L=M.expm1(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.mul(L.exp())}}})}}),i.floor=g.op({floor_:function(A){var S=h.convertToTensor(A,"x","floor");return s.ENGINE.runKernelFunc(function(M){return M.floor(S)},{$x:S},function(M){return{$x:function(){return O.zerosLike(M)}}})}}),i.log=g.op({log_:function(A){var S=h.convertToTensor(A,"x","log"),M=[S];return s.ENGINE.runKernelFunc(function(P,L){var V=P.log(S);return L([S]),V},{x:S},function(P,L){var V=L[0];return{x:function(){return P.div(V.toFloat())}}},"Log",{},M)}}),i.log1p=g.op({log1p_:function(A){var S=h.convertToTensor(A,"x","log1p");return s.ENGINE.runKernelFunc(function(M,P){var L=M.log1p(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.div(L.add(1))}}})}}),i.logSigmoid=g.op({logSigmoid_:function(A){var S=h.convertToTensor(A,"x","logSigmoid");return s.ENGINE.runKernelFunc(function(M,P){var L=M.softplus(S.neg()).neg();return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.mul(L.neg().sigmoid())}}})}}),i.neg=g.op({neg_:function(A){var S=h.convertToTensor(A,"x","neg"),M=[S];return s.ENGINE.runKernelFunc(function(P){return P.neg(S)},{x:S},function(P){return{x:function(){return P.neg()}}},"Neg",{},M)}}),i.reciprocal=g.op({reciprocal_:function(A){var S=h.convertToTensor(A,"x","reciprocal");return s.ENGINE.runKernelFunc(function(M,P){var L=M.reciprocal(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.div(L.square().neg())}}})}}),i.round=g.op({round_:function(A){var S=h.convertToTensor(A,"x","round");return s.ENGINE.runKernelFunc(function(M){return M.round(S)},{$x:S},function(M){return{$x:function(){return O.zerosLike(M)}}})}}),i.rsqrt=g.op({rsqrt_:function(A){var S=h.convertToTensor(A,"x","rsqrt"),M=[S];return s.ENGINE.runKernelFunc(function(P,L){var V=P.rsqrt(S);return L([S]),V},{x:S},function(P,L){var V=L[0];return{x:function(){return P.div(V.pow(1.5).mul(2)).neg()}}},"Rsqrt",{},M)}}),i.sigmoid=g.op({sigmoid_:function(A){var S=h.convertToTensor(A,"x","sigmoid");return s.ENGINE.runKernelFunc(function(M,P){var L=M.sigmoid(S);return P([L]),L},{x:S},function(M,P){var L=P[0];return{x:function(){return M.mul(L.mul(O.scalar(1).sub(L)))}}},"Sigmoid")}}),i.sign=g.op({sign_:function(A){var S=h.convertToTensor(A,"x","sign");return s.ENGINE.runKernelFunc(function(M){return M.sign(S)},{$x:S},function(M){return{$x:function(){return O.zerosLike(M)}}})}}),i.isNaN=g.op({isNaN_:function(A){var S=h.convertToTensor(A,"x","isNaN");return s.ENGINE.runKernelFunc(function(M){return M.isNaN(S)},{$x:S},function(M){return{$x:function(){return O.zerosLike(M)}}})}}),i.isInf=g.op({isInf_:function(A){var S=h.convertToTensor(A,"x","isInf");return s.ENGINE.runKernelFunc(function(M){return M.isInf(S)},{$x:S},function(M){return{$x:function(){return O.zerosLike(M)}}})}}),i.isFinite=g.op({isFinite_:function(A){var S=h.convertToTensor(A,"x","is
8860Finite");return s.ENGINE.runKernelFunc(function(M){return M.isFinite(S)},{$x:S},function(M){return{$x:function(){return O.zerosLike(M)}}})}}),i.sin=g.op({sin_:function(A){var S=h.convertToTensor(A,"x","sin"),M=[S];return s.ENGINE.runKernelFunc(function(P,L){var V=P.sin(S);return L([S]),V},{x:S},function(P,L){var V=L[0];return{x:function(){return V.toFloat().cos().mul(P)}}},"Sin",{},M)}}),i.sinh=g.op({sinh_:function(A){var S=h.convertToTensor(A,"x","sinh");return s.ENGINE.runKernelFunc(function(M,P){var L=M.sinh(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return L.toFloat().cosh().mulStrict(M)}}})}}),i.softplus=g.op({softplus_:function(A){var S=h.convertToTensor(A,"x","softplus");return s.ENGINE.runKernelFunc(function(M,P){var L=M.softplus(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.mul(L.sigmoid())}}})}}),i.sqrt=g.op({sqrt_:function(A){var S=h.convertToTensor(A,"x","sqrt");return s.ENGINE.runKernelFunc(function(M,P){var L=M.sqrt(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.div(L.toFloat().sqrt().mul(2))}}})}}),i.step=g.op({step_:function(A,S){S===void 0&&(S=0);var M=h.convertToTensor(A,"x","step");return s.ENGINE.runKernelFunc(function(P){return P.step(M,S)},{$x:M},function(P){return{$x:function(){return O.zerosLike(P)}}})}}),i.tan=g.op({tan_:function(A){var S=h.convertToTensor(A,"x","tan");return s.ENGINE.runKernelFunc(function(M,P){var L=M.tan(S);return P([S]),L},{$x:S},function(M,P){var L=P[0];return{$x:function(){return M.div(L.cos().square())}}})}}),i.tanh=g.op({tanh_:function(A){var S=h.convertToTensor(A,"x","tanh");return s.ENGINE.runKernelFunc(function(M,P){var L=M.tanh(S);return P([L]),L},{x:S},function(M,P){var L=P[0];return{x:function(){return O.scalar(1).sub(L.square()).mulStrict(M)}}},"Tanh",{},null,[!0])}})},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});/** 8861 * @license 8862 * Copyright 2018 Google LLC. All Rights Reserved. 8863 * Licensed under the Apache License, Version 2.0 (the "License"); 8864 * you may not use this file except in compliance with the License. 8865 * You may obtain a copy of the License at 8866 * 8867 * http://www.apache.org/licenses/LICENSE-2.0 8868 * 8869 * Unless required by applicable law or agreed to in writing, software 8870 * distributed under the License is distributed on an "AS IS" BASIS, 8871 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8872 * See the License for the specific language governing permissions and 8873 * limitations under the License. 8874 * ============================================================================= 8875 */var s=n(25),h=n(29),v=n(21),g=n(28);i.complex=g.op({complex_:function(O,A){var S=h.convertToTensor(O,"real","complex"),M=h.convertToTensor(A,"imag","complex");return v.assertShapesMatch(S.shape,M.shape,"real and imag shapes, "+S.shape+" and "+M.shape+", must match in call to tf.complex()."),s.ENGINE.runKernelFunc(function(P){return P.complex(S,M)},{$real:S,$imag:M})}}),i.real=g.op({real_:function(O){var A=h.convertToTensor(O,"input","real");return s.ENGINE.runKernelFunc(function(S){return S.real(A)},{$input:A})}}),i.imag=g.op({imag_:function(O){var A=h.convertToTensor(O,"input","imag");return s.ENGINE.runKernelFunc(function(S){return S.imag(A)},{$input:A})}})},function(a,i,n){/** 8876* @license 8877* Copyright 2018 Google Inc. All Rights Reserved. 8878* Licensed under the Apache License, Version 2.0 (the "License"); 8879* you may not use this file except in compliance with the License. 8880* You may obtain a copy of the License at 8881* 8882* http://www.apache.org/licenses/LICENSE-2.0 8883* 8884* Unless required by applicable law or agreed to in writing, software 8885* distributed under the License is distributed on an "AS IS" BASIS, 8886* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8887* See the License for the specific language governing permissions and 8888* limitations under the License. 8889* ============================================================================= 8890*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(74),v=n(29),g=n(21),O=n(206),A=n(147),S=n(28),M=n(91),P=n(372);i.addStrict=S.op({addStrict_:function(L,V){var N=v.convertToTensor(L,"a","addStrict"),ee=v.convertToTensor(V,"b","addStrict");return g.assertShapesMatch(N.shape,ee.shape,"Error in addStrict: "),N.add(ee)}}),i.atan2=S.op({atan2_:function(L,V){var N,ee=v.convertToTensor(L,"a","atan2"),J=v.convertToTensor(V,"b","atan2");N=h.makeTypesMatch(ee,J),ee=N[0],J=N[1];
8890var K=A.assertAndGetBroadcastShape(ee.shape,J.shape);return s.ENGINE.runKernelFunc(function(re,ce){var pe=re.atan2(ee,J);return ce([ee,J]),pe},{$a:ee,$b:J},function(re,ce){var pe=ce[0],ke=ce[1];return{$a:function(){var Ce=O.add(pe.square(),ke.square()),be=re.mul(ke.div(Ce)),$e=A.getReductionAxes(pe.shape,K);return $e.length>0&&(be=be.sum($e)),be.reshape(pe.shape)},$b:function(){var Ce=O.add(pe.square(),ke.square()),be=P.neg(re.mul(pe.div(Ce))),$e=A.getReductionAxes(ke.shape,K);return $e.length>0&&(be=be.sum($e)),be.reshape(ke.shape)}}})}}),i.divStrict=S.op({divStrict_:function(L,V){var N=v.convertToTensor(L,"a","div"),ee=v.convertToTensor(V,"b","div");return g.assertShapesMatch(N.shape,ee.shape,"Error in divideStrict: "),N.div(ee)}}),i.floorDiv=S.op({floorDiv_:function(L,V){var N,ee=v.convertToTensor(L,"a","floorDiv"),J=v.convertToTensor(V,"b","floorDiv");N=h.makeTypesMatch(ee,J),ee=N[0],J=N[1];var K=A.assertAndGetBroadcastShape(ee.shape,J.shape);return s.ENGINE.runKernelFunc(function(re,ce){var pe=re.floorDiv(ee,J);return ce([ee,J]),pe},{a:ee,b:J},function(re,ce){var pe=ce[0],ke=ce[1];return{a:function(){var Ce=re.div(ke.toFloat()),be=A.getReductionAxes(pe.shape,K);return be.length>0?Ce.sum(be).reshape(pe.shape):Ce},b:function(){var Ce=re.mul(pe.toFloat()),be=A.getReductionAxes(ke.shape,K);be.length>0&&(Ce=Ce.sum(be).reshape(ke.shape));var $e=ke.square();return Ce.div($e.toFloat()).neg()}}},"FloorDiv")}}),i.maximum=S.op({maximum_:function(L,V){var N,ee=v.convertToTensor(L,"a","maximum"),J=v.convertToTensor(V,"b","maximum");return N=h.makeTypesMatch(ee,J),ee=N[0],J=N[1],ee.dtype==="bool"&&(ee=ee.toInt(),J=J.toInt()),A.assertAndGetBroadcastShape(ee.shape,J.
8890shape),s.ENGINE.runKernelFunc(function(K,re){var ce=K.maximum(ee,J);return re([ee,J]),ce},{a:ee,b:J},function(K,re){var ce=re[0],pe=re[1];return{a:function(){return K.mul(ce.greaterEqual(pe).toFloat())},b:function(){return K.mul(ce.less(pe).toFloat())}}},"Maximum")}}),i.maximumStrict=S.op({maximumStrict_:function(L,V){var N=v.convertToTensor(L,"a","maximumStrict"),ee=v.convertToTensor(V,"b","maximumStrict");return g.assertShapesMatch(N.shape,ee.shape,"Error in maximumStrict: "),N.maximum(ee)}}),i.minimum=S.op({minimum_:function(L,V){var N,ee=v.convertToTensor(L,"a","minimum"),J=v.convertToTensor(V,"b","minimum");return N=h.makeTypesMatch(ee,J),ee=N[0],J=N[1],ee.dtype==="bool"&&(ee=ee.toInt(),J=J.toInt()),A.assertAndGetBroadcastShape(ee.shape,J.shape),s.ENGINE.runKernelFunc(function(K,re){var ce=K.minimum(ee,J);return re([ee,J]),ce},{a:ee,b:J},function(K,re){var ce=re[0],pe=re[1];return{a:function(){return K.mul(ce.lessEqual(pe).toFloat())},b:function(){return K.mul(ce.greater(pe).toFloat())}}},"Minimum")}}),i.minimumStrict=S.op({minimumStrict_:function(L,V){var N=v.convertToTensor(L,"a","minimumStrict"),ee=v.convertToTensor(V,"b","minimumStrict");return g.assertShapesMatch(N.shape,ee.shape,"Error in minimumStrict: "),N.minimum(ee)}}),i.mod=S.op({mod_:function(L,V){var N,ee=v.convertToTensor(L,"a","mod"),J=v.convertToTensor(V,"b","mod");N=h.makeTypesMatch(ee,J),ee=N[0],J=N[1];
8890var K=A.assertAndGetBroadcastShape(ee.shape,J.shape);return s.ENGINE.runKernelFunc(function(re,ce){var pe=re.mod(ee,J);return ce([ee,J]),pe},{$a:ee,$b:J},function(re,ce){var pe=ce[0],ke=ce[1];return{$a:function(){var Ce=A.getReductionAxes(pe.shape,K);return Ce.length>0?re.sum(Ce).reshape(pe.shape):re},$b:function(){var Ce=re.mul(pe.div(ke).floor().neg()),be=A.getReductionAxes(ke.shape,K);return be.length>0?Ce.sum(be).reshape(ke.shape):Ce}}})}}),i.modStrict=S.op({modStrict_:function(L,V){var N=v.convertToTensor(L,"a","modStrict"),ee=v.convertToTensor(V,"b","modStrict");return g.assertShapesMatch(N.shape,ee.shape,"Error in modStrict: "),N.mod(ee)}}),i.mul=S.op({mul_:function(L,V){var N,ee=v.convertToTensor(L,"a","mul"),J=v.convertToTensor(V,"b","mul");N=h.makeTypesMatch(ee,J),ee=N[0],J=N[1];var K=A.assertAndGetBroadcastShape(ee.shape,J.shape);return s.ENGINE.runKernelFunc(function(re,ce){var pe=re.multiply(ee,J);return ce([ee,J]),pe},{a:ee,b:J},function(re,ce){var pe=ce[0],ke=ce[1];return{a:function(){var Ce=re.mul(ke.toFloat()),be=A.getReductionAxes(pe.shape,K);return be.length>0?Ce.sum(be).reshape(pe.shape):Ce},b:function(){var Ce=re.mul(pe.toFloat()),be=A.getReductionAxes(ke.shape,K);return be.length>0?Ce.sum(be).reshape(ke.shape):Ce}}},"Mul")}}),i.mulStrict=S.op({mulStrict_:function(L,V){var N=v.convertToTensor(L,"a","mul"),ee=v.convertToTensor(V,"b","mul");return g.assertShapesMatch(N.shape,ee.shape,"Error in multiplyStrict: "),N.mul(ee)}}),i.pow=S.op({pow_:function(L,V){var N,ee=v.convertToTensor(L,"base","pow"),J=v.convertToTensor(V,"exp","pow");N=h.makeTypesMatch(ee,J),ee=N[0],J=N[1];
8890var K=A.assertAndGetBroadcastShape(ee.shape,J.shape),re=[ee,J];return s.ENGINE.runKernelFunc(function(ce,pe){var ke=ce.pow(ee,J);return pe([ee,J,ke]),ke},{a:ee,b:J},function(ce,pe){var ke=pe[0],Ce=pe[1],be=pe[2];return{a:function(){var $e=Ce.toFloat(),ht=ce.mul($e.mul(ke.pow($e.sub(M.scalar(1))))),Dt=A.getReductionAxes(ke.shape,K);return Dt.length>0&&(ht=ht.sum(Dt)),ht.reshape(ke.shape)},b:function(){var $e=ke.greater(0),ht=ke.log().where($e,M.zerosLike(ke)),Dt=ce.mul(be.mul(ht)),Ut=A.getReductionAxes(Ce.shape,K);return Ut.length>0&&(Dt=Dt.sum(Ut)),Dt.reshape(Ce.shape)}}},"Pow",{},re,[!0])}}),i.powStrict=S.op({powStrict_:function(L,V){return g.assertShapesMatch(L.shape,V.shape,"Error in powStrict: "),L.pow(V)}}),i.squaredDifferenceStrict=S.op({squaredDifferenceStrict_:function(L,V){var N=v.convertToTensor(L,"a","squaredDifferenceStrict"),ee=v.convertToTensor(V,"b","squaredDifferenceStrict");return g.assertShapesMatch(N.shape,ee.shape,"Error in squaredDifferenceStrict: "),N.squaredDifference(ee)}}),i.sub=S.op({sub_:function(L,V){var N,ee=v.convertToTensor(L,"a","sub"),J=v.convertToTensor(V,"b","sub");N=h.makeTypesMatch(ee,J),ee=N[0],J=N[1];
8890var K=A.assertAndGetBroadcastShape(ee.shape,J.shape);return s.ENGINE.runKernelFunc(function(re){return re.subtract(ee,J)},{a:ee,b:J},function(re){return{a:function(){var ce=re,pe=A.getReductionAxes(ee.shape,K);return pe.length>0&&(ce=ce.sum(pe)),ce.reshape(ee.shape)},b:function(){var ce=re,pe=A.getReductionAxes(J.shape,K);return pe.length>0&&(ce=ce.sum(pe)),ce.neg().reshape(J.shape)}}},"Sub")}}),i.subStrict=S.op({subStrict_:function(L,V){var N=v.convertToTensor(L,"a","subStrict"),ee=v.convertToTensor(V,"b","subStrict");return g.assertShapesMatch(N.shape,ee.shape,"Error in subStrict: "),N.sub(ee)}})},function(a,i,n){/** 8891* @license 8892* Copyright 2020 Google LLC. All Rights Reserved. 8893* Licensed under the Apache License, Version 2.0 (the "License"); 8894* you may not use this file except in compliance with the License. 8895* You may obtain a copy of the License at 8896* 8897* http://www.apache.org/licenses/LICENSE-2.0 8898* 8899* Unless required by applicable law or agreed to in writing, software 8900* distributed under the License is distributed on an "AS IS" BASIS, 8901* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8902* See the License for the specific language governing permissions and 8903* limitations under the License. 8904* ============================================================================= 8905*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(205);n(33).Tensor.prototype.div=function(h){return s.div(this,h)}},function(a,i,n){/** 8906* @license 8907* Copyright 2020 Google Inc. All Rights Reserved. 8908* Licensed under the Apache License, Version 2.0 (the "License"); 8909* you may not use this file except in compliance with the License. 8910* You may obtain a copy of the License at 8911* 8912* http://www.apache.org/licenses/LICENSE-2.0 8913* 8914* Unless required by applicable law or agreed to in writing, software 8915* distributed under the License is distributed on an "AS IS" BASIS, 8916* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8917* See the License for the specific language governing permissions and 8918* limitations under the License. 8919* ============================================================================= 8920*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(25),h=n(73),v=n(29),g=n(28);i.broadcastTo=g.op({broadcastTo_:function(O,A){var S=v.convertToTensor(O,"broadcastTo","x"),M=S.shape;if(A.some(function(re){return!(re>0)||re%1!=0}))throw new Error("broadcastTo(): Invalid broadcast shape ["+A+"].");if(A.length<S.rank)throw new Error("broadcastTo(): shape.length="+A.length+" < input.rank="+S.rank+".");if(A.length>S.rank){for(var P=S.shape.slice();P.length<A.length;)P.unshift(1);S=S.reshape(P)}for(var L=S.shape,V=Array.from(A),N=A.length-1;N>=0;N--)if(L[N]===A[N])V[N]=1;else if(S.shape[N]!==1)throw new Error("broadcastTo(): ["+M+"] cannot be broadcast to ["+A+"].");var ee=V.map(function(re,ce){return re>1?ce:-1}).filter(function(re){return re>=0});if(ee.length===0)return S.clone();var J={x:S},K={shape:A,inputShape:L};return s.ENGINE.runKernelFunc(function(re){return re.tile(S,V)},J,function(re){return{x:function(){return re.sum(ee,!0)}}},h.BroadcastTo,K)}})},function(a,i,n){/** 8921* @license 8922* Copyright 2020 Google LLC. All Rights Reserved. 8923* Licensed under the Apache License, Version 2.0 (the "License"); 8924* you may not use this file except in compliance with the License. 8925* You may obtain a copy of the License at 8926* 8927* http://www.apache.org/licenses/LICENSE-2.0 8928* 8929* Unless required by applicable law or agreed to in writing, software 8930* distributed under the License is distributed on an "AS IS" BASIS, 8931* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8932* See the License for the specific language governing permissions and 8933* limitations under the License. 8934* ============================================================================= 8935*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(376);n(33).Tensor.prototype.broadcastTo=function(h){return s.broadcastTo(this,h)}},function(a,i,n){/** 8936* @license 8937* Copyright 2017 Google Inc. All Rights Reserved. 8938* Licensed under the Apache License, Version 2.0 (the "License");
8939* you may not use this file except in compliance with the License. 8940* You may obtain a copy of the License at 8941* 8942* http://www.apache.org/licenses/LICENSE-2.0 8943* 8944* Unless required by applicable law or agreed to in writing, software 8945* distributed under the License is distributed on an "AS IS" BASIS, 8946* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8947* See the License for the specific language governing permissions and 8948* limitations under the License. 8949* ============================================================================= 8950*/var s,h,v,g;Object.defineProperty(i,"__esModule",{value:!0}),function(S){S.R0="R0",S.R1="R1",S.R2="R2",S.R3="R3",S.R4="R4",S.R5="R5",S.R6="R6"}(i.Rank||(i.Rank={})),function(S){S.float32="float32",S.int32="int32",S.bool="int32",S.complex64="complex64"}(s||(s={})),function(S){S.float32="float32",S.int32="int32",S.bool="bool",S.complex64="complex64"}(h||(h={})),function(S){S.float32="float32",S.int32="float32",S.bool="float32",S.complex64="complex64"}(v||(v={})),function(S){S.float32="complex64",S.int32="complex64",S.bool="complex64",S.complex64="complex64"}(g||(g={}));var O={float32:v,int32:s,bool:h,complex64:g};function A(S,M){if(S==="string"||M==="string"){if(S==="string"&&M==="string")return"string";throw new Error("Can not upcast "+S+" with "+M)}return O[S][M]}i.upcastType=A,i.sumOutType=function(S){return A(S,"int32")}},function(a,i,n){/** 8951* @license 8952* Copyright 2018 Google LLC. All Rights Reserved. 8953* Licensed under the Apache License, Version 2.0 (the "License"); 8954* you may not use this file except in compliance with the License. 8955* You may obtain a copy of the License at 8956* 8957* http://www.apache.org/licenses/LICENSE-2.0 8958* 8959* Unless required by applicable law or agreed to in writing, software 8960* distributed under the License is distributed on an "AS IS" BASIS, 8961* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8962* See the License for the specific language governing permissions and 8963* limitations under the License. 8964* ============================================================================= 8965*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(21),h=20,v=3,g=7;function O(M,P,L){var V;return V=Array.isArray(M)?parseFloat(M[0].toFixed(g))+" + "+parseFloat(M[1].toFixed(g))+"j":s.isString(M)?"'"+M+"'":L==="bool"?A(M):parseFloat(M.toFixed(g)).toString(),s.rightPad(V,P)}function A(M){return M===0?"false":"true"}function S(M){for(var P=[],L=0;L<M.length;L+=2)P.push([M[L],M[L+1]]);return P}i.tensorToString=function(M,P,L,V){var N=s.computeStrides(P),ee=function(ce,pe,ke,Ce){var be=s.sizeFromShape(pe),$e=Ce[Ce.length-1],ht=new Array($e).fill(0),Dt=pe.length,Ut=ke==="complex64"?S(ce):ce;if(Dt>1)for(var Ee=0;Ee<be/$e;Ee++)for(var Ot=Ee*$e,zt=0;zt<$e;zt++)ht[zt]=Math.max(ht[zt],O(Ut[Ot+zt],0,ke).length);return ht}(M,P,L,N),J=P.length,K=function ce(pe,ke,Ce,be,$e,ht){ht===void 0&&(ht=!0);var Dt=Ce==="complex64"?2:1,Ut=ke[0],Ee=ke.length;if(Ee===0){if(Ce==="complex64"){var Ot=S(pe);
8965return[O(Ot[0],0,Ce)]}return Ce==="bool"?[A(pe[0])]:[pe[0].toString()]}if(Ee===1){if(Ut>h){var zt=v*Dt,Mt=Array.from(pe.slice(0,zt)),Ke=Array.from(pe.slice((Ut-v)*Dt,Ut*Dt));return Ce==="complex64"&&(Mt=S(Mt),Ke=S(Ke)),["["+Mt.map(function(Yt,We){return O(Yt,$e[We],Ce)}).join(", ")+", ..., "+Ke.map(function(Yt,We){return O(Yt,$e[Ut-v+We],Ce)}).join(", ")+"]"]}var Tt=Ce==="complex64"?S(pe):Array.from(pe);return["["+Tt.map(function(Yt,We){return O(Yt,$e[We],Ce)}).join(", ")+"]"]}var vt=ke.slice(1),yt=be.slice(1),bt=be[0]*Dt,Ht=[];if(Ut>h){for(var _t=0;_t<v;_t++){var Ze=_t*bt,Vt=Ze+bt;Ht.push.apply(Ht,ce(pe.slice(Ze,Vt),vt,Ce,yt,$e,!1))}Ht.push("...");for(var _t=Ut-v;_t<Ut;_t++){var Ze=_t*bt,Vt=Ze+bt;Ht.push.apply(Ht,ce(pe.slice(Ze,Vt),vt,Ce,yt,$e,_t===Ut-1))}}else for(var _t=0;_t<Ut;_t++){var Ze=_t*bt,Vt=Ze+bt;Ht.push.apply(Ht,ce(pe.slice(Ze,Vt),vt,Ce,yt,$e,_t===Ut-1))}var sn=Ee===2?",":"";Ht[0]="["+Ht[0]+sn;for(var _t=1;_t<Ht.length-1;_t++)Ht[_t]=" "+Ht[_t]+sn;for(var yn=`, 8966`,_t=2;_t<Ee;_t++)yn+=` 8967`;return Ht[Ht.length-1]=" "+Ht[Ht.length-1]+"]"+(ht?"":yn),Ht}(M,P,L,N,ee),re=["Tensor"];return V&&(re.push(" dtype: "+L),re.push(" rank: "+J),re.push(" shape: ["+P+"]"),re.push(" values:")),re.push(K.map(function(ce){return" "+ce}).join(` 8968`)),re.join(` 8969`)}},function(a,i,n){/** 8970* @license 8971* Copyright 2017 Google Inc. All Rights Reserved. 8972* Licensed under the Apache License, Version 2.0 (the "License"); 8973* you may not use this file except in compliance with the License. 8974* You may obtain a copy of the License at 8975* 8976* http://www.apache.org/licenses/LICENSE-2.0 8977* 8978* Unless required by applicable law or agreed to in writing, software 8979* distributed under the License is distributed on an "AS IS" BASIS, 8980* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8981* See the License for the specific language governing permissions and 8982* limitations under the License. 8983* ============================================================================= 8984*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(21);i.getFilteredNodesXToY=function(h,v,g){for(var O={},A={},S=0;S<v.length;S++)O[v[S].id]=!0;for(S=0;S<h.length;S++){var M=(re=h[S]).inputs;for(var P in M){for(var L=M[P],V=!1,N=0;N<v.length;N++)if(O[L.id]){re.outputs.forEach(function(Ce){return O[Ce.id]=!0}),V=!0,A[re.id]=!0;break}if(V)break}}var ee={};ee[g.id]=!0;var J={};for(S=h.length-1;S>=0;S--)for(M=(re=h[S]).inputs,N=0;N<re.outputs.length;N++)if(ee[re.outputs[N].id]){for(var P in M)ee[M[P].id]=!0,J[re.id]=!0;break}var K=[];for(S=0;S<h.length;S++){var re;if(A[(re=h[S]).id]&&J[re.id]){var ce={};for(var P in re.inputs){var pe=re.inputs[P];O[pe.id]&&(ce[P]=pe)}var ke=Object.assign({},re);ke.inputs=ce,ke.outputs=re.outputs,K.push(ke)}}return K},i.backpropagateGradients=function(h,v,g){for(var O=function(S){var M=v[S],P=[];if(M.outputs.forEach(function(ee){var J=h[ee.id];J!=null?P.push(J):P.push(null)}),M.gradient==null)throw new Error("Cannot compute gradient: gradient function not found for "+M.kernelName+".");var L=M.gradient(P),V=function(ee){if(!(ee in L))throw new Error("Cannot backprop through input "+ee+". Available gradients found: "+Object.keys(L)+".");var J=g(function(){return L[ee]()});if(J.dtype!=="float32")throw new Error("Error in gradient for op "+M.kernelName+". The gradient of input "+ee+" must have 'float32' dtype, but has '"+J.dtype+"'");var K=M.inputs[ee];if(!s.arraysEqual(J.shape,K.shape))throw new Error("Error in gradient for op "+M.kernelName+". The gradient of input '"+ee+"' has shape '"+J.shape+"', which does not match the shape of the input '"+K.shape+"'");if(h[K.id]==null)h[K.id]=J;else{var re=h[K.id];h[K.id]=re.add(J),re.dispose()}};for(var N in M.inputs)V(N)},A=v.length-1;A>=0;A--)O(A)}},function(a,i,n){/** 8985* @license 8986* Copyright 2018 Google Inc. All Rights Reserved. 8987* Licensed under the Apache License, Version 2.0 (the "License"); 8988* you may not use this file except in compliance with the License. 8989* You may obtain a copy of the License at 8990* 8991* http://www.apache.org/licenses/LICENSE-2.0 8992* 8993* Unless required by applicable law or agreed to in writing, softw
8993are 8994* distributed under the License is distributed on an "AS IS" BASIS, 8995* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8996* See the License for the specific language governing permissions and 8997* limitations under the License. 8998* ============================================================================= 8999*/Object.defineProperty(i,"__esModule",{value:!0});var s=n(21),h=function(){function O(A,S){this.backendTimer=A,this.logger=S,S==null&&(this.logger=new g)}return O.prototype.profileKernel=function(A,S,M){var P,L=this,V=this.backendTimer.time(function(){P=M()});return P.forEach(function(N){N.data().then(function(ee){v(ee,N.dtype,A),V.then(function(J){var K="";J.getExtraProfileInfo!=null&&(K=J.getExtraProfileInfo()),L.logger.logKernelProfile(A,N,ee,J.kernelMs,S,K)})})}),P},O}();function v(O,A,S){if(A!=="float32")return!1;for(var M=0;M<O.length;M++){var P=O[M];if(isNaN(P)||!isFinite(P))return console.warn("Found "+P+" in the result of '"+S+"'"),!0}return!1}i.Profiler=h,i.checkComputationForErrors=v;var g=function(){function O(){}return O.prototype.logKernelProfile=function(A,S,M,P,L,V){var N=typeof P=="number"?s.rightPad(P+"ms",9):P.error,ee=s.rightPad(A,25),J=S.rank,K=S.size,re=s.rightPad(S.shape.toString(),14),ce="";for(var pe in L){var ke=L[pe].shape||S.shape,Ce=ke.length;ce+=pe+": "+Ce+"D "+(Ce>0?ke:"")+" "}console.log("%c"+ee+" %c"+N+" %c"+J+"D "+re+" %c"+K+" %c"+ce+" %c"+V,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},O}();i.Logger=g},function(a,i,n){/** 9000* @license 9001* Copyright 2019 Google LLC. All Rights Reserved. 9002* Licensed under the Apache License, Version 2.0 (the "License"); 9003* you may not use this file except in compliance with the License. 9004* You may obtain a copy of the License at 9005* 9006* http://www.apache.org/licenses/LICENSE-2.0 9007* 9008* Unless required by applicable law or agreed to in writing, software 9009* distributed under the License is distributed on an "AS IS" BASIS, 9010* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9011* See the License for the specific language governing permissions and 9012* limitations under the License. 9013* ============================================================================= 9014*/Object.defineProperty(i,"__esModule",{value:!0});var s=new Map,h=new Map;function v(g,O){return O+"_"+g}i.getKernel=function(g,O){var A=v(g,O);return s.get(A)},i.getGradient=function(g){return h.get(g)},i.getKernelsForBackend=function(g){for(var O=s.entries(),A=[];;){var S=O.next(),M=S.done,P=S.value;if(M)break;var L=P[0],V=P[1];L.split("_")[0]===g&&A.push(V)}return A},i.registerKernel=function(g){var O=g.kernelName,A=g.backendName,S=v(O,A);if(s.has(S))throw new Error("The kernel '"+O+"' for backend '"+A+"' is already registered");s.set(S,g)},i.registerGradient=function(g){var O=g.kernelName;h.has(O)&&console.warn("Overriding the gradient for '"+O+"'"),h.set(O,g)},i.unregisterKernel=function(g,O){var A=v(g,O);if(!s.has(A))throw new Error("The kernel '"+g+"' for backend '"+O+"' is not registered");s.delete(A)},i.unregisterGradient=function(g){if(!h.has(g))throw new Error("The gradient '"+g+"' for backend is not registered");h.delete(g)}},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0});/** 9015 * @license 9016 * Copyright 2020 Google LLC. All Rights Reserved. 9017 * Licensed under the Apache License, Version 2.0 (the "License"); 9018 * you may not use this file except in compliance with the License. 9019 * You may obtain a copy of the License at 9020 * 9021 * http://www.apache.org/licenses/LICENSE-2.0 9022 * 9023 * Unless required by applicable law or agreed to in writing, software 9024 * distributed under the License is distributed on an "AS IS" BASIS, 9025 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9026 * See the License for the specific language governing permissions and 9027 * limitations under the License. 9028 * ============================================================================= 9029 */var s=n(206);n(33).Tensor.prototype.add=function(h){return s.add(this,h)}},function(a,i,n){Object.defineProperty(i,"__esModule",{value:!0}),n(383),n(377),n(375),n(371),n(363),n(361),n(359),n(357),n(355),n(353)},function(a,i){},function(a,i){},function(a,i){},function(a,i){},function(a,i){},function(a,i){},function(a,i,n){(function(s,h){(function(v,g){if(!v.setImmediate){var O,A=1,S={},M=!1,P=v.document,L=Object.getPrototypeOf&&Object.getPrototypeOf(v);L=L&&L.setTimeout?L:v,{}.toString.call(v.process)==="[object process]"?O=function(ee){h.nextTick(function(){N(ee)})}:function(){if(v.postMessage&&!v.importScripts){var ee=!0,J=v.onmessage;return v.onmessage=function(){ee=!1},v.postMessage("","*"),v.onmessage=J,ee}}()?function(){var ee="setImmediate$"+Math.random()+"$",J=function(K){K.source===v&&typeof K.data=="str
9029ing"&&K.data.indexOf(ee)===0&&N(+K.data.slice(ee.length))};v.addEventListener?v.addEventListener("message",J,!1):v.attachEvent("onmessage",J),O=function(K){v.postMessage(ee+K,"*")}}():v.MessageChannel?function(){var ee=new MessageChannel;ee.port1.onmessage=function(J){N(J.data)},O=function(J){ee.port2.postMessage(J)}}():P&&"onreadystatechange"in P.createElement("script")?function(){var ee=P.documentElement;O=function(J){var K=P.createElement("script");K.onreadystatechange=function(){N(J),K.onreadystatechange=null,ee.removeChild(K),K=null},ee.appendChild(K)}}():O=function(ee){setTimeout(N,0,ee)},L.setImmediate=function(ee){typeof ee!="function"&&(ee=new Function(""+ee));for(var J=new Array(arguments.length-1),K=0;K<J.length;K++)J[K]=arguments[K+1];var re={callback:ee,args:J};return S[A]=re,O(A),A++},L.clearImmediate=V}function V(ee){delete S[ee]}function N(ee){if(M)setTimeout(N,0,ee);else{var J=S[ee];if(J){M=!0;try{(function(K){var re=K.callback,ce=K.args;switch(ce.length){case 0:re();break;case 1:re(ce[0]);break;case 2:re(ce[0],ce[1]);break;case 3:re(ce[0],ce[1],ce[2]);break;default:re.apply(g,ce)}})(J)}finally{V(ee),M=!1}}}}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,n(59),n(75))},function(a,i){var n={}.toString;a.exports=Array.isArray||function(s){return n.call(s)=="[object Array]"}},function(a,i){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */i.read=function(n,s,h,v,g){var O,A,S=8*g-v-1,M=(1<<S)-1,P=M>>1,L=-7,V=h?g-1:0,N=h?-1:1,ee=n[s+V];for(V+=N,O=ee&(1<<-L)-1,ee>>=-L,L+=S;L>0;O=256*O+n[s+V],V+=N,L-=8);for(A=O&(1<<-L)-1,O>>=-L,L+=v;L>0;A=256*A+n[s+V],V+=N,L-=8);if(O===0)O=1-P;else{if(O===M)return A?NaN:1/0*(ee?-1:1);A+=Math.pow(2,v),O-=P}return(ee?-1:1)*A*Math.pow(2,O-v)},i.write=function(n,s,h,v,g,O){var A,S,M,P=8*O-g-1,L=(1<<P)-1,V=L>>1,N=g===23?Math.pow(2,-24)-Math.pow(2,-77):0,ee=v?0:O-1,J=v?1:-1,K=s<0||s===0&&1/s<0?1:0;for(s=Math.abs(s),isNaN(s)||s===1/0?(S=isNaN(s)?1:0,A=L):(A=Math.floor(Math.log(s)/Math.LN2),s*(M=Math.pow(2,-A))<1&&(A--,M*=2),(s+=A+V>=1?N/M:N*Math.pow(2,1-V))*M>=2&&(A++,M/=2),A+V>=L?(S=0,A=L):A+V>=1?(S=(s*M-1)*Math.pow(2,g),A+=V):(S=s*Math.pow(2,V-1)*Math.pow(2,g),A=0));g>=8;n[h+ee]=255&S,ee+=J,S/=256,g-=8);for(A=A<<g|S,P+=g;P>0;n[h+ee]=255&A,ee+=J,A/=256,P-=8);n[h+ee-J]|=128*K}},function(a,i,n){i.byteLength=function(L){var V=S(L),N=V[0],ee=V[1];return 3*(N+ee)/4-ee},i.toByteArray=function(L){var V,N,ee=S(L),J=ee[0],K=ee[1],re=new v(function(ke,Ce,be){return 3*(Ce+be)/4-be}(0,J,K)),ce=0,pe=K>0?J-4:J;for(N=0;N<pe;N+=4)V=h[L.charCodeAt(N)]<<18|h[L.charCodeAt(N+1)]<<12|h[L.charCodeAt(N+2)]<<6|h[L.charCodeAt(N+3)],re[ce++]=V>>16&255,re[ce++]=V>>8&255,re[ce++]=255&V;return K===2&&(V=h[L.charCodeAt(N)]<<2|h[L.charCodeAt(N+1)]>>4,re[ce++]=255&V),K===1&&(V=h[L.charCodeAt(N)]<<10|h[L.charCodeAt(N+1)]<<4|h[L.charCodeAt(N+2)]>>2,re[ce++]=V>>8&255,re[ce++]=255&V),re},i.fromByteArray=function(L){for(var V,N=L.length,ee=N%3,J=[],K=0,re=N-ee;K<re;K+=16383)J.push(P(L,K,K+16383>re?re:K+16383));return ee===1?(V=L[N-1],J.push(s[V>>2]+s[V<<4&63]+"==")):ee===2&&(V=(L[N-2]<<8)+L[N-1],J.push(s[V>>10]+s[V>>4&63]+s[V<<2&63]+"=")),J.join("")};for(var s=[],h=[],v=typeof Uint8Array<"u"?Uint8Array:Array,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",O=0,A=g.length;O<A;++O)s[O]=g[O],h[g.charCodeAt(O)]=O;function S(L){var V=L.length;if(V%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var N=L.indexOf("=");return N===-1&&(N=V),[N,N===V?0:4-N%4]}function M(L){return s[L>>18&63]+s[L>>12&63]+s[L>>6&63]+s[63&L]}function P(L,V,N){for(var ee,J=[],K=V;K<N;K+=3)ee=(L[K]<<16&16711680)+(L[K+1]<<8&65280)+(255&L[K+2]),J.push(M(ee));return J.join("")}h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},function(a,i){var n={}.hasOwnProperty;a.exports=function(s,h){return n.call(s,h)}},function(a,i){a.exports=function(n,s){return{enumerable:!(1&n),configurable:!(2&n),writable:!(4&n),value:s}}},function(a,i,n){var s=n(149);a.exports=function(h,v){if(!s(h))return h;var g,O;if(v&&typeof(g=h.toString)=="function"&&!s(O=g.call(h))||typeof(g=h.valueOf)=="function"&&!s(O=g.call(h))||!v&&typeof(g=h.toString)=="function"&&!s(O=g.call(h)))return O;throw TypeError("Can't convert object to primitive value")}},function(a,i,n){var s=n(149),h=n(150).document,v=s(h)&&s(h.createElement);a.exports=function(g){return v?h.createElement(g):{}}},function(a,i,n){a.exports=!n(148)&&!n(208)(function(){return Object.defineProperty(n(398)("div"),"a",{get:function(){return 7}}).a!=7})},function(a,i,n){var s=n(149);a.exports=function(h){if(!s(h))throw TypeError(h+" is not an object!");return h}},function(a,i,n){var s=n(400),h=n(399),v=n(397),g=Object.defineProperty;i.f=n(148)?Object.defineProperty:function(O,A,S){if(s(O),A=v(A,!0),s(S),h)try{return g(O,A,S)}catch{}if("get"in S||"set"in S)throw TypeError("Accessors not supported!");return"value"in S&&(O[A]=S.value),O}},function(a,i,n){var s=n(401),h=n(396);a.exports=n(148)?function(v,g,O){return s.f(v,g,h(1,O))}:function(v,g,O){return v[g]=O,v}},function(a,i){a.exports=function(n){if(typeof n!="function")throw TypeError(n+" is not a function!");return n}},function(a,i,n){var s=n(403);a.exports=function(h,v,g){if(s(h),v===void 0)return h;switch(g){case 1:return function(O){return h.call(v,O)};case 2:return function(O,A){return h.call(v,O,A)};case 3:return function(O,A,S){return h.call(v,O,A,S)}}return function(){return h.apply(v,arguments)}}},function(a,i,n){var s=n(150),h=n(209),v=n(404),g=n(402),O=n(395),A=function(S,M,P){var L,V,N,ee=S&A.F,J=S&A.G,K=S&A.S,re=S&A.P,ce=S&A.B,pe=S&A.W,ke=J?h:h[M]||(h[M]={}),Ce=ke.prototype,be=J?s:K?s[M]:(s[M]||{}).prototype;
9029for(L in J&&(P=M),P)(V=!ee&&be&&be[L]!==void 0)&&O(ke,L)||(N=V?be[L]:P[L],ke[L]=J&&typeof be[L]!="function"?P[L]:ce&&V?v(N,s):pe&&be[L]==N?function($e){var ht=function(Dt,Ut,Ee){if(this instanceof $e){switch(arguments.length){case 0:return new $e;case 1:return new $e(Dt);case 2:return new $e(Dt,Ut)}return new $e(Dt,Ut,Ee)}return $e.apply(this,arguments)};return ht.prototype=$e.prototype,ht}(N):re&&typeof N=="function"?v(Function.call,N):N,re&&((ke.virtual||(ke.virtual={}))[L]=N,S&A.R&&Ce&&!Ce[L]&&g(Ce,L,N)))};A.F=1,A.G=2,A.S=4,A.P=8,A.B=16,A.W=32,A.U=64,A.R=128,a.exports=A},function(a,i,n){var s=n(405);s(s.G,{global:n(150)})},function(a,i,n){n(406),a.exports=n(209).global},function(a,i,n){var s=function(h){var v,g=Object.prototype,O=g.hasOwnProperty,A=typeof Symbol=="function"?Symbol:{},S=A.iterator||"@@iterator",M=A.asyncIterator||"@@asyncIterator",P=A.toStringTag||"@@toStringTag";function L(yt,bt,Ht){return Object.defineProperty(yt,bt,{value:Ht,enumerable:!0,configurable:!0,writable:!0}),yt[bt]}try{L({},"")}catch{L=function(bt,Ht,_t){return bt[Ht]=_t}}function V(yt,bt,Ht,_t){var Ze=bt&&bt.prototype instanceof pe?bt:pe,Vt=Object.create(Ze.prototype),sn=new Ke(_t||[]);return Vt._invoke=function(yn,Yt,We){var Ye=ee;return function(He,dt){if(Ye===K)throw new Error("Generator is already running");if(Ye===re){if(He==="throw")throw dt;return vt()}for(We.method=He,We.arg=dt;;){var It=We.delegate;if(It){var ct=Ot(It,We);if(ct){if(ct===ce)continue;return ct}}if(We.method==="next")We.sent=We._sent=We.arg;else if(We.method==="throw"){if(Ye===ee)throw Ye=re,We.arg;We.dispatchException(We.arg)}else We.method==="return"&&We.abrupt("return",We.arg);Ye=K;var on=N(yn,Yt,We);if(on.type==="normal"){if(Ye=We.done?re:J,on.arg===ce)continue;return{value:on.arg,done:We.done}}on.type==="throw"&&(Ye=re,We.method="throw",We.arg=on.arg)}}}(yt,Ht,sn),Vt}function N(yt,bt,Ht){try{return{type:"normal",arg:yt.call(bt,Ht)}}catch(_t){return{type:"throw",arg:_t}}}h.wrap=V;var ee="suspendedStart",J="suspendedYield",K="executing",re="completed",ce={};function pe(){}function ke(){}function Ce(){}var be={};L(be,S,function(){return this});var $e=Object.getPrototypeOf,ht=$e&&$e($e(Tt([])));ht&&ht!==g&&O.call(ht,S)&&(be=ht);var Dt=Ce.prototype=pe.prototype=Object.create(be);function Ut(yt){["next","throw","return"].forEach(function(bt){L(yt,bt,function(Ht){return this._invoke(bt,Ht)})})}function Ee(yt,bt){var Ht;this._invoke=function(_t,Ze){function Vt(){return new bt(function(sn,yn){(function Yt(We,Ye,He,dt){var It=N(yt[We],yt,Ye);if(It.type!=="throw"){var ct=It.arg,on=ct.value;return on&&typeof on=="object"&&O.call(on,"__await")?bt.resolve(on.__await).then(function(Xt){Yt("next",Xt,He,dt)},function(Xt){Yt("throw",Xt,He,dt)}):bt.resolve(on).then(function(Xt){ct.value=Xt,He(ct)},function(Xt){return Yt("throw",Xt,He,dt)})}dt(It.arg)})(_t,Ze,sn,yn)})}return Ht=Ht?Ht.then(Vt,Vt):Vt()}}function Ot(yt,bt){var Ht=yt.iterator[bt.method];if(Ht===v){if(bt.delegate=null,bt.method==="throw"){if(yt.iterator.return&&(bt.method="return",bt.arg=v,Ot(yt,bt),bt.method==="throw"))return ce;bt.method="throw",bt.arg=new TypeError("The iterator does not provide a 'throw' method")}return ce}var _t=N(Ht,yt.iterator,bt.arg);
vendor: 4,306 bytes, line 9029
9029if(_t.type==="throw")return bt.method="throw",bt.arg=_t.arg,bt.delegate=null,ce;var Ze=_t.arg;return Ze?Ze.done?(bt[yt.resultName]=Ze.value,bt.next=yt.nextLoc,bt.method!=="return"&&(bt.method="next",bt.arg=v),bt.delegate=null,ce):Ze:(bt.method="throw",bt.arg=new TypeError("iterator result is not an object"),bt.delegate=null,ce)}function zt(yt){var bt={tryLoc:yt[0]};1 in yt&&(bt.catchLoc=yt[1]),2 in yt&&(bt.finallyLoc=yt[2],bt.afterLoc=yt[3]),this.tryEntries.push(bt)}function Mt(yt){var bt=yt.completion||{};bt.type="normal",delete bt.arg,yt.completion=bt}function Ke(yt){this.tryEntries=[{tryLoc:"root"}],yt.forEach(zt,this),this.reset(!0)}function Tt(yt){if(yt){var bt=yt[S];if(bt)return bt.call(yt);if(typeof yt.next=="function")return yt;if(!isNaN(yt.length)){var Ht=-1,_t=function Ze(){for(;++Ht<yt.length;)if(O.call(yt,Ht))return Ze.value=yt[Ht],Ze.done=!1,Ze;return Ze.value=v,Ze.done=!0,Ze};return _t.next=_t}}return{next:vt}}function vt(){return{value:v,done:!0}}return ke.prototype=Ce,L(Dt,"constructor",Ce),L(Ce,"constructor",ke),ke.displayName=L(Ce,P,"GeneratorFunction"),h.isGeneratorFunction=function(yt){var bt=typeof yt=="function"&&yt.constructor;return!!bt&&(bt===ke||(bt.displayName||bt.name)==="GeneratorFunction")},h.mark=function(yt){return Object.setPrototypeOf?Object.setPrototypeOf(yt,Ce):(yt.__proto__=Ce,L(yt,P,"GeneratorFunction")),yt.prototype=Object.create(Dt),yt},h.awrap=function(yt){return{__await:yt}},Ut(Ee.prototype),L(Ee.prototype,M,function(){return this}),h.AsyncIterator=Ee,h.async=function(yt,bt,Ht,_t,Ze){Ze===void 0&&(Ze=Promise);var Vt=new Ee(V(yt,bt,Ht,_t),Ze);return h.isGeneratorFunction(bt)?Vt:Vt.next().then(function(sn){return sn.done?sn.value:Vt.next()})},Ut(Dt),L(Dt,P,"Generator"),L(Dt,S,function(){return this}),L(Dt,"toString",function(){return"[object Generator]"}),h.keys=function(yt){var bt=[];for(var Ht in yt)bt.push(Ht);return bt.reverse(),function _t(){for(;bt.length;){var Ze=bt.pop();if(Ze in yt)return _t.value=Ze,_t.done=!1,_t}return _t.done=!0,_t}},h.values=Tt,Ke.prototype={constructor:Ke,reset:function(yt){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(Mt),!yt)for(var bt in this)bt.charAt(0)==="t"&&O.call(this,bt)&&!isNaN(+bt.slice(1))&&(this[bt]=v)},stop:function(){this.done=!0;var yt=this.tryEntries[0].completion;if(yt.type==="throw")throw yt.arg;return this.rval},dispatchException:function(yt){if(this.done)throw yt;var bt=this;function Ht(Yt,We){return Vt.type="throw",Vt.arg=yt,bt.next=Yt,We&&(bt.method="next",bt.arg=v),!!We}for(var _t=this.tryEntries.length-1;_t>=0;--_t){var Ze=this.tryEntries[_t],Vt=Ze.completion;if(Ze.tryLoc==="root")return Ht("end");if(Ze.tryLoc<=this.prev){var sn=O.call(Ze,"catchLoc"),yn=O.call(Ze,"finallyLoc");if(sn&&yn){if(this.prev<Ze.catchLoc)return Ht(Ze.catchLoc,!0);if(this.prev<Ze.finallyLoc)return Ht(Ze.finallyLoc)}else if(sn){if(this.prev<Ze.catchLoc)return Ht(Ze.catchLoc,!0)}else{if(!yn)throw new Error("try statement without catch or finally");if(this.prev<Ze.finallyLoc)return Ht(Ze.finallyLoc)}}}},abrupt:function(yt,bt){for(var Ht=this.tryEntries.length-1;Ht>=0;--Ht){var _t=this.tryEntries[Ht];if(_t.tryLoc<=this.prev&&O.call(_t,"finallyLoc")&&this.prev<_t.finallyLoc){var Ze=_t;break}}Ze&&(yt==="break"||yt==="continue")&&Ze.tryLoc<=bt&&bt<=Ze.finallyLoc&&(Ze=null);var Vt=Ze?Ze.completion:{};return Vt.type=yt,Vt.arg=bt,Ze?(this.method="next",this.next=Ze.finallyLoc,ce):this.complete(Vt)},complete:function(yt,bt){if(yt.type==="throw")throw yt.arg;return yt.type==="break"||yt.type==="continue"?this.next=yt.arg:yt.type==="return"?(this.rval=this.arg=yt.arg,this.method="return",this.next="end"):yt.type==="normal"&&bt&&(this.next=bt),ce},finish:function(yt){for(var bt=this.tryEntries.length-1;bt>=0;--bt){var Ht=this.tryEntries[bt];if(Ht.finallyLoc===yt)return this.complete(Ht.completion,Ht.afterLoc),Mt(Ht),ce}},catch:function(yt){for(var bt=this.tryEntries.length-1;bt>=0;--bt){var Ht=this.tryEntries[bt];if(Ht.tryLoc===yt){var _t=Ht.completion;if(_t.type==="throw"){var Ze=_t.arg;Mt(Ht)}return Ze}}throw new Error("illegal catch attempt")},delegateYield:function(yt,bt,Ht){return this.delegate={iterator:Tt(yt),resultName:bt,nextLoc:Ht},this.method==="next"&&(this.arg=v),ce}},h}
9029(a.exports);try{regeneratorRuntime=s}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=s:Function("r","regeneratorRuntime = r")(s)}},function(a,i,n){for(var s=n(155),h=n(82),v=n(38),g=n(16),O=n(42),A=n(96),S=n(19),M=S("iterator"),P=S("toStringTag"),L=A.Array,V={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},N=h(V),ee=0;ee<N.length;ee++){var J,K=N[ee],re=V[K],ce=g[K],pe=ce&&ce.prototype;if(pe&&(pe[M]||O(pe,M,L),pe[P]||O(pe,P,K),A[K]=L,re))for(J in s)pe[J]||v(pe,J,s[J],!0)}},function(a,i,n){var s=n(8),h=n(152);s(s.G+s.B,{setImmediate:h.set,clearImmediate:h.clear})},function(a,i,n){var s=n(16),h=n(8),v=n(120),g=[].slice,O=/MSIE .\./.test(v),A=function(S){return function(M,P){var L=arguments.length>2,V=!!L&&g.call(arguments,2);return S(L?function(){(typeof M=="function"?M:Function(M)).apply(this,V)}:M,P)}};h(h.G+h.B+h.F*O,{setTimeout:A(s.setTimeout),setInterval:A(s.setInterval)})},function(a,i,n){n(411),n(410),n(409),a.exports=n(24)},function(a,i,n){var s=n(8),h=n(24),v=n(16),g=n(104),O=n(216);s(s.P+s.R,"Promise",{finally:function(A){var S=g(this,h.Promise||v.Promise),M=typeof A=="function";return this.then(M?function(P){return O(S,A()).then(function(){return P})}:A,M?function(P){return O(S,A()).then(function(){throw P})}:A)}})},function(a,i,n){n(218),n(413),a.exports=n(24).Promise.finally},function(a,i,n){var s=n(8),h=n(210)(!0);s(s.S,"Object",{entries:function(v){return h(v)}})},function(a,i,n){n(415),a.exports=n(24).Object.entries},function(a,i,n){var s=n(8),h=n(210)(!1);s(s.S,"Object",{values:function(v){return h(v)}})},function(a,i,n){n(417),a.exports=n(24).Object.values},function(a,i,n){var s=n(8),h=n(212),v=n(41),g=n(53),O=n(158);s(s.S,"Object",{getOwnPropertyDescriptors:function(A){for(var S,M,P=v(A),L=g.f,V=h(P),N={},ee=0;V.length>ee;)(M=L(P,S=V[ee++]))!==void 0&&O(N,S,M);return N}})},function(a,i,n){n(419),a.exports=n(24).Object.getOwnPropertyDescriptors},function(a,i,n){n(239)("asyncIterator")},function(a,i,n){n(421),a.exports=n(174).f("asyncIterator")},function(a,i,n){n(97)("trimRight",function(s){return function(){return s(this,2)}},"trimEnd")},function(a,i,n){n(423),a.exports=n(24).String.trimRight},function(a,i,n){n(97)("trimLeft",function(s){return function(){return s(this,1)}},"trimStart")},function(a,i,n){n(425),a.exports=n(24).String.trimLeft},function(a,i,n){var s=n(8),h=n(211),v=n(120),g=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(v);s(s.P+s.F*g,"String",{padEnd:function(O){return h(this,O,arguments.length>1?arguments[1]:void 0,!1)}})},function(a,i,n){n(427),a.exports=n(24).String.padEnd},function(a,i,n){var s=n(8),h=n(211),v=n(120),g=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(v);s(s.P+s.F*g,"String",{padStart:function(O){return h(this,O,arguments.length>1?arguments[1]:void 0,!0)}})},function(a,i,n){n(429),a.exports=n(24).String.padStart},function(a,i,n){var s=n(126),h=n(13),v=n(22),g=n(56),O=n(19)("isConcatSpreadable");a.exports=function A(S,M,P,L,V,N,ee,J){for(var K,re,ce=V,pe=0,ke=!!ee&&g(ee,J,3);pe<L;){if(pe in P){if(K=ke?ke(P[pe],pe,M):P[pe],re=!1,h(K)&&(re=(re=K[O])!==void 0?!!re:s(K)),re&&N>0)ce=A(S,M,K,v(K.length),ce,N-1)-1;else{if(ce>=9007199254740991)throw TypeError();S[ce]=K}ce++}pe++}return ce}},function(a,i,n){var s=n(8),h=n(431),v=n(34),g=n(22),O=n(55),A=n(224);s(s.P,"Array",{flatMap:function(S){var M,P,L=v(this);return O(S),M=g(L.length),P=A(L,0),h(P,L,L,M,0,1,S,arguments[1]),P}}),n(77)("flatMap")},function(a,i,n){n(432),a.exports=n(24).Array.flatMap},function(a,i,n){var s=n(8),h=n(128)(!0);s(s.P,"Array",{includes:function(v){return h(this,v,arguments.length>1?arguments[1]:void 0)}}),n(77)("includes")},function(a,i,n){n(434),a.exports=n(24).Array.includes},function(a,i,n){var s=n(8),h=n(170);h&&s(s.S,"Reflect",{setPrototypeOf:function(v,g){h.check(v,g);try{return h.set(v,g),!0}catch{return!1}}})},function(a,i,n){var s=n(26),h=n(53),v=n(78),g=n(43),O=n(8),A=n(85),S=n(14),M=n(13);O(O.S,"Reflect",{set:function P(L,V,N){var ee,J,K=arguments.length<4?L:arguments[3],re=h.f(S(L),V);if(!re){if(M(J=v(L)))return P(J,V,N,K);re=A(0)}if(g(re,"value")){if(re.writable===!1||!M(K))return!1;if(ee=h.f(K,V)){if(ee.get||ee.set||ee.writable===!1)return!1;ee.value=N,s.f(K,V,ee)}else s.f(K,V,A(0,N));return!0}return re.set!==void 0&&(re.set.call(K,N),!0)}})},function(a,i,n){var s=n(8),h=n(14),v=Object.preventExtensions;s(s.S,"Reflect",{preventExtensions:function(g){h(g);try{return v&&v(g),!0}catch{return!1}}})},function(a,i,n){var s=n(8);s(s.S,"Reflect",{ownKeys:n(212)})},function(a,i,n){var s=n(8),h=n(14),v=Object.isExtensible;s(s.S,"Reflect",{isExtensible:function(g){return h(g),!v||v(g)}})},function(a,i,n){var s=n(8);s(s.S,"Reflect",{has:function(h,v){return v in h}})},function(a,i,n){var s=n(8),h=n(78),v=n(14);s(s.S,"Reflect",{getPrototypeOf:function(g){return h(v(g))}})},function(a,i,n){var s=n(53),h=n(8),v=n(14);h(h.S,"Reflect",{getOwnPropertyDescriptor:function(g,O){return s.f(v(g),O)}})},function(a,i,n){var s=n(53),h=n(78),v=n(43),g=n(8),O=n(13),A=n(14);g(g.S,"Reflect",{get:function S(M,P){var L,V,N=arguments.length<3?M:arguments[2];return A(M)===N?M[P]:(L=s.f(M,P))?v(L,"value")?L.value:L.get!==void 0?L.get.call(N):void 0:O(V=h(M))?S(V,P,N):void 0}})},function(a,i,n){var s=n(8),h=n(14),v=function(g){this._t=h(g),this._i=0;var O,A=this._k=[];for(O in g)A.push(O)};n(226)(v,"Object",function(){var g,O=this._k;do if(this._i>=O.length)return{value:void 0,done:!0};while(!((g=O[this._i++])in this._t));return{value:g,done:!1}}),s(s.S,"Reflect",{enumerate:function(g){return new v(g)}})},function(a,i,n){var s=n(8),h=n(53).f,v=n(14);s(s.S,"Reflect",{deleteProperty:function(g,O){var A=h(v(g),O);return!(A&&!A.configurable)&&delete g[O]}})},function(a,i,n){var s=n(26),h=n(8),v=n(14),g=n(66);h(h.S+h.F*n(15)(function(){Reflect.defineProperty(s.f({}
vendor: 4,774 bytes, line 9029
9029,1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(O,A,S){v(O),A=g(A,!0),v(S);try{return s.f(O,A,S),!0}catch{return!1}}})},function(a,i,n){var s=n(8),h=n(80),v=n(55),g=n(14),O=n(13),A=n(15),S=n(233),M=(n(16).Reflect||{}).construct,P=A(function(){function V(){}return!(M(function(){},[],V)instanceof V)}),L=!A(function(){M(function(){})});s(s.S+s.F*(P||L),"Reflect",{construct:function(V,N){v(V),g(N);var ee=arguments.length<3?V:v(arguments[2]);if(L&&!P)return M(V,N,ee);if(V==ee){switch(N.length){case 0:return new V;case 1:return new V(N[0]);case 2:return new V(N[0],N[1]);case 3:return new V(N[0],N[1],N[2]);case 4:return new V(N[0],N[1],N[2],N[3])}var J=[null];return J.push.apply(J,N),new(S.apply(V,J))}var K=ee.prototype,re=h(O(K)?K:Object.prototype),ce=Function.apply.call(V,re,N);return O(ce)?ce:re}})},function(a,i,n){var s=n(8),h=n(55),v=n(14),g=(n(16).Reflect||{}).apply,O=Function.apply;s(s.S+s.F*!n(15)(function(){g(function(){})}),"Reflect",{apply:function(A,S,M){var P=h(A),L=v(M);return g?g(P,S,L):O.call(P,S,L)}})},function(a,i,n){n(60)("Float64",8,function(s){return function(h,v,g){return s(this,h,v,g)}})},function(a,i,n){n(60)("Float32",4,function(s){return function(h,v,g){return s(this,h,v,g)}})},function(a,i,n){n(60)("Uint32",4,function(s){return function(h,v,g){return s(this,h,v,g)}})},function(a,i,n){n(60)("Int32",4,function(s){return function(h,v,g){return s(this,h,v,g)}})},function(a,i,n){n(60)("Uint16",2,function(s){return function(h,v,g){return s(this,h,v,g)}})},function(a,i,n){n(60)("Int16",2,function(s){return function(h,v,g){return s(this,h,v,g)}})},function(a,i,n){n(60)("Uint8",1,function(s){return function(h,v,g){return s(this,h,v,g)}},!0)},function(a,i,n){n(60)("Uint8",1,function(s){return function(h,v,g){return s(this,h,v,g)}})},function(a,i,n){n(60)("Int8",1,function(s){return function(h,v,g){return s(this,h,v,g)}})},function(a,i,n){var s=n(8);s(s.G+s.W+s.F*!n(118).ABV,{DataView:n(151).DataView})},function(a,i,n){var s=n(8),h=n(118),v=n(151),g=n(14),O=n(81),A=n(22),S=n(13),M=n(16).ArrayBuffer,P=n(104),L=v.ArrayBuffer,V=v.DataView,N=h.ABV&&M.isView,ee=L.prototype.slice,J=h.VIEW;s(s.G+s.W+s.F*(M!==L),{ArrayBuffer:L}),s(s.S+s.F*!h.CONSTR,"ArrayBuffer",{isView:function(K){return N&&N(K)||S(K)&&J in K}}),s(s.P+s.U+s.F*n(15)(function(){return!new L(2).slice(1,void 0).byteLength}),"ArrayBuffer",{slice:function(K,re){if(ee!==void 0&&re===void 0)return ee.call(g(this),K);for(var ce=g(this).byteLength,pe=O(K,ce),ke=O(re===void 0?ce:re,ce),Ce=new(P(this,L))(A(ke-pe)),be=new V(this),$e=new V(Ce),ht=0;pe<ke;)$e.setUint8(ht++,be.getUint8(pe++));return Ce}}),n(95)("ArrayBuffer")},function(a,i,n){var s=n(214),h=n(76);n(119)("WeakSet",function(v){return function(){return v(this,arguments.length>0?arguments[0]:void 0)}},{add:function(v){return s.def(h(this,"WeakSet"),v,!0)}},s,!1,!0)},function(a,i,n){var s,h=n(16),v=n(51)(0),g=n(38),O=n(65),A=n(235),S=n(214),M=n(13),P=n(76),L=n(76),V=!h.ActiveXObject&&"ActiveXObject"in h,N=O.getWeak,ee=Object.isExtensible,J=S.ufstore,K=function(pe){return function(){return pe(this,arguments.length>0?arguments[0]:void 0)}},re={get:function(pe){if(M(pe)){var ke=N(pe);return ke===!0?J(P(this,"WeakMap")).get(pe):ke?ke[this._i]:void 0}},set:function(pe,ke){return S.def(P(this,"WeakMap"),pe,ke)}},ce=a.exports=n(119)("WeakMap",K,re,S,!0,!0);L&&V&&(A((s=S.getConstructor(K,"WeakMap")).prototype,re),O.NEED=!0,v(["delete","has","get","set"],function(pe){var ke=ce.prototype,Ce=ke[pe];g(ke,pe,function(be,$e){if(M(be)&&!ee(be)){this._f||(this._f=new s);var ht=this._f[pe](be,$e);return pe=="set"?this:ht}return Ce.call(this,be,$e)})}))},function(a,i,n){var s=n(215),h=n(76);a.exports=n(119)("Set",function(v){return function(){return v(this,arguments.length>0?arguments[0]:void 0)}},{add:function(v){return s.def(h(this,"Set"),v=v===0?0:v,v)}},s)},function(a,i,n){var s=n(215),h=n(76);a.exports=n(119)("Map",function(v){return function(){return v(this,arguments.length>0?arguments[0]:void 0)}},{get:function(v){var g=s.getEntry(h(this,"Map"),v);return g&&g.v},set:function(v,g){return s.def(h(this,"Map"),v===0?0:v,g)}},s,!0)},function(a,i){a.exports=function(n){try{return{e:!1,v:n()}}catch(s){return{e:!0,v:s}}}},function(a,i,n){var s=n(16),h=n(152).set,v=s.MutationObserver||s.WebKitMutationObserver,g=s.process,O=s.Promise,A=n(62)(g)=="process";a.exports=function(){var S,M,P,L=function(){var J,K;for(A&&(J=g.domain)&&J.exit();S;){K=S.fn,S=S.next;try{K()}catch(re){throw S?P():M=void 0,re}}M=void 0,J&&J.enter()};if(A)P=function(){g.nextTick(L)};else if(!v||s.navigator&&s.navigator.standalone)if(O&&O.resolve){var V=O.resolve(void 0);P=function(){V.then(L)}}else P=function(){h.call(s,L)};else{var N=!0,ee=document.createTextNode("");new v(L).observe(ee,{characterData:!0}
9029),P=function(){ee.data=N=!N}}return function(J){var K={fn:J,next:void 0};M&&(M.next=K),S||(S=K,P()),M=K}}},function(a,i,n){var s=n(161),h=n(14),v=n(104),g=n(153),O=n(22),A=n(123),S=n(154),M=n(15),P=Math.min,L=[].push,V=!M(function(){});n(122)("split",2,function(N,ee,J,K){var re;return re="abbc".split(/(b)*/)[1]=="c"||"test".split(/(?:)/,-1).length!=4||"ab".split(/(?:ab)*/).length!=2||".".split(/(.?)(.?)/).length!=4||".".split(/()()/).length>1||"".split(/.?/).length?function(ce,pe){var ke=String(this);if(ce===void 0&&pe===0)return[];if(!s(ce))return J.call(ke,ce,pe);for(var Ce,be,$e,ht=[],Dt=(ce.ignoreCase?"i":"")+(ce.multiline?"m":"")+(ce.unicode?"u":"")+(ce.sticky?"y":""),Ut=0,Ee=pe===void 0?4294967295:pe>>>0,Ot=new RegExp(ce.source,Dt+"g");(Ce=S.call(Ot,ke))&&!((be=Ot.lastIndex)>Ut&&(ht.push(ke.slice(Ut,Ce.index)),Ce.length>1&&Ce.index<ke.length&&L.apply(ht,Ce.slice(1)),$e=Ce[0].length,Ut=be,ht.length>=Ee));)Ot.lastIndex===Ce.index&&Ot.lastIndex++;return Ut===ke.length?!$e&&Ot.test("")||ht.push(""):ht.push(ke.slice(Ut)),ht.length>Ee?ht.slice(0,Ee):ht}:"0".split(void 0,0).length?function(ce,pe){return ce===void 0&&pe===0?[]:J.call(this,ce,pe)}:J,[function(ce,pe){var ke=N(this),Ce=ce==null?void 0:ce[ee];return Ce!==void 0?Ce.call(ce,ke,pe):re.call(String(ke),ce,pe)},function(ce,pe){var ke=K(re,ce,this,pe,re!==J);if(ke.done)return ke.value;var Ce=h(ce),be=String(this),$e=v(Ce,RegExp),ht=Ce.unicode,Dt=(Ce.ignoreCase?"i":"")+(Ce.multiline?"m":"")+(Ce.unicode?"u":"")+(V?"y":"g"),Ut=new $e(V?Ce:"^(?:"+Ce.source+")",Dt),Ee=pe===void 0?4294967295:pe>>>0;if(Ee===0)return[];if(be.length===0)return A(Ut,be)===null?[be]:[];for(var Ot=0,zt=0,Mt=[];zt<be.length;){Ut.lastIndex=V?zt:0;var Ke,Tt=A(Ut,V?be:be.slice(zt));if(Tt===null||(Ke=P(O(Ut.lastIndex+(V?0:zt)),be.length))===Ot)zt=g(be,zt,ht);else{if(Mt.push(be.slice(Ot,zt)),Mt.length===Ee)return Mt;for(var vt=1;vt<=Tt.length-1;vt++)if(Mt.push(Tt[vt]),Mt.length===Ee)return Mt;zt=Ot=Ke}}return Mt.push(be.slice(Ot)),Mt}]})},function(a,i,n){var s=n(14),h=n(234),v=n(123);n(122)("search",1,function(g,O,A,S){return[function(M){var P=g(this),L=M==null?void 0:M[O];return L!==void 0?L.call(M,P):new RegExp(M)[O](String(P))},function(M){var P=S(A,M,this);if(P.done)return P.value;var L=s(M),V=String(this),N=L.lastIndex;h(N,0)||(L.lastIndex=0);var ee=v(L,V);return h(L.lastIndex,N)||(L.lastIndex=N),ee===null?-1:ee.index}]})},function(a,i,n){var s=n(14),h=n(34),v=n(22),g=n(54),O=n(153),A=n(123),S=Math.max,M=Math.min,P=Math.floor,L=/\$([$&`']|\d\d?|<[^>]*>)/g,V=/\$([$&`']|\d\d?)/g,N=function(ee){return ee===void 0?ee:String(ee)};n(122)("replace",2,function(ee,J,K,re){return[function(pe,ke){var Ce=ee(this),be=pe==null?void 0:pe[J];return be!==void 0?be.call(pe,Ce,ke):K.call(String(Ce),pe,ke)},function(pe,ke){var Ce=re(K,pe,this,ke);if(Ce.done)return Ce.value;var be=s(pe),$e=String(this),ht=typeof ke=="function";ht||(ke=String(ke));var Dt=be.global;if(Dt){var Ut=be.unicode;be.lastIndex=0}for(var Ee=[];;){var Ot=A(be,$e);if(Ot===null||(Ee.push(Ot),!Dt))break;String(Ot[0])===""&&(be.lastIndex=O($e,v(be.lastIndex),Ut))}for(var zt="",Mt=0,Ke=0;Ke<Ee.length;Ke++){Ot=Ee[Ke];for(var Tt=String(Ot[0]),vt=S(M(g(Ot.index),$e.length),0),yt=[],bt=1;bt<Ot.length;bt++)yt.push(N(Ot[bt]));var Ht=Ot.groups;if(ht){var _t=[Tt].concat(yt,vt,$e);Ht!==void 0&&_t.push(Ht);var Ze=String(ke.apply(void 0,_t))}else Ze=ce(Tt,$e,vt,yt,Ht,ke);vt>=Mt&&(zt+=$e.slice(Mt,vt)+Ze,Mt=vt+Tt.length)}return zt+$e.slice(Mt)}];function ce(pe,ke,Ce,be,$e,ht){var Dt=Ce+pe.length,Ut=be.length,Ee=V;return $e!==void 0&&($e=h($e),Ee=L),K.call(ht,Ee,function(Ot,zt){var Mt;switch(zt.charAt(0)){case"$":return"$";case"&":return pe;case"`":return ke.slice(0,Ce);case"'":return ke.slice(Dt);case"<":Mt=$e[zt.slice(1,-1)];break;default:var Ke=+zt;if(Ke===0)return Ot;if(Ke>Ut){var Tt=P(Ke/10);return Tt===0?Ot:Tt<=Ut?be[Tt-1]===void 0?zt.charAt(1):be[Tt-1]+zt.charAt(1):Ot}Mt=be[Ke-1]}return Mt===void 0?"":Mt})}})},function(a,i,n){var s=n(14),h=n(22),v=n(153),g=n(123);n(122)("match",1,function(O,A,S,M){return[function(P){var L=O(this),V=P==null?void 0:P[A];return V!==void 0?V.call(P,L):new RegExp(P)[A](String(L))},function(P){var L=M(S,P,this);if(L.done)return L.value;var V=s(P),N=String(this);if(!V.global)return g(V,N);var ee=V.unicode;V.lastIndex=0;for(var J,K=[],re=0;(J=g(V,N))!==null;){var ce=String(J[0]);K[re]=ce,ce===""&&(V.lastIndex=v(N,h(V.lastIndex),ee)),re++}return re===0?null:K}]})},function(a,i,n){n(219);var s=n(14),h=n(124),v=n(27),g=/./.toString,O=function(A){n(38)(RegExp.prototype,"toString",A,!0)};n(15)(function(){return g.call({source:"a",flags:"b"})!="/a/b"})?O(function(){var A=s(this);return"/".concat(A.source,"/","flags"in A?A.flags:!v&&A instanceof RegExp?h.call(A):void 0)}):g.name!="toString"&&O(function(){return g.call(this)})},function(a,i,n){var s=n(16),h=n(168),v=n(26).f,g=n(79).f,O=n(161),A=n(124),S=s.RegExp,M=S,P=S.prototype,L=/a/g,V=/a/g,N=new S(L)!==L;if(n(27)&&(!N||n(15)(function(){return V[n(19)("match")]=!1,S(L)!=L||S(V)==V||S(L,"i")!="/a/i"}))){S=function(re,ce){var pe=this instanceof S,ke=O(re),Ce=ce===void 0;return!pe&&ke&&re.constructor===S&&Ce?re:h(N?new M(ke&&!Ce?re.source:re,ce):M((ke=re instanceof S)?re.source:re,ke&&Ce?A.call(re):ce),pe?this:P,S)};for(var ee=function(re){re in S||v(S,re,{configurable:!0,get:function(){return M[re]}
vendor: 10,250 bytes, line 9029
9029,set:function(ce){M[re]=ce}})},J=g(M),K=0;J.length>K;)ee(J[K++]);P.constructor=S,S.prototype=P,n(38)(s,"RegExp",S)}n(95)("RegExp")},function(a,i,n){n(95)("Array")},function(a,i,n){var s=n(8),h=n(51)(6),v="findIndex",g=!0;v in[]&&Array(1)[v](function(){g=!1}),s(s.P+s.F*g,"Array",{findIndex:function(O){return h(this,O,arguments.length>1?arguments[1]:void 0)}}),n(77)(v)},function(a,i,n){var s=n(8),h=n(51)(5),v=!0;"find"in[]&&Array(1).find(function(){v=!1}),s(s.P+s.F*v,"Array",{find:function(g){return h(this,g,arguments.length>1?arguments[1]:void 0)}}),n(77)("find")},function(a,i,n){var s=n(8);s(s.P,"Array",{fill:n(156)}),n(77)("fill")},function(a,i,n){var s=n(8);s(s.P,"Array",{copyWithin:n(222)}),n(77)("copyWithin")},function(a,i,n){var s=n(8),h=n(41),v=n(54),g=n(22),O=[].lastIndexOf,A=!!O&&1/[1].lastIndexOf(1,-0)<0;s(s.P+s.F*(A||!n(49)(O)),"Array",{lastIndexOf:function(S){if(A)return O.apply(this,arguments)||0;var M=h(this),P=g(M.length),L=P-1;for(arguments.length>1&&(L=Math.min(L,v(arguments[1]))),L<0&&(L=P+L);L>=0;L--)if(L in M&&M[L]===S)return L||0;return-1}})},function(a,i,n){var s=n(8),h=n(128)(!1),v=[].indexOf,g=!!v&&1/[1].indexOf(1,-0)<0;s(s.P+s.F*(g||!n(49)(v)),"Array",{indexOf:function(O){return g?v.apply(this,arguments)||0:h(this,O,arguments[1])}})},function(a,i,n){var s=n(8),h=n(223);s(s.P+s.F*!n(49)([].reduceRight,!0),"Array",{reduceRight:function(v){return h(this,v,arguments.length,arguments[1],!0)}})},function(a,i,n){var s=n(8),h=n(223);s(s.P+s.F*!n(49)([].reduce,!0),"Array",{reduce:function(v){return h(this,v,arguments.length,arguments[1],!1)}})},function(a,i,n){var s=n(8),h=n(51)(4);s(s.P+s.F*!n(49)([].every,!0),"Array",{every:function(v){return h(this,v,arguments[1])}})},function(a,i,n){var s=n(8),h=n(51)(3);s(s.P+s.F*!n(49)([].some,!0),"Array",{some:function(v){return h(this,v,arguments[1])}})},function(a,i,n){var s=n(8),h=n(51)(2);s(s.P+s.F*!n(49)([].filter,!0),"Array",{filter:function(v){return h(this,v,arguments[1])}})},function(a,i,n){var s=n(8),h=n(51)(1);s(s.P+s.F*!n(49)([].map,!0),"Array",{map:function(v){return h(this,v,arguments[1])}})},function(a,i,n){var s=n(13),h=n(126),v=n(19)("species");a.exports=function(g){var O;return h(g)&&(typeof(O=g.constructor)!="function"||O!==Array&&!h(O.prototype)||(O=void 0),s(O)&&(O=O[v])===null&&(O=void 0)),O===void 0?Array:O}},function(a,i,n){var s=n(8),h=n(51)(0),v=n(49)([].forEach,!0);s(s.P+s.F*!v,"Array",{forEach:function(g){return h(this,g,arguments[1])}})},function(a,i,n){var s=n(8),h=n(55),v=n(34),g=n(15),O=[].sort,A=[1,2,3];s(s.P+s.F*(g(function(){A.sort(void 0)})||!g(function(){A.sort(null)})||!n(49)(O)),"Array",{sort:function(S){return S===void 0?O.call(v(this)):O.call(v(this),h(S))}})},function(a,i,n){var s=n(8),h=n(171),v=n(62),g=n(81),O=n(22),A=[].slice;s(s.P+s.F*n(15)(function(){h&&A.call(h)}),"Array",{slice:function(S,M){var P=O(this.length),L=v(this);if(M=M===void 0?P:M,L=="Array")return A.call(this,S,M);for(var V=g(S,P),N=g(M,P),ee=O(N-V),J=new Array(ee),K=0;K<ee;K++)J[K]=L=="String"?this.charAt(V+K):this[V+K];return J}})},function(a,i,n){var s=n(8),h=n(41),v=[].join;s(s.P+s.F*(n(107)!=Object||!n(49)(v)),"Array",{join:function(g){return v.call(h(this),g===void 0?",":g)}})},function(a,i,n){var s=n(8),h=n(158);s(s.S+s.F*n(15)(function(){function v(){}return!(Array.of.call(v)instanceof v)}),"Array",{of:function(){for(var v=0,g=arguments.length,O=new(typeof this=="function"?this:Array)(g);g>v;)h(O,v,arguments[v++]);return O.length=g,O}})},function(a,i,n){var s=n(56),h=n(8),v=n(34),g=n(225),O=n(159),A=n(22),S=n(158),M=n(157);h(h.S+h.F*!n(125)(function(P){Array.from(P)}),"Array",{from:function(P){var L,V,N,ee,J=v(P),K=typeof this=="function"?this:Array,re=arguments.length,ce=re>1?arguments[1]:void 0,pe=ce!==void 0,ke=0,Ce=M(J);if(pe&&(ce=s(ce,re>2?arguments[2]:void 0,2)),Ce==null||K==Array&&O(Ce))for(V=new K(L=A(J.length));L>ke;ke++)S(V,ke,pe?ce(J[ke],ke):J[ke]);else for(ee=Ce.call(J),V=new K;!(N=ee.next()).done;ke++)S(V,ke,pe?g(ee,ce,[N.value,ke],!0):N.value);return V.length=ke,V}})},function(a,i,n){var s=n(8);s(s.S,"Array",{isArray:n(126)})},function(a,i,n){var s=n(14),h=n(66);a.exports=function(v){if(v!=="string"&&v!=="number"&&v!=="default")throw TypeError("Incorrect hint");return h(s(this),v!="number")}},function(a,i,n){var s=n(19)("toPrimitive"),h=Date.prototype;s in h||n(42)(h,s,n(494))},function(a,i,n){var s=Date.prototype,h=s.toString,v=s.getTime;new Date(NaN)+""!="Invalid Date"&&n(38)(s,"toString",function(){var g=v.call(this);return g==g?h.call(this):"Invalid Date"})},function(a,i,n){var s=n(15),h=Date.prototype.getTime,v=Date.prototype.toISOString,g=function(O){return O>9?O:"0"+O};a.exports=s(function(){return v.call(new Date(-5e13-1))!="0385-07-25T07:06:39.999Z"})||!s(function(){v.call(new Date(NaN))})?function(){if(!isFinite(h.call(this)))throw RangeError("Invalid time value");var O=this,A=O.getUTCFullYear(),S=O.getUTCMilliseconds(),M=A<0?"-":A>9999?"+":"";return M+("00000"+Math.abs(A)).slice(M?-6:-4)+"-"+g(O.getUTCMonth()+1)+"-"+g(O.getUTCDate())+"T"+g(O.getUTCHours())+":"+g(O.getUTCMinutes())+":"+g(O.getUTCSeconds())+"."+(S>99?S:"0"+g(S))+"Z"}:v},function(a,i,n){var s=n(8),h=n(497);s(s.P+s.F*(Date.prototype.toISOString!==h),"Date",{toISOString:h})},function(a,i,n){var s=n(8),h=n(34),v=n(66);s(s.P+s.F*n(15)(function(){return new Date(NaN).toJSON()!==null||Date.prototype.toJSON.call({toISOString:function(){return 1}})!==1}),"Date",{toJSON:function(g){var O=h(this),A=v(O);return typeof A!="number"||isFinite(A)?O.toISOString():null}})},function(a,i,n){var s=n(8);s(s.S,"Date",{now:function(){return new Date().getTime()}})},function(a,i,n){n(37)("sup",function(s){return function(){return s(this,"sup","","")}})},function(a,i,n){n(37)("sub",function(s){return function(){return s(this,"sub","","")}})},function(a,i,n){n(37)("strike",function(s){return function(){return s(this,"strike","","")}})},function(a,i,n){n(37)("small",function(s){return function(){return s(this,"small","","")}})},function(a,i,n){n(37)("link",function(s){return function(h){return s(this,"a","href",h)}})},function(a,i,n){n(37)("italics",function(s){return function(){return s(this,"i","","")}})},function(a,i,n){n(37)("fontsize",function(s){return function(h){return s(this,"font","size",h)}})},function(a,i,n){n(37)("fontcolor",function(s){return function(h){return s(this,"font","color",h)}})},function(a,i,n){n(37)("fixed",function(s){return function(){return s(this,"tt","","")}})},function(a,i,n){n(37)("bold",function(s){return function(){return s(this,"b","","")}})},function(a,i,n){n(37)("blink",function(s){return function(){return s(this,"blink","","")}})},function(a,i,n){n(37)("big",function(s){return function(){return s(this,"big","","")}})},function(a,i,n){n(37)("anchor",function(s){return function(h){return s(this,"a","name",h)}})},function(a,i,n){var s=n(8),h=n(22),v=n(162),g="".startsWith;s(s.P+s.F*n(160)("startsWith"),"String",{startsWith:function(O){var A=v(this,O,"startsWith"),S=h(Math.min(arguments.length>1?arguments[1]:void 0,A.length)),M=String(O);return g?g.call(A,M,S):A.slice(S,S+M.length)===M}})},function(a,i,n){var s=n(8);s(s.P,"String",{repeat:n(167)})},function(a,i,n){var s=n(8),h=n(162);s(s.P+s.F*n(160)("includes"),"String",{includes:function(v){return!!~h(this,v,"includes").indexOf(v,arguments.length>1?arguments[1]:void 0)}})},function(a,i,n){var s=n(8),h=n(22),v=n(162),g="".endsWith;s(s.P+s.F*n(160)("endsWith"),"String",{endsWith:function(O){var A=v(this,O,"endsWith"),S=arguments.length>1?arguments[1]:void 0,M=h(A.length),P=S===void 0?M:Math.min(h(S),M),L=String(O);return g?g.call(A,L,P):A.slice(P-L.length,P)===L}})},function(a,i,n){var s=n(8),h=n(164)(!1);s(s.P,"String",{codePointAt:function(v){return h(this,v)}})},function(a,i,n){var s=n(164)(!0);n(163)(String,"String",function(h){this._t=String(h),this._i=0},function(){var h,v=this._t,g=this._i;return g>=v.length?{value:void 0,done:!0}:(h=s(v,g),this._i+=h.length,{value:h,done:!1})})},function(a,i,n){n(97)("trim",function(s){return function(){return s(this,3)}})},function(a,i,n){var s=n(8),h=n(41),v=n(22);s(s.S,"String",{raw:function(g){for(var O=h(g.raw),A=v(O.length),S=arguments.length,M=[],P=0;A>P;)M.push(String(O[P++])),P<S&&M.push(String(arguments[P]));return M.join("")}})},function(a,i,n){var s=n(8),h=n(81),v=String.fromCharCode,g=String.fromCodePoint;s(s.S+s.F*(!!g&&g.length!=1),"String",{fromCodePoint:function(O){for(var A,S=[],M=arguments.length,P=0;M>P;){if(A=+arguments[P++],h(A,1114111)!==A)throw RangeError(A+" is not a valid code point");S.push(A<65536?v(A):v(55296+((A-=65536)>>10),A%1024+56320))}return S.join("")}})},function(a,i,n){var s=n(8);s(s.S,"Math",{trunc:function(h){return(h>0?Math.floor:Math.ceil)(h)}})},function(a,i,n){var s=n(8),h=n(165),v=Math.exp;s(s.S,"Math",{tanh:function(g){var O=h(g=+g),A=h(-g);return O==1/0?1:A==1/0?-1:(O-A)/(v(g)+v(-g))}})},function(a,i,n){var s=n(8),h=n(165),v=Math.exp;s(s.S+s.F*n(15)(function(){return!Math.sinh(-2e-17)!=-2e-17}),"Math",{sinh:function(g){return Math.abs(g=+g)<1?(h(g)-h(-g))/2:(v(g-1)-v(-g-1))*(Math.E/2)}})},function(a,i,n){var s=n(8);s(s.S,"Math",{sign:n(166)})},function(a,i,n){var s=n(8);s(s.S,"Math",{log2:function(h){return Math.log(h)/Math.LN2}})},function(a,i,n){var s=n(8);s(s.S,"Math",{log1p:n(227)})},function(a,i,n){var s=n(8);s(s.S,"Math",{log10:function(h){return Math.log(h)*Math.LOG10E}})},function(a,i,n){var s=n(8),h=Math.imul;s(s.S+s.F*n(15)(function(){return h(4294967295,5)!=-5||h.length!=2}),"Math",{imul:function(v,g){var O=+v,A=+g,S=65535&O,M=65535&A;return 0|S*M+((65535&O>>>16)*M+S*(65535&A>>>16)<<16>>>0)}})},function(a,i,n){var s=n(8),h=Math.abs;s(s.S,"Math",{hypot:function(v,g){for(var O,A,S=0,M=0,P=arguments.length,L=0;M<P;)L<(O=h(arguments[M++]))?(S=S*(A=L/O)*A+1,L=O):S+=O>0?(A=O/L)*A:O;return L===1/0?1/0:L*Math.sqrt(S)}})},function(a,i,n){var s=n(166),h=Math.pow,v=h(2,-52),g=h(2,-23),O=h(2,127)*(2-g),A=h(2,-126);a.exports=Math.fround||function(S){var M,P,L=Math.abs(S),V=s(S);return L<A?V*function(N){return N+1/v-1/v}(L/A/g)*A*g:(P=(M=(1+g/v)*L)-(M-L))>O||P!=P?V*(1/0):V*P}},function(a,i,n){var s=n(8);s(s.S,"Math",{fround:n(532)})},function(a,i,n){var s=n(8),h=n(165);s(s.S+s.F*(h!=Math.expm1),"Math",{expm1:h})},function(a,i,n){var s=n(8),h=Math.exp;
9029s(s.S,"Math",{cosh:function(v){return(h(v=+v)+h(-v))/2}})},function(a,i,n){var s=n(8);s(s.S,"Math",{clz32:function(h){return(h>>>=0)?31-Math.floor(Math.log(h+.5)*Math.LOG2E):32}})},function(a,i,n){var s=n(8),h=n(166);s(s.S,"Math",{cbrt:function(v){return h(v=+v)*Math.pow(Math.abs(v),1/3)}})},function(a,i,n){var s=n(8),h=Math.atanh;s(s.S+s.F*!(h&&1/h(-0)<0),"Math",{atanh:function(v){return(v=+v)==0?v:Math.log((1+v)/(1-v))/2}})},function(a,i,n){var s=n(8),h=Math.asinh;s(s.S+s.F*!(h&&1/h(0)>0),"Math",{asinh:function v(g){return isFinite(g=+g)&&g!=0?g<0?-v(-g):Math.log(g+Math.sqrt(g*g+1)):g}})},function(a,i,n){var s=n(8),h=n(227),v=Math.sqrt,g=Math.acosh;s(s.S+s.F*!(g&&Math.floor(g(Number.MAX_VALUE))==710&&g(1/0)==1/0),"Math",{acosh:function(O){return(O=+O)<1?NaN:O>9490626562425156e-8?Math.log(O)+Math.LN2:h(O-1+v(O-1)*v(O+1))}})},function(a,i,n){var s=n(8),h=n(231);s(s.S+s.F*(Number.parseInt!=h),"Number",{parseInt:h})},function(a,i,n){var s=n(8),h=n(230);s(s.S+s.F*(Number.parseFloat!=h),"Number",{parseFloat:h})},function(a,i,n){var s=n(8);s(s.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(a,i,n){var s=n(8);s(s.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(a,i,n){var s=n(8),h=n(228),v=Math.abs;s(s.S,"Number",{isSafeInteger:function(g){return h(g)&&v(g)<=9007199254740991}})},function(a,i,n){var s=n(8);s(s.S,"Number",{isNaN:function(h){return h!=h}})},function(a,i,n){var s=n(8);s(s.S,"Number",{isInteger:n(228)})},function(a,i,n){var s=n(8),h=n(16).isFinite;s(s.S,"Number",{isFinite:function(v){return typeof v=="number"&&h(v)}})},function(a,i,n){var s=n(8);s(s.S,"Number",{EPSILON:Math.pow(2,-52)})},function(a,i,n){var s=n(8),h=n(15),v=n(229),g=1 .toPrecision;s(s.P+s.F*(h(function(){return g.call(1,void 0)!=="1"})||!h(function(){g.call({})})),"Number",{toPrecision:function(O){var A=v(this,"Number#toPrecision: incorrect invocation!");return O===void 0?g.call(A):g.call(A,O)}})},function(a,i,n){var s=n(8),h=n(54),v=n(229),g=n(167),O=1 .toFixed,A=Math.floor,S=[0,0,0,0,0,0],M="Number.toFixed: incorrect invocation!",P=function(ee,J){for(var K=-1,re=J;++K<6;)re+=ee*S[K],S[K]=re%1e7,re=A(re/1e7)},L=function(ee){for(var J=6,K=0;--J>=0;)K+=S[J],S[J]=A(K/ee),K=K%ee*1e7},V=function(){for(var ee=6,J="";--ee>=0;)if(J!==""||ee===0||S[ee]!==0){var K=String(S[ee]);J=J===""?K:J+g.call("0",7-K.length)+K}return J},N=function(ee,J,K){return J===0?K:J%2==1?N(ee,J-1,K*ee):N(ee*ee,J/2,K)};s(s.P+s.F*(!!O&&(8e-5 .toFixed(3)!=="0.000"||.9 .toFixed(0)!=="1"||1.255 .toFixed(2)!=="1.25"||0xde0b6b3a7640080 .toFixed(0)!=="1000000000000000128")||!n(15)(function(){O.call({})})),"Number",{toFixed:function(ee){var J,K,re,ce,pe=v(this,M),ke=h(ee),Ce="",be="0";if(ke<0||ke>20)throw RangeError(M);if(pe!=pe)return"NaN";if(pe<=-1e21||pe>=1e21)return String(pe);if(pe<0&&(Ce="-",pe=-pe),pe>1e-21)if(K=(J=function($e){for(var ht=0,Dt=$e;Dt>=4096;)ht+=12,Dt/=4096;for(;Dt>=2;)ht+=1,Dt/=2;return ht}(pe*N(2,69,1))-69)<0?pe*N(2,-J,1):pe/N(2,J,1),K*=4503599627370496,(J=52-J)>0){for(P(0,K),re=ke;re>=7;)P(1e7,0),re-=7;for(P(N(10,re,1),0),re=J-1;re>=23;)L(1<<23),re-=23;L(1<<re),P(1,1),L(2),be=V()}else P(0,K),P(1<<-J,0),be=V()+g.call("0",ke);return be=ke>0?Ce+((ce=be.length)<=ke?"0."+g.call("0",ke-ce)+be:be.slice(0,ce-ke)+"."+be.slice(ce-ke)):Ce+be}})},function(a,i,n){var s=n(16),h=n(43),v=n(62),g=n(168),O=n(66),A=n(15),S=n(79).f,M=n(53).f,P=n(26).f,L=n(97).trim,V=s.Number,N=V,ee=V.prototype,J=v(n(80)(ee))=="Number",K="trim"in String.prototype,re=function(Ce){var be=O(Ce,!1);if(typeof be=="string"&&be.length>2){var $e,ht,Dt,Ut=(be=K?be.trim():L(be,3)).charCodeAt(0);if(Ut===43||Ut===45){if(($e=be.charCodeAt(2))===88||$e===120)return NaN}else if(Ut===48){switch(be.charCodeAt(1)){case 66:case 98:ht=2,Dt=49;break;case 79:case 111:ht=8,Dt=55;break;default:return+be}for(var Ee,Ot=be.slice(2),zt=0,Mt=Ot.length;zt<Mt;zt++)if((Ee=Ot.charCodeAt(zt))<48||Ee>Dt)return NaN;return parseInt(Ot,ht)}}return+be};if(!V(" 0o1")||!V("0b1")||V("+0x1")){V=function(Ce){var be=arguments.length<1?0:Ce,$e=this;return $e instanceof V&&(J?A(function(){ee.valueOf.call($e)}):v($e)!="Number")?g(new N(re(be)),$e,V):re(be)};for(var ce,pe=n(27)?S(N):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),ke=0;pe.length>ke;ke++)h(N,ce=pe[ke])&&!h(V,ce)&&P(V,ce,M(N,ce));V.prototype=ee,ee.constructor=V,n(38)(s,"Number",V)}},function(a,i,n){var s=n(8),h=n(230);s(s.G+s.F*(parseFloat!=h),{parseFloat:h})},function(a,i,n){var s=n(8),h=n(231);
vendor: 4,204 bytes, line 9029
9029s(s.G+s.F*(parseInt!=h),{parseInt:h})},function(a,i,n){var s=n(13),h=n(78),v=n(19)("hasInstance"),g=Function.prototype;v in g||n(26).f(g,v,{value:function(O){if(typeof this!="function"||!s(O))return!1;if(!s(this.prototype))return O instanceof this;for(;O=h(O);)if(this.prototype===O)return!0;return!1}})},function(a,i,n){var s=n(26).f,h=Function.prototype,v=/^\s*function ([^ (]*)/;"name"in h||n(27)&&s(h,"name",{configurable:!0,get:function(){try{return(""+this).match(v)[1]}catch{return""}}})},function(a,i,n){var s=n(8);s(s.P,"Function",{bind:n(233)})},function(a,i,n){var s=n(105),h={};h[n(19)("toStringTag")]="z",h+""!="[object z]"&&n(38)(Object.prototype,"toString",function(){return"[object "+s(this)+"]"},!0)},function(a,i,n){var s=n(8);s(s.S,"Object",{setPrototypeOf:n(170).set})},function(a,i,n){var s=n(8);s(s.S,"Object",{is:n(234)})},function(a,i,n){var s=n(8);s(s.S+s.F,"Object",{assign:n(235)})},function(a,i,n){var s=n(13);n(52)("isExtensible",function(h){return function(v){return!!s(v)&&(!h||h(v))}})},function(a,i,n){var s=n(13);n(52)("isSealed",function(h){return function(v){return!s(v)||!!h&&h(v)}})},function(a,i,n){var s=n(13);n(52)("isFrozen",function(h){return function(v){return!s(v)||!!h&&h(v)}})},function(a,i,n){var s=n(13),h=n(65).onFreeze;n(52)("preventExtensions",function(v){return function(g){return v&&s(g)?v(h(g)):g}})},function(a,i,n){var s=n(13),h=n(65).onFreeze;n(52)("seal",function(v){return function(g){return v&&s(g)?v(h(g)):g}})},function(a,i,n){var s=n(13),h=n(65).onFreeze;n(52)("freeze",function(v){return function(g){return v&&s(g)?v(h(g)):g}})},function(a,i,n){n(52)("getOwnPropertyNames",function(){return n(236).f})},function(a,i,n){var s=n(34),h=n(82);n(52)("keys",function(){return function(v){return h(s(v))}})},function(a,i,n){var s=n(34),h=n(78);n(52)("getPrototypeOf",function(){return function(v){return h(s(v))}})},function(a,i,n){var s=n(41),h=n(53).f;n(52)("getOwnPropertyDescriptor",function(){return function(v,g){return h(s(v),g)}})},function(a,i,n){var s=n(8);s(s.S+s.F*!n(27),"Object",{defineProperties:n(237)})},function(a,i,n){var s=n(8);s(s.S+s.F*!n(27),"Object",{defineProperty:n(26).f})},function(a,i,n){var s=n(8);s(s.S,"Object",{create:n(80)})},function(a,i,n){var s=n(82),h=n(127),v=n(106);a.exports=function(g){var O=s(g),A=h.f;if(A)for(var S,M=A(g),P=v.f,L=0;M.length>L;)P.call(g,S=M[L++])&&O.push(S);return O}},function(a,i,n){a.exports=n(129)("native-function-to-string",Function.toString)},function(a,i,n){var s=n(16),h=n(43),v=n(27),g=n(8),O=n(38),A=n(65).KEY,S=n(15),M=n(129),P=n(98),L=n(84),V=n(19),N=n(174),ee=n(239),J=n(575),K=n(126),re=n(14),ce=n(13),pe=n(34),ke=n(41),Ce=n(66),be=n(85),$e=n(80),ht=n(236),Dt=n(53),Ut=n(127),Ee=n(26),Ot=n(82),zt=Dt.f,Mt=Ee.f,Ke=ht.f,Tt=s.Symbol,vt=s.JSON,yt=vt&&vt.stringify,bt=V("_hidden"),Ht=V("toPrimitive"),_t={}.propertyIsEnumerable,Ze=M("symbol-registry"),Vt=M("symbols"),sn=M("op-symbols"),yn=Object.prototype,Yt=typeof Tt=="function"&&!!Ut.f,We=s.QObject,Ye=!We||!We.prototype||!We.prototype.findChild,He=v&&S(function(){return $e(Mt({},"a",{get:function(){return Mt(this,"a",{value:7}).a}})).a!=7})?function(rn,fn,Xn){var Fn=zt(yn,fn);Fn&&delete yn[fn],Mt(rn,fn,Xn),Fn&&rn!==yn&&Mt(yn,fn,Fn)}:Mt,dt=function(rn){var fn=Vt[rn]=$e(Tt.prototype);return fn._k=rn,fn},It=Yt&&typeof Tt.iterator=="symbol"?function(rn){return typeof rn=="symbol"}:function(rn){return rn instanceof Tt},ct=function(rn,fn,Xn){return rn===yn&&ct(sn,fn,Xn),re(rn),fn=Ce(fn,!0),re(Xn),h(Vt,fn)?(Xn.enumerable?(h(rn,bt)&&rn[bt][fn]&&(rn[bt][fn]=!1),Xn=$e(Xn,{enumerable:be(0,!1)})):(h(rn,bt)||Mt(rn,bt,be(1,{})),rn[bt][fn]=!0),He(rn,fn,Xn)):Mt(rn,fn,Xn)},on=function(rn,fn){re(rn);for(var Xn,Fn=J(fn=ke(fn)),Ar=0,Dr=Fn.length;Dr>Ar;)ct(rn,Xn=Fn[Ar++],fn[Xn]);return rn},Xt=function(rn){var fn=_t.call(this,rn=Ce(rn,!0));return!(this===yn&&h(Vt,rn)&&!h(sn,rn))&&(!(fn||!h(this,rn)||!h(Vt,rn)||h(this,bt)&&this[bt][rn])||fn)},En=function(rn,fn){if(rn=ke(rn),fn=Ce(fn,!0),rn!==yn||!h(Vt,fn)||h(sn,fn)){var Xn=zt(rn,fn);return!Xn||!h(Vt,fn)||h(rn,bt)&&rn[bt][fn]||(Xn.enumerable=!0),Xn}},xe=function(rn){for(var fn,Xn=Ke(ke(rn)),Fn=[],Ar=0;Xn.length>Ar;)h(Vt,fn=Xn[Ar++])||fn==bt||fn==A||Fn.push(fn);return Fn}
9029,jn=function(rn){for(var fn,Xn=rn===yn,Fn=Ke(Xn?sn:ke(rn)),Ar=[],Dr=0;Fn.length>Dr;)!h(Vt,fn=Fn[Dr++])||Xn&&!h(yn,fn)||Ar.push(Vt[fn]);return Ar};Yt||(O((Tt=function(){if(this instanceof Tt)throw TypeError("Symbol is not a constructor!");var rn=L(arguments.length>0?arguments[0]:void 0),fn=function(Xn){this===yn&&fn.call(sn,Xn),h(this,bt)&&h(this[bt],rn)&&(this[bt][rn]=!1),He(this,rn,be(1,Xn))};return v&&Ye&&He(yn,rn,{configurable:!0,set:fn}),dt(rn)}).prototype,"toString",function(){return this._k}),Dt.f=En,Ee.f=ct,n(79).f=ht.f=xe,n(106).f=Xt,Ut.f=jn,v&&!n(83)&&O(yn,"propertyIsEnumerable",Xt,!0),N.f=function(rn){return dt(V(rn))}),g(g.G+g.W+g.F*!Yt,{Symbol:Tt});for(var nr="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ar=0;nr.length>ar;)V(nr[ar++]);for(var cr=Ot(V.store),Er=0;cr.length>Er;)ee(cr[Er++]);g(g.S+g.F*!Yt,"Symbol",{for:function(rn){return h(Ze,rn+="")?Ze[rn]:Ze[rn]=Tt(rn)},keyFor:function(rn){if(!It(rn))throw TypeError(rn+" is not a symbol!");for(var fn in Ze)if(Ze[fn]===rn)return fn},useSetter:function(){Ye=!0},useSimple:function(){Ye=!1}}),g(g.S+g.F*!Yt,"Object",{create:function(rn,fn){return fn===void 0?$e(rn):on($e(rn),fn)},defineProperty:ct,defineProperties:on,getOwnPropertyDescriptor:En,getOwnPropertyNames:xe,getOwnPropertySymbols:jn});var hn=S(function(){Ut.f(1)});g(g.S+g.F*hn,"Object",{getOwnPropertySymbols:function(rn){return Ut.f(pe(rn))}}),vt&&g(g.S+g.F*(!Yt||S(function(){var rn=Tt();return yt([rn])!="[null]"||yt({a:rn})!="{}"||yt(Object(rn))!="{}"})),"JSON",{stringify:function(rn){for(var fn,Xn,Fn=[rn],Ar=1;arguments.length>Ar;)Fn.push(arguments[Ar++]);if(Xn=fn=Fn[1],(ce(fn)||rn!==void 0)&&!It(rn))return K(fn)||(fn=function(Dr,xr){if(typeof Xn=="function"&&(xr=Xn.call(this,Dr,xr)),!It(xr))return xr}),Fn[1]=fn,yt.apply(vt,Fn)}}),Tt.prototype[Ht]||n(42)(Tt.prototype,Ht,Tt.prototype.valueOf),P(Tt,"Symbol"),P(Math,"Math",!0),P(s.JSON,"JSON",!0)},function(a,i,n){n(577),n(574),n(573),n(572),n(571),n(570),n(569),n(568),n(567),n(566),n(565),n(564),n(563),n(562),n(561),n(560),n(559),n(558),n(557),n(556),n(555),n(554),n(553),n(552),n(551),n(550),n(549),n(548),n(547),n(546),n(545),n(544),n(543),n(542),n(541),n(540),n(539),n(538),n(537),n(536),n(535),n(534),n(533),n(531),n(530),n(529),n(528),n(527),n(526),n(525),n(524),n(523),n(522),n(521),n(520),n(519),n(518),n(517),n(516),n(515),n(514),n(513),n(512),n(511),n(510),n(509),n(508),n(507),n(506),n(505),n(504),n(503),n(502),n(501),n(500),n(499),n(498),n(496),n(495),n(493),n(492),n(491),n(490),n(489),n(488),n(487),n(485),n(484),n(483),n(482),n(481),n(480),n(479),n(478),n(477),n(476),n(475),n(474),n(473),n(155),n(472),n(220),n(471),n(219),n(470),n(469),n(468),n(467),n(218),n(464),n(463),n(462),n(461),n(460),n(459),n(458),n(457),n(456),n(455),n(454),n(453),n(452),n(451),n(450),n(449),n(448),n(447),n(446),n(445),n(444),n(443),n(442),n(441),n(440),n(439),n(438),n(437),n(436),a.exports=n(24)},function(a,i,n){n(578),n(435),n(433),n(430),n(428),n(426),n(424),n(422),n(420),n(418),n(416),n(414),n(412),n(408)},function(a,i,n){n(579);var s=function(h){return h&&h.__esModule?h:{default:h}}(n(407));s.default._babelPolyfill&&typeof console<"u"&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),s.default._babelPolyfill=!0},function(a,i,n){n(580),a.exports=n(248)},function(a,i,n){var s={},h={},v=34,g=10,O=13;function A(L){return new Function("d","return {"+L.map(function(V,N){return JSON.stringify(V)+": d["+N+'] || ""'}).join(",")+"}")}function S(L){var V=Object.create(null),N=[];return L.forEach(function(ee){for(var J in ee)J in V||N.push(V[J]=J)}),N}function M(L,V){var N=L+"",ee=N.length;return ee<V?new Array(V-ee+1).join(0)+N:N}function P(L){var V=L.getUTCHours(),N=L.getUTCMinutes(),ee=L.getUTCSeconds(),J=L.getUTCMilliseconds();return isNaN(L)?"Invalid Date":function(K){return K<0?"-"+M(-K,6):K>9999?"+"+M(K,6):M(K,4)}(L.getUTCFullYear())+"-"+M(L.getUTCMonth()+1,2)+"-"+M(L.getUTCDate(),2)+(J?"T"+M(V,2)+":"+M(N,2)+":"+M(ee,2)+"."+M(J,3)+"Z":ee?"T"+M(V,2)+":"+M(N,2)+":"+M(ee,2)+"Z":N||V?"T"+M(V,2)+":"+M(N,2)+"Z":"")}i.a=function(L){var V=new RegExp('["'+L+` 9030\r]`),N=L.charCodeAt(0);function ee(ce,pe){var ke,Ce=[],be=ce.length,$e=0,ht=0,Dt=be<=0,Ut=!1;function Ee(){if(Dt)return h;if(Ut)return Ut=!1,s;var zt,Mt,Ke=$e;if(ce.charCodeAt(Ke)===v){for(;$e++<be&&ce.charCodeAt($e)!==v||ce.charCodeAt(++$e)===v;);return(zt=$e)>=be?Dt=!0:(Mt=ce.charCodeAt($e++))===g?Ut=!0:Mt===O&&(Ut=!0,ce.charCodeAt($e)===g&&++$e),ce.slice(Ke+1,zt-1).replace(/""/g,'"')}for(;$e<be;){if((Mt=ce.charCodeAt(zt=$e++))===g)Ut=!0;else if(Mt===O)Ut=!0,ce.charCodeAt($e)===g&&++$e;else if(Mt!==N)continue;return ce.slice(Ke,zt)}return Dt=!0,ce.slice(Ke,be)}for(ce.charCodeAt(be-1)===g&&--be,ce.charCodeAt(be-1)===O&&--be;(ke=Ee())!==h;){for(var Ot=[];ke!==s&&ke!==h;)Ot.push(ke),ke=Ee();pe&&(Ot=pe(Ot,ht++))==null||Ce.push(Ot)}return Ce}function J(ce,pe){return ce.map(function(ke){return pe.map(function(Ce){return re(ke[Ce])}).join(L)})}function K(ce){return ce.map(re).join(L)}function re(ce){return ce==null?"":ce instanceof Date?P(ce):V.test(ce+="")?'"'+ce.replace(/"/g,'""')+'"':ce}return{parse:function(ce,pe){var ke,Ce,be=ee(ce,function($e,ht){if(ke)return ke($e,ht-1);Ce=$e,ke=pe?function(Dt,Ut){var Ee=A(Dt);return function(Ot,zt){return Ut(Ee(Ot),zt,Dt)}}($e,pe):A($e)});return be.columns=Ce||[],be},parseRows:ee,format:function(ce,pe){return pe==null&&(pe=S(ce)),[pe.map(re).join(L)].concat(J(ce,pe)).join(` 9031`)},formatBody:function(ce,pe){return pe==null&&(pe=S(ce)),J(ce,pe).join(` 9032`)},formatRows:function(ce){return ce.map(K).join(` 9033`)},formatRow:K,formatValue:re}}}]).default})})(afe);Wo(La);La.subscribe(c=>c);var nA=(c=>(c[c.Untrained=0]="Untrained",c[c.Success=1]="Success",c[c.Failure=2]="Failure",c))(nA||{});const sfe={duration:1800,numEpochs:80,numSamples:60,minSamples:50,updatesPrSecond:4,learningRate:.5,includedAxes:[!0,!0,!0],includedParameters:[!0,!0,!0,!0,!0],preferableButton:"AB",automaticClassification:!0,output:!0},Jd=f4("gestureData",[]),d4=Dc({}),gl=Dc(sfe),v5=Dc(null);function ufe(c){Jd.update(o=>[...o,{name:c,ID:Date.now(),recordings:[],output:{}}])}function cfe(c){Jd.update(o=>{const a=o.indexOf(c);return a>-1&&o.splice(a,1),o})}function lfe(c,o){Jd.update(a=>{for(const i of a)if(i.ID===c){i.recordings=[...i.recordings,o];break}return a})}function ffe(c,o){Jd.update(a=>{for(const i of a)if(i.ID===c){for(let n=0;n<i.recordings.length;n++)if(i.recordings[n].ID===o)return i.recordings.splice(n,1),a}return a})}function dfe(c,o){Jd.update(a=>{for(const i of a)if(i.ID===c){i.output.sound=o;break}return a})}function E$(c,o){Jd.update(a=>{for(const i of a)if(i.ID===c){i.output.matrix=o;break}return a})}const $K=Dc({}),HK=Dc(void 0),tP=Dc(void 0),vN=Dc(0),qK=Dc(new Array(Wo(gl).numSamples));let mS=0;d4.subscribe(c=>{qK.update(o=>(o[mS]=c,o)),mS++,mS>=Wo(gl).numSamples&&(mS=0)});const hfe=Dc({percentage:0,loss:0,epochs:0});function GK(){const c=Wo(qK),o=c.length,a=new Array(o),i=new Array(o),n=new Array(o);for(let s=0;s<o;s++){const h=(s+mS)%o;a[s]=c[h].accelX,i[s]=c[h].accelY,n[s]=c[h].accelZ}return{x:a,y:i,z:n}}var ed=(c=>(c[c.NONE=0]="NONE",c[c.INPUT=1]="INPUT",c[c.OUTPUT=2]="OUTPUT",c))(ed||{}),ic=(c=>(c[c.NONE=0]="NONE",c[c.START=1]="START",c[c.START_OUTPUT=2]="START_OUTPUT",c[c.BLUETOOTH=3]="BLUETOOTH",c[c.USB_START=4]="USB_START",c[c.USB_DOWNLOADING=5]="USB_DOWNLOADING",c[c.USB_DONE=6]="USB_DONE",c[c.MANUAL_TUTORIAL=7]="MANUAL_TUTORIAL",c)
9033)(ic||{});const sp=Dc({connectionState:0,deviceState:0}),KK=()=>{sp.update(c=>(c.connectionState=Wo(No).isInputConnected?2:1,c.deviceState=Wo(No).isInputConnected?2:1,c))};let gS;La.subscribe(c=>gS=c);const C$=Dc(UK.checkCompatibility()),S$=Dc(Wo(C$)?!Wo(C$).bluetooth:!1),No=Dc({isRequestingDevice:ed.NONE,isFlashingDevice:!1,isTesting:!1,isRecording:!1,isTraining:!1,isInputConnected:!1,isOutputConnected:!1,isPredicting:!1,offerReconnect:!1,requestDeviceWasCancelled:!1,reconnectState:ed.NONE,isInputReady:!1,isInputAssigned:!1,isOutputAssigned:!1,isOutputReady:!1,isLoading:!0}),nP=Dc({warning:!1,text:""}),pfe=Dc({text:""});function Ig(c){nP.set({warning:!1,text:c})}function F2(c){nP.set({warning:!0,text:c})}function FS(c=!0,o=!0){const a=mfe(c);return!a.isReady&&o&&F2(a.msg),a.isReady}function mfe(c=!0){const o=Wo(No);return o.isRecording?{isReady:!1,msg:gS("alert.isRecording")}:o.isTesting?{isReady:!1,msg:gS("alert.isTesting")}:o.isTraining?{isReady:!1,msg:gS("alert.isTraining")}:!o.isInputConnected&&c?{isReady:!1,msg:gS("alert.isNotConnected")}:{isReady:!0,msg:""}}const YK=()=>!Wo(Jd)||Wo(Jd).length<2?!1:!Wo(Jd).some(c=>c.recordings.length<3),yN=Dc({buttonA:0,buttonB:0});var A6;(c=>{let o;(h=>{h.UART_SERVICE="6e400001-b5a3-f393-e0a9-e50e24dcca9e",h.ACCEL_SERVICE="e95d0753-251d-470a-a062-fa1922dfa9a8",h.DEVICE_INFO_SERVICE="0000180a-0000-1000-8000-00805f9b34fb",h.LED_SERVICE="e95dd91d-251d-470a-a062-fa1922dfa9a8",h.IO_SERVICE="e95d127b-251d-470a-a062-fa1922dfa9a8",h.BUTTON_SERVICE="e95d9882-251d-470a-a062-fa1922dfa9a8"})(o=c.Services||(c.Services={}));let a;(h=>{h.BUTTON_A="e95dda90-251d-470a-a062-fa1922dfa9a8",h.BUTTON_B="e95dda91-251d-470a-a062-fa1922dfa9a8",h.ACCEL_DATA="e95dca4b-251d-470a-a062-fa1922dfa9a8",h.IO_DATA="e95d8d00-251d-470a-a062-fa1922dfa9a8",h.LED_MATRIX_STATE="e95d7b77-251d-470a-a062-fa1922dfa9a8",h.MODEL_NUMBER="00002a24-0000-1000-8000-00805f9b34fb",h.UART_DATA_TX="6e400002-b5a3-f393-e0a9-e50e24dcca9e",h.UART_DATA_RX="6e400003-b5a3-f393-e0a9-e50e24dcca9e"})(a=c.Characteristics||(c.Characteristics={}));let i;(h=>{h.PRODUCT_ID=516,h.VENDOR_ID=3368,h.FICR=268435456,h.DEVICE_ID_1=100,h.MICROBIT_NAME_LENGTH=5,h.MICROBIT_NAME_CODE_LETTERS=5})(i=c.USBSpecs||(c.USBSpecs={})),(h=>{h[h.Released=0]="Released",h[h.Pressed=1]="Pressed",h[h.LongPressed=2]="LongPressed"})(c.ButtonStates||(c.ButtonStates={}));const n=class{static async getModelNumber(h){try{const O=await(await(await h.getPrimaryService(o.DEVICE_INFO_SERVICE)).getCharacteristic(a.MODEL_NUMBER)).readValue(),A=new TextDecoder().decode(O);if(A.toLowerCase()==="BBC micro:bit".toLowerCase())return 1;if(A.toLowerCase().includes("BBC micro:bit v2".toLowerCase()))return 2}catch(v){console.log(v)}throw new Error("Could not read model number")}static serialNumberToName(h){let v=i.MICROBIT_NAME_CODE_LETTERS,g=1,O="";for(let A=0;A<i.MICROBIT_NAME_LENGTH;A++){const S=Math.floor(h%v/g);h-=S,v*=i.MICROBIT_NAME_CODE_LETTERS,g*=i.MICROBIT_NAME_CODE_LETTERS,O=n.CODEBOOK_USB[A][S]+O}return O}static patternToName(h){const v=[" "," "," "," "," "];for(let g=0;g<i.MICROBIT_NAME_LENGTH;g++)for(let O=0;O<i.MICROBIT_NAME_LENGTH;O++)if(h[O*i.MICROBIT_NAME_LENGTH+g]){v[g]=this.CODEBOOK_BLUETOOTH[O][g];break}return v.join("")}static nameToPattern(h){const v=new Array(25).fill(!0);if(h.length!=i.MICROBIT_NAME_LENGTH)return v.map(()=>!1);for(let g=0;g<i.MICROBIT_NAME_LENGTH;g++)for(let O=0;O<i.MICROBIT_NAME_LENGTH&&this.CODEBOOK_BLUETOOTH[O][g]!==h.charAt(g);O++)v[5*O+g]=!1;return v}static arrayToOctet(h){let v=h;typeof h[0]=="boolean"&&(v=h.map(S=>S?1:0));let g=0,O=0;for(let A=v.length-1;A>=0;A--)g+=v[A]*Math.pow(2,O),O++;return g}};let s=n;s.CODEBOOK_USB=[["z","v","g","p","t"],["u","o","i","e","a"],["z","v","g","p","t"],["u","o","i","e","a"],["z","v","g","p","t"]],s.CODEBOOK_BLUETOOTH=[["t","a","t","a","t"],["p","e","p","e","p"],["g","i","g","i","g"],["v","o","v","o","v"],["z","u","z","u","z"]],c.Utility=s})(A6||(A6={}));const Va=A6,A2={emptyFunction:()=>{}};class dk{constructor(o,a,i,n,s){this.gattServer=o,this.microbitVersion=a,this.onDisconnect=i,this.onReconnect=n,this.onReconnectFailed=s,this.dcListener=this.disconnectListener.bind(this),this.device=o.device,this.device.addEventListener("gattserverdisconnected",this.dcListener)}listenForDisconnect(o){return this.device.addEventListener("gattserverdisconnected",o)}removeDisconnectListener(o){return this.device.removeEventListener("gattserverdisconnected",o)}getDevice(){return this.device}
9033async getUARTService(){return await this.getService(Va.Services.UART_SERVICE)}async getAccelerometerService(){return await this.getService(Va.Services.ACCEL_SERVICE)}async getButtonService(){return await this.getService(Va.Services.BUTTON_SERVICE)}async getDeviceInfoService(){return await this.getService(Va.Services.DEVICE_INFO_SERVICE)}async getLEDService(){return await this.getService(Va.Services.LED_SERVICE)}async getIOService(){return await this.getService(Va.Services.IO_SERVICE)}isConnected(){return this.gattServer.connected}getGattServer(){if(!this.isConnected())throw new Error("MicrobitConnection: gatt server is not available until after connection is established");return this.gattServer}getVersion(){return this.microbitVersion}disconnect(){this.isConnected()&&(this.device.removeEventListener("gattserverdisconnected",this.dcListener),this.gattServer.disconnect(),this.disconnectEventHandler(!0))}async listenToUART(o){const i=await(await this.getUARTService()).getCharacteristic(Va.Characteristics.UART_DATA_TX);await i.startNotifications(),i.addEventListener("characteristicvaluechanged",n=>{const s=[],h=n.target;for(let g=0;g<h.value.byteLength;g+=1)s[g]=h.value.getUint8(g);const v=String.fromCharCode.apply(null,s);o(v)})}async listenToButton(o,a){const i=await this.getButtonService(),n=o==="A"?Va.Characteristics.BUTTON_A:Va.Characteristics.BUTTON_B,s=await i.getCharacteristic(n);await s.startNotifications(),s.addEventListener("characteristicvaluechanged",h=>{const g=h.target.value.getUint8(0);let O=Va.ButtonStates.Released;g===1&&(O=Va.ButtonStates.Pressed),g===2&&(O=Va.ButtonStates.LongPressed),a(O,o)})}async listenToAccelerometer(o){const i=await(await this.getAccelerometerService()).getCharacteristic(Va.Characteristics.ACCEL_DATA);await i.startNotifications(),i.addEventListener("characteristicvaluechanged",n=>{const s=n.target,h=s.value.getInt16(0,!0),v=s.value.getInt16(2,!0),g=s.value.getInt16(4,!0);o(h,v,g)})}async setLEDMatrix(o){if(o.length!==5||o[0].length!==5)throw new Error("Matrix must be 5x5");let a=o;typeof o[0][0]=="boolean"&&(a=o.map(g=>g.map(O=>O?1:0)));const n=await(await this.getLEDService()).getCharacteristic(Va.Characteristics.LED_MATRIX_STATE),s=new Uint8Array(5);for(let v=0;v<5;v+=1)s[v]=Va.Utility.arrayToOctet(a[v]);const h=new DataView(s.buffer);await n.writeValue(h)}disconnectListener(o){this.device.gatt.connect().then(()=>{var a;(a=this.onReconnect)==null||a.call(this,this)}).catch(()=>{this.onReconnectFailed()}),this.disconnectEventHandler(!1)}disconnectEventHandler(o){this.device!==void 0&&this.onDisconnect(o)}static async requestDevice(o,a){return new Promise((i,n)=>{try{navigator.bluetooth.requestDevice({filters:[{namePrefix:`BBC micro:bit [${o}]`}],optionalServices:[Va.Services.UART_SERVICE,Va.Services.ACCEL_SERVICE,Va.Services.DEVICE_INFO_SERVICE,Va.Services.LED_SERVICE,Va.Services.IO_SERVICE,Va.Services.BUTTON_SERVICE]}).then(s=>{i(s)}).catch(s=>n(s))}catch(s){a(s),n(s)}})}static async createMicrobitBluetooth(o,a,i,n,s,h){if(o.gatt===void 0)throw console.warn("Missing gatt server on microbit device:",o),new Error("BluetoothRemoteGATTServer for microbit device is undefined");let v,g;try{v=await o.gatt.connect(),g=await Va.Utility.getModelNumber(v)}catch(A){return n(A),o.gatt!==void 0&&o.gatt.disconnect(),Promise.reject("Failed to establish a connection!")}const O=new dk(v,g,i,s,h);return v.connected&&a(O),O}async getService(o){try{return await this.gattServer.getPrimaryService(o)}catch(a){console.log(a)}throw new Error("Failed to get primary service!")}}class XK{constructor(){this.enableLogging=eP.isInDevelopment&&!0,this.logTimer=new Date().getTime(),this.logInterval=1e3}onBluetoothConnectionError(o){this.enableLogging&&console.log("An error occured while connecting.",o)}onReady(){this.enableLogging&&console.log("Is ready!")}accelerometerChange(o,a,i){}buttonChange(o,a){this.enableLogging&&console.log("Button change",o,a)}onAssigned(o,a){this.enableLogging&&console.log(a," was assigned "),this.enableLogging&&console.log(o)}onCancelledBluetoothRequest(){this.enableLogging&&console.log("Device request was cancelled")}onConnected(o){this.enableLogging&&console.log(o," got connected via bluetooth")}onDisconnected(){this.enableLogging&&console.log("disconnected via bluetooth")}onExpelled(o,a){this.enableLogging&&console.log("Was expelled manually?:",o,"both?:",a)}logTimed(...o){new Date().getTime()-this.logTimer>this.logInterval&&(console.log(o),this.logTimer=new Date().getTime())}}/*! js-cookie v3.0.1 | MIT */function qD(c){for(var o=1;o<arguments.length;o++){var a=arguments[o];for(var i in a)c[i]=a[i]}return c}var gfe={read:function(c){return c[0]==='"'&&(c=c.slice(1,-1)),c.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(c){return encodeURIComponent(c).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decode
9033URIComponent)}};function O6(c,o){function a(n,s,h){if(!(typeof document>"u")){h=qD({},o,h),typeof h.expires=="number"&&(h.expires=new Date(Date.now()+h.expires*864e5)),h.expires&&(h.expires=h.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var v="";for(var g in h)h[g]&&(v+="; "+g,h[g]!==!0&&(v+="="+h[g].split(";")[0]));return document.cookie=n+"="+c.write(s,n)+v}}function i(n){if(!(typeof document>"u"||arguments.length&&!n)){for(var s=document.cookie?document.cookie.split("; "):[],h={},v=0;v<s.length;v++){var g=s[v].split("="),O=g.slice(1).join("=");try{var A=decodeURIComponent(g[0]);if(h[A]=c.read(O,A),n===A)break}catch{}}return n?h[n]:h}}return Object.create({set:a,get:i,remove:function(n,s){a(n,"",qD({},s,{expires:-1}))},withAttributes:function(n){return O6(this.converter,qD({},this.attributes,n))},withConverter:function(n){return O6(qD({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(c)}})}var H_=O6(gfe,{path:"/"});class Rv{static isReconnectFlagSet(){return H_.get(this.reconnectCookieName)!==void 0}static unsetReconnectFlag(){H_.remove(this.reconnectCookieName)}static setReconnectFlag(){H_.set(this.reconnectCookieName,"true")}static isComplianceSet(){return H_.get(this.complianceCookieName)!==void 0}static getComplianceChoices(){return this.isComplianceSet()?JSON.parse(H_.get(this.complianceCookieName)):{necessary:!0,analytics:!1}}static setComplianceChoices(o){H_.set(this.complianceCookieName,JSON.stringify(o),{expires:365}),document.dispatchEvent(this.complianceCookieChangeEvent)}}Rv.reconnectCookieName="reconnect_flag";Rv.complianceCookieName="cookie_consent";
9033Rv.complianceCookieChangeEvent=new Event("complianceCookieChange");let vS=Wo(La);La.subscribe(c=>vS=c);class vfe extends XK{constructor(){super(...arguments),this.smoothedAccelX=0,this.smoothedAccelY=0,this.smoothedAccelZ=0,this.reconnectTimeout=setTimeout(A2.emptyFunction,0),this.timeout=4e3}onBluetoothConnectionError(o){super.onBluetoothConnectionError(o),No.update(a=>(a.isInputConnected=!1,a.isInputAssigned=!1,a))}onReady(){super.onReady(),clearTimeout(this.reconnectTimeout),No.update(o=>(o.isInputReady=!0,o))}onAssigned(o,a){super.onAssigned(o,a),No.update(i=>(i.isInputAssigned=!0,i))}onExpelled(o,a){super.onExpelled(o,a),No.update(i=>(i.isInputConnected=!1,i.isInputAssigned=!1,i.isInputReady=!1,i.offerReconnect=!o,i.reconnectState=ed.INPUT,i)),clearTimeout(this.reconnectTimeout)}onCancelledBluetoothRequest(){super.onCancelledBluetoothRequest(),No.update(o=>(o.requestDeviceWasCancelled=!0,o.isInputConnected=!1,o))}onDisconnected(){super.onDisconnected(),No.update(o=>(o.isInputConnected=!1,o.offerReconnect=!1,o.isInputReady=!1,o.reconnectState=ed.NONE,o))}onConnected(o){super.onConnected(o),Ig(vS("alert.micro.GATTserverInform")),Ig(vS("alert.micro.microBitServiceInform")),Ig(vS("alert.micro.gettingDataInform")),No.update(i=>(i.isInputConnected=!0,i.isRequestingDevice=ed.NONE,i.offerReconnect=!1,i)),clearTimeout(this.reconnectTimeout);const a=()=>this.onCatastrophicError();this.reconnectTimeout=setTimeout(function(){a()},this.timeout),Ig(vS("alert.micro.nowConnectedInform"))}accelerometerChange(o,a,i){super.accelerometerChange(o,a,i);const n=o/1e3,s=a/1e3,h=i/1e3;this.smoothedAccelX=n*.25+this.smoothedAccelX*.75,this.smoothedAccelY=s*.25+this.smoothedAccelY*.75,this.smoothedAccelZ=h*.25+this.smoothedAccelZ*.75,d4.set({accelX:n,accelY:s,accelZ:h,smoothedAccelX:this.smoothedAccelX,smoothedAccelY:this.smoothedAccelY,smoothedAccelZ:this.smoothedAccelZ})}buttonChange(o,a){super.buttonChange(o,a),o!==Va.ButtonStates.Released&&(a==="A"?yN.update(i=>(i.buttonA=1,i.buttonB=0,i)):yN.update(i=>(i.buttonA=0,i.buttonB=1,i)))}onCatastrophicError(){Rv.setReconnectFlag(),location.reload()}}let yS=Wo(La);La.subscribe(c=>yS=c);class yfe extends XK{constructor(){super(...arguments),this.reconnectTimeout=setTimeout(A2.emptyFunction,0),this.timeout=4e3}onBluetoothConnectionError(o){super.onBluetoothConnectionError(o),No.update(a=>(a.isOutputConnected=!1,a.isOutputAssigned=!1,a))}onReady(){super.onReady(),No.update(o=>(o.isOutputReady=!0,o)),clearTimeout(this.reconnectTimeout)}onAssigned(o,a){super.onAssigned(o,a),No.update(i=>(i.isOutputAssigned=!0,i))}onExpelled(o,a){super.onExpelled(o,a),No.update(i=>(i.isOutputConnected=!1,i.offerReconnect=!o,i.isOutputAssigned=!1,i.isOutputReady=!1,a||(i.reconnectState=ed.OUTPUT),i)),clearTimeout(this.reconnectTimeout)}onCancelledBluetoothRequest(){super.onCancelledBluetoothRequest(),No.update(o=>(o.isOutputConnected=!1,o.requestDeviceWasCancelled=!0,o))}accelerometerChange(o,a,i){}buttonChange(o,a){}onConnected(o){super.onConnected(o),Ig(yS("alert.output.GATTserverInform")),Ig(yS("alert.output.microBitServiceInform")),Ig(yS("alert.output.connectingToComponents")),No.update(i=>(i.isOutputConnected=!0,i.isRequestingDevice=ed.NONE,i.offerReconnect=!1,i)),clearTimeout(this.reconnectTimeout);const a=()=>this.onCatastrophicError();this.reconnectTimeout=setTimeout(function(){a()},this.timeout),Ig(yS("alert.output.nowConnectedInform"))}onDisconnected(){super.onDisconnected(),No.update(o=>(o.isOutputConnected=!1,o.isOutputReady=!1,o))}onCatastrophicError(){Rv.setReconnectFlag(),location.reload()}}function rP(c){const o=c-1;return o*o*o+1}function ew(c,{delay:o=0,duration:a=400,easing:i=YB}={}){const n=+getComputedStyle(c).opacity;return{delay:o,duration:a,easing:i,css:s=>`opacity: ${s*n}`}}function D6(c,{delay:o=0,duration:a=400,easing:i=rP,x:n=0,y:s=0,opacity:h=0}={}){const v=getComputedStyle(c),g=+v.opacity,O=v.transform==="none"?"":v.transform,A=g*(1-h),[S,M]=w$(n),[P,L]=w$(s);return{delay:o,duration:a,easing:i,css:(V,N)=>` 9034 transform: ${O} translate(${(1-V)*S}${M}, ${(1-V)*P}${L}); 9035 opacity: ${g-A*N}`}}function bN(c,{delay:o=0,duration:a=400,easing:i=rP,axis:n="y"}={}){const s=getComputedStyle(c),h=+s.opacity,v=n==="y"?"height":"width",g=parseFloat(s[v]),O=n==="y"?["to
9035p","bottom"]:["left","right"],A=O.map(ee=>`${ee[0].toUpperCase()}${ee.slice(1)}`),S=parseFloat(s[`padding${A[0]}`]),M=parseFloat(s[`padding${A[1]}`]),P=parseFloat(s[`margin${A[0]}`]),L=parseFloat(s[`margin${A[1]}`]),V=parseFloat(s[`border${A[0]}Width`]),N=parseFloat(s[`border${A[1]}Width`]);return{delay:o,duration:a,easing:i,css:ee=>`overflow: hidden;opacity: ${Math.min(ee*20,1)*h};${v}: ${ee*g}px;padding-${O[0]}: ${ee*S}px;padding-${O[1]}: ${ee*M}px;margin-${O[0]}: ${ee*P}px;margin-${O[1]}: ${ee*L}px;border-${O[0]}-width: ${ee*V}px;border-${O[1]}-width: ${ee*N}px;`}}function A$(c,{delay:o=0,duration:a=400,easing:i=rP,axis:n="x"}={}){const s=getComputedStyle(c),h=+s.opacity,v=n==="y"?"height":"width",g=parseFloat(s[v]),O=n==="y"?["top","bottom"]:["left","right"],A=O.map(ee=>`${ee[0].toUpperCase()}${ee.slice(1)}`),S=parseFloat(s[`padding${A[0]}`]),M=parseFloat(s[`padding${A[1]}`]),P=parseFloat(s[`margin${A[0]}`]),L=parseFloat(s[`margin${A[1]}`]),V=parseFloat(s[`border${A[0]}Width`]),N=parseFloat(s[`border${A[1]}Width`]);return{delay:o,duration:a,easing:i,css:ee=>`overflow: hidden;opacity: ${Math.min(ee*20,1)*h};${v}: ${ee*g}px;padding-${O[0]}: ${ee*S}px;padding-${O[1]}: ${ee*M}px;margin-${O[0]}: ${ee*P}px;margin-${O[1]}: ${ee*L}px;border-${O[0]}-width: ${ee*V}px;border-${O[1]}-width: ${ee*N}px;`}}function bfe(c){let o,a,i,n,s;const h=c[8].default,v=Gk(h,c,c[7],null);return{c(){o=an("div"),a=an("button"),v&&v.c(),Fs(a,"--color",c[6][c[0]]),Qt(a,"class","outline-none font-bold rounded-full shadow-gray-400 shadow-lg svelte-dkkahu"),Bi(a,"small",c[3]),Bi(a,"normal",!c[3]),Bi(a,"outlined",c[4]),Bi(a,"filled",!c[4]),Bi(a,"fillOnHover",c[5]),Qt(o,"class","grid grid-cols-1 content-center place-items-center")},m(g,O){_r(g,o,O),ft(o,a),v&&v.m(a,null),i=!0,n||(s=sa(a,"click",c[9]),n=!0)},p(g,[O]){v&&v.p&&(!i||O&128)&&Yk(v,h,g,g[7],i?Kk(h,g[7],O,null):Xk(g[7]),null),(!i||O&1)&&Fs(a,"--color",g[6][g[0]]),(!i||O&8)&&Bi(a,"small",g[3]),(!i||O&8)&&Bi(a,"normal",!g[3]),(!i||O&16)&&Bi(a,"outlined",g[4]),(!i||O&16)&&Bi(a,"filled",!g[4]),(!i||O&32)&&Bi(a,"fillOnHover",g[5])},i(g){i||(hr(v,g),i=!0)},o(g){Cr(v,g),i=!1},d(g){g&&br(o),v&&v.d(g),n=!1,s()}}}function xfe(c,o,a){let{$$slots:i={},$$scope:n}=o,{color:s="blue"}=o,{onClick:h=()=>{}}=o,{stopPropagation:v=!1}=o,{small:g=!1}=o,{outlined:O=!1}=o,{fillOnHover:A=!1}=o;const S={blue:"#63BFC2",red:"#FF7777",gray:"gray",pink:"#EDBFD9"},M=P=>{v&&P.stopPropagation(),h()};return c.$$set=P=>{"color"in P&&a(0,s=P.color),"onClick"in P&&a(1,h=P.onClick),"stopPropagation"in P&&a(2,v=P.stopPropagation),"small"in P&&a(3,g=P.small),"outlined"in P&&a(4,O=P.outlined),"fillOnHover"in P&&a(5,A=P.fillOnHover),"$$scope"in P&&a(7,n=P.$$scope)},[s,h,v,g,O,A,S,n,i,M]}class vl extends $o{constructor(o){super(),Vo(this,o,xfe,bfe,jo,{color:0,onClick:1,stopPropagation:2,small:3,outlined:4,fillOnHover:5})}}const iP=f4("btPatternInput",Array(25).fill(!1)),oP=f4("btPatternOutput",Array(25).fill(!1));/*! ***************************************************************************** 9036Copyright (c) Microsoft Corporation. All rights reserved. 9037Licensed under the Apache License, Version 2.0 (the "License"); you may not use 9038this file except in compliance with the License. You may obtain a copy of the 9039License at http://www.apache.org/licenses/LICENSE-2.0 9040 9041THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 9042KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 9043WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 9044MERCHANTABLITY OR NON-INFRINGEMENT. 9045 9046See the Apache Version 2.0 License for specific language governing permissions 9047and limitations under the License. 9048***************************************************************************** */var JK=function(c,o){return(JK=Object.
9048setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var n in i)i.hasOwnProperty(n)&&(a[n]=i[n])})(c,o)};function aP(c,o){function a(){this.constructor=c}JK(c,o),c.prototype=o===null?Object.create(o):(a.prototype=o.prototype,new a)}function xo(c,o,a,i){return new(a||(a=Promise))(function(n,s){function h(O){try{g(i.next(O))}catch(A){s(A)}}function v(O){try{g(i.throw(O))}catch(A){s(A)}}function g(O){var A;O.done?n(O.value):(A=O.value,A instanceof a?A:new a(function(S){S(A)})).then(h,v)}g((i=i.apply(c,o||[])).next())})}function wo(c,o){var a,i,n,s,h={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function v(g){return function(O){return function(A){if(a)throw new TypeError("Generator is already executing.");for(;h;)try{if(a=1,i&&(n=2&A[0]?i.return:A[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,A[1])).done)return n;switch(i=0,n&&(A=[2&A[0],n.value]),A[0]){case 0:case 1:n=A;break;case 4:return h.label++,{value:A[1],done:!1};case 5:h.label++,i=A[1],A=[0];continue;case 7:A=h.ops.pop(),h.trys.pop();continue;default:if(n=h.trys,!((n=n.length>0&&n[n.length-1])||A[0]!==6&&A[0]!==2)){h=0;continue}if(A[0]===3&&(!n||A[1]>n[0]&&A[1]<n[3])){h.label=A[1];break}if(A[0]===6&&h.label<n[1]){h.label=n[1],n=A;break}if(n&&h.label<n[2]){h.label=n[2],h.ops.push(A);break}n[2]&&h.ops.pop(),h.trys.pop();continue}A=o.call(c,h)}catch(S){A=[6,S],i=0}finally{a=n=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}([g,O])}}}function Cx(){}function lu(){lu.init.call(this)}function QK(c){return c._maxListeners===void 0?lu.defaultMaxListeners:c._maxListeners}function wfe(c,o,a){if(o)c.call(a);else for(var i=c.length,n=kA(c,i),s=0;s<i;++s)n[s].call(a)}function _fe(c,o,a,i){if(o)c.call(a,i);else for(var n=c.length,s=kA(c,n),h=0;h<n;++h)s[h].call(a,i)}function kfe(c,o,a,i,n){if(o)c.call(a,i,n);else for(var s=c.length,h=kA(c,s),v=0;v<s;++v)h[v].call(a,i,n)}function Efe(c,o,a,i,n,s){if(o)c.call(a,i,n,s);else for(var h=c.length,v=kA(c,h),g=0;g<h;++g)v[g].call(a,i,n,s)}function Cfe(c,o,a,i){if(o)c.apply(a,i);else for(var n=c.length,s=kA(c,n),h=0;h<n;++h)s[h].apply(a,i)}function O$(c,o,a,i){var n,s,h,v;if(typeof a!="function")throw new TypeError('"listener" argument must be a function');if((s=c._events)?(s.newListener&&(c.emit("newListener",o,a.listener?a.listener:a),s=c._events),h=s[o]):(s=c._events=new Cx,c._eventsCount=0),h){if(typeof h=="function"?h=s[o]=i?[a,h]:[h,a]:i?h.unshift(a):h.push(a),!h.warned&&(n=QK(c))&&n>0&&h.length>n){h.warned=!0;var g=new Error("Possible EventEmitter memory leak detected. "+h.length+" "+o+" listeners added. Use emitter.setMaxListeners() to increase limit");g.name="MaxListenersExceededWarning",g.emitter=c,g.type=o,g.count=h.length,v=g,typeof console.warn=="function"?console.warn(v):console.log(v)}}else h=s[o]=a,++c._eventsCount;return c}function D$(c,o,a){var i=!1;function n(){c.removeListener(o,n),i||(i=!0,a.apply(c,arguments))}return n.listener=a,n}function T$(c){var o=this._events;if(o){var a=o[c];if(typeof a=="function")return 1;if(a)return a.length}return 0}function kA(c,o){for(var a=new Array(o);o--;)a[o]=c[o];return a}Cx.prototype=Object.create(null),lu.EventEmitter=lu,lu.usingDomains=!1,lu.prototype.domain=void 0,lu.prototype._events=void 0,lu.prototype._maxListeners=void 0,lu.defaultMaxListeners=10,lu.init=function(){this.domain=null,lu.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Cx,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},lu.prototype.setMaxListeners=function(c){if(typeof c!="number"||c<0||isNaN(c))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=c,this},lu.prototype.getMaxListeners=function(){return QK(this)},lu.prototype.emit=function(c){var o,a,i,n,s,h,v,g=c==="error";if(h=this._events)g=g&&h.error==null;else if(!g)return!1;if(v=this.domain,g){if(o=arguments[1],!v){if(o instanceof Error)throw o;var O=new Error('Uncaught, unspecified "error" event. ('+o+")");throw O.context=o,O}return o||(o=new Error('Uncaught, unspecified "error" event')),o.domainEmitter=this,o.domain=v,o.domainThrown=!1,v.emit("error",o),!1}if(!(a=h[c]))return!1;var A=typeof a=="function";switch(i=arguments.length){case 1:wfe(a,A,this);break;case 2:_fe(a,A,this,arguments[1]);break;case 3:kfe(a,A,this,arguments[1],arguments[2]);break;case 4:Efe(a,A,this,arguments[1],arguments[2],arguments[3]);break;default:for(n=new Array(i-1),s=1;s<i;s++)n[s-1]=arguments[s];Cfe(a,A,this,n)}return!0},lu.prototype.addListener=function(c,o){return O$(this,c,o,!1)},lu.prototype.on=lu.prototype.addListener,lu.prototype.prependListener=function(c,o){return O$(this,c,o,!0)},lu.prototype.once=function(c,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.on(c,D$(this,c,o)),this},lu.prototype.prependOnceListener=function(c,o){if(typeof o!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(c,D$(this,c,o)),this},lu.prototype.removeListener=function(c,o){var a,i,n,s,h;if(typeof o!="function")throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(a=i[c]))return this;if(a===o||a.listener&&a.listener===o)--this._eventsCount==0?this._events=new Cx:(delete i[c],i.removeListener&&this.emit
9048("removeListener",c,a.listener||o));else if(typeof a!="function"){for(n=-1,s=a.length;s-- >0;)if(a[s]===o||a[s].listener&&a[s].listener===o){h=a[s].listener,n=s;break}if(n<0)return this;if(a.length===1){if(a[0]=void 0,--this._eventsCount==0)return this._events=new Cx,this;delete i[c]}else(function(v,g){for(var O=g,A=O+1,S=v.length;A<S;O+=1,A+=1)v[O]=v[A];v.pop()})(a,n);i.removeListener&&this.emit("removeListener",c,h||o)}return this},lu.prototype.removeAllListeners=function(c){var o,a;if(!(a=this._events))return this;if(!a.removeListener)return arguments.length===0?(this._events=new Cx,this._eventsCount=0):a[c]&&(--this._eventsCount==0?this._events=new Cx:delete a[c]),this;if(arguments.length===0){for(var i,n=Object.keys(a),s=0;s<n.length;++s)(i=n[s])!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=new Cx,this._eventsCount=0,this}if(typeof(o=a[c])=="function")this.removeListener(c,o);else if(o)do this.removeListener(c,o[o.length-1]);while(o[0]);return this},lu.prototype.listeners=function(c){var o,a=this._events;return a&&(o=a[c])?typeof o=="function"?[o.listener||o]:function(i){for(var n=new Array(i.length),s=0;s<n.length;++s)n[s]=i[s].listener||i[s];return n}(o):[]},lu.listenerCount=function(c,o){return typeof c.listenerCount=="function"?c.listenerCount(o):T$.call(c,o)},lu.prototype.listenerCount=T$,lu.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var N$,Sfe=function(){function c(){this.locked=!1}return c.prototype.lock=function(){return xo(this,void 0,void 0,function(){return wo(this,function(o){switch(o.label){case 0:return this.locked?[4,new Promise(function(a){return setTimeout(a,1)})]:[3,2];case 1:return o.sent(),[3,0];case 2:return this.locked=!0,[2]}})})},c.prototype.unlock=function(){this.locked=!1},c}(),ZK=function(c){function o(a,i,n){i===void 0&&(i=0),n===void 0&&(n=1e7);var s=c.call(this)||this;s.transport=a,s.mode=i,s.clockFrequency=n,s.connected=!1,s.sendMutex=new Sfe,s.blockSize=s.transport.packetSize-4-1;var h=s.transport.packetSize-2-1;return s.operationCount=Math.floor(h/5),s}return aP(o,c),o.prototype.bufferSourceToUint8Array=function(a,i){if(!i)return new Uint8Array([a]);var n=i.buffer!==void 0?i.buffer:i,s=new Uint8Array(n.byteLength+1);return s.set([a]),s.set(new Uint8Array(n),1),s},o.prototype.selectProtocol=function(a){return xo(this,void 0,void 0,function(){var i;return wo(this,function(n){switch(n.label){case 0:return i=a===2?59196:59294,[4,this.swjSequence(new Uint8Array([255,255,255,255,255,255,255]))];case 1:return n.sent(),[4,this.swjSequence(new Uint16Array([i]))];case 2:return n.sent(),[4,this.swjSequence(new Uint8Array([255,255,255,255,255,255,255]))];case 3:return n.sent(),[4,this.swjSequence(new Uint8Array([0]))];case 4:return n.sent(),[2]}})})},o.prototype.send=function(a,i){return xo(this,void 0,void 0,function(){var n,s;return wo(this,function(h){switch(h.label){case 0:return n=this.bufferSourceToUint8Array(a,i),[4,this.sendMutex.lock()];case 1:h.sent(),h.label=2;case 2:return h.trys.push([2,,5,6]),[4,this.transport.write(n)];case 3:return h.sent(),[4,this.transport.read()];case 4:if((s=h.sent()).getUint8(0)!==a)throw new Error("Bad response for "+a+" -> "+s.getUint8(0));switch(a){case 3:case 8:case 9:case 10:case 17:case 18:case 19:case 29:case 23:case 24:case 26:case 21:case 22:case 4:if(s.getUint8(1)!==0)throw new Error("Bad status for "+a+" -> "+s.getUint8(1))}return[2,s];case 5:return this.sendMutex.unlock(),[7];case 6:return[2]}})})},o.prototype.clearAbort=function(a){return a===void 0&&(a=30),xo(this,void 0,void 0,function(){return wo(this,function(i){switch(i.label){case 0:return[4,this.send(8,new Uint8Array([0,a]))];case 1:return i.sent(),[2]}})})},o.prototype.dapInfo=function(a){return xo(this,void 0,void 0,function(){var i,n,s,h;return wo(this,function(v){switch(v.label){case 0:return v.trys.push([0,2,,4]),[4,this.send(0,new Uint8Array([a]))];case 1:if(i=v.sent(),(n=i.getUint8(1))===0)return[2,""];switch(a){case 240:case 254:case 255:case 253:if(n===1)return[2,i.getUint8(2)];if(n===2)return[2,i.getUint16(2)];if(n===4)return[2,i.getUint32(2)]}return s=Array.prototype.slice.call(new Uint8Array(i.buffer,2,n)),[2,String.fromCharCode.apply(null,s)];case 2:return h=v.sent(),[4,this.clearAbort()];case 3:throw v.sent(),h;case 4:return[2]}})})},o.prototype.swjSequence=function(a,i){return i===void 0&&(i=8*a.byteLength),xo(this,void 0,void 0,function(){var n,s;return wo(this,function(h){switch(h.label){case 0:n=this.bufferSourceToUint8Array(i,a),h.label=1;case 1:return h.trys.push([1,3,,5]),[4,this.send(18,n)];case 2:return h.sent(),[3,5];case 3:return s=h.sent(),[4,this.clearAbort()];case 4:throw h.sent(),s;case 5:return[2]}})})},o.prototype.swjClock=function(a){return xo(this,void 0,void 0,function(){var i;return wo(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,4]),[4,this.send(17,new Uint8Array([255&a,(65280&a)>>8,(16711680&a)>>16,(4278190080&a)>>24]))];case 1:return n.sent(),[3,4];case 2:return i=n.sent(),[4,this.clearAbort()];case 3:throw n.sent(),i;case 4:return[2]}})})},o.prototype.swjPins=function(a,i,n){return xo(this,void 0,void 0,function(){var s;return wo(this,function(h){switch(h.label){case 0:return h.trys.push([0,2,,4]),[4,this.send(16,new Uint8Array([a,i,255&n,(65280&n)>>8,(16711680&n)>>16,(4278190080&n)>>24]))];case 1:return[2,h.sent().getUint8(1)];case 2:return s=h.sent(),[4,this.clearAbort()];case 3:throw h.sent(),s;case 4:return[2]}})})},o.prototype.dapDelay=function(a){return xo(this,void 0,void 0,function(){var i;return wo(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,4]),[4,this.send(9,new Uint8Array([255&a,(65280&a)>>8]))];case 1:return n.sent(),[3,4];case 2:return i=n.sent(),[4,this.clearAbort()];case 3:throw n.sent(),i;case 4:return[2]}})})},o.prototype.configureTransfer=function(a,i,n){return xo(this,void 0,void 0,function(){var s,h,v;return wo(this,function(g){switch(g.label){case 0:s=new Uint8Array(5),(h=new DataView(s.buffer)).setUint8(0,a),h.setUint16(1,i,!0),h.setUint16(3,n,!0),g.label=1;case 1:return g.trys.push([1,3,,5]),[4,this.send(4,s)];case 2:return g.sent(),[3,5];case 3:return v=g.sent(),[4,this.clearAbort()];case 4:throw g.sent(),v;
9048case 5:return[2]}})})},o.prototype.connect=function(){return xo(this,void 0,void 0,function(){var a,i,n;return wo(this,function(s){switch(s.label){case 0:return this.connected===!0?[2]:[4,this.transport.open()];case 1:s.sent(),s.label=2;case 2:return s.trys.push([2,5,,8]),[4,this.send(17,new Uint32Array([this.clockFrequency]))];case 3:return s.sent(),[4,this.send(2,new Uint8Array([this.mode]))];case 4:if((a=s.sent()).getUint8(1)===0||this.mode!==0&&a.getUint8(1)!==this.mode)throw new Error("Mode not enabled.");return[3,8];case 5:return i=s.sent(),[4,this.clearAbort()];case 6:return s.sent(),[4,this.transport.close()];case 7:throw s.sent(),i;case 8:return s.trys.push([8,11,,13]),[4,this.configureTransfer(0,100,0)];case 9:return s.sent(),[4,this.selectProtocol(1)];case 10:return s.sent(),[3,13];case 11:return n=s.sent(),[4,this.transport.close()];case 12:throw s.sent(),n;case 13:return this.connected=!0,[2]}})})},o.prototype.disconnect=function(){return xo(this,void 0,void 0,function(){var a;return wo(this,function(i){switch(i.label){case 0:if(this.connected===!1)return[2];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,this.send(3)];case 2:return i.sent(),[3,5];case 3:return a=i.sent(),[4,this.clearAbort()];case 4:throw i.sent(),a;case 5:return[4,this.transport.close()];case 6:return i.sent(),this.connected=!1,[2]}})})},o.prototype.reconnect=function(){return xo(this,void 0,void 0,function(){return wo(this,function(a){switch(a.label){case 0:return[4,this.disconnect()];case 1:return a.sent(),[4,new Promise(function(i){return setTimeout(i,100)})];case 2:return a.sent(),[4,this.connect()];case 3:return a.sent(),[2]}})})},o.prototype.reset=function(){return xo(this,void 0,void 0,function(){var a;return wo(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,4]),[4,this.send(10)];case 1:return[2,i.sent().getUint8(2)===1];case 2:return a=i.sent(),[4,this.clearAbort()];case 3:throw i.sent(),a;case 4:return[2]}})})},o.prototype.transfer=function(a,i,n,s){return i===void 0&&(i=2),n===void 0&&(n=0),s===void 0&&(s=0),xo(this,void 0,void 0,function(){var h,v,g,O,A,S,M;return wo(this,function(P){switch(P.label){case 0:h=typeof a=="number"?[{port:a,mode:i,register:n,value:s}]:a,v=new Uint8Array(2+5*h.length),(g=new DataView(v.buffer)).setUint8(0,0),g.setUint8(1,h.length),h.forEach(function(L,V){var N=2+5*V;g.setUint8(N,L.port|L.mode|L.register),g.setUint32(N+1,L.value||0,!0)}),P.label=1;case 1:return P.trys.push([1,3,,5]),[4,this.send(5,v)];case 2:if((O=P.sent()).getUint8(1)!==h.length)throw new Error("Transfer count mismatch");if((A=O.getUint8(2))===2)throw new Error("Transfer response WAIT");if(A===4)throw new Error("Transfer response FAULT");if(A===8)throw new Error("Transfer response PROTOCOL_ERROR");if(A===16)throw new Error("Transfer response VALUE_MISMATCH");if(A===7)throw new Error("Transfer response NO_ACK");return typeof a=="number"?[2,O.getUint32(3,!0)]:(S=4*h.length,[2,new Uint32Array(O.buffer.slice(3,3+S))]);case 3:return M=P.sent(),[4,this.clearAbort()];case 4:throw P.sent(),M;case 5:return[2]}})})},o.prototype.transferBlock=function(a,i,n){return xo(this,void 0,void 0,function(){var s,h,v,g,O,A,S,M;return wo(this,function(P){switch(P.label){case 0:v=4,typeof n=="number"?(s=n,h=2):(s=n.length,h=0,v+=n.byteLength),g=new Uint8Array(v),(O=new DataView(g.buffer)).setUint8(0,0),O.setUint16(1,s,!0),O.setUint8(3,a|h|i),typeof n!="number"&&n.forEach(function(L,V){var N=4+4*V;O.setUint32(N,L,!0)}),P.label=1;case 1:return P.trys.push([1,3,,5]),[4,this.send(6,O)];case 2:if((A=P.sent()).getUint16(1,!0)!==s)throw new Error("Transfer count mismatch");if((S=A.getUint8(3))===2)throw new Error("Transfer response WAIT");if(S===4)throw new Error("Transfer response FAULT");if(S===8)throw new Error("Transfer response PROTOCOL_ERROR");if(S===7)throw new Error("Transfer response NO_ACK");return typeof n=="number"?[2,new Uint32Array(A.buffer.slice(4,4+4*s))]:[3,5];case 3:return M=P.sent(),[4,this.clearAbort()];case 4:throw P.sent(),M;case 5:return[2,void 0]}})})},o}(lu),Afe=/[\xc0-\xff][\x80-\xbf]*$/g,Ofe=/[\xc0-\xff][\x80-\xbf]*/g,Dfe=function(){function c(){}return c.prototype.decode=function(o){var a=Array.prototype.slice.call(new Uint8Array(o)),i=String.fromCodePoint.apply(void 0,a);this.partialChar&&(i=""+this.partialChar+i,this.partialChar=void 0);var n=i.match(Afe);if(n){var s=n[0].length;this.partialChar=i.slice(-s),i=i.slice(0,-s)}return i.replace(Ofe,this.decoderReplacer)},c.prototype.decoderReplacer=function(o){var a=o.codePointAt(0)<<24,i=Math.clz32(~a),n=0,s=o.length,h="";if(i<5&&s>=i){for(a=a<<i>>>24+i,n=1;n<i;n+=1)a=a<<6|63&o.codePointAt(n);a<=65535?h+=String.fromCodePoint(a):a<=1114111?(a-=65536,h+=String.fromCodePoint(55296+(a>>10),56320+(1023&a))):n=0}for(;n<s;n+=1)h+="�";return h},c}(),Tfe=new Dfe,I$=function(c){function o(a,i,n){i===void 0&&(i=0),n===void 0&&(n=1e7);var s=c.call(this,a,i,n)||this;return s.serialPolling=!1,s.serialListeners=!1,s.on("newListener",function(h){return xo(s,void 0,void 0,function(){return wo(this,function(v){return h===o.EVENT_SERIAL_DATA&&this.listenerCount(h)===0&&(this.serialListeners=!0),[2]})})}),s.on("removeListener",function(h){h===o.EVENT_SERIAL_DATA&&s.listenerCount(h)===0&&(s.seri
9048alListeners=!1)}),s}return aP(o,c),o.prototype.isBufferBinary=function(a){for(var i=Array.prototype.slice.call(new Uint16Array(a,0,50)),n=String.fromCharCode.apply(null,i),s=0;s<n.length;s++){var h=n.charCodeAt(s);if(h===65533||h<=8)return!0}return!1},o.prototype.writeBuffer=function(a,i,n){return n===void 0&&(n=0),xo(this,void 0,void 0,function(){var s,h,v,g;return wo(this,function(O){switch(O.label){case 0:s=Math.min(a.byteLength,n+i),h=a.slice(n,s),(v=new Uint8Array(h.byteLength+1)).set([h.byteLength]),v.set(new Uint8Array(h),1),O.label=1;case 1:return O.trys.push([1,3,,5]),[4,this.send(140,v)];case 2:return O.sent(),[3,5];case 3:return g=O.sent(),[4,this.clearAbort()];case 4:throw O.sent(),g;case 5:return this.emit(o.EVENT_PROGRESS,n/a.byteLength),s<a.byteLength?[2,this.writeBuffer(a,i,s)]:[2]}})})},o.prototype.flash=function(a,i){return i===void 0&&(i=62),xo(this,void 0,void 0,function(){var n,s,h;return wo(this,function(v){switch(v.label){case 0:n=function(g){return g.buffer!==void 0}(a)?a.buffer:a,s=this.isBufferBinary(n)?0:1,v.label=1;case 1:return v.trys.push([1,6,,8]),[4,this.send(138,new Uint32Array([s]))];case 2:if(v.sent().getUint8(1)!==0)throw new Error("Flash error");return[4,this.writeBuffer(n,i)];case 3:return v.sent(),this.emit(o.EVENT_PROGRESS,1),[4,this.send(139)];case 4:if(v.sent().getUint8(1)!==0)throw new Error("Flash error");return[4,this.send(137)];case 5:return v.sent(),[3,8];case 6:return h=v.sent(),[4,this.clearAbort()];case 7:throw v.sent(),h;case 8:return[2]}})})},o.prototype.getSerialBaudrate=function(){return xo(this,void 0,void 0,function(){var a;return wo(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,4]),[4,this.send(129)];case 1:return[2,i.sent().getUint32(1,!0)];case 2:return a=i.sent(),[4,this.clearAbort()];case 3:throw i.sent(),a;case 4:return[2]}})})},o.prototype.setSerialBaudrate=function(a){return a===void 0&&(a=9600),xo(this,void 0,void 0,function(){var i;return wo(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,4]),[4,this.send(130,new Uint32Array([a]))];case 1:return n.sent(),[3,4];case 2:return i=n.sent(),[4,this.clearAbort()];case 3:throw n.sent(),i;case 4:return[2]}})})},o.prototype.serialWrite=function(a){return xo(this,void 0,void 0,function(){var i,n;return wo(this,function(s){switch(s.label){case 0:(i=a.split("").map(function(h){return h.charCodeAt(0)})).unshift(i.length),s.label=1;case 1:return s.trys.push([1,3,,5]),[4,this.send(132,new Uint8Array(i).buffer)];case 2:return s.sent(),[3,5];case 3:return n=s.sent(),[4,this.clearAbort()];case 4:throw s.sent(),n;case 5:return[2]}})})},o.prototype.serialRead=function(){return xo(this,void 0,void 0,function(){var a,i,n;return wo(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,4]),[4,this.send(131)];case 1:return(a=s.sent()).byteLength===0||a.getUint8(0)!==131||(i=a.getUint8(1))===0?[2,void 0]:[2,a.buffer.slice(2,2+i)];case 2:return n=s.sent(),[4,this.clearAbort()];case 3:throw s.sent(),n;case 4:return[2]}})})},o.prototype.startSerialRead=function(a,i){return a===void 0&&(a=100),i===void 0&&(i=!0),xo(this,void 0,void 0,function(){var n,s,h;return wo(this,function(v){switch(v.label){case 0:this.serialPolling=!0,v.label=1;case 1:return this.serialPolling?this.serialListeners?(n=this.connected,this.connected!==!1||i!==!0?[3,3]:[4,this.connect()]):[3,7]:[3,9];case 2:v.sent(),v.label=3;case 3:return[4,this.serialRead()];case 4:return s=v.sent(),n!==!1||i!==!0?[3,6]:[4,this.disconnect()];case 5:v.sent(),v.label=6;case 6:s!==void 0&&(h=Tfe.decode(s),this.emit(o.EVENT_SERIAL_DATA,h)),v.label=7;case 7:return[4,new Promise(function(g){return setTimeout(g,a)})];case 8:return v.sent(),[3,1];case 9:return[2]}})})},o.prototype.stopSerialRead=function(){this.serialPolling=!1},o.EVENT_PROGRESS="progress",o.EVENT_SERIAL_DATA="serial",o}(ZK),Nfe=function(){function c(o,a,i){a===void 0&&(a=0),i===void 0&&(i=1e7),this.proxy=o.open!==void 0?new ZK(o,a,i):o}return c.prototype.waitDelay=function(o,a,i){return a===void 0&&(a=0),i===void 0&&(i=100),xo(this,void 0,void 0,function(){var n;return wo(this,function(s){switch(s.label){case 0:n=!0,a>0&&setTimeout(function(){if(n)throw n=!1,new Error("Wait timed out")},a),s.label=1;case 1:return n?[4,o()]:[3,5];case 2:return s.sent()===!0?(n=!1,[2]):i>0?[4,new Promise(function(h){return setTimeout(h,a)})]:[3,4];case 3:s.sent(),s.label=4;case 4:return[3,1];case 5:return[2]}})})}
9048,c.prototype.concatTypedArray=function(o){if(o.length===1)return o[0];for(var a=0,i=0,n=o;i<n.length;i++)a+=n[i].length;for(var s=new Uint32Array(a),h=0,v=0;h<o.length;h++)s.set(o[h],v),v+=o[h].length;return s},c.prototype.readDPCommand=function(o){return[{mode:2,port:0,register:o}]},c.prototype.writeDPCommand=function(o,a){if(o===8){if(a===this.selectedAddress)return[];this.selectedAddress=a}return[{mode:0,port:0,register:o,value:a}]},c.prototype.readAPCommand=function(o){var a=4278190080&o|240&o;return this.writeDPCommand(8,a).concat({mode:2,port:1,register:o})},c.prototype.writeAPCommand=function(o,a){if(o===0){if(a===this.cswValue)return[];this.cswValue=a}var i=4278190080&o|240&o;return this.writeDPCommand(8,i).concat({mode:0,port:1,register:o,value:a})},c.prototype.readMem16Command=function(o){return this.writeAPCommand(0,587202641).concat(this.writeAPCommand(4,o)).concat(this.readAPCommand(12))},c.prototype.writeMem16Command=function(o,a){return this.writeAPCommand(0,587202641).concat(this.writeAPCommand(4,o)).concat(this.writeAPCommand(12,a))},c.prototype.readMem32Command=function(o){return this.writeAPCommand(0,587202642).concat(this.writeAPCommand(4,o)).concat(this.readAPCommand(12))},c.prototype.writeMem32Command=function(o,a){return this.writeAPCommand(0,587202642).concat(this.writeAPCommand(4,o)).concat(this.writeAPCommand(12,a))},c.prototype.transferSequence=function(o){return xo(this,void 0,void 0,function(){var a,i,n,s;return wo(this,function(h){switch(h.label){case 0:a=(a=[]).concat.apply(a,o),i=[],h.label=1;case 1:return a.length?(n=a.splice(0,this.proxy.operationCount),[4,this.proxy.transfer(n)]):[3,3];case 2:return s=h.sent(),i.push(s),[3,1];case 3:return[2,this.concatTypedArray(i)]}})})},c.prototype.connect=function(){return xo(this,void 0,void 0,function(){var o,a=this;return wo(this,function(i){switch(i.label){case 0:return o=-1610612736,[4,this.proxy.connect()];case 1:return i.sent(),[4,this.readDP(0)];case 2:return i.sent(),[4,this.transferSequence([this.writeDPCommand(0,4),this.writeDPCommand(8,0),this.writeDPCommand(4,1342177280)])];case 3:return i.sent(),[4,this.waitDelay(function(){return xo(a,void 0,void 0,function(){return wo(this,function(n){switch(n.label){case 0:return[4,this.readDP(4)];case 1:return[2,(n.sent()&o)===o]}})})})];case 4:return i.sent(),[2]}})})},c.prototype.disconnect=function(){return this.proxy.disconnect()},c.prototype.reconnect=function(){return xo(this,void 0,void 0,function(){return wo(this,function(o){switch(o.label){case 0:return[4,this.disconnect()];case 1:return o.sent(),[4,new Promise(function(a){return setTimeout(a,100)})];case 2:return o.sent(),[4,this.connect()];case 3:return o.sent(),[2]}})})},c.prototype.reset=function(){return this.proxy.reset()},c.prototype.readDP=function(o){return xo(this,void 0,void 0,function(){return wo(this,function(a){switch(a.label){case 0:return[4,this.proxy.transfer(this.readDPCommand(o))];case 1:return[2,a.sent()[0]]}})})},c.prototype.writeDP=function(o,a){return xo(this,void 0,void 0,function(){return wo(this,function(i){switch(i.label){case 0:return[4,this.proxy.transfer(this.writeDPCommand(o,a))];case 1:return i.sent(),[2]}})})},c.prototype.readAP=function(o){return xo(this,void 0,void 0,function(){return wo(this,function(a){switch(a.label){case 0:return[4,this.proxy.transfer(this.readAPCommand(o))];case 1:return[2,a.sent()[0]]}})})},c.prototype.writeAP=function(o,a){return xo(this,void 0,void 0,function(){return wo(this,function(i){switch(i.label){case 0:return[4,this.proxy.transfer(this.writeAPCommand(o,a))];case 1:return i.sent(),[2]}})})},c.prototype.readMem16=function(o){return xo(this,void 0,void 0,function(){return wo(this,function(a){switch(a.label){case 0:return[4,this.proxy.transfer(this.readMem16Command(o))];case 1:return[2,a.sent()[0]]}})})},c.prototype.writeMem16=function(o,a){return xo(this,void 0,void 0,function(){return wo(this,function(i){switch(i.label){case 0:return a<<=(2&o)<<3,[4,this.proxy.transfer(this.writeMem16Command(o,a))];case 1:return i.sent(),[2]}})})},c.prototype.readMem32=function(o){return xo(this,void 0,void 0,function(){return wo(this,function(a){switch(a.label){case 0:return[4,this.proxy.transfer(this.readMem32Command(o))];case 1:return[2,a.sent()[0]]}})})},c.prototype.writeMem32=function(o,a){return xo(this,void 0,void 0,function(){return wo(this,function(i){switch(i.label){case 0:return[4,this.proxy.transfer(this.writeMem32Command(o,a))];case 1:return i.sent(),[2]}})})},c.prototype.readBlock=function(o,a){return xo(this,void 0,void 0,function(){var i,n,s,h;return wo(this,function(v){switch(v.label){case 0:return[4,this.transferSequence([this.writeAPCommand(0,587202642),this.writeAPCommand(4,o)])];case 1:v.sent(),i=[],n=a,v.label=2;case 2:return n>0?(s=Math.min(n,Math.floor(this.proxy.blockSize/4)),[4,this.proxy.transferBlock(1,12,s)]):[3,4];case 3:return h=v.sent(),i.push(h),n-=s,[3,2];case 4:return[2,this.concatTypedArray(i)]}})})},c.prototype.writeBlock=function(o,a){return xo(this,void 0,void 0,function(){var i,n;return wo(this,function(s){switch(s.label){case 0:return[4,this.transferSequence([this.writeAPCommand(0,587202642),this.writeAPCommand(4,o)])];case 1:s.sent(),i=0,s.label=2;case 2:return i<a.length?(n=a.slice(i,i+Math.floor(this.proxy.blockSize/4)),[4,this.proxy.transferBlock(1,12,n)]):[3,4];case 3:return s.sent(),i+=Math.floor(this.proxy.blockSize/4),[3,2];case 4:return[2]}})})},c}(),Ife=function(c){function o(){return c!==null&&c.apply(this,arguments)||this}return aP(o,c),o.prototype.enableDebug=function(){return this.writeMem32(3758157296,-1604386815)},o.prototype.readCoreRegisterCommand=function(a){return this.writeMem32Command(3758157300,a).concat(this.readMem32Command(3758157296)).concat(this.readMem32Command(3758157304))},o.prototype.writeCoreRegisterCommand=function(a,i){return this.writeMem32Command(3758157304,i).concat(this.writeMem32Command(3758157300,65536|a))},o.prototype.getState=function(){return xo(this,void 0,void 0,function(){var a,i,n;return wo(this,function(s){switch(s.label){case 0:return[4,this.readMem32(3758157296)];case 1:return a=s.sent(),i=524288&a?1:262144&a?2:131072&a?3:4,33554432&a?[4,this.readMem32(3758157296)]:[3,3];case 2:return 33554432&(n=s.sent())&&!(16777216&n)?[2,0]:[2,i];case 3:return[2,i];case 4:return[2]}})})},o.prototype.isHalted=function(){return xo(this,void 0,void 0,function(){return wo(this,function(a){switch(a.label){case 0:return[4,this.readMem32(3758157296)];case 1:return[2,!!(131072&a.sent())]}})})},o.prototype.halt=function(a,i){return a===void 0&&(a=!0),i===void 0&&(i=0),xo(this,void 0,void 0,function(){var n=this;return wo(this,function(s){switch(s.label){case 0:return[4,this.isHalted()];case 1:return s.sent()?[2]:[4,this.writeMem32(3758157296,-1604386813)];case 2:return s.sent(),a?[2,this.waitDelay(function(){return n.isHalted()},i)]:[2]}})})},o.prototype.resume=function(a,i){return a===void 0&&(a=!0),i===void 0&&(i=0),xo(this,void 0,void 0,function(){var n=this;return wo(this,function(s){switch(s.label){case 0:return[4,this.isHalted()];case 1:return s.sent()?[4,this.writeMem32(3758157104,7)]:[2];case 2:return s.sent(),[4,this.enableDebug()];case 3:return s.sent(),a?[2,this.waitDelay(function(){return xo(n,void 0,void 0,function(){return wo(this,function(h){switch(h.label){case 0:return[4,this.isHalted()];case 1:return[2,!h.sent()]}})})},i)]:[2]}})})},o.prototype.readCoreRegister=function(a){return xo(this,void 0,void 0,function(){var i;return wo(this,function(n){switch(n.label){case 0:return[4,this.transferSequence([this.writeMem32Command(3758157300,a),this.readMem32Command(3758157296)])];case 1:if(i=n.sent(),!(65536&i[0]))throw new Error("Register not ready");return[2,this.readMem32(3758157304)]}})})},o.prototype.readCoreRegisters=function(a){return xo(this,void 0,void 0,function(){var i,n,s,h,v;return wo(this,function(g){switch(g.label){case 0:i=[],n=0,s=a,g.label=1;case 1:return n<s.length?(h=s[n],[4,this.readCoreRegister(h)]):[3,4];case 2:v=g.sent(),i.push(v),g.label=3;case 3:return n++,[3,1];case 4:return[2,i]}})})},o.prototype.writeCoreRegister=function(a,i){return xo(this,void 0,void 0,function(){var n;return wo(this,function(s){switch(s.label){case 0:return[4,this.transferSequence([this.writeMem32Command(3758157304,i),this.writeMem32Command(3758157300,65536|a),this.readMem32Command(3758157296)])];case 1:if(n=s.sent(),!(65536&n[0]))throw new Error("Register not ready");return[2]}})})},o.prototype.execute=function(a,i,n,s,h){h===void 0&&(h=a+1);for(var v=[],g=5;g<arguments.length;g++)v[g-5]=arguments[g];return xo(this,void 0,void 0,function(){var O,A,S,M=this;return wo(this,function(P){switch(P.label){case 0:for(i[i.length-1]!==48682&&((O=new Uint32Array(i.length+1)).set(i),O.set([48682],i.length-1),i=O),A=[this.writeCoreRegisterCommand(13,n),this.writeCoreRegisterCommand(15,s),this.writeCoreRegisterCommand(14,h)],S=0;S<Math.min(v.length,12);S++)A.push(this.writeCoreRegisterCommand(S,v[S]));return A.push(this.writeCoreRegisterCommand(16,16777216)),[4,this.halt()];case 1:return P.sent(),[4,this.transferSequence(A)];case 2:return P.sent(),[4,this.writeBlock(a,i)];case 3:return P.sent(),[4,this.resume(!1)];case 4:return P.sent(),[4,this.waitDelay(function(){return M.isHalted()},1e4)];case 5:return P.sent(),[2]}})})},o.prototype.softReset=function(){return xo(this,void 0,void 0,function(){return wo(this,function(a){switch(a.label){case 0:return[4,this.writeMem32(3758157308,0)];case 1:return a.sent(),[2,this.writeMem32(3758157068,100270084)]}})})},o.prototype.setTargetResetState=function(a){return a===void 0&&(a=!0),xo(this,void 0,void 0,function(){var i;return wo(this,function(n){switch(n.label){case 0:return[4,this.writeMem32(3758157308,1)];case 1:return n.sent(),a!==!0?[3,3]:[4,this.reset()];case 2:return n.sent(),[3,6];case 3:return[4,this.readMem32(3758157068)];case 4:return i=n.sent(),[4,this.writeMem32(3758157068,100270084|i)];case 5:n.sent(),n.label=6;case 6:return[4,this.writeMem32(3758157308,0)];case 7:return n.sent(),[2]}})})},o}(Nfe);(function(c){c[c.ENABLE=1]="ENABLE",c[c.KEY=2]="KEY"})(N$||(N$={}));var Mfe=function(){function c(o,a,i,n){a===void 0&&(a=255),i===void 0&&(i=1),n===void 0&&(n=!1),this.device=o,this.interfaceClass=a,this.configuration=i,this.alwaysControlTransfer=n,this.packetSize=64}return c.prototype.extendBuffer=function(o,a){var i=o.buffer!==void 0?o.buffer:o,n=Math.min(i.byteLength,a),s=new Uint8Array(n);return s.set(new Uint8Array(i)),s},c.prototype.open=function(){return xo(this,void 0,void 0,function(){var o,a,i,n,s,h,v=this;return wo(this,function(g){switch(g.label){case 0:return[4,this.device.open()];case 1:return g.sent(),[4,this.device.selectConfiguration(this.configuration)];case 2:if(g.sent(),!(o=this.device.configuration.interfaces.filter(function(O){return O.alternates[0].interfaceClass===v.interfaceClass})).length)throw new Error("No valid interfaces found.");if((a=o.find(function(O){return O.alternates[0].endpoints.length>0}))||(a=o[0]),this.interfaceNumber=a.interfaceNumber,!this.alwaysControlTransfer)for(i=a.alternates[0].endpoints,this.endpointIn=void 0,this.endpointOut=void 0,n=0,s=i;n<s.length;n++)(h=s[n]).direction!=="in"||this.endpointIn?h.direction!=="out"||this.endpointOut||(this.endpointOut=h):this.endpointIn=h;return[2,this.device.claimInterface(this.interfaceNumber)]}})})},c.prototype.close=function(){return this.device.close()},c.prototype.read=function(){return xo(this,void 0,void 0,function(){var o;return wo(this,function(a){switch(a.label){case 0:if(this.interfaceNumber===void 0)throw new Error("No device opened");return this.endpointIn?[4,this.device.transferIn(this.endpointIn.endpointNumber,this.packetSize)]:[3,2];case 1:return o=a.sent(),[3,4];case 2:return[4,this.device.controlTransferIn({requestType:"class",recipient:"interface",request:1,value:256,index:this.interfaceNumber},this.packetSize)];case 3:o=a.sent(),a.label=4;case 4:return[2,o.data]}})})},c.prototype.write=function(o){return xo(this,void 0,void 0,function(){var a;return wo(this,function(i){switch(i.label){case 0:if(this.interfaceNumber===void 0)throw new Error("No device opened");return a=this.extendBuffer(o,this.packetSize),this.endpointOut?[4,this.device.transferOut(this.endpointOut.endpointNumber,a)]:[3,2];case 1:return i.sent(),[3,4];case 2:return[4,this.device.controlTransferOut({requestType:"class",recipient:"interface",request:9,value:512,index:this.interfaceNumber},a)];case 3:i.sent(),i.label=4;case 4:return[2]}})})},c}();class sP extends Ife{constructor(o){const a=new Mfe(o);super(a),this.usbDevice=o,this.transport=a}static async requestConnection(){const o={filters:[{vendorId:Va.USBSpecs.VENDOR_ID,productId:Va.USBSpecs.PRODUCT_ID}]};try{const a=await navigator.usb.requestDevice(o);return new sP(a)}catch(a){return console.log(a),Promise.reject(a)}}getSerialNumber(){return this.usbDevice.serialNumber.toString()}getModelNumber(){const o=this.usbDevice.serialNumber.toString().substring(0,4);return parseInt(o)<9903?1:2}async getFriendlyName(){let o="",a;try{await this.connect();const i=await this.readMem32(Va.USBSpecs.FICR+Va.USBSpecs.DEVICE_ID_1);o=Va.Utility.serialNumberToName(i)}catch(i){console.log(i),a=i}finally{await this.disconnect()}return o?Promise.resolve(o):Promise.reject(a)}async flashHex(o,a){const n=await(await fetch(o)).arrayBuffer(),s=new I$(this.transport);s.on(I$.EVENT_PROGRESS,h=>{a(h)});try{await s.connect(),await s.flash(n),await s.disconnect()}catch(h){return console.log(h),Promise.reject(h)}return Promise.resolve()}}const zT=class{static isInputAssigned(){return this.assignedInputMicrobit!==void 0}static isInputConnected(){return this.isInputAssigned()?this.getInput().isConnected():!1}static isOutputAssigned(){return this.assignedOutputMicrobit!==void 0}static isOutputConnected(){return this.isOutputAssigned()?this.getOutput().isConnected():!1}static isOutputReady(){return this.isOutputConnected()?!(!this.outputMatrix&&!this.outputIO&&!this.outputUart):!1}static isMicrobitLinked(){return this.linkedMicrobit!==void 0}
9048static getInput(){if(!this.isInputAssigned()||!this.assignedInputMicrobit)throw new Error("Cannot get input microbit, it is not assigned!");return this.assignedInputMicrobit}static getOutput(){if(!this.isOutputAssigned()||!this.assignedOutputMicrobit)throw new Error("Cannot get output microbit, it is not assigned!");return this.assignedOutputMicrobit}static async assignInput(c){if(c.length!==5)throw new Error("Could not connect, the name specified must be of length 5!");const o=mc.getInputBehaviour(),a=h=>{this.assignedInputMicrobit=h,this.inputName=c,o.onConnected(c),zT.listenToInputServices().then(()=>{o.onReady()}).catch(v=>{console.log(v)})},i=h=>{this.isInputOutputTheSame()&&mc.getOutputBehaviour().onDisconnected(),h?this.isInputAssigned()&&(mc.getInputBehaviour().onExpelled(h,!0),mc.getOutputBehaviour().onExpelled(h,!0),this.clearAssignedOutputReference(),this.clearAssignedInputReference()):(o.onDisconnected(),this.isInputReconnecting=!0),this.clearBluetoothServiceActionQueue()},n=h=>{if(this.isInputReconnecting=!1,this.inputFlaggedForDisconnect){this.disconnectInputSafely(h),this.inputFlaggedForDisconnect=!1;return}this.inputName=c,this.assignedInputMicrobit=h,this.isInputOutputTheSame()&&mc.getOutputBehaviour().onConnected(c),o.onConnected(c),zT.listenToInputServices().then(()=>{this.isInputOutputTheSame()?(this.assignedOutputMicrobit=h,this.inputName=c,zT.listenToOutputServices().then(()=>{o.onReady(),mc.getOutputBehaviour().onReady()}).catch(v=>{console.log(v)})):o.onReady()}).catch(v=>{console.log(v)})},s=()=>{mc.getInputBehaviour().onExpelled(!1,!0),mc.getOutputBehaviour().onExpelled(!1,!0),this.clearAssignedOutputReference()};try{const h=await dk.requestDevice(c,this.onFailedConnection(o));return await dk.createMicrobitBluetooth(h,a,i,this.onFailedConnection(o),n,s),o.onAssigned(this.getInput(),c),this.inputName=c,this.inputVersion=this.getInput().getVersion(),!0}catch(h){console.log(h),this.onFailedConnection(o)(h)}return!1}static async disconnectInputSafely(c){await c.listenToAccelerometer(A2.emptyFunction),await c.listenToButton("A",A2.emptyFunction),await c.listenToButton("B",A2.emptyFunction),c.disconnect()}static async listenToInputServices(){const c=mc.getInputBehaviour();if(!this.isInputConnected())throw new Error("Could not listen to services, no microbit connected!");await this.getInput().listenToAccelerometer(c.accelerometerChange.bind(c)),await this.getInput().listenToButton("A",c.buttonChange.bind(c)),await this.getInput().listenToButton("B",c.buttonChange.bind(c))}static async assignOutput(c){console.assert(c.length==5);const o=mc.getOutputBehaviour(),a=h=>{this.assignedOutputMicrobit=h,o.onConnected(c),this.listenToOutputServices().then(()=>{o.onReady()}).catch(v=>{console.log(v)})},i=h=>{h?this.isOutputAssigned()&&(mc.getOutputBehaviour().onExpelled(h),this.clearAssignedOutputReference()):(this.isOutputReconnecting=!0,mc.getOutputBehaviour().onDisconnected()),this.clearBluetoothServiceActionQueue()},n=h=>{if(this.isOutputReconnecting=!1,this.outputFlaggedForDisconnect){this.outputFlaggedForDisconnect=!1,this.disconnectOutputSafely(h);return}this.assignedOutputMicrobit=h,o.onConnected(c),this.listenToOutputServices().then(()=>{o.onReady()}).catch(v=>{console.log(v)})},s=()=>{o.onExpelled(!1,!1)};try{const h=await dk.requestDevice(c,this.onFailedConnection(o));return await dk.createMicrobitBluetooth(h,a,i,this.onFailedConnection(o),n,s),o.onAssigned(this.getOutput(),c),this.outputName=c,this.outputVersion=this.getOutput().getVersion(),!0}catch(h){this.onFailedConnection(o)(h)}return!1}static onFailedConnection(c){return o=>{o?o.message&&o.message.includes("User cancelled the requestDevice() chooser")?c.onCancelledBluetoothRequest():c.onBluetoothConnectionError(o):c.onBluetoothConnectionError("Unknown error")}}static async disconnectOutputSafely(c){await this.getIOOf(c),await this.getMatrixOf(c),await(await c.getUARTService()).getCharacteristic(Va.Characteristics.UART_DATA_RX),c.disconnect()}static async listenToOutputServices(){if(!this.isOutputConnected())throw new Error("Could not listen to services, no microbit connected!");this.outputIO=await this.getIOOf(this.getOutput()),this.outputMatrix=await this.getMatrixOf(this.getOutput());const c=await this.getOutput().getUARTService();this.outputUart=await c.getCharacteristic(Va.Characteristics.UART_DATA_RX)}static getAssignedOutput(){if(!this.assignedOutputMicrobit)throw new Error("No output microbit has been assigned!");return this.assignedOutputMicrobit}static getAssignedInput(){if(!this.assignedInputMicrobit)throw new Error("No input microbit has been assigned!");return this.assignedInputMicrobit}static isInputOutputTheSame(){return!this.isOutputAssigned()||!this.isInputAssigned()?!1:this.getInput().getDevice().id==this.getOutput().getDevice().id}static expelInputAndOutput(){if(!this.isInputAssigned()&&!this.isOutputAssigned())throw new Error("Could not disconnect microbits, none have been connected yet!");this.isInputOutputTheSame()?(mc.getInputBehaviour().onExpelled(!0,!0),mc.getOutputBehaviour().onExpelled(!0,!0),this.disconnectOrFlagInputGATT()):(this.isOutputAssigned()&&(mc.getOutputBehaviour().onExpelled(!0,!0),this.disconnectOrFlagOutputGATT()),this.isInputAssigned()&&(mc.getInputBehaviour().onExpelled(!0,!0),this.disconnectOrFlagInputGATT())),this.clearAssignedInputReference(),this.clearAssignedOutputReference()}static expelOutput(){if(!this.isOutputAssigned())throw new Error("Cannot disconnect, no output micro:bit is connected");mc.getOutputBehaviour().onExpelled(!0),this.isInputOutputTheSame()?(this.clearAssignedOutputReference(),this.setGladSmiley(this.getInput())):(this.disconnectOrFlagOutputGATT(),this.clearAssignedOutputReference())}static expelInput(){if(!this.isInputAssigned())throw new Error("Cannot disconnect, no input micro:bit is connected");mc.getInputBehaviour().onExpelled(!0),this.isInputOutputTheSame()?this.expelInputAndOutput():(this.disconnectOrFlagInputGATT(),this.clearAssignedInputReference())}static sendToOutputPin(c){if(!this.isOutputAssigned())throw new Error("No output microbit is connected, cannot send to pin.");if(!this.outputIO)throw new Error("Cannot send to output pin, have not subscribed to the IO service yet!");const o=new DataView(new ArrayBuffer(c.length*2));
9048c.forEach((a,i)=>{o.setInt8(i*2,a.pin),o.setInt8(i*2+1,a.on?1:0),pfe.set({text:`Turn pin ${a.pin} ${a.on?"on":"off"}`})}),this.addToServiceActionQueue(this.outputIO,o)}static setOutputMatrix(c){if(!this.isOutputAssigned())throw new Error("No output microbit is connected, cannot set matrix.");if(!this.outputMatrix)throw new Error("Cannot send to output matrix, have not subscribed to the matrix service yet!");const o=new DataView(new ArrayBuffer(5));for(let a=0;a<5;a++)o.setUint8(a,this.subarray(c,a*5,5+a*5).reduce((i,n)=>i<<1|(n?1:0),0));this.addToServiceActionQueue(this.outputMatrix,o)}static useInputAsOutput(){if(!this.isInputAssigned())throw new Error("No input microbit has be defined! Please check that it is connected before using it");if(!this.inputName)throw new Error("Something went wrong. Input microbit was specified, but without name!");this.assignedOutputMicrobit=this.getInput(),this.outputName=this.inputName,this.outputVersion=this.inputVersion,mc.getOutputBehaviour().onAssigned(this.getOutput(),this.outputName),mc.getOutputBehaviour().onConnected(this.outputName),this.listenToOutputServices().then(()=>{mc.getOutputBehaviour().onReady()}).catch(c=>{console.log(c)})}static getInputVersion(){if(!this.inputVersion)throw new Error("No version has been set, has the micro:bit been connected?");return this.inputVersion}static getOutputVersion(){if(!this.outputVersion)throw new Error("No version has been set, has the micro:bit been connected?");return this.outputVersion}static getOutputName(){if(!this.outputName)throw new Error("No name has been set, has the micro:bit connected?");return this.outputName}static getInputName(){if(!this.inputName)throw new Error("No name has been set, has the micro:bit connected?");return this.inputName}static sendToOutputUart(c,o){if(!this.assignedOutputMicrobit)throw new Error("No output microbit has been set");if(!this.outputUart)throw new Error("Cannot send to uart. Have not subscribed to UART service yet!");const a=new DataView(new ArrayBuffer(2+o.length));
9048a.setUint8(0,c.charCodeAt(0));for(let i=0;i<o.length;i++)a.setUint8(i+1,o.charCodeAt(i));a.setUint8(1+o.length,"#".charCodeAt(0)),this.addToServiceActionQueue(this.outputUart,a)}static async linkMicrobit(){try{this.linkedMicrobit=await sP.requestConnection()}catch(c){return console.log(c),Promise.reject(c)}}static getLinked(){if(!this.isMicrobitLinked()||!this.linkedMicrobit)throw new Error("No microbit has been linked!");return this.linkedMicrobit}static async unlinkMicrobit(){if(!this.isMicrobitLinked())throw new Error("Cannot disconnect USB. No USB microbit could be found");await this.getLinked().disconnect()}static flashHexToLinked(c){if(!this.isMicrobitLinked())throw new Error("Cannot flash to USB, none are connected!");const o=this.getLinked().getModelNumber(),a=this.hexFiles[o];return this.getLinked().flashHex(a,c)}static async getLinkedFriendlyName(){if(!this.isMicrobitLinked())throw new Error("Cannot get friendly name from USB, none are connected!");return await this.getLinked().getFriendlyName()}static disconnectOrFlagInputGATT(){if(!this.assignedInputMicrobit)throw new Error("No input micro:bit could be found while disconnecting from GATT");this.isInputReconnecting?this.inputFlaggedForDisconnect=!0:this.assignedInputMicrobit.disconnect()}static disconnectOrFlagOutputGATT(){if(!this.assignedOutputMicrobit)throw new Error("No output micro:bit could be found while disconnecting from GATT");this.isOutputReconnecting?this.outputFlaggedForDisconnect=!0:this.assignedOutputMicrobit.disconnect()}static clearAssignedOutputReference(){this.assignedOutputMicrobit=void 0,this.outputName=void 0,this.outputVersion=void 0,this.outputIO=void 0,this.outputUart=void 0,this.outputMatrix=void 0}static clearAssignedInputReference(){this.assignedInputMicrobit=void 0,this.inputName=void 0,this.inputVersion=void 0}static addToServiceActionQueue(c,o){this.bluetoothServiceActionQueue.update(a=>(a.queue.push({service:c,view:o}),a)),this.processServiceActionQueue()}static processServiceActionQueue(){if(Wo(this.bluetoothServiceActionQueue).busy||Wo(this.bluetoothServiceActionQueue).queue.length==0)return;Wo(this.bluetoothServiceActionQueue).busy=!0;const{service:c,view:o}=Wo(this.bluetoothServiceActionQueue).queue.shift()??{service:void 0,view:void 0};if(c===void 0)throw new Error("Could not process the service queue, an element in the queue was not provided with a service to execute on.");c.writeValue(o).then(()=>{Wo(this.bluetoothServiceActionQueue).busy=!1,this.processServiceActionQueue()}).catch(a=>{console.log(a),a&&a.message.includes("GATT Service no longer exists")&&this.listenToOutputServices().then(()=>{console.log("Attempted to fix missing gatt!")}).catch(()=>{console.error("Failed to fix missing GATT service issue. Uncharted territory")}),Wo(this.bluetoothServiceActionQueue).busy=!1,this.processServiceActionQueue()})}static async getMatrixOf(c){if(!c)throw new Error("Cannot get matrix of undefined microbit");return await(await c.getLEDService()).getCharacteristic(Va.Characteristics.LED_MATRIX_STATE)}static async getIOOf(c){if(!c)throw new Error("Cannot get IO of undefined microbit.");return await(await c.getIOService()).getCharacteristic(Va.Characteristics.IO_DATA)}static subarray(c,o,a){const i=[];for(let n=o;n<a;n++)i.push(c[n]);return i}static clearBluetoothServiceActionQueue(){this.bluetoothServiceActionQueue.set({busy:!1,queue:[]})}static async setGladSmiley(c){try{await c.setLEDMatrix([[0,0,0,0,0],[0,1,0,1,0],[0,0,0,0,0],[1,0,0,0,1],[0,1,1,1,0]])}catch(o){console.log(o)}}};let pu=zT;pu.hexFiles={1:"firmware/ml-microbit-cpp-version-combined.hex",2:"firmware/MICROBIT.hex",universal:"firmware/universal-hex.hex"};pu.assignedInputMicrobit=void 0;pu.assignedOutputMicrobit=void 0;pu.inputName=void 0;pu.outputName=void 0;pu.linkedMicrobit=void 0;pu.isInputReconnecting=!1;pu.isOutputReconnecting=!1;pu.inputFlaggedForDisconnect=!1;pu.outputFlaggedForDisconnect=!1;pu.bluetoothServiceActionQueue=Dc({busy:!1,queue:[]});function Ffe(c){let o;return{c(){o=Sr(c[1])},m(a,i){_r(a,o,i)},p(a,i){i&2&&Ur(o,a[1])},d(a){a&&br(o)}}}function Rfe(c){let o,a,i,n,s,h,v,g,O,A,S,M,P,L;
9048return A=new vl({props:{onClick:c[5],$$slots:{default:[Ffe]},$$scope:{ctx:c}}}),{c(){o=an("div"),a=an("div"),i=an("div"),n=an("button"),n.innerHTML='<i class="fas fa-plus text-lg text-gray-600 hover:text-gray-800 duration-75 svelte-1rnkjvh" style="transform: rotate(45deg);"></i>',s=or(),h=an("p"),v=Sr(c[0]),g=or(),O=an("div"),xi(A.$$.fragment),Qt(n,"class","hover:bg-gray-100 rounded outline-transparent w-8 svelte-1rnkjvh"),Qt(i,"class","absolute right-2 top-2 svelte-1rnkjvh"),Qt(O,"class","flex justify-center"),Qt(a,"class","w-100"),Qt(o,"class","absolute top-8 right-4 bg-white rounded-md p-6 border-1 border-black z-5")},m(V,N){_r(V,o,N),ft(o,a),ft(a,i),ft(i,n),ft(a,s),ft(a,h),ft(h,v),ft(a,g),ft(a,O),gi(A,O,null),M=!0,P||(L=sa(n,"click",c[4]),P=!0)},p(V,[N]){(!M||N&1)&&Ur(v,V[0]);const ee={};N&4&&(ee.onClick=V[5]),N&1026&&(ee.$$scope={dirty:N,ctx:V}),A.$set(ee)},i(V){M||(hr(A.$$.fragment,V),Ll(()=>{M&&(S||(S=Qd(o,A$,{},!0)),S.run(1))}),M=!0)},o(V){Cr(A.$$.fragment,V),S||(S=Qd(o,A$,{},!1)),S.run(0),M=!1},d(V){V&&br(o),vi(A),V&&S&&S.end(),P=!1,L()}}}function Bfe(c,o,a){let i,n,s,h;Vi(c,No,M=>a(2,i=M)),Vi(c,oP,M=>a(7,n=M)),Vi(c,iP,M=>a(8,s=M)),Vi(c,La,M=>a(9,h=M));let v,g;No.subscribe(M=>{M.reconnectState===ed.INPUT?(a(0,v=h("popup.disconnectedWarning.input")),a(1,g=h("popup.disconnectedWarning.reconnectButton.input"))):M.reconnectState===ed.OUTPUT&&(a(0,v=h("popup.disconnectedWarning.output")),a(1,g=h("popup.disconnectedWarning.reconnectButton.output")))}),No.subscribe(M=>{M.offerReconnect});const O=M=>{console.assert(M!=ed.NONE);const P=M===ed.INPUT?s:n,L=Va.Utility.patternToName(P);(()=>M==ed.INPUT?pu.assignInput(L):pu.assignOutput(L))().then(N=>{N&&fu(No,i.offerReconnect=!1,i)})};return[v,g,i,O,()=>fu(No,i.offerReconnect=!1,i),()=>O(i.reconnectState)]}class Pfe extends $o{constructor(o){super(),Vo(this,o,Bfe,Rfe,jo,{})}}function M$(c){let o,a,i,n,s,h;return{c(){o=an("div"),a=an("div"),i=an("p"),n=Sr(c[0]),Qt(i,"class","text-red-600 text-center shadow-lg text-2xl m-2 p-5 w-max bg-white rounded-xl border border-solid border-warm-gray-400"),Qt(a,"class","flex justify-center"),Qt(o,"class","absolute mt-2 w-full z-100 textAnimation")},m(v,g){_r(v,o,g),ft(o,a),ft(a,i),ft(i,n),h=!0},p(v,g){(!h||g&1)&&Ur(n,v[0])},i(v){h||(Ll(()=>{h&&(s||(s=Qd(o,ew,{},!0)),s.run(1))}),h=!0)},o(v){s||(s=Qd(o,ew,{},!1)),s.run(0),h=!1},d(v){v&&br(o),v&&s&&s.end()}}}function F$(c){let o,a;return o=new Pfe({}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function jfe(c){let o,a,i,n=c[1]&&M$(c),s=c[2].offerReconnect&&F$();return{c(){o=an("div"),n&&n.c(),a=or(),s&&s.c()},m(h,v){_r(h,o,v),n&&n.m(o,null),ft(o,a),s&&s.m(o,null),i=!0},p(h,[v]){h[1]?n?(n.p(h,v),v&2&&hr(n,1)):(n=M$(h),n.c(),hr(n,1),n.m(o,a)):n&&(Bs(),Cr(n,1,1,()=>{n=null}),Ps()),h[2].offerReconnect?s?v&4&&hr(s,1):(s=F$(),s.c(),hr(s,1),s.m(o,null)):s&&(Bs(),Cr(s,1,1,()=>{s=null}),Ps())},i(h){i||(hr(n),hr(s),i=!0)},o(h){Cr(n),Cr(s),i=!1},d(h){h&&br(o),n&&n.d(),s&&s.d()}}}function Lfe(c,o,a){let i,n;Vi(c,nP,O=>a(3,i=O)),Vi(c,No,O=>
9048a(2,n=O));let s="",h=!1,v;function g(O){O.warning&&(a(0,s=O.text),a(1,h=!0),v&&clearTimeout(v),v=setTimeout(()=>{a(1,h=!1)},3e3))}return c.$$.update=()=>{c.$$.dirty&8&&g(i)},[s,h,n,i]}class zfe extends $o{constructor(o){super(),Vo(this,o,Lfe,jfe,jo,{})}}function Ufe(c){let o,a,i,n,s,h=c[1]("menu.data.examples")+"",v;return{c(){o=an("div"),a=an("p"),i=Sr(c[0]),n=or(),s=an("p"),v=Sr(h),Qt(a,"class","text-7xl mb-4"),Qt(s,"class","text-xl"),Qt(o,"class","w-full text-center justify-center pt-5 pb-7")},m(g,O){_r(g,o,O),ft(o,a),ft(a,i),ft(o,n),ft(o,s),ft(s,v)},p(g,[O]){O&1&&Ur(i,g[0]),O&2&&h!==(h=g[1]("menu.data.examples")+"")&&Ur(v,h)},i:Fi,o:Fi,d(g){g&&br(o)}}}function Wfe(c,o,a){let i,n,s;return Vi(c,Jd,h=>a(2,n=h)),Vi(c,La,h=>a(1,s=h)),c.$$.update=()=>{c.$$.dirty&4&&a(0,i=n.reduce((h,v)=>h+=v.recordings.length,0))},[i,s,n]}class Vfe extends $o{constructor(o){super(),Vo(this,o,Wfe,Ufe,jo,{})}}function $fe(c){let o;return{c(){o=Iv("rect"),Qt(o,"width",c[3]),Qt(o,"height",c[2]),Qt(o,"x","0"),Qt(o,"y","0"),Qt(o,"rx","8"),Qt(o,"ry","8")},m(a,i){_r(a,o,i)},p(a,i){i&8&&Qt(o,"width",a[3]),i&4&&Qt(o,"height",a[2])},d(a){a&&br(o)}}}function R$(c){let o,a,i,n,s,h;return{c(){o=Iv("animate"),n=Iv("animate"),Qt(o,"attributeName","x1"),Qt(o,"from",a="-"+c[6]+"%"),Qt(o,"to","100%"),Qt(o,"dur",i=c[4]+"s"),Qt(o,"repeatCount","indefinite"),Qt(n,"attributeName","x2"),Qt(n,"from","0%"),Qt(n,"to",s=100+c[6]+"%"),Qt(n,"dur",h=c[4]+"s"),Qt(n,"repeatCount","indefinite")},m(v,g){_r(v,o,g),_r(v,n,g)},p(v,g){g&64&&a!==(a="-"+v[6]+"%")&&Qt(o,"from",a),g&16&&i!==(i=v[4]+"s")&&Qt(o,"dur",i),g&64&&s!==(s=100+v[6]+"%")&&Qt(n,"to",s),g&16&&h!==(h=v[4]+"s")&&Qt(n,"dur",h)},d(v){v&&br(o),v&&br(n)}}}function Hfe(c){let o,a,i,n,s,h,v,g,O,A;const S=c[11].default,M=Gk(S,c,c[10],null),P=M||$fe(c);let L=c[5]&&R$(c);return{c(){o=Iv("svg"),a=Iv("rect"),i=Iv("defs"),n=Iv("clipPath"),P&&P.c(),s=Iv("linearGradient"),L&&L.c(),h=Iv("stop"),v=Iv("stop"),g=Iv("stop"),Qt(a,"f
9048ill","url(#"+c[9]+")"),Qt(a,"clip-path","url(#"+c[8]+")"),Qt(a,"width",c[3]),Qt(a,"height",c[2]),Qt(a,"x","0"),Qt(a,"y","0"),Qt(n,"id",c[8]),Qt(h,"stop-color",c[1]),Qt(h,"offset","0%"),Qt(v,"stop-color",c[0]),Qt(v,"offset","50%"),Qt(g,"stop-color",c[1]),Qt(g,"offset","100%"),Qt(s,"id",c[9]),Qt(s,"x1",O="-"+c[6]+"%"),Qt(s,"y1","50%"),Qt(s,"x2","0%"),Qt(s,"y2","50%"),Qt(o,"width",c[3]),Qt(o,"height",c[2]),Qt(o,"aria-label",c[7]),Qt(o,"preserveAspectRatio","none")},m(V,N){_r(V,o,N),ft(o,a),ft(o,i),ft(i,n),P&&P.m(n,null),ft(i,s),L&&L.m(s,null),ft(s,h),ft(s,v),ft(s,g),A=!0},p(V,[N]){(!A||N&8)&&Qt(a,"width",V[3]),(!A||N&4)&&Qt(a,"height",V[2]),M?M.p&&(!A||N&1024)&&Yk(M,S,V,V[10],A?Kk(S,V[10],N,null):Xk(V[10]),null):P&&P.p&&(!A||N&12)&&P.p(V,A?N:-1),V[5]?L?L.p(V,N):(L=R$(V),L.c(),L.m(s,h)):L&&(L.d(1),L=null),(!A||N&2)&&Qt(h,"stop-color",V[1]),(!A||N&1)&&Qt(v,"stop-color",V[0]),(!A||N&2)&&Qt(g,"stop-color",V[1]),(!A||N&64&&O!==(O="-"+V[6]+"%"))&&Qt(s,"x1",O),(!A||N&8)&&Qt(o,"width",V[3]),(!A||N&4)&&Qt(o,"height",V[2]),(!A||N&128)&&Qt(o,"aria-label",V[7])},i(V){A||(hr(P,V),A=!0)},o(V){Cr(P,V),A=!1},d(V){V&&br(o),P&&P.d(V),L&&L.d()}}}function B$(){return Math.random().toString(36).substring(2)}function qfe(c,o,a){let{$$slots:i={},$$scope:n}=o,{secondaryColor:s="#F5F5F7"}=o,{primaryColor:h="#EBECEF"}=o,{height:v=200}=o,{width:g=400}=o,{speed:O=2}=o,{animate:A=!0}=o,{secondaryColorPercentWidth:S=100}=o,{ariaLabel:M=null}=o,P=B$(),L=B$();return c.$$set=V=>{"secondaryColor"in V&&a(0,s=V.secondaryColor),"primaryColor"in V&&a(1,h=V.primaryColor),"height"in V&&a(2,v=V.height),"width"in V&&a(3,g=V.width),"speed"in V&&a(4,O=V.speed),"animate"in V&&a(5,A=V.animate),"secondaryColorPercentWidth"in V&&a(6,S=V.secondaryColorPercentWidth),"ariaLabel"in V&&a(7,M=V.ariaLabel),"$$scope"in V&&a(10,n=V.$$scope)},[s,h,v,g,O,A,S,M,P,L,n,i]}class Gfe extends $o{constructor(o){super(),Vo(this,o,qfe,Hfe,jo,{secondaryColor:0,primaryColor:1,height:2,width:3,speed:4,animate:5,secondaryColorPercentWidth:6,ariaLabel:7})}}function P$(c){let o,a,i;return a=new Gfe({props:{height:c[3],width:c[2],primaryColor:c[6],secondaryColor:c[7]}}),{c(){o=an("div"),xi(a.$$.fragment)},m(n,s){_r(n,o,s),gi(a,o,null),i=!0},p(n,s){const h={};s&8&&(h.height=n[3]),s&4&&(h.width=n[2]),s&64&&(h.primaryColor=n[6]),s&128&&(h.secondaryColor=n[7]),a.$set(h)},i(n){i||(hr(a.$$.fragment,n),i=!0)},o(n){Cr(a.$$.fragment,n),i=!1},d(n){n&&br(o),vi(a)}}}function Kfe(c){let o,a,i,n,s,h,v,g=!c[8]&&P$(c);return{c(){o=an("img"),i=or(),g&&g.c(),n=Cm(),Qt(o,"alt",c[0]),Qt(o,"height",c[3]),Qx(o.src,a=c[1])||Qt(o,"src",a),Qt(o,"width",c[2]),Bi(o,"animate-duration-[10s]",c[4]),Bi(o,"animate-spin",c[4]),Bi(o,"hidden",!c[8]),Bi(o,"shadow-md",c[5])},m(O,A){_r(O,o,A),_r(O,i,A),g&&g.m(O,A),_r(O,n,A),s=!0,h||(v=sa(o,"load",c[9]),h=!0)},p(O,[A]){(!s||A&1)&&Qt(o,"alt",O[0]),(!s||A&8)&&Qt(o,"height",O[3]),(!s||A&2&&!Qx(o.src,a=O[1]))&&Qt(o,"src",a),(!s||A&4)&&Qt(o,"width",O[2]),(!s||A&16)&&Bi(o,"animate-duration-[10s]",O[4]),(!s||A&16)&&Bi(o,"animate-spin",O[4]),(!s||A&256)&&Bi(o,"hidden",!O[8]),(!s||A&32)&&Bi(o,"shadow-md",O[5]),O[8]?g&&(Bs(),Cr(g,1,1,()=>{g=null}),Ps()):g?(g.p(O,A),A&256&&hr(g,1)):(g=P$(O),g.c(),hr(g,1),g.m(n.parentNode,n))},i(O){s||(hr(g),s=!0)},o(O){Cr(g),s=!1},d(O){O&&br(o),O&&br(i),g&&g.d(O),O&&br(n),h=!1,v()}}}function Yfe(c,o,a){let{alt:i}=o,{src:n}=o,{width:s=void 0}=o,{height:h=void 0}=o,{spin:v=!1}=o,{castShadow:g=!1}=o,{loadingColorPrimary:O=void 0}=o,{loadingColorSecondary:A=void 0}=o,{onLoaded:S=void 0}=o,M=!1;const P=()=>{S&&S(),a(8,M=!0)};return c.$$set=L=>{"alt"in L&&a(0,i=L.alt),"src"in L&&a(1,n=L.src),"width"in L&&a(2,s=L.width),"height"in L&&a(3,h=L.height),"spin"in L&&a(4,v=L.spin),"castShadow"in L&&a(5,g=L.castShadow),"loadingColorPrimary"in L&&a(6,O=L.loadingColorPrimary),"loadingColorSecondary"in L&&a(7,A=L.loadingColorSecondary),"onLoaded"in L&&a(10,S=L.onLoaded)},[i,n,s,h,v,g,O,A,M,P,S]}class Jk extends $o{constructor(o){super(),Vo(this,o,Yfe,Kfe,jo,{alt:0,src:1,width:2,height:3,spin:4,castShadow:5,loadingColorPrimary:6,loadingColorSecondary:7,onLoaded:10})}}function Xfe(c){let o,a,i,n=c[1]("menu.model.noModel")+"",s;return{c(){o=an("div"),a=an("div"),i=an("div"),s=Sr(n),Qt(i,"class","m-auto"),Qt(a,"class","flex h-full"),Qt(o,"class","h-34 w-34 m-auto mb-8 border-2 border-white border-opacity-30 rounded-lg border-dashed font-bold text-warm-gray-300")},m(h,v){_r(h,o,v),ft(o,a),ft(a,i),ft(i,s)},p(h,v){v&2&&n!==(n=h[1]("menu.model.noModel")+"")&&Ur(s,n)},i:Fi,o:Fi,d(h){h&&br(o)}}}function Jfe(c){let o,a,i,n,s=c[1]("menu.trainer.TrainingFinished")+"",h,v;return a=new Jk({props:{alt:"Model Icon",src:"imgs/model.svg",height:100,width:100,loadingColorPrimary:"#68BDBF",loadingColorSecondary:"#3C81F6",spin:!0}}),{c(){o=an("div"),xi(a.$$.fragment),i=or(),n=an("p"),h=Sr(s),Qt(n,"class","text-white mt-3 mb-4"),Qt(o,"class","text-white text-center flex flex-col justify-center items-center")},m(g,O){_r(g,o,O),gi(a,o,null),ft(o,i),ft(o,n),ft(n,h),v=!0},p(g,O){(!v||O&2)&&s!==(s=g[1]("menu.trainer.TrainingFinished")+"")&&Ur(h,s)},i(g){v||(hr(a.$$.fragment,g),v=!0)},o(g){Cr(a.$$.fragment,g),v=!1},d(g){g&&br(o),vi(a)}}}function Qfe(c){let o,a,i,n;const s=[Jfe,Xfe],h=[];function v(g,O){return g[0].isPredicting?0:1}return a=v(c),i=h[a]=s[a](c),{c(){o=an("div"),i.c(),Qt(o,"class","h-40 w-40 m-auto mt-2 flex flex-col justify-center")},m(g,O){_r(g,o,O),h[a].m(o,null),n=!0},p(g,[O]){let A=a;a=v(g),a===A?h[a].p(g,O):(Bs(),Cr(h[A],1,1,()=>{h[A]=null}),Ps(),i=h[a],i?i.p(g,O):(i=h[a]=s[a](g),i.c()),hr(i,1),i.m(o,null))},i(g){n||(hr(i),n=!0)},o(g){Cr(i),n=!1},d(g){g&&br(o),h[a].d()}}}function Zfe(c,o,a){let i,n;return Vi(c,No,s=>a(0,i=s)),Vi(c,La,s=>a(1,n=s)),[i,n]}class ede extends $o{constructor(o){super(),Vo(this,o,Zfe,Qfe,jo,{})}}function tde(c){var g;let o,a,i=(((g=c[0])==null?void 0:g.name)??"")+"",n,s,h,v;return{c(){o=an("div"),a=an("p"),n=Sr(i),s=or(),h=an("p"),v=Sr(c[1]),Qt(
9048a,"class","w-full max-w-[100%] text-2xl break-all"),Qt(o,"class","grid break-words mr-auto ml-auto w-3/4 h-70px border-2 rounded-lg border-solid text-center align-center content-center"),Qt(h,"class","text-4xl ml-5 mt-4 pb-4")},m(O,A){_r(O,o,A),ft(o,a),ft(a,n),_r(O,s,A),_r(O,h,A),ft(h,v)},p(O,A){var S;A&1&&i!==(i=(((S=O[0])==null?void 0:S.name)??"")+"")&&Ur(n,i),A&2&&Ur(v,O[1])},d(O){O&&br(o),O&&br(s),O&&br(h)}}}function nde(c){let o,a,i,n=c[3]("menu.model.noModel")+"",s;return{c(){o=an("div"),a=an("div"),i=an("div"),s=Sr(n),Qt(i,"class","m-auto"),Qt(a,"class","flex h-full"),Qt(o,"class","h-34 w-34 m-auto mb-8 border-2 border-white border-opacity-30 rounded-lg border-dashed font-bold text-warm-gray-300")},m(h,v){_r(h,o,v),ft(o,a),ft(a,i),ft(i,s)},p(h,v){v&8&&n!==(n=h[3]("menu.model.noModel")+"")&&Ur(s,n)},d(h){h&&br(o)}}}function rde(c){let o;function a(s,h){return s[2].isPredicting?tde:nde}let i=a(c),n=i(c);return{c(){o=an("div"),n.c(),Qt(o,"class","w-full text-center justify-center pt-5")},m(s,h){_r(s,o,h),n.m(o,null)},p(s,[h]){i===(i=a(s))&&n?n.p(s,h):(n.d(1),n=i(s),n&&(n.c(),n.m(o,null)))},i:Fi,o:Fi,d(s){s&&br(o),n.d()}}}function ide(c,o,a){let i,n,s,h,v;Vi(c,HK,O=>a(0,s=O)),Vi(c,No,O=>a(2,h=O)),Vi(c,La,O=>a(3,v=O));var g;return i=isNaN(i)?0:i,c.$$.update=()=>{c.$$.dirty&17&&a(5,i=a(4,g=s==null?void 0:s.confidence)!==null&&g!==void 0?g:0),c.$$.dirty&32&&a(1,n=Math.round(i*100).toString()+"%")},[s,n,h,v,g,i]}class ode extends $o{constructor(o){super(),Vo(this,o,ide,rde,jo,{})}}var hb=(c=>(c[c.HOMEPAGE=0]="HOMEPAGE",c[c.DATAPAGE=1]="DATAPAGE",c[c.TRAININGPAGE=2]="TRAININGPAGE",c[c.MODELPAGE=3]="MODELPAGE",c))(hb||{});class f1{static getOpenMenu(){if(Wo(this.currentlyOpen)==-1)throw new Error("No menu have been opened");return Wo(this.menuStore)[Wo(this.currentlyOpen)]}static getOpenMenuId(){return this.currentlyOpen}static openMenu(o){this.currentlyOpen.set(o)}static closeMenus(){this.currentlyOpen.set(-1)}static getMenuStore(){return this.menuStore}static addMenu(o){this.menuStore.update(a=>(a.push(o),a))}}f1.currentlyOpen=Dc(-1);f1.menuStore=Dc([{title:"menu.data.helpHeading",infoBubbleTitle:"menu.data.helpHeading",infoBubbleContent:"menu.data.helpBody",collapsedButtonContent:void 0,expandedButtonContent:Vfe,navigationPage:hb.DATAPAGE},{title:"menu.trainer.helpHeading",infoBubbleTitle:"menu.trainer.helpHeading",infoBubbleContent:"menu.trainer.helpBody",collapsedButtonContent:void 0,expandedButtonContent:ede,navigationPage:hb.TRAININGPAGE},{title:"menu.model.helpHeading",infoBubbleTitle:"menu.model.helpHeading",infoBubbleContent:"menu.model.helpBody",collapsedButtonContent:void 0,expandedButtonContent:ode,navigationPage:hb.MODELPAGE}]);function j$(c){let o,a,i,n,s;const h=c[4].default,v=Gk(h,c,c[3],null);return{c(){o=an("div"),v&&v.c(),Qt(o,"class","z-10000 fixed top-0 left-0 bg-black/50 bg-blend-darken h-screen w-screen flex justify-center items-center")},m(g,O){_r(g,o,O),v&&v.m(o,null),i=!0,n||(s=sa(o,"click",function(){Fg(c[1])&&c[1].apply(this,arguments)}),n=!0)},p(g,O){c=g,v&&v.p&&(!i||O&8)&&Yk(v,h,c,c[3],i?Kk(h,c[3],O,null):Xk(c[3]),null)},i(g){i||(hr(v,g),Ll(()=>{i&&(a||(a=Qd(o,D6,{},!0)),a.run(1))}),i=!0)},o(g){Cr(v,g),a||(a=Qd(o,D6,{},!1)),a.run(0),i=!1},d(g){g&&br(o),v&&v.d(g),g&&a&&a.end(),n=!1,s()}}}function ade(c){let o,a,i,n,s=c[0]&&j$(c);return{c(){s&&s.c(),o=Cm()},m(h,v){s&&s.m(h,v),_r(h,o,v),a=!0,i||(n=sa(window,"keydown",c[2]),i=!0)},p(h,[v]){h[0]?s?(s.p(h,v),v&1&&hr(s,1)):(s=j$(h),s.c(),hr(s,1),s.m(o.parentNode,o)):s&&(Bs(),Cr(s,1,1,()=>{s=null}),Ps())},i(h){a||(hr(s),a=!0)},o(h){Cr(s),a=!1},d(h){s&&s.d(h),h&&br(o),i=!1,n()}}}function sde(c,o,a){let{$$slots:i={},$$scope:n}=o,{isOpen:s}=o,{onClose:h}=o;function v(g){g.key==="Escape"&&(g.preventDefault(),h())}return c.$$set=g=>{"isOpen"in g&&a(0,s=g.isOpen),"onClose"in g&&a(1,h=g.onClose),"$$scope"in g&&a(3,n=g.$$scope)},[s,h,v,n,i]}class eY extends $o{constructor(o){super(),Vo(this,o,sde,ade,jo,{isOpen:0,onClose:1})}}function L$(c){let o,a,i,n;return{c(){o=an("div"),a=an("button"),a.innerHTML='<i class="fas fa-plus text-lg text-gray-600 hover:text-gray-800 duration-75 svelte-1rnkjvh" style="transform: rotate(45deg);"></i>',Qt(a,"class","hover:bg-gray-100 rounded outline-transparent w-8 svelte-1rnkjvh"),Qt(o,"class","absolute right-2 top-2 svelte-1rnkjvh")},m(s,h){_r(s,o,h),ft(o,a),i||(n=sa(a,"click",function(){Fg(c[2])&&c[2].apply(this,arguments)}),i=!0)},p(s,h){c=s},d(s){s&&br(o),i=!1,n()}}}function ude(c){let o,a,i,n,s,h,v,g=c[0]&&L$(c);const O=c[3].default,A=Gk(O,c,c[5],null);return{c(){o=an("div"),g&&g.c(),a=or(),i=an("div"),A&&A.c(),Qt(i,"class",n="m-1 "+(c[0]?"mt-3":"mt-1")),Qt(o,"class","w-min h-min border-gray-200 border border-solid relative bg-white rounded-lg p-8")},m(S,M){_r(S,o,M),g&&g.m(o,null),ft(o,a),ft(o,i),A&&A.m(i,null),s=!0,h||(v=sa(o,"click",AK(c[4])),h=!0)},p(S,M){S[0]?g?g.p(S,M):(g=L$(S),g.c(),g.m(o,a)):g&&(g.d(1),g=null),A&&A.p&&(!s||M&32)&&Yk(A,O,S,S[5],s?Kk(O,S[5],M,null):Xk(S[5]),null),(!s||M&1&&n!==(n="m-1 "+(S[0]?"mt-3":"mt-1")))&&Qt(i,"class",n)},i(S){s||(hr(A,S),s=!0)},o(S){Cr(A,S),s=!1},d(S){S&&br(o),g&&g.d(),A&&A.d(S),h=!1,v()}}}function cde(c){let o,a;return o=new eY({props:{isOpen:c[1],onClose:c[2],$$slots:{default:[ude]},$$scope:{ctx:c}}}
9048),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,[n]){const s={};n&2&&(s.isOpen=i[1]),n&4&&(s.onClose=i[2]),n&37&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function lde(c,o,a){let{$$slots:i={},$$scope:n}=o,{hasCloseButton:s=!0}=o,{isOpen:h}=o,{onClose:v}=o;function g(O){NK.call(this,c,O)}return c.$$set=O=>{"hasCloseButton"in O&&a(0,s=O.hasCloseButton),"isOpen"in O&&a(1,h=O.isOpen),"onClose"in O&&a(2,v=O.onClose),"$$scope"in O&&a(5,n=O.$$scope)},[s,h,v,i,g,n]}class Qk extends $o{constructor(o){super(),Vo(this,o,lde,cde,jo,{hasCloseButton:0,isOpen:1,onClose:2})}}function z$(c,o,a){const i=c.slice();return i[6]=o[a],i}function fde(c){let o,a=c[1]("content.index.contactBody")+"",i,n,s,h=c[1]("content.index.contactMail")+"",v,g;return{c(){o=an("p"),i=Sr(a),n=or(),s=an("a"),v=Sr(h),Qt(s,"href",g=`mailto:${c[1]("content.index.contactMail")}`),Qt(s,"class","underline text-red-500 hover:text-red-300 "),Qt(o,"class","w-60")},m(O,A){_r(O,o,A),ft(o,i),ft(o,n),ft(o,s),ft(s,v)},p(O,A){A&2&&a!==(a=O[1]("content.index.contactBody")+"")&&Ur(i,a),A&2&&h!==(h=O[1]("content.index.contactMail")+"")&&Ur(v,h),A&2&&g!==(g=`mailto:${O[1]("content.index.contactMail")}`)&&Qt(s,"href",g)},d(O){O&&br(o)}}}function U$(c){let o,a=c[6]+"",i;return{c(){o=an("option"),i=Sr(a),o.__value=c[6],o.value=o.__value},m(n,s){_r(n,o,s),ft(o,i)},p:Fi,d(n){n&&br(o)}}}function dde(c){let o,a,i,n,s,h,v=c[1]("content.index.contactButton")+"",g,O,A,S,M=c[1]("content.index.acknowledgement")+"",P,L,V,N;a=new Qk({props:{isOpen:c[0],onClose:c[3],$$slots:{default:[fde]},$$scope:{ctx:c}}});let ee=gN,J=[];for(let K=0;K<ee.length;K+=1)J[K]=U$(z$(c,ee,K));return{c(){o=an("main"),xi(a.$$.fragment),i=or(),n=an("select");for(let K=0;K<J.length;K+=1)J[K].c();s=or(),h=an("button"),g=Sr(v),O=or(),A=an("div"),S=an("p"),P=Sr(M),Qt(n,"class","bg-[#63BFC2] outline-none float-right text-white ml-2 mr-2 pl-2 pr-2"),c[2]===void 0&&Ll(()=>c[4].call(n)),Qt(h,"class","border outline-none border-solid rounded-full ml-2 mr-2 pl-4 pr-4 float-right text-white pl-2 pr-2"),Qt(S,"class","text-white text-xs"),Qt(A,"class","h-full ml-10 flex items-center"),Qt(o,"class","pt-5 pb-3 h-15 w-full")},m(K,re){_r(K,o,re),gi(a,o,null),ft(o,i),ft(o,n);for(let ce=0;ce<J.length;ce+=1)J[ce]&&J[ce].m(n,null);Nk(n,c[2],!0),ft(o,s),ft(o,h),ft(h,g),ft(o,O),ft(o,A),ft(A,S),ft(S,P),L=!0,V||(N=[sa(n,"change",c[4]),sa(h,"click",c[5])],V=!0)},p(K,[re]){const ce={};if(re&1&&(ce.isOpen=K[0]),re&1&&(ce.onClose=K[3]),re&514&&(ce.$$scope={dirty:re,ctx:K}),a.$set(ce),re&0){ee=gN;let pe;for(pe=0;pe<ee.length;pe+=1){const ke=z$(K,ee,pe);J[pe]?J[pe].p(ke,re):(J[pe]=U$(ke),J[pe].c(),J[pe].m(n,null))}for(;pe<J.length;pe+=1)J[pe].d(1);J.length=ee.length}re&4&&Nk(n,K[2]),(!L||re&2)&&v!==(v=K[1]("content.index.contactButton")+"")&&Ur(g,v),(!L||re&2)&&M!==(M=K[1]("content.index.acknowledgement")+"")&&Ur(P,M)},i(K){L||(hr(a.$$.fragment,K),L=!0)},o(K){Cr(a.$$.fragment,K),L=!1},d(K){K&&br(o),vi(a),Pv(J,K),V=!1,Ul(N)}}}function hde(c,o,a){let i,n;Vi(c,La,O=>a(1,i=O)),Vi(c,tA,O=>a(2,n=O));let s=!1;const h=()=>a(0,s=!1);function v(){n=QB(this),tA.set(n)}return[s,i,n,h,v,()=>a(0,s=!s)]}class pde extends $o{constructor(o){super(),Vo(this,o,hde,dde,jo,{})}}function mde(c){let o,a,i,n,s,h,v,g=c[0]("content.index.heading")+"",O,A,S,M=c[0]("content.index.howBody")+"",P,L,V,N,ee,J=c[0]("content.index.ledDescription")+"",K,re,ce,pe,ke,Ce,be,$e=c[0]("content.index.recordButtonDescription")+"",ht,Dt,Ut,Ee=c[0]("content.index.setupBody2")+"",Ot,zt,Mt,Ke,Tt=c[0]("content.index.videoHeading")+"",vt,yt,bt,Ht=c[0]("content.index.videoBody")+"",_t,Ze,Vt,sn,yn,Yt,We,Ye,He;return a=new pde({}),ke=new Jk({props:{alt:"microbit guide",height:114,src:"imgs/microbit_guide.svg",width:200}}),{c(){o=an("main"),xi(a.$$.fragment),i=or(),n=an("div"),s=an("div"),h=an("div"),v=an("p"),O=Sr(g),A=or(),S=an("p"),P=Sr(M),L=or(),V=an("div"),N=an("div"),ee=an("p"),K=Sr(J),re=or(),ce=an("div"),pe=an("div"),xi(ke.$$.fragment),Ce=or(),be=an("p"),ht=Sr($e),Dt=or(),Ut=an("p"),Ot=Sr(Ee),zt=or(),Mt=an("div"),Ke=an("p"),vt=Sr(Tt),yt=or(),bt=an("p"),_t=Sr(Ht),Ze=or(),Vt=an("a"),Vt.textContent="Link",sn=or(),yn=an("br"),Yt=or(),We=an("img"),Qt(v,"class","text-lg mb-2 font-semibold"),Qt(ee,"class","absolute text-center w-60px left-5px top-12px"),Qt(ce,"class","flex-col place-content-center drop-shadow-xl center-items content-center justify-items-center"),Qt(be,"class","absolute text-center w-60px right-0px top-30px"),Qt(N,"class",""),Qt(V,"class","relative w-342px place-self-ce
vendor: 4,914 bytes, lines 9048-9053
9048nter flex justify-around gap-1 ml-auto mr-auto mt-6 mb-6"),Qt(h,"class","border-gray-200 border border-solid bg-white rounded-lg p-6 shadow-xl"),Qt(Ke,"class","text-lg mb-2 font-semibold"),Qt(Vt,"href","https://www.dr.dk/skole/ultrabit/udskoling/elevoevelse-med-bbc-microbit-skjulte-moenstre-i-data"),Qt(Vt,"target","_blank"),Qt(Vt,"class","svelte-1kwoqdf"),Qx(We.src,Ye="imgs/data-trainer-thumpnail.png")||Qt(We,"src",Ye),Qt(We,"alt","gg"),Qt(Mt,"class","border-gray-200 border border-solid bg-white rounded-lg p-6 pb-2 flex flex-col"),Qt(s,"class","grid-container grid-cols-2 min-w-800px svelte-1kwoqdf"),Qt(n,"class","p-10 pb-2 pt-2 mt-0")},m(dt,It){_r(dt,o,It),gi(a,o,null),ft(o,i),ft(o,n),ft(n,s),ft(s,h),ft(h,v),ft(v,O),ft(h,A),ft(h,S),ft(S,P),ft(h,L),ft(h,V),ft(V,N),ft(N,ee),ft(ee,K),ft(N,re),ft(N,ce),ft(ce,pe),gi(ke,pe,null),ft(N,Ce),ft(N,be),ft(be,ht),ft(h,Dt),ft(h,Ut),ft(Ut,Ot),ft(s,zt),ft(s,Mt),ft(Mt,Ke),ft(Ke,vt),ft(Mt,yt),ft(Mt,bt),ft(bt,_t),ft(bt,Ze),ft(bt,Vt),ft(Mt,sn),ft(Mt,yn),ft(Mt,Yt),ft(Mt,We),He=!0},p(dt,[It]){(!He||It&1)&&g!==(g=dt[0]("content.index.heading")+"")&&Ur(O,g),(!He||It&1)&&M!==(M=dt[0]("content.index.howBody")+"")&&Ur(P,M),(!He||It&1)&&J!==(J=dt[0]("content.index.ledDescription")+"")&&Ur(K,J),(!He||It&1)&&$e!==($e=dt[0]("content.index.recordButtonDescription")+"")&&Ur(ht,$e),(!He||It&1)&&Ee!==(Ee=dt[0]("content.index.setupBody2")+"")&&Ur(Ot,Ee),(!He||It&1)&&Tt!==(Tt=dt[0]("content.index.videoHeading")+"")&&Ur(vt,Tt),(!He||It&1)&&Ht!==(Ht=dt[0]("content.index.videoBody")+"")&&Ur(_t,Ht)},i(dt){He||(hr(a.$$.fragment,dt),hr(ke.$$.fragment,dt),He=!0)},o(dt){Cr(a.$$.fragment,dt),Cr(ke.$$.fragment,dt),He=!1},d(dt){dt&&br(o),vi(a),vi(ke)}}}function gde(c,o,a){let i;return Vi(c,La,n=>a(0,i=n)),[i]}class tY extends $o{constructor(o){super(),Vo(this,o,gde,mde,jo,{})}}const nY=Dc(tY);class vde{setContentComponent(o){nY.set(o)}}class h4{}class yde extends h4{navigate(o){o.setContentComponent(tY),f1.closeMenus()}}/*! 9049 * @kurkle/color v0.3.2 9050 * https://github.com/kurkle/color#readme 9051 * (c) 2023 Jukka Kurkela 9052 * Released under the MIT License 9053 */function EA(c){return c+.5|0}const Mx=(c,o,a)=>Math.max(Math.min(c,a),o);function bS(c){return Mx(EA(c*2.55),0,255)}function Wx(c){return Mx(EA(c*255),0,255)}function ub(c){return Mx(EA(c/2.55)/100,0,1)}function W$(c){return Mx(EA(c*100),0,100)}const E0={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},T6=[..."0123456789ABCDEF"],bde=c=>T6[c&15],xde=c=>T6[(c&240)>>4]+T6[c&15],GD=c=>(c&240)>>4===(c&15),wde=c=>GD(c.r)&&GD(c.g)&&GD(c.b)&&GD(c.a);function _de(c){var o=c.length,a;return c[0]==="#"&&(o===4||o===5?a={r:255&E0[c[1]]*17,g:255&E0[c[2]]*17,b:255&E0[c[3]]*17,a:o===5?E0[c[4]]*17:255}:(o===7||o===9)&&(a={r:E0[c[1]]<<4|E0[c[2]],g:E0[c[3]]<<4|E0[c[4]],b:E0[c[5]]<<4|E0[c[6]],a:o===9?E0[c[7]]<<4|E0[c[8]]:255})),a}const kde=(c,o)=>c<255?o(c):"";function Ede(c){var o=wde(c)?bde:xde;return c?"#"+o(c.r)+o(c.g)+o(c.b)+kde(c.a,o):void 0}const Cde=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function rY(c,o,a){const i=o*Math.min(a,1-a),n=(s,h=(s+c/30)%12)=>a-i*Math.max(Math.min(h-3,9-h,1),-1);return[n(0),n(8),n(4)]}function Sde(c,o,a){const i=(n,s=(n+c/60)%6)=>a-a*o*Math.max(Math.min(s,4-s,1),0);return[i(5),i(3),i(1)]}function Ade(c,o,a){const i=rY(c,1,.5);let n;for(o+a>1&&(n=1/(o+a),o*=n,a*=n),n=0;n<3;n++)i[n]*=1-o-a,i[n]+=o;return i}function Ode(c,o,a,i,n){return c===n?(o-a)/i+(o<a?6:0):o===n?(a-c)/i+2:(c-o)/i+4}function uP(c){const a=c.r/255,i=c.g/255,n=c.b/255,s=Math.max(a,i,n),h=Math.min(a,i,n),v=(s+h)/2;let g,O,A;return s!==h&&(A=s-h,O=v>.5?A/(2-s-h):A/(s+h),g=Ode(a,i,n,A,s),g=g*60+.5),[g|0,O||0,v]}function cP(c,o,a,i){return(Array.isArray(o)?c(o[0],o[1],o[2]):c(o,a,i)).map(Wx)}function lP(c,o,a){return cP(rY,c,o,a)}function Dde(c,o,a){return cP(Ade,c,o,a)}function Tde(c,o,a){return cP(Sde,c,o,a)}function iY(c){return(c%360+360)%360}function Nde(c){const o=Cde.exec(c);let a=255,i;if(!o)return;o[5]!==i&&(a=o[6]?bS(+o[5]):Wx(+o[5]));const n=iY(+o[2]),s=+o[3]/100,h=+o[4]/100;return o[1]==="hwb"?i=Dde(n,s,h):o[1]==="hsv"?i=Tde(n,s,h):i=lP(n,s,h),{r:i[0],g:i[1],b:i[2],a}}function Ide(c,o){var a=uP(c);a[0]=iY(a[0]+o),a=lP(a),c.r=a[0],c.g=a[1],c.b=a[2]}function Mde(c){if(!c)return;const o=uP(c),a=o[0],i=W$(o[1]),n=W$(o[2]);return c.a<255?`hsla(${a}, ${i}%, ${n}%, ${ub(c.a)})`:`hsl(${a}, ${i}%, ${n}%)`}const V$={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},$$={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",K
vendor: 16,971 bytes, lines 9053-9058
9053ocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Fde(){const c={},o=Object.keys($$),a=Object.keys(V$);let i,n,s,h,v;for(i=0;i<o.length;i++){for(h=v=o[i],n=0;n<a.length;n++)s=a[n],v=v.replace(s,V$[s]);s=parseInt($$[h],16),c[v]=[s>>16&255,s>>8&255,s&255]}return c}let KD;function Rde(c){KD||(KD=Fde(),KD.transparent=[0,0,0,0]);const o=KD[c.toLowerCase()];return o&&{r:o[0],g:o[1],b:o[2],a:o.length===4?o[3]:255}}const Bde=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Pde(c){const o=Bde.exec(c);let a=255,i,n,s;if(o){if(o[7]!==i){const h=+o[7];a=o[8]?bS(h):Mx(h*255,0,255)}return i=+o[1],n=+o[3],s=+o[5],i=255&(o[2]?bS(i):Mx(i,0,255)),n=255&(o[4]?bS(n):Mx(n,0,255)),s=255&(o[6]?bS(s):Mx(s,0,255)),{r:i,g:n,b:s,a}}}function jde(c){return c&&(c.a<255?`rgba(${c.r}, ${c.g}, ${c.b}, ${ub(c.a)})`:`rgb(${c.r}, ${c.g}, ${c.b})`)}const y5=c=>c<=.0031308?c*12.92:Math.pow(c,1/2.4)*1.055-.055,q_=c=>c<=.04045?c/12.92:Math.pow((c+.055)/1.055,2.4);function Lde(c,o,a){const i=q_(ub(c.r)),n=q_(ub(c.g)),s=q_(ub(c.b));return{r:Wx(y5(i+a*(q_(ub(o.r))-i))),g:Wx(y5(n+a*(q_(ub(o.g))-n))),b:Wx(y5(s+a*(q_(ub(o.b))-s))),a:c.a+a*(o.a-c.a)}}function YD(c,o,a){if(c){let i=uP(c);i[o]=Math.max(0,Math.min(i[o]+i[o]*a,o===0?360:1)),i=lP(i),c.r=i[0],c.g=i[1],c.b=i[2]}}function oY(c,o){return c&&Object.assign(o||{},c)}function H$(c){var o={r:0,g:0,b:0,a:255};return Array.isArray(c)?c.length>=3&&(o={r:c[0],g:c[1],b:c[2],a:255},c.length>3&&(o.a=Wx(c[3]))):(o=oY(c,{r:0,g:0,b:0,a:1}),o.a=Wx(o.a)),o}function zde(c){return c.charAt(0)==="r"?Pde(c):Nde(c)}class rA{constructor(o){if(o instanceof rA)return o;const a=typeof o;let i;a==="object"?i=H$(o):a==="string"&&(i=_de(o)||Rde(o)||zde(o)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var o=oY(this._rgb);return o&&(o.a=ub(o.a)),o}set rgb(o){this._rgb=H$(o)}rgbString(){return this._valid?jde(this._rgb):void 0}hexString(){return this._valid?Ede(this._rgb):void 0}hslString(){return this._valid?Mde(this._rgb):void 0}mix(o,a){if(o){const i=this.rgb,n=o.rgb;let s;const h=a===s?.5:a,v=2*h-1,g=i.a-n.a,O=((v*g===-1?v:(v+g)/(1+v*g))+1)/2;s=1-O,i.r=255&O*i.r+s*n.r+.5,i.g=255&O*i.g+s*n.g+.5,i.b=255&O*i.b+s*n.b+.5,i.a=h*i.a+(1-h)*n.a,this.rgb=i}return this}interpolate(o,a){return o&&(this._rgb=Lde(this._rgb,o._rgb,a)),this}clone(){return new rA(this.rgb)}alpha(o){return this._rgb.a=Wx(o),this}clearer(o){const a=this._rgb;return a.a*=1-o,this}greyscale(){const o=this._rgb,a=EA(o.r*.3+o.g*.59+o.b*.11);return o.r=o.g=o.b=a,this}opaquer(o){const a=this._rgb;return a.a*=1+o,this}negate(){const o=this._rgb;return o.r=255-o.r,o.g=255-o.g,o.b=255-o.b,this}lighten(o){return YD(this._rgb,2,o),this}darken(o){return YD(this._rgb,2,-o),this}saturate(o){return YD(this._rgb,1,o),this}desaturate(o){return YD(this._rgb,1,-o),this}rotate(o){return Ide(this._rgb,o),this}}/*! 9054 * Chart.js v4.2.1 9055 * https://www.chartjs.org 9056 * (c) 2023 Chart.js Contributors 9057 * Released under the MIT License 9058 */const Ude=(()=>{let c=0;return()=>c++})();function gc(c){return c===null||typeof c>"u"}function Xc(c){if(Array.isArray&&Array.isArray(c))return!0;const o=Object.prototype.toString.call(c);return o.slice(0,7)==="[object"&&o.slice(-6)==="Array]"}function Rs(c){return c!==null&&Object.prototype.toString.call(c)==="[object Object]"}function mf(c){return(typeof c=="number"||c instanceof Number)&&isFinite(+c)}function Dg(c,o){return mf(c)?c:o}function hu(c,o){return typeof c>"u"?o:c}const Wde=(c,o)=>typeof c=="string"&&c.endsWith("%")?parseFloat(c)/100*o:+c;function Oc(c,o,a){if(c&&typeof c.call=="function")return c.apply(a,o)}function Xd(c,o,a,i){let n,s,h;if(Xc(c))if(s=c.length,i)for(n=s-1;n>=0;n--)o.call(a,c[n],n);else for(n=0;n<s;n++)o.call(a,c[n],n);else if(Rs(c))for(h=Object.keys(c),s=h.length,n=0;n<s;n++)o.call(a,c[h[n]],h[n])}function q$(c,o){let a,i,n,s;if(!c||!o||c.length!==o.length)return!1;for(a=0,i=c.length;a<i;++a)if(n=c[a],s=o[a],n.datasetIndex!==s.datasetIndex||n.index!==s.index)return!1;return!0}function xN(c){if(Xc(c))return c.map(xN);if(Rs(c)){const o=Object.create(null),a=Object.keys(c),i=a.length;let n=0;for(;n<i;++n)o[a[n]]=xN(c[a[n]]);return o}return c}function aY(c){return["__proto__","prototype","constructor"].indexOf(c)===-1}function Vde(c,o,a,i){if(!aY(c))return;const n=o[c],s=a[c];Rs(n)&&Rs(s)?iA(n,s,i):o[c]=xN(s)}function iA(c,o,a){const i=Xc(o)?o:[o],n=i.length;if(!Rs(c))return c;a=a||{};const s=a.merger||Vde;let h;for(let v=0;v<n;++v){if(h=i[v],!Rs(h))continue;const g=Object.keys(h);for(let O=0,A=g.length;O<A;++O)s(g[O],c,h,a)}return c}function RS(c,o){return iA(c,o,{merger:$de})}function $de(c,o,a){if(!aY(c))return;const i=o[c],n=a[c];Rs(i)&&Rs(n)?RS(i,n):Object.prototype.hasOwnProperty.call(o,c)||(o[c]=xN(n))}const G$={"":c=>c,x:c=>c.x,y:c=>c.y};function Hde(c){const o=c.split("."),a=[];let i="";for(const n of o)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(a.push(i),i="");return a}function qde(c){const o=Hde(c);return a=>{for(const i of o){if(i==="")break;a=a&&a[i]}return a}}function wN(c,o){return(G$[o]||(G$[o]=qde(o)))(c)}function fP(c){return c.charAt(0).toUpperCase()+c.slice(1)}const jv=c=>typeof c<"u",tw=c=>typeof c=="function",K$=(c,o)=>{if(c.size!==o.size)return!1;for(const a of c)if(!o.has(a))return!1;return!0};function Gde(c){return c.type==="mouseup"||c.type==="click"||c.type==="contextmenu"}const td=Math.PI,T0=2*td,Kde=T0+td,_N=Number.POSITIVE_INFINITY,Yde=td/180,Em=td/2,Zw=td/4,Y$=td*2/3,Fx=Math.log10,Ik=Math.sign;function BS(c,o,a){return Math.abs(c-o)<a}function X$(c){const o=Math.round(c);c=BS(c,o,c/1e3)?o:c;const a=Math.pow(10,Math.floor(Fx(c))),i=c/a;return(i<=1?1:i<=2?2:i<=5?5:10)*a}function Xde(c){const o=[],a=Math.sqrt(c);let i;for(i=1;i<a;i++)c%i===0&&(o.push(i),o.push(c/i));return a===(a|0)&&o.push(a),o.sort((n,s)=>n-s).pop(),o}function oA(c){return!isNaN(parseFloat(c))&&isFinite(c)}function Jde(c,o){const a=Math.round(c);return a-o<=c&&a+o>=c}function sY(c,o,a){let i,n,s;for(i=0,n=c.length;i<n;i++)s=c[i][a],isNaN(s)||(o.min=Math.min(o.min,s),o.max=Math.max(o.max,s))}function Rx(c){return c*(td/180)}function dP(c){return c*(180/td)}function J$(c){if(!mf(c))return;let o=1,a=0;for(;Math.round(c*o)/o!==c;)o*=10,a++;return a}function Qde(c,o){const a=o.x-c.x,i=o.y-c.y,n=Math.sqrt(a*a+i*i);let s=Math.atan2(i,a);return s<-.5*td&&(s+=T0),{angle:s,distance:n}}function Q$(c,o){return Math.sqrt(Math.pow(o.x-c.x,2)+Math.pow(o.y-c.y,2))}function Zde(c,o){return(c-o+Kde)%T0-td}function Mv(c){return(c%T0+T0)%T0}function uY(c,o,a,i){const n=Mv(c),s=Mv(o),h=Mv(a),v=Mv(s-n),g=Mv(h-n),O=Mv(n-s),A=Mv(n-h);return n===s||n===h||i&&s===h||v>g&&O<A}function pb(c,o,a){return Math.max(o,Math.min(a,c))}function ehe(c){return pb(c,-32768,32767)}function the(c,o,a,i=1e-6){return c>=Math.min(o,a)-i&&c<=Math.max(o,a)+i}function hP(c,o,a){a=a||(h=>c[h]<o);let i=c.length-1,n=0,s;for(;i-n>1;)s=n+i>>1,a(s)?n=s:i=s;return{lo:n,hi:i}}const x2=(c,o,a,i)=>hP(c,a,i?n=>{const s=c[n][o];return s<a||s===a&&c[n+1][o]===a}:n=>c[n][o]<a),nhe=(c,o,a)=>hP(c,a,i=>c[i][o]>=a);function rhe(c,o,a){let i=0,n=c.length;for(;i<n&&c[i]<o;)i++;for(;n>i&&c[n-1]>a;)n--;return i>0||n<c.length?c.slice(i,n):c}const cY=["push","pop","shift","splice","unshift"];function ihe(c,o){if(c._chartjs){c._chartjs.listeners.push(o);return}Object.defineProperty(c,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[o]}}),cY.forEach(a=>{const i="_onData"+fP(a),n=c[a];Object.defineProperty(c,a,{configurable:!0,enumerable:!1,value(...s){const h=n.apply(this,s);return c._chartjs.listeners.forEach(v=>{typeof v[i]=="function"&&v[i](...s)}),h}})})}function Z$(c,o){const a=c._chartjs;if(!a)return;const i=a.listeners,n=i.indexOf(o);n!==-1&&i.splice(n,1),!(i.length>0)&&(cY.forEach(s=>{delete c[s]}),delete c._chartjs)}function ohe(c){const o=new Set;let a,i;for(a=0,i=c.length;a<i;++a)o.add(c[a]);return o.size===i?c:Array.from(o)}const lY=function(){return typeof window>"u"?function(c){return c()}:window.requestAnimationFrame}();function fY(c,o){let a=[],i=!1;return function(...n){a=n,i||(i=!0,lY.call(window,()=>{i=!1,c.apply(o,a)}))}}function ahe(c,o){let a;return function(...i){return o?(clearTimeout(a),a=setTimeout(c,o,i)):c.apply(this,i),o}}const she=c=>c==="start"?"left":c==="end"?"right":"center",eH=(c,o,a)=>c==="start"?o:c==="end"?a:(o+a)/2;function uhe(c,o,a){const i=o.length;let n=0,s=i;if(c._sorted){const{iScale:h,_parsed:v}=c,g=h.axis,{min:O,max:A,minDefined:S,maxDefined:M}=h.getUserBounds();S&&(n=pb(Math.min(x2(v,h.axis,O).lo,a?i:x2(o,g,h.getPixelForValue(O)).lo),0,i-1)),M?s=pb(Math.max(x2(v,h.axis,A,!0).hi+1,a?0:x2(o,g,h.getPixelForValue(A),!0).hi+1),n,i)-n:s=i-n}return{start:n,count:s}}function che(c){const{xScale:o,yScale:a,_scaleRanges:i}=c,n={xmin:o.min,xmax:o.max,ymin:a.min,ymax:a.max};if(!i)return c._scaleRanges=n,!0;const s=i.xmin!==o.min||i.xmax!==o.max||i.ymin!==a.min||i.ymax!==a.max;return Object.assign(i,n),s}const XD=c=>c===0||c===1,tH=(c,o,a)=>-(Math.pow(2,10*(c-=1))*Math.sin((c-o)*T0/a)),nH=(c,o,a)=>Math.pow(2,-10*c)*Math.sin((c-o)*T0/a)+1,PS={linear:c=>c,easeInQuad:c=>c*c,easeOutQuad:c=>-c*(c-2),easeInOutQuad:c=>(c/=.5)<1?.5*c*c:-.5*(--c*(c-2)-1),easeInCubic:c=>c*c*c,easeOutCubic:c=>(c-=1)*c*c+1,easeInOutCubic:c=>(c/=.5)<1?.5*c*c*c:.5*((c-=2)*c*c+2),easeInQuart:c=>c*c*c*c,easeOutQuart:c=>-((c-=1)*c*c*c-1),easeInOutQuart:c=>(c/=.5)<1?.5*c*c*c*c:-.5*((c-=2)*c*c*c-2),easeInQuint:c=>c*c*c*c*c,easeOutQuint:c=>(c-=1)*c*c*c*c+1,easeInOutQuint:c=>(c/=.5)<1?.5*c*c*c*c*c:.5*((c-=2)*c*c*c*c+2),easeInSine:c=>-Math.cos(c*Em)+1,easeOutSine:c=>Math.sin(c*Em),easeInOutSine:c=>-.5*(Math.cos(td*c)-1),easeInExpo:c=>c===0?0:Math.pow(2,10*(c-1)),easeOutExpo:c=>c===1?1:-Math.pow(2,-10*c)+1,easeInOutExpo:c=>XD(c)?c:c<.5?.5*Math.pow(2,10*(c*2-1)):.5*(-Math.pow(2,-10*(c*2-1))+2),easeInCirc:c=>c>=1?c:-(Math.sqrt(1-c*c)-1),easeOutCirc:c=>Math.sqrt(1-(c-=1)*c),easeInOutCirc:c=>(c/=.5)<1?-.5*(Math.sqrt(1-c*c)-1):.5*(Math.sqrt(1-(c-=2)*c)+1),easeInElastic:c=>XD(c)?c:tH(c,.075,.3),easeOutElastic:c=>XD(c)?c:nH(c,.075,.3),easeInOutElastic(c){return XD(c)?c:c<.5?.5*tH(c*2,.1125,.45):.5+.5*nH(c*2-1,.1125,.45)},easeInBack(c){return c*c*((1.70158+1)*c-1.70158)},easeOutBack(c){return(c-=1)*c*((1.70158+1)*c+1.70158)+1},easeInOutBack(c){let o=1.70158;return(c/=.5)<1?.5*(c*c*(((o*=1.525)+1)*c-o)):.5*((c-=2)*c*(((o*=1.525)+1)*c+o)+2)},easeInBounce:c=>1-PS.easeOutBounce(1-c),easeOutBounce(c){return c<1/2.75?7.5625*c*c:c<2/2.75?7.5625*(c-=1.5/2.75)*c+.75:c<2.5/2.75?7.5625*(c-=2.25/2.75)*c+.9375:7.5625*(c-=2.625/2.75)*c+.984375},easeInOutBounce:c=>c<.5?PS.easeInBounce(c*2)*.5:PS.easeOutBounce(c*2-1)*.5+.5};function dY(c){if(c&&typeof c=="object"){const o=c.toString();return o==="[object CanvasPattern]"||o==="[object CanvasGradient]"}return!1}function rH(c){return dY(c)?c:new rA(c)}function b5(c){return dY(c)?c:new rA(c).saturate(.5).darken(.1).hexString()}const lhe=["x","y","borderWidth","radius","tension"],fhe=["color","borderColor","backgroundColor"];function dhe(c){c.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),c.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:o=>o!=="onProgress"&&o!=="onComplete"&&o!=="fn"}),c.set("animations",{colors:{type:"color",properties:fhe},numbers:{type:"number",properties:lhe}}),c.describe("animations",{_fallback:"animation"}),c.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:o=>o|0}}}})}function hhe(c){c.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const iH=new Map;function phe(c,o){o=o||{};const a=c+JSON.stringify(o);let i=iH.get(a);return i||(i=new Intl.NumberFormat(c,o),iH.set(a,i)),i}function pP(c,o,a){return phe(o,a).format(c)}const hY={values(c){return Xc(c)?c:""+c},numeric(c,o,a){if(c===0)return"0";const i=this.chart.options.locale;let n,s=c;if(a.length>1){const O=Math.max(Math.abs(a[0].value),Math.abs(a[a.length-1].value));(O<1e-4||O>1e15)&&(n="scientific"),s=mhe(c,a)}const h=Fx(Math.abs(s)),v=Math.max(Math.min(-1*Math.floor(h),20),0),g={notation:n,minimumFractionDigits:v,maximumFractionDigits:v};return Object.assign(g,this.options.ticks.format),pP(c,i,g)},logarithmic(c,o,a){if(c===0)return"0";const i=a[o].significand||c/Math.pow(10,Math.floor(Fx(c)));return[1,2,3,5,10,15].includes(i)||o>.8*a.length?hY.numeric.call(this,c,o,a):""}};function mhe(c,o){let a=o.length>3?o[2].value-o[1].value:o[1].value-o[0].value;return Math.abs(a)>=1&&c!==Math.floor(c)&&(a=c-Math.floor(c)),a}var p4={formatters:hY};function ghe(c){c.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(o,a)=>a.lineWidth,tickColor:(o,a)=>a.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:p4.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),c.route("scale.ticks","color","","color"),c.route("scale.grid","color","","borderColor"),c.route("scale.border","color","","borderColor"),c.route("scale.title","color","","color"),c.describe("scale",{_fallback:!1,_scriptable:o=>!o.startsWith("before")&&!o.startsWith("after")&&o!=="callback"&&o!=="parser",_indexable:o=>o!=="borderDash"&&o!=="tickBorderDash"&&o!=="dash"}),c.describe("scales",{_fallback:"scale"}),c.describe("scale.ticks",{_scriptable:o=>o!=="backdropPadding"&&o!=="callback",_indexable:o=>o!=="backdropPadding"})}const R2=Object.create(null),N6=Object.create(null);function jS(c,o){if(!o)return c;const a=o.split(".");for(let i=0,n=a.length;i<n;++i){const s=a[i];c=c[s]||(c[s]=Object.create(null))}return c}function x5(c,o,a){return typeof o=="string"?iA(jS(c,o),a):iA(jS(c,""),o)}class vhe{constructor(o,a){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,n)=>b5(n.backgroundColor),this.hoverBorderColor=(i,n)=>b5(n.borderColor),this.hoverColor=(i,n)=>b5(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={}
vendor: 4,403 bytes, line 9058
9058,this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(o),this.apply(a)}set(o,a){return x5(this,o,a)}get(o){return jS(this,o)}describe(o,a){return x5(N6,o,a)}override(o,a){return x5(R2,o,a)}route(o,a,i,n){const s=jS(this,o),h=jS(this,i),v="_"+a;Object.defineProperties(s,{[v]:{value:s[a],writable:!0},[a]:{enumerable:!0,get(){const g=this[v],O=h[n];return Rs(g)?Object.assign({},O,g):hu(g,O)},set(g){this[v]=g}}})}apply(o){o.forEach(a=>a(this))}}var ml=new vhe({_scriptable:c=>!c.startsWith("on"),_indexable:c=>c!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[dhe,hhe,ghe]);function yhe(c){return!c||gc(c.size)||gc(c.family)?null:(c.style?c.style+" ":"")+(c.weight?c.weight+" ":"")+c.size+"px "+c.family}function kN(c,o,a,i,n){let s=o[n];return s||(s=o[n]=c.measureText(n).width,a.push(n)),s>i&&(i=s),i}function bhe(c,o,a,i){i=i||{};let n=i.data=i.data||{},s=i.garbageCollect=i.garbageCollect||[];i.font!==o&&(n=i.data={},s=i.garbageCollect=[],i.font=o),c.save(),c.font=o;let h=0;const v=a.length;let g,O,A,S,M;for(g=0;g<v;g++)if(S=a[g],S!=null&&Xc(S)!==!0)h=kN(c,n,s,h,S);else if(Xc(S))for(O=0,A=S.length;O<A;O++)M=S[O],M!=null&&!Xc(M)&&(h=kN(c,n,s,h,M));c.restore();const P=s.length/2;if(P>a.length){for(g=0;g<P;g++)delete n[s[g]];s.splice(0,P)}return h}function e2(c,o,a){const i=c.currentDevicePixelRatio,n=a!==0?Math.max(a/2,.5):0;return Math.round((o-n)*i)/i+n}function oH(c,o){o=o||c.getContext("2d"),o.save(),o.resetTransform(),o.clearRect(0,0,c.width,c.height),o.restore()}function xhe(c,o,a,i){whe(c,o,a,i,null)}function whe(c,o,a,i,n){let s,h,v,g,O,A,S,M;const P=o.pointStyle,L=o.rotation,V=o.radius;let N=(L||0)*Yde;if(P&&typeof P=="object"&&(s=P.toString(),s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]")){c.save(),c.translate(a,i),c.rotate(N),c.drawImage(P,-P.width/2,-P.height/2,P.width,P.height),c.restore();return}if(!(isNaN(V)||V<=0)){switch(c.beginPath(),P){default:n?c.ellipse(a,i,n/2,V,0,0,T0):c.arc(a,i,V,0,T0),c.closePath();break;case"triangle":A=n?n/2:V,c.moveTo(a+Math.sin(N)*A,i-Math.cos(N)*V),N+=Y$,c.lineTo(a+Math.sin(N)*A,i-Math.cos(N)*V),N+=Y$,c.lineTo(a+Math.sin(N)*A,i-Math.cos(N)*V),c.closePath();break;case"rectRounded":O=V*.516,g=V-O,h=Math.cos(N+Zw)*g,S=Math.cos(N+Zw)*(n?n/2-O:g),v=Math.sin(N+Zw)*g,M=Math.sin(N+Zw)*(n?n/2-O:g),c.arc(a-S,i-v,O,N-td,N-Em),c.arc(a+M,i-h,O,N-Em,N),c.arc(a+S,i+v,O,N,N+Em),c.arc(a-M,i+h,O,N+Em,N+td),c.closePath();break;case"rect":if(!L){g=Math.SQRT1_2*V,A=n?n/2:g,c.rect(a-A,i-g,2*A,2*g);break}N+=Zw;case"rectRot":S=Math.cos(N)*(n?n/2:V),h=Math.cos(N)*V,v=Math.sin(N)*V,M=Math.sin(N)*(n?n/2:V),c.moveTo(a-S,i-v),c.lineTo(a+M,i-h),c.lineTo(a+S,i+v),c.lineTo(a-M,i+h),c.closePath();break;case"crossRot":N+=Zw;case"cross":S=Math.cos(N)*(n?n/2:V),h=Math.cos(N)*V,v=Math.sin(N)*V,M=Math.sin(N)*(n?n/2:V),c.moveTo(a-S,i-v),c.lineTo(a+S,i+v),c.moveTo(a+M,i-h),c.lineTo(a-M,i+h);break;case"star":S=Math.cos(N)*(n?n/2:V),h=Math.cos(N)*V,v=Math.sin(N)*V,M=Math.sin(N)*(n?n/2:V),c.moveTo(a-S,i-v),c.lineTo(a+S,i+v),c.moveTo(a+M,i-h),c.lineTo(a-M,i+h),N+=Zw,S=Math.cos(N)*(n?n/2:V),h=Math.cos(N)*V,v=Math.sin(N)*V,M=Math.sin(N)*(n?n/2:V),c.moveTo(a-S,i-v),c.lineTo(a+S,i+v),c.moveTo(a+M,i-h),c.lineTo(a-M,i+h);break;case"line":h=n?n/2:Math.cos(N)*V,v=Math.sin(N)*V,c.moveTo(a-h,i-v),c.lineTo(a+h,i+v);break;case"dash":c.moveTo(a,i),c.lineTo(a+Math.cos(N)*(n?n/2:V),i+Math.sin(N)*V);break;case!1:c.closePath();break}c.fill(),o.borderWidth>0&&c.stroke()}}function aA(c,o,a){return a=a||.5,!o||c&&c.x>o.left-a&&c.x<o.right+a&&c.y>o.top-a&&c.y<o.bottom+a}function pY(c,o){c.save(),c.beginPath(),c.rect(o.left,o.top,o.right-o.left,o.bottom-o.top),c.clip()}function mY(c){c.restore()}function _he(c,o,a,i,n){if(!o)return c.lineTo(a.x,a.y);if(n==="middle"){const s=(o.x+a.x)/2;c.lineTo(s,o.y),c.lineTo(s,a.y)}else n==="after"!=!!i?c.lineTo(o.x,a.y):c.lineTo(a.x,o.y);c.lineTo(a.x,a.y)}function khe(c,o,a,i){if(!o)return c.lineTo(a.x,a.y);c.bezierCurveTo(i?o.cp1x:o.cp2x,i?o.cp1y:o.cp2y,i?a.cp2x:a.cp1x,i?a.cp2y:a.cp1y,a.x,a.y)}function EN(c,o,a,i,n,s={}){const h=Xc(o)?o:[o],v=s.strokeWidth>0&&s.strokeColor!=="";let g,O;for(c.save(),c.font=n.string,Ehe(c,s),g=0;g<h.length;++g)O=h[g],s.backdrop&&She(c,s.backdrop),v&&(s.strokeColor&&(c.strokeStyle=s.strokeColor),gc(s.strokeWidth)||(c.lineWidth=s.strokeWidth),c.strokeText(O,a,i,s.maxWidth)),c.fillText(O,a,i,s.maxWidth),Che(c,a,i,O,s
vendor: 15,684 bytes, lines 9058-9063
9058),i+=n.lineHeight;c.restore()}function Ehe(c,o){o.translation&&c.translate(o.translation[0],o.translation[1]),gc(o.rotation)||c.rotate(o.rotation),o.color&&(c.fillStyle=o.color),o.textAlign&&(c.textAlign=o.textAlign),o.textBaseline&&(c.textBaseline=o.textBaseline)}function Che(c,o,a,i,n){if(n.strikethrough||n.underline){const s=c.measureText(i),h=o-s.actualBoundingBoxLeft,v=o+s.actualBoundingBoxRight,g=a-s.actualBoundingBoxAscent,O=a+s.actualBoundingBoxDescent,A=n.strikethrough?(g+O)/2:O;c.strokeStyle=c.fillStyle,c.beginPath(),c.lineWidth=n.decorationWidth||2,c.moveTo(h,A),c.lineTo(v,A),c.stroke()}}function She(c,o){const a=c.fillStyle;c.fillStyle=o.color,c.fillRect(o.left,o.top,o.width,o.height),c.fillStyle=a}function Ahe(c,o){const{x:a,y:i,w:n,h:s,radius:h}=o;c.arc(a+h.topLeft,i+h.topLeft,h.topLeft,-Em,td,!0),c.lineTo(a,i+s-h.bottomLeft),c.arc(a+h.bottomLeft,i+s-h.bottomLeft,h.bottomLeft,td,Em,!0),c.lineTo(a+n-h.bottomRight,i+s),c.arc(a+n-h.bottomRight,i+s-h.bottomRight,h.bottomRight,Em,0,!0),c.lineTo(a+n,i+h.topRight),c.arc(a+n-h.topRight,i+h.topRight,h.topRight,0,-Em,!0),c.lineTo(a+h.topLeft,i)}const Ohe=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Dhe=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function The(c,o){const a=(""+c).match(Ohe);if(!a||a[1]==="normal")return o*1.2;switch(c=+a[2],a[3]){case"px":return c;case"%":c/=100;break}return o*c}const Nhe=c=>+c||0;function gY(c,o){const a={},i=Rs(o),n=i?Object.keys(o):o,s=Rs(c)?i?h=>hu(c[h],c[o[h]]):h=>c[h]:()=>c;for(const h of n)a[h]=Nhe(s(h));return a}function Ihe(c){return gY(c,{top:"y",right:"x",bottom:"y",left:"x"})}function Mhe(c){return gY(c,["topLeft","topRight","bottomLeft","bottomRight"])}function xb(c){const o=Ihe(c);return o.width=o.left+o.right,o.height=o.top+o.bottom,o}function Mk(c,o){c=c||{},o=o||ml.font;let a=hu(c.size,o.size);typeof a=="string"&&(a=parseInt(a,10));let i=hu(c.style,o.style);i&&!(""+i).match(Dhe)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const n={family:hu(c.family,o.family),lineHeight:The(hu(c.lineHeight,o.lineHeight),a),size:a,style:i,weight:hu(c.weight,o.weight),string:""};return n.string=yhe(n),n}function JD(c,o,a,i){let n=!0,s,h,v;for(s=0,h=c.length;s<h;++s)if(v=c[s],v!==void 0&&(o!==void 0&&typeof v=="function"&&(v=v(o),n=!1),a!==void 0&&Xc(v)&&(v=v[a%v.length],n=!1),v!==void 0))return i&&!n&&(i.cacheable=!1),v}function Fhe(c,o,a){const{min:i,max:n}=c,s=Wde(o,(n-i)/2),h=(v,g)=>a&&v===0?0:v+g;return{min:h(i,-Math.abs(s)),max:h(n,s)}}function W2(c,o){return Object.assign(Object.create(c),o)}function mP(c,o=[""],a=c,i,n=()=>c[0]){jv(i)||(i=xY("_fallback",c));const s={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:c,_rootScopes:a,_fallback:i,_getTarget:n,override:h=>mP([h,...c],o,a,i)};return new Proxy(s,{deleteProperty(h,v){return delete h[v],delete h._keys,delete c[0][v],!0},get(h,v){return yY(h,v,()=>Whe(v,o,c,h))},getOwnPropertyDescriptor(h,v){return Reflect.getOwnPropertyDescriptor(h._scopes[0],v)},getPrototypeOf(){return Reflect.getPrototypeOf(c[0])},has(h,v){return sH(h).includes(v)},ownKeys(h){return sH(h)},set(h,v,g){const O=h._storage||(h._storage=n());return h[v]=O[v]=g,delete h._keys,!0}})}function Fk(c,o,a,i){const n={_cacheable:!1,_proxy:c,_context:o,_subProxy:a,_stack:new Set,_descriptors:vY(c,i),setContext:s=>Fk(c,s,a,i),override:s=>Fk(c.override(s),o,a,i)};return new Proxy(n,{deleteProperty(s,h){return delete s[h],delete c[h],!0},get(s,h,v){return yY(s,h,()=>Bhe(s,h,v))},getOwnPropertyDescriptor(s,h){return s._descriptors.allKeys?Reflect.has(c,h)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(c,h)},getPrototypeOf(){return Reflect.getPrototypeOf(c)},has(s,h){return Reflect.has(c,h)},ownKeys(){return Reflect.ownKeys(c)},set(s,h,v){return c[h]=v,delete s[h],!0}})}function vY(c,o={scriptable:!0,indexable:!0}){const{_scriptable:a=o.scriptable,_indexable:i=o.indexable,_allKeys:n=o.allKeys}=c;return{allKeys:n,scriptable:a,indexable:i,isScriptable:tw(a)?a:()=>a,isIndexable:tw(i)?i:()=>i}}const Rhe=(c,o)=>c?c+fP(o):o,gP=(c,o)=>Rs(o)&&c!=="adapters"&&(Object.getPrototypeOf(o)===null||o.constructor===Object);function yY(c,o,a){if(Object.prototype.hasOwnProperty.call(c,o))return c[o];const i=a();return c[o]=i,i}function Bhe(c,o,a){const{_proxy:i,_context:n,_subProxy:s,_descriptors:h}=c;let v=i[o];return tw(v)&&h.isScriptable(o)&&(v=Phe(o,v,c,a)),Xc(v)&&v.length&&(v=jhe(o,v,c,h.isIndexable)),gP(o,v)&&(v=Fk(v,n,s&&s[o],h)),v}function Phe(c,o,a,i){const{_proxy:n,_context:s,_subProxy:h,_stack:v}=a;if(v.has(c))throw new Error("Recursion detected: "+Array.from(v).join("->")+"->"+c);return v.add(c),o=o(s,h||i),v.delete(c),gP(c,o)&&(o=vP(n._scopes,n,c,o)),o}function jhe(c,o,a,i){const{_proxy:n,_context:s,_subProxy:h,_descriptors:v}=a;if(jv(s.index)&&i(c))o=o[s.index%o.length];else if(Rs(o[0])){const g=o,O=n._scopes.filter(A=>A!==g);o=[];for(const A of g){const S=vP(O,n,c,A);o.push(Fk(S,s,h&&h[c],v))}}return o}function bY(c,o,a){return tw(c)?c(o,a):c}const Lhe=(c,o)=>c===!0?o:typeof c=="string"?wN(o,c):void 0;function zhe(c,o,a,i,n){for(const s of o){const h=Lhe(a,s);if(h){c.add(h);const v=bY(h._fallback,a,n);if(jv(v)&&v!==a&&v!==i)return v}else if(h===!1&&jv(i)&&a!==i)return null}return!1}function vP(c,o,a,i){const n=o._rootScopes,s=bY(o._fallback,a,i),h=[...c,...n],v=new Set;v.add(i);let g=aH(v,h,a,s||a,i);return g===null||jv(s)&&s!==a&&(g=aH(v,h,s,g,i),g===null)?!1:mP(Array.from(v),[""],n,s,()=>Uhe(o,a,i))}function aH(c,o,a,i,n){for(;a;)a=zhe(c,o,a,i,n);return a}function Uhe(c,o,a){const i=c._getTarget();o in i||(i[o]={});const n=i[o];return Xc(n)&&Rs(a)?a:n||{}}function Whe(c,o,a,i){let n;for(const s of o)if(n=xY(Rhe(s,c),a),jv(n))return gP(c,n)?vP(a,i,c,n):n}function xY(c,o){for(const a of o){if(!a)continue;const i=a[c];if(jv(i))return i}}function sH(c){let o=c._keys;return o||(o=c._keys=Vhe(c._scopes)),o}function Vhe(c){const o=new Set;for(const a of c)for(const i of Object.keys(a).filter(n=>!n.startsWith("_")))o.add(i);return Array.from(o)}const $he=Number.EPSILON||1e-14,Rk=(c,o)=>o<c.length&&!c[o].skip&&c[o],wY=c=>c==="x"?"y":"x";function Hhe(c,o,a,i){const n=c.skip?o:c,s=o,h=a.skip?o:a,v=Q$(s,n),g=Q$(h,s);let O=v/(v+g),A=g/(v+g);O=isNaN(O)?0:O,A=isNaN(A)?0:A;const S=i*O,M=i*A;return{previous:{x:s.x-S*(h.x-n.x),y:s.y-S*(h.y-n.y)},next:{x:s.x+M*(h.x-n.x),y:s.y+M*(h.y-n.y)}}}function qhe(c,o,a){const i=c.length;let n,s,h,v,g,O=Rk(c,0);for(let A=0;A<i-1;++A)if(g=O,O=Rk(c,A+1),!(!g||!O)){if(BS(o[A],0,$he)){a[A]=a[A+1]=0;continue}n=a[A]/o[A],s=a[A+1]/o[A],v=Math.pow(n,2)+Math.pow(s,2),!(v<=9)&&(h=3/Math.sqrt(v),a[A]=n*h*o[A],a[A+1]=s*h*o[A])}}function Ghe(c,o,a="x"){const i=wY(a),n=c.length;let s,h,v,g=Rk(c,0);for(let O=0;O<n;++O){if(h=v,v=g,g=Rk(c,O+1),!v)continue;const A=v[a],S=v[i];h&&(s=(A-h[a])/3,v[`cp1${a}`]=A-s,v[`cp1${i}`]=S-s*o[O]),g&&(s=(g[a]-A)/3,v[`cp2${a}`]=A+s,v[`cp2${i}`]=S+s*o[O])}}function Khe(c,o="x"){const a=wY(o),i=c.length,n=Array(i).fill(0),s=Array(i);let h,v,g,O=Rk(c,0);for(h=0;h<i;++h)if(v=g,g=O,O=Rk(c,h+1),!!g){if(O){const A=O[o]-g[o];n[h]=A!==0?(O[a]-g[a])/A:0}s[h]=v?O?Ik(n[h-1])!==Ik(n[h])?0:(n[h-1]+n[h])/2:n[h-1]:n[h]}qhe(c,n,s),Ghe(c,s,o)}function QD(c,o,a){return Math.max(Math.min(c,a),o)}function Yhe(c,o){let a,i,n,s,h,v=aA(c[0],o);for(a=0,i=c.length;a<i;++a)h=s,s=v,v=a<i-1&&aA(c[a+1],o),s&&(n=c[a],h&&(n.cp1x=QD(n.cp1x,o.left,o.right),n.cp1y=QD(n.cp1y,o.top,o.bottom)),v&&(n.cp2x=QD(n.cp2x,o.left,o.right),n.cp2y=QD(n.cp2y,o.top,o.bottom)))}function Xhe(c,o,a,i,n){let s,h,v,g;if(o.spanGaps&&(c=c.filter(O=>!O.skip)),o.cubicInterpolationMode==="monotone")Khe(c,n);else{let O=i?c[c.length-1]:c[0];for(s=0,h=c.length;s<h;++s)v=c[s],g=Hhe(O,v,c[Math.min(s+1,h-(i?0:1))%h],o.tension),v.cp1x=g.previous.x,v.cp1y=g.previous.y,v.cp2x=g.next.x,v.cp2y=g.next.y,O=v}o.capBezierPoints&&Yhe(c,a)}function _Y(){return typeof window<"u"&&typeof document<"u"}function yP(c){let o=c.parentNode;return o&&o.toString()==="[object ShadowRoot]"&&(o=o.host),o}function CN(c,o,a){let i;return typeof c=="string"?(i=parseInt(c,10),c.indexOf("%")!==-1&&(i=i/100*o.parentNode[a])):i=c,i}const m4=c=>c.ownerDocument.defaultView.getComputedStyle(c,null);function Jhe(c,o){return m4(c).getPropertyValue(o)}const Qhe=["top","right","bottom","left"];function O2(c,o,a){const i={};a=a?"-"+a:"";for(let n=0;n<4;n++){const s=Qhe[n];i[s]=parseFloat(c[o+"-"+s+a])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Zhe=(c,o,a)=>(c>0||o>0)&&(!a||!a.shadowRoot);function epe(c,o){const a=c.touches,i=a&&a.length?a[0]:c,{offsetX:n,offsetY:s}=i;let h=!1,v,g;if(Zhe(n,s,c.target))v=n,g=s;else{const O=o.getBoundingClientRect();v=i.clientX-O.left,g=i.clientY-O.top,h=!0}return{x:v,y:g,box:h}}function d2(c,o){if("native"in c)return c;const{canvas:a,currentDevicePixelRatio:i}=o,n=m4(a),s=n.boxSizing==="border-box",h=O2(n,"padding"),v=O2(n,"border","width"),{x:g,y:O,box:A}=epe(c,a),S=h.left+(A&&v.left),M=h.top+(A&&v.top);let{width:P,height:L}=o;return s&&(P-=h.width+v.width,L-=h.height+v.height),{x:Math.round((g-S)/P*a.width/i),y:Math.round((O-M)/L*a.height/i)}}function tpe(c,o,a){let i,n;if(o===void 0||a===void 0){const s=yP(c);if(!s)o=c.clientWidth,a=c.clientHeight;else{const h=s.getBoundingClientRect(),v=m4(s),g=O2(v,"border","width"),O=O2(v,"padding");o=h.width-O.width-g.width,a=h.height-O.height-g.height,i=CN(v.maxWidth,s,"clientWidth"),n=CN(v.maxHeight,s,"clientHeight")}}return{width:o,height:a,maxWidth:i||_N,maxHeight:n||_N}}const ZD=c=>Math.round(c*10)/10;function npe(c,o,a,i){const n=m4(c),s=O2(n,"margin"),h=CN(n.maxWidth,c,"clientWidth")||_N,v=CN(n.maxHeight,c,"clientHeight")||_N,g=tpe(c,o,a);let{width:O,height:A}=g;if(n.boxSizing==="content-box"){const M=O2(n,"border","width"),P=O2(n,"padding");O-=P.width+M.width,A-=P.height+M.height}return O=Math.max(0,O-s.width),A=Math.max(0,i?O/i:A-s.height),O=ZD(Math.min(O,h,g.maxWidth)),A=ZD(Math.min(A,v,g.maxHeight)),O&&!A&&(A=ZD(O/2)),(o!==void 0||a!==void 0)&&i&&g.height&&A>g.height&&(A=g.height,O=ZD(Math.floor(A*i))),{width:O,height:A}}function uH(c,o,a){const i=o||1,n=Math.floor(c.height*i),s=Math.floor(c.width*i);c.height=Math.floor(c.height),c.width=Math.floor(c.width);const h=c.canvas;return h.style&&(a||!h.style.height&&!h.style.width)&&(h.style.height=`${c.height}px`,h.style.width=`${c.width}px`),c.currentDevicePixelRatio!==i||h.height!==n||h.width!==s?(c.currentDevicePixelRatio=i,h.height=n,h.width=s,c.ctx.setTransform(i,0,0,i,0,0),!0):!1}const rpe=function(){let c=!1;try{const o={get passive(){return c=!0,!1}};window.addEventListener("test",null,o),window.removeEventListener("test",null,o)}catch{}return c}();function cH(c,o){const a=Jhe(c,o),i=a&&a.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function h2(c,o,a,i){return{x:c.x+a*(o.x-c.x),y:c.y+a*(o.y-c.y)}}function ipe(c,o,a,i){return{x:c.x+a*(o.x-c.x),y:i==="middle"?a<.5?c.y:o.y:i==="after"?a<1?c.y:o.y:a>0?o.y:c.y}}function ope(c,o,a,i){const n={x:c.cp2x,y:c.cp2y},s={x:o.cp1x,y:o.cp1y},h=h2(c,n,a),v=h2(n,s,a),g=h2(s,o,a),O=h2(h,v,a),A=h2(v,g,a);return h2(O,A,a)}function kY(c){return c==="angle"?{between:uY,compare:Zde,normalize:Mv}:{between:the,compare:(o,a)=>o-a,normalize:o=>o}}function lH({start:c,end:o,count:a,loop:i,style:n}){return{start:c%a,end:o%a,loop:i&&(o-c+1)%a===0,style:n}}function ape(c,o,a){const{property:i,start:n,end:s}=a,{between:h,normalize:v}=kY(i),g=o.length;let{start:O,end:A,loop:S}=c,M,P;if(S){for(O+=g,A+=g,M=0,P=g;M<P&&h(v(o[O%g][i]),n,s);++M)O--,A--;O%=g,A%=g}return A<O&&(A+=g),{start:O,end:A,loop:S,style:c.style}}function spe(c,o,a){if(!a)return[c];const{property:i,start:n,end:s}=a,h=o.length,{compare:v,between:g,normalize:O}=kY(i),{start:A,end:S,loop:M,style:P}=ape(c,o,a),L=[];let V=!1,N=null,ee,J,K;const re=()=>g(n,K,ee)&&v(n,K)!==0,ce=()=>v(s,ee)===0||g(s,K,ee),pe=()=>V||re(),ke=()=>!V||ce();for(let Ce=A,be=A;Ce<=S;++Ce)J=o[Ce%h],!J.skip&&(ee=O(J[i]),ee!==K&&(V=g(ee,n,s),N===null&&pe()&&(N=v(ee,n)===0?Ce:be),N!==null&&ke()&&(L.push(lH({start:N,end:Ce,loop:M,count:h,style:P})),N=null),be=Ce,K=ee));return N!==null&&L.push(lH({start:N,end:S,loop:M,count:h,style:P})),L}function upe(c,o){const a=[],i=c.segments;for(let n=0;n<i.length;n++){const s=spe(i[n],c.points,o);s.length&&a.push(...s)}return a}function cpe(c,o,a,i){let n=0,s=o-1;if(a&&!i)for(;n<o&&!c[n].skip;)n++;for(;n<o&&c[n].skip;)n++;for(n%=o,a&&(s+=n);s>n&&c[s%o].skip;)s--;return s%=o,{start:n,end:s}}function lpe(c,o,a,i){const n=c.length,s=[];let h=o,v=c[o],g;for(g=o+1;g<=a;++g){const O=c[g%n];O.skip||O.stop?v.skip||(i=!1,s.push({start:o%n,end:(g-1)%n,loop:i}),o=h=O.stop?g:null):(h=g,v.skip&&(o=g)),v=O}return h!==null&&s.push({start:o%n,end:h%n,loop:i}),s}function fpe(c,o){const a=c.points,i=c.options.spanGaps,n=a.length;if(!n)return[];const s=!!c._loop,{start:h,end:v}=cpe(a,n,s,i);if(i===!0)return fH(c,[{start:h,end:v,loop:s}],a,o);const g=v<h?v+n:v,O=!!c._fullLoop&&h===0&&v===n-1;return fH(c,lpe(a,h,g,O),a,o)}function fH(c,o,a,i){return!i||!i.setContext||!a?o:dpe(c,o,a,i)}function dpe(c,o,a,i){const n=c._chart.getContext(),s=dH(c.options),{_datasetIndex:h,options:{spanGaps:v}}=c,g=a.length,O=[];let A=s,S=o[0].start,M=S;function P(L,V,N,ee){const J=v?-1:1;if(L!==V){for(L+=g;a[L%g].skip;)L-=J;for(;a[V%g].skip;)V+=J;L%g!==V%g&&(O.push({start:L%g,end:V%g,loop:N,style:ee}),A=ee,S=V%g)}}for(const L of o){S=v?S:L.start;let V=a[S%g],N;for(M=S+1;M<=L.end;M++){const ee=a[M%g];N=dH(i.setContext(W2(n,{type:"segment",p0:V,p1:ee,p0DataIndex:(M-1)%g,p1DataIndex:M%g,datasetIndex:h}))),hpe(N,A)&&P(S,M-1,L.loop,A),V=ee,A=N}S<M-1&&P(S,M-1,L.loop,A)}return O}function dH(c){return{backgroundColor:c.backgroundColor,borderCapStyle:c.borderCapStyle,borderDash:c.borderDash,borderDashOffset:c.borderDashOffset,borderJoinStyle:c.borderJoinStyle,borderWidth:c.borderWidth,borderColor:c.borderColor}}function hpe(c,o){return o&&JSON.stringify(c)!==JSON.stringify(o)}/*! 9059 * Chart.js v4.2.1 9060 * https://www.chartjs.org 9061 * (c) 2023 Chart.js Contributors 9062 * Released under the MIT License 9063 */class ppe{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(o,a,i,n){const s=a.listeners[n],h=a.duration;s.forEach(v=>v({chart:o,initial:a.initial,numSteps:h,currentStep:Math.min(i-a.start,h)}))}_refresh(){this._request||(this._running=!0,this._request=lY.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(o=Date.now()){let a=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;const s=i.items;let h=s.length-1,v=!1,g;for(;h>=0;--h)g=s[h],g._active?(g._total>i.duration&&(i.duration=g._total),g.tick(o),v=!0):(s[h]=s[s.length-1],s.pop());v&&(n.draw(),this._notify(n,i,o,"progress")),s.length||(i.running=!1,this._notify(n,i,o,"complete"),i.initial=!1),a+=s.length}),this._lastDate=o,a===0&&(this._running=!1)}_getAnims(o){const a=this._charts;let i=a.get(o);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},a.set(o,i)),i}listen(o,a,i){this._getAnims(o).listeners[a].push(i)}add(o,a){!a||!a.length||this._getAnims(o).items.push(...a)}has(o){return this._getAnims(o).items.length>0}start(o){const a=this._charts.get(o);a&&(a.running=!0,a.start=Date.now(),a.duration=a.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(o){if(!this._running)return!1;const a=this._charts.get(o);return!(!a||!a.running||!a.items.length)}stop(o){const a=this._charts.get(o);if(!a||!a.items.length)return;const i=a.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();a.items=[],this._notify(o,a,Date.now(),"complete")}remove(o){return this._charts.delete(o)}}var ab=new ppe;const hH="transparent",mpe={boolean(c,o,a){return a>.5?o:c},color(c,o,a){const i=rH(c||hH),n=i.valid&&rH(o||hH);
vendor: 4,155 bytes, line 9063
9063return n&&n.valid?n.mix(i,a).hexString():o},number(c,o,a){return c+(o-c)*a}};class gpe{constructor(o,a,i,n){const s=a[i];n=JD([o.to,n,s,o.from]);const h=JD([o.from,s,n]);this._active=!0,this._fn=o.fn||mpe[o.type||typeof h],this._easing=PS[o.easing]||PS.linear,this._start=Math.floor(Date.now()+(o.delay||0)),this._duration=this._total=Math.floor(o.duration),this._loop=!!o.loop,this._target=a,this._prop=i,this._from=h,this._to=n,this._promises=void 0}active(){return this._active}update(o,a,i){if(this._active){this._notify(!1);const n=this._target[this._prop],s=i-this._start,h=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(h,o.duration)),this._total+=s,this._loop=!!o.loop,this._to=JD([o.to,a,n,o.from]),this._from=JD([o.from,n,a])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(o){const a=o-this._start,i=this._duration,n=this._prop,s=this._from,h=this._loop,v=this._to;let g;if(this._active=s!==v&&(h||a<i),!this._active){this._target[n]=v,this._notify(!0);return}if(a<0){this._target[n]=s;return}g=a/i%2,g=h&&g>1?2-g:g,g=this._easing(Math.min(1,Math.max(0,g))),this._target[n]=this._fn(s,v,g)}wait(){const o=this._promises||(this._promises=[]);return new Promise((a,i)=>{o.push({res:a,rej:i})})}_notify(o){const a=o?"res":"rej",i=this._promises||[];for(let n=0;n<i.length;n++)i[n][a]()}}class vpe{constructor(o,a){this._chart=o,this._properties=new Map,this.configure(a)}configure(o){if(!Rs(o))return;const a=Object.keys(ml.animation),i=this._properties;Object.getOwnPropertyNames(o).forEach(n=>{const s=o[n];if(!Rs(s))return;const h={};for(const v of a)h[v]=s[v];(Xc(s.properties)&&s.properties||[n]).forEach(v=>{(v===n||!i.has(v))&&i.set(v,h)})})}_animateOptions(o,a){const i=a.options,n=bpe(o,i);if(!n)return[];const s=this._createAnimations(n,i);return i.$shared&&ype(o.options.$animations,i).then(()=>{o.options=i},()=>{}),s}_createAnimations(o,a){const i=this._properties,n=[],s=o.$animations||(o.$animations={}),h=Object.keys(a),v=Date.now();let g;for(g=h.length-1;g>=0;--g){const O=h[g];if(O.charAt(0)==="$")continue;if(O==="options"){n.push(...this._animateOptions(o,a));continue}const A=a[O];let S=s[O];const M=i.get(O);if(S)if(M&&S.active()){S.update(M,A,v);continue}else S.cancel();if(!M||!M.duration){o[O]=A;continue}s[O]=S=new gpe(M,o,O,A),n.push(S)}return n}update(o,a){if(this._properties.size===0){Object.assign(o,a);return}const i=this._createAnimations(o,a);if(i.length)return ab.add(this._chart,i),!0}}function ype(c,o){const a=[],i=Object.keys(o);for(let n=0;n<i.length;n++){const s=c[i[n]];s&&s.active()&&a.push(s.wait())}return Promise.all(a)}function bpe(c,o){if(!o)return;let a=c.options;if(!a){c.options=o;return}return a.$shared&&(c.options=a=Object.assign({},a,{$shared:!1,$animations:{}})),a}function pH(c,o){const a=c&&c.options||{},i=a.reverse,n=a.min===void 0?o:0,s=a.max===void 0?o:0;return{start:i?s:n,end:i?n:s}}function xpe(c,o,a){if(a===!1)return!1;const i=pH(c,a),n=pH(o,a);return{top:n.end,right:i.end,bottom:n.start,left:i.start}}function wpe(c){let o,a,i,n;return Rs(c)?(o=c.top,a=c.right,i=c.bottom,n=c.left):o=a=i=n=c,{top:o,right:a,bottom:i,left:n,disabled:c===!1}}function EY(c,o){const a=[],i=c._getSortedDatasetMetas(o);let n,s;for(n=0,s=i.length;n<s;++n)a.push(i[n].index);return a}function mH(c,o,a,i={}){const n=c.keys,s=i.mode==="single";let h,v,g,O;if(o!==null){for(h=0,v=n.length;h<v;++h){if(g=+n[h],g===a){if(i.all)continue;break}O=c.values[g],mf(O)&&(s||o===0||Ik(o)===Ik(O))&&(o+=O)}return o}}function _pe(c){const o=Object.keys(c),a=new Array(o.length);let i,n,s;for(i=0,n=o.length;i<n;++i)s=o[i],a[i]={x:s,y:c[s]};return a}function gH(c,o){const a=c&&c.options.stacked;return a||a===void 0&&o.stack!==void 0}function kpe(c,o,a){return`${c.id}.${o.id}.${a.stack||a.type}`}function Epe(c){const{min:o,max:a,minDefined:i,maxDefined:n}=c.getUserBounds();return{min:i?o:Number.NEGATIVE_INFINITY,max:n?a:Number.POSITIVE_INFINITY}}function Cpe(c,o,a){const i=c[o]||(c[o]={});return i[a]||(i[a]={})}function vH(c,o,a,i){for(const n of o.getMatchingVisibleMetas(i).reverse()){const s=c[n.index];if(a&&s>0||!a&&s<0)return n.index}return null}
vendor: 9,740 bytes, line 9063
9063function yH(c,o){const{chart:a,_cachedMeta:i}=c,n=a._stacks||(a._stacks={}),{iScale:s,vScale:h,index:v}=i,g=s.axis,O=h.axis,A=kpe(s,h,i),S=o.length;let M;for(let P=0;P<S;++P){const L=o[P],{[g]:V,[O]:N}=L,ee=L._stacks||(L._stacks={});M=ee[O]=Cpe(n,A,V),M[v]=N,M._top=vH(M,h,!0,i.type),M._bottom=vH(M,h,!1,i.type);const J=M._visualValues||(M._visualValues={});J[v]=N}}function w5(c,o){const a=c.scales;return Object.keys(a).filter(i=>a[i].axis===o).shift()}function Spe(c,o){return W2(c,{active:!1,dataset:void 0,datasetIndex:o,index:o,mode:"default",type:"dataset"})}function Ape(c,o,a){return W2(c,{active:!1,dataIndex:o,parsed:void 0,raw:void 0,element:a,index:o,mode:"default",type:"data"})}function GC(c,o){const a=c.controller.index,i=c.vScale&&c.vScale.axis;if(i){o=o||c._parsed;for(const n of o){const s=n._stacks;if(!s||s[i]===void 0||s[i][a]===void 0)return;delete s[i][a],s[i]._visualValues!==void 0&&s[i]._visualValues[a]!==void 0&&delete s[i]._visualValues[a]}}}const _5=c=>c==="reset"||c==="none",bH=(c,o)=>o?c:Object.assign({},c),Ope=(c,o,a)=>c&&!o.hidden&&o._stacked&&{keys:EY(a,!0),values:null};class LS{constructor(o,a){this.chart=o,this._ctx=o.ctx,this.index=a,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const o=this._cachedMeta;this.configure(),this.linkScales(),o._stacked=gH(o.vScale,o),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(o){this.index!==o&&GC(this._cachedMeta),this.index=o}linkScales(){const o=this.chart,a=this._cachedMeta,i=this.getDataset(),n=(S,M,P,L)=>S==="x"?M:S==="r"?L:P,s=a.xAxisID=hu(i.xAxisID,w5(o,"x")),h=a.yAxisID=hu(i.yAxisID,w5(o,"y")),v=a.rAxisID=hu(i.rAxisID,w5(o,"r")),g=a.indexAxis,O=a.iAxisID=n(g,s,h,v),A=a.vAxisID=n(g,h,s,v);a.xScale=this.getScaleForId(s),a.yScale=this.getScaleForId(h),a.rScale=this.getScaleForId(v),a.iScale=this.getScaleForId(O),a.vScale=this.getScaleForId(A)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(o){return this.chart.scales[o]}_getOtherScale(o){const a=this._cachedMeta;return o===a.iScale?a.vScale:a.iScale}reset(){this._update("reset")}_destroy(){const o=this._cachedMeta;this._data&&Z$(this._data,this),o._stacked&&GC(o)}_dataCheck(){const o=this.getDataset(),a=o.data||(o.data=[]),i=this._data;if(Rs(a))this._data=_pe(a);else if(i!==a){if(i){Z$(i,this);const n=this._cachedMeta;GC(n),n._parsed=[]}a&&Object.isExtensible(a)&&ihe(a,this),this._syncList=[],this._data=a}}addElements(){const o=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(o.dataset=new this.datasetElementType)}buildOrUpdateElements(o){const a=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const s=a._stacked;a._stacked=gH(a.vScale,a),a.stack!==i.stack&&(n=!0,GC(a),a.stack=i.stack),this._resyncElements(o),(n||s!==a._stacked)&&yH(this,a._parsed)}configure(){const o=this.chart.config,a=o.datasetScopeKeys(this._type),i=o.getOptionScopes(this.getDataset(),a,!0);this.options=o.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(o,a){const{_cachedMeta:i,_data:n}=this,{iScale:s,_stacked:h}=i,v=s.axis;let g=o===0&&a===n.length?!0:i._sorted,O=o>0&&i._parsed[o-1],A,S,M;if(this._parsing===!1)i._parsed=n,i._sorted=!0,M=n;else{Xc(n[o])?M=this.parseArrayData(i,n,o,a):Rs(n[o])?M=this.parseObjectData(i,n,o,a):M=this.parsePrimitiveData(i,n,o,a);const P=()=>S[v]===null||O&&S[v]<O[v];for(A=0;A<a;++A)i._parsed[A+o]=S=M[A],g&&(P()&&(g=!1),O=S);i._sorted=g}h&&yH(this,M)}parsePrimitiveData(o,a,i,n){const{iScale:s,vScale:h}=o,v=s.axis,g=h.axis,O=s.getLabels(),A=s===h,S=new Array(n);let M,P,L;for(M=0,P=n;M<P;++M)L=M+i,S[M]={[v]:A||s.parse(O[L],L),[g]:h.parse(a[L],L)};return S}parseArrayData(o,a,i,n){const{xScale:s,yScale:h}=o,v=new Array(n);let g,O,A,S;for(g=0,O=n;g<O;++g)A=g+i,S=a[A],v[g]={x:s.parse(S[0],A),y:h.parse(S[1],A)};return v}parseObjectData(o,a,i,n){const{xScale:s,yScale:h}=o,{xAxisKey:v="x",yAxisKey:g="y"}=this._parsing,O=new Array(n);let A,S,M,P;for(A=0,S=n;A<S;++A)M=A+i,P=a[M],O[A]={x:s.parse(wN(P,v),M),y:h.parse(wN(P,g),M)};return O}getParsed(o){return this._cachedMeta._parsed[o]}getDataElement(o){return this._cachedMeta.data[o]}applyStack(o,a,i){const n=this.chart,s=this._cachedMeta,h=a[o.axis],v={keys:EY(n,!0),values:a._stacks[o.axis]._visualValues};return mH(v,h,s.index,{mode:i})}updateRangeFromParsed(o,a,i,n){const s=i[a.axis];let h=s===null?NaN:s;const v=n&&i._stacks[a.axis];n&&v&&(n.values=v,h=mH(n,s,this._cachedMeta.index)),o.min=Math.min(o.min,h),o.max=Math.max(o.max,h)}getMinMax(o,a){const i=this._cachedMeta,n=i._parsed,s=i._sorted&&o===i.iScale,h=n.length,v=this._getOtherScale(o),g=Ope(a,i,this.chart),O={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:A,max:S}=Epe(v);let M,P;function L(){P=n[M];const V=P[v.axis];return!mf(P[o.axis])||A>V||S<V}for(M=0;M<h&&!(!L()&&(this.updateRangeFromParsed(O,o,P,g),s));++M);if(s){for(M=h-1;M>=0;--M)if(!L()){this.updateRangeFromParsed(O,o,P,g);break}}return O}getAllParsedValues(o){const a=this._cachedMeta._parsed,i=[];let n,s,h;for(n=0,s=a.length;n<s;++n)h=a[n][o.axis],mf(h)&&i.push(h);return i}getMaxOverflow(){return!1}getLabelAndValue(o){const a=this._cachedMeta,i=a.iScale,n=a.vScale,s=this.getParsed(o);return{label:i?""+i.getLabelForValue(s[i.axis]):"",value:n?""+n.getLabelForValue(s[n.axis]):""}}_update(o){const a=this._cachedMeta;this.update(o||"default"),a._clip=wpe(hu(this.options.clip,xpe(a.xScale,a.yScale,this.getMaxOverflow())))}update(o){}draw(){const o=this._ctx,a=this.chart,i=this._cachedMeta,n=i.data||[],s=a.chartArea,h=[],v=this._drawStart||0,g=this._drawCount||n.length-v,O=this.options.drawActiveElementsOnTop;let A;for(i.dataset&&i.dataset.draw(o,s,v,g),A=v;A<v+g;++A){const S=n[A];S.hidden||(S.active&&O?h.push(S):S.draw(o,s))}for(A=0;A<h.length;++A)h[A].draw(o,s)}getStyle(o,a){const i=a?"active":"default";return o===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(o||0,i)}getContext(o,a,i){const n=this.getDataset();let s;if(o>=0&&o<this._cachedMeta.data.length){const h=this._cachedMeta.data[o];s=h.$context||(h.$context=Ape(this.getContext(),o,h)),s.parsed=this.getParsed(o),s.raw=n.data[o],s.index=s.dataIndex=o}else s=this.$context||(this.$context=Spe(this.chart.getContext(),this.index)),s.dataset=n,s.index=s.datasetIndex=this.index;return s.active=!!a,s.mode=i,s}resolveDatasetElementOptions(o){return this._resolveElementOptions(this.datasetElementType.id,o)}resolveDataElementOptions(o,a){return this._resolveElementOptions(this.dataElementType.id,a,o)}_resolveElementOptions(o,a="default",i){const n=a==="active",s=this._cachedDataOpts,h=o+"-"+a,v=s[h],g=this.enableOptionSharing&&jv(i);if(v)return bH(v,g);const O=this.chart.config,A=O.datasetElementScopeKeys(this._type,o),S=n?[`${o}Hover`,"hover",o,""]:[o,""],M=O.getOptionScopes(this.getDataset(),A),P=Object.keys(ml.elements[o]),L=()=>this.getContext(i,n,a),V=O.resolveNamedOptions(M,P,L,S);return V.$shared&&(V.$shared=g,s[h]=Object.freeze(bH(V,g))),V}_resolveAnimations(o,a,i){const n=this.chart,s=this._cachedDataOpts,h=`animation-${a}`,v=s[h];if(v)return v;let g;if(n.options.animation!==!1){const A=this.chart.config,S=A.datasetAnimationScopeKeys(this._type,a),M=A.getOptionScopes(this.getDataset(),S);g=A.createResolver(M,this.getContext(o,i,a))}const O=new vpe(n,g&&g.animations);return g&&g._cacheable&&(s[h]=Object.freeze(O)),O}getSharedOptions(o){if(o.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},o))}includeOptions(o,a){return!a||_5(o)||this.chart._animationsDisabled}_getSharedOptions(o,a){const i=this.resolveDataElementOptions(o,a),n=this._sharedOptions,s=this.getSharedOptions(i),h=this.includeOptions(a,s)||s!==n;return this.updateSharedOptions(s,a,i),{sharedOptions:s,includeOptions:h}}updateElement(o,a,i,n){_5(n)?Object.assign(o,i):this._resolveAnimations(a,n).update(o,i)}updateSharedOptions(o,a,i){o&&!_5(a)&&this._resolveAnimations(void 0,a).update(o,i)}_setStyle(o,a,i,n){o.active=n;const s=this.getStyle(a,n);this._resolveAnimations(a,i,n).update(o,{options:!n&&this.getSharedOptions(s)||s})}removeHoverStyle(o,a,i){this._setStyle(o,i,"active",!1)}setHoverStyle(o,a,i){this._setStyle(o,i,"active",!0)}_removeDatasetHoverStyle(){const o=this._cachedMeta.dataset;o&&this._setStyle(o,void 0,"active",!1)}_setDatasetHoverStyle(){const o=this._cachedMeta.dataset;o&&this._setStyle(o,void 0,"active",!0)}_resyncElements(o){const a=this._data,i=this._cachedMeta.data;for(const[v,g,O]of this._syncList)this[v](g,O);this._syncList=[];const n=i.length,s=a.length,h=Math.min(s,n);h&&this.parse(0,h),s>n?this._insertElements(n,s-n,o):s<n&&this._removeElements(s,n-s)}_insertElements(o,a,i=!0){const n=this._cachedMeta,s=n.data,h=o+a;let v;const g=O=>{for(O.length+=a,v=O.length-1;v>=h;v--)O[v]=O[v-a]};for(g(s),v=o;v<h;++v)s[v]=new this.dataElementType;this._parsing&&g(n._parsed),this.parse(o,a),i&&this.updateElements(s,o,a,"reset")}updateElements(o,a,i,n){}_removeElements(o,a){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(o,a);i._stacked&&GC(i,n)}i.data.splice(o,a)}
vendor: 4,991 bytes, line 9063
9063_sync(o){if(this._parsing)this._syncList.push(o);else{const[a,i,n]=o;this[a](i,n)}this.chart._dataChanges.push([this.index,...o])}_onDataPush(){const o=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-o,o])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(o,a){a&&this._sync(["_removeElements",o,a]);const i=arguments.length-2;i&&this._sync(["_insertElements",o,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}Ka(LS,"defaults",{}),Ka(LS,"datasetElementType",null),Ka(LS,"dataElementType",null);class UT extends LS{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(o){const a=this._cachedMeta,{dataset:i,data:n=[],_dataset:s}=a,h=this.chart._animationsDisabled;let{start:v,count:g}=uhe(a,n,h);this._drawStart=v,this._drawCount=g,che(a)&&(v=0,g=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!s._decimated,i.points=n;const O=this.resolveDatasetElementOptions(o);this.options.showLine||(O.borderWidth=0),O.segment=this.options.segment,this.updateElement(i,void 0,{animated:!h,options:O},o),this.updateElements(n,v,g,o)}updateElements(o,a,i,n){const s=n==="reset",{iScale:h,vScale:v,_stacked:g,_dataset:O}=this._cachedMeta,{sharedOptions:A,includeOptions:S}=this._getSharedOptions(a,n),M=h.axis,P=v.axis,{spanGaps:L,segment:V}=this.options,N=oA(L)?L:Number.POSITIVE_INFINITY,ee=this.chart._animationsDisabled||s||n==="none",J=a+i,K=o.length;let re=a>0&&this.getParsed(a-1);for(let ce=0;ce<K;++ce){const pe=o[ce],ke=ee?pe:{};if(ce<a||ce>=J){ke.skip=!0;continue}const Ce=this.getParsed(ce),be=gc(Ce[P]),$e=ke[M]=h.getPixelForValue(Ce[M],ce),ht=ke[P]=s||be?v.getBasePixel():v.getPixelForValue(g?this.applyStack(v,Ce,g):Ce[P],ce);ke.skip=isNaN($e)||isNaN(ht)||be,ke.stop=ce>0&&Math.abs(Ce[M]-re[M])>N,V&&(ke.parsed=Ce,ke.raw=O.data[ce]),S&&(ke.options=A||this.resolveDataElementOptions(ce,pe.active?"active":n)),ee||this.updateElement(pe,ce,ke,n),re=Ce}}getMaxOverflow(){const o=this._cachedMeta,a=o.dataset,i=a.options&&a.options.borderWidth||0,n=o.data||[];if(!n.length)return i;const s=n[0].size(this.resolveDataElementOptions(0)),h=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,s,h)/2}draw(){const o=this._cachedMeta;o.dataset.updateControlPoints(this.chart.chartArea,o.iScale.axis),super.draw()}}Ka(UT,"id","line"),Ka(UT,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),Ka(UT,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function t2(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class bP{static override(o){Object.assign(bP.prototype,o)}constructor(o){this.options=o||{}}init(){}formats(){return t2()}parse(){return t2()}format(){return t2()}add(){return t2()}diff(){return t2()}startOf(){return t2()}endOf(){return t2()}}var Dpe={_date:bP};function Tpe(c,o,a,i){const{controller:n,data:s,_sorted:h}=c,v=n._cachedMeta.iScale;if(v&&o===v.axis&&o!=="r"&&h&&s.length){const g=v._reversePixels?nhe:x2;if(i){if(n._sharedOptions){const O=s[0],A=typeof O.getRange=="function"&&O.getRange(o);if(A){const S=g(s,o,a-A),M=g(s,o,a+A);return{lo:S.lo,hi:M.hi}}}}else return g(s,o,a)}return{lo:0,hi:s.length-1}}function CA(c,o,a,i,n){const s=c.getSortedVisibleDatasetMetas(),h=a[o];for(let v=0,g=s.length;v<g;++v){const{index:O,data:A}=s[v],{lo:S,hi:M}=Tpe(s[v],o,h,n);for(let P=S;P<=M;++P){const L=A[P];L.skip||i(L,O,P)}}}function Npe(c){const o=c.indexOf("x")!==-1,a=c.indexOf("y")!==-1;return function(i,n){const s=o?Math.abs(i.x-n.x):0,h=a?Math.abs(i.y-n.y):0;return Math.sqrt(Math.pow(s,2)+Math.pow(h,2))}}function k5(c,o,a,i,n){const s=[];return!n&&!c.isPointInArea(o)||CA(c,a,o,function(v,g,O){!n&&!aA(v,c.chartArea,0)||v.inRange(o.x,o.y,i)&&s.push({element:v,datasetIndex:g,index:O})},!0),s}function Ipe(c,o,a,i){let n=[];function s(h,v,g){const{startAngle:O,endAngle:A}=h.getProps(["startAngle","endAngle"],i),{angle:S}=Qde(h,{x:o.x,y:o.y});uY(S,O,A)&&n.push({element:h,datasetIndex:v,index:g})}return CA(c,a,o,s),n}function Mpe(c,o,a,i,n,s){let h=[];const v=Npe(a);let g=Number.POSITIVE_INFINITY;function O(A,S,M){const P=A.inRange(o.x,o.y,n);if(i&&!P)return;const L=A.getCenterPoint(n);if(!(!!s||c.isPointInArea(L))&&!P)return;const N=v(o,L);N<g?(h=[{element:A,datasetIndex:S,index:M}],g=N):N===g&&h.push({element:A,datasetIndex:S,index:M})}return CA(c,a,o,O),h}function E5(c,o,a,i,n,s){return!s&&!c.isPointInArea(o)?[]:a==="r"&&!i?Ipe(c,o,a,n):Mpe(c,o,a,i,n,s)}function xH(c,o,a,i,n){const s=[],h=a==="x"?"inXRange":"inYRange";let v=!1;return CA(c,a,o,(g,O,A)=>{g[h](o[a],n)&&(s.push({element:g,datasetIndex:O,index:A}),v=v||g.inRange(o.x,o.y,n))}),i&&!v?[]:s}var Fpe={evaluateInteractionItems:CA,modes:{index(c,o,a,i){const n=d2(o,c),s=a.axis||"x",h=a.includeInvisible||!1,v=a.intersect?k5(c,n,s,i,h):E5(c,n,s,!1,i,h),g=[];
vendor: 56,066 bytes, line 9063
9063return v.length?(c.getSortedVisibleDatasetMetas().forEach(O=>{const A=v[0].index,S=O.data[A];S&&!S.skip&&g.push({element:S,datasetIndex:O.index,index:A})}),g):[]},dataset(c,o,a,i){const n=d2(o,c),s=a.axis||"xy",h=a.includeInvisible||!1;let v=a.intersect?k5(c,n,s,i,h):E5(c,n,s,!1,i,h);if(v.length>0){const g=v[0].datasetIndex,O=c.getDatasetMeta(g).data;v=[];for(let A=0;A<O.length;++A)v.push({element:O[A],datasetIndex:g,index:A})}return v},point(c,o,a,i){const n=d2(o,c),s=a.axis||"xy",h=a.includeInvisible||!1;return k5(c,n,s,i,h)},nearest(c,o,a,i){const n=d2(o,c),s=a.axis||"xy",h=a.includeInvisible||!1;return E5(c,n,s,a.intersect,i,h)},x(c,o,a,i){const n=d2(o,c);return xH(c,n,"x",a.intersect,i)},y(c,o,a,i){const n=d2(o,c);return xH(c,n,"y",a.intersect,i)}}};const CY=["left","top","right","bottom"];function KC(c,o){return c.filter(a=>a.pos===o)}function wH(c,o){return c.filter(a=>CY.indexOf(a.pos)===-1&&a.box.axis===o)}function YC(c,o){return c.sort((a,i)=>{const n=o?i:a,s=o?a:i;return n.weight===s.weight?n.index-s.index:n.weight-s.weight})}function Rpe(c){const o=[];let a,i,n,s,h,v;for(a=0,i=(c||[]).length;a<i;++a)n=c[a],{position:s,options:{stack:h,stackWeight:v=1}}=n,o.push({index:a,box:n,pos:s,horizontal:n.isHorizontal(),weight:n.weight,stack:h&&s+h,stackWeight:v});return o}function Bpe(c){const o={};for(const a of c){const{stack:i,pos:n,stackWeight:s}=a;if(!i||!CY.includes(n))continue;const h=o[i]||(o[i]={count:0,placed:0,weight:0,size:0});h.count++,h.weight+=s}return o}function Ppe(c,o){const a=Bpe(c),{vBoxMaxWidth:i,hBoxMaxHeight:n}=o;let s,h,v;for(s=0,h=c.length;s<h;++s){v=c[s];const{fullSize:g}=v.box,O=a[v.stack],A=O&&v.stackWeight/O.weight;v.horizontal?(v.width=A?A*i:g&&o.availableWidth,v.height=n):(v.width=i,v.height=A?A*n:g&&o.availableHeight)}return a}function jpe(c){const o=Rpe(c),a=YC(o.filter(O=>O.box.fullSize),!0),i=YC(KC(o,"left"),!0),n=YC(KC(o,"right")),s=YC(KC(o,"top"),!0),h=YC(KC(o,"bottom")),v=wH(o,"x"),g=wH(o,"y");return{fullSize:a,leftAndTop:i.concat(s),rightAndBottom:n.concat(g).concat(h).concat(v),chartArea:KC(o,"chartArea"),vertical:i.concat(n).concat(g),horizontal:s.concat(h).concat(v)}}function _H(c,o,a,i){return Math.max(c[a],o[a])+Math.max(c[i],o[i])}function SY(c,o){c.top=Math.max(c.top,o.top),c.left=Math.max(c.left,o.left),c.bottom=Math.max(c.bottom,o.bottom),c.right=Math.max(c.right,o.right)}function Lpe(c,o,a,i){const{pos:n,box:s}=a,h=c.maxPadding;if(!Rs(n)){a.size&&(c[n]-=a.size);const S=i[a.stack]||{size:0,count:1};S.size=Math.max(S.size,a.horizontal?s.height:s.width),a.size=S.size/S.count,c[n]+=a.size}s.getPadding&&SY(h,s.getPadding());const v=Math.max(0,o.outerWidth-_H(h,c,"left","right")),g=Math.max(0,o.outerHeight-_H(h,c,"top","bottom")),O=v!==c.w,A=g!==c.h;return c.w=v,c.h=g,a.horizontal?{same:O,other:A}:{same:A,other:O}}function zpe(c){const o=c.maxPadding;function a(i){const n=Math.max(o[i]-c[i],0);return c[i]+=n,n}c.y+=a("top"),c.x+=a("left"),a("right"),a("bottom")}function Upe(c,o){const a=o.maxPadding;function i(n){const s={left:0,top:0,right:0,bottom:0};return n.forEach(h=>{s[h]=Math.max(o[h],a[h])}),s}return i(c?["left","right"]:["top","bottom"])}function xS(c,o,a,i){const n=[];let s,h,v,g,O,A;for(s=0,h=c.length,O=0;s<h;++s){v=c[s],g=v.box,g.update(v.width||o.w,v.height||o.h,Upe(v.horizontal,o));const{same:S,other:M}=Lpe(o,a,v,i);O|=S&&n.length,A=A||M,g.fullSize||n.push(v)}return O&&xS(n,o,a,i)||A}function eT(c,o,a,i,n){c.top=a,c.left=o,c.right=o+i,c.bottom=a+n,c.width=i,c.height=n}function kH(c,o,a,i){const n=a.padding;let{x:s,y:h}=o;for(const v of c){const g=v.box,O=i[v.stack]||{count:1,placed:0,weight:1},A=v.stackWeight/O.weight||1;if(v.horizontal){const S=o.w*A,M=O.size||g.height;jv(O.start)&&(h=O.start),g.fullSize?eT(g,n.left,h,a.outerWidth-n.right-n.left,M):eT(g,o.left+O.placed,h,S,M),O.start=h,O.placed+=S,h=g.bottom}else{const S=o.h*A,M=O.size||g.width;jv(O.start)&&(s=O.start),g.fullSize?eT(g,s,n.top,M,a.outerHeight-n.bottom-n.top):eT(g,s,o.top+O.placed,M,S),O.start=s,O.placed+=S,s=g.right}}o.x=s,o.y=h}var tT={addBox(c,o){c.boxes||(c.boxes=[]),o.fullSize=o.fullSize||!1,o.position=o.position||"top",o.weight=o.weight||0,o._layers=o._layers||function(){return[{z:0,draw(a){o.draw(a)}}]},c.boxes.push(o)},removeBox(c,o){const a=c.boxes?c.boxes.indexOf(o):-1;a!==-1&&c.boxes.splice(a,1)},configure(c,o,a){o.fullSize=a.fullSize,o.position=a.position,o.weight=a.weight},update(c,o,a,i){if(!c)return;const n=xb(c.options.layout.padding),s=Math.max(o-n.width,0),h=Math.max(a-n.height,0),v=jpe(c.boxes),g=v.vertical,O=v.horizontal;Xd(c.boxes,V=>{typeof V.beforeLayout=="function"&&V.beforeLayout()});const A=g.reduce((V,N)=>N.box.options&&N.box.options.display===!1?V:V+1,0)||1,S=Object.freeze({outerWidth:o,outerHeight:a,padding:n,availableWidth:s,availableHeight:h,vBoxMaxWidth:s/2/A,hBoxMaxHeight:h/2}),M=Object.assign({},n);SY(M,xb(i));const P=Object.assign({maxPadding:M,w:s,h,x:n.left,y:n.top},n),L=Ppe(g.concat(O),S);xS(v.fullSize,P,S,L),xS(g,P,S,L),xS(O,P,S,L)&&xS(g,P,S,L),zpe(P),kH(v.leftAndTop,P,S,L),P.x+=P.w,P.y+=P.h,kH(v.rightAndBottom,P,S,L),c.chartArea={left:P.left,top:P.top,right:P.left+P.w,bottom:P.top+P.h,height:P.h,width:P.w},Xd(v.chartArea,V=>{const N=V.box;Object.assign(N,c.chartArea),N.update(P.w,P.h,{left:0,top:0,right:0,bottom:0})})}};class AY{acquireContext(o,a){}releaseContext(o){return!1}addEventListener(o,a,i){}removeEventListener(o,a,i){}getDevicePixelRatio(){return 1}getMaximumSize(o,a,i,n){return a=Math.max(0,a||o.width),i=i||o.height,{width:a,height:Math.max(0,n?Math.floor(a/n):i)}}isAttached(o){return!0}updateConfig(o){}}class Wpe extends AY{acquireContext(o){return o&&o.getContext&&o.getContext("2d")||null}updateConfig(o){o.options.animation=!1}}const WT="$chartjs",Vpe={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},EH=c=>c===null||c==="";function $pe(c,o){const a=c.style,i=c.getAttribute("height"),n=c.getAttribute("width");if(c[WT]={initial:{height:i,width:n,style:{display:a.display,height:a.height,width:a.width}}},a.display=a.display||"block",a.boxSizing=a.boxSizing||"border-box",EH(n)){const s=cH(c,"width");s!==void 0&&(c.width=s)}if(EH(i))if(c.style.height==="")c.height=c.width/(o||2);else{const s=cH(c,"height");s!==void 0&&(c.height=s)}return c}const OY=rpe?{passive:!0}:!1;function Hpe(c,o,a){c.addEventListener(o,a,OY)}function qpe(c,o,a){c.canvas.removeEventListener(o,a,OY)}function Gpe(c,o){const a=Vpe[c.type]||c.type,{x:i,y:n}=d2(c,o);return{type:a,chart:o,native:c,x:i!==void 0?i:null,y:n!==void 0?n:null}}function SN(c,o){for(const a of c)if(a===o||a.contains(o))return!0}function Kpe(c,o,a){const i=c.canvas,n=new MutationObserver(s=>{let h=!1;for(const v of s)h=h||SN(v.addedNodes,i),h=h&&!SN(v.removedNodes,i);h&&a()});return n.observe(document,{childList:!0,subtree:!0}),n}function Ype(c,o,a){const i=c.canvas,n=new MutationObserver(s=>{let h=!1;for(const v of s)h=h||SN(v.removedNodes,i),h=h&&!SN(v.addedNodes,i);h&&a()});return n.observe(document,{childList:!0,subtree:!0}),n}const sA=new Map;let CH=0;function DY(){const c=window.devicePixelRatio;c!==CH&&(CH=c,sA.forEach((o,a)=>{a.currentDevicePixelRatio!==c&&o()}))}function Xpe(c,o){sA.size||window.addEventListener("resize",DY),sA.set(c,o)}function Jpe(c){sA.delete(c),sA.size||window.removeEventListener("resize",DY)}function Qpe(c,o,a){const i=c.canvas,n=i&&yP(i);if(!n)return;const s=fY((v,g)=>{const O=n.clientWidth;a(v,g),O<n.clientWidth&&a()},window),h=new ResizeObserver(v=>{const g=v[0],O=g.contentRect.width,A=g.contentRect.height;O===0&&A===0||s(O,A)});return h.observe(n),Xpe(c,s),h}function C5(c,o,a){a&&a.disconnect(),o==="resize"&&Jpe(c)}function Zpe(c,o,a){const i=c.canvas,n=fY(s=>{c.ctx!==null&&a(Gpe(s,c))},c);return Hpe(i,o,n),n}class eme extends AY{acquireContext(o,a){const i=o&&o.getContext&&o.getContext("2d");return i&&i.canvas===o?($pe(o,a),i):null}releaseContext(o){const a=o.canvas;if(!a[WT])return!1;const i=a[WT].initial;["height","width"].forEach(s=>{const h=i[s];gc(h)?a.removeAttribute(s):a.setAttribute(s,h)});const n=i.style||{};return Object.keys(n).forEach(s=>{a.style[s]=n[s]}),a.width=a.width,delete a[WT],!0}addEventListener(o,a,i){this.removeEventListener(o,a);const n=o.$proxies||(o.$proxies={}),h={attach:Kpe,detach:Ype,resize:Qpe}[a]||Zpe;n[a]=h(o,a,i)}removeEventListener(o,a){const i=o.$proxies||(o.$proxies={}),n=i[a];if(!n)return;({attach:C5,detach:C5,resize:C5}[a]||qpe)(o,a,n),i[a]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(o,a,i,n){return npe(o,a,i,n)}isAttached(o){const a=yP(o);return!!(a&&a.isConnected)}}function tme(c){return!_Y()||typeof OffscreenCanvas<"u"&&c instanceof OffscreenCanvas?Wpe:eme}class Bk{constructor(){Ka(this,"active",!1)}tooltipPosition(o){const{x:a,y:i}=this.getProps(["x","y"],o);return{x:a,y:i}}hasValue(){return oA(this.x)&&oA(this.y)}getProps(o,a){const i=this.$animations;if(!a||!i)return this;const n={};return o.forEach(s=>{n[s]=i[s]&&i[s].active()?i[s]._to:this[s]}),n}}Ka(Bk,"defaults",{}),Ka(Bk,"defaultRoutes");function nme(c,o){const a=c.options.ticks,i=rme(c),n=Math.min(a.maxTicksLimit||i,i),s=a.major.enabled?ome(o):[],h=s.length,v=s[0],g=s[h-1],O=[];if(h>n)return ame(o,O,s,h/n),O;const A=ime(s,o,n);if(h>0){let S,M;const P=h>1?Math.round((g-v)/(h-1)):null;for(nT(o,O,A,gc(P)?0:v-P,v),S=0,M=h-1;S<M;S++)nT(o,O,A,s[S],s[S+1]);return nT(o,O,A,g,gc(P)?o.length:g+P),O}return nT(o,O,A),O}function rme(c){const o=c.options.offset,a=c._tickSize(),i=c._length/a+(o?0:1),n=c._maxLength/a;return Math.floor(Math.min(i,n))}function ime(c,o,a){const i=sme(c),n=o.length/a;if(!i)return Math.max(n,1);const s=Xde(i);for(let h=0,v=s.length-1;h<v;h++){const g=s[h];if(g>n)return g}return Math.max(n,1)}function ome(c){const o=[];let a,i;for(a=0,i=c.length;a<i;a++)c[a].major&&o.push(a);return o}function ame(c,o,a,i){let n=0,s=a[0],h;for(i=Math.ceil(i),h=0;h<c.length;h++)h===s&&(o.push(c[h]),n++,s=a[n*i])}function nT(c,o,a,i,n){const s=hu(i,0),h=Math.min(hu(n,c.length),c.length);let v=0,g,O,A;for(a=Math.ceil(a),n&&(g=n-i,a=g/Math.floor(g/a)),A=s;A<0;)v++,A=Math.round(s+v*a);for(O=Math.max(s,0);O<h;O++)O===A&&(o.push(c[O]),v++,A=Math.round(s+v*a))}function sme(c){const o=c.length;let a,i;if(o<2)return!1;for(i=c[0],a=1;a<o;++a)if(c[a]-c[a-1]!==i)return!1;return i}const ume=c=>c==="left"?"right":c==="right"?"left":c,SH=(c,o,a)=>o==="top"||o==="left"?c[o]+a:c[o]-a,AH=(c,o)=>Math.min(o||c,c);function OH(c,o){const a=[],i=c.length/o,n=c.length;let s=0;for(;s<n;s+=i)a.push(c[Math.floor(s)]);return a}function cme(c,o,a){const i=c.ticks.length,n=Math.min(o,i-1),s=c._startPixel,h=c._endPixel,v=1e-6;let g=c.getPixelForTick(n),O;if(!(a&&(i===1?O=Math.max(g-s,h-g):o===0?O=(c.getPixelForTick(1)-g)/2:O=(g-c.getPixelForTick(n-1))/2,g+=n<o?O:-O,g<s-v||g>h+v)))return g}function lme(c,o){Xd(c,a=>{const i=a.gc,n=i.length/2;let s;if(n>o){for(s=0;s<n;++s)delete a.data[i[s]];i.splice(0,n)}})}function XC(c){return c.drawTicks?c.tickLength:0}function DH(c,o){if(!c.display)return 0;const a=Mk(c.font,o),i=xb(c.padding);return(Xc(c.text)?c.text.length:1)*a.lineHeight+i.height}function fme(c,o){return W2(c,{scale:o,type:"scale"})}function dme(c,o,a){return W2(c,{tick:a,index:o,type:"tick"})}function hme(c,o,a){let i=she(c);return(a&&o!=="right"||!a&&o==="right")&&(i=ume(i)),i}function pme(c,o,a,i){const{top:n,left:s,bottom:h,right:v,chart:g}=c,{chartArea:O,scales:A}=g;let S=0,M,P,L;const V=h-n,N=v-s;if(c.isHorizontal()){if(P=eH(i,s,v),Rs(a)){const ee=Object.keys(a)[0],J=a[ee];L=A[ee].getPixelForValue(J)+V-o}else a==="center"?L=(O.bottom+O.top)/2+V-o:L=SH(c,a,o);M=v-s}else{if(Rs(a)){const ee=Object.keys(a)[0],J=a[ee];P=A[ee].getPixelForValue(J)-N+o}else a==="center"?P=(O.left+O.right)/2-N+o:P=SH(c,a,o);L=eH(i,h,n),S=a==="left"?-Em:Em}return{titleX:P,titleY:L,maxWidth:M,rotation:S}}class Zk extends Bk{constructor(o){super(),this.id=o.id,this.type=o.type,this.options=void 0,this.ctx=o.ctx,this.chart=o.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(o){this.options=o.setContext(this.getContext()),this.axis=o.axis,this._userMin=this.parse(o.min),this._userMax=this.parse(o.max),this._suggestedMin=this.parse(o.suggestedMin),this._suggestedMax=this.parse(o.suggestedMax)}parse(o,a){return o}getUserBounds(){let{_userMin:o,_userMax:a,_suggestedMin:i,_suggestedMax:n}=this;return o=Dg(o,Number.POSITIVE_INFINITY),a=Dg(a,Number.NEGATIVE_INFINITY),i=Dg(i,Number.POSITIVE_INFINITY),n=Dg(n,Number.NEGATIVE_INFINITY),{min:Dg(o,i),max:Dg(a,n),minDefined:mf(o),maxDefined:mf(a)}}getMinMax(o){let{min:a,max:i,minDefined:n,maxDefined:s}=this.getUserBounds(),h;if(n&&s)return{min:a,max:i};const v=this.getMatchingVisibleMetas();for(let g=0,O=v.length;g<O;++g)h=v[g].controller.getMinMax(this,o),n||(a=Math.min(a,h.min)),s||(i=Math.max(i,h.max));return a=s&&a>i?i:a,i=n&&a>i?a:i,{min:Dg(a,Dg(i,a)),max:Dg(i,Dg(a,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const o=this.chart.data;return this.options.labels||(this.isHorizontal()?o.xLabels:o.yLabels)||o.labels||[]}getLabelItems(o=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(o))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Oc(this.options.beforeUpdate,[this])}update(o,a,i){const{beginAtZero:n,grace:s,ticks:h}=this.options,v=h.sampleSize;this.beforeUpdate(),this.maxWidth=o,this.maxHeight=a,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Fhe(this,s,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const g=v<this.ticks.length;this._convertTicksToLabels(g?OH(this.ticks,v):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),h.display&&(h.autoSkip||h.source==="auto")&&(this.ticks=nme(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),g&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let o=this.options.reverse,a,i;this.isHorizontal()?(a=this.left,i=this.right):(a=this.top,i=this.bottom,o=!o),this._startPixel=a,this._endPixel=i,this._reversePixels=o,this._length=i-a,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Oc(this.options.afterUpdate,[this])}beforeSetDimensions(){Oc(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){Oc(this.options.afterSetDimensions,[this])}_callHooks(o){this.chart.notifyPlugins(o,this.getContext()),Oc(this.options[o],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Oc(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(o){const a=this.options.ticks;let i,n,s;for(i=0,n=o.length;i<n;i++)s=o[i],s.label=Oc(a.callback,[s.value,i,o],this)}afterTickToLabelConversion(){Oc(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Oc(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const o=this.options,a=o.ticks,i=AH(this.ticks.length,o.ticks.maxTicksLimit),n=a.minRotation||0,s=a.maxRotation;let h=n,v,g,O;if(!this._isVisible()||!a.display||n>=s||i<=1||!this.isHorizontal()){this.labelRotation=n;return}const A=this._getLabelSizes(),S=A.widest.width,M=A.highest.height,P=pb(this.chart.width-S,0,this.maxWidth);v=o.offset?this.maxWidth/i:P/(i-1),S+6>v&&(v=P/(i-(o.offset?.5:1)),g=this.maxHeight-XC(o.grid)-a.padding-DH(o.title,this.chart.options.font),O=Math.sqrt(S*S+M*M),h=dP(Math.min(Math.asin(pb((A.highest.height+6)/v,-1,1)),Math.asin(pb(g/O,-1,1))-Math.asin(pb(M/O,-1,1)))),h=Math.max(n,Math.min(s,h))),this.labelRotation=h}afterCalculateLabelRotation(){Oc(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Oc(this.options.beforeFit,[this])}fit(){const o={width:0,height:0},{chart:a,options:{ticks:i,title:n,grid:s}}=this,h=this._isVisible(),v=this.isHorizontal();if(h){const g=DH(n,a.options.font);if(v?(o.width=this.maxWidth,o.height=XC(s)+g):(o.height=this.maxHeight,o.width=XC(s)+g),i.display&&this.ticks.length){const{first:O,last:A,widest:S,highest:M}=this._getLabelSizes(),P=i.padding*2,L=Rx(this.labelRotation),V=Math.cos(L),N=Math.sin(L);if(v){const ee=i.mirror?0:N*S.width+V*M.height;o.height=Math.min(this.maxHeight,o.height+ee+P)}else{const ee=i.mirror?0:V*S.width+N*M.height;o.width=Math.min(this.maxWidth,o.width+ee+P)}this._calculatePadding(O,A,N,V)}}this._handleMargins(),v?(this.width=this._length=a.width-this._margins.left-this._margins.right,this.height=o.height):(this.width=o.width,this.height=this._length=a.height-this._margins.top-this._margins.bottom)}_calculatePadding(o,a,i,n){const{ticks:{align:s,padding:h},position:v}=this.options,g=this.labelRotation!==0,O=v!=="top"&&this.axis==="x";if(this.isHorizontal()){const A=this.getPixelForTick(0)-this.left,S=this.right-this.getPixelForTick(this.ticks.length-1);let M=0,P=0;g?O?(M=n*o.width,P=i*a.height):(M=i*o.height,P=n*a.width):s==="start"?P=a.width:s==="end"?M=o.width:s!=="inner"&&(M=o.width/2,P=a.width/2),this.paddingLeft=Math.max((M-A+h)*this.width/(this.width-A),0),this.paddingRight=Math.max((P-S+h)*this.width/(this.width-S),0)}else{let A=a.height/2,S=o.height/2;s==="start"?(A=0,S=o.height):s==="end"&&(A=a.height,S=0),this.paddingTop=A+h,this.paddingBottom=S+h}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){Oc(this.options.afterFit,[this])}isHorizontal(){const{axis:o,position:a}=this.options;return a==="top"||a==="bottom"||o==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(o){this.beforeTickToLabelConversion(),this.generateTickLabels(o);let a,i;for(a=0,i=o.length;a<i;a++)gc(o[a].label)&&(o.splice(a,1),i--,a--);this.afterTickToLabelConversion()}_getLabelSizes(){let o=this._labelSizes;if(!o){const a=this.options.ticks.sampleSize;let i=this.ticks;a<i.length&&(i=OH(i,a)),this._labelSizes=o=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return o}_computeLabelSizes(o,a,i){const{ctx:n,_longestTextCache:s}=this,h=[],v=[],g=Math.floor(a/AH(a,i));let O=0,A=0,S,M,P,L,V,N,ee,J,K,re,ce;for(S=0;S<a;S+=g){if(L=o[S].label,V=this._resolveTickFontOptions(S),n.font=N=V.string,ee=s[N]=s[N]||{data:{},gc:[]},J=V.lineHeight,K=re=0,!gc(L)&&!Xc(L))K=kN(n,ee.data,ee.gc,K,L),re=J;else if(Xc(L))for(M=0,P=L.length;M<P;++M)ce=L[M],!gc(ce)&&!Xc(ce)&&(K=kN(n,ee.data,ee.gc,K,ce),re+=J);h.push(K),v.push(re),O=Math.max(K,O),A=Math.max(re,A)}lme(s,a);const pe=h.indexOf(O),ke=v.indexOf(A),Ce=be=>({width:h[be]||0,height:v[be]||0});return{first:Ce(0),last:Ce(a-1),widest:Ce(pe),highest:Ce(ke),widths:h,heights:v}}getLabelForValue(o){return o}getPixelForValue(o,a){return NaN}getValueForPixel(o){}getPixelForTick(o){const a=this.ticks;return o<0||o>a.length-1?null:this.getPixelForValue(a[o].value)}getPixelForDecimal(o){this._reversePixels&&(o=1-o);const a=this._startPixel+o*this._length;return ehe(this._alignToPixels?e2(this.chart,a,0):a)}getDecimalForPixel(o){const a=(o-this._startPixel)/this._length;return this._reversePixels?1-a:a}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:o,max:a}=this;return o<0&&a<0?a:o>0&&a>0?o:0}getContext(o){const a=this.ticks||[];if(o>=0&&o<a.length){const i=a[o];return i.$context||(i.$context=dme(this.getContext(),o,i))}return this.$context||(this.$context=fme(this.chart.getContext(),this))}_tickSize(){const o=this.options.ticks,a=Rx(this.labelRotation),i=Math.abs(Math.cos(a)),n=Math.abs(Math.sin(a)),s=this._getLabelSizes(),h=o.autoSkipPadding||0,v=s?s.widest.width+h:0,g=s?s.highest.height+h:0;return this.isHorizontal()?g*i>v*n?v/i:g/n:g*n<v*i?g/i:v/n}_isVisible(){const o=this.options.display;return o!=="auto"?!!o:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(o){const a=this.axis,i=this.chart,n=this.options,{grid:s,position:h,border:v}=n,g=s.offset,O=this.isHorizontal(),S=this.ticks.length+(g?1:0),M=XC(s),P=[],L=v.setContext(this.getContext()),V=L.display?L.width:0,N=V/2,ee=function(zt){return e2(i,zt,V)};let J,K,re,ce,pe,ke,Ce,be,$e,ht,Dt,Ut;if(h==="top")J=ee(this.bottom),ke=this.bottom-M,be=J-N,ht=ee(o.top)+N,Ut=o.bottom;else if(h==="bottom")J=ee(this.top),ht=o.top,Ut=ee(o.bottom)-N,ke=J+N,be=this.top+M;else if(h==="left")J=ee(this.right),pe=this.right-M,Ce=J-N,$e=ee(o.left)+N,Dt=o.right;else if(h==="right")J=ee(this.left),$e=o.left,Dt=ee(o.right)-N,pe=J+N,Ce=this.left+M;else if(a==="x"){if(h==="center")J=ee((o.top+o.bottom)/2+.5);else if(Rs(h)){const zt=Object.keys(h)[0],Mt=h[zt];J=ee(this.chart.scales[zt].getPixelForValue(Mt))}ht=o.top,Ut=o.bottom,ke=J+N,be=ke+M}else if(a==="y"){if(h==="center")J=ee((o.left+o.right)/2);else if(Rs(h)){const zt=Object.keys(h)[0],Mt=h[zt];J=ee(this.chart.scales[zt].getPixelForValue(Mt))}pe=J-N,Ce=pe-M,$e=o.left,Dt=o.right}const Ee=hu(n.ticks.maxTicksLimit,S),Ot=Math.max(1,Math.ceil(S/Ee));for(K=0;K<S;K+=Ot){const zt=this.getContext(K),Mt=s.setContext(zt),Ke=v.setContext(zt),Tt=Mt.lineWidth,vt=Mt.color,yt=Ke.dash||[],bt=Ke.dashOffset,Ht=Mt.tickWidth,_t=Mt.tickColor,Ze=Mt.tickBorderDash||[],Vt=Mt.tickBorderDashOffset;re=cme(this,K,g),re!==void 0&&(ce=e2(i,re,Tt),O?pe=Ce=$e=Dt=ce:ke=be=ht=Ut=ce,P.push({tx1:pe,ty1:ke,tx2:Ce,ty2:be,x1:$e,y1:ht,x2:Dt,y2:Ut,width:Tt,color:vt,borderDash:yt,borderDashOffset:bt,tickWidth:Ht,tickColor:_t,tickBorderDash:Ze,tickBorderDashOffset:Vt}))}return this._ticksLength=S,this._borderValue=J,P}_computeLabelItems(o){const a=this.axis,i=this.options,{position:n,ticks:s}=i,h=this.isHorizontal(),v=this.ticks,{align:g,crossAlign:O,padding:A,mirror:S}=s,M=XC(i.grid),P=M+A,L=S?-A:P,V=-Rx(this.labelRotation),N=[];let ee,J,K,re,ce,pe,ke,Ce,be,$e,ht,Dt,Ut="middle";if(n==="top")pe=this.bottom-L,ke=this._getXAxisLabelAlignment();else if(n==="bottom")pe=this.top+L,ke=this._getXAxisLabelAlignment();else if(n==="left"){const Ot=this._getYAxisLabelAlignment(M);ke=Ot.textAlign,ce=Ot.x}else if(n==="right"){const Ot=this._getYAxisLabelAlignment(M);ke=Ot.textAlign,ce=Ot.x}else if(a==="x"){if(n==="center")pe=(o.top+o.bottom)/2+P;else if(Rs(n)){const Ot=Object.keys(n)[0],zt=n[Ot];pe=this.chart.scales[Ot].getPixelForValue(zt)+P}ke=this._getXAxisLabelAlignment()}else if(a==="y"){if(n==="center")ce=(o.left+o.right)/2-P;else if(Rs(n)){const Ot=Object.keys(n)[0],zt=n[Ot];ce=this.chart.scales[Ot].getPixelForValue(zt)}ke=this._getYAxisLabelAlignment(M).textAlign}a==="y"&&(g==="start"?Ut="top":g==="end"&&(Ut="bottom"));const Ee=this._getLabelSizes();for(ee=0,J=v.length;ee<J;++ee){K=v[ee],re=K.label;const Ot=s.setContext(this.getContext(ee));Ce=this.getPixelForTick(ee)+s.labelOffset,be=this._resolveTickFontOptions(ee),$e=be.lineHeight,ht=Xc(re)?re.length:1;const zt=ht/2,Mt=Ot.color,Ke=Ot.textStrokeColor,Tt=Ot.textStrokeWidth;let vt=ke;h?(ce=Ce,ke==="inner"&&(ee===J-1?vt=this.options.reverse?"left":"right":ee===0?vt=this.options.reverse?"right":"left":vt="center"),n==="top"?O==="near"||V!==0?Dt=-ht*$e+$e/2:O==="center"?Dt=-Ee.highest.height/2-zt*$e+$e:Dt=-Ee.highest.height+$e/2:O==="near"||V!==0?Dt=$e/2:O==="center"?Dt=Ee.highest.height/2-zt*$e:Dt=Ee.highest.height-ht*$e,S&&(Dt*=-1),V!==0&&!Ot.showLabelBackdrop&&(ce+=$e/2*Math.sin(V))):(pe=Ce,Dt=(1-ht)*$e/2);let yt;if(Ot.showLabelBackdrop){const bt=xb(Ot.backdropPadding),Ht=Ee.heights[ee],_t=Ee.widths[ee];let Ze=Dt-bt.top,Vt=0-bt.left;switch(Ut){case"middle":Ze-=Ht/2;break;case"bottom":Ze-=Ht;break}switch(ke){case"center":Vt-=_t/2;break;case"right":Vt-=_t;break}yt={left:Vt,top:Ze,width:_t+bt.width,height:Ht+bt.height,color:Ot.backdropColor}}N.push({label:re,font:be,textOffset:Dt,options:{rotation:V,color:Mt,strokeColor:Ke,strokeWidth:Tt,textAlign:vt,textBaseline:Ut,translation:[ce,pe],backdrop:yt}})}return N}_getXAxisLabelAlignment(){const{position:o,ticks:a}=this.options;if(-Rx(this.labelRotation))return o==="top"?"left":"right";let n="center";return a.align==="start"?n="left":a.align==="end"?n="right":a.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(o){const{position:a,ticks:{crossAlign:i,mirror:n,padding:s}}=this.options,h=this._getLabelSizes(),v=o+s,g=h.widest.width;let O,A;return a==="left"?n?(A=this.right+s,i==="near"?O="left":i==="center"?(O="center",A+=g/2):(O="right",A+=g)):(A=this.right-v,i==="near"?O="right":i==="center"?(O="center",A-=g/2):(O="left",A=this.left)):a==="right"?n?(A=this.left+s,i==="near"?O="right":i==="center"?(O="center",A-=g/2):(O="left",A-=g)):(A=this.left+v,i==="near"?O="left":i==="center"?(O="center",A+=g/2):(O="right",A=this.right)):O="right",{textAlign:O,x:A}}_computeLabelArea(){if(this.options.ticks.mirror)return;const o=this.chart,a=this.options.position;if(a==="left"||a==="right")return{top:0,left:this.left,bottom:o.height,right:this.right};if(a==="top"||a==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:o.width}}drawBackground(){const{ctx:o,options:{backgroundColor:a},left:i,top:n,width:s,height:h}=this;a&&(o.save(),o.fillStyle=a,o.fillRect(i,n,s,h),o.restore())}getLineWidthForValue(o){const a=this.options.grid;if(!this._isVisible()||!a.display)return 0;const n=this.ticks.findIndex(s=>s.value===o);return n>=0?a.setContext(this.getContext(n)).lineWidth:0}drawGrid(o){const a=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(o));let s,h;const v=(g,O,A)=>{!A.width||!A.color||(i.save(),i.lineWidth=A.width,i.strokeStyle=A.color,i.setLineDash(A.borderDash||[]),i.lineDashOffset=A.borderDashOffset,i.beginPath(),i.moveTo(g.x,g.y),i.lineTo(O.x,O.y),i.stroke(),i.restore())};if(a.display)for(s=0,h=n.length;s<h;++s){const g=n[s];a.drawOnChartArea&&v({x:g.x1,y:g.y1},{x:g.x2,y:g.y2},g),a.drawTicks&&v({x:g.tx1,y:g.ty1},{x:g.tx2,y:g.ty2},{color:g.tickColor,width:g.tickWidth,borderDash:g.tickBorderDash,borderDashOffset:g.tickBorderDashOffset})}}drawBorder(){const{chart:o,ctx:a,options:{border:i,grid:n}}=this,s=i.setContext(this.getContext()),h=i.display?s.width:0;if(!h)return;const v=n.setContext(this.getContext(0)).lineWidth,g=this._borderValue;let O,A,S,M;this.isHorizontal()?(O=e2(o,this.left,h)-h/2,A=e2(o,this.right,v)+v/2,S=M=g):(S=e2(o,this.top,h)-h/2,M=e2(o,this.bottom,v)+v/2,O=A=g),a.save(),a.lineWidth=s.width,a.strokeStyle=s.color,a.beginPath(),a.moveTo(O,S),a.lineTo(A,M),a.stroke(),a.restore()}drawLabels(o){if(!this.options.ticks.display)return;const i=this.ctx,n=this._computeLabelArea();n&&pY(i,n);const s=this.getLabelItems(o);for(const h of s){const v=h.options,g=h.font,O=h.label,A=h.textOffset;EN(i,O,0,A,g,v)}n&&mY(i)}drawTitle(){const{ctx:o,options:{position:a,title:i,reverse:n}}=this;if(!i.display)return;const s=Mk(i.font),h=xb(i.padding),v=i.align;let g=s.lineHeight/2;a==="bottom"||a==="center"||Rs(a)?(g+=h.bottom,Xc(i.text)&&(g+=s.lineHeight*(i.text.length-1))):g+=h.top;const{titleX:O,titleY:A,maxWidth:S,rotation:M}=pme(this,g,a,v);EN(o,i.text,0,0,s,{color:i.color,maxWidth:S,rotation:M,textAlign:hme(v,a,n),textBaseline:"middle",translation:[O,A]})}draw(o){this._isVisible()&&(this.drawBackground(),this.drawGrid(o),this.drawBorder(),this.drawTitle(),this.drawLabels(o))}_layers(){const o=this.options,a=o.ticks&&o.ticks.z||0,i=hu(o.grid&&o.grid.z,-1),n=hu(o.border&&o.border.z,0);return!this._isVisible()||this.draw!==Zk.prototype.draw?[{z:a,draw:s=>{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:a,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(o){const a=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let s,h;for(s=0,h=a.length;s<h;++s){const v=a[s];v[i]===this.id&&(!o||v.type===o)&&n.push(v)}return n}_resolveTickFontOptions(o){const a=this.options.ticks.setContext(this.getContext(o));return Mk(a.font)}_maxDigits(){const o=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/o}}class rT{constructor(o,a,i){this.type=o,this.scope=a,this.override=i,this.items=Object.create(null)}isForType(o){return Object.prototype.isPrototypeOf.call(this.type.prototype,o.prototype)}register(o){const a=Object.getPrototypeOf(o);let i;vme(a)&&(i=this.register(a));const n=this.items,s=o.id,h=this.scope+"."+s;if(!s)throw new Error("class does not have id: "+o);return s in n||(n[s]=o,mme(o,h,i),this.override&&ml.override(o.id,o.overrides)),h}get(o){return this.items[o]}unregister(o){const a=this.items,i=o.id,n=this.scope;i in a&&delete a[i],n&&i in ml[n]&&(delete ml[n][i],this.override&&delete R2[i])}}function mme(c,o,a){const i=iA(Object.create(null),[a?ml.get(a):{},ml.get(o),c.defaults]);ml.set(o,i),c.defaultRoutes&&gme(o,c.defaultRoutes),c.descriptors&&ml.describe(o,c.descriptors)}function gme(c,o){Object.keys(o).forEach(a=>{const i=a.split("."),n=i.pop(),s=[c].concat(i).join("."),h=o[a].split("."),v=h.pop(),g=h.join(".");ml.route(s,n,g,v)})}function vme(c){return"id"in c&&"defaults"in c}class yme{constructor(){this.controllers=new rT(LS,"datasets",!0),this.elements=new rT(Bk,"elements"),this.plugins=new rT(Object,"plugins"),this.scales=new rT(Zk,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...o){this._each("register",o)}remove(...o){this._each("unregister",o)}addControllers(...o){this._each("register",o,this.controllers)}addElements(...o){this._each("register",o,this.elements)}addPlugins(...o){this._each("register",o,this.plugins)}addScales(...o){this._each("register",o,this.scales)}getController(o){return this._get(o,this.controllers,"controller")}getElement(o){return this._get(o,this.elements,"element")}getPlugin(o){return this._get(o,this.plugins,"plugin")}getScale(o){return this._get(o,this.scales,"scale")}removeControllers(...o){this._each("unregister",o,this.controllers)}removeElements(...o){this._each("unregister",o,this.elements)}removePlugins(...o){this._each("unregister",o,this.plugins)}removeScales(...o){this._each("unregister",o,this.scales)}_each(o,a,i){[...a].forEach(n=>{const s=i||this._getRegistryForType(n);i||s.isForType(n)||s===this.plugins&&n.id?this._exec(o,s,n):Xd(n,h=>{const v=i||this._getRegistryForType(h);this._exec(o,v,h)})})}_exec(o,a,i){const n=fP(o);Oc(i["before"+n],[],i),a[o](i),Oc(i["after"+n],[],i)}_getRegistryForType(o){for(let a=0;a<this._typedRegistries.length;a++){const i=this._typedRegistries[a];if(i.isForType(o))return i}return this.plugins}_get(o,a,i){const n=a.get(o);if(n===void 0)throw new Error('"'+o+'" is not a registered '+i+".");return n}}var r1=new yme;class bme{constructor(){this._init=[]}notify(o,a,i,n){a==="beforeInit"&&(this._init=this._createDescriptors(o,!0),this._notify(this._init,o,"install"));const s=n?this._descriptors(o).filter(n):this._descriptors(o),h=this._notify(s,o,a,i);return a==="afterDestroy"&&(this._notify(s,o,"stop"),this._notify(this._init,o,"uninstall")),h}_notify(o,a,i,n){n=n||{};for(const s of o){const h=s.plugin,v=h[i],g=[a,n,s.options];if(Oc(v,g,h)===!1&&n.cancelable)return!1}return!0}invalidate(){gc(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(o){if(this._cache)return this._cache;const a=this._cache=this._createDescriptors(o);return this._notifyStateChanges(o),a}_createDescriptors(o,a){const i=o&&o.config,n=hu(i.options&&i.options.plugins,{}),s=xme(i);return n===!1&&!a?[]:_me(o,s,n,a)}_notifyStateChanges(o){const a=this._oldCache||[],i=this._cache,n=(s,h)=>s.filter(v=>!h.some(g=>v.plugin.id===g.plugin.id));this._notify(n(a,i),o,"stop"),this._notify(n(i,a),o,"start")}}function xme(c){const o={},a=[],i=Object.keys(r1.plugins.items);for(let s=0;s<i.length;s++)a.push(r1.getPlugin(i[s]));const n=c.plugins||[];for(let s=0;s<n.length;s++){const h=n[s];a.indexOf(h)===-1&&(a.push(h),o[h.id]=!0)}return{plugins:a,localIds:o}}function wme(c,o){return!o&&c===!1?null:c===!0?{}:c}function _me(c,{plugins:o,localIds:a},i,n){const s=[],h=c.getContext();for(const v of o){const g=v.id,O=wme(i[g],n);O!==null&&s.push({plugin:v,options:kme(c.config,{plugin:v,local:a[g]},O,h)})}return s}function kme(c,{plugin:o,local:a},i,n){const s=c.pluginScopeKeys(o),h=c.getOptionScopes(i,s);return a&&o.defaults&&h.push(o.defaults),c.createResolver(h,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function I6(c,o){const a=ml.datasets[c]||{};return((o.datasets||{})[c]||{}).indexAxis||o.indexAxis||a.indexAxis||"x"}function Eme(c,o){let a=c;return c==="_index_"?a=o:c==="_value_"&&(a=o==="x"?"y":"x"),a}function Cme(c,o){return c===o?"_index_":"_value_"}function Sme(c){if(c==="top"||c==="bottom")return"x";if(c==="left"||c==="right")return"y"}function AN(c,o){if(c==="x"||c==="y"||c==="r"||(c=o.axis||Sme(o.position)||c.length>1&&AN(c[0].toLowerCase(),o),c))return c;throw new Error(`Cannot determine type of '${name}' axis. Please provide 'axis' or 'position' option.`)}function Ame(c,o){const a=R2[c.type]||{scales:{}},i=o.scales||{},n=I6(c.type,o),s=Object.create(null);return Object.keys(i).forEach(h=>{const v=i[h];if(!Rs(v))return console.error(`Invalid scale configuration for scale: ${h}`);if(v._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${h}`);const g=AN(h,v),O=Cme(g,n),A=a.scales||{};s[h]=RS(Object.create(null),[{axis:g},v,A[g],A[O]])}),c.data.datasets.forEach(h=>{const v=h.type||c.type,g=h.indexAxis||I6(v,o),A=(R2[v]||{}).scales||{};Object.keys(A).forEach(S=>{const M=Eme(S,g),P=h[M+"AxisID"]||M;s[P]=s[P]||Object.create(null),RS(s[P],[{axis:M},i[P],A[S]])})}),Object.keys(s).forEach(h=>{const v=s[h];RS(v,[ml.scales[v.type],ml.scale])}),s}function TY(c){const o=c.options||(c.options={});o.plugins=hu(o.plugins,{}),o.scales=Ame(c,o)}function NY(c){return c=c||{},c.datasets=c.datasets||[],c.labels=c.labels||[],c}function Ome(c){return c=c||{},c.data=NY(c.data),TY(c),c}const TH=new Map,IY=new Set;function iT(c,o){let a=TH.get(c);return a||(a=o(),TH.set(c,a),IY.add(a)),a}const JC=(c,o,a)=>{const i=wN(o,a);i!==void 0&&c.add(i)};class Dme{constructor(o){this._config=Ome(o),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(o){this._config.type=o}get data(){return this._config.data}set data(o){this._config.data=NY(o)}get options(){return this._config.options}set options(o){this._config.options=o}get plugins(){return this._config.plugins}update(){const o=this._config;this.clearCache(),TY(o)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(o){return iT(o,()=>[[`datasets.${o}`,""]])}datasetAnimationScopeKeys(o,a){return iT(`${o}.transition.${a}`,()=>[[`datasets.${o}.transitions.${a}`,`transitions.${a}`],[`datasets.${o}`,""]])}datasetElementScopeKeys(o,a){return iT(`${o}-${a}`,()=>[[`datasets.${o}.elements.${a}`,`datasets.${o}`,`elements.${a}`,""]])}pluginScopeKeys(o){const a=o.id,i=this.type;return iT(`${i}-plugin-${a}`,()=>[[`plugins.${a}`,...o.additionalOptionScopes||[]]])}_cachedScopes(o,a){const i=this._scopeCache;let n=i.get(o);return(!n||a)&&(n=new Map,i.set(o,n)),n}getOptionScopes(o,a,i){const{options:n,type:s}=this,h=this._cachedScopes(o,i),v=h.get(a);if(v)return v;const g=new Set;a.forEach(A=>{o&&(g.add(o),A.forEach(S=>JC(g,o,S))),A.forEach(S=>JC(g,n,S)),A.forEach(S=>JC(g,R2[s]||{},S)),A.forEach(S=>JC(g,ml,S)),A.forEach(S=>JC(g,N6,S))});const O=Array.from(g);return O.length===0&&O.push(Object.create(null)),IY.has(a)&&h.set(a,O),O}chartOptionScopes(){const{options:o,type:a}=this;return[o,R2[a]||{},ml.datasets[a]||{},{type:a},ml,N6]}resolveNamedOptions(o,a,i,n=[""]){const s={$shared:!0},{resolver:h,subPrefixes:v}=NH(this._resolverCache,o,n);let g=h;if(Nme(h,a)){s.$shared=!1,i=tw(i)?i():i;const O=this.createResolver(o,i,v);g=Fk(h,i,O)}for(const O of a)s[O]=g[O];return s}createResolver(o,a,i=[""],n){const{resolver:s}=NH(this._resolverCache,o,i);return Rs(a)?Fk(s,a,void 0,n):s}}function NH(c,o,a){let i=c.get(o);i||(i=new Map,c.set(o,i));const n=a.join();let s=i.get(n);return s||(s={resolver:mP(o,a),subPrefixes:a.filter(v=>!v.toLowerCase().includes("hover"))},i.set(n,s)),s}const Tme=c=>Rs(c)&&Object.getOwnPropertyNames(c).reduce((o,a)=>o||tw(c[a]),!1);function Nme(c,o){const{isScriptable:a,isIndexable:i}=vY(c);for(const n of o){const s=a(n),h=i(n),v=(h||s)&&c[n];if(s&&(tw(v)||Tme(v))||h&&Xc(v))return!0}return!1}var Ime="4.2.1";const Mme=["top","bottom","left","right","chartArea"];function IH(c,o){return c==="top"||c==="bottom"||Mme.indexOf(c)===-1&&o==="x"}function MH(c,o){return function(a,i){return a[c]===i[c]?a[o]-i[o]:a[c]-i[c]}}function FH(c){const o=c.chart,a=o.options.animation;o.notifyPlugins("afterRender"),Oc(a&&a.onComplete,[c],o)}function Fme(c){const o=c.chart,a=o.options.animation;Oc(a&&a.onProgress,[c],o)}function MY(c){return _Y()&&typeof c=="string"?c=document.getElementById(c):c&&c.length&&(c=c[0]),c&&c.canvas&&(c=c.canvas),c}const VT={},RH=c=>{const o=MY(c);return Object.values(VT).filter(a=>a.canvas===o).pop()};function Rme(c,o,a){const i=Object.keys(c);for(const n of i){const s=+n;if(s>=o){const h=c[n];delete c[n],(a>0||s>o)&&(c[s+a]=h)}}}function Bme(c,o,a,i){return!a||c.type==="mouseout"?null:i?o:c}function Pme(c){const{xScale:o,yScale:a}=c;if(o&&a)return{left:o.left,right:o.right,top:a.top,bottom:a.bottom}}class cb{static register(...o){r1.add(...o),BH()}static unregister(...o){r1.remove(...o),BH()}constructor(o,a){const i=this.config=new Dme(a),n=MY(o),s=RH(n);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const h=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||tme(n)),this.platform.updateConfig(i);const v=this.platform.acquireContext(n,h.aspectRatio),g=v&&v.canvas,O=g&&g.height,A=g&&g.width;if(this.id=Ude(),this.ctx=v,this.canvas=g,this.width=A,this.height=O,this._options=h,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new bme,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ahe(S=>this.update(S),h.resizeDelay||0),this._dataChanges=[],VT[this.id]=this,!v||!g){console.error("Failed to create chart: can't acquire context from the given item");return}ab.listen(this,"complete",FH),ab.listen(this,"progress",Fme),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:o,maintainAspectRatio:a},width:i,height:n,_aspectRatio:s}=this;return gc(o)?a&&s?s:n?i/n:null:o}get data(){return this.config.data}set data(o){this.config.data=o}get options(){return this._options}set options(o){this.config.options=o}get registry(){return r1}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():uH(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return oH(this.canvas,this.ctx),this}stop(){return ab.stop(this),this}resize(o,a){ab.running(this)?this._resizeBeforeDraw={width:o,height:a}:this._resize(o,a)}_resize(o,a){const i=this.options,n=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,h=this.platform.getMaximumSize(n,o,a,s),v=i.devicePixelRatio||this.platform.getDevicePixelRatio(),g=this.width?"resize":"attach";this.width=h.width,this.height=h.height,this._aspectRatio=this.aspectRatio,uH(this,v,!0)&&(this.notifyPlugins("resize",{size:h}),Oc(i.onResize,[this,h],this),this.attached&&this._doResize(g)&&this.render())}ensureScalesHaveIDs(){const a=this.options.scales||{};Xd(a,(i,n)=>{i.id=n})}buildOrUpdateScales(){const o=this.options,a=o.scales,i=this.scales,n=Object.keys(i).reduce((h,v)=>(h[v]=!1,h),{});let s=[];a&&(s=s.concat(Object.keys(a).map(h=>{const v=a[h],g=AN(h,v),O=g==="r",A=g==="x";return{options:v,dposition:O?"chartArea":A?"bottom":"left",dtype:O?"radialLinear":A?"category":"linear"}}))),Xd(s,h=>{const v=h.options,g=v.id,O=AN(g,v),A=hu(v.type,h.dtype);(v.position===void 0||IH(v.position,O)!==IH(h.dposition))&&(v.position=h.dposition),n[g]=!0;let S=null;if(g in i&&i[g].type===A)S=i[g];else{const M=r1.getScale(A);S=new M({id:g,type:A,ctx:this.ctx,chart:this}),i[S.id]=S}S.init(v,o)}),Xd(n,(h,v)=>{h||delete i[v]}),Xd(i,h=>{tT.configure(this,h,h.options),tT.addBox(this,h)})}_updateMetasets(){const o=this._metasets,a=this.data.datasets.length,i=o.length;if(o.sort((n,s)=>n.index-s.index),i>a){for(let n=a;n<i;++n)this._destroyDatasetMeta(n);o.splice(a,i-a)}this._sortedMetasets=o.slice(0).sort(MH("order","index"))}_removeUnreferencedMetasets(){const{_metasets:o,data:{datasets:a}}=this;o.length>a.length&&delete this._stacks,o.forEach((i,n)=>{a.filter(s=>s===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const o=[],a=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=a.length;i<n;i++){const s=a[i];let h=this.getDatasetMeta(i);const v=s.type||this.config.type;if(h.type&&h.type!==v&&(this._destroyDatasetMeta(i),h=this.getDatasetMeta(i)),h.type=v,h.indexAxis=s.indexAxis||I6(v,this.options),h.order=s.order||0,h.index=i,h.label=""+s.label,h.visible=this.isDatasetVisible(i),h.controller)h.controller.updateIndex(i),h.controller.linkScales();else{const g=r1.getController(v),{datasetElementType:O,dataElementType:A}=ml.datasets[v];Object.assign(g,{dataElementType:r1.getElement(A),datasetElementType:O&&r1.getElement(O)}),h.controller=new g(this,i),o.push(h.controller)}}return this._updateMetasets(),o}_resetElements(){Xd(this.data.datasets,(o,a)=>{this.getDatasetMeta(a).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(o){const a=this.config;a.update();const i=this._options=a.createResolver(a.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:o,cancelable:!0})===!1)return;const s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let h=0;for(let O=0,A=this.data.datasets.length;O<A;O++){const{controller:S}=this.getDatasetMeta(O),M=!n&&s.indexOf(S)===-1;S.buildOrUpdateElements(M),h=Math.max(+S.getMaxOverflow(),h)}h=this._minPadding=i.layout.autoPadding?h:0,this._updateLayout(h),n||Xd(s,O=>{O.reset()}),this._updateDatasets(o),this.notifyPlugins("afterUpdate",{mode:o}),this._layers.sort(MH("z","_idx"));const{_active:v,_lastEvent:g}=this;g?this._eventHandler(g,!0):v.length&&this._updateHoverStyles(v,v,!0),this.render()}_updateScales(){Xd(this.scales,o=>{tT.removeBox(this,o)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const o=this.options,a=new Set(Object.keys(this._listeners)),i=new Set(o.events);(!K$(a,i)||!!this._responsiveListeners!==o.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:o}=this,a=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:s}of a){const h=i==="_removeElements"?-s:s;Rme(o,n,h)}}_getUniformDataChanges(){const o=this._dataChanges;if(!o||!o.length)return;this._dataChanges=[];const a=this.data.datasets.length,i=s=>new Set(o.filter(h=>h[0]===s).map((h,v)=>v+","+h.splice(1).join(","))),n=i(0);for(let s=1;s<a;s++)if(!K$(n,i(s)))return;return Array.from(n).map(s=>s.split(",")).map(s=>({method:s[1],start:+s[2],count:+s[3]}))}_updateLayout(o){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;tT.update(this,this.width,this.height,o);const a=this.chartArea,i=a.width<=0||a.height<=0;this._layers=[],Xd(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,s)=>{n._idx=s}),this.notifyPlugins("afterLayout")}_updateDatasets(o){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:o,cancelable:!0})!==!1){for(let a=0,i=this.data.datasets.length;a<i;++a)this.getDatasetMeta(a).controller.configure();for(let a=0,i=this.data.datasets.length;a<i;++a)this._updateDataset(a,tw(o)?o({datasetIndex:a}):o);this.notifyPlugins("afterDatasetsUpdate",{mode:o})}}_updateDataset(o,a){const i=this.getDatasetMeta(o),n={meta:i,index:o,mode:a,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",n)!==!1&&(i.controller._update(a),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(ab.has(this)?this.attached&&!ab.running(this)&&ab.start(this):(this.draw(),FH({chart:this})))}draw(){let o;if(this._resizeBeforeDraw){const{width:i,height:n}=this._resizeBeforeDraw;this._resize(i,n),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const a=this._layers;for(o=0;o<a.length&&a[o].z<=0;++o)a[o].draw(this.chartArea);for(this._drawDatasets();o<a.length;++o)a[o].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(o){const a=this._sortedMetasets,i=[];let n,s;for(n=0,s=a.length;n<s;++n){const h=a[n];(!o||h.visible)&&i.push(h)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const o=this.getSortedVisibleDatasetMetas();for(let a=o.length-1;a>=0;--a)this._drawDataset(o[a]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(o){const a=this.ctx,i=o._clip,n=!i.disabled,s=Pme(o)||this.chartArea,h={meta:o,index:o.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",h)!==!1&&(n&&pY(a,{left:i.left===!1?0:s.left-i.left,right:i.right===!1?this.width:s.right+i.right,top:i.top===!1?0:s.top-i.top,bottom:i.bottom===!1?this.height:s.bottom+i.bottom}),o.controller.draw(),n&&mY(a),h.cancelable=!1,this.notifyPlugins("afterDatasetDraw",h))}isPointInArea(o){return aA(o,this.chartArea,this._minPadding)}getElementsAtEventForMode(o,a,i,n){const s=Fpe.modes[a];return typeof s=="function"?s(this,o,i,n):[]}getDatasetMeta(o){const a=this.data.datasets[o],i=this._metasets;let n=i.filter(s=>s&&s._dataset===a).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:a&&a.order||0,index:o,_dataset:a,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=W2(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(o){const a=this.data.datasets[o];if(!a)return!1;const i=this.getDatasetMeta(o);return typeof i.hidden=="boolean"?!i.hidden:!a.hidden}setDatasetVisibility(o,a){const i=this.getDatasetMeta(o);i.hidden=!a}toggleDataVisibility(o){this._hiddenIndices[o]=!this._hiddenIndices[o]}getDataVisibility(o){return!this._hiddenIndices[o]}_updateVisibility(o,a,i){const n=i?"show":"hide",s=this.getDatasetMeta(o),h=s.controller._resolveAnimations(void 0,n);jv(a)?(s.data[a].hidden=!i,this.update()):(this.setDatasetVisibility(o,i),h.update(s,{visible:i}),this.update(v=>v.datasetIndex===o?n:void 0))}hide(o,a){this._updateVisibility(o,a,!1)}show(o,a){this._updateVisibility(o,a,!0)}_destroyDatasetMeta(o){const a=this._metasets[o];a&&a.controller&&a.controller._destroy(),delete this._metasets[o]}_stop(){let o,a;for(this.stop(),ab.remove(this),o=0,a=this.data.datasets.length;o<a;++o)this._destroyDatasetMeta(o)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:o,ctx:a}=this;this._stop(),this.config.clearCache(),o&&(this.unbindEvents(),oH(o,a),this.platform.releaseContext(a),this.canvas=null,this.ctx=null),delete VT[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...o){return this.canvas.toDataURL(...o)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const o=this._listeners,a=this.platform,i=(s,h)=>{a.addEventListener(this,s,h),o[s]=h},n=(s,h,v)=>{s.offsetX=h,s.offsetY=v,this._eventHandler(s)};Xd(this.options.events,s=>i(s,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const o=this._responsiveListeners,a=this.platform,i=(g,O)=>{a.addEventListener(this,g,O),o[g]=O},n=(g,O)=>{o[g]&&(a.removeEventListener(this,g,O),delete o[g])},s=(g,O)=>{this.canvas&&this.resize(g,O)};let h;const v=()=>{n("attach",v),this.attached=!0,this.resize(),i("resize",s),i("detach",h)};h=()=>{this.attached=!1,n("resize",s),this._stop(),this._resize(0,0),i("attach",v)},a.isAttached(this.canvas)?v():h()}unbindEvents(){Xd(this._listeners,(o,a)=>{this.platform.removeEventListener(this,a,o)}),this._listeners={},Xd(this._responsiveListeners,(o,a)=>{this.platform.removeEventListener(this,a,o)}),this._responsiveListeners=void 0}updateHoverStyle(o,a,i){const n=i?"set":"remove";let s,h,v,g;for(a==="dataset"&&(s=this.getDatasetMeta(o[0].datasetIndex),s.controller["_"+n+"DatasetHoverStyle"]()),v=0,g=o.length;v<g;++v){h=o[v];const O=h&&this.getDatasetMeta(h.datasetIndex).controller;O&&O[n+"HoverStyle"](h.element,h.datasetIndex,h.index)}}getActiveElements(){return this._active||[]}setActiveElements(o){const a=this._active||[],i=o.map(({datasetIndex:s,index:h})=>{const v=this.getDatasetMeta(s);if(!v)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:v.data[h],index:h}});!q$(i,a)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,a))}notifyPlugins(o,a,i){return this._plugins.notify(this,o,a,i)}isPluginEnabled(o){return this._plugins._cache.filter(a=>a.plugin.id===o).length===1}_updateHoverStyles(o,a,i){const n=this.options.hover,s=(g,O)=>g.filter(A=>!O.some(S=>A.datasetIndex===S.datasetIndex&&A.index===S.index)),h=s(a,o),v=i?o:s(o,a);h.length&&this.updateHoverStyle(h,n.mode,!1),v.length&&n.mode&&this.updateHoverStyle(v,n.mode,!0)}_eventHandler(o,a){const i={event:o,replay:a,cancelable:!0,inChartArea:this.isPointInArea(o)},n=h=>(h.options.events||this.options.events).includes(o.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;const s=this._handleEvent(o,a,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(s||i.changed)&&this.render(),this}_handleEvent(o,a,i){const{_active:n=[],options:s}=this,h=a,v=this._getActiveElements(o,n,i,h),g=Gde(o),O=Bme(o,this._lastEvent,i,g);i&&(this._lastEvent=null,Oc(s.onHover,[o,v,this],this),g&&Oc(s.onClick,[o,v,this],this));const A=!q$(v,n);return(A||a)&&(this._active=v,this._updateHoverStyles(v,n,a)),this._lastEvent=O,A}_getActiveElements(o,a,i,n){if(o.type==="mouseout")return[];if(!i)return a;const s=this.options.hover;return this.getElementsAtEventForMode(o,s.mode,s,n)}}Ka(cb,"defaults",ml),Ka(cb,"instances",VT),Ka(cb,"overrides",R2),Ka(cb,"registry",r1),Ka(cb,"version",Ime),Ka(cb,"getChart",RH);function BH(){return Xd(cb.instances,c=>c._plugins.invalidate())}function FY(c,o,a=o){c.lineCap=hu(a.borderCapStyle,o.borderCapStyle),c.setLineDash(hu(a.borderDash,o.borderDash)),c.lineDashOffset=hu(a.borderDashOffset,o.borderDashOffset),c.lineJoin=hu(a.borderJoinStyle,o.borderJoinStyle),c.lineWidth=hu(a.borderWidth,o.borderWidth),c.strokeStyle=hu(a.borderColor,o.borderColor)}function jme(c,o,a){c.lineTo(a.x,a.y)}function Lme(c){return c.stepped?_he:c.tension||c.cubicInterpolationMode==="monotone"?khe:jme}function RY(c,o,a={}){const i=c.length,{start:n=0,end:s=i-1}=a,{start:h,end:v}=o,g=Math.max(n,h),O=Math.min(s,v),A=n<h&&s<h||n>v&&s>v;return{count:i,start:g,loop:o.loop,ilen:O<g&&!A?i+O-g:O-g}}function zme(c,o,a,i){const{points:n,options:s}=o,{count:h,start:v,loop:g,ilen:O}=RY(n,a,i),A=Lme(s);let{move:S=!0,reverse:M}=i||{},P,L,V;for(P=0;P<=O;++P)L=n[(v+(M?O-P:P))%h],!L.skip&&(S?(c.moveTo(L.x,L.y),S=!1):A(c,V,L,M,s.stepped),V=L);return g&&(L=n[(v+(M?O:0))%h],A(c,V,L,M,s.stepped)),!!g}function Ume(c,o,a,i){const n=o.points,{count:s,start:h,ilen:v}=RY(n,a,i),{move:g=!0,reverse:O}=i||{};let A=0,S=0,M,P,L,V,N,ee;const J=re=>(h+(O?v-re:re))%s,K=()=>{V!==N&&(c.lineTo(A,N),c.lineTo(A,V),c.lineTo(A,ee))};for(g&&(P=n[J(0)],c.moveTo(P.x,P.y)),M=0;M<=v;++M){if(P=n[J(M)],P.skip)continue;const re=P.x,ce=P.y,pe=re|0;pe===L?(ce<V?V=ce:ce>N&&(N=ce),A=(S*A+re)/++S):(K(),c.lineTo(re,ce),L=pe,S=0,V=N=ce),ee=ce}K()}function M6(c){const o=c.options,a=o.borderDash&&o.borderDash.length;return!c._decimated&&!c._loop&&!o.tension&&o.cubicInterpolationMode!=="monotone"&&!o.stepped&&!a?Ume:zme}function Wme(c){return c.stepped?ipe:c.tension||c.cubicInterpolationMode==="monotone"?ope:h2}function Vme(c,o,a,i){let n=o._path;n||(n=o._path=new Path2D,o.path(n,a,i)&&n.closePath()),FY(c,o.options),c.stroke(n)}function $me(c,o,a,i){const{segments:n,options:s}=o,h=M6(o);for(const v of n)FY(c,s,v.style),c.beginPath(),h(c,o,v,{start:a,end:a+i-1})&&c.closePath(),c.stroke()}const Hme=typeof Path2D=="function";function qme(c,o,a,i){Hme&&!o.options.segment?Vme(c,o,a,i):$me(c,o,a,i)}class wS extends Bk{constructor(o){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,o&&Object.assign(this,o)}updateControlPoints(o,a){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;Xhe(this._points,i,o,n,a),this._pointsUpdated=!0}}set points(o){this._points=o,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=fpe(this,this.options.segment))}first(){const o=this.segments,a=this.points;return o.length&&a[o[0].start]}last(){const o=this.segments,a=this.points,i=o.length;return i&&a[o[i-1].end]}interpolate(o,a){const i=this.options,n=o[a],s=this.points,h=upe(this,{property:a,start:n,end:n});if(!h.length)return;const v=[],g=Wme(i);let O,A;for(O=0,A=h.length;O<A;++O){const{start:S,end:M}=h[O],P=s[S],L=s[M];if(P===L){v.push(P);continue}const V=Math.abs((n-P[a])/(L[a]-P[a])),N=g(P,L,V,i.stepped);N[a]=o[a],v.push(N)}return v.length===1?v[0]:v}pathSegment(o,a,i){return M6(this)(o,this,a,i)}path(o,a,i){const n=this.segments,s=M6(this);let h=this._loop;a=a||0,i=i||this.points.length-a;for(const v of n)h&=s(o,this,v,{start:a,end:a+i-1});return!!h}draw(o,a,i,n){const s=this.options||{};
vendor: 8,798 bytes, line 9063
9063(this.points||[]).length&&s.borderWidth&&(o.save(),qme(o,this,i,n),o.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}Ka(wS,"id","line"),Ka(wS,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),Ka(wS,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),Ka(wS,"descriptors",{_scriptable:!0,_indexable:o=>o!=="borderDash"&&o!=="fill"});function PH(c,o,a,i){const n=c.options,{[a]:s}=c.getProps([a],i);return Math.abs(o-s)<n.radius+n.hitRadius}class $T extends Bk{constructor(o){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,o&&Object.assign(this,o)}inRange(o,a,i){const n=this.options,{x:s,y:h}=this.getProps(["x","y"],i);return Math.pow(o-s,2)+Math.pow(a-h,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(o,a){return PH(this,o,"x",a)}inYRange(o,a){return PH(this,o,"y",a)}getCenterPoint(o){const{x:a,y:i}=this.getProps(["x","y"],o);return{x:a,y:i}}size(o){o=o||this.options||{};let a=o.radius||0;a=Math.max(a,a&&o.hoverRadius||0);const i=a&&o.borderWidth||0;return(a+i)*2}draw(o,a){const i=this.options;this.skip||i.radius<.1||!aA(this,a,this.size(i)/2)||(o.strokeStyle=i.borderColor,o.lineWidth=i.borderWidth,o.fillStyle=i.backgroundColor,xhe(o,i,this.x,this.y))}getRange(){const o=this.options||{};return o.radius+o.hitRadius}}Ka($T,"id","point"),Ka($T,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),Ka($T,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Gme(c,o){const a=[],{bounds:n,step:s,min:h,max:v,precision:g,count:O,maxTicks:A,maxDigits:S,includeBounds:M}=c,P=s||1,L=A-1,{min:V,max:N}=o,ee=!gc(h),J=!gc(v),K=!gc(O),re=(N-V)/(S+1);let ce=X$((N-V)/L/P)*P,pe,ke,Ce,be;if(ce<1e-14&&!ee&&!J)return[{value:V},{value:N}];be=Math.ceil(N/ce)-Math.floor(V/ce),be>L&&(ce=X$(be*ce/L/P)*P),gc(g)||(pe=Math.pow(10,g),ce=Math.ceil(ce*pe)/pe),n==="ticks"?(ke=Math.floor(V/ce)*ce,Ce=Math.ceil(N/ce)*ce):(ke=V,Ce=N),ee&&J&&s&&Jde((v-h)/s,ce/1e3)?(be=Math.round(Math.min((v-h)/ce,A)),ce=(v-h)/be,ke=h,Ce=v):K?(ke=ee?h:ke,Ce=J?v:Ce,be=O-1,ce=(Ce-ke)/be):(be=(Ce-ke)/ce,BS(be,Math.round(be),ce/1e3)?be=Math.round(be):be=Math.ceil(be));const $e=Math.max(J$(ce),J$(ke));pe=Math.pow(10,gc(g)?$e:g),ke=Math.round(ke*pe)/pe,Ce=Math.round(Ce*pe)/pe;let ht=0;for(ee&&(M&&ke!==h?(a.push({value:h}),ke<h&&ht++,BS(Math.round((ke+ht*ce)*pe)/pe,h,jH(h,re,c))&&ht++):ke<h&&ht++);ht<be;++ht)a.push({value:Math.round((ke+ht*ce)*pe)/pe});return J&&M&&Ce!==v?a.length&&BS(a[a.length-1].value,v,jH(v,re,c))?a[a.length-1].value=v:a.push({value:v}):(!J||Ce===v)&&a.push({value:Ce}),a}function jH(c,o,{horizontal:a,minRotation:i}){const n=Rx(i),s=(a?Math.sin(n):Math.cos(n))||.001,h=.75*o*(""+c).length;return Math.min(o/s,h)}class ON extends Zk{constructor(o){super(o),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(o,a){return gc(o)||(typeof o=="number"||o instanceof Number)&&!isFinite(+o)?null:+o}handleTickRangeOptions(){const{beginAtZero:o}=this.options,{minDefined:a,maxDefined:i}=this.getUserBounds();let{min:n,max:s}=this;const h=g=>n=a?n:g,v=g=>s=i?s:g;if(o){const g=Ik(n),O=Ik(s);g<0&&O<0?v(0):g>0&&O>0&&h(0)}if(n===s){let g=s===0?1:Math.abs(s*.05);v(s+g),o||h(n-g)}this.min=n,this.max=s}getTickLimit(){const o=this.options.ticks;let{maxTicksLimit:a,stepSize:i}=o,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),a=a||11),a&&(n=Math.min(a,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const o=this.options,a=o.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n={maxTicks:i,bounds:o.bounds,min:o.min,max:o.max,precision:a.precision,step:a.stepSize,count:a.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:a.minRotation||0,includeBounds:a.includeBounds!==!1},s=this._range||this,h=Gme(n,s);return o.bounds==="ticks"&&sY(h,this,"value"),o.reverse?(h.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),h}configure(){const o=this.ticks;let a=this.min,i=this.max;if(super.configure(),this.options.offset&&o.length){const n=(i-a)/Math.max(o.length-1,1)/2;a-=n,i+=n}this._startValue=a,this._endValue=i,this._valueRange=i-a}getLabelForValue(o){return pP(o,this.chart.options.locale,this.options.ticks.format)}}class F6 extends ON{determineDataLimits(){const{min:o,max:a}=this.getMinMax(!0);this.min=mf(o)?o:0,this.max=mf(a)?a:1,this.handleTickRangeOptions()}computeTickLimit(){const o=this.isHorizontal(),a=o?this.width:this.height,i=Rx(this.options.ticks.minRotation),n=(o?Math.sin(i):Math.cos(i))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(a/Math.min(40,s.lineHeight/n))}getPixelForValue(o){return o===null?NaN:this.getPixelForDecimal((o-this._startValue)/this._valueRange)}getValueForPixel(o){return this._startValue+this.getDecimalForPixel(o)*this._valueRange}}Ka(F6,"id","linear"),Ka(F6,"defaults",{ticks:{callback:p4.formatters.numeric}});const uA=c=>Math.floor(Fx(c)),n2=(c,o)=>Math.pow(10,uA(c)+o);function LH(c){return c/Math.pow(10,uA(c))===1}function zH(c,o,a){const i=Math.pow(10,a),n=Math.floor(c/i);return Math.ceil(o/i)-n}function Kme(c,o){const a=o-c;let i=uA(a);for(;zH(c,o,i)>10;)i++;for(;zH(c,o,i)<10;)i--;return Math.min(i,uA(c))}function Yme(c,{min:o,max:a}){o=Dg(c.min,o);const i=[],n=uA(o);let s=Kme(o,a),h=s<0?Math.pow(10,Math.abs(s)):1;const v=Math.pow(10,s),g=n>s?Math.pow(10,n):0,O=Math.round((o-g)*h)/h,A=Math.floor((o-g)/v/10)*v*10;let S=Math.floor((O-A)/Math.pow(10,s)),M=Dg(c.min,Math.round((g+A+S*Math.pow(10,s))*h)/h);for(;M<a;)i.push({value:M,major:LH(M),significand:S}),S>=10?S=S<15?15:20:S++,S>=20&&(s++,S=2,h=s>=0?1:h),M=Math.round((g+A+S*Math.pow(10,s))*h)/h;const P=Dg(c.max,M);return i.push({value:P,major:LH(P),significand:S}),i}class UH extends Zk{constructor(o){super(o),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(o,a){const i=ON.prototype.parse.apply(this,[o,a]);if(i===0){this._zero=!0;return}return mf(i)&&i>0?i:null}determineDataLimits(){const{min:o,max:a}=this.getMinMax(!0);this.min=mf(o)?Math.max(0,o):null,this.max=mf(a)?Math.max(0,a):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!mf(this._userMin)&&(this.min=o===n2(this.min,0)?n2(this.min,-1):n2(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:o,maxDefined:a}=this.getUserBounds();let i=this.min,n=this.max;const s=v=>i=o?i:v,h=v=>n=a?n:v;i===n&&(i<=0?(s(1),h(10)):(s(n2(i,-1)),h(n2(n,1)))),i<=0&&s(n2(n,-1)),n<=0&&h(n2(i,1)),this.min=i,this.max=n}buildTicks(){const o=this.options,a={min:this._userMin,max:this._userMax},i=Yme(a,this);return o.bounds==="ticks"&&sY(i,this,"value"),o.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(o){return o===void 0?"0":pP(o,this.chart.options.locale,this.options.ticks.format)}configure(){const o=this.min;super.configure(),this._startValue=Fx(o),this._valueRange=Fx(this.max)-Fx(o)}getPixelForValue(o){return(o===void 0||o===0)&&(o=this.min),o===null||isNaN(o)?NaN:this.getPixelForDecimal(o===this.min?0:(Fx(o)-this._startValue)/this._valueRange)}getValueForPixel(o){const a=this.getDecimalForPixel(o);return Math.pow(10,this._startValue+a*this._valueRange)}}Ka(UH,"id","logarithmic"),Ka(UH,"defaults",{ticks:{callback:p4.formatters.logarithmic,major:{enabled:!0}}});function R6(c){const o=c.ticks;if(o.display&&c.display){const a=xb(o.backdropPadding);return hu(o.font&&o.font.size,ml.font.size)+a.height}return 0}function Xme(c,o,a){return a=Xc(a)?a:[a],{w:bhe(c,o.string,a),h:a.length*o.lineHeight}}function WH(c,o,a,i,n){return c===i||c===n?{start:o-a/2,end:o+a/2}:c<i||c>n?{start:o-a,end:o}:{start:o,end:o+a}}function Jme(c){const o={l:c.left+c._padding.left,r:c.right-c._padding.right,t:c.top+c._padding.top,b:c.bottom-c._padding.bottom},a=Object.assign({},o),i=[],n=[],s=c._pointLabels.length,h=c.options.pointLabels,v=h.centerPointLabels?td/s:0;for(let g=0;g<s;g++){const O=h.setContext(c.getPointLabelContext(g));n[g]=O.padding;const A=c.getPointPosition(g,c.drawingArea+n[g],v),S=Mk(O.font),M=Xme(c.ctx,S,c._pointLabels[g]);i[g]=M;const P=Mv(c.getIndexAngle(g)+v),L=Math.round(dP(P)),V=WH(L,A.x,M.w,0,180),N=WH(L,A.y,M.h,90,270);Qme(a,o,P,V,N)}c.setCenterPoint(o.l-a.l,a.r-o.r,o.t-a.t,a.b-o.b),c._pointLabelItems=Zme(c,i,n)}function Qme(c,o,a,i,n){const s=Math.abs(Math.sin(a)),h=Math.abs(Math.cos(a));let v=0,g=0;
vendor: 10,626 bytes, line 9063
9063i.start<o.l?(v=(o.l-i.start)/s,c.l=Math.min(c.l,o.l-v)):i.end>o.r&&(v=(i.end-o.r)/s,c.r=Math.max(c.r,o.r+v)),n.start<o.t?(g=(o.t-n.start)/h,c.t=Math.min(c.t,o.t-g)):n.end>o.b&&(g=(n.end-o.b)/h,c.b=Math.max(c.b,o.b+g))}function Zme(c,o,a){const i=[],n=c._pointLabels.length,s=c.options,h=R6(s)/2,v=c.drawingArea,g=s.pointLabels.centerPointLabels?td/n:0;for(let O=0;O<n;O++){const A=c.getPointPosition(O,v+h+a[O],g),S=Math.round(dP(Mv(A.angle+Em))),M=o[O],P=nge(A.y,M.h,S),L=ege(S),V=tge(A.x,M.w,L);i.push({x:A.x,y:P,textAlign:L,left:V,top:P,right:V+M.w,bottom:P+M.h})}return i}function ege(c){return c===0||c===180?"center":c<180?"left":"right"}function tge(c,o,a){return a==="right"?c-=o:a==="center"&&(c-=o/2),c}function nge(c,o,a){return a===90||a===270?c-=o/2:(a>270||a<90)&&(c-=o),c}function rge(c,o){const{ctx:a,options:{pointLabels:i}}=c;for(let n=o-1;n>=0;n--){const s=i.setContext(c.getPointLabelContext(n)),h=Mk(s.font),{x:v,y:g,textAlign:O,left:A,top:S,right:M,bottom:P}=c._pointLabelItems[n],{backdropColor:L}=s;if(!gc(L)){const V=Mhe(s.borderRadius),N=xb(s.backdropPadding);a.fillStyle=L;const ee=A-N.left,J=S-N.top,K=M-A+N.width,re=P-S+N.height;Object.values(V).some(ce=>ce!==0)?(a.beginPath(),Ahe(a,{x:ee,y:J,w:K,h:re,radius:V}),a.fill()):a.fillRect(ee,J,K,re)}EN(a,c._pointLabels[n],v,g+h.lineHeight/2,h,{color:s.color,textAlign:O,textBaseline:"middle"})}}function BY(c,o,a,i){const{ctx:n}=c;if(a)n.arc(c.xCenter,c.yCenter,o,0,T0);else{let s=c.getPointPosition(0,o);n.moveTo(s.x,s.y);for(let h=1;h<i;h++)s=c.getPointPosition(h,o),n.lineTo(s.x,s.y)}}function ige(c,o,a,i,n){const s=c.ctx,h=o.circular,{color:v,lineWidth:g}=o;!h&&!i||!v||!g||a<0||(s.save(),s.strokeStyle=v,s.lineWidth=g,s.setLineDash(n.dash),s.lineDashOffset=n.dashOffset,s.beginPath(),BY(c,a,h,i),s.closePath(),s.stroke(),s.restore())}function oge(c,o,a){return W2(c,{label:a,index:o,type:"pointLabel"})}class oT extends ON{constructor(o){super(o),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const o=this._padding=xb(R6(this.options)/2),a=this.width=this.maxWidth-o.width,i=this.height=this.maxHeight-o.height;this.xCenter=Math.floor(this.left+a/2+o.left),this.yCenter=Math.floor(this.top+i/2+o.top),this.drawingArea=Math.floor(Math.min(a,i)/2)}determineDataLimits(){const{min:o,max:a}=this.getMinMax(!1);this.min=mf(o)&&!isNaN(o)?o:0,this.max=mf(a)&&!isNaN(a)?a:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/R6(this.options))}generateTickLabels(o){ON.prototype.generateTickLabels.call(this,o),this._pointLabels=this.getLabels().map((a,i)=>{const n=Oc(this.options.pointLabels.callback,[a,i],this);return n||n===0?n:""}).filter((a,i)=>this.chart.getDataVisibility(i))}fit(){const o=this.options;o.display&&o.pointLabels.display?Jme(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(o,a,i,n){this.xCenter+=Math.floor((o-a)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(o,a,i,n))}getIndexAngle(o){const a=T0/(this._pointLabels.length||1),i=this.options.startAngle||0;return Mv(o*a+Rx(i))}getDistanceFromCenterForValue(o){if(gc(o))return NaN;const a=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-o)*a:(o-this.min)*a}getValueForDistanceFromCenter(o){if(gc(o))return NaN;const a=o/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-a:this.min+a}getPointLabelContext(o){const a=this._pointLabels||[];if(o>=0&&o<a.length){const i=a[o];return oge(this.getContext(),o,i)}}getPointPosition(o,a,i=0){const n=this.getIndexAngle(o)-Em+i;return{x:Math.cos(n)*a+this.xCenter,y:Math.sin(n)*a+this.yCenter,angle:n}}getPointPositionForValue(o,a){return this.getPointPosition(o,this.getDistanceFromCenterForValue(a))}getBasePosition(o){return this.getPointPositionForValue(o||0,this.getBaseValue())}getPointLabelPosition(o){const{left:a,top:i,right:n,bottom:s}=this._pointLabelItems[o];return{left:a,top:i,right:n,bottom:s}}drawBackground(){const{backgroundColor:o,grid:{circular:a}}=this.options;if(o){const i=this.ctx;i.save(),i.beginPath(),BY(this,this.getDistanceFromCenterForValue(this._endValue),a,this._pointLabels.length),i.closePath(),i.fillStyle=o,i.fill(),i.restore()}}drawGrid(){const o=this.ctx,a=this.options,{angleLines:i,grid:n,border:s}=a,h=this._pointLabels.length;let v,g,O;if(a.pointLabels.display&&rge(this,h),n.display&&this.ticks.forEach((A,S)=>{if(S!==0){g=this.getDistanceFromCenterForValue(A.value);const M=this.getContext(S),P=n.setContext(M),L=s.setContext(M);ige(this,P,g,h,L)}}),i.display){for(o.save(),v=h-1;v>=0;v--){const A=i.setContext(this.getPointLabelContext(v)),{color:S,lineWidth:M}=A;!M||!S||(o.lineWidth=M,o.strokeStyle=S,o.setLineDash(A.borderDash),o.lineDashOffset=A.borderDashOffset,g=this.getDistanceFromCenterForValue(a.ticks.reverse?this.min:this.max),O=this.getPointPosition(v,g),o.beginPath(),o.moveTo(this.xCenter,this.yCenter),o.lineTo(O.x,O.y),o.stroke())}o.restore()}}drawBorder(){}drawLabels(){const o=this.ctx,a=this.options,i=a.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let s,h;o.save(),o.translate(this.xCenter,this.yCenter),o.rotate(n),o.textAlign="center",o.textBaseline="middle",this.ticks.forEach((v,g)=>{if(g===0&&!a.reverse)return;const O=i.setContext(this.getContext(g)),A=Mk(O.font);if(s=this.getDistanceFromCenterForValue(this.ticks[g].value),O.showLabelBackdrop){o.font=A.string,h=o.measureText(v.label).width,o.fillStyle=O.backdropColor;const S=xb(O.backdropPadding);o.fillRect(-h/2-S.left,-s-A.size/2-S.top,h+S.width,A.size+S.height)}EN(o,v.label,0,-s,A,{color:O.color})}),o.restore()}drawTitle(){}}Ka(oT,"id","radialLinear"),Ka(oT,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:p4.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(o){return o},padding:5,centerPointLabels:!1}}),Ka(oT,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),Ka(oT,"descriptors",{angleLines:{_fallback:"grid"}});const g4={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},km=Object.keys(g4);function age(c,o){return c-o}function VH(c,o){if(gc(o))return null;const a=c._adapter,{parser:i,round:n,isoWeekday:s}=c._parseOpts;let h=o;return typeof i=="function"&&(h=i(h)),mf(h)||(h=typeof i=="string"?a.parse(h,i):a.parse(h)),h===null?null:(n&&(h=n==="week"&&(oA(s)||s===!0)?a.startOf(h,"isoWeek",s):a.startOf(h,n)),+h)}function $H(c,o,a,i){const n=km.length;for(let s=km.indexOf(c);s<n-1;++s){const h=g4[km[s]],v=h.steps?h.steps:Number.MAX_SAFE_INTEGER;if(h.common&&Math.ceil((a-o)/(v*h.size))<=i)return km[s]}return km[n-1]}function sge(c,o,a,i,n){for(let s=km.length-1;s>=km.indexOf(a);s--){const h=km[s];if(g4[h].common&&c._adapter.diff(n,i,h)>=o-1)return h}return km[a?km.indexOf(a):0]}function uge(c){for(let o=km.indexOf(c)+1,a=km.length;o<a;++o)if(g4[km[o]].common)return km[o]}function HH(c,o,a){if(!a)c[o]=!0;else if(a.length){const{lo:i,hi:n}=hP(a,o),s=a[i]>=o?a[i]:a[n];c[s]=!0}}function cge(c,o,a,i){const n=c._adapter,s=+n.startOf(o[0].value,i),h=o[o.length-1].value;let v,g;for(v=s;v<=h;v=+n.add(v,1,i))g=a[v],g>=0&&(o[g].major=!0);return o}function qH(c,o,a){const i=[],n={},s=o.length;let h,v;for(h=0;h<s;++h)v=o[h],n[v]=h,i.push({value:v,major:!1});return s===0||!a?i:cge(c,i,n,a)}class DN extends Zk{constructor(o){super(o),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(o,a={}){const i=o.time||(o.time={}),n=this._adapter=new Dpe._date(o.adapters.date);n.init(a),RS(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(o),this._normalized=a.normalized}parse(o,a){return o===void 0?null:VH(this,o)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const o=this.options,a=this._adapter,i=o.time.unit||"day";let{min:n,max:s,minDefined:h,maxDefined:v}=this.getUserBounds();function g(O){!h&&!isNaN(O.min)&&(n=Math.min(n,O.min)),!v&&!isNaN(O.max)&&(s=Math.max(s,O.max))}(!h||!v)&&(g(this._getLabelBounds()),(o.bounds!=="ticks"||o.ticks.source!=="labels")&&g(this.getMinMax(!1))),n=mf(n)&&!isNaN(n)?n:+a.startOf(Date.now(),i),s=mf(s)&&!isNaN(s)?s:+a.endOf(Date.now(),i)+1,this.min=Math.min(n,s-1),this.max=Math.max(n+1,s)}_getLabelBounds(){const o=this.getLabelTimestamps();let a=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return o.length&&(a=o[0],i=o[o.length-1]),{min:a,max:i}}buildTicks(){const o=this.options,a=o.time,i=o.ticks,n=i.source==="labels"?this.getLabelTimestamps():this._generate();o.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const s=this.min,h=this.max,v=rhe(n,s,h);return this._unit=a.unit||(i.autoSkip?$H(a.minUnit,this.min,this.max,this._getLabelCapacity(s)):sge(this,v.length,a.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:uge(this._unit),this.initOffsets(n),o.reverse&&v.reverse(),qH(this,v,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(o=>+o.value))}initOffsets(o=[]){let a=0,i=0,n,s;this.options.offset&&o.length&&(n=this.getDecimalForValue(o[0]),o.length===1?a=1-n:a=(this.getDecimalForValue(o[1])-n)/2,s=this.getDecimalForValue(o[o.length-1]),o.length===1?i=s:i=(s-this.getDecimalForValue(o[o.length-2]))/2);const h=o.length<3?.5:.25;a=pb(a,0,h),i=pb(i,0,h),this._offsets={start:a,end:i,factor:1/(a+1+i)}}_generate(){const o=this._adapter,a=this.min,i=this.max,n=this.options,s=n.time,h=s.unit||$H(s.minUnit,a,i,this._getLabelCapacity(a)),v=hu(n.ticks.stepSize,1),g=h==="week"?s.isoWeekday:!1,O=oA(g)||g===!0,A={};let S=a,M,P;if(O&&(S=+o.startOf(S,"isoWeek",g)),S=+o.startOf(S,O?"day":h),o.diff(i,a,h)>1e5*v)throw new Error(a+" and "+i+" are too far apart with stepSize of "+v+" "+h);const L=n.ticks.source==="data"&&this.getDataTimestamps();for(M=S,P=0;M<i;M=+o.add(M,v,h),P++)HH(A,M,L);return(M===i||n.bounds==="ticks"||P===1)&&HH(A,M,L),Object.keys(A).sort((V,N)=>V-N).map(V=>+V)}getLabelForValue(o){const a=this._adapter,i=this.options.time;
9063return i.tooltipFormat?a.format(o,i.tooltipFormat):a.format(o,i.displayFormats.datetime)}format(o,a){const n=this.options.time.displayFormats,s=this._unit,h=a||n[s];return this._adapter.format(o,h)}_tickFormatFunction(o,a,i,n){const s=this.options,h=s.ticks.callback;if(h)return Oc(h,[o,a,i],this);const v=s.time.displayFormats,g=this._unit,O=this._majorUnit,A=g&&v[g],S=O&&v[O],M=i[a],P=O&&S&&M&&M.major;return this._adapter.format(o,n||(P?S:A))}generateTickLabels(o){let a,i,n;for(a=0,i=o.length;a<i;++a)n=o[a],n.label=this._tickFormatFunction(n.value,a,o)}getDecimalForValue(o){return o===null?NaN:(o-this.min)/(this.max-this.min)}getPixelForValue(o){const a=this._offsets,i=this.getDecimalForValue(o);return this.getPixelForDecimal((a.start+i)*a.factor)}getValueForPixel(o){const a=this._offsets,i=this.getDecimalForPixel(o)/a.factor-a.end;return this.min+i*(this.max-this.min)}_getLabelSize(o){const a=this.options.ticks,i=this.ctx.measureText(o).width,n=Rx(this.isHorizontal()?a.maxRotation:a.minRotation),s=Math.cos(n),h=Math.sin(n),v=this._resolveTickFontOptions(0).size;return{w:i*s+v*h,h:i*h+v*s}}_getLabelCapacity(o){const a=this.options.time,i=a.displayFormats,n=i[a.unit]||i.millisecond,s=this._tickFormatFunction(o,0,qH(this,[o],this._majorUnit),n),h=this._getLabelSize(s),v=Math.floor(this.isHorizontal()?this.width/h.w:this.height/h.h)-1;return v>0?v:1}getDataTimestamps(){let o=this._cache.data||[],a,i;if(o.length)return o;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(a=0,i=n.length;a<i;++a)o=o.concat(n[a].controller.getAllParsedValues(this));return this._cache.data=this.normalize(o)}getLabelTimestamps(){const o=this._cache.labels||[];let a,i;if(o.length)return o;const n=this.getLabels();for(a=0,i=n.length;a<i;++a)o.push(VH(this,n[a]));return this._cache.labels=this._normalized?o:this.normalize(o)}normalize(o){return ohe(o.sort(age))}}Ka(DN,"id","time"),Ka(DN,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function aT(c,o,a){let i=0,n=c.length-1,s,h,v,g;a?(o>=c[i].pos&&o<=c[n].pos&&({lo:i,hi:n}=x2(c,"pos",o)),{pos:s,time:v}=c[i],{pos:h,time:g}=c[n]):(o>=c[i].time&&o<=c[n].time&&({lo:i,hi:n}=x2(c,"time",o)),{time:s,pos:v}=c[i],{time:h,pos:g}=c[n]);const O=h-s;return O?v+(g-v)*(o-s)/O:v}class GH extends DN{constructor(o){super(o),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const o=this._getTimestampsForTable(),a=this._table=this.buildLookupTable(o);this._minPos=aT(a,this.min),this._tableRange=aT(a,this.max)-this._minPos,super.initOffsets(o)}buildLookupTable(o){const{min:a,max:i}=this,n=[],s=[];let h,v,g,O,A;for(h=0,v=o.length;h<v;++h)O=o[h],O>=a&&O<=i&&n.push(O);if(n.length<2)return[{time:a,pos:0},{time:i,pos:1}];for(h=0,v=n.length;h<v;++h)A=n[h+1],g=n[h-1],O=n[h],Math.round((A+g)/2)!==O&&s.push({time:O,pos:h/(v-1)});return s}_getTimestampsForTable(){let o=this._cache.all||[];if(o.length)return o;const a=this.getDataTimestamps(),i=this.getLabelTimestamps();return a.length&&i.length?o=this.normalize(a.concat(i)):o=a.length?a:i,o=this._cache.all=o,o}getDecimalForValue(o){return(aT(this._table,o)-this._minPos)/this._tableRange}getValueForPixel(o){const a=this._offsets,i=this.getDecimalForPixel(o)/a.factor-a.end;return aT(this._table,i*this._tableRange+this._minPos,!0)}}Ka(GH,"id","timeseries"),Ka(GH,"defaults",DN.defaults);function lge(c){let o;return{c(){o=an("canvas"),Qt(o,"id","myChart")},m(a,i){_r(a,o,i),c[2](o)},p:Fi,i:Fi,o:Fi,d(a){a&&br(o),c[2](null)}}}function fge(c,o,a){let{config:i}=o,n;Zx(()=>{var h;cb.register([F6,UT,$T,wS]),new cb((h=n.getContext("2d"))!==null&&h!==void 0?h:new HTMLCanvasElement,i)});function s(h){l1[h?"unshift":"push"](()=>{n=h,a(0,n)})}return c.$$set=h=>{"config"in h&&a(1,i=h.config)},[n,i,s]}class dge extends $o{constructor(o){super(),Vo(this,o,fge,lge,jo,{config:1})}}function hge(c){let o,a;return o=new dge({props:{config:c[0]()}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p:Fi,i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function pge(c,o,a){let{data:i}=o;function n(){const s=[],h=[],v=[];for(let g=1;g<i.x.length;g++)s.push({x:g,y:i.x[g-1]}),h.push({x:g,y:i.y[g-1]}),v.push({x:g,y:i.z[g-1]});return{type:"line",data:{datasets:[{label:"x",borderColor:"red",borderWidth:1,radius:0,data:s},{label:"y",borderColor:"green",borderWidth:1,radius:0,data:h},{label:"z",borderColor:"blue",borderWidth:1,radius:0,data:v}]},options:{responsive:!0,maintainAspectRatio:!1,interaction:{intersect:!1}
9063,plugins:{legend:{display:!1}},scales:{x:{type:"linear",min:0,max:i.x.length,grid:{color:"#f3f3f3"},ticks:{display:!1}},y:{type:"linear",min:-2.5,max:2.5,grid:{color:"#f3f3f3"},ticks:{display:!1}}}}}}return c.$$set=s=>{"data"in s&&a(1,i=s.data)},[n,i]}class mge extends $o{constructor(o){super(),Vo(this,o,pge,hge,jo,{data:1})}}function gge(c){let o,a,i,n,s,h,v,g,O,A,S,M,P,L,V,N;return P=new mge({props:{data:c[0].data}}),{c(){o=an("main"),a=an("div"),i=an("div"),s=or(),h=an("div"),v=an("button"),g=an("div"),O=an("i"),A=or(),S=an("i"),M=or(),xi(P.$$.fragment),Qt(i,"class",n="absolute h-26 w-40 transition ease "+(c[1]?"bg-white duration-500":"bg-transparent")),Qt(a,"class","relative"),Qt(O,"class","z-1 absolute fas fa-circle fa-lg text-white"),Qt(S,"class","z-2 absolute far fa-times-circle fa-lg transition ease cursor-pointer text-light-800 hover:text-black"),Qt(g,"class","relative"),Qt(v,"class","absolute -left-2.8px -top-6px outline-none"),Qt(h,"class","relative"),Qt(o,"class","h-26 w-40 pr-3 pt-1 bg-white")},m(ee,J){_r(ee,o,J),ft(o,a),ft(a,i),ft(o,s),ft(o,h),ft(h,v),ft(v,g),ft(g,O),ft(g,A),ft(g,S),ft(o,M),gi(P,o,null),L=!0,V||(N=sa(S,"click",c[2]),V=!0)},p(ee,[J]){(!L||J&2&&n!==(n="absolute h-26 w-40 transition ease "+(ee[1]?"bg-white duration-500":"bg-transparent")))&&Qt(i,"class",n);const K={};J&1&&(K.data=ee[0].data),P.$set(K)},i(ee){L||(hr(P.$$.fragment,ee),L=!0)},o(ee){Cr(P.$$.fragment,ee),L=!1},d(ee){ee&&br(o),vi(P),V=!1,N()}}}function vge(c,o,a){let{recording:i}=o,{onDelete:n}=o,s=!1;function h(){s||(a(1,s=!0),setTimeout(()=>{a(1,s=!1),n(i)},450))}return c.$$set=v=>{"recording"in v&&a(0,i=v.recording),"onDelete"in v&&a(3,n=v.onDelete)},[i,s,h,n]}class yge extends $o{constructor(o){super(),Vo(this,o,vge,gge,jo,{recording:0,onDelete:3})}}function KH(c,o,a){const i=c.slice();return i[18]=o[a],i}function bge(c){let o,a,i,n,s,h,v;return n=new vl({props:{onClick:c[7],stopPropagation:!0,small:!0,outlined:!0,fillOnHover:!0,$$slots:{default:[wge]},$$scope:{ctx:c}}}),{c(){o=an("div"),a=an("div"),a.innerHTML='<i class="w-full h-full m-0 mt-4 p-2 fas fa-check fa-2x text-[#63BFC2] transition ease "></i>',i=or(),xi(n.$$.fragment),Qt(a,"class","w-full text-center"),Qt(o,"class","border selected text-center border-solid border-gray-200 mb-2 p-2 bg-white shadow-xl rounded-xl w-35 h-30 ml-2 mr-2 cursor-pointer svelte-1t19zhc")},m(g,O){_r(g,o,O),ft(o,a),ft(o,i),gi(n,o,null),s=!0,h||(v=sa(o,"click",c[9]),h=!0)},p(g,O){const A={};O&2097156&&(A.$$scope={dirty:O,ctx:g}),n.$set(A)},i(g){s||(hr(n.$$.fragment,g),s=!0)},o(g){Cr(n.$$.fragment,g),s=!1},d(g){g&&br(o),vi(n),h=!1,v()}}}
9063function xge(c){let o,a,i,n,s=c[2]("content.data.addData")+"",h,v,g;return{c(){o=an("div"),a=an("div"),a.innerHTML='<i class="w-full h-full m-0 mt-4 p-2 fas fa-plus fa-2x text-black-500 transition ease "></i>',i=or(),n=an("p"),h=Sr(s),Qt(a,"class","w-full text-center"),Qt(n,"class","w-full text-center"),Qt(o,"class","border text-center border-solid border-gray-200 mb-2 p-2 bg-white rounded-xl w-35 h-30 ml-2 mr-2 cursor-pointer")},m(O,A){_r(O,o,A),ft(o,a),ft(o,i),ft(o,n),ft(n,h),v||(g=sa(o,"click",c[9]),v=!0)},p(O,A){A&4&&s!==(s=O[2]("content.data.addData")+"")&&Ur(h,s)},i:Fi,o:Fi,d(O){O&&br(o),v=!1,g()}}}function wge(c){let o=c[2]("content.data.record")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&4&&o!==(o=i[2]("content.data.record")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function _ge(c){let o,a,i,n,s,h=c[2]("content.index.recordButtonDescription")+"",v,g;return i=new Jk({props:{height:95,width:140,src:"imgs/microbit_record_guide.svg",alt:"microbit recording guide"}}),{c(){o=an("div"),a=an("div"),xi(i.$$.fragment),n=or(),s=an("p"),v=Sr(h),Qt(a,"class","text-left float-left mt-auto mb-auto ml-3"),Qt(s,"class","text-center absolute w-60px right-23px top-30px"),Qt(o,"class","relative float-left text-left h-30 w-60 bg-white border rounded-xl justify-start flex gap-1 m-0 -mt-2")},m(O,A){_r(O,o,A),ft(o,a),gi(i,a,null),ft(o,n),ft(o,s),ft(s,v),g=!0},p(O,A){(!g||A&4)&&h!==(h=O[2]("content.index.recordButtonDescription")+"")&&Ur(v,h)},i(O){g||(hr(i.$$.fragment,O),g=!0)},o(O){Cr(i.$$.fragment,O),g=!1},d(O){O&&br(o),vi(i)}}}function kge(c){let o,a=[],i=new Map,n,s=c[0].recordings;const h=v=>String(v[0].ID)+String(v[18].ID);for(let v=0;v<s.length;v+=1){let g=KH(c,s,v),O=h(g);i.set(O,a[v]=YH(O,g))}return{c(){o=an("div");for(let v=0;v<a.length;v+=1)a[v].c();Qt(o,"class","flex border border-solid border-gray-200 mb-2 p-2 bg-white rounded-xl h-30")},m(v,g){_r(v,o,g);for(let O=0;O<a.length;O+=1)a[O]&&a[O].m(o,null);n=!0},p(v,g){g&257&&(s=v[0].recordings,Bs(),a=PK(a,g,h,1,v,s,i,o,BK,YH,null,KH),Ps())},i(v){if(!n){for(let g=0;g<s.length;g+=1)hr(a[g]);n=!0}},o(v){for(let g=0;g<a.length;g+=1)Cr(a[g]);n=!1},d(v){v&&br(o);for(let g=0;g<a.length;g+=1)a[g].d()}}}function YH(c,o){let a,i,n;return i=new yge({props:{recording:o[18],onDelete:o[8]}}),{key:c,first:null,c(){a=Cm(),xi(i.$$.fragment),this.first=a},m(s,h){_r(s,a,h),gi(i,s,h),n=!0},p(s,h){o=s;const v={};h&1&&(v.recording=o[18]),i.$set(v)},i(s){n||(hr(i.$$.fragment,s),n=!0)},o(s){Cr(i.$$.fragment,s),n=!1},d(s){s&&br(a),vi(i,s)}}}function Ege(c){let o,a,i,n,s,h,v,g,O,A,S,M,P,L,V,N,ee,J,K,re;const ce=[xge,bge],pe=[];function ke(ht,Dt){return ht[3]!==ht[0]?0:1}P=ke(c),L=pe[P]=ce[P](c);const Ce=[kge,_ge],be=[];function $e(ht,Dt){return ht[0].recordings.length>0?0:ht[3]===ht[0]?1:-1}return~(N=$e(c))&&(ee=be[N]=Ce[N](c)),{c(){o=an("main"),a=an("div"),n=or(),s=an("div"),h=an("div"),v=an("div"),g=an("h3"),O=or(),A=an("button"),S=an("i"),M=or(),L.c(),V=or(),ee&&ee.c(),Qt(a,"class","bg-red-600 h-1.5 rounded-full absolute mt-123px ml-14px"),Qt(a,"style",i=c[1]?"transition: "+(c[4]/1e3).toString()+"s linear; width: 97%;":"width:0;"),Qt(g,"contenteditable",""),c[0].name===void 0&&Ll(()=>c[14].call(g)),Qt(v,"class","w-40 col-start-2 col-end-5 text-center font-semibold transition ease rounded-xl border border-gray-300 border-solid hover:bg-gray-100"),Qt(S,"class","far fa-times-circle fa-lg text-light-800 hover:text-black transition ease"),Qt(A,"class","pl-3 col-start-5 place-self-start justify-self-end outline-none"),Qt(h,"class","grid grid-cols-5 place-items-center border border-solid border-gray-200 mb-2 p-2 bg-white rounded-xl w-50 h-30 ml-2"),Qt(s,"class","items-center flex mb-1"),Qt(o,"class","flex-row flex")},m(ht,Dt){_r(ht,o,Dt),ft(o,a),ft(o,n),ft(o,s),ft(s,h),ft(h,v),ft(v,g),c[0].name!==void 0&&(g.textContent=c[0].name),ft(h,O),ft(h,A),ft(A,S),ft(s,M),pe[P].m(s,null),ft(s,V),~N&&be[N].m(s,null),J=!0,K||(re=[sa(g,"input",c[14]),sa(g,"click",c[5]),sa(g,"keypress",c[10]),sa(S,"click",c[6])],K=!0)},p(ht,[Dt]){(!J||Dt&2&&i!==(i=ht[1]?"transition: "+(ht[4]/1e3).toString()+"s linear; width: 97%;":"width:0;"))&&Qt(a,"style",i),Dt&1&&ht[0].name!==g.textContent&&(g.textContent=ht[0].name);let Ut=P;P=ke(ht),P===Ut?pe[P].p(ht,Dt):(Bs(),Cr(pe[Ut],1,1,()=>{pe[Ut]=null}),Ps(),L=pe[P],L?L.p(ht,Dt):(L=pe[P]=ce[P](ht),L.c()),hr(L,1),L.m(s,V));let Ee=N;N=$e(ht),N===Ee?~N&&be[N].p(ht,Dt):(ee&&(Bs(),Cr(be[Ee],1,1,()=>{be[Ee]=null}),Ps()),~N?(ee=be[N],ee?ee.p(ht,Dt):(ee=be[N]=Ce[N](ht),ee.c()),hr(ee,1),ee.m(s,null)):ee=null)},i(ht){J||(hr(L),hr(ee),J=!0)},o(ht){Cr(L),Cr(ee),J=!1},d(ht){ht&&br(o),pe[P].d(),~N&&be[N].d(),K=!1,Ul(re)}}}function Cge(c,o,a){let i,n,s,h;Vi(c,yN,ce=>a(13,i=ce)),Vi(c,La,ce=>a(2,n=ce)),Vi(c,v5,ce=>a(3,s=ce)),Vi(c,No,ce=>a(15,h=ce));let{onNoMicrobitSelect:v}=o,{gesture:g}=o;const O=n("content.data.classPlaceholderNewClass"),A=Wo(gl).duration;let S=!1;function M(){g.name===O&&a(0,g.name="",g)}function P(){FS(!1)&&window.confirm(n("alert.deleteGestureConfirm")+'"'+g.name+'"?')&&(fu(No,h.isPredicting=!1,h),setTimeout(()=>{cfe(g)},450))}function L(){if(!FS())return;fu(No,h.isRecording=!0,h),Ig("Optager"),a(1,S=!0);let ce={x:[],y:[],z:[]};const pe=d4.subscribe(ke=>{ce.x.push(ke.accelX),ce.y.push(ke.accelY),ce.z.push(ke.accelZ)});setTimeout(()=>{if(fu(No,h.isRecording=!1,h),a(1,S=!1),pe(),Wo(gl).minSamples<=ce.x.length){const ke={ID:Date.now(),data:ce};lfe(g.ID,ke),Ig("Færdiggjort optagelse")}else F2(n("alert.recording.disconnectedDuringRecording"))},A)}function V(ce){FS(!1)&&(fu(No,h.isPredicting=!1,h),ffe(g.ID,ce.ID))}
9063function N(){if(!h.isInputConnected){v5.update(ce=>(ce=null,ce)),v();return}v5.update(ce=>(ce===g?ce=null:ce=g,ce))}function ee(ce){const pe=Wo(gl);s===g&&(pe.preferableButton==="AB"||ce.buttonA&&pe.preferableButton==="A"||pe.preferableButton==="B"&&ce.buttonB)&&L()}function J(ce){if(ce.code==="Backspace"||ce.code==="Delete")return!0;if(ce.code==="Enter")return ce.preventDefault(),ce.target instanceof HTMLElement&&ce.target.blur(),!0;if(g.name.length>=25)return ce.preventDefault(),F2(n("alert.data.classNameLengthAlert")),!1}let K=!0;function re(){g.name=this.textContent,a(0,g)}return c.$$set=ce=>{"onNoMicrobitSelect"in ce&&a(11,v=ce.onNoMicrobitSelect),"gesture"in ce&&a(0,g=ce.gesture)},c.$$.update=()=>{c.$$.dirty&12288&&(K?a(12,K=!1):ee(i))},[g,S,n,s,A,M,P,L,V,N,J,v,K,i,re]}class Sge extends $o{constructor(o){super(),Vo(this,o,Cge,Ege,jo,{onNoMicrobitSelect:11,gesture:0})}}function XH(c){let o,a;return{c(){o=an("p"),a=Sr(c[0]),Qt(o,"class","text-white w-auto h-auto mr-0 whitespace-pre-line svelte-hfc4mf"),Fs(o,"color",c[5]),Bi(o,"underline",c[1])},m(i,n){_r(i,o,n),ft(o,a)},p(i,n){n&1&&Ur(a,i[0]),n&32&&Fs(o,"color",i[5]),n&2&&Bi(o,"underline",i[1])},d(i){i&&br(o)}}}function JH(c){let o,a,i,n;const s=c[15].default,h=Gk(s,c,c[14],null);return{c(){o=an("div"),h&&h.c(),Qt(o,"class","fixed z-10000 rounded-md p-3 cursor-default"),Fs(o,"top",c[9]+"px"),Fs(o,"left",c[10]+"px"),Fs(o,"width",c[2]+"px"),Fs(o,"background-color",c[3])},m(v,g){_r(v,o,g),h&&h.m(o,null),a=!0,i||(n=sa(o,"click",AK(c[16])),i=!0)},p(v,g){h&&h.p&&(!a||g&16384)&&Yk(h,s,v,v[14],a?Kk(s,v[14],g,null):Xk(v[14]),null),(!a||g&512)&&Fs(o,"top",v[9]+"px"),(!a||g&1024)&&Fs(o,"left",v[10]+"px"),(!a||g&4)&&Fs(o,"width",v[2]+"px"),(!a||g&8)&&Fs(o,"background-color",v[3])},i(v){a||(hr(h,v),a=!0)},o(v){Cr(h,v),a=!1},d(v){v&&br(o),h&&h.d(v),i=!1,n()}}}function Age(c){let o,a,i,n,s,h,v,g,O=c[0]!==void 0&&XH(c),A=c[6]&&JH(c);return{c(){o=an("div"),O&&O.c(),a=or(),i=an("i"),n=or(),A&&A.c(),Qt(i,"class","far fa-question-circle flex text-white w-auto h-auto mr-0 ml-1 mt-4px svelte-hfc4mf"),Fs(i,"color",c[4]),Bi(i,"hovering",c[6]),Qt(o,"class","cursor-pointer w-auto flex"),Ll(()=>c[19].call(o))},m(S,M){_r(S,o,M),O&&O.m(o,null),ft(o,a),ft(o,i),ft(o,n),A&&A.m(o,null),s=OK(o,c[19].bind(o)),c[20](o),h=!0,v||(g=[sa(o,"mouseenter",c[17]),sa(o,"mouseleave",c[18])],v=!0)},p(S,[M]){S[0]!==void 0?O?O.p(S,M):(O=XH(S),O.c(),O.m(o,a)):O&&(O.d(1),O=null),(!h||M&16)&&Fs(i,"color",S[4]),(!h||M&64)&&Bi(i,"hovering",S[6]),S[6]?A?(A.p(S,M),M&64&&hr(A,1)):(A=JH(S),A.c(),hr(A,1),A.m(o,null)):A&&(Bs(),Cr(A,1,1,()=>{A=null}),Ps())},i(S){h||(hr(A),h=!0)},o(S){Cr(A),h=!1},d(S){S&&br(o),O&&O.d(),A&&A.d(),s(),c[20](null),v=!1,Ul(g)}}}function Oge(c,o,a){let{$$slots:i={},$$scope:n}=o,{text:s=void 0}=o,{underlineText:h=!0}=o,{boxOffset:v={x:0,y:0}}=o,{width:g=300}=o,{backgroundColor:O="rgba(231, 229, 228, 1)"}=o,{iconColor:A="rgba(255,255,255,0.5)"}=o,{iconTextColor:S="rgba(255,255,255,1)"}=o,M=!1,P,L,V=0,N=0,ee;function J(){let Ce=ee.getBoundingClientRect();a(9,V=L+5+v.y+Ce.y),a(10,N=P-20+v.x+Ce.x),a(6,M=!0)}function K(Ce){NK.call(this,c,Ce)}const re=()=>J(),ce=()=>a(6,M=!1);function pe(){P=this.clientWidth,L=this.clientHeight,a(7,P),a(8,L)}function ke(Ce){l1[Ce?"unshift":"push"](()=>{ee=Ce,a(11,ee)})}return c.$$set=Ce=>{"text"in Ce&&a(0,s=Ce.text),"underlineText"in Ce&&a(1,h=Ce.underlineText),"boxOffset"in Ce&&a(13,v=Ce.boxOffset),"width"in Ce&&a(2,g=Ce.width),"backgroundColor"in Ce&&a(3,O=Ce.backgroundColor),"iconColor"in Ce&&a(4,A=Ce.iconColor),"iconTextColor"in Ce&&a(5,S=Ce.iconTextColor),"$$scope"in Ce&&a(14,n=Ce.$$scope)},[s,h,g,O,A,S,M,P,L,V,N,ee,J,v,n,i,K,re,ce,pe,ke]}class PY extends $o{constructor(o){super(),Vo(this,o,Oge,Age,jo,{text:0,underlineText:1,boxOffset:13,width:2,backgroundColor:3,iconColor:4,iconTextColor:5})}}function Dge(c){let o,a,i,n,s;return{c(){o=an("p"),a=Sr(c[4]),i=or(),n=an("p"),s=Sr(c[5]),Qt(o,"class","font-bold text-left mb-1 mt-1 text-sm svelte-d2l7fv"),Bi(o,"blackText",c[6]),Bi(o,"whiteText",!c[6]),Qt(n,"class","text-sm text-left svelte-d2l7fv"),Bi(n,"blackText",c[6]),Bi(n,"whiteText",!c[6])},m(h,v){_r(h,o,v),ft(o,a),_r(h,i,v),_r(h,n,v),ft(n,s)},p(h,v){v&16&&Ur(a,h[4]),v&64&&Bi(o,"blackText",h[6]),v&64&&Bi(o,"whiteText",!h[6]),v&32&&Ur(s,h[5]),v&64&&Bi(n,"blackText",h[6]),v&64&&Bi(n,"whiteText",!h[6])},d(h){h&&br(o),h&&br(i),h&&br(n)}}}function Tge(c){let o,a;return o=new PY({props:{text:c[0],underlineText:c[1],boxOffset:c[2],width:c[3],backgroundColor:c[6]?"rgba(231, 229, 228, 1)":"rgba(87, 83, 78, 1)",iconColor:c[6]?"rgba(255,255,255,0.5)":"rgba(160,160,160,
90631)",iconTextColor:c[6]?"rgba(255,255,255,1)":"rgba(160,160,160,1)",$$slots:{default:[Dge]},$$scope:{ctx:c}}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,[n]){const s={};n&1&&(s.text=i[0]),n&2&&(s.underlineText=i[1]),n&4&&(s.boxOffset=i[2]),n&8&&(s.width=i[3]),n&64&&(s.backgroundColor=i[6]?"rgba(231, 229, 228, 1)":"rgba(87, 83, 78, 1)"),n&64&&(s.iconColor=i[6]?"rgba(255,255,255,0.5)":"rgba(160,160,160,1)"),n&64&&(s.iconTextColor=i[6]?"rgba(255,255,255,1)":"rgba(160,160,160,1)"),n&240&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function Nge(c,o,a){let{iconText:i=void 0}=o,{underlineText:n=!0}=o,{boxOffset:s={x:0,y:0}}=o,{width:h=300}=o,{titleText:v}=o,{bodyText:g}=o,{isLightTheme:O=!0}=o;return c.$$set=A=>{"iconText"in A&&a(0,i=A.iconText),"underlineText"in A&&a(1,n=A.underlineText),"boxOffset"in A&&a(2,s=A.boxOffset),"width"in A&&a(3,h=A.width),"titleText"in A&&a(4,v=A.titleText),"bodyText"in A&&a(5,g=A.bodyText),"isLightTheme"in A&&a(6,O=A.isLightTheme)},[i,n,s,h,v,g,O]}class Vx extends $o{constructor(o){super(),Vo(this,o,Nge,Tge,jo,{iconText:0,underlineText:1,boxOffset:2,width:3,titleText:4,bodyText:5,isLightTheme:6})}}function Ige(c){let o,a,i=c[0]("content.data.choice.header")+"",n,s,h,v=c[0]("content.data.choice.body")+"",g,O,A,S,M,P,L,V=c[0]("content.index.recordButtonDescription")+"",N,ee;return M=new Jk({props:{alt:"microbit recording guide",height:134,src:"imgs/microbit_record_guide.svg",width:200}}),{c(){o=an("div"),a=an("p"),n=Sr(i),s=or(),h=an("p"),g=Sr(v),O=or(),A=an("div"),S=an("div"),xi(M.$$.fragment),P=or(),L=an("p"),N=Sr(V),Qt(a,"class","font-bold text-sm mb-2"),Qt(h,"class","text-sm"),Qt(S,"class","w-full float-left"),Qt(L,"class","text-center absolute w-60px right-10px top-35px"),Qt(A,"class","relative w-full justify-start flex justify-around gap-1 mt-6 mb-2")},m(J,K){_r(J,o,K),ft(o,a),ft(a,n),ft(o,s),ft(o,h),ft(h,g),ft(o,O),ft(o,A),ft(A,S),gi(M,S,null),ft(A,P),ft(A,L),ft(L,N),ee=!0},p(J,[K]){(!ee||K&1)&&i!==(i=J[0]("content.data.choice.header")+"")&&Ur(n,i),(!ee||K&1)&&v!==(v=J[0]("content.data.choice.body")+"")&&Ur(g,v),(!ee||K&1)&&V!==(V=J[0]("content.index.recordButtonDescription")+"")&&Ur(N,V)},i(J){ee||(hr(M.$$.fragment,J),ee=!0)},o(J){Cr(M.$$.fragment,J),ee=!1},d(J){J&&br(o),vi(M)}}}function Mge(c,o,a){let i;return Vi(c,La,n=>a(0,i=n)),[i]}class Fge extends $o{constructor(o){super(),Vo(this,o,Mge,Ige,jo,{})}}function QH(c,o,a){const i=c.slice();return i[9]=o[a],i[11]=a,i}function ZH(c){let o,a,i,n;function s(){return c[6](c[11])}function h(...v){return c[7](c[11],...v)}return{c(){o=an("div"),Qt(o,"class",a=(c[9]?"bg-[#63BFC2] border-[#63BFC2]":"bg-gray-300 border-gray-300")+" border-3 rounded transition ease svelte-x9czys"),Bi(o,"turnedOn",c[9]),Bi(o,"turnedOff",!c[9]),Bi(o,"border-teal-500",c[1][c[11]])},m(v,g){_r(v,o,g),i||(n=[sa(o,"mousedown",s),sa(o,"mouseenter",h)],i=!0)},p(v,g){c=v,g&1&&a!==(a=(c[9]?"bg-[#63BFC2] border-[#63BFC2]":"bg-gray-300 border-gray-300")+" border-3 rounded transition ease svelte-x9czys")&&Qt(o,"class",a),g&1&&Bi(o,"turnedOn",c[9]),g&1&&Bi(o,"turnedOff",!c[9]),g&3&&Bi(o,"border-teal-500",c[1][c[11]])},d(v){v&&br(o),i=!1,Ul(n)}}}function Rge(c){let o,a,i,n=c[0],s=[];for(let h=0;h<n.length;h+=1)s[h]=ZH(QH(c,n,h));return{c(){o=an("main");for(let h=0;h<s.length;h+=1)s[h].c();Qt(o,"class","buttonGrid select-none svelte-x9czys")},m(h,v){_r(h,o,v);for(let g=0;g<s.length;g+=1)s[g]&&s[g].m(o,null);a||(i=sa(o,"mouseleave",c[3]),a=!0)},p(h,[v]){if(v&23){n=h[0];let g;for(g=0;g<n.length;g+=1){const O=QH(h,n,g);s[g]?s[g].p(O,v):(s[g]=ZH(O),s[g].c(),s[g].m(o,null))}for(;g<s.length;g+=1)s[g].d(1);s.length=n.length}},i:Fi,o:Fi,d(h){h&&br(o),Pv(s,h),a=!1,i()}}}function Bge(c,o,a){let{onMatrixChange:i}=o,{matrix:n}=o,s=new Array(25).fill(!1);if(!(n instanceof Array)||n.length!==25){n=new Array(25);for(let M=0;M<25;M++)n[M]=!1}const h=(M,P)=>{a(0,n[M]=P,n),v(M).forEach(V=>{V.position<=0?a(0,n[V.index]=P,n):a(0,n[V.index]=!1,n)}),i(n)},v=M=>{const P=[];for(let L=M%5;L<25;L+=5)P.push({index:L,position:Math.sign(M-L)});return P},g=()=>{for(let M=0;M<s.length;M++)a(1,s[M]=!1,s)},O=(M,P=void 0)=>{const L=v(M);for(let V=0;V<s.length;V++)a(1,s[V]=!1,s);
9063L.forEach(V=>{a(1,s[V.index]=V.position<=0,s)}),P!==void 0&&P.buttons===1&&h(M,!0)},A=M=>{h(M,!0)},S=(M,P)=>{O(M,P)};return c.$$set=M=>{"onMatrixChange"in M&&a(5,i=M.onMatrixChange),"matrix"in M&&a(0,n=M.matrix)},[n,s,h,g,O,i,A,S]}class Pge extends $o{constructor(o){super(),Vo(this,o,Bge,Rge,jo,{onMatrixChange:5,matrix:0})}}function eq(c){let o,a=c[3]("popup.connectMB.bluetooth.cancelledConnection")+"",i;return{c(){o=an("p"),i=Sr(a),Qt(o,"class","text-red-500 mb-1")},m(n,s){_r(n,o,s),ft(o,i)},p(n,s){s&8&&a!==(a=n[3]("popup.connectMB.bluetooth.cancelledConnection")+"")&&Ur(i,a)},d(n){n&&br(o)}}}function jge(c){let o,a,i,n,s=c[3]("popup.connectMB.bluetooth.step0")+"",h,v,g,O,A=c[3]("popup.connectMB.bluetooth.step1")+"",S,M,P,L,V=c[3]("popup.connectMB.bluetooth.step2")+"",N,ee,J,K,re=c[3]("popup.connectMB.bluetooth.step3")+"",ce,pe,ke,Ce,be,$e,ht;return Ce=new Pge({props:{matrix:c[2],onMatrixChange:c[6]}}),$e=new vl({props:{onClick:c[5],$$slots:{default:[zge]},$$scope:{ctx:c}}}),{c(){o=an("div"),a=an("div"),i=an("p"),n=Sr("1. "),h=Sr(s),v=or(),g=an("p"),O=Sr("2. "),S=Sr(A),M=or(),P=an("p"),L=Sr("3. "),N=Sr(V),ee=or(),J=an("p"),K=Sr("4. "),ce=Sr(re),pe=or(),ke=an("div"),xi(Ce.$$.fragment),be=or(),xi($e.$$.fragment),Qt(a,"class","col-span-2 pt-5"),Qt(o,"class","grid grid-cols-3 mb-5 w-650px")},m(Dt,Ut){_r(Dt,o,Ut),ft(o,a),ft(a,i),ft(i,n),ft(i,h),ft(a,v),ft(a,g),ft(g,O),ft(g,S),ft(a,M),ft(a,P),ft(P,L),ft(P,N),ft(a,ee),ft(a,J),ft(J,K),ft(J,ce),ft(o,pe),ft(o,ke),gi(Ce,ke,null),_r(Dt,be,Ut),gi($e,Dt,Ut),ht=!0},p(Dt,Ut){(!ht||Ut&8)&&s!==(s=Dt[3]("popup.connectMB.bluetooth.step0")+"")&&Ur(h,s),(!ht||Ut&8)&&A!==(A=Dt[3]("popup.connectMB.bluetooth.step1")+"")&&Ur(S,A),(!ht||Ut&8)&&V!==(V=Dt[3]("popup.connectMB.bluetooth.step2")+"")&&Ur(N,V),(!ht||Ut&8)&&re!==(re=Dt[3]("popup.connectMB.bluetooth.step3")+"")&&Ur(ce,re);const Ee={};Ut&4&&(Ee.matrix=Dt[2]),Ce.$set(Ee);const Ot={};Ut&1032&&(Ot.$$scope={dirty:Ut,ctx:Dt}),$e.$set(Ot)},i(Dt){ht||(hr(Ce.$$.fragment,Dt),hr($e.$$.fragment,Dt),ht=!0)},o(Dt){Cr(Ce.$$.fragment,Dt),Cr($e.$$.fragment,Dt),ht=!1},d(Dt){Dt&&br(o),vi(Ce),Dt&&br(be),vi($e,Dt)}}}function Lge(c){let o,a,i=c[3]("popup.connectMB.bluetooth.connecting")+"",n,s,h,v;return{c(){o=an("div"),a=an("p"),n=Sr(i),s=or(),h=an("img"),Qt(h,"alt","loading"),Qx(h.src,v="imgs/loadingspinner.gif")||Qt(h,"src",v),Qt(h,"width","100px"),Qt(o,"class","w-650px flex flex-col justify-center items-center")},m(g,O){_r(g,o,O),ft(o,a),ft(a,n),ft(o,s),ft(o,h)},p(g,O){O&8&&i!==(i=g[3]("popup.connectMB.bluetooth.connecting")+"")&&Ur(n,i)},i:Fi,o:Fi,d(g){g&&br(o)}}}function zge(c){let o=c[3]("popup.connectMB.bluetooth.connect")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&8&&o!==(o=i[3]("popup.connectMB.bluetooth.connect")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function Uge(c){let o,a,i=c[3]("popup.connectMB.bluetooth.heading")+"",n,s,h,v,g,O,A=c[1].requestDeviceWasCancelled&&!c[0]&&eq(c);const S=[Lge,jge],M=[];function P(L,V){return L[0]?0:1}return v=P(c),g=M[v]=S[v](c),{c(){o=an("main"),a=an("h1"),n=Sr(i),s=or(),A&&A.c(),h=or(),g.c(),Qt(a,"class","mb-5 font-bold")},m(L,V){_r(L,o,V),ft(o,a),ft(a,n),ft(o,s),A&&A.m(o,null),ft(o,h),M[v].m(o,null),O=!0},p(L,[V]){(!O||V&8)&&i!==(i=L[3]("popup.connectMB.bluetooth.heading")+"")&&Ur(n,i),L[1].requestDeviceWasCancelled&&!L[0]?A?A.p(L,V):(A=eq(L),A.c(),A.m(o,h)):A&&(A.d(1),A=null);let N=v;v=P(L),v===N?M[v].p(L,V):(Bs(),Cr(M[N],1,1,()=>{M[N]=null}),Ps(),g=M[v],g?g.p(L,V):(g=M[v]=S[v](L),g.c()),hr(g,1),g.m(o,null))},i(L){O||(hr(g),O=!0)},o(L){Cr(g),O=!1},d(L){L&&br(o),A&&A.d(),M[v].d()}}}function Wge(c,o,a){let i,n,s;Vi(c,No,P=>a(1,i=P)),Vi(c,La,P=>a(3,s=P));let{deviceState:h}=o,{onBluetoothConnected:v}=o,g=!1,O=h===ed.INPUT?iP:oP;Vi(c,O,P=>a(2,n=P));const A=()=>{if(g)return;a(0,g=!0);let P=Va.Utility.patternToName(n);(()=>h==ed.INPUT?pu.assignInput(P):pu.assignOutput(P))().then(V=>{V?v():a(0,g=!1)})};function S(P){P.code==="Enter"&&A()}function M(P){fu(O,n=P,n)}return Zx(()=>{document.addEventListener("keypress",S)}),Ule(()=>{document.removeEventListener("keypress",S)}),Zx(()=>{fu(No,i.requestDeviceWasCancelled=!1,i)}),c.$$set=P=>{"deviceState"in P&&a(7,h=P.deviceState),"onBluetoothConnected"in P&&a(8,v=P.onBluetoothConnected)},[g,i,n,s,O,A,M,h,v]}class Vge extends $o{constructor(o){super(),Vo(this,o,Wge,Uge,jo,{deviceState:7,onBluetoothConnected:8})}}function $ge(c){let o=c[2]("connectMB.main.installButton")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&4&&o!==(o=i[2]("connectMB.main.installButton")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function Hge(c){let o=c[2]("connectMB.main.connectButton")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&4&&o!==(o=i[2]("connectMB.main.connectButton")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function qge(c){let o,a,i,n,s=c[2]("connectMB.main.usbHeader")+"",h,v,g,O=c[2]("connectMB.main.usbBody")+"",A,S,M,P,L,V,N=c[2]("connectMB.main.btHeader")+"",ee,J,K,re=c[2]("connectMB.main.btBody")+"",ce,pe,ke,Ce,be,$e;return M=new vl({props:{$$slots:{default:[$ge]},$$scope:{ctx:c}}}),ke=new vl({props:{$$slots:{default:[Hge]},$$scope:{ctx:c}}}
9063),{c(){o=an("main"),a=an("div"),i=an("div"),n=an("h1"),h=Sr(s),v=or(),g=an("p"),A=Sr(O),S=or(),xi(M.$$.fragment),P=or(),L=an("div"),V=an("h1"),ee=Sr(N),J=or(),K=an("p"),ce=Sr(re),pe=or(),xi(ke.$$.fragment),Qt(n,"class","font-bold"),Qt(g,"class","mb-5"),Qt(i,"class","hover:cursor-pointer mr-2 border-gray-200 border border-solid rounded-lg p-6 shadow-lg"),Qt(V,"class","font-bold"),Qt(K,"class","mb-5"),Qt(L,"class","hover:cursor-pointer ml-2 border-gray-200 border border-solid rounded-lg p-6 shadow-lg"),Qt(a,"class","grid grid-cols-2 w-600px text-center")},m(ht,Dt){_r(ht,o,Dt),ft(o,a),ft(a,i),ft(i,n),ft(n,h),ft(i,v),ft(i,g),ft(g,A),ft(i,S),gi(M,i,null),ft(a,P),ft(a,L),ft(L,V),ft(V,ee),ft(L,J),ft(L,K),ft(K,ce),ft(L,pe),gi(ke,L,null),Ce=!0,be||($e=[sa(i,"click",function(){Fg(c[0])&&c[0].apply(this,arguments)}),sa(L,"click",function(){Fg(c[1])&&c[1].apply(this,arguments)})],be=!0)},p(ht,[Dt]){c=ht,(!Ce||Dt&4)&&s!==(s=c[2]("connectMB.main.usbHeader")+"")&&Ur(h,s),(!Ce||Dt&4)&&O!==(O=c[2]("connectMB.main.usbBody")+"")&&Ur(A,O);const Ut={};Dt&12&&(Ut.$$scope={dirty:Dt,ctx:c}),M.$set(Ut),(!Ce||Dt&4)&&N!==(N=c[2]("connectMB.main.btHeader")+"")&&Ur(ee,N),(!Ce||Dt&4)&&re!==(re=c[2]("connectMB.main.btBody")+"")&&Ur(ce,re);const Ee={};Dt&12&&(Ee.$$scope={dirty:Dt,ctx:c}),ke.$set(Ee)},i(ht){Ce||(hr(M.$$.fragment,ht),hr(ke.$$.fragment,ht),Ce=!0)},o(ht){Cr(M.$$.fragment,ht),Cr(ke.$$.fragment,ht),Ce=!1},d(ht){ht&&br(o),vi(M),vi(ke),be=!1,Ul($e)}}}function Gge(c,o,a){let i;Vi(c,La,h=>a(2,i=h));let{onStartUsbClick:n}=o,{onStartBluetoothClick:s}=o;return c.$$set=h=>{"onStartUsbClick"in h&&a(0,n=h.onStartUsbClick),"onStartBluetoothClick"in h&&a(1,s=h.onStartBluetoothClick)},[n,s,i]}class Kge extends $o{constructor(o){super(),Vo(this,o,Gge,qge,jo,{onStartUsbClick:0,onStartBluetoothClick:1})}}function Yge(c){let o=c[1]("popup.connectMB.main.bluetooth.subtitle")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&2&&o!==(o=i[1]("popup.connectMB.main.bluetooth.subtitle")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function Xge(c){let o,a,i,n=c[1]("connectMB.usb.header")+"",s,h,v,g=c[1]("connectMB.usb.done.body1")+"",O,A,S,M=c[1]("connectMB.usb.done.body2")+"",P,L,V,N=c[1]("connectMB.usb.done.body3")+"",ee,J,K,re=c[1]("connectMB.usb.done.body4")+"",ce,pe,ke,Ce;return ke=new vl({props:{onClick:c[0],$$slots:{default:[Yge]},$$scope:{ctx:c}}}),{c(){o=an("main"),a=an("div"),i=an("h1"),s=Sr(n),h=or(),v=an("p"),O=Sr(g),A=or(),S=an("p"),P=Sr(M),L=or(),V=an("p"),ee=Sr(N),J=or(),K=an("p"),ce=Sr(re),pe=or(),xi(ke.$$.fragment),Qt(i,"class","font-bold mb-5 text-center"),Qt(v,"class","font-bold text-center"),Qt(S,"class","mb-3 mt-2"),Qt(V,"class","mb-3"),Qt(K,"class","mb-5 w-70%"),Qt(a,"class","w-600px text-left")},m(be,$e){_r(be,o,$e),ft(o,a),ft(a,i),ft(i,s),ft(a,h),ft(a,v),ft(v,O),ft(a,A),ft(a,S),ft(S,P),ft(a,L),ft(a,V),ft(V,ee),ft(a,J),ft(a,K),ft(K,ce),ft(a,pe),gi(ke,a,null),Ce=!0},p(be,[$e]){(!Ce||$e&2)&&n!==(n=be[1]("connectMB.usb.header")+"")&&Ur(s,n),(!Ce||$e&2)&&g!==(g=be[1]("connectMB.usb.done.body1")+"")&&Ur(O,g),(!Ce||$e&2)&&M!==(M=be[1]("connectMB.usb.done.body2")+"")&&Ur(P,M),(!Ce||$e&2)&&N!==(N=be[1]("connectMB.usb.done.body3")+"")&&Ur(ee,N),(!Ce||$e&2)&&re!==(re=be[1]("connectMB.usb.done.body4")+"")&&Ur(ce,re);const ht={};$e&1&&(ht.onClick=be[0]),$e&6&&(ht.$$scope={dirty:$e,ctx:be}),ke.$set(ht)},i(be){Ce||(hr(ke.$$.fragment,be),Ce=!0)},o(be){Cr(ke.$$.fragment,be),Ce=!1},d(be){be&&br(o),vi(ke)}}}function Jge(c,o,a){let i;Vi(c,La,s=>a(1,i=s));let{onConnectBluetoothClick:n}=o;return c.$$set=s=>{"onConnectBluetoothClick"in s&&a(0,n=s.onConnectBluetoothClick)},[n,i]}class Qge extends $o{constructor(o){super(),Vo(this,o,Jge,Xge,jo,{onConnectBluetoothClick:0})}}function Zge(c){let o,a,i,n=c[2]("connectMB.usb.header")+"",s,h,v,g=c[2]("connectMB.usb.pleaseWait")+"",O,A,S,M,P,L,V,N,ee;return{c(){o=an("main"),a=an("div"),i=an("h1"),s=Sr(n),h=or(),v=an("p"),O=Sr(g),A=or(),S=an("div"),M=an("div"),P=an("div"),L=an("div"),V=or(),N=an("p"),ee=Sr(c[1]),Qt(i,"class","font-bold mb-8"),Qt(v,"class","font-bold mb-2"),Qt(L,"class","h-2 bg-green-400 rounded"),Fs(L,"width",c[0]*100+"%"),Qt(P,"class","w-full h-2 bg-gray-200 rounded"),Qt(N,"class","text-left mt-1"),Qt(M,"class","flex-1 mr-2"),Qt(S,"class","flex justify-center mb-2"),Qt(a,"class","w-600px text-center")},m(J,K){_r(J,o,K),ft(o,a),ft(a,i),ft(i,s),ft(a,h),ft(a,v),ft(v,O),ft(a,A),ft(a,S),ft(S,M),ft(M,P),ft(P,L),ft(M,V),ft(M,N),ft(N,ee)},p(J,[K]){K&4&&n!==(n=J[2]("connectMB.usb.header")+"")&&Ur(s,n),K&4&&g!==(g=J[2]("connectMB.usb.pleaseWait")+"")&&Ur(O,g),K&1&&Fs(L,"width",J[0]*100+"%"),K&2&&Ur(ee,J[1])},i:Fi,o:Fi,d(J){J&&br(o)}}}function e0e(c,o,a){let i,n;Vi(c,La,h=>
9063a(2,n=h));let{transferProgress:s}=o;return c.$$set=h=>{"transferProgress"in h&&a(0,s=h.transferProgress)},c.$$.update=()=>{c.$$.dirty&1&&a(1,i=`${Math.round(s*100)}%`)},[s,i,n]}class t0e extends $o{constructor(o){super(),Vo(this,o,e0e,Zge,jo,{transferProgress:0})}}function tq(c){let o,a=c[1]("connectMB.usb.body1")+"",i;return{c(){o=an("p"),i=Sr(a)},m(n,s){_r(n,o,s),ft(o,i)},p(n,s){s&2&&a!==(a=n[1]("connectMB.usb.body1")+"")&&Ur(i,a)},d(n){n&&br(o)}}}function nq(c){let o,a=c[1]("connectMB.usb.body2")+"",i;return{c(){o=an("p"),i=Sr(a)},m(n,s){_r(n,o,s),ft(o,i)},p(n,s){s&2&&a!==(a=n[1]("connectMB.usb.body2")+"")&&Ur(i,a)},d(n){n&&br(o)}}}function n0e(c){let o=c[1](c[0]===1?"connectMB.usb.button1":"connectMB.usb.button2")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&3&&o!==(o=i[1](i[0]===1?"connectMB.usb.button1":"connectMB.usb.button2")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function r0e(c){let o,a,i,n=c[1]("connectMB.usb.header")+"",s,h,v,g,O,A,S,M,P=c[0]===1&&tq(c),L=c[0]===2&&nq(c);return S=new vl({props:{onClick:c[0]===2?c[2]:c[5],$$slots:{default:[n0e]},$$scope:{ctx:c}}}),{c(){o=an("main"),a=an("div"),i=an("h1"),s=Sr(n),h=or(),v=an("div"),g=an("div"),P&&P.c(),O=or(),L&&L.c(),A=or(),xi(S.$$.fragment),Qt(i,"class","font-bold mb-5"),Qt(a,"class","w-500px text-center"),Qt(g,"class","mb-5")},m(V,N){_r(V,o,N),ft(o,a),ft(a,i),ft(i,s),ft(o,h),ft(o,v),ft(v,g),P&&P.m(g,null),ft(g,O),L&&L.m(g,null),ft(v,A),gi(S,v,null),M=!0},p(V,[N]){(!M||N&2)&&n!==(n=V[1]("connectMB.usb.header")+"")&&Ur(s,n),V[0]===1?P?P.p(V,N):(P=tq(V),P.c(),P.m(g,O)):P&&(P.d(1),P=null),V[0]===2?L?L.p(V,N):(L=nq(V),L.c(),L.m(g,null)):L&&(L.d(1),L=null);const ee={};N&1&&(ee.onClick=V[0]===2?V[2]:V[5]),N&67&&(ee.$$scope={dirty:N,ctx:V}),S.$set(ee)},i(V){M||(hr(S.$$.fragment,V),M=!0)},o(V){Cr(S.$$.fragment,V),M=!1},d(V){V&&br(o),P&&P.d(),L&&L.d(),vi(S)}}}function i0e(c,o,a){let i;Vi(c,La,O=>a(1,i=O));let{onFoundUsb:n}=o,{onUsbLinkError:s}=o;function h(){pu.linkMicrobit().then(()=>n()).catch(O=>{console.log(O),s()})}let v=1;const g=()=>{a(0,v=2)};return c.$$set=O=>{"onFoundUsb"in O&&a(3,n=O.onFoundUsb),"onUsbLinkError"in O&&a(4,s=O.onUsbLinkError)},[v,i,h,n,s,g]}class o0e extends $o{constructor(o){super(),Vo(this,o,i0e,r0e,jo,{onFoundUsb:3,onUsbLinkError:4})}}function a0e(c){let o=c[1]("connectMB.usb.manual.done")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&2&&o!==(o=i[1]("connectMB.usb.manual.done")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function s0e(c){let o,a,i=c[1]("connectMB.usb.manual.header")+"",n,s,h,v,g=c[1]("connectMB.usb.manual.manualDownload")+"",O,A,S,M=c[1]("connectMB.usb.manual.manualDownloadLink")+"",P,L,V,N,ee,J,K=c[1]("popup.connectMB.USBCompatibility.transferStep.step1")+"",re,ce,pe,ke,Ce=c[1]("popup.connectMB.USBCompatibility.transferStep.step2")+"",be,$e,ht,Dt,Ut=c[1]("popup.connectMB.USBCompatibility.transferStep.step3")+"",Ee,Ot,zt,Mt,Ke,Tt,vt,yt,bt,Ht,_t;return Ke=new Jk({props:{alt:"Transferring the firmware",castShadow:!0,height:104,src:c[3],width:290}}),yt=new vl({props:{onClick:c[0],$$slots:{default:[a0e]},$$scope:{ctx:c}}}),{c(){o=an("main"),a=an("h1"),n=Sr(i),s=or(),h=an("div"),v=an("p"),O=Sr(g),A=or(),S=an("p"),P=Sr(M),L=or(),V=an("div"),N=an("div"),ee=an("p"),J=Sr("1. "),re=Sr(K),ce=or(),pe=an("p"),ke=Sr("2. "),be=Sr(Ce),$e=or(),ht=an("p"),Dt=Sr("3. "),Ee=Sr(Ut),Ot=or(),zt=an("div"),Mt=an("div"),xi(Ke.$$.fragment),Tt=or(),vt=an("div"),xi(yt.$$.fragment),Qt(a,"class","mb-5 font-bold"),Qt(v,"class","mr-1"),Qt(S,"class","hover:cursor-pointer text-red-500 underline"),Qt(h,"class","flex float-left mb-3"),Qt(N,"class","col-span-2"),Qt(Mt,"class",""),Qt(V,"class","grid grid-cols-3 mb-5 w-900px"),Qt(vt,"class","grid grid-cols-1 place-items-center w-full")},m(Ze,Vt){_r(Ze,o,Vt),ft(o,a),ft(a,n),ft(o,s),ft(o,h),ft(h,v),ft(v,O),ft(h,A),ft(h,S),ft(S,P),ft(o,L),ft(o,V),ft(V,N),ft(N,ee),ft(ee,J),ft(ee,re),ft(N,ce),ft(N,pe),ft(pe,ke),ft(pe,be),ft(N,$e),ft(N,ht),ft(ht,Dt),ft(ht,Ee),ft(V,Ot),ft(V,zt),ft(zt,Mt),gi(Ke,Mt,null),ft(o,Tt),ft(o,vt),gi(yt,vt,null),bt=!0,Ht||(_t=sa(S,"click",c[4]),Ht=!0)},p(Ze,[Vt]){(!bt||Vt&2)&&i!==(i=Ze[1]("connectMB.usb.manual.header")+"")&&Ur(n,i),(!bt||Vt&2)&&g!==(g=Ze[1]("connectMB.usb.manual.manualDownload")+"")&&Ur(O,g),(!bt||Vt&2)&&M!==(M=Ze[1]("connectMB.usb.manual.manualDownloadLink")+"")&&Ur(P,M),(!bt||Vt&2)&&K!==(K=Ze[1]("popup.connectMB.USBCompatibility.transferStep.step1")+"")&&Ur(re,K),(!bt||Vt&2)&&Ce!==(Ce=Ze[1]("popup.connectMB.USBCompatibility.transferStep.step2")+"")&&Ur(be,Ce),(!bt||Vt&2)&&Ut!==(Ut=Ze[1]("popup.connectMB.USBCompatibility.transferStep.step3")+"")&&Ur(Ee,Ut);const sn={};Vt&1&&(sn.onClick=Ze[0]),Vt&514&&(sn.$$scope={dirty:Vt,ctx:Ze}),yt.$set(sn)},i(Ze){bt||(hr(Ke.$$.fragment,Ze),hr(yt.$$.fragment,Ze),bt=!0)},o(Ze){Cr(Ke.$$.fragment,Ze),Cr(yt.$$.fragment,Ze),bt=!1},d(Ze){Ze&&br(o),vi(Ke),vi(yt),Ht=!1,_t()}}}function u0e(c,o,a){let i;Vi(c,La,M=>a(1,i=M));var n;let{onConnectBluetoothClick:s}=o;function h(){const M=document.createElement("a");M.href=pu.hexFiles.universal,M.download="firmware.hex",document.body.appendChild(M),M.click(),document.body.removeChild(M)}Zx(()=>h());const g=(n=D0.getParser(window.navigator.userAgent).getOS().name)!==null&&n!==void 0?n:"unknown",A=(M=>{switch(M){case"Chrome OS":return"imgs/transfer_firmware_chromeos.gif";case"Windows":return"imgs/transfer_firmware_windows.gif";case"macOS":return"imgs/transfer_firmware_macos.gif";default:return"imgs/transfer_firmware_macosgif"}})(g),S=()=>h();return c.$$set=M=>{"onConnectBluetoothClick"in M&&a(0,s=M.onConnectBluetoothClick)},[s,i,h,A,S]}class c0e extends $o{constructor(o){super(),Vo(this,o,u0e,s0e,jo,{onConnectBluetoothClick:0})}}function l0e(c){let o=c[2]("connectMB.outputMB.sameButton")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&4&&o!==(o=i[2]("connectMB.outputMB.sameButton")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function f0e(c){let o=c[2]("connectMB.outputMB.otherButton")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&4&&o!==(o=i[2]("connectMB.outputMB.otherButton")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function d0e(c){let o,a,i,n=c[2]("connectMB.output.header")+"",s,h,v,g,O,A=c[2]("connectMB.outputMB.same")+"",S,M,P,L,V,N,ee=c[2]("connectMB.outputMB.different")+"",J,K,re,ce,pe,ke;return P=new vl({props:{$$slots:{default:[l0e]},$$scope:{ctx:c}}}),re=new vl({props:{$$slots:{default:[f0e]},$$scope:{ctx:c}}}
9063),{c(){o=an("main"),a=an("div"),i=an("h1"),s=Sr(n),h=or(),v=an("div"),g=an("div"),O=an("h1"),S=Sr(A),M=or(),xi(P.$$.fragment),L=or(),V=an("div"),N=an("h1"),J=Sr(ee),K=or(),xi(re.$$.fragment),Qt(a,"class","text-center mb-5 font-bold text-lg"),Qt(O,"class","font-bold mb-6"),Qt(g,"class","hover:cursor-pointer mr-2 border-gray-200 border border-solid rounded-lg p-6 shadow-lg"),Qt(N,"class","font-bold mb-6"),Qt(V,"class","hover:cursor-pointer ml-2 border-gray-200 border border-solid rounded-lg p-6 shadow-lg"),Qt(v,"class","grid grid-cols-2 w-600px text-center")},m(Ce,be){_r(Ce,o,be),ft(o,a),ft(a,i),ft(i,s),ft(o,h),ft(o,v),ft(v,g),ft(g,O),ft(O,S),ft(g,M),gi(P,g,null),ft(v,L),ft(v,V),ft(V,N),ft(N,J),ft(V,K),gi(re,V,null),ce=!0,pe||(ke=[sa(g,"click",function(){Fg(c[0])&&c[0].apply(this,arguments)}),sa(V,"click",function(){Fg(c[1])&&c[1].apply(this,arguments)})],pe=!0)},p(Ce,[be]){c=Ce,(!ce||be&4)&&n!==(n=c[2]("connectMB.output.header")+"")&&Ur(s,n),(!ce||be&4)&&A!==(A=c[2]("connectMB.outputMB.same")+"")&&Ur(S,A);const $e={};be&12&&($e.$$scope={dirty:be,ctx:c}),P.$set($e),(!ce||be&4)&&ee!==(ee=c[2]("connectMB.outputMB.different")+"")&&Ur(J,ee);const ht={};be&12&&(ht.$$scope={dirty:be,ctx:c}),re.$set(ht)},i(Ce){ce||(hr(P.$$.fragment,Ce),hr(re.$$.fragment,Ce),ce=!0)},o(Ce){Cr(P.$$.fragment,Ce),Cr(re.$$.fragment,Ce),ce=!1},d(Ce){Ce&&br(o),vi(P),vi(re),pe=!1,Ul(ke)}}}function h0e(c,o,a){let i;Vi(c,La,h=>a(2,i=h));let{onConnectSameClick:n}=o,{onConnectDifferentClick:s}=o;return c.$$set=h=>{"onConnectSameClick"in h&&a(0,n=h.onConnectSameClick),"onConnectDifferentClick"in h&&a(1,s=h.onConnectDifferentClick)},[n,s,i]}class p0e extends $o{constructor(o){super(),Vo(this,o,h0e,d0e,jo,{onConnectSameClick:0,onConnectDifferentClick:1})}}function m0e(c){let o,a;return o=new c0e({props:{onConnectBluetoothClick:c[10]}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&2&&(s.onConnectBluetoothClick=i[10]),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function g0e(c){let o,a;return o=new Qge({props:{onConnectBluetoothClick:c[9]}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&2&&(s.onConnectBluetoothClick=i[9]),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function v0e(c){let o,a;return o=new t0e({props:{transferProgress:c[0]}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&1&&(s.transferProgress=i[0]),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function y0e(c){let o,a;return o=new o0e({props:{onUsbLinkError:c[8],onFoundUsb:c[2]}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&2&&(s.onUsbLinkError=i[8]),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function b0e(c){let o,a;return o=new Vge({props:{onBluetoothConnected:c[7],deviceState:c[1].deviceState}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&2&&(s.onBluetoothConnected=i[7]),n&2&&(s.deviceState=i[1].deviceState),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function x0e(c){let o,a;return o=new p0e({props:{onConnectSameClick:c[3],onConnectDifferentClick:c[6]}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&2&&(s.onConnectDifferentClick=i[6]),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function w0e(c){let o,a;return o=new Kge({props:{onStartBluetoothClick:c[4],onStartUsbClick:c[5]}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&2&&(s.onStartBluetoothClick=i[4]),n&2&&(s.onStartUsbClick=i[5]),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function _0e(c){let o,a,i,n;const s=[w0e,x0e,b0e,y0e,v0e,g0e,m0e],h=[];function v(g,O){return g[1].connectionState===ic.START?0:g[1].connectionState===ic.START_OUTPUT?1:g[1].connectionState===ic.BLUETOOTH?2:g[1].connectionState===ic.USB_START?3:g[1].connectionState===ic.USB_DOWNLOADING?4:g[1].connectionState===ic.USB_DONE?5:g[1].connectionState===ic.MANUA
9063L_TUTORIAL?6:-1}return~(o=v(c))&&(a=h[o]=s[o](c)),{c(){a&&a.c(),i=Cm()},m(g,O){~o&&h[o].m(g,O),_r(g,i,O),n=!0},p(g,O){let A=o;o=v(g),o===A?~o&&h[o].p(g,O):(a&&(Bs(),Cr(h[A],1,1,()=>{h[A]=null}),Ps()),~o?(a=h[o],a?a.p(g,O):(a=h[o]=s[o](g),a.c()),hr(a,1),a.m(i.parentNode,i)):a=null)},i(g){n||(hr(a),n=!0)},o(g){Cr(a),n=!1},d(g){~o&&h[o].d(g),g&&br(i)}}}function k0e(c){let o,a,i;return a=new Qk({props:{isOpen:c[1].connectionState!==ic.NONE,onClose:c[11],$$slots:{default:[_0e]},$$scope:{ctx:c}}}),{c(){o=an("main"),xi(a.$$.fragment)},m(n,s){_r(n,o,s),gi(a,o,null),i=!0},p(n,[s]){const h={};s&2&&(h.isOpen=n[1].connectionState!==ic.NONE),s&2&&(h.onClose=n[11]),s&16387&&(h.$$scope={dirty:s,ctx:n}),a.$set(h)},i(n){i||(hr(a.$$.fragment,n),i=!0)},o(n){Cr(a.$$.fragment,n),i=!1},d(n){n&&br(o),vi(a)}}}function E0e(c,o,a){let i;Vi(c,sp,V=>a(1,i=V));let n=0;function s(){pu.getLinkedFriendlyName().then(V=>{i.deviceState===ed.OUTPUT?oP.set(Va.Utility.nameToPattern(V)):iP.set(Va.Utility.nameToPattern(V)),pu.flashHexToLinked(N=>{i.connectionState!=ic.USB_DOWNLOADING&&fu(sp,i.connectionState=ic.USB_DOWNLOADING,i),a(0,n=N)}).then(()=>{fu(sp,i.connectionState=ic.USB_DONE,i)}).catch(()=>{fu(sp,i.connectionState=ic.MANUAL_TUTORIAL,i)})}).catch(()=>{fu(sp,i.connectionState=ic.MANUAL_TUTORIAL,i)})}function h(){pu.useInputAsOutput(),fu(sp,i.connectionState=ic.NONE,i)}return[n,i,s,h,()=>fu(sp,i.connectionState=ic.BLUETOOTH,i),()=>fu(sp,i.connectionState=ic.USB_START,i),()=>fu(sp,i.connectionState=ic.START,i),()=>{fu(sp,i.connectionState=ic.NONE,i)},()=>{fu(sp,i.connectionState=ic.MANUAL_TUTORIAL,i)},()=>fu(sp,i.connectionState=ic.BLUETOOTH,i),()=>fu(sp,i.connectionState=ic.BLUETOOTH,i),()=>fu(sp,i.connectionState=ic.NONE,i)]}class jY extends $o{constructor(o){super(),Vo(this,o,E0e,k0e,jo,{})}}function C0e(c){let o,a,i;return{c(){o=an("main"),o.innerHTML='<div class="w-32 text-center svelte-fyvgwq"><i class="fas fa-plus fa-3x text-black-500 transition ease svelte-fyvgwq"></i></div>',Qt(o,"class","h-30 relative cursor-pointer transition ease w-72 items-center flex mb-2 ml-2 p-2 bg-white bg-gradient-to-r from-white to-[#63BFC2] rounded-xl svelte-fyvgwq")},m(n,s){_r(n,o,s),a||(i=sa(o,"click",c[0]),a=!0)},p:Fi,i:Fi,o:Fi,d(n){n&&br(o),a=!1,i()}}}function S0e(c,o,a){let i;Vi(c,La,h=>a(1,i=h));const n=i("content.data.classPlaceholderNewClass");function s(){FS(!1)&&ufe(n)}return[s]}class A0e extends $o{constructor(o){super(),Vo(this,o,S0e,C0e,jo,{})}}function rq(c,o,a){const i=c.slice();return i[11]=o[a],i[12]=o,i[13]=a,i}function O0e(c){let o,a,i,n,s,h,v,g,O=[],A=new Map,S,M,P;a=new Qk({props:{isOpen:c[1],onClose:c[7],$$slots:{default:[N0e]},$$scope:{ctx:c}}});let L={};n=new jY({props:L}),c[8](n);const V=[M0e,I0e],N=[];function ee(re,ce){return re[0].length>0?0:1}h=ee(c),v=N[h]=V[h](c);let J=c[0];const K=re=>re[11].ID;for(let re=0;re<J.length;re+=1){let ce=rq(c,J,re),pe=K(ce);A.set(pe,O[re]=oq(pe,ce))}return M=new A0e({}),{c(){o=an("main"),xi(a.$$.fragment),i=or(),xi(n.$$.fragment),s=or(),v.c(),g=or();for(let re=0;re<O.length;re+=1)O[re].c();S=or(),xi(M.$$.fragment),Qt(o,"class","pl-2 mt-24 w-full")},m(re,ce){_r(re,o,ce),gi(a,o,null),ft(o,i),gi(n,o,null),ft(o,s),N[h].m(o,null),ft(o,g);for(let pe=0;pe<O.length;pe+=1)O[pe]&&O[pe].m(o,null);ft(o,S),gi(M,o,null),P=!0},p(re,ce){const pe={};ce&2&&(pe.isOpen=re[1]),ce&2&&(pe.onClose=re[7]),ce&16418&&(pe.$$scope={dirty:ce,ctx:re}),a.$set(pe);const ke={};n.$set(ke);let Ce=h;h=ee(re),h===Ce?N[h].p(re,ce):(Bs(),Cr(N[Ce],1,1,()=>{N[Ce]=null}),Ps(),v=N[h],v?v.p(re,ce):(v=N[h]=V[h](re),v.c()),hr(v,1),v.m(o,g)),ce&3&&(J=re[0],Bs(),O=PK(O,ce,K,1,re,J,A,o,BK,oq,S,rq),Ps())},i(re){if(!P){hr(a.$$.fragment,re),hr(n.$$.fragment,re),hr(v);for(let ce=0;ce<J.length;ce+=1)hr(O[ce]);hr(M.$$.fragment,re),P=!0}},o(re){Cr(a.$$.fragment,re),Cr(n.$$.fragment,re),Cr(v);for(let ce=0;ce<O.length;ce+=1)Cr(O[ce]);Cr(M.$$.fragment,re),P=!1},d(re){re&&br(o),vi(a),c[8](null),vi(n),N[h].d();for(let ce=0;ce<O.length;ce+=1)O[ce].d();vi(M)}}}function D0e(c){let o,a,i,n=c[5]("menu.trainer.notConnected1")+"",s,h,v,g=c[5]("menu.trainer.notConnected2")+"",O,A,S;return{c(){o=an("div"),a=an("div"),i=an("p"),s=Sr(n),h=or(),v=an("p"),O=Sr(g),A=or(),S=an("div"),S.innerHTML='<img class="m-auto" src="imgs/down_arrow.svg" alt="down arrow icon" width="100px"/>',Qt(i,"class","w-4/5 text-white text-3xl bold m-auto"),Qt(v,"class","w-4/5 text-white text-3xl bold m-auto"),Qt(S,"class","text-center ml-auto mr-auto mb-2 mt-10 "),Qt(a,"class","w-full"),Qt(o,"class","w-full h-full grid grid-cols-1 items-center place-items-center text-center")},m(M,P){_r(M,o,P),ft(o,a),ft(a,i),ft(i,s),ft(a,h),ft(a,v),ft(v,O),ft(a,A),ft(a,S)},p(M,P){P&32&&n!==(n=M[5]("menu.trainer.notConnected1")+"")&&Ur(s,n),P&32&&g!==(g=M[5]("menu.trainer.notConnected2")+"")&&Ur(O,g)},i:Fi,o:Fi,d(M){M&&br(o)}}}function T0e(c){let o=c[5]("footer.connectButtonNotConnected")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&32&&o!==(o=i[5]("footer.connectButtonNotConnected")+"")&&Ur(a,o)},d(i){i&&br(a)}}}
9063function N0e(c){let o,a,i=c[5]("content.data.addDataNoConnection")+"",n,s,h,v;return h=new vl({props:{onClick:c[6],$$slots:{default:[T0e]},$$scope:{ctx:c}}}),{c(){o=an("div"),a=an("p"),n=Sr(i),s=or(),xi(h.$$.fragment),Qt(a,"class","mb-5"),Qt(o,"class","w-70 text-center")},m(g,O){_r(g,o,O),ft(o,a),ft(a,n),ft(o,s),gi(h,o,null),v=!0},p(g,O){(!v||O&32)&&i!==(i=g[5]("content.data.addDataNoConnection")+"")&&Ur(n,i);const A={};O&2&&(A.onClick=g[6]),O&16416&&(A.$$scope={dirty:O,ctx:g}),h.$set(A)},i(g){v||(hr(h.$$.fragment,g),v=!0)},o(g){Cr(h.$$.fragment,g),v=!1},d(g){g&&br(o),vi(h)}}}function I0e(c){let o,a,i,n=c[5]("content.data.noData")+"",s;return{c(){o=an("div"),a=an("div"),i=an("p"),s=Sr(n),Qt(a,"class","text-center text-xl w-1/2 text-bold text-white"),Qt(o,"class","flex justify-center")},m(h,v){_r(h,o,v),ft(o,a),ft(a,i),ft(i,s)},p(h,v){v&32&&n!==(n=h[5]("content.data.noData")+"")&&Ur(s,n)},i:Fi,o:Fi,d(h){h&&br(o)}}}function M0e(c){let o,a,i,n,s,h,v,g=c[3](),O;i=new Vx({props:{iconText:c[5]("content.data.classification"),titleText:c[5]("content.data.classHelpHeader"),bodyText:c[5]("content.data.classHelpBody")}}),h=new PY({props:{text:c[5]("content.data.choice"),$$slots:{default:[F0e]},$$scope:{ctx:c}}});let A=g&&iq(c);return{c(){o=an("div"),a=an("div"),xi(i.$$.fragment),n=or(),s=an("div"),xi(h.$$.fragment),v=or(),A&&A.c(),Qt(a,"class","absolute left-3 flex"),Qt(s,"class","absolute left-55 flex"),Qt(o,"class","p-0 relative flex h-7")},m(S,M){_r(S,o,M),ft(o,a),gi(i,a,null),ft(o,n),ft(o,s),gi(h,s,null),ft(o,v),A&&A.m(o,null),O=!0},p(S,M){const P={};M&32&&(P.iconText=S[5]("content.data.classification")),M&32&&(P.titleText=S[5]("content.data.classHelpHeader")),M&32&&(P.bodyText=S[5]("content.data.classHelpBody")),i.$set(P);const L={};M&32&&(L.text=S[5]("content.data.choice")),M&16384&&(L.$$scope={dirty:M,ctx:S}),h.$set(L),M&8&&(g=S[3]()),g?A?(A.p(S,M),M&8&&hr(A,1)):(A=iq(S),A.c(),hr(A,1),A.m(o,null)):A&&(Bs(),Cr(A,1,1,()=>{A=null}),Ps())},i(S){O||(hr(i.$$.fragment,S),hr(h.$$.fragment,S),hr(A),O=!0)},o(S){Cr(i.$$.fragment,S),Cr(h.$$.fragment,S),Cr(A),O=!1},d(S){S&&br(o),vi(i),vi(h),A&&A.d()}}}function F0e(c){let o,a;return o=new Fge({}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function iq(c){let o,a,i;return a=new Vx({props:{iconText:c[5]("content.data.data"),titleText:c[5]("content.data.data"),bodyText:c[5]("content.data.dataDescription")}}),{c(){o=an("div"),xi(a.$$.fragment),Qt(o,"class","absolute left-92 flex")},m(n,s){_r(n,o,s),gi(a,o,null),i=!0},p(n,s){const h={};s&32&&(h.iconText=n[5]("content.data.data")),s&32&&(h.titleText=n[5]("content.data.data")),s&32&&(h.bodyText=n[5]("content.data.dataDescription")),a.$set(h)},i(n){i||(hr(a.$$.fragment,n),i=!0)},o(n){Cr(a.$$.fragment,n),i=!1},d(n){n&&br(o),vi(a)}}}function oq(c,o){let a,i,n,s;function h(g){o[10](g,o[11],o[12],o[13])}let v={onNoMicrobitSelect:o[9]};return o[11]!==void 0&&(v.gesture=o[11]),i=new Sge({props:v}),l1.push(()=>jK(i,"gesture",h)),{key:c,first:null,c(){a=Cm(),xi(i.$$.fragment),this.first=a},m(g,O){_r(g,a,O),gi(i,g,O),s=!0},p(g,O){o=g;const A={};O&2&&(A.onNoMicrobitSelect=o[9]),!n&&O&1&&(n=!0,A.gesture=o[11],IK(()=>n=!1)),i.$set(A)},i(g){s||(hr(i.$$.fragment,g),s=!0)},o(g){Cr(i.$$.fragment,g),s=!1},d(g){g&&br(a),vi(i,g)}}}function R0e(c){let o,a,i,n,s;const h=[D0e,O0e],v=[];function g(O,A){return A&24&&(o=null),o==null&&(o=!O[3]()&&!O[4].isInputConnected),o?0:1}return a=g(c,-1),i=v[a]=h[a](c),{c(){i.c(),n=Cm()},m(O,A){v[a].m(O,A),_r(O,n,A),s=!0},p(O,[A]){let S=a;a=g(O,A),a===S?v[a].p(O,A):(Bs(),Cr(v[S],1,1,()=>{v[S]=null}),Ps(),i=v[a],i?i.p(O,A):(i=v[a]=h[a](O),i.c()),hr(i,1),i.m(n.parentNode,n))},i(O){s||(hr(i),s=!0)},o(O){Cr(i),s=!1},d(O){v[a].d(O),O&&br(n)}}}function B0e(c,o,a){let i,n,s,h;Vi(c,Jd,L=>a(0,n=L)),Vi(c,No,L=>a(4,s=L)),Vi(c,La,L=>a(5,h=L));let v=!1,g;const O=()=>{a(1,v=!1),KK()},A=()=>a(1,v=!1);function S(L){l1[L?"unshift":"push"](()=>{g=L,a(2,g)})}const M=()=>a(1,v=!0);function P(L,V,N,ee){N[ee]=L,Jd.set(n)}return c.$$.update=()=>{c.$$.dirty&1&&a(3,i=()=>n.length===0?!1:n.some(L=>L.recordings.length>0))},[n,v,g,i,s,h,O,A,S,M,P]}class P0e extends $o{constructor(o){super(),Vo(this,o,B0e,R0e,jo,{})}}class j0e extends h4{navigate(o){o.setContentComponent(P0e),f1.openMenu(0)}}function aq(c){return c.reduce(function(i,n){return i+n},0)/c.length}function S5(c){const o=aq(c),a=c.map(function(s){const h=s-o;return h*h}),i=aq(a);return Math.sqrt(i)}function A5(c){return c.reduce((o,a)=>
9063o+Math.abs(a))}function L0e(c){return c.reduce((o,a)=>o+a)}function B6(c){return L0e(c)/c.length}function sq(c){const o=B6(c),a=function(i,n){return i+(n-o)*(n-o)};return Math.sqrt(c.reduce(a,0)/c.length)}function O5(c,o){const a=o||{},i=a.lag||5,n=a.threshold||3.5,s=a.influence||.5;let h=0;if(c===void 0||c.length<i+2)throw` ## y data array to short(${c.length}) for given lag of ${i}`;const v=Array(c.length).fill(0),g=c.slice(0),O=c.slice(0,i),A=[];A[i-1]=B6(O);const S=[];S[i-1]=sq(O);for(let M=i;M<c.length;M++){Math.abs(c[M]-A[M-1])>.1&&Math.abs(c[M]-A[M-1])>n*S[M-1]?(c[M]>A[M-1]?(v[M]=1,M-1>0&&v[M-1]==0&&h++):v[M]=-1,g[M]=s*c[M]+(1-s)*g[M-1]):(v[M]=0,g[M]=c[M]);const P=g.slice(M-i,M);A[M]=B6(P),S[M]=sq(P)}return{numPeaks:h,results:v}}let Pk;La.subscribe(c=>Pk=c);let Ac,LY,HT,w2;function z0e(){if(No.update(n=>(n.isTraining=!0,n)),!W0e()){No.update(n=>(n.isTraining=!1,n));return}Ig(Pk("alert.beginModelSetup"));const c=$0e();Wo(Jd).forEach(n=>{const s={gesture:String(n.ID)};n.recordings.forEach(h=>{const v=h.data.x,g=h.data.y,O=h.data.z,A=xP(v,g,O);c.addData(A,s)})}),c.normalizeData(),c.data.training.forEach(n=>
9063{Object.keys(n.xs).forEach(s=>{isNaN(n.xs[s]??"NaN")&&(n.xs[s]=0)})});const a={epochs:Wo(gl).numEpochs};Ig(Pk("alert.trainingModel")),tP.set(c),LY=new Promise(n=>{setTimeout(()=>{n(!0)},2500)}),c.train(a,G0e,H0e);const i=document.getElementById("tfjs-visor-container");i!=null&&(i.style.display="none")}function U0e(){const c=Wo(gl);return c.includedAxes.reduce((o,a)=>o||a)&&c.includedParameters.reduce((o,a)=>o||a)}function W0e(c=!0){const o=Wo(Jd);return!o||o.length<2?(c&&F2(Pk("alert.twoGestures")),!1):U0e()?!!V0e(o,c):(c&&F2(Pk("alert.oneDataRepresentation")),!1)}function V0e(c,o){let a=!0;return c.forEach(i=>{i.recordings.length<3&&(o&&F2(Pk("alert.recordingsPerGesture")),a=!1)}),a}function $0e(){Ac={axes:Wo(gl).includedAxes,params:Wo(gl).includedParameters};const c={inputs:X0e(Ac),task:"classification",debug:"false",learningRate:Wo(gl).learningRate};return S6.neuralNetwork(c)}function H0e(){LY.then(()=>{No.update(n=>(n.isTraining=!1,n));const{x:c,y:o,z:a}=GK(),i=xP(c,o,a);Wo(tP).classify(i,q0e)})}function q0e(c,o){if(c!==void 0){vN.update(()=>nA.Failure);return}for(const a of o)if(isNaN(a.confidence)){vN.update(()=>nA.Failure);return}UY()}function G0e(c,o){const a=Wo(gl).numEpochs+1;hfe.set({percentage:Math.round(c/a*100),loss:o.val_loss,epochs:c})}const K0e=(c,o,a)=>{const n=s=>{let h=0;for(;h===0;)h=Math.random()*5e-14-5e-14;return s+h};return{peturb_x:c.map(s=>n(s)),peturb_y:o.map(s=>n(s)),peturb_z:a.map(s=>n(s))}};function xP(c,o,a){const i=K0e(c,o,a);c=i.peturb_x,o=i.peturb_y,a=i.peturb_z;const n={ax_max:void 0,ax_min:void 0,ax_std:void 0,ax_peaks:void 0,ax_total:void 0,ay_max:void 0,ay_min:void 0,ay_std:void 0,ay_peaks:void 0,ay_total:void 0,az_max:void 0,az_min:void 0,az_std:void 0,az_peaks:void 0,az_total:void 0};return Ac||(Ac={axes:Wo(gl).includedAxes,params:Wo(gl).includedParameters}),Ac.axes[0]&&(Ac.params[0]&&(n.ax_max=Math.max(...c)),Ac.params[1]&&(n.ax_min=Math.min(...c)),Ac.params[2]&&(n.ax_std=S5(c)),Ac.params[3]&&(n.ax_peaks=O5(c).numPeaks),Ac.params[4]&&(n.ax_total=A5(c))),Ac.axes[1]&&(Ac.params[0]&&(n.ay_max=Math.max(...o)),Ac.params[1]&&(n.ay_min=Math.min(...o)),Ac.params[2]&&(n.ay_std=S5(o)),Ac.params[3]&&(n.ay_peaks=O5(o).numPeaks),Ac.params[4]&&(n.ay_total=A5(o))),Ac.axes[2]&&(Ac.params[0]&&(n.az_max=Math.max(...a)),Ac.params[1]&&(n.az_min=Math.min(...a)),Ac.params[2]&&(n.az_std=S5(a)),Ac.params[3]&&(n.az_peaks=O5(a).numPeaks),Ac.params[4]&&(n.az_total=A5(a))),n}function zY(c){No.update(o=>(o.isPredicting=c,o))}function UY(){zY(!0);const c=Wo(gl).updatesPrSecond,o=Wo(gl).automaticClassification;o&&(w2=setInterval(WY,1e3/c)),HT=gl.subscribe(a=>{(a.updatesPrSecond!==c||a.automaticClassification!==o)&&(w2!==void 0&&clearInterval(w2),w2=void 0,UY())})}function WY(){const c=Wo(No);if(!c.isPredicting||c.isRecording||c.isTraining){w2!==void 0&&clearInterval(w2),w2=void 0,zY(!1),HT==null||HT();return}if(!c.isInputConnected)return;const{x:a,y:i,z:n}=GK(),s=xP(a,i,n);Wo(tP).classify(s,Y0e)}function Y0e(c,o){if(c!==void 0){F2(c),console.error(c);return}let a=0,i;o.forEach(n=>{$K.update(s=>(s[n.label]=n.confidence,s)),n.confidence>a&&(a=n.confidence,i=n.label)});for(const n of Wo(Jd))String(n.ID)===i&&HK.set({...n,confidence:a})}function X0e(c){const o=["ax_max","ax_min","ax_std","ax_peaks","ax_total","ay_max","ay_min","ay_std","ay_peaks","ay_total","az_max","az_min","az_std","az_peaks","az_total"],a=[];for(let i=0;i<c.axes.length;i++)for(let n=0;n<c.params.length;n++)if(c.axes[i]&&c.params[n]){const s=i*5+n;a.push(o[s])}return a}function uq(c){let o,a;return o=new vl({props:{color:"pink",onClick:z0e,$$slots:{default:[J0e]},$$scope:{ctx:c}}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&22&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function J0e(c){let o=c[2](c[1])+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&6&&o!==(o=i[2](i[1])+"")&&Ur(a,o)},d(i){i&&br(a)}}}function Q0e(c){let o,a,i=c[3]&&c[0].isInputConnected&&!c[0].isTraining&&uq(c);return{c(){i&&i.c(),o=Cm()},m(n,s){i&&i.m(n,s),_r(n,o,s),a=!0},p(n,[s]){n[3]&&n[0].isInputConnected&&!n[0].isTraining?i?(i.p(n,s),s&1&&hr(i,1)):(i=uq(n),i.c(),hr(i,1),i.m(o.parentNode,o)):i&&(Bs(),Cr(i,1,1,()=>{i=null}),Ps())},i(n){a||(hr(i),a=!0)},o(n){Cr(i),a=!1},d(n){i&&i.d(n),n&&br(o)}}}function Z0e(c,o,a){let i,n,s;Vi(c,No,v=>a(0,n=v)),Vi(c,La,v=>a(2,s=v));const h=YK();return c.$$.update=()=>{c.$$.dirty&1&&a(1,i=n.isPredicting?"menu.trainer.trainNewModelButton":"menu.trainer.trainModelButton")},[n,i,s,h]}class eve extends $o{constructor(o){super(),Vo(this,o,Z0e,Q0e,jo,{})}}function tve(c){let o,a,i,n=c[1]("content.trainer.failure.header")+"",s,h,v,g=c[1]("content.trainer.failure.body")+"",O,A,S,M=c[1]("content.trainer.failure.todo")+"",P,L,V;return{c(){o=an("div"),a=an("div"),i=an("p"),s=Sr(n),h=or(),v=an("p"),O=Sr(g),A=or(),S=an("p"),P=Sr(M),Qt(i,"class","text-red-500 font-bold text-center text-xl mb-5"),Qt(v,"class","mb-3"),Qt(S,"class","font-bold"),Qt(o,"class","justify-center items-center content-center w-150 bg-white m-auto")},m(N,ee){_r(N,o,ee),ft(o,a),ft(a,i),ft(i,s),ft(a,h),ft(a,v),ft(v,O),ft(a,A),ft(a,S),ft(S,P),V=!0},p(N,ee){(!V||ee&2)&&n!==(n=N[1]("content.trainer.failure.header")+"")&&Ur(s,n),(!V||ee&2)&&g!==(g=N[1]("content.trainer.failure.body")+"")&&Ur(O,g),(!V||ee&2)&&M!==(M=N[1]("content.trainer.failure.todo")+"")&&Ur(P,M)},i(N){V||(Ll(()=>{V&&(L||(L=Qd(o,bN,{},!0)),L.run(1))}),V=!0)},o(N){L||(L=Qd(o,bN,{},!1)),L.run(0),V=!1},d(N){N&&br(o),N&&L&&L.end()}}}function nve(c){let o,a,i,n,s,h=c[2].isPredicting&&cq(c);return n=new eve({}),{c(){o=an("div"),h&&h.c(),a=or(),i=an("div"),xi(n.$$.fragment),Qt(i,"class","w-full pt-5 text-white"),Qt(o,"class","w-3/4 text-white")},m(v,g){_r(v,o,g),h&&h.m(o,null),ft(o,a),ft(o,i),gi(n,i,null),s=!0},p(v,g){v[2].isPredicting?h?h.p(v,g):(h=cq(v),h.c(),h.m(o,a)):h&&(h.d(1),h=null)},i(v){s||(hr(n.$$.fragment,v),s=!0)},o(v){Cr(n.$$.fragment,v),s=!1},d(v){v&&br(o),h&&h.d(),vi(n)}}}function rve(c){let o,a,i,n,s=c[1]("menu.trainer.isTrainingModelButton")+"",h;return{c(){o=an("div"),a=an("div"),a.innerHTML='<i class="fa fa-solid fa-circle-notch text-5xl animate-spin animate-duration-[2s]"></i>',i=or(),n=an("p"),h=Sr(s),Qt(a,"class","ml-auto mr-auto flex center-items justify-center"),Qt(n,"class","text-white bold text-3xl bold mt-10"),Qt(o,"class","w-3/4 text-white")},m(v,g){_r(v,o,g),ft(o,a),ft(o,i),ft(o,n),ft(n,h)},p(v,g){g&2&&s!==(s=v[1]("menu.trainer.isTrainingModelButton")+"")&&Ur(h,s)},i:Fi,o:Fi,d(v){v&&br(o)}}}function ive(c){let o,a,i=c[1]("menu.trainer.notEnoughDataHeader1")+"",n,s,h,v=c[1]("menu.trainer.notEnoughDataInfoBody")+"",g;return{c(){o=an("div"),a=an("h1"),n=Sr(i),s=or(),h=an("p"),g=Sr(v),Qt(a,"class","w-3/4 text-white text-3xl bold m-auto"),Qt(h,"class","w-3/5 text-white text-xl m-auto mt-5"),Qt(o,"class","w-full")},m(O,A){_r(O,o,A),ft(o,a),ft(a,n),ft(o,s),ft(o,h),ft(h,g)},p(O,A){A&2&&i!==(i=O[1]("menu.trainer.notEnoughDataHeader1")+"")&&Ur(n,i),A&2&&v!==(v=O[1]("menu.trainer.notEnoughDataInfoBody")+"")&&Ur(g,v)},i:Fi,o:Fi,d(O){O&&br(o)}}}function ove(c){let o,a,i=c[1]("menu.trainer.notConnected1")+"",n,s,h,v=c[1]("menu.trainer.notConnected2")+"",g,O,A;return{c(){o=an("div"),a=an("p"),n=Sr(i),s=or(),h=an("p"),g=Sr(v),O=or(),A=an("div"),A.innerHTML='<img class="m-auto" src="imgs/down_arrow.svg" alt="down arrow icon" width="100px"/>',Qt(a,"class","w-4/5 text-white text-3xl bold m-auto"),Qt(h,"class","w-4/5 text-white text-3xl bold m-auto"),Qt(A,"class","text-center ml-auto mr-auto mb-2 mt-10 "),Qt(o,"class","w-full")},m(S,M){_r(S,o,M),ft(o,a),ft(a,n),ft(o,s),ft(o,h),ft(h,g),ft(o,O),ft(o,A)},p(S,M){M&2&&i!==(i=S[1]("menu.trainer.notConnected1")+"")&&Ur(n,i),M&2&&v!==(v=S[1]("menu.trainer.notConnected2")+"")&&Ur(g,v)},i:Fi,o:Fi,d(S){S&&br(o)}}}function cq(c){let o,a=c[1]("menu.trainer.TrainingFinished")+"",i,n,s,h=c[1]("menu.trainer.TrainingFinished.body")+"",v;return{c(){o=an("p"),i=Sr(a),n=or(),s=an("p"),v=Sr(h),Qt(o,"class","text-white bold text-3xl bold mt-10"),Qt(s,"class","text-white bold text-xl bold mt-10")},m(g,O){_r(g,o,O),ft(o,i),_r(g,n,O),_r(g,s,O),ft(s,v)},p(g,O){O&2&&a!==(a=g[1]("menu.trainer.TrainingFinished")+"")&&Ur(i,a),O&2&&h!==(h=g[1]("menu.trainer.TrainingFinished.body")+"")&&Ur(v,h)},d(g){g&&br(o),g&&br(n),g&&br(s)}}}function ave(c){let o,a,i,n,s,h;o=new Qk({props:{isOpen:c[0],onClose:c[5],$$slots:{default:[tve]},$$scope:{ctx:c}}});const v=[ove,ive,rve,nve],g=[];function O(A,S){return A[2].isInputConnected?A[3]?A[2].isTraining?2:3:1:0}return n=O(c),s=g[n]=v[n](c),{c(){xi(o.$$.fragment),a=or(),i=an("div"),s.c(),Qt(i,"class","w-full h-full grid grid-cols-1 items-center place-items-center text-center")},m(A,S){gi(o,A,S),_r(A,a,S),_r(A,i,S),g[n].m(i,null),h=!0},p(A,[S]){const M={};S&1&&(M.isOpen=A[0]),S&1&&(M.onClose=A[5]),S&66&&(M.$$scope={dirty:S,ctx:A}),o.$set(M);let P=n;n=O(A),n===P?g[n].p(A,S):(Bs(),Cr(g[P],1,1,()=>{g[P]=null}),Ps(),s=g[n],s?s.p(A,S):(s=g[n]=v[n](A),s.c()),hr(s,1),s.m(i,null))},i(A){h||(hr(o.$$.fragment,A),hr(s),h=!0)},o(A){Cr(o.$$.fragment,A),Cr(s),h=!1},d(A){vi(o,A),A&&br(a),A&&br(i),g[n].d()}}}function sve(c,o,a){let i,n,s;Vi(c,vN,O=>a(4,i=O)),Vi(c,La,O=>a(1,n=O)),Vi(c,No,O=>a(2,s=O));const h=YK();let v=!1;const g=()=>a(0,v=!1);return c.$$.update=()=>{c.$$.dirty&16&&i===nA.Failure&&(a(0,v=!0),vN.update(()=>nA.Untrained))},[v,n,s,h,i,g]}class uve extends $o{constructor(o){super(),Vo(this,o,sve,ave,jo,{})}}class cve extends h4{navigate(o){o.setContentComponent(uve),f1.openMenu(1)}}function lq(c,o,a){const i=c.slice();return i[10]=o[a],i[12]=a,i}function fq(c){let o,a,i,n;function s(){return c[5](c[12])}function h(...v){return c[6](c[12],...v)}return{c(){o=an("div"),Qt(o,"class",a=(c[10]?"bg-[#FF0000]":"bg-gray-300")+" rounded-[2px] transition ease svelte-1ht32nb"),Bi(o,"turnedOn",c[10]),Bi(o,"turnedOff",!c[10])},m(v,g){_r(v,o,g),i||(n=[sa(o,"mousedown",s),sa(o,"mouseenter",h)],i=!0)},p(v,g){c=v,g&1&&a!==(a=(c[10]?"bg-[#FF0000]":"bg-gray-300")+" rounded-[2px] transition ease svelte-1ht32nb")&&Qt(o,"class",a),g&1&&Bi(o,"turnedOn",c[10]),g&1&&Bi(o,"turnedOff",!c[10])},d(v){v&&br(o),i=!1,Ul(n)}}}function lve(c){let o,a=c[0],i=[];for(let n=0;n<a.length;n+=1)i[n]=fq(lq(c,a,n));return{c(){o=an("main");for(let n=0;n<i.length;n+=1)i[n].c();Qt(o,"class","buttonGrid h-18 w-18 select-none ml-0 svelte-1ht32nb")},m(n,s){_r(n,o,s);for(let h=0;h<i.length;h+=1)i[h]&&i[h].m(o,null)},p(n,[s]){if(s&7){a=n[0];let h;for(h=0;h<a.length;h+=1){const v=lq(n,a,h);i[h]?i[h].p(v,s):(i[h]=fq(v),i[h].c(),i[h].m(o,null))}for(;h<i.length;h+=1)i[h].d(1);i.length=a.length}},i:Fi,o:Fi,d(n){n&&br(o),Pv(i,n)}}}function fve(c,o,a){var i,n;const s=()=>{pu.isOutputReady()&&pu.setOutputMatrix(v)};let{gesture:h}
9063=o,v=(n=(i=h.output)===null||i===void 0?void 0:i.matrix)!==null&&n!==void 0?n:new Array(25).fill(!1),g=!0;function O(P){g=!v[P],a(0,v[P]=g,v),E$(h.ID,v)}function A(P,L){L.buttons===1&&(a(0,v[P]=g,v),E$(h.ID,v))}const S=P=>{O(P)},M=(P,L)=>{A(P,L)};return c.$$set=P=>{"gesture"in P&&a(4,h=P.gesture)},[v,O,A,s,h,S,M]}class dve extends $o{constructor(o){super(),Vo(this,o,fve,lve,jo,{trigger:3,gesture:4})}get trigger(){return this.$$.ctx[3]}}function dq(c,o,a){const i=c.slice();return i[8]=o[a],i}function hq(c){let o;return{c(){o=an("i"),Qt(o,"class","absolute top-42px left-38px fas fa-slash text-6xl text-[#63BFC2]")},m(a,i){_r(a,o,i)},d(a){a&&br(o)}}}function pq(c){let o,a,i,n,s=c[3],h=[];for(let v=0;v<s.length;v+=1)h[v]=mq(dq(c,s,v));return{c(){o=an("select");for(let v=0;v<h.length;v+=1)h[v].c();Qt(o,"class","bg-white border rounded text-center absolute bottom-2 ml-13px mr-13px w-120px"),o.disabled=a=!c[2],c[0]===void 0&&Ll(()=>c[5].call(o))},m(v,g){_r(v,o,g);for(let O=0;O<h.length;O+=1)h[O]&&h[O].m(o,null);Nk(o,c[0],!0),i||(n=[sa(o,"change",c[5]),sa(o,"change",c[6]),sa(o,"click",pve)],i=!0)},p(v,g){if(g&8){s=v[3];let O;for(O=0;O<s.length;O+=1){const A=dq(v,s,O);h[O]?h[O].p(A,g):(h[O]=mq(A),h[O].c(),h[O].m(o,null))}for(;O<h.length;O+=1)h[O].d(1);h.length=s.length}g&4&&a!==(a=!v[2])&&(o.disabled=a),g&9&&Nk(o,v[0])},d(v){v&&br(o),Pv(h,v),i=!1,Ul(n)}}}function mq(c){let o,a=c[8].name+"",i;return{c(){o=an("option"),i=Sr(a),o.__value=c[8],o.value=o.__value},m(n,s){_r(n,o,s),ft(o,i)},p:Fi,d(n){n&&br(o)}}}function hve(c){let o,a,i,n,s,h,v=!c[2]&&hq(),g=c[2]&&pq(c);return{c(){o=an("main"),a=an("i"),i=or(),v&&v.c(),n=or(),g&&g.c(),Qt(a,"class","absolute text-center top-42px left-38px fa fa-volume-up text-6xl text-[#63BFC2]"),Qt(o,"class","h-146px w-146px ml-8 self-center items-center border-5 heavy-shadow border-solid border bg-white rounded-lg cursor-pointer relative svelte-trr64q")},m(O,A){_r(O,o,A),ft(o,a),ft(o,i),v&&v.m(o,null),ft(o,n),g&&g.m(o,null),s||(h=sa(o,"click",c[4]),s=!0)},p(O,[A]){O[2]?v&&(v.d(1),v=null):v||(v=hq(),v.c(),v.m(o,n)),O[2]?g?g.p(O,A):(g=pq(O),g.c(),g.m(o,null)):g&&(g.d(1),g=null)},i:Fi,o:Fi,d(O){O&&br(o),v&&v.d(),g&&g.d(),s=!1,h()}}}const pve=c=>{c.stopPropagation()};function mve(c,o,a){let i;Vi(c,La,S=>a(7,i=S));let{onSoundSelection:n}=o,{selectedSound:s=void 0}=o,h=!1;const v=[{name:i("content.model.output.soundOptionCongratulations"),id:"0",path:"sounds/congratulations.wav"},{name:i("content.model.output.soundOptionHighPitchBeep"),id:"1",path:"sounds/high_pitch.wav"},{name:i("content.model.output.soundOptionLowPitchBeep"),id:"2",path:"sounds/low_pitch.wav"},{name:i("content.model.output.soundOptionLoser"),id:"3",path:"sounds/looser.wav"},{name:i("content.model.output.soundOptionMistake"),id:"4",path:"sounds/mistake.mp3"},{name:i("content.model.output.soundOptionHugeMistake"),id:"5",path:"sounds/huge_mistake.wav"}];function g(){a(2,h=!h),h?(s===void 0&&a(0,s=v[0]),n(s)):n(void 0)}Zx(()=>{if(a(2,h=s!==void 0),!!h){for(let S=0;S<v.length;S++)if(s!==void 0&&s.id===v[S].id){a(0,s=v[S]);return}a(0,s=v[0]),a(2,h=!1),n(void 0)}});function O(){s=QB(this),a(0,s),a(3,v)}const A=()=>n(s);return c.$$set=S=>{"onSoundSelection"in S&&a(1,n=S.onSoundSelection),"selectedSound"in S&&a(0,s=S.selectedSound)},[s,n,h,v,g,O,A]}class gve extends $o{constructor(o){super(),Vo(this,o,mve,hve,jo,{onSoundSelection:1,selectedSound:0})}}function vve(c,o,a){const i=c.slice();return i[17]=o[a],i}function yve(c){let o,a,i,n,s;return{c(){o=an("div"),a=an("p"),i=Sr(c[17]),n=Sr("%"),s=or(),Qt(a,"class","absolute text-xs"),Fs(a,"margin-top","-8px"),Fs(a,"margin-left","18px"),Qt(o,"class","w-5 bg-gray-300 mt-6"),Fs(o,"height","1px")},m(h,v){_r(h,o,v),ft(o,a),ft(a,i),ft(a,n),ft(o,s)},p:Fi,d(h){h&&br(o)}}}function bve(c){let o,a,i,n,s=c[0].name+"",h,v,g,O,A,S,M,P,L,V,N,ee,J,K,re,ce,pe,ke,Ce,be,$e,ht,Dt,Ut,Ee,Ot,zt,Mt,Ke,Tt,vt,yt,bt,Ht,_t=[75,50,25],Ze=[];for(let yn=0;yn<3;yn+=1)Ze[yn]=yve(vve(c,_t,yn));pe=new Vx({props:{titleText:c[8]("content.model.classification.helpHeading"),bodyText:c[8]("content.model.classification.helpBody"),isLightTheme:!1}}),Ee=new Jk({props:{src:"imgs/blank_microbit.svg",alt:"microbit guide",width:180,height:146,loadingColorSecondary:"#818181",loadingColorPrimary:"#4A4A4A",onLoaded:c[11]}});function Vt(yn){c[12](yn)}let sn={gesture:c[0]};return c[5][0]!==void 0&&(sn.trigger=c[5][0]),Mt=new dve({props:sn}),l1.push(()=>jK(Mt,"trigger",Vt)),vt=new gve({props:{onSoundSelection:c[9],selectedSound:c[6]}}),{c(){o=an("main"),a=an("div"),i=an("div"),n=an("h3"),h=Sr(s),v=or(),g=an("input"),O=or(),A=an("div"),S=an("div"),M=an("div"),L=or(),V=an("div"),N=or(),ee=an("div");for(let yn=0;yn<3;yn+=1)Ze[yn].c();J=or(),K=an("div"),re=or(),ce=an("div"),xi(pe.$$.fragment),ke=or(),Ce=an("div"),be=an("img"),ht=or(),Dt=an("div"),Ut=an("div"),xi(Ee.$$.fragment),Ot=or(),zt=an("div"),xi(Mt.$$.fragment),Tt=or(),xi(vt.$$.fragment),Qt(i,"class","w-36 text-center font-semibold rounded-xl px-1 py-1 border border-gray-300 border-solid mr-2 break-words"),Qt(g,"class","h-25 rotate-90 svelte-1yiou4w"),Qt(g,"type","range"),Qt(g,"orient","vertical"),Qt(g,"name",""),Qt(g,"min","10"),Qt(g,"max","90"),Qt(g,"id",""),Qt(M,"class",P="absolute w-5 "+(c[2]?"bg-blue-500":"bg-gray-400")+" z-index: -10"),Fs(M,"height",100*c[4][c[0].ID]+"px"),Fs(M,"margin-top",100-100*c[4][c[0].ID]+"px"),Qt(V,"class","absolute w-5 bg-blue-500"),Fs(V,"height","1px"),Fs(V,"margin-top",6.5-.068*c[3]+"rem"),Qt(ee,"class","absolute"),Qt(S,"class","w-4 h-full absolute rounded border border-solid border-gray-400 overflow-hidden"),Qt(A,"class","w-4 h-25 relative"),Qt(ce,"class","relative float-right h-full mt-2"),Fs(ce,"top","-12px"),Qt(a,"class","h-146px heavy-shadow self-center items-center flex border border-solid border-gray-200 p-2 bg-white rounded-xl svelte-1yiou4w"),Qt(be,"class","m-auto "),Qx(be.src,$e=c[2]?"imgs/right_arrow_blue.svg":"imgs/right_arrow.svg")||Qt(be,"src",$e),Qt(be,"alt","right arrow icon"),Qt(be,"width","30px"),Qt(Ce,"class","text-center ml-auto mr-auto"),Bi(Ce,"invert",c[2]),Qt(zt,"class","bg-black p-0 m-0 absolute top-10 left-13.5 w-18 h-18"),Bi(zt,"hidden",!c[7]),Qt(Ut,"class","w-180px relative rounded-xl bg-transparent heavy-shadow h-full svelte-1yiou4w"),Qt(Dt,"class","relative flex items-center"),Qt(o,"class","pl-3 mb-4 justify-center items-center layout-grid svelte-1yiou4w")},m(yn,Yt){_r(yn,o,Yt),ft(o,a),ft(a,i),ft(i,n),ft(n,h),ft(a,v),ft(a,g),_$(g,c[3]),ft(a,O),ft(a,A),ft(A,S),ft(S,M),ft(S,L),ft(S,V),ft(S,N),ft(S,ee);for(let We=0;We<3;We+=1)Ze[We]&&Ze[We].m(ee,null);ft(S,J),ft(S,K),ft(a,re),ft(a,ce),gi(pe,ce,null),ft(o,ke),ft(o,Ce),ft(Ce,be),ft(o,ht),ft(o,Dt),ft(Dt,Ut),gi(Ee,Ut,null),ft(Ut,Ot),ft(Ut,zt),gi(Mt,zt,null),ft(Dt,Tt),gi(vt,Dt,null),yt=!0,bt||(Ht=[sa(g,"change",c[10]),sa(g,"input",c[10]),sa(zt,"click",function(){Fg(c[1])&&c[1].apply(this,arguments)})],bt=!0)},p(yn,[Yt]){c=yn,(!yt||Yt&1)&&s!==(s=c[0].name+"")&&Ur(h,s),Yt&8&&_$(g,c[3]),(!yt||Yt&4&&P!==(P="absolute w-5 "+(c[2]?"bg-blue-500":"bg-gray-400")+" z-index: -10"))&&Qt(M,"class",P),(!yt||Yt&17)&&Fs(M,"height",100*c[4][c[0].ID]+"px"),(!yt||Yt&17)&&Fs(M,"margin-top",100-100*c[4][c[0].ID]+"px"),(!yt||Yt&8)&&Fs(V,"margin-top",6.5-.068*c[3]+"rem");const We={};Yt&256&&(We.titleText=c[8]("content.model.classification.helpHeading")),Yt&256&&(We.bodyText=c[8]("content.model.classification.helpBody")),pe.$set(We),(!yt||Yt&4&&!Qx(be.src,$e=c[2]?"imgs/right_arrow_blue.svg":"imgs/right_arrow.svg"))&&Qt(be,"src",$e),(!yt||Yt&4)&&Bi(Ce,"invert",c[2]);const Ye={};Yt&128&&(Ye.onLoaded=c[11]),Ee.$set(Ye);const He={};Yt&1&&(He.gesture=c[0]),!Ke&&Yt&32&&(Ke=!0,He.trigger=c[5][0],IK(()=>
9063Ke=!1)),Mt.$set(He),(!yt||Yt&128)&&Bi(zt,"hidden",!c[7]);const dt={};Yt&64&&(dt.selectedSound=c[6]),vt.$set(dt)},i(yn){yt||(hr(pe.$$.fragment,yn),hr(Ee.$$.fragment,yn),hr(Mt.$$.fragment,yn),hr(vt.$$.fragment,yn),yt=!0)},o(yn){Cr(pe.$$.fragment,yn),Cr(Ee.$$.fragment,yn),Cr(Mt.$$.fragment,yn),Cr(vt.$$.fragment,yn),yt=!1},d(yn){yn&&br(o),Pv(Ze,yn),vi(pe),vi(Ee),vi(Mt),vi(vt),bt=!1,Ul(Ht)}}}function xve(c,o,a){let i,n,s;Vi(c,gl,re=>a(13,i=re)),Vi(c,$K,re=>a(4,n=re)),Vi(c,La,re=>a(8,s=re));let{gesture:h}=o,{onUserInteraction:v=()=>{}}=o,g=!1,O=[],A=h.output.sound,S=80;function M(re){a(6,A=re),dfe(h.ID,re),v()}function P(){A!==void 0&&pu.isOutputAssigned()&&(pu.getAssignedOutput().getVersion()===1?new Audio(A.path).play():pu.sendToOutputUart("s",A.id))}function L(re,ce,pe){return a(2,g=re<=ce*100),g?i.automaticClassification?!pe:!0:!1}const V=()=>O.forEach(re=>{re()});let N=!1;function ee(){S=Fle(this.value),a(3,S)}const J=()=>a(7,N=!0);function K(re){c.$$.not_equal(O[0],re)&&(O[0]=re,a(5,O))}return c.$$set=re=>{"gesture"in re&&a(0,h=re.gesture),"onUserInteraction"in re&&a(1,v=re.onUserInteraction)},c.$$.update=()=>{c.$$.dirty&29&&L(S,n[h.ID],g)&&(V(),P())},[h,v,g,S,n,O,A,N,s,M,ee,J,K]}class wve extends $o{constructor(o){super(),Vo(this,o,xve,bve,jo,{gesture:0,onUserInteraction:1})}}function gq(c,o,a){const i=c.slice();return i[12]=o[a],i}function _ve(c){let o,a,i=c[3]("content.model.trainModelFirstHeading")+"",n,s,h,v,g=c[3]("content.model.trainModelFirstBody")+"",O;return{c(){o=an("div"),a=an("p"),n=Sr(i),s=or(),h=an("br"),v=or(),O=Sr(g),Qt(a,"class","w-3/4 text-white text-3xl bold"),Qt(o,"class","w-full h-full grid grid-cols-1 items-center place-items-center text-center")},m(A,S){_r(A,o,S),ft(o,a),ft(a,n),ft(a,s),ft(a,h),ft(a,v),ft(a,O)},p(A,S){S&8&&i!==(i=A[3]("content.model.trainModelFirstHeading")+"")&&Ur(n,i),S&8&&g!==(g=A[3]("content.model.trainModelFirstBody")+"")&&Ur(O,g)},i:Fi,o:Fi,d(A){A&&br(o)}}}function kve(c){let o,a,i,n,s,h,v,g,O,A,S,M,P,L;i=new Vx({props:{iconText:c[3]("content.model.output.prediction.iconTitle"),titleText:c[3]("content.model.output.prediction.descriptionTitle"),bodyText:c[3]("content.model.output.prediction.descriptionBody")}}),h=new Vx({props:{iconText:c[3]("content.model.output.ledOutput.descriptionTitle"),titleText:c[3]("content.model.output.ledOutput.descriptionTitle"),bodyText:c[3]("content.model.output.ledOutput.descriptionBody")}}),O=new Vx({props:{iconText:c[3]("content.model.output.sound.iconTitle"),titleText:c[3]("content.model.output.sound.descriptionTitle"),bodyText:c[3]("content.model.output.sound.descriptionBody")}});let V=c[4],N=[];for(let K=0;K<V.length;K+=1)N[K]=vq(gq(c,V,K));const ee=K=>Cr(N[K],1,1,()=>{N[K]=null});let J=!c[2].isOutputConnected&&!c[0]&&c[1]&&yq(c);return{c(){o=an("div"),a=an("div"),xi(i.$$.fragment),n=or(),s=an("div"),xi(h.$$.fragment),v=or(),g=an("div"),xi(O.$$.fragment),A=or(),S=an("div");for(let K=0;K<N.length;K+=1)N[K].c();M=or(),J&&J.c(),P=Cm(),Qt(a,"class","absolute left-5 flex"),Qt(s,"class","absolute left-69 flex"),Qt(g,"class","absolute left-122 flex"),Qt(o,"class","p-0 relative flex h-31 pt-24"),Qt(S,"class","w-729px pt-0 pl-2")},m(K,re){_r(K,o,re),ft(o,a),gi(i,a,null),ft(o,n),ft(o,s),gi(h,s,null),ft(o,v),ft(o,g),gi(O,g,null),_r(K,A,re),_r(K,S,re);for(let ce=0;ce<N.length;ce+=1)N[ce]&&N[ce].m(S,null);_r(K,M,re),J&&J.m(K,re),_r(K,P,re),L=!0},p(K,re){const ce={};re&8&&(ce.iconText=K[3]("content.model.output.prediction.iconTitle")),re&8&&(ce.titleText=K[3]("content.model.output.prediction.descriptionTitle")),re&8&&(ce.bodyText=K[3]("content.model.output.prediction.descriptionBody")),i.$set(ce);const pe={};re&8&&(pe.iconText=K[3]("content.model.output.ledOutput.descriptionTitle")),re&8&&(pe.titleText=K[3]("content.model.output.ledOutput.descriptionTitle")),re&8&&(pe.bodyText=K[3]("content.model.output.ledOutput.descriptionBody")),h.$set(pe);const ke={};if(re&8&&(ke.iconText=K[3]("content.model.output.sound.iconTitle")),re&8&&(ke.titleText=K[3]("content.model.output.sound.descriptionTitle")),re&8&&(ke.bodyText=K[3]("content.model.output.sound.descriptionBody")),O.$set(ke),re&48){V=K[4];let Ce;for(Ce=0;Ce<V.length;
9063Ce+=1){const be=gq(K,V,Ce);N[Ce]?(N[Ce].p(be,re),hr(N[Ce],1)):(N[Ce]=vq(be),N[Ce].c(),hr(N[Ce],1),N[Ce].m(S,null))}for(Bs(),Ce=V.length;Ce<N.length;Ce+=1)ee(Ce);Ps()}!K[2].isOutputConnected&&!K[0]&&K[1]?J?(J.p(K,re),re&7&&hr(J,1)):(J=yq(K),J.c(),hr(J,1),J.m(P.parentNode,P)):J&&(Bs(),Cr(J,1,1,()=>{J=null}),Ps())},i(K){if(!L){hr(i.$$.fragment,K),hr(h.$$.fragment,K),hr(O.$$.fragment,K);for(let re=0;re<V.length;re+=1)hr(N[re]);hr(J),L=!0}},o(K){Cr(i.$$.fragment,K),Cr(h.$$.fragment,K),Cr(O.$$.fragment,K),N=N.filter(Boolean);for(let re=0;re<N.length;re+=1)Cr(N[re]);Cr(J),L=!1},d(K){K&&br(o),vi(i),vi(h),vi(O),K&&br(A),K&&br(S),Pv(N,K),K&&br(M),J&&J.d(K),K&&br(P)}}}function vq(c){let o,a;return o=new wve({props:{gesture:c[12],onUserInteraction:c[5]}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&16&&(s.gesture=i[12]),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function yq(c){let o,a,i,n,s=c[3]("content.model.output.popup.header")+"",h,v,g,O=c[3]("content.model.output.popup.body")+"",A,S,M,P,L,V,N,ee,J,K;return{c(){o=an("div"),a=an("div"),i=an("div"),n=an("p"),h=Sr(s),v=or(),g=an("p"),A=Sr(O),S=or(),M=an("div"),M.innerHTML='<img class="m-auto" src="imgs/down_arrow.svg" alt="down arrow icon" width="80px"/>',P=or(),L=an("div"),V=an("button"),V.innerHTML='<i class="fas fa-plus text-lg text-gray-600 hover:text-gray-800 duration-75 svelte-1rnkjvh" style="transform: rotate(45deg);"></i>',Qt(n,"class","text-2xl font-bold"),Qt(i,"class","m-4 mr-2 w-3/4"),Qt(M,"class","text-center ml-0 mb-2 mt-8"),Qt(V,"class","hover:bg-gray-100 rounded outline-transparent w-8 svelte-1rnkjvh"),Qt(L,"class","absolute right-2 top-2 svelte-1rnkjvh"),Qt(a,"class","flex relative col-start-2 rounded-lg col-end-5 h-35"),Fs(a,"background-color","rgba(231, 229, 228, 0.85)"),Qt(o,"class","grid grid-cols-5 absolute bottom-5 w-full min-w-729px")},m(re,ce){_r(re,o,ce),ft(o,a),ft(a,i),ft(i,n),ft(n,h),ft(i,v),ft(i,g),ft(g,A),ft(a,S),ft(a,M),ft(a,P),ft(a,L),ft(L,V),ee=!0,J||(K=sa(V,"click",c[7]),J=!0)},p(re,ce){(!ee||ce&8)&&s!==(s=re[3]("content.model.output.popup.header")+"")&&Ur(h,s),(!ee||ce&8)&&O!==(O=re[3]("content.model.output.popup.body")+"")&&Ur(A,O)},i(re){ee||(Ll(()=>{ee&&(N||(N=Qd(o,ew,{},!0)),N.run(1))}),ee=!0)},o(re){N||(N=Qd(o,ew,{},!1)),N.run(0),ee=!1},d(re){re&&br(o),re&&N&&N.end(),J=!1,K()}}}function Eve(c){let o,a,i,n;const s=[kve,_ve],h=[];function v(g,O){return g[2].isPredicting?0:1}return a=v(c),i=h[a]=s[a](c),{c(){o=an("main"),i.c(),Qt(o,"class","w-full h-full relative")},m(g,O){_r(g,o,O),h[a].m(o,null),n=!0},p(g,[O]){let A=a;a=v(g),a===A?h[a].p(g,O):(Bs(),Cr(h[A],1,1,()=>{h[A]=null}),Ps(),i=h[a],i?i.p(g,O):(i=h[a]=s[a](g),i.c()),hr(i,1),i.m(o,null))},i(g){n||(hr(i),n=!0)},o(g){Cr(i),n=!1},d(g){g&&br(o),h[a].d()}}}function Cve(c,o,a){let i,n,s,h;Vi(c,yN,L=>a(6,i=L)),Vi(c,No,L=>a(2,n=L)),Vi(c,La,L=>a(3,s=L)),Vi(c,Jd,L=>a(4,h=L));let v=!1,g=!1;function O(){a(1,g=!0)}function A(){if(!FS())return;fu(No,n.isRecording=!0,n),Ig("Optager");const L=Wo(gl).duration,V=setInterval(()=>{},L/30);setTimeout(()=>{clearInterval(V),fu(No,n.isRecording=!1,n),WY()},L)}function S(L){if(M)return;!Wo(gl).automaticClassification&&(L.buttonA===1||L.buttonB===1)&&A()}let M=!0;Zx(()=>{M=!1});const P=()=>{a(0,v=!0)};return c.$$.update=()=>{c.$$.dirty&64&&S(i)},[v,g,n,s,h,O,i,P]}class Sve extends $o{constructor(o){super(),Vo(this,o,Cve,Eve,jo,{})}}class Ave extends h4{navigate(o){o.setContentComponent(Sve),f1.openMenu(2)}}class P6{static setCurrentPage(o){const a=this.pageSelectorStrategies.get(o);if(!a)throw Error(`No selector could be found for the given page, ${o}`);a.navigate(new vde)}}P6.pageSelectorStrategies=new Map([[hb.HOMEPAGE,new yde],[hb.DATAPAGE,new j0e],[hb.TRAININGPAGE,new cve],[hb.MODELPAGE,new Ave]]);function Ove(c){let o,a,i,n,s=c[5](c[0])+"",h,v,g,O,A,S,M,P;O=new Vx({props:{bodyText:c[5](c[2]),boxOffset:{x:-200,y:30},titleText:c[5](c[1]),width:280}});const L=c[8].default,V=Gk(L,c,c[7],null);return{c(){o=an("div"),a=an("div"),i=an("div"),n=an("p"),h=Sr(s),v=or(),g=an("div"),xi(O.$$.fragment),A=or(),V&&V.c(),Qt(n,"class","text-lg font-medium text-center"),Bi(n,"underline",c[4]),Qt(g,"class","absolute top-3px right-12 svelte-y21km2"),Qt(i,"class","h-full mt-6.2 relative svelte-y21km2"),Qt(a,"class","border bg-opacity-75 border-solid min-h-20 text-warm-gray-50 border-white border-opacity-30 shadow-sm shadow-gray-500 select-none transition duration-300 rounded-full bg-[#EDBFD9] svelte-y21km2"),Bi(a,"bg-[#63BFC2]",c[4]),Bi(a,"bg-opacity-95",c[4]),Bi(a,"curs
9063or-pointer",!c[4]),Bi(a,"hover:bg-border-opacity-30",!c[4]),Bi(a,"hover:bg-opacity-95",!c[4]),Bi(a,"rounded-3xl",c[4]),Qt(o,"class","svelte-y21km2")},m(N,ee){_r(N,o,ee),ft(o,a),ft(a,i),ft(i,n),ft(n,h),ft(i,v),ft(i,g),gi(O,g,null),ft(a,A),V&&V.m(a,null),S=!0,M||(P=sa(a,"click",function(){Fg(c[3])&&c[3].apply(this,arguments)}),M=!0)},p(N,[ee]){c=N,(!S||ee&33)&&s!==(s=c[5](c[0])+"")&&Ur(h,s),(!S||ee&16)&&Bi(n,"underline",c[4]);const J={};ee&36&&(J.bodyText=c[5](c[2])),ee&34&&(J.titleText=c[5](c[1])),O.$set(J),V&&V.p&&(!S||ee&128)&&Yk(V,L,c,c[7],S?Kk(L,c[7],ee,null):Xk(c[7]),null),(!S||ee&16)&&Bi(a,"bg-[#63BFC2]",c[4]),(!S||ee&16)&&Bi(a,"bg-opacity-95",c[4]),(!S||ee&16)&&Bi(a,"cursor-pointer",!c[4]),(!S||ee&16)&&Bi(a,"hover:bg-border-opacity-30",!c[4]),(!S||ee&16)&&Bi(a,"hover:bg-opacity-95",!c[4]),(!S||ee&16)&&Bi(a,"rounded-3xl",c[4])},i(N){S||(hr(O.$$.fragment,N),hr(V,N),S=!0)},o(N){Cr(O.$$.fragment,N),Cr(V,N),S=!1},d(N){N&&br(o),vi(O),V&&V.d(N),M=!1,P()}}}function Dve(c,o,a){let i;Vi(c,La,M=>a(5,i=M));let{$$slots:n={},$$scope:s}=o,{title:h}=o,{helpTitle:v}=o,{helpDescription:g}=o,{onClickFunction:O}=o,{isExpanded:A}=o;const S=void 0;return c.$$set=M=>{"title"in M&&a(0,h=M.title),"helpTitle"in M&&a(1,v=M.helpTitle),"helpDescription"in M&&a(2,g=M.helpDescription),"onClickFunction"in M&&a(3,O=M.onClickFunction),"isExpanded"in M&&a(4,A=M.isExpanded),"$$scope"in M&&a(7,s=M.$$scope)},[h,v,g,O,A,i,S,s,n]}class Tve extends $o{constructor(o){super(),Vo(this,o,Dve,Ove,jo,{title:0,helpTitle:1,helpDescription:2,onClickFunction:3,isExpanded:4,expandedButtonContent:6})}get expandedButtonContent(){return this.$$.ctx[6]}}function bq(c,o,a){const i=c.slice();return i[8]=o[a],i[10]=a,i}function Nve(c){let o,a,i;var n=c[0]===c[10]?c[8].expandedButtonContent:c[8].collapsedButtonContent;function s(h){return{}}return n&&(o=hN(n,s())),{c(){o&&xi(o.$$.fragment),a=Cm()},m(h,v){o&&gi(o,h,v),_r(h,a,v),i=!0},p(h,v){if(v&1&&n!==(n=h[0]===h[10]?h[8].expandedButtonContent:h[8].collapsedButtonContent)){if(o){Bs();const g=o;Cr(g.$$.fragment,1,0,()=>{vi(g,1)}),Ps()}n?(o=hN(n,s()),xi(o.$$.fragment),hr(o.$$.fragment,1),gi(o,a.parentNode,a)):o=null}},i(h){i||(o&&hr(o.$$.fragment,h),i=!0)},o(h){o&&Cr(o.$$.fragment,h),i=!1},d(h){h&&br(a),o&&vi(o,h)}}}function Ive(c){let o;return{c(){o=an("div"),o.innerHTML=`<img class="m-auto" src="imgs/down_arrow.svg" alt="down arrow icon" width="30px"/> 9064 `,Qt(o,"class","text-center ml-auto mr-auto mb-1 mt-1")},m(a,i){_r(a,o,i)},d(a){a&&br(o)}}}function xq(c){let o,a,i=c[10]!==Wo(f1.getMenuStore()).length-1,n,s;function h(){return c[4](c[8])}o=new Tve({props:{onClickFunction:h,title:c[8].title,helpTitle:c[8].infoBubbleTitle,helpDescription:c[8].infoBubbleContent,isExpanded:c[0]===c[10],$$slots:{default:[Nve]},$$scope:{ctx:c}}});let v=i&&Ive();return{c(){xi(o.$$.fragment),a=or(),v&&v.c(),n=Cm()},m(g,O){gi(o,g,O),_r(g,a,O),v&&v.m(g,O),_r(g,n,O),s=!0},p(g,O){c=g;const A={};O&1&&(A.isExpanded=c[0]===c[10]),O&2049&&(A.$$scope={dirty:O,ctx:c}),o.$set(A)},i(g){s||(hr(o.$$.fragment,g),s=!0)},o(g){Cr(o.$$.fragment,g),s=!1},d(g){vi(o,g),g&&br(a),v&&v.d(g),g&&br(n)}}}function Mve(c){let o,a,i,n,s=c[2]("content.index.ultrabit")+"",h,v,g,O,A,S,M,P,L,V=Wo(f1.getMenuStore()),N=[];for(let J=0;J<V.length;J+=1)N[J]=xq(bq(c,V,J));const ee=J=>Cr(N[J],1,1,()=>{N[J]=null});return{c(){o=an("div"),a=an("div"),a.innerHTML='<img alt="decoration arrows" src="imgs/partial_red_arrows.svg" width="225px"/>',i=or(),n=an("p"),h=Sr(s),v=or(),g=an("div"),O=an("button"),O.innerHTML='<i class="fas fa-home text-3xl outline-none"></i>',A=or(),S=an("div");for(let J=0;J<N.length;J+=1)N[J].c();Qt(a,"class","absolute bottom-15 -left-2"),Qt(n,"class","mb-8 text-white font-extrabold text-3xl"),Qt(O,"class","rounded hover:bg-white hover:bg-opacity-10 duration-100 select-none outline-none"),Qt(g,"class","text-white absolute right-10 top-5 focus:outline-none"),Qt(S,"class","relative"),Qt(o,"class","relative flex flex-col w-full p-5 pl-5 pr-5 border-r border-solid border-black border-opacity-40 shadow-2xl")},m(J,K){_r(J,o,K),ft(o,a),ft(o,i),ft(o,n),ft(n,h),ft(o,v),ft(o,g),ft(g,O),ft(o,A),ft(o,S);for(let re=0;re<N.length;re+=1)N[re]&&N[re].m(S,null);c[5](o),M=!0,P||(L=sa(O,"click",c[3]),P=!0)},p(J,[K]){if((!M||K&4)&&s!==(s=J[2]("content.index.ultrabit")+"")&&Ur(h,s),K&1){V=Wo(f1.getMenuStore());let re;for(re=0;re<V.length;re+=1){const ce=bq(J,V,re);N[re]?(N[re].p(ce,K),hr(N[re],1)):(N[re]=xq(ce),N[re].c(),hr(N[re],1),N[re].m(S,null))}for(Bs(),re=V.length;re<N.length;re+=1)ee(re);Ps()}},i(J){if(!M){for(let K=0;K<V.length;K+=1)hr(N[K]);M=!0}}
9064,o(J){N=N.filter(Boolean);for(let K=0;K<N.length;K+=1)Cr(N[K]);M=!1},d(J){J&&br(o),Pv(N,J),c[5](null),P=!1,L()}}}const wq="imgs/sidebar_background.svg";function Fve(c,o,a){let i,n;Vi(c,No,S=>a(7,i=S)),Vi(c,La,S=>a(2,n=S));const s=()=>{P6.setCurrentPage(hb.HOMEPAGE)};let h=-1;f1.getOpenMenuId().subscribe(S=>{a(0,h=S)});let v,g=document.createElement("img");g.src=wq,g.addEventListener("load",()=>{a(1,v.style.backgroundImage="url('"+g.src+"')",v),fu(No,i.isLoading=!1,i)}),g.src=wq;const O=S=>{P6.setCurrentPage(S.navigationPage)};function A(S){l1[S?"unshift":"push"](()=>{v=S,a(1,v)})}return[h,v,n,s,O,A]}class Rve extends $o{constructor(o){super(),Vo(this,o,Fve,Mve,jo,{})}}function Bve(c){let o,a,i,n,s;var h=c[0];function v(g){return{}}return h&&(i=hN(h,v())),{c(){o=an("div"),o.innerHTML='<img alt="theme graphic" src="imgs/arrow_group.svg" width="350px"/>',a=or(),i&&xi(i.$$.fragment),n=Cm(),Qt(o,"class","absolute -z-1 bottom-2 right-1")},m(g,O){_r(g,o,O),_r(g,a,O),i&&gi(i,g,O),_r(g,n,O),s=!0},p(g,[O]){if(O&1&&h!==(h=g[0])){if(i){Bs();const A=i;Cr(A.$$.fragment,1,0,()=>{vi(A,1)}),Ps()}h?(i=hN(h,v()),xi(i.$$.fragment),hr(i.$$.fragment,1),gi(i,n.parentNode,n)):i=null}},i(g){s||(i&&hr(i.$$.fragment,g),s=!0)},o(g){i&&Cr(i.$$.fragment,g),s=!1},d(g){g&&br(o),g&&br(a),g&&br(n),i&&vi(i,g)}}}function Pve(c,o,a){let i;return Vi(c,nY,n=>a(0,i=n)),[i]}class jve extends $o{constructor(o){super(),Vo(this,o,Pve,Bve,jo,{})}}var ak={};(function(c){(function(o){/** 9065 * @license 9066 * MIT License: 9067 * 9068 * Copyright (c) 2010-2013, Joe Walnes 9069 * 2013-2018, Drew Noakes 9070 * 9071 * Permission is hereby granted, free of charge, to any person obtaining a copy 9072 * of this software and associated documentation files (the "Software"), to deal 9073 * in the Software without restriction, including without limitation the rights 9074 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9075 * copies of the Software, and to permit persons to whom the Software is 9076 * furnished to do so, subject to the following conditions: 9077 * 9078 * The above copyright notice and this permission notice shall be included in 9079 * all copies or substantial portions of the Software. 9080 * 9081 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9082 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9083 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 9084 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 9085 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 9086 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 9087 * THE SOFTWARE. 9088 */Date.now=Date.now||function(){return new Date().getTime()};var a={extend:function(){arguments[0]=arguments[0]||{};for(var s=1;s<arguments.length;s++)for(var h in arguments[s])arguments[s].hasOwnProperty(h)&&(typeof arguments[s][h]=="object"?arguments[s][h]instanceof Array?arguments[0][h]=arguments[s][h]:arguments[0][h]=a.extend(arguments[0][h],arguments[s][h]):arguments[0][h]=arguments[s][h]);return arguments[0]},binarySearch:function(s,h){for(var v=0,g=s.length;v<g;){var O=v+g>>1;h<s[O][0]?g=O:v=O+1}return v},pixelSnap:function(s,h){return h%2===0?Math.round(s):Math.floor(s)+.5}};function i(s){this.options=a.extend({},i.defaultOptions,s),this.disabled=!1,this.clear()}i.defaultOptions={resetBoundsInterval:3e3,resetBounds:!0},i.prototype.clear=function(){this.data=[],this.maxValue=Number.NaN,this.minValue=Number.NaN},i.prototype.resetBounds=function(){if(this.data.length){this.maxValue=this.data[0][1],this.minValue=this.data[0][1];for(var s=1;s<this.data.length;s++){var h=this.data[s][1];h>this.maxValue&&(this.maxValue=h),h<this.minValue&&(this.minValue=h)}}else this.maxValue=Number.NaN,this.minValue=Number.NaN},i.prototype.append=function(s,h,v){if(!(isNaN(s)||isNaN(h))){var g=this.data.length-1;if(g>=0)for(var O=g;;){var A=this.data[O];if(s>=A[0]){s===A[0]?v?(A[1]+=h,h=A[1]):A[1]=h:this.data.splice(O+1,0,[s,h]);break}if(O--,O<0){this.data.splice(0,0,[s,h]);break}}else this.data.push([s,h]);this.maxValue=isNaN(this.maxValue)?h:Math.max(this.maxValue,h),this.minValue=isNaN(this.minValue)?h:Math.min(this.minValue,h)}},i.prototype.dropOldData=function(s,h){for(var v=0;this.data.length-v>=h&&this.data[v+1][0]<s;)v++;v!==0&&this.data.splice(0,v)};function n(s){this.options=a.extend({},n.defaultChartOptions,s),this.seriesSet=[],this.currentValueRange=1,this.currentVisMinValue=0,this.lastRenderTimeMillis=0,this.lastChartTimestamp=0,this.mousemove=this.mousemove.bind(this),this.mouseout=this.mouseout.bind(this)}n.tooltipFormatter=function(s,h){var v=this.options.timestampFormatter||n.timeFormatter,g=document.createElement("div"),O;g.appendChild(document.createTextNode(v(new Date(s))));for(var A=0;A<h.length;++A){O=h[A].series.options.tooltipLabel||"",O!==""&&(O=O+" ");var S=document.createElement("span");S.style.color=h[A].series.options.strokeStyle,S.appendChild(document.createTextNode(O+this.options.yMaxFormatter(h[A].value,this.options.labels.precision))),g.appendChild(document.createElement("br")),g.appendChild(S)}return g.innerHTML},n.defaultChartOptions={millisPerPixel:20,enableDpiScaling:!0,yMinFormatter:function(s,h){return parseFloat(s).toFixed(h)},yMaxFormatter:function(s,h){return parseFloat(s).toFixed(h)},yIntermediateFormatter:function(s,h){return parseFloat(s).toFixed(h)},maxValueScale:1,minValueScale:1,interpolation:"bezier",scaleSmoothing:.125,maxDataSetLength:2,
9088scrollBackwards:!1,displayDataFromPercentile:1,grid:{fillStyle:"#000000",strokeStyle:"#777777",lineWidth:2,millisPerLine:1e3,verticalSections:2,borderVisible:!0},labels:{fillStyle:"#ffffff",disabled:!1,fontSize:10,fontFamily:"monospace",precision:2,showIntermediateLabels:!1,intermediateLabelSameAxis:!0},title:{text:"",fillStyle:"#ffffff",fontSize:15,fontFamily:"monospace",verticalAlign:"middle"},horizontalLines:[],tooltip:!1,tooltipLine:{lineWidth:1,strokeStyle:"#BBBBBB"},tooltipFormatter:n.tooltipFormatter,nonRealtimeData:!1,responsive:!1,limitFPS:0},n.AnimateCompatibility=function(){var s=function(v,g){var O=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(A){return window.setTimeout(function(){A(Date.now())},16)};return O.call(window,v,g)},h=function(v){var g=window.cancelAnimationFrame||function(O){clearTimeout(O)};return g.call(window,v)};return{requestAnimationFrame:s,cancelAnimationFrame:h}}(),n.defaultSeriesPresentationOptions={lineWidth:1,strokeStyle:"#ffffff"},n.prototype.addTimeSeries=function(s,h){this.seriesSet.push({timeSeries:s,options:a.extend({},n.defaultSeriesPresentationOptions,h)}),s.options.resetBounds&&s.options.resetBoundsInterval>0&&(s.resetBoundsTimerId=setInterval(function(){s.resetBounds()},s.options.resetBoundsInterval))},n.prototype.removeTimeSeries=function(s){for(var h=this.seriesSet.length,v=0;v<h;v++)if(this.seriesSet[v].timeSeries===s){this.seriesSet.splice(v,1);break}s.resetBoundsTimerId&&clearInterval(s.resetBoundsTimerId)},n.prototype.getTimeSeriesOptions=function(s){for(var h=this.seriesSet.length,v=0;v<h;v++)if(this.seriesSet[v].timeSeries===s)return this.seriesSet[v].options},n.prototype.bringToFront=function(s){for(var h=this.seriesSet.length,v=0;v<h;v++)if(this.seriesSet[v].timeSeries===s){var g=this.seriesSet.splice(v,1);this.seriesSet.push(g[0]);break}},n.prototype.streamTo=function(s,h){this.canvas=s,this.clientWidth=parseInt(this.canvas.getAttribute("width")),this.clientHeight=parseInt(this.canvas.getAttribute("height")),this.delay=h,this.start()},n.prototype.getTooltipEl=function(){return this.tooltipEl||(this.tooltipEl=document.createElement("div"),this.tooltipEl.className="smoothie-chart-tooltip",this.tooltipEl.style.pointerEvents="none",this.tooltipEl.style.position="absolute",this.tooltipEl.style.display="none",document.body.appendChild(this.tooltipEl)),this.tooltipEl},n.prototype.updateTooltip=function(){if(this.options.tooltip){var s=this.getTooltipEl();if(!this.mouseover||!this.options.tooltip){s.style.display="none";return}for(var h=this.lastChartTimestamp,v=this.options.scrollBackwards?h-this.mouseX*this.options.millisPerPixel:h-(this.clientWidth-this.mouseX)*this.options.millisPerPixel,g=[],O=0;O<this.seriesSet.length;O++){var A=this.seriesSet[O].timeSeries;if(!A.disabled){var S=a.binarySearch(A.data,v);S>0&&S<A.data.length&&g.push({series:this.seriesSet[O],index:S,value:A.data[S][1]})}}g.length?(s.innerHTML=this.options.tooltipFormatter.call(this,v,g),s.style.display="block"):s.style.display="none"}},n.prototype.mousemove=function(s){if(this.mouseover=!0,this.mouseX=s.offsetX,this.mouseY=s.offsetY,this.mousePageX=s.pageX,this.mousePageY=s.pageY,!!this.options.tooltip){var h=this.getTooltipEl();h.style.top=Math.round(this.mousePageY)+"px",h.style.left=Math.round(this.mousePageX)+"px",this.updateTooltip()}},n.prototype.mouseout=function(){this.mouseover=!1,this.mouseX=this.mouseY=-1,this.tooltipEl&&(this.tooltipEl.style.display="none")},n.prototype.resize=function(){var s=!this.options.enableDpiScaling||!window?1:window.devicePixelRatio,h,v;this.options.responsive?(h=this.canvas.offsetWidth,v=this.canvas.offsetHeight,h!==this.lastWidth&&(this.lastWidth=h,this.canvas.setAttribute("width",Math.floor(h*s).toString()),this.canvas.getContext("2d").scale(s,s)),v!==this.lastHeight&&(this.lastHeight=v,this.canvas.setAttribute("height",Math.floor(v*s).toString()),this.canvas.getContext("2d").scale(s,s)),this.clientWidth=h,this.clientHeight=v):(h=parseInt(this.canvas.getAttribute("width")),v=parseInt(this.canvas.getAttribute("height")),s!==1?(Math.floor(this.clientWidth*s)!==h&&(this.canvas.setAttribute("width",Math.floor(h*s).toString()),this.canvas.style.width=h+"px",this.clientWidth=h,this.canvas.getContext("2d").scale(s,s)),Math.floor(this.clientHeight*s)!==v&&(this.canvas.setAttribute("height",Math.floor(v*s).toString()),this.canvas.style.height=v+"px",this.clientHeight=v,this.canvas.getContext("2d").scale(s,s))):(this.clientWidth=h,this.clientHeight=v))},n.prototype.start=function(){if(!this.frame){this.canvas.addEventListener("mousemove",this.mousemove),this.canvas.addEventListener("mouseout",this.mouseout);var s=function(){this.frame=n.AnimateCompatibility.requestAnimationFrame(function(){if(this.options.nonRealtimeData){var h=new Date(0),v=this.seriesSet.reduce(function(g,O){var A=O.t
9088imeSeries.data,S=Math.round(this.options.displayDataFromPercentile*A.length)-1;if(S=S>=0?S:0,S=S<=A.length-1?S:A.length-1,A&&A.length>0){var M=A[S][0];g=g>M?g:M}return g}.bind(this),h);this.render(this.canvas,v>h?v:null)}else this.render();s()}.bind(this))}.bind(this);s()}},n.prototype.stop=function(){this.frame&&(n.AnimateCompatibility.cancelAnimationFrame(this.frame),delete this.frame,this.canvas.removeEventListener("mousemove",this.mousemove),this.canvas.removeEventListener("mouseout",this.mouseout))},n.prototype.updateValueRange=function(){for(var s=this.options,h=Number.NaN,v=Number.NaN,g=0;g<this.seriesSet.length;g++){var O=this.seriesSet[g].timeSeries;O.disabled||(isNaN(O.maxValue)||(h=isNaN(h)?O.maxValue:Math.max(h,O.maxValue)),isNaN(O.minValue)||(v=isNaN(v)?O.minValue:Math.min(v,O.minValue)))}if(s.maxValue!=null?h=s.maxValue:h*=s.maxValueScale,s.minValue!=null?v=s.minValue:v-=Math.abs(v*s.minValueScale-v),this.options.yRangeFunction){var A=this.options.yRangeFunction({min:v,max:h});v=A.min,h=A.max}if(!isNaN(h)&&!isNaN(v)){var S=h-v,M=S-this.currentValueRange,P=v-this.currentVisMinValue;this.isAnimatingScale=Math.abs(M)>.1||Math.abs(P)>.1,this.currentValueRange+=s.scaleSmoothing*M,this.currentVisMinValue+=s.scaleSmoothing*P}this.valueRange={min:v,max:h}},n.prototype.render=function(s,h){var v=Date.now();if(!(this.options.limitFPS>0&&v-this.lastRenderTimeMillis<1e3/this.options.limitFPS)){if(h=(h||v)-(this.delay||0),h-=h%this.options.millisPerPixel,!this.isAnimatingScale){var g=this.lastChartTimestamp===h;if(g){var O=v-this.lastRenderTimeMillis>166.66666666666666;if(!O)return}}this.lastRenderTimeMillis=v,this.lastChartTimestamp=h,this.resize(),s=s||this.canvas;var A=s.getContext("2d"),S=this.options,M={top:0,left:0,width:this.clientWidth,height:this.clientHeight},P=h-M.width*S.millisPerPixel,L=function(En,xe){var jn=En-this.currentVisMinValue,nr=this.currentValueRange===0?M.height:M.height*(1-jn/this.currentValueRange);return a.pixelSnap(nr,xe)}.bind(this),V=function(En,xe){var jn=S.scrollBackwards?(h-En)/S.millisPerPixel:M.width-(h-En)/S.millisPerPixel;return a.pixelSnap(jn,xe)};if(this.updateValueRange(),A.font=S.labels.fontSize+"px "+S.labels.fontFamily,A.save(),A.translate(M.left,M.top),A.beginPath(),A.rect(0,0,M.width,M.height),A.clip(),A.save(),A.fillStyle=S.grid.fillStyle,A.clearRect(0,0,M.width,M.height),A.fillRect(0,0,M.width,M.height),A.restore(),A.save(),A.lineWidth=S.grid.lineWidth,A.strokeStyle=S.grid.strokeStyle,S.grid.millisPerLine>0){A.beginPath();for(var N=h-h%S.grid.millisPerLine;N>=P;N-=S.grid.millisPerLine){var ee=V(N,S.grid.lineWidth);A.moveTo(ee,0),A.lineTo(ee,M.height)}A.stroke(),A.closePath()}for(var J=1;J<S.grid.verticalSections;J++){var K=a.pixelSnap(J*M.height/S.grid.verticalSections,S.grid.lineWidth);A.beginPath(),A.moveTo(0,K),A.lineTo(M.width,K),A.stroke(),A.closePath()}if(S.grid.borderVisible&&(A.beginPath(),A.strokeRect(0,0,M.width,M.height),A.closePath()),A.restore(),S.horizontalLines&&S.horizontalLines.length)for(var re=0;re<S.horizontalLines.length;re++){var ce=S.horizontalLines[re],pe=ce.lineWidth||1,ke=L(ce.value,pe);A.strokeStyle=ce.color||"#ffffff",A.lineWidth=pe,A.beginPath(),A.moveTo(0,ke),A.lineTo(M.width,ke),A.stroke(),A.closePath()}for(var Ce=0;Ce<this.seriesSet.length;Ce++){var be=this.seriesSet[Ce].timeSeries,$e=be.data;if(be.dropOldData(P,S.maxDataSetLength),!($e.length<=1||be.disabled)){A.save();var ht=this.seriesSet[Ce].options,Dt=ht.strokeStyle&&ht.strokeStyle!=="none",Ut=Dt?ht.lineWidth:0;A.beginPath();var Ee=V($e[0][0],Ut),Ot=L($e[0][1],Ut),zt=Ee,Mt=Ot,Ke;switch(A.moveTo(Ee,Ot),ht.interpolation||S.interpolation){case"linear":case"line":{Ke=function(En,xe,jn,nr){A.lineTo(En,xe)};break}case"bezier":default:{Ke=function(En,xe,jn,nr){A.bezierCurveTo(Math.round((jn+En)/2),nr,Math.round(jn+En)/2,xe,En,xe)};break}case"step":{Ke=function(En,xe,jn,nr){A.lineTo(En,nr),A.lineTo(En,xe)};break}}for(var Tt=1;Tt<$e.length;Tt++){var vt=$e[Tt],yt=V(vt[0],Ut),bt=L(vt[1],Ut);Ke(yt,bt,zt,Mt),zt=yt,Mt=bt}Dt&&(A.lineWidth=ht.lineWidth,A.strokeStyle=ht.strokeStyle,A.stroke()),ht.fillStyle&&(A.lineTo(zt,M.height+Ut+1),A.lineTo(Ee,M.height+Ut+1),A.fillStyle=ht.fillStyle,A.fill()),A.restore(
9088)}}S.tooltip&&this.mouseX>=0&&(A.lineWidth=S.tooltipLine.lineWidth,A.strokeStyle=S.tooltipLine.strokeStyle,A.beginPath(),A.moveTo(this.mouseX,0),A.lineTo(this.mouseX,M.height),A.closePath(),A.stroke()),this.updateTooltip();var Ht=S.labels;if(!Ht.disabled&&!isNaN(this.valueRange.min)&&!isNaN(this.valueRange.max)){var _t=S.yMaxFormatter(this.valueRange.max,Ht.precision),Ze=S.yMinFormatter(this.valueRange.min,Ht.precision),Vt=S.scrollBackwards?0:M.width-A.measureText(_t).width-2,sn=S.scrollBackwards?0:M.width-A.measureText(Ze).width-2;A.fillStyle=Ht.fillStyle,A.fillText(_t,Vt,Ht.fontSize),A.fillText(Ze,sn,M.height-2)}if(Ht.showIntermediateLabels&&!isNaN(this.valueRange.min)&&!isNaN(this.valueRange.max)&&S.grid.verticalSections>0)for(var yn=(this.valueRange.max-this.valueRange.min)/S.grid.verticalSections,Yt=M.height/S.grid.verticalSections,J=1;J<S.grid.verticalSections;J++){var K=M.height-Math.round(J*Yt),We=S.yIntermediateFormatter(this.valueRange.min+J*yn,Ht.precision),Ye=Ht.intermediateLabelSameAxis?S.scrollBackwards?0:M.width-A.measureText(We).width-2:S.scrollBackwards?M.width-A.measureText(We).width-2:0;A.fillText(We,Ye,K-S.grid.lineWidth)}if(S.timestampFormatter&&S.grid.millisPerLine>0)for(var He=S.scrollBackwards?A.measureText(Ze).width:M.width-A.measureText(Ze).width+4,N=h-h%S.grid.millisPerLine;N>=P;N-=S.grid.millisPerLine){var ee=V(N,0);if(!S.scrollBackwards&&ee<He||S.scrollBackwards&&ee>He){var dt=new Date(N),It=S.timestampFormatter(dt),ct=A.measureText(It).width;He=S.scrollBackwards?ee+ct+2:ee-ct-2,A.fillStyle=S.labels.fillStyle,S.scrollBackwards?A.fillText(It,ee,M.height-2):A.fillText(It,ee-ct,M.height-2)}}if(S.title.text!==""){A.font=S.title.fontSize+"px "+S.title.fontFamily;var on=S.scrollBackwards?M.width-A.measureText(S.title.text).width-2:2;if(S.title.verticalAlign=="bottom"){A.textBaseline="bottom";var Xt=M.height}else if(S.title.verticalAlign=="middle"){A.textBaseline="middle";var Xt=M.height/2}else{A.textBaseline="top";var Xt=0}A.fillStyle=S.title.fillStyle,A.fillText(S.title.text,on,Xt)}A.restore()}},n.timeFormatter=function(s){function h(v){return(v<10?"0":"")+v}return h(s.getHours())+":"+h(s.getMinutes())+":"+h(s.getSeconds())},o.TimeSeries=i,o.SmoothieChart=n})(c)})(ak);function Lve(c){let o,a;return{c(){o=an("main"),a=an("canvas"),Qt(a,"height","160"),Qt(a,"id","smoothie-chart"),Qt(a,"width",c[0])},m(i,n){_r(i,o,n),ft(o,a),c[4](a)},p(i,[n]){n&1&&Qt(a,"width",i[0])},i:Fi,o:Fi,d(i){i&&br(o),c[4](null)}}}const D5=2;function zve(c,o,a){let i;Vi(c,No,N=>a(3,i=N));var n=void 0,s;let h=new ak.TimeSeries,v=new ak.TimeSeries,g=new ak.TimeSeries,O=new ak.TimeSeries;Zx(()=>{a(2,s=new ak.SmoothieChart({maxValue:2.3,minValue:-2,millisPerPixel:7,grid:{fillStyle:"#ffffff00",strokeStyle:"rgba(48,48,48,0.20)",millisPerLine:3e3,borderVisible:!1},interpolation:"linear"})),s.addTimeSeries(h,{lineWidth:D5,strokeStyle:"#f9808e"}),s.addTimeSeries(v,{lineWidth:D5,strokeStyle:"#80f98e"}),s.addTimeSeries(g,{lineWidth:D5,strokeStyle:"#808ef9"}),s.addTimeSeries(O,{lineWidth:3,strokeStyle:"#4040ff44",fillStyle:"#0000ff07"}),s.streamTo(n,0),s.stop()});let A=!1;function S(N){!N||A||(O.append(new Date().getTime()-1,-2,!1),O.append(new Date().getTime(),2.3,!1),A=!0,setTimeout(()=>{O.append(new Date().getTime()-1,2.3,!1),O.append(new Date().getTime(),-2,!1),A=!1},Wo(gl).duration))}let M;function P(N){N?M=d4.subscribe(ee=>{{const J=new Date().getTime();h.append(J,ee.smoothedAccelX,!1),v.append(J,ee.smoothedAccelY,!1),g.append(J,ee.smoothedAccelZ,!1)}}):M!==void 0&&(M(),M=void 0)}let{width:L}=o;function V(N){l1[N?"unshift":"push"](()=>{n=N,a(1,n)})}return c.$$set=N=>{"width"in N&&a(0,L=N.width)},c.$$.update=()=>{if(c.$$.dirty&12&&s!==void 0&&(i.isInputReady?s.start():s.stop()),c.$$.dirty&8&&S(i.isRecording||i.isTesting),c.$$.dirty&8){const N=i.isInputConnected;P(N)}},[L,n,s,i,V]}class Uve extends $o{constructor(o){super(),Vo(this,o,zve,Lve,jo,{width:0})}}function Wve(c){let o,a,i,n,s,h,v,g,O,A,S,M,P,L,V,N,ee,J,K,re;i=new Uve({props:{width:c[0]}});let ce=!c[2].isInputReady&&_q(c);O=new Vx({props:{titleText:c[3]("footer.helpHeader"),bodyText:c[3]("footer.helpContent"),isLightTheme:!1,boxOffset:{x:25,y:-50}}});let pe=(c[2].isPredicting||c[2].isTraining||c[2].isOutputConnected)&&kq(c);const ke=[Qve,Jve],Ce=[];function be($e,ht){return!$e[2].isInputConnected||$e[2].isInputReady?0:1}return J=be(c),K=Ce[J]=ke[J](c),{c(){o=an("div"),a=an("div"),xi(i.$$.fragment),n=or(),ce&&ce.c(),s=or(),h=an("div"),v=an("div"),g=an("div"),xi(O.$$.fragment),A=or(),S=an("p"),S.textContent="Live",M=or(),P=an("p"),P.textContent="â¢",L=or(),V=an("div"),pe&&pe.c(),N=or(),ee=an("div"),K.c(),Qt(a,"class","absolute w-full h-full"),Qt(g,"class","float-left"),Qt(S,"class","float-left ml-10"),Qt(P,"class","float-left ml-1 -mt-3 text-3xl"),Bi(P,"text-red-500",c[2].isInputReady),Bi(P,"text-gray-500",!c[2].isInputReady),Qt(v,"class","float-left mt-2 ml-2"),Qt(ee,"class","ml-2"),Qt(V,"class","absolute right-2 top-2 m-0 float-right flex"),Qt(h,"class","w-full h-full p-0 m-0 absolute top-0 left-0"),Qt(o,"class","relative w-full h-full")},m($e,ht){_r($e,o,ht),ft(o,a),gi(i,a,null),ft(o,n),ce&&ce.m(o,null),ft(o,s),ft(o,h),ft(h,v),ft(v,g),gi(O,g,null),ft(v,A),ft(v,S),ft(v,M),ft(v,P),ft(h,L),ft(h,V),pe&&pe.m(V,null),ft(V,N),ft(V,ee),Ce[J].m(ee,null),re=!0},p($e,ht){const Dt={};ht&1&&(Dt.width=$e[0]),i.$set(Dt),$e[2].isInputReady?ce&&(Bs(),Cr(ce,1,1,()=>{ce=null}
9088),Ps()):ce?(ce.p($e,ht),ht&4&&hr(ce,1)):(ce=_q($e),ce.c(),hr(ce,1),ce.m(o,s));const Ut={};ht&8&&(Ut.titleText=$e[3]("footer.helpHeader")),ht&8&&(Ut.bodyText=$e[3]("footer.helpContent")),O.$set(Ut),(!re||ht&4)&&Bi(P,"text-red-500",$e[2].isInputReady),(!re||ht&4)&&Bi(P,"text-gray-500",!$e[2].isInputReady),$e[2].isPredicting||$e[2].isTraining||$e[2].isOutputConnected?pe?(pe.p($e,ht),ht&4&&hr(pe,1)):(pe=kq($e),pe.c(),hr(pe,1),pe.m(V,N)):pe&&(Bs(),Cr(pe,1,1,()=>{pe=null}),Ps());let Ee=J;J=be($e),J===Ee?Ce[J].p($e,ht):(Bs(),Cr(Ce[Ee],1,1,()=>{Ce[Ee]=null}),Ps(),K=Ce[J],K?K.p($e,ht):(K=Ce[J]=ke[J]($e),K.c()),hr(K,1),K.m(ee,null))},i($e){re||(hr(i.$$.fragment,$e),hr(ce),hr(O.$$.fragment,$e),hr(pe),hr(K),re=!0)},o($e){Cr(i.$$.fragment,$e),Cr(ce),Cr(O.$$.fragment,$e),Cr(pe),Cr(K),re=!1},d($e){$e&&br(o),vi(i),ce&&ce.d(),vi(O),pe&&pe.d(),Ce[J].d()}}}function Vve(c){let o,a,i;return a=new vl({props:{onClick:c[4],$$slots:{default:[tye]},$$scope:{ctx:c}}}),{c(){o=an("div"),xi(a.$$.fragment),Qt(o,"class","h-full w-full flex justify-center bg-white")},m(n,s){_r(n,o,s),gi(a,o,null),i=!0},p(n,s){const h={};s&520&&(h.$$scope={dirty:s,ctx:n}),a.$set(h)},i(n){i||(hr(a.$$.fragment,n),i=!0)},o(n){Cr(a.$$.fragment,n),i=!1},d(n){n&&br(o),vi(a)}}}function _q(c){let o,a,i,n=c[3]("footer.reconnecting")+"",s,h,v;return{c(){o=an("div"),a=an("div"),i=an("h1"),s=Sr(n),Qt(a,"class","bg-[#EDBFD9] py-2 px-4 rounded-full"),Qt(o,"class","absolute w-full h-full flex items-center justify-center text-white")},m(g,O){_r(g,o,O),ft(o,a),ft(a,i),ft(i,s),v=!0},p(g,O){(!v||O&8)&&n!==(n=g[3]("footer.reconnecting")+"")&&Ur(s,n)},i(g){v||(Ll(()=>{v&&(h||(h=Qd(a,ew,{},!0)),h.run(1))}),v=!0)},o(g){h||(h=Qd(a,ew,{},!1)),h.run(0),v=!1},d(g){g&&br(o),g&&h&&h.end()}}}function kq(c){let o,a,i,n;const s=[Hve,$ve],h=[];function v(g,O){return g[2].isOutputAssigned?0:1}return o=v(c),a=h[o]=s[o](c),{c(){a.c(),i=Cm()},m(g,O){h[o].m(g,O),_r(g,i,O),n=!0},p(g,O){let A=o;o=v(g),o===A?h[o].p(g,O):(Bs(),Cr(h[A],1,1,()=>{h[A]=null}),Ps(),a=h[o],a?a.p(g,O):(a=h[o]=s[o](g),a.c()),hr(a,1),a.m(i.parentNode,i))},i(g){n||(hr(a),n=!0)},o(g){Cr(a),n=!1},d(g){h[o].d(g),g&&br(i)}}}function $ve(c){let o,a;return o=new vl({props:{onClick:c[4],$$slots:{default:[qve]},$$scope:{ctx:c}}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&520&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function Hve(c){let o,a,i,n;const s=[Kve,Gve],h=[];function v(g,O){return!g[2].isOutputConnected||g[2].isOutputReady?0:1}return o=v(c),a=h[o]=s[o](c),{c(){a.c(),i=Cm()},m(g,O){h[o].m(g,O),_r(g,i,O),n=!0},p(g,O){let A=o;o=v(g),o===A?h[o].p(g,O):(Bs(),Cr(h[A],1,1,()=>{h[A]=null}),Ps(),a=h[o],a?a.p(g,O):(a=h[o]=s[o](g),a.c()),hr(a,1),a.m(i.parentNode,i))},i(g){n||(hr(a),n=!0)},o(g){Cr(a),n=!1},d(g){h[o].d(g),g&&br(i)}}}function qve(c){let o=c[3]("menu.model.connectOutputButton")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&8&&o!==(o=i[3]("menu.model.connectOutputButton")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function Gve(c){let o,a;return o=new vl({props:{onClick:A2.emptyFunction,color:"gray",$$slots:{default:[Yve]},$$scope:{ctx:c}}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&512&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function Kve(c){let o,a;return o=new vl({props:{onClick:c[6],color:"red",$$slots:{default:[Xve]},$$scope:{ctx:c}}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&520&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function Yve(c){let o,a;return{c(){o=an("img"),Qt(o,"alt","loading"),Qx(o.src,a="imgs/loadingspinner.gif")||Qt(o,"src",a),Fs(o,"height","24px")},m(i,n){_r(i,o,n)},p:Fi,d(i){i&&br(o)}}}function Xve(c){let o=c[3]("menu.model.disconnect")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&8&&o!==(o=i[3]("menu.model.disconnect")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function Jve(c){let o,a;return o=new vl({props:{onClick:A2.emptyFunction,color:"gray",$$slots:{default:[Zve]},$$scope:{ctx:c}}}
9088),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&512&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function Qve(c){let o,a;return o=new vl({props:{onClick:c[5],color:"red",$$slots:{default:[eye]},$$scope:{ctx:c}}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,n){const s={};n&520&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function Zve(c){let o,a;return{c(){o=an("img"),Qt(o,"alt","loading"),Qx(o.src,a="imgs/loadingspinner.gif")||Qt(o,"src",a),Fs(o,"height","24px")},m(i,n){_r(i,o,n)},p:Fi,d(i){i&&br(o)}}}function eye(c){let o=c[3]("footer.disconnectButton")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&8&&o!==(o=i[3]("footer.disconnectButton")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function tye(c){let o=c[3]("footer.connectButtonNotConnected")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&8&&o!==(o=i[3]("footer.connectButtonNotConnected")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function nye(c){let o,a,i,n,s,h,v,g={};a=new jY({props:g}),c[7](a);const O=[Vve,Wve],A=[];function S(M,P){return M[2].isInputAssigned?1:0}return n=S(c),s=A[n]=O[n](c),{c(){o=an("div"),xi(a.$$.fragment),i=or(),s.c(),Qt(o,"class","h-full w-full bg-white border-t border-solid border-black border-opacity-60 shadow-black shadow-xl"),Ll(()=>c[8].call(o)),Bi(o,"bg-gray-300",c[2].isInputAssigned&&!c[2].isInputReady)},m(M,P){_r(M,o,P),gi(a,o,null),ft(o,i),A[n].m(o,null),h=OK(o,c[8].bind(o)),v=!0},p(M,[P]){const L={};a.$set(L);let V=n;n=S(M),n===V?A[n].p(M,P):(Bs(),Cr(A[V],1,1,()=>{A[V]=null}),Ps(),s=A[n],s?s.p(M,P):(s=A[n]=O[n](M),s.c()),hr(s,1),s.m(o,null)),(!v||P&4)&&Bi(o,"bg-gray-300",M[2].isInputAssigned&&!M[2].isInputReady)},i(M){v||(hr(a.$$.fragment,M),hr(s),v=!0)},o(M){Cr(a.$$.fragment,M),Cr(s),v=!1},d(M){M&&br(o),c[7](null),vi(a),A[n].d(),h()}}}function rye(c,o,a){let i,n;Vi(c,No,M=>a(2,i=M)),Vi(c,La,M=>a(3,n=M));let s,h;const v=()=>{KK()},g=()=>{pu.expelInputAndOutput()},O=()=>{pu.expelOutput()};function A(M){l1[M?"unshift":"push"](()=>{h=M,a(1,h)})}function S(){s=this.clientWidth,a(0,s)}return[s,h,i,n,v,g,O,A,S]}class iye extends $o{constructor(o){super(),Vo(this,o,rye,nye,jo,{})}}function oye(c){let o,a;return o=new iye({}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p:Fi,i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}class aye extends $o{constructor(o){super(),Vo(this,o,null,oye,jo,{})}}function Eq(c,o,a){const i=c.slice();return i[3]=o[a],i}function Cq(c,o,a){const i=c.slice();return i[6]=o[a],i}function Sq(c){let o,a,i=c[6].browser+"",n;return{c(){o=an("li"),a=an("a"),n=Sr(i),Qt(a,"class","text-blue-400"),Qt(a,"href",c[6].link),Qt(a,"target","_blank")},m(s,h){_r(s,o,h),ft(o,a),ft(a,n)},p:Fi,d(s){s&&br(o)}}}function Aq(c){let o,a,i,n,s,h=c[3].name+"",v,g,O,A,S=c[3].description+"",M,P;return{c(){o=an("hr"),a=or(),i=an("div"),n=an("div"),s=an("p"),v=Sr(h),g=or(),O=an("div"),A=an("p"),M=Sr(S),P=or(),Qt(s,"class","m-2"),Qt(n,"class","table-cell bg-gray-200/50 justify-center align-middle"),Qt(A,"class","m-2"),Qt(O,"class","table-cell bg-gray-100/50"),Qt(i,"class","table-row")},m(L,V){_r(L,o,V),_r(L,a,V),_r(L,i,V),ft(i,n),ft(n,s),ft(s,v),ft(i,g),ft(i,O),ft(O,A),ft(A,M),ft(i,P)},p:Fi,d(L){L&&br(o),L&&br(a),L&&br(i)}}}function sye(c){let o,a,i,n,s=c[0]("cookies.overlay.title")+"",h,v,g,O,A,S=c[0]("cookies.overlay.question.whatAreCookies")+"",M,P,L,V=c[0]("cookies.overlay.answer.whatAreCookies")+"",N,ee,J,K=c[0]("cookies.overlay.question.ourReasoning")+"",re,ce,pe,ke=c[0]("cookies.overlay.answer.ourReasoning")+"",Ce,be,$e,ht=c[0]("cookies.overlay.question.storageDuration")+"",Dt,Ut,Ee,Ot=c[0]("cookies.overlay.answer.storageDuration")+"",zt,Mt,Ke,Tt=c[0]("cookies.overlay.question.deleting")+"",vt,yt,bt,Ht=c[0]("cookies.overlay.answer.deleting")+"",_t,Ze,Vt,sn,yn,Yt=c[0]("cookies.overlay.question.consentChange")+"",We,Ye,He,dt=c[0]("cookies.overlay.answer.consentChange")+"",It,ct,on,Xt,En=c[0]("cookies.overlay.table.title")+"",xe,jn,nr,ar,cr,Er,hn,rn,fn,Xn=c[0]("cookies.overlay.table.header.description")+"",Fn,Ar,Dr,xr,fi=c[2],ci=[];for(let Ir=0;Ir<fi.length;Ir+=1)ci[Ir]=Sq(Cq(c,fi,Ir));let qr=c[1],mi=[];for(let Ir=0;Ir<qr.length;Ir+=1)mi[Ir]=Aq(Eq(c,qr,Ir));return{c(){o=an("div"),a=an("div"),i=an("div"),n=an("p"),h=Sr(s),v=or(),g=an("div"),O=an("div"),A=an("p"),M=Sr(S),P=or(),L=an("p"),N=Sr(V),ee=or(),J=an("p"),re=Sr(K),ce=or(),pe=an("p"),Ce=Sr(ke),be=or(),$e=an("p"),Dt=Sr(ht),Ut=or(),Ee=an("p"),zt=Sr(Ot),Mt=or(),Ke=an("p"),vt=Sr(Tt),yt=or(),bt=an("p"),_t=Sr(Ht),Ze=or(),Vt=an("ul");for(let Ir=0;Ir<ci.length;Ir+=1)ci[Ir].c();sn=or(),yn=an("p"),We=Sr(Yt),Ye=or(),He=an("p"),It=Sr(dt),ct=or(),on=an("div"),Xt=an("p"),xe=Sr(En),jn=or(),nr=an("div"),ar=an("div"),cr=an("div"),Er=an("div"),Er.innerHTML='<p class="m-2 font-bold">Cookie</p>',hn=or(),rn=an("div"),fn=an("p"),Fn=Sr(Xn),Ar=or();for(let Ir=0;Ir<mi.length;Ir+=1)mi[Ir].c();Qt(n,"class","text-red-500 font-bold text-center text-xl"),Qt(A,"class","font-bold"),Qt(J,"class","font-bold mt-2"),Qt($e,"class","font-bold mt-2"),Qt(Ke,"class","font-bold mt-2"),Qt(yn,"class","font-bold mt-2"),Qt(O,"class","p-2"),Qt(Xt,"class","font-bold text-lg ml-2 mt-2"),Qt(Er,"class","table-cell bg-gray-200 justify-center align-middle"),Qt(fn,"class","m-2 text-center font-bold"),Qt(rn,"class","table-cell bg-gray-100"),Qt(cr,"class","table-row"),Qt(ar,"class","table ml-2 mr-4"),Qt(nr,"class","flex"),Qt(g,"class","overflow-y-scroll h-10/11"),Qt(a,"class","w-150 h-150 p-3"),Qt(o,"class","justify-center items-center content-center w-150 h-150 bg-white m-auto")},m(Ir,ti){_r(Ir,o,ti),ft(o,a),ft(a,i),ft(i,n),ft(n,h),ft(a,v),ft(a,g),ft(g,O),ft(O,A),ft(A,M),ft(O,P),ft(O,L),ft(L,N),ft(O,ee),ft(O,J),ft(J,re),ft(O,ce),ft(O,pe),ft(pe,Ce),ft(O,be),ft(O,$e),ft($e,Dt),ft(O,Ut),ft(O,Ee),ft(Ee,zt),ft(O,Mt),ft(O,Ke),ft(Ke,vt),ft(O,yt),ft(O,bt),ft(bt,_t),ft(O,Ze),ft(O,Vt);for(let ri=0;ri<ci.length;ri+=1)ci[ri]&&ci[ri].m(Vt,null);ft(O,sn),ft(O,yn),ft(yn,We),ft(O,Ye),ft(O,He),ft(He,It),ft(g,ct),ft(g,on),ft(on,
9088Xt),ft(Xt,xe),ft(on,jn),ft(on,nr),ft(nr,ar),ft(ar,cr),ft(cr,Er),ft(cr,hn),ft(cr,rn),ft(rn,fn),ft(fn,Fn),ft(ar,Ar);for(let ri=0;ri<mi.length;ri+=1)mi[ri]&&mi[ri].m(ar,null);xr=!0},p(Ir,[ti]){if((!xr||ti&1)&&s!==(s=Ir[0]("cookies.overlay.title")+"")&&Ur(h,s),(!xr||ti&1)&&S!==(S=Ir[0]("cookies.overlay.question.whatAreCookies")+"")&&Ur(M,S),(!xr||ti&1)&&V!==(V=Ir[0]("cookies.overlay.answer.whatAreCookies")+"")&&Ur(N,V),(!xr||ti&1)&&K!==(K=Ir[0]("cookies.overlay.question.ourReasoning")+"")&&Ur(re,K),(!xr||ti&1)&&ke!==(ke=Ir[0]("cookies.overlay.answer.ourReasoning")+"")&&Ur(Ce,ke),(!xr||ti&1)&&ht!==(ht=Ir[0]("cookies.overlay.question.storageDuration")+"")&&Ur(Dt,ht),(!xr||ti&1)&&Ot!==(Ot=Ir[0]("cookies.overlay.answer.storageDuration")+"")&&Ur(zt,Ot),(!xr||ti&1)&&Tt!==(Tt=Ir[0]("cookies.overlay.question.deleting")+"")&&Ur(vt,Tt),(!xr||ti&1)&&Ht!==(Ht=Ir[0]("cookies.overlay.answer.deleting")+"")&&Ur(_t,Ht),ti&4){fi=Ir[2];let ri;for(ri=0;ri<fi.length;ri+=1){const yi=Cq(Ir,fi,ri);ci[ri]?ci[ri].p(yi,ti):(ci[ri]=Sq(yi),ci[ri].c(),ci[ri].m(Vt,null))}for(;ri<ci.length;ri+=1)ci[ri].d(1);ci.length=fi.length}if((!xr||ti&1)&&Yt!==(Yt=Ir[0]("cookies.overlay.question.consentChange")+"")&&Ur(We,Yt),(!xr||ti&1)&&dt!==(dt=Ir[0]("cookies.overlay.answer.consentChange")+"")&&Ur(It,dt),(!xr||ti&1)&&En!==(En=Ir[0]("cookies.overlay.table.title")+"")&&Ur(xe,En),(!xr||ti&1)&&Xn!==(Xn=Ir[0]("cookies.overlay.table.header.description")+"")&&Ur(Fn,Xn),ti&2){qr=Ir[1];let ri;for(ri=0;ri<qr.length;ri+=1){const yi=Eq(Ir,qr,ri);mi[ri]?mi[ri].p(yi,ti):(mi[ri]=Aq(yi),mi[ri].c(),mi[ri].m(ar,null))}for(;ri<mi.length;ri+=1)mi[ri].d(1);mi.length=qr.length}},i(Ir){xr||(Ll(()=>{xr&&(Dr||(Dr=Qd(o,bN,{},!0)),Dr.run(1))}),xr=!0)},o(Ir){Dr||(Dr=Qd(o,bN,{},!1)),Dr.run(0),xr=!1},d(Ir){Ir&&br(o),Pv(ci,Ir),Pv(mi,Ir),Ir&&Dr&&Dr.end()}}}function uye(c,o,a){let i;Vi(c,La,h=>a(0,i=h));const n=[{name:"ai_user",description:i("cookies.overlay.table.row.ai_user.description")},{name:"ai_session",description:i("cookies.overlay.table.row.ai_session.description")},{name:"cookie_consent",description:i("cookies.overlay.table.row.cookie_consent.description")}];return[i,n,[{browser:"Internet Explorer",link:"https://support.microsoft.com/windows/delete-and-manage-cookies-168dab11-0753-043d-7c16-ede5947fc64d#ie=ie-11"},{browser:"Microsoft Edge",link:"https://support.microsoft.com/microsoft-edge/delete-cookies-in-microsoft-edge-63947406-40ac-c3b8-57b9-2a946a29ae09"},{browser:"Mozilla FireFox",link:"https://support.mozilla.org/kb/delete-cookies-remove-info-websites-stored"},{browser:"Google Chrome",link:"https://support.google.com/chrome/answer/95647"},{browser:"Opera",link:"https://help.opera.com/latest/web-preferences/#cookies"},{browser:"Safari",link:"https://support.apple.com/guide/safari/sfri11471/mac"},{browser:"Apple Devices",link:"https://support.apple.com/HT201265"},{browser:"Chrome for android",link:"https://support.google.com/chrome/answer/95647?co=GENIE.Platform%3DAndroid"}]]}class cye extends $o{constructor(o){super(),Vo(this,o,uye,sye,jo,{})}}function Oq(c,o,a){const i=c.slice();return i[9]=o[a],i}function lye(c){let o,a;return o=new cye({}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function Dq(c){let o,a=c[9]+"",i;return{c(){o=an("option"),i=Sr(a),o.__value=c[9],o.value=o.__value},m(n,s){_r(n,o,s),ft(o,i)},p:Fi,d(n){n&&br(o)}}}function fye(c){let o=c[3]("cookies.banner.buttons.accept")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&8&&o!==(o=i[3]("cookies.banner.buttons.accept")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function dye(c){let o=c[3]("cookies.banner.buttons.reject")+"",a;return{c(){a=Sr(o)},m(i,n){_r(i,a,n)},p(i,n){n&8&&o!==(o=i[3]("cookies.banner.buttons.reject")+"")&&Ur(a,o)},d(i){i&&br(a)}}}function hye(c){let o,a,i,n,s,h,v,g=c[3]("cookies.banner.title")+"",O,A,S,M,P,L,V=c[3]("cookies.banner.subtitle")+"",N,ee,J,K=c[3]("cookies.banner.text.pleaseHelp")+"",re,ce,pe,ke=c[3]("cookies.banner.text.description")+"",Ce,be,$e,ht,Dt,Ut=c[3]("cookies.banner.text.readMore")+"",Ee,Ot,zt,Mt=c[3]("cookies.banner.text.readMore.here")+"",Ke,Tt,vt,yt,bt,Ht,_t,Ze,Vt,sn,yn,Yt,We,Ye;o=new Qk({props:{isOpen:c[1],onClose:c[6],$$slots:{default:[lye]},$$scope:{ctx:c}}});let He=gN,dt=[];for(let It=0;It<He.length;It+=1)dt[It]=Dq(Oq(c,He,It));return _t=new vl({props:{color:"blue",onClick:c[4],$$slots:{default:[fye]},$$scope:{ctx:c}}}),sn=new vl({props:{color:"gray",onClick:c[5],$$slots:{default:[dye]},$$scope:{ctx:c}}}
9088),{c(){xi(o.$$.fragment),a=or(),i=an("div"),n=an("select");for(let It=0;It<dt.length;It+=1)dt[It].c();s=or(),h=an("div"),v=an("p"),O=Sr(g),A=or(),S=an("div"),M=an("div"),P=an("div"),L=an("p"),N=Sr(V),ee=or(),J=an("p"),re=Sr(K),ce=or(),pe=an("p"),Ce=Sr(ke),be=or(),$e=an("div"),ht=or(),Dt=an("p"),Ee=Sr(Ut),Ot=or(),zt=an("a"),Ke=Sr(Mt),Tt=or(),vt=an("div"),yt=or(),bt=an("div"),Ht=an("div"),xi(_t.$$.fragment),Ze=or(),Vt=an("div"),xi(sn.$$.fragment),Qt(n,"class","absolute bg-white right-5 top-5 text-black ml-2 mr-2 pl-2 pr-2"),c[2]===void 0&&Ll(()=>c[7].call(n)),Qt(v,"class","text-center font-bold text-red-400 text-2xl ml-auto mr-auto"),Qt(h,"class","ml-auto mr-auto mt-5"),Qt(L,"class","font-bold text-xl mb-2"),Qt($e,"class","mb-2"),Qt(zt,"href","/"),Qt(zt,"class","text-[#63BFC2] font-bold"),Qt(vt,"class","mb-2"),Qt(P,"class","mr-20 ml-20 mt-auto mb-auto"),Qt(M,"class","flex w-8/10 flex-col"),Qt(Ht,"class","flex-1 flex-col m-auto pl-4 pr-4"),Qt(Vt,"class","flex-1 flex-col m-auto pl-4 pr-4"),Qt(bt,"class","flex w-1/4 flex-row mr-4"),Qt(S,"class","flex w-full mb-5"),Qt(i,"class","fixed bottom-0 w-full bg-white")},m(It,ct){gi(o,It,ct),_r(It,a,ct),_r(It,i,ct),ft(i,n);for(let on=0;on<dt.length;on+=1)dt[on]&&dt[on].m(n,null);Nk(n,c[2],!0),ft(i,s),ft(i,h),ft(h,v),ft(v,O),ft(i,A),ft(i,S),ft(S,M),ft(M,P),ft(P,L),ft(L,N),ft(P,ee),ft(P,J),ft(J,re),ft(P,ce),ft(P,pe),ft(pe,Ce),ft(P,be),ft(P,$e),ft(P,ht),ft(P,Dt),ft(Dt,Ee),ft(Dt,Ot),ft(Dt,zt),ft(zt,Ke),ft(P,Tt),ft(P,vt),ft(S,yt),ft(S,bt),ft(bt,Ht),gi(_t,Ht,null),ft(bt,Ze),ft(bt,Vt),gi(sn,Vt,null),Yt=!0,We||(Ye=[sa(n,"change",c[7]),sa(zt,"click",c[8])],We=!0)},p(It,ct){const on={};if(ct&2&&(on.isOpen=It[1]),ct&2&&(on.onClose=It[6]),ct&4096&&(on.$$scope={dirty:ct,ctx:It}),o.$set(on),ct&0){He=gN;let xe;for(xe=0;xe<He.length;xe+=1){const jn=Oq(It,He,xe);dt[xe]?dt[xe].p(jn,ct):(dt[xe]=Dq(jn),dt[xe].c(),dt[xe].m(n,null))}for(;xe<dt.length;xe+=1)dt[xe].d(1);dt.length=He.length}ct&4&&Nk(n,It[2]),(!Yt||ct&8)&&g!==(g=It[3]("cookies.banner.title")+"")&&Ur(O,g),(!Yt||ct&8)&&V!==(V=It[3]("cookies.banner.subtitle")+"")&&Ur(N,V),(!Yt||ct&8)&&K!==(K=It[3]("cookies.banner.text.pleaseHelp")+"")&&Ur(re,K),(!Yt||ct&8)&&ke!==(ke=It[3]("cookies.banner.text.description")+"")&&Ur(Ce,ke),(!Yt||ct&8)&&Ut!==(Ut=It[3]("cookies.banner.text.readMore")+"")&&Ur(Ee,Ut),(!Yt||ct&8)&&Mt!==(Mt=It[3]("cookies.banner.text.readMore.here")+"")&&Ur(Ke,Mt);const Xt={};ct&4104&&(Xt.$$scope={dirty:ct,ctx:It}),_t.$set(Xt);const En={};ct&4104&&(En.$$scope={dirty:ct,ctx:It}),sn.$set(En)},i(It){Yt||(hr(o.$$.fragment,It),hr(_t.$$.fragment,It),hr(sn.$$.fragment,It),yn&&yn.end(1),Yt=!0)},o(It){Cr(o.$$.fragment,It),Cr(_t.$$.fragment,It),Cr(sn.$$.fragment,It),yn=qle(i,D6,{}),Yt=!1},d(It){vi(o,It),It&&br(a),It&&br(i),Pv(dt,It),vi(_t),vi(sn),It&&yn&&yn.end(),We=!1,Ul(Ye)}}}function pye(c){let o,a;return o=new eY({props:{isOpen:c[0],onClose:mye,$$slots:{default:[hye]},$$scope:{ctx:c}}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,[n]){const s={};n&1&&(s.isOpen=i[0]),n&4110&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}const mye=()=>{};function gye(c,o,a){let i,n;Vi(c,tA,M=>a(2,i=M)),Vi(c,La,M=>a(3,n=M));let s,h=!1;const v=()=>{Rv.setComplianceChoices({necessary:!0,analytics:!0}),a(0,s=!1)},g=()=>{Rv.setComplianceChoices({necessary:!0,analytics:!1}),a(0,s=!1)};Zx(()=>{a(0,s=!Rv.isComplianceSet())});const O=()=>a(1,h=!1);function A(){i=QB(this),tA.set(i)}return[s,h,i,n,v,g,O,A,M=>{M.preventDefault(),a(1,h=!0)}]}class vye extends $o{constructor(o){super(),Vo(this,o,gye,pye,jo,{})}}function yye(c){let o;return{c(){o=an("div"),o.innerHTML='<img alt="loading" src="imgs/loadingspinner.gif" width="150px"/>',Qt(o,"class","justify-center items-center self-center m-auto")},m(a,i){_r(a,o,i)},p:Fi,i:Fi,o:Fi,d(a){a&&br(o)}}}class bye extends $o{constructor(o){super(),Vo(this,o,null,yye,jo,{})}}function xye(c){let o,a,i,n,s=c[0]("compatibility.platform.notSupported")+"",h,v,g,O=c[0]("compatibility.platform.notSupported.joinDesktop")+"",A;return{c(){o=an("main"),a=an("p"),a.textContent="ultra:bit",i=or(),n=an("p"),h=Sr(s),v=or(),g=an("p"),A=Sr(O),Qt(a,"class","mb-4 text-white font-extrabold text-5xl"),Qt(o,"class","h-screen w-screen bg-[#63BFC2] flex flex-col justify-center items-center")},m(S,M){_r(S,o,M),ft(o,a),ft(o,i),ft(o,n),ft(n,h),ft(o,v),ft(o,g),ft(g,A)},p(S,[M]){M&1&&s!==(s=S[0]("compatibility.platform.notSupported")+"")&&Ur(h,s),M&1&&O!==(O=S[0]("compatibility.platform.notSupported.joinDesktop")+"")&&Ur(A,O)},i:Fi,o:Fi,d(S){S&&br(o)}}}function wye(c,o,a){let i;return Vi(c,La,n=>a(0,i=n)),[i]}class _ye extends $o{constructor(o){super(),Vo(this,o,wye,xye,jo,{})}}function Tq(c,o,a){const i=c.slice();return i[3]=o[a],i}function Nq(c){let o,a,i=c[3].browser+"",n,s,h,v,g=String(c[3].version)+"",O,A;return{c(){o=an("tr"),a=an("td"),n=Sr(i),s=or(),h=an("td"),v=Sr("v"),O=Sr(g),A=or(),Qt(h,"class","text-right"),Qt(o,"class","border-solid border-b-1")},m(S,M){_r(S,o,M),ft(o,a),ft(a,n),ft(o,s),ft(o,h),ft(h,v),ft(h,O),ft(o,A)},p:Fi,d(S){S&&br(o)}}}function kye(c){let o,a,i=c[1]("popup.compatibility.bluetooth.header")+"",n,s,h,v,g,O,A=c[1]("popup.compatibility.bluetooth.explain")+"",S,M,P,L,V,N=c[1]("popup.compatibility.bluetooth.advice")+"",ee,J,K,re,ce,pe,ke,Ce,be,$e,ht,Dt,Ut,Ee=eA.getSupp
9088ortedBrowsers(),Ot=[];for(let zt=0;zt<Ee.length;zt+=1)Ot[zt]=Nq(Tq(c,Ee,zt));return{c(){o=an("div"),a=an("h1"),n=Sr(i),s=or(),h=an("hr"),v=or(),g=an("div"),O=an("p"),S=Sr(A),M=or(),P=an("div"),L=or(),V=an("p"),ee=Sr(N),J=or(),K=an("div"),re=or(),ce=an("hr"),pe=or(),ke=an("div"),Ce=or(),be=an("div"),$e=an("table"),ht=an("thead"),ht.innerHTML=`<tr class="font-bold"><td>Browser</td> 9089 <td class="text-right">Version</td></tr>`,Dt=or(),Ut=an("tbody");for(let zt=0;zt<Ot.length;zt+=1)Ot[zt].c();Qt(a,"class","font-bold text-red-500 text-xl min-w-140"),Qt(P,"class","h-2"),Qt(g,"class","pt-3"),Qt(K,"class","h-4"),Qt(ke,"class","h-4"),Qt($e,"class","m-auto"),Qt(be,"class","pl-2 pt-2 w-full")},m(zt,Mt){_r(zt,o,Mt),ft(o,a),ft(a,n),ft(o,s),ft(o,h),ft(o,v),ft(o,g),ft(g,O),ft(O,S),ft(g,M),ft(g,P),ft(g,L),ft(g,V),ft(V,ee),ft(o,J),ft(o,K),ft(o,re),ft(o,ce),ft(o,pe),ft(o,ke),ft(o,Ce),ft(o,be),ft(be,$e),ft($e,ht),ft($e,Dt),ft($e,Ut);for(let Ke=0;Ke<Ot.length;Ke+=1)Ot[Ke]&&Ot[Ke].m(Ut,null)},p(zt,Mt){if(Mt&2&&i!==(i=zt[1]("popup.compatibility.bluetooth.header")+"")&&Ur(n,i),Mt&2&&A!==(A=zt[1]("popup.compatibility.bluetooth.explain")+"")&&Ur(S,A),Mt&2&&N!==(N=zt[1]("popup.compatibility.bluetooth.advice")+"")&&Ur(ee,N),Mt&0){Ee=eA.getSupportedBrowsers();let Ke;for(Ke=0;Ke<Ee.length;Ke+=1){const Tt=Tq(zt,Ee,Ke);Ot[Ke]?Ot[Ke].p(Tt,Mt):(Ot[Ke]=Nq(Tt),Ot[Ke].c(),Ot[Ke].m(Ut,null))}for(;Ke<Ot.length;Ke+=1)Ot[Ke].d(1);Ot.length=Ee.length}},d(zt){zt&&br(o),Pv(Ot,zt)}}}function Eye(c){let o,a;return o=new Qk({props:{isOpen:c[0],onClose:c[2],$$slots:{default:[kye]},$$scope:{ctx:c}}}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p(i,[n]){const s={};n&1&&(s.isOpen=i[0]),n&1&&(s.onClose=i[2]),n&66&&(s.$$scope={dirty:n,ctx:i}),o.$set(s)},i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function Cye(c,o,a){let i,n;return Vi(c,S$,h=>a(0,i=h)),Vi(c,La,h=>a(1,n=h)),[i,n,()=>{fu(S$,i=!1,i)}]}class Sye extends $o{constructor(o){super(),Vo(this,o,Cye,Eye,jo,{})}}function Aye(c){let o,a,i,n,s,h,v,g,O,A,S,M,P,L,V,N,ee,J,K=c[0].isLoading&&Iq();return i=new vye({}),s=new zfe({}),v=new Sye({}),A=new Rve({}),L=new jve({}),ee=new aye({}),{c(){K&&K.c(),o=or(),a=an("main"),xi(i.$$.fragment),n=or(),xi(s.$$.fragment),h=or(),xi(v.$$.fragment),g=or(),O=an("div"),xi(A.$$.fragment),S=or(),M=an("div"),P=an("div"),xi(L.$$.fragment),V=or(),N=an("div"),xi(ee.$$.fragment),Qt(O,"class","h-full flex min-w-75 max-w-75"),Qt(P,"class","relative z-1 flex-1 overflow-y-auto flex-row"),Qt(N,"class","h-160px w-full"),Qt(M,"class","h-full w-full overflow-y-hidden overflow-x-auto flex flex-col bg-[#63BFC2] shadow-2xl"),Qt(a,"class","h-screen w-screen m-0 relative flex"),Bi(a,"hidden",c[0].isLoading)},m(re,ce){K&&K.m(re,ce),_r(re,o,ce),_r(re,a,ce),gi(i,a,null),ft(a,n),gi(s,a,null),ft(a,h),gi(v,a,null),ft(a,g),ft(a,O),gi(A,O,null),ft(a,S),ft(a,M),ft(M,P),gi(L,P,null),ft(M,V),ft(M,N),gi(ee,N,null),J=!0},p(re,ce){re[0].isLoading?K?ce&1&&hr(K,1):(K=Iq(),K.c(),hr(K,1),K.m(o.parentNode,o)):K&&(Bs(),Cr(K,1,1,()=>{K=null}),Ps()),(!J||ce&1)&&Bi(a,"hidden",re[0].isLoading)},i(re){J||(hr(K),hr(i.$$.fragment,re),hr(s.$$.fragment,re),hr(v.$$.fragment,re),hr(A.$$.fragment,re),hr(L.$$.fragment,re),hr(ee.$$.fragment,re),J=!0)},o(re){Cr(K),Cr(i.$$.fragment,re),Cr(s.$$.fragment,re),Cr(v.$$.fragment,re),Cr(A.$$.fragment,re),Cr(L.$$.fragment,re),Cr(ee.$$.fragment,re),J=!1},d(re){K&&K.d(re),re&&br(o),re&&br(a),vi(i),vi(s),vi(v),vi(A),vi(L),vi(ee)}}}function Oye(c){let o,a;return o=new _ye({}),{c(){xi(o.$$.fragment)},m(i,n){gi(o,i,n),a=!0},p:Fi,i(i){a||(hr(o.$$.fragment,i),a=!0)},o(i){Cr(o.$$.fragment,i),a=!1},d(i){vi(o,i)}}}function Iq(c){let o,a,i,n;return a=new bye({}),{c(){o=an("main"),xi(a.$$.fragment),Qt(o,"class","h-screen w-screen bg-[#63BFC2] flex absolute z-10")},m(s,h){_r(s,o,h),gi(a,o,null),n=!0},i(s){n||(hr(a.$$.fragment,s),Ll(()=>{n&&(i||(i=Qd(o,ew,{},!0)),i.run(1))}),n=!0)},o(s){Cr(a.$$.fragment,s),i||(i=Qd(o,ew,{},!1)),i.run(0),n=!1},d(s){s&&br(o),vi(a),s&&i&&i.end()}}}function Dye(c){let o,a,i,n;const s=[Oye,Aye],h=[];function v(g,O){return UK.checkCompatibility().platformAllowed?1:0}return o=v(),a=h[o]=s[o](c),{c(){a.c(),i=Cm()},m(g,O){h[o].m(g,O),_r(g,i,O),n=!0},p(g,[O]){a.p(g,O)},i(g){n||(hr(a),n=!0)},o(g){Cr(a),n=!1},d(g){h[o].d(g),g&&br(i)}}}function Tye(c,o,a){let i;return Vi(c,No,n=>a(0,i=n)),mc.setInputBehaviour(new vfe),mc.setOutputBehaviour(new yfe),Rv.isReconnectFlagSet()&&(fu(No,i.offerReconnect=!0,i),fu(No,i.reconnectState=ed.INPUT,i),Rv.unsetReconnectFlag()),[i]}class Nye extends $o{constructor(o){super(),Vo(this,o,Tye,Dye,jo,{})}}/*! 9090 * Microsoft Dynamic Proto Utility, 1.1.8 9091 * Copyright (c) Microsoft and contributors. All rights reserved. 9092 */var sT,uT="undefined",TN="constructor",wb="prototype",NN="function",IN="_dynInstFuncs",j6="_isDynProxy",bk="_dynClass",Iye="_dynCls$",L6="_dynInstChk",cA=L6,VY="_dfOpts",Mq="_unknown_",$Y="__proto__",cT="_dyn"+$Y,Fq="__dynProto$Gbl",T5="_dynInstProto",qT="useBaseInst",z6="setInstFuncs",v4=Object,lA=v4.getPrototypeOf,Rq=v4.getOwnPropertyNames;function Mye(){var c;return typeof globalThis!==uT&&(c=globalThis),!c&&typeof self!==uT&&(c=self),!c&&typeof window!==uT&&(c=window),!c&&typeof global!==uT&&(c=global),c||{}}var Bq=Mye(),U6=Bq[Fq]||(Bq[Fq]={o:(sT={},sT[z6]=!0,sT[qT]=!0,sT),n:1e3});function _b(c,o){return c&&v4[wb].hasOwnProperty.call(c,o)}function HY(c){return c&&(c===v4[wb]||c===Array[wb])}function wP(c){return HY(c)||c===Function[wb]}function B2(c){var o;if(c){if(lA)return lA(c);var a=c[$Y]||c[wb]||(c[TN]?c[TN][wb]:null);o=c[cT]||a,_b(c,cT)||(delete c[T5],o=c[cT]=c[T5]||c[cT],c[T5]=a)}return o}function MN(c,o){var a=[];if(Rq)a=Rq(c);else for(var i in c)typeof i=="string"&&_b(c,i)&&a.push(i);if(a&&a.length>0)for(var n=0;n<a.length;n++)o(a[n])}function _P(c,o,a){return o!==TN&&typeof c[o]===NN&&(a||_b(c,o))}function FN(c){throw new TypeError("DynamicProto: "+c)}function Fye(c){var o={};return MN(c,function(a){!o[a]&&_P(c,a,!1)&&(o[a]=c[a])}),o}function kP(c,o){for(var a=c.length-1;a>=0;a--)if(c[a]===o)return!0;return!1}function Rye(c,o,a,i){function n(g,O,A){var S=O[A];if(S[j6]&&i){var M=g[IN]||{};M[cA]!==!1&&(S=(M[O[bk]]||{})[A]||S)}return function(){return S.apply(g,arguments)}}var s={};MN(a,function(g){s[g]=n(o,a,g)});for(var h=B2(c),v=[];h&&!wP(h)&&!kP(v,h);)MN(h,function(g){!s[g]&&_P(h,g,!lA)&&(s[g]=n(o,h,g))}),v.push(h),h=B2(h);return s}function Bye(c,o,a,i){var n=null;if(c&&_b(a,bk)){var s=c[IN]||{};if(n=(s[a[bk]]||{})[o],n||FN("Missing ["+o+"] "+NN),!n[L6]&&s[cA]!==!1){for(var h=!_b(c,o),v=B2(c),g=[];h&&v&&!wP(v)&&!kP(g,v);){var O=v[o];if(O){h=O===i;break}g.push(v),v=B2(v)}try{h&&(c[o]=n),n[L6]=1}catch{s[cA]=!1}}}return n}function Pye(c,o,a){var i=o[c];return i===a&&(i=B2(o)[c]),typeof i!==NN&&FN("["+c+"] is not a "+NN),i}function jye(c,o,a,i,n){function s(g,O){var A=function(){var S=Bye(this,O,g,A)||Pye(O,g,A);return S.apply(this,arguments)};return A[j6]=1,A}if(!HY(c)){var h=a[IN]=a[IN]||{},v=h[o]=h[o]||{};h[cA]!==!1&&(h[cA]=!!n),MN(a,function(g){_P(a,g,!1)&&a[g]!==i[g]&&(v[g]=a[g],delete a[g],(!_b(c,g)||c[g]&&!c[g][j6])&&
9092(c[g]=s(c,g)))})}}function Lye(c,o){if(lA){for(var a=[],i=B2(o);i&&!wP(i)&&!kP(a,i);){if(i===c)return!0;a.push(i),i=B2(i)}return!1}return!0}function N5(c,o){return _b(c,wb)?c.name||o||Mq:((c||{})[TN]||{}).name||o||Mq}function Wu(c,o,a,i){_b(c,wb)||FN("theClass is an invalid class definition.");var n=c[wb];Lye(n,o)||FN("["+N5(c)+"] not in hierarchy of ["+N5(o)+"]");var s=null;_b(n,bk)?s=n[bk]:(s=Iye+N5(c,"_")+"$"+U6.n,U6.n++,n[bk]=s);var h=Wu[VY],v=!!h[qT];v&&i&&i[qT]!==void 0&&(v=!!i[qT]);var g=Fye(o),O=Rye(n,o,g,v);a(o,O);var A=!!lA&&!!h[z6];A&&i&&(A=!!i[z6]),jye(n,s,o,g,A!==!1)}Wu[VY]=U6.o;var eE="function",Eb="object",Bx="undefined",dp="prototype",EP="hasOwnProperty",Cb=Object,CP=Cb[dp],W6=Cb.assign,zye=Cb.create,qY=Cb.defineProperty,P2=CP[EP],Pq=null;function tE(c){c===void 0&&(c=!0);var o=c===!1?null:Pq;return o||(typeof globalThis!==Bx&&(o=globalThis),!o&&typeof self!==Bx&&(o=self),!o&&typeof window!==Bx&&(o=window),!o&&typeof global!==Bx&&(o=global),Pq=o),o}function SP(c){throw new TypeError(c)}function GY(c){var o=zye;if(o)return o(c);if(c==null)return{};var a=typeof c;a!==Eb&&a!==eE&&SP("Object prototype may only be an Object:"+c);function i(){}return i[dp]=c,new i}(tE()||{}).Symbol;(tE()||{}).Reflect;var Uye=function(c){for(var o,a=1,i=arguments.length;a<i;a++){o=arguments[a];for(var n in o)CP[EP].call(o,n)&&(c[n]=o[n])}return c},lp=W6||Uye,V6=function(c,o){return V6=Cb.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var n in i)i[EP](n)&&(a[n]=i[n])},V6(c,o)};function Sb(c,o){typeof o!==eE&&o!==null&&SP("Class extends value "+String(o)+" is not a constructor or null"),V6(c,o);function a(){this.constructor=c}c[dp]=o===null?GY(o):(a[dp]=o[dp],new a)}function jq(c,o){for(var a=0,i=o.length,n=c.length;a<i;a++,n++)c[n]=o[a];return c}var j2="initialize",nw="name",$6="getNotifyMgr",$x="identifier",du="push",mb="isInitialized",L2="config",I5="instrumentationKey",o1="logger",Xa="length",zS="time",Yc="processNext",KY="getProcessTelContext",US="addNotificationListener",WS="removeNotificationListener",Lq="stopPollingInternalLogs",H6="onComplete",y4="getPlugin",RN="flush",lT="_extensions",jk="splice",lb="teardown",BN="messageId",xk="message",Lk="isAsync",q6="_doTeardown",fA="update",u1="getNext",z2="diagLog",dA="setNextPlugin",zk="createNew",G6="cookieCfg",SA="indexOf",PN="substring",jN="userAgent",hA="split",YY="setEnabled",sk="substr",M5="nodeType",Uk="apply",Hx="replace",zq="enableDebugExceptions",XY="logInternalMessage",K6="toLowerCase",hp="call",vb="type",AP="handler",G_="listeners",Y6="isChildEvt",wk="getCtx",i1="setCtx",X6="complete",J6="traceId",Uq="spanId",Q6="traceFlags",JY="version",Ya="",Wq="channels",jl="core",Vq="createPerfMgr",Z6="disabled",OP="extensionConfig",Wye="extensions",d1="processTelemetry",qx="priority",GT="eventsSent",VS="eventsDiscarded",KT="eventsSendRequest",hk="perfEvent",F5="errorToConsole",YT="warnToConsole",LN="getPerfMgr",QY="toISOString",ZY="endsWith",$q="indexOf",Hq="map",qq="reduce",eB="trim",eX="toString",Vye="__proto__",XT="constructor",Gq=qY,tB=Cb.freeze,Kq=Cb.keys,tX=String[dp],$ye=tX[eB],Hye=tX[ZY],qye=Date[dp],Gye=qye[QY],Kye=Array.isArray,nX=CP[eX],rX=P2[eX],Yye=rX[hp](Cb),Xye=/-([a-z])/g,Jye=/([^\w\d_$])/g,Qye=/^(\d+[\w\d_$])/,zN=Object.getPrototypeOf;function iX(c){if(c){if(zN)return zN(c);var o=c[Vye]||c[dp]||c[XT];if(o)return o}return null}function Qf(c){return c===void 0||typeof c===Bx}function _i(c){return c===null||Qf(c)}function Zye(c){return!_i(c)}function oX(c,o){return!!(c&&P2[hp](c,o))}function Lv(c){return!!(c&&typeof c===Eb)}function Ba(c){return!!(c&&typeof c===eE)}function UN(c){var o=c;return o&&aa(o)&&(o=o[Hx](Xye,function(a,i){return i.toUpperCase()}),o=o[Hx](Jye,"_"),o=o[Hx](Qye,function(a,i){return"_"+i})),o}function ac(c,o){if(c)for(var a in c)P2[hp](c,a)&&o[hp](c,a,c[a])}function e1e(c,o){var a=!1;return c&&o&&!(a=c===o)&&(a=Hye?c[ZY](o):t1e(c,o)),a}function t1e(c,o){var a=!1,i=o?o[Xa]:0,n=c?c[Xa]:0;if(i&&n&&n>=i&&!(a=c===o)){for(var s=n-1,h=i-1;h>=0;h--){if(c[s]!=o[h])return!1;s--}a=!0}return a}function Yd(c,o){return c&&o?c[SA](o)!==-1:!1}var mu=Kye||n1e;function n1e(c){return!!(c&&nX[hp](c)==="[object Array]")}function DP(c){return!!(c&&nX[hp](c)==="[object Error]")}function aa(c){return typeof c=="string"}function aX(c){return typeof c=="number"}function r1e(c){return typeof c=="boolean"}function Yq(c){var o=!1;if(c&&typeof c=="object"){var a=zN?zN(c):iX(c);a?(a[XT]&&P2[hp](a,XT)&&(a=a[XT]),o=typeof a===eE&&rX[hp](a)===Yye):o=!0}return o}function Wk(c){if(c)return Gye?c[QY]():i1e(c)}function i1e(c){if(c&&c.getUTCFullYear){var o=function(a){var i=String(a);return i[Xa]===1&&(i="0"+i),i};return c.getUTCFullYear()+"-"+o(c.getUTCMonth()+1)+"-"+o(c.getUTCDate())+"T"+o(c.getUTCHours())+":"+o(c.getUTCMinutes())+":"+o(c.getUTCSeconds())+"."+String((c.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}function Po(c,o,a){var i=c[Xa];try{for(var n=0;n<i&&!(n in c&&o[hp](a||c,c[n],n,c)===-1);n++);}catch{}}function Bv(c,o,a){if(c){if(c[$q])return c[$q](o,a);var i=c[Xa],n=a||0;try{for(var s=Math.max(n>=0?n:i-Math.abs(n),0);s<i;s++)if(s in c&&c[s]===o)return s}catch{}}return-1}function $S(c,o,a){var i;if(c){if(c[Hq])return c[Hq](o,a);var n=c[Xa],s=a||c;i=new Array(n);try{for(var h=0;h<n;h++)h in c&&(i[h]=o[hp](s,c[h],c))}catch{}}return i}function o1e(c,o,a){var i;if(c){if(c[qq])return c[qq](o,a);var n=c[Xa],s=0;if(arguments[Xa]>=3)i=arguments[2];else{for(;s<n&&!(s in c);)s++;i=c[s++]}for(;s<n;)s in c&&(i=o(i,c[s],s,c)),s++}return i}function fp(c){return c&&(c=$ye&&c[eB]?c[eB]():c[Hx]?c[Hx](/^\s+|(?=\s)\s+$/g,Ya):c),c}var Xq=!{toString:null}
9092.propertyIsEnumerable("toString"),R5=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];function U2(c){var o=typeof c;if(o!==eE&&(o!==Eb||c===null)&&SP("objKeys called on non-object"),!Xq&&Kq)return Kq(c);var a=[];for(var i in c)c&&P2[hp](c,i)&&a[du](i);if(Xq)for(var n=R5[Xa],s=0;s<n;s++)c&&P2[hp](c,R5[s])&&a[du](R5[s]);return a}function Px(c,o,a,i){if(Gq)try{var n={enumerable:!0,configurable:!0};return a&&(n.get=a),i&&(n.set=i),Gq(c,o,n),!0}catch{}return!1}function a1e(c){return c}function TP(c){return tB&&ac(c,function(o,a){(mu(a)||Lv(a))&&tB(a)}),_k(c)}var _k=tB||a1e;function h1(){var c=Date;return c.now?c.now():new c().getTime()}function Ss(c){return DP(c)?c[nw]:Ya}function Ms(c,o,a,i,n){var s=a;return c&&(s=c[o],s!==a&&(!n||n(s))&&(!i||i(a))&&(s=a,c[o]=s)),s}function hf(c,o,a){var i;return c?(i=c[o],!i&&_i(i)&&(i=Qf(a)?{}:a,c[o]=i)):i=Qf(a)?{}:a,i}function a1(c,o){return _i(c)?o:c}function nB(c){return!!c}function up(c){throw new Error(c)}function sX(c,o){var a=null,i=null;return Ba(c)?a=c:i=c,function(){var n=arguments;if(a&&(i=a()),i)return i[o][Uk](i,n)}}function s1e(c,o,a){if(c&&o&&Lv(c)&&Lv(o)){var i=function(s){if(aa(s)){var h=o[s];Ba(h)?(!a||a(s,!0,o,c))&&(c[s]=sX(o,s)):(!a||a(s,!1,o,c))&&(oX(c,s)&&delete c[s],Px(c,s,function(){return o[s]},function(v){o[s]=v})||(c[s]=h))}};for(var n in o)i(n)}return c}function NP(c,o,a,i,n){c&&o&&a&&(n!==!1||Qf(c[o]))&&(c[o]=sX(a,i))}function _S(c,o,a,i){return c&&o&&Lv(c)&&mu(a)&&Po(a,function(n){aa(n)&&NP(c,n,o,n,i)}),c}function u1e(c){return function(){function o(){var a=this;c&&ac(c,function(i,n){a[i]=n})}return o}()}function uX(c){return c&&W6&&(c=Cb(W6({},c))),c}function IP(c,o,a,i,n,s){var h=arguments,v=h[0]||{},g=h[Xa],O=!1,A=1;for(g>0&&r1e(v)&&(O=v,v=h[A]||{},A++),Lv(v)||(v={});A<g;A++){var S=h[A],M=mu(S),P=Lv(S);for(var L in S){var V=M&&L in S||P&&P2[hp](S,L);if(V){var N=S[L],ee=void 0;if(O&&N&&((ee=mu(N))||Yq(N))){var J=v[L];ee?mu(J)||(J=[]):Yq(J)||(J={}),N=IP(O,J,N)}N!==void 0&&(v[L]=N)}}}return v}function cX(c){var o={};return ac(c,function(a,i){o[a]=i,o[i]=a}),TP(o)}function c1e(c){var o={};return ac(c,function(a,i){o[a]=i[1],o[i[0]]=i[1]}),TP(o)}var lX="window",l1e="document",f1e="documentMode",d1e="navigator",h1e="history",p1e="location",m1e="console",g1e="performance",fX="JSON",v1e="crypto",y1e="msCrypto",b1e="ReactNative",rB="msie",iB="trident/",dX="XMLHttpRequest",B5=null,P5=null,x1e=!1,K_=null,j5=null;function hX(c,o){var a=!1;if(c){try{if(a=o in c,!a){var i=c[dp];i&&(a=o in i)}}catch{}if(!a)try{var n=new c;a=!Qf(n[o])}catch{}}return a}function zl(c){var o=tE();return o&&o[c]?o[c]:c===lX&&AA()?window:null}function AA(){return!!(typeof window===Eb&&window)}function Gx(){return AA()?window:zl(lX)}function pX(){return!!(typeof document===Eb&&document)}function Mg(){return pX()?document:zl(l1e)}function mX(){return!!(typeof navigator===Eb&&navigator)}function Ab(){return mX()?navigator:zl(d1e)}function gX(){return!!(typeof history===Eb&&history)}function w1e(){return gX()?history:zl(h1e)}function jx(c){if(c&&x1e){var o=zl("__mockLocation");if(o)return o}return typeof location===Eb&&location?location:zl(p1e)}function _1e(){return typeof console!==Bx?console:zl(m1e)}function rw(){return zl(g1e)}function nE(){return!!(typeof JSON===Eb&&JSON||zl(fX)!==null)}function zv(){return nE()?JSON||zl(fX):null}function k1e(){return zl(v1e)}function E1e(){return zl(y1e)}function C1e(){var c=Ab();return c&&c.product?c.product===b1e:!1}function oB(){var c=Ab();if(c&&(c[jN]!==P5||B5===null)){P5=c[jN];var o=(P5||Ya)[K6]();B5=Yd(o,rB)||Yd(o,iB)}return B5}function vX(c){if(c===void 0&&(c=null),!c){var o=Ab()||{};c=o?(o[jN]||Ya)[K6]():Ya}var a=(c||Ya)[K6]();if(Yd(a,rB)){var i=Mg()||{};return Math.max(parseInt(a[hA](rB)[1]),i[f1e]||0)}else if(Yd(a,iB)){var n=parseInt(a[hA](iB)[1]);if(n)return n+4}return null}function To(c){var o=Object[dp].toString[hp](c),a=Ya;return o==="[object Error]"?a="{ stack: '"+c.stack+"', message: '"+c.message+"', name: '"+c[nw]+"'":nE()&&(a=zv().stringify(c)),o+a}function fT(){return j5===null&&(j5=mX()&&!!Ab().sendBeacon),j5}function Jq(c){var o=!1;try{o=!!zl("fetch");var a=zl("Request");o&&c&&a&&(o=hX(a,"keepalive"))}catch{}return o}function Qq(){return K_===null&&(K_=typeof XDomainRequest!==Bx,K_&&WN()&&(K_=K_&&!hX(zl(dX),"withCredentials"))),K_}function WN(){var c=!1;try{var o=zl(dX);c=!!o}catch{}return c}var L5=["eventsSent","eventsDiscarded","eventsSendRequest","perfEvent"],VN=null,dT;function S1e(c,o){return function(){var a=arguments,i=yX(o);if(i){var n=i.listener;n&&n[c]&&n[c][Uk](n,a)}}}function A1e(){var c=zl("Microsoft");return c&&(VN=c.ApplicationInsights),VN}function yX(c){var o=VN;return!o&&c.disableDbgExt!==!0&&(o=VN||A1e()),o?o.ChromeDbgExt:null}function O1e(c){if(!dT){dT={};for(var o=0;o<L5[Xa];o++)dT[L5[o]]=S1e(L5[o],c)}return dT}var D1e="AI (Internal): ",T1e="AI: ",N1e="AITR_";function Zq(c){return c?'"'+c[Hx](/\"/g,Ya)+'"':Ya}function eG(c,o){var a=_1e();if(a){var i="log";a[c]&&(i=c),Ba(a[i])&&a[i](o)}}var pA=function(){function c(o,a,i,n){i===void 0&&(i=!1);var s=this;
9092s[BN]=o,s[xk]=(i?T1e:D1e)+o;var h=Ya;nE()&&(h=zv().stringify(n));var v=(a?" message:"+Zq(a):Ya)+(n?" props:"+Zq(h):Ya);s[xk]+=v}return c.dataType="MessageData",c}();function OA(c,o){return(c||{})[o1]||new b4(o)}var b4=function(){function c(o){this.identifier="DiagnosticLogger",this.queue=[];var a=0,i={},n,s,h,v;Wu(c,this,function(g){A(o||{}),g.consoleLoggingLevel=function(){return n},g.telemetryLoggingLevel=function(){return s},g.maxInternalMessageLimit=function(){return h},g[zq]=function(){return v},g.throwInternal=function(P,L,V,N,ee){ee===void 0&&(ee=!1);var J=new pA(L,V,ee,N);if(v)throw To(J);var K=P===1?F5:YT;if(Qf(J[xk]))M("throw"+(P===1?"Critical":"Warning"),J);else{if(ee){var re=+J[BN];!i[re]&&n>=P&&(g[K](J[xk]),i[re]=!0)}else n>=P&&g[K](J[xk]);O(P,J)}},g[YT]=function(P){eG("warn",P),M("warning",P)},g[F5]=function(P){eG("error",P),M("error",P)},g.resetInternalMessageCount=function(){a=0,i={}},g[XY]=O;function O(P,L){if(!S()){var V=!0,N=N1e+L[BN];if(i[N]?V=!1:i[N]=!0,V&&(P<=s&&(g.queue[du](L),a++,M(P===1?"error":"warn",L)),a===h)){var ee="Internal events throttle limit per PageView reached for this app.",J=new pA(23,ee,!1);g.queue[du](J),P===1?g[F5](ee):g[YT](ee)}}}function A(P){n=a1(P.loggingLevelConsole,0),s=a1(P.loggingLevelTelemetry,1),h=a1(P.maxMessageLimit,25),v=a1(P[zq],!1)}function S(){return a>=h}function M(P,L){var V=yX(o||{});V&&V[z2]&&V[z2](P,L)}})}return c.__ieDyn=1,c}();function MP(c){return c||new b4}function Ni(c,o,a,i,n,s){s===void 0&&(s=!1),MP(c).throwInternal(o,a,i,n,s)}function _2(c,o){MP(c)[YT](o)}function I1e(c,o,a){MP(c)[XY](o,a)}var kk="ctx",aB="ParentContextKey",HS="ChildrenContextKey",M1e=null,JT=function(){function c(o,a,i){var n=this,s=!1;if(n.start=h1(),n[nw]=o,n[Lk]=i,n[Y6]=function(){return!1},Ba(a)){var h;s=Px(n,"payload",function(){return!h&&Ba(a)&&(h=a(),a=null),h})}n[wk]=function(v){return v?v===c[aB]||v===c[HS]?n[v]:(n[kk]||{})[v]:null},n[i1]=function(v,g){if(v)if(v===c[aB])n[v]||(n[Y6]=function(){return!0}),n[v]=g;else if(v===c[HS])n[v]=g;else{var O=n[kk]=n[kk]||{};O[v]=g}},n[X6]=function(){var v=0,g=n[wk](c[HS]);if(mu(g))for(var O=0;O<g[Xa];O++){var A=g[O];A&&(v+=A[zS])}n[zS]=h1()-n.start,n.exTime=n[zS]-v,n[X6]=function(){},!s&&Ba(a)&&(n.payload=a())}}return c.ParentContextKey="parent",c.ChildrenContextKey="childEvts",c}(),F1e=function(){function c(o){this.ctx={},Wu(c,this,function(a){a.create=function(i,n,s){return new JT(i,n,s)},a.fire=function(i){i&&(i[X6](),o&&Ba(o[hk])&&o[hk](i))},a[i1]=function(i,n){if(i){var s=a[kk]=a[kk]||{};s[i]=n}},a[wk]=function(i){return(a[kk]||{})[i]}})}return c.__ieDyn=1,c}(),z5="CoreUtils.doPerf";function $N(c,o,a,i,n){if(c){var s=c;if(s[LN]&&(s=s[LN]()),s){var h=void 0,v=s[wk](z5);try{if(h=s.create(o(),i,n),h){if(v&&h[i1]&&(h[i1](JT[aB],v),v[wk]&&v[i1])){var g=v[wk](JT[HS]);g||(g=[],v[i1](JT[HS],g)),g[du](h)}return s[i1](z5,h),a(h)}}catch(O){h&&h[i1]&&h[i1]("exception",O)}finally{h&&s.fire(h),s[i1](z5,v)}}}return a()}function R1e(){return M1e}var bX=4294967296,D2=4294967295,xX=!1,kS=123456789,ES=987654321;function B1e(c){c<0&&(c>>>=0),kS=123456789+c&D2,ES=987654321-c&D2,xX=!0}function P1e(){try{var c=h1()&2147483647;B1e((Math.random()*bX^c)+c)}catch{}}function HN(c){var o=0,a=k1e()||E1e();return a&&a.getRandomValues&&(o=a.getRandomValues(new Uint32Array(1))[0]&D2),o===0&&oB()&&(xX||P1e(),o=j1e()&D2),o===0&&(o=Math.floor(bX*Math.random()|0)),c||(o>>>=0),o}function j1e(c){ES=36969*(ES&65535)+(ES>>16)&D2,kS=18e3*(kS&65535)+(kS>>16)&D2;var o=(ES<<16)+(kS&65535)>>>0&D2|0;return c||(o>>>=0),o}function FP(c){c===void 0&&(c=22);for(var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=HN()>>>0,i=0,n=Ya;n[Xa]<c;)i++,n+=o.charAt(a&63),a>>>=6,i===5&&(a=(HN()<<2&4294967295|a&3)>>>0,i=0);return n}var tG=qY,wX="2.8.11",L1e="."+FP(6),z1e=0;function U1e(c,o,a){if(tG)try{return tG(c,o,{value:a,enumerable:!1,configurable:!0}),!0}catch{}return!1}function _X(c){return c[M5]===1||c[M5]===9||!+c[M5]}function W1e(c,o){var a=o[c.id];if(!a){a={};try{_X(o)&&(U1e(o,c.id,a)||(o[c.id]=a))}catch{}}return a}function Ob(c,o){return o===void 0&&(o=!1),UN(c+z1e+++(o?"."+wX:Ya)+L1e)}function kX(c){var o={id:Ob("_aiData-"+(c||Ya)+"."+wX),accept:function(a){return _X(a)},get:function(a,i,n,s){var h=a[o.id];return h?h[UN(i)]:(s&&(h=W1e(o,a),h[UN(i)]=n),n)},kill:function(a,i){if(a&&a[i])try{delete a[i]}catch{}}};return o}var nG="toGMTString",rG="toUTCString",RP="cookie",U5="expires",sB="enabled",iG="isCookieUseDisabled",oG="disableCookiesUsage",Lx="_ckMgr",hT=null,W5=null,aG=null,mA=Mg(),sG={},qN={};function V1e(c,o){var a=qS[Lx]||qN[Lx];return a||(a=qS[Lx]=qS(c,o),qN[Lx]=a),a}function pT(c){return c?c.isEnabled():!0}function $1e(c){var o=c[G6]=c[G6]||{};if(Ms(o,"domain",c.cookieDomain,Zye,_i),Ms(o,"path",c.cookiePath||"/",null,_i),_i(o[sB])){var a=void 0;Qf(c[iG])||(a=!c[iG]),Qf(c[oG])||(a=!c[oG]),o[sB]=a}return o}function EX(c,o){return o&&c&&mu(c.ignoreCookies)?c.ignoreCookies[SA](o)!==-1:!1}function H1e(c,o){return o&&c&&mu(c.blockedCookies)&&c.blockedCookies[SA](o)!==-1?!0:EX(c,o)}function BP(c,o){var a;if(c)a=c.getCookieMgr();else if(o){var i=o[G6];i[Lx]?a=i[Lx]:a=qS(o)}return a||(a=V1e(o,(c||{})[o1])),a}function qS(c,o){var a,i=$1e(c||qN),n=i.path||"/",s=i.domain,h=i[sB]!==!1,v=(a={isEnabled:function(){var g=h&&uG(o),O=qN[Lx];return g&&O&&v!==O&&(g=pT(O)),g}},a[YY]=function(g){h=g!==!1},a.set=function(g,O,A,S,M){var P=!1;
9092if(pT(v)&&!H1e(i,g)){var L={},V=fp(O||Ya),N=V[SA](";");if(N!==-1&&(V=fp(O[PN](0,N)),L=CX(O[PN](N+1))),Ms(L,"domain",S||s,nB,Qf),!_i(A)){var ee=oB();if(Qf(L[U5])){var J=h1(),K=J+A*1e3;if(K>0){var re=new Date;re.setTime(K),Ms(L,U5,cG(re,ee?nG:rG)||cG(re,ee?nG:rG)||Ya,nB)}}ee||Ms(L,"max-age",Ya+A,null,Qf)}var ce=jx();ce&&ce.protocol==="https:"&&(Ms(L,"secure",null,null,Qf),W5===null&&(W5=!G1e((Ab()||{})[jN])),W5&&Ms(L,"SameSite","None",null,Qf)),Ms(L,"path",M||n,null,Qf);var pe=i.setCookie||fG;pe(g,lG(V,L)),P=!0}return P},a.get=function(g){var O=Ya;return pT(v)&&!EX(i,g)&&(O=(i.getCookie||q1e)(g)),O},a.del=function(g,O){var A=!1;return pT(v)&&(A=v.purge(g,O)),A},a.purge=function(g,O){var A,S=!1;if(uG(o)){var M=(A={},A.path=O||"/",A[U5]="Thu, 01 Jan 1970 00:00:01 GMT",A);oB()||(M["max-age"]="0");var P=i.delCookie||fG;P(g,lG(Ya,M)),S=!0}return S},a);return v[Lx]=v,v}function uG(c){if(hT===null){hT=!1;try{var o=mA||{};hT=o[RP]!==void 0}catch(a){Ni(c,2,68,"Cannot access document.cookie - "+Ss(a),{exception:To(a)})}}return hT}function CX(c){var o={};if(c&&c[Xa]){var a=fp(c)[hA](";");Po(a,function(i){if(i=fp(i||Ya),i){var n=i[SA]("=");n===-1?o[i]=null:o[fp(i[PN](0,n))]=fp(i[PN](n+1))}})}return o}function cG(c,o){return Ba(c[o])?c[o]():null}function lG(c,o){var a=c||Ya;return ac(o,function(i,n){a+="; "+i+(_i(n)?Ya:"="+n)}),a}function q1e(c){var o=Ya;if(mA){var a=mA[RP]||Ya;aG!==a&&(sG=CX(a),aG=a),o=fp(sG[c]||Ya)}return o}function fG(c,o){mA&&(mA[RP]=c+"="+o)}function G1e(c){return aa(c)?!!(Yd(c,"CPU iPhone OS 12")||Yd(c,"iPad; CPU OS 12")||Yd(c,"Macintosh; Intel Mac OS X 10_14")&&Yd(c,"Version/")&&Yd(c,"Safari")||Yd(c,"Macintosh; Intel Mac OS X 10_14")&&e1e(c,"AppleWebKit/605.1.15 (KHTML, like Gecko)")||Yd(c,"Chrome/5")||Yd(c,"Chrome/6")||Yd(c,"UnrealEngine")&&!Yd(c,"Chrome")||Yd(c,"UCBrowser/12")||Yd(c,"UCBrowser/11")):!1}var SX="on",dG="attachEvent",hG="addEventListener",pG="detachEvent",mG="removeEventListener",uB="events",cB="visibilitychange",x4="pagehide",AX="unload",OX="beforeunload",DX=Ob("aiEvtPageHide");Ob("aiEvtPageShow");var K1e=/\.[\.]+/g,Y1e=/[\.]+$/,X1e=1,GN=kX("events"),J1e=/^([^.]*)(?:\.(.+)|)/;function gG(c){return c&&c[Hx]?c[Hx](/^[\s\.]+|(?=[\s\.])[\.\s]+$/g,Ya):c}function PP(c,o){var a;if(o){var i=Ya;mu(o)?(i=Ya,Po(o,function(s){s=gG(s),s&&(s[0]!=="."&&(s="."+s),i+=s)})):i=gG(o),i&&(i[0]!=="."&&(i="."+i),c=(c||Ya)+i)}var n=J1e.exec(c||Ya)||[];return a={},a[vb]=n[1],a.ns=(n[2]||Ya).replace(K1e,".").replace(Y1e,Ya)[hA](".").sort().join("."),a}function TX(c,o,a){a===void 0&&(a=!0);var i=GN.get(c,uB,{},a),n=i[o];return n||(n=i[o]=[]),n}function NX(c,o,a,i){c&&o&&o[vb]&&(c[mG]?c[mG](o[vb],a,i):c[pG]&&c[pG](SX+o[vb],a))}function Q1e(c,o,a,i){var n=!1;return c&&o&&o[vb]&&a&&(c[hG]?(c[hG](o[vb],a,i),n=!0):c[dG]&&(c[dG](SX+o[vb],a),n=!0)),n}function vG(c,o,a,i){for(var n=o[Xa];n--;){var s=o[n];s&&(!a.ns||a.ns===s.evtName.ns)&&(!i||i(s))&&(NX(c,s.evtName,s[AP],s.capture),o[jk](n,1))}}function Z1e(c,o,a){if(o[vb])vG(c,TX(c,o[vb]),o,a);else{var i=GN.get(c,uB,{});ac(i,function(n,s){vG(c,s,o,a)}),U2(i)[Xa]===0&&GN.kill(c,uB)}}function V2(c,o){var a;return o?(mu(o)?a=[c].concat(o):a=[c,o],a=PP("xx",a).ns[hA](".")):a=c,a}function Kx(c,o,a,i,n){var s;n===void 0&&(n=!1);var h=!1;if(c)try{var v=PP(o,i);if(h=Q1e(c,v,a,n),h&&GN.accept(c)){var g=(s={guid:X1e++,evtName:v},s[AP]=a,s.capture=n,s);TX(c,v.type)[du](g)}}catch{}return h}function GS(c,o,a,i,n){if(n===void 0&&(n=!1),c)try{var s=PP(o,i),h=!1;Z1e(c,s,function(v){return s.ns&&!a||v[AP]===a?(h=!0,!0):!1}),h||NX(c,s,a,n)}catch{}}function ebe(c,o,a){var i=!1,n=Gx();n&&(i=Kx(n,c,o,a),i=Kx(n.body,c,o,a)||i);var s=Mg();return s&&(i=Kx(s,c,o,a)||i),i}function tbe(c,o,a){var i=Gx();i&&(GS(i,c,o,a),GS(i.body,c,o,a));var n=Mg();n&&GS(n,c,o,a)}function KN(c,o,a,i){var n=!1;return o&&c&&c[Xa]>0&&Po(c,function(s){s&&(!a||Bv(a,s)===-1)&&(n=ebe(s,o,i)||n)}),n}function nbe(c,o,a,i){var n=!1;return o&&c&&mu(c)&&(n=KN(c,o,a,i),!n&&a&&a[Xa]>0&&(n=KN(c,o,null,i))),n}function lB(c,o,a){c&&mu(c)&&Po(c,function(i){i&&tbe(i,o,a)})}function rbe(c,o,a){return nbe([OX,AX,x4],c,o,a)}function ibe(c,o){lB([OX,AX,x4],c,o)}function fB(c,o,a){function i(h){var v=Mg();c&&v&&v.visibilityState==="hidden"&&c(h)}var n=V2(DX,a),s=KN([x4],c,o,n);return(!o||Bv(o,cB)===-1)&&(s=KN([cB],i,o,n)||s),!s&&o&&(s=fB(c,null,a)),s}function obe(c,o){var a=V2(DX,o);lB([x4],c,a),lB([cB],null,a)}function zx(){for(var c=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],o=Ya,a,i=0;i<4;i++)a=HN(),o+=c[a&15]+c[a>>4&15]+c[a>>8&15]+c[a>>12&15]+c[a>>16&15]+c[a>>20&15]+c[a>>24&15]+c[a>>28&15];var n=c[8+(HN()&3)|0];return o[sk](0,8)+o[sk](9,4)+"4"+o[sk](13,3)+n+o[sk](16,3)+o[sk](19,12)}var dB="00",abe="ff",IX="00000000000000000000000000000000",MX="0000000000000000";function DA(c,o,a){return c&&c[Xa]===o&&c!==a?!!c.match(/^[\da-f]*$/):!1}function yG(c,o,a){return DA(c,o)?c:a}function sbe(c){(isNaN(c)||c<0||c>255)&&(c=1);for(var o=c.toString(16);o[Xa]<2;)o="0"+o;return o}function bG(c,o,a,i){var n;return n={},n[JY]=DA(i,2,abe)?i:dB,n[J6]=jP(c)?c:zx(),n.spanId=LP(o)?o:zx()[sk](0,
909216),n.traceFlags=a>=0&&a<=255?a:1,n}function jP(c){return DA(c,32,IX)}function LP(c){return DA(c,16,MX)}function xG(c){if(c){var o=sbe(c[Q6]);DA(o,2)||(o="01");var a=c[JY]||dB;return a!=="00"&&a!=="ff"&&(a=dB),"".concat(a,"-").concat(yG(c.traceId,32,IX),"-").concat(yG(c.spanId,16,MX),"-").concat(o)}return""}var ube=kX("plugin");function T2(c){return ube.get(c,"state",{},!0)}function FX(c,o){for(var a=[],i=null,n=c[u1](),s;n;){var h=n[y4]();if(h){i&&Ba(i[dA])&&Ba(h[d1])&&i[dA](h);var v=!1;Ba(h[mb])?v=h[mb]():(s=T2(h),v=s[mb]),v||a[du](h),i=h,n=n[u1]()}}Po(a,function(g){var O=c[jl]();g[j2](c.getCfg(),O,o,c[u1]()),s=T2(g),!g[jl]&&!s[jl]&&(s[jl]=O),s[mb]=!0,delete s[lb]})}function V5(c){return c.sort(function(o,a){var i=0;if(a){var n=Ba(a[d1]);Ba(o[d1])?i=n?o[qx]-a[qx]:1:n&&(i=-1)}else i=o?1:-1;return i})}function cbe(c){var o={};return{getName:function(){return o[nw]},setName:function(a){c&&c.setName(a),o[nw]=a},getTraceId:function(){return o[J6]},setTraceId:function(a){c&&c.setTraceId(a),jP(a)&&(o[J6]=a)},getSpanId:function(){return o[Uq]},setSpanId:function(a){c&&c.setSpanId(a),LP(a)&&(o[Uq]=a)},getTraceFlags:function(){return o[Q6]},setTraceFlags:function(a){c&&c.setTraceFlags(a),o[Q6]=a}}}var lbe="TelemetryPluginChain",wG="_hasRun",_G="_getTelCtx",kG=0;function fbe(c,o,a){for(;c;){if(c[y4]()===a)return c;c=c[u1]()}return iw([a],o[L2]||{},o)}function zP(c,o,a,i){var n=null,s=[];i!==null&&(n=i?fbe(c,a,i):c);var h={_next:g,ctx:{core:function(){return a},diagLog:function(){return OA(a,o)},getCfg:function(){return o},getExtCfg:O,getConfig:A,hasNext:function(){return!!n},getNext:function(){return n},setNext:function(M){n=M},iterate:S,onComplete:v}};function v(M,P){for(var L=[],V=2;V<arguments.length;V++)L[V-2]=arguments[V];M&&s[du]({func:M,self:Qf(P)?h.ctx:P,args:L})}function g(){var M=n;if(n=M?M[u1]():null,!M){var P=s;P&&P[Xa]>0&&(Po(P,function(L){try{L.func[hp](L.self,L.args)}catch(V){Ni(a[o1],2,73,"Unexpected Exception during onComplete - "+To(V))}}),s=[])}return M}function O(M,P,L){P===void 0&&(P={}),L===void 0&&(L=0);var V;if(o){var N=o[OP];N&&M&&(V=N[M])}if(!V)V=P;else if(Lv(P)&&L!==0){var ee=IP(!0,P,V);o&&L===2&&ac(P,function(J){if(_i(ee[J])){var K=o[J];_i(K)||(ee[J]=K)}}),V=ee}return V}function A(M,P,L){L===void 0&&(L=!1);var V,N=O(M,null);return N&&!_i(N[P])?V=N[P]:o&&!_i(o[P])&&(V=o[P]),_i(V)?L:V}function S(M){for(var P;P=h._next();){var L=P[y4]();L&&M(L)}}return h}function p1(c,o,a,i){var n=zP(c,o,a,i),s=n.ctx;function h(g){var O=n._next();return O&&O[d1](g,s),!O}function v(g,O){return g===void 0&&(g=null),mu(g)&&(g=iw(g,o,a,O)),p1(g||s[u1](),o,a,O)}return s[Yc]=h,s[zk]=v,s}function YN(c,o,a){var i=o[L2]||{},n=zP(c,i,o,a),s=n.ctx;function h(g){var O=n._next();return O&&O.unload(s,g),!O}function v(g,O){return g===void 0&&(g=null),mu(g)&&(g=iw(g,i,o,O)),YN(g||s[u1](),o,O)}return s[Yc]=h,s[zk]=v,s}function UP(c,o,a){var i=o[L2]||{},n=zP(c,i,o,a),s=n.ctx;function h(g){return s.iterate(function(O){Ba(O[fA])&&O[fA](s,g)})}function v(g,O){return g===void 0&&(g=null),mu(g)&&(g=iw(g,i,o,O)),UP(g||s[u1](),o,O)}return s[Yc]=h,s[zk]=v,s}function iw(c,o,a,i){var n=null,s=!i;if(mu(c)&&c[Xa]>0){var h=null;Po(c,function(v){if(!s&&i===v&&(s=!0),s&&v&&Ba(v[d1])){var g=dbe(v,o,a);n||(n=g),h&&h._setNext(g),h=g}})}return i&&!n?iw([i],o,a):n}function dbe(c,o,a){var i=null,n=Ba(c[d1]),s=Ba(c[dA]),h;c?h=c[$x]+"-"+c[qx]+"-"+kG++:h="Unknown-0-"+kG++;var v={getPlugin:function(){return c},getNext:function(){return i},processTelemetry:A,unload:S,update:M,_id:h,_setNext:function(P){i=P}};function g(){var P;return c&&Ba(c[_G])&&(P=c[_G]()),P||(P=p1(v,o,a)),P}function O(P,L,V,N,ee){var J=!1,K=c?c[$x]:lbe,re=P[wG];return re||(re=P[wG]={}),P.setNext(i),c&&$N(P[jl](),function(){return K+":"+V},function(){re[h]=!0;try{var ce=i?i._id:Ya;ce&&(re[ce]=!1),J=L(P)}catch(ke){var pe=i?re[i._id]:!0;pe&&(J=!0),(!i||!pe)&&Ni(P[z2](),1,73,"Plugin ["+K+"] failed during "+V+" - "+To(ke)+", run flags: "+To(re))}},N,ee),J}function A(P,L){L=L||g();function V(N){if(!c||!n)return!1;var ee=T2(c);return ee[lb]||ee[Z6]?!1:(s&&c[dA](i),c[d1](P,N),!0)}O(L,V,"processTelemetry",function(){return{item:P}},!P.sync)||L[Yc](P)}function S(P,L){function V(){var N=!1;if(c){var ee=T2(c),J=c[jl]||ee[jl];c&&(!J||J===P.core())&&!ee[lb]&&(ee[jl]=null,ee[lb]=!0,ee[mb]=!1,c[lb]&&c[lb](P,L)===!0&&(N=!0))}return N}O(P,V,"unload",function(){},L[Lk])||P[Yc](L)}function M(P,L){function V(){var N=!1;if(c){var ee=T2(c),J=c[jl]||ee[jl];c&&(!J||J===P.core())&&!ee[lb]&&c[fA]&&c[fA](P,L)===!0&&(N=!0)}return N}O(P,V,"update",function(){},!1)||P[Yc](L)}return _k(v)}
9092var w4=500,hbe="Channel has invalid priority - ";function EG(c,o,a){o&&mu(o)&&o[Xa]>0&&(o=o.sort(function(i,n){return i[qx]-n[qx]}),Po(o,function(i){i[qx]<w4&&up(hbe+i[$x])}),c[du]({queue:_k(o),chain:iw(o,a[L2],a)}))}function pbe(c,o){function a(){return p1(null,o[L2],o,null)}function i(O,A,S,M){var P=O?O[Xa]+1:1;function L(){P--,P===0&&(M&&M(),M=null)}P>0&&Po(O,function(V){if(V&&V.queue[Xa]>0){var N=V.chain,ee=A[zk](N);ee[H6](L),S(ee)}else P--}),L()}function n(O,A){var S=A||{reason:0};return i(c,O,function(M){M[Yc](S)},function(){O[Yc](S)}),!0}function s(O,A){var S=A||{reason:0,isAsync:!1};return i(c,O,function(M){M[Yc](S)},function(){O[Yc](S),v=!1}),!0}function h(O){var A=null;return c&&c[Xa]>0&&Po(c,function(S){if(S&&S.queue[Xa]>0&&(Po(S.queue,function(M){if(M[$x]===O)return A=M,-1}),A))return-1}),A}var v=!1,g={identifier:"ChannelControllerPlugin",priority:w4,initialize:function(O,A,S,M){v=!0,Po(c,function(P){P&&P.queue[Xa]>0&&FX(p1(P.chain,O,A),S)})},isInitialized:function(){return v},processTelemetry:function(O,A){i(c,A||a(),function(S){S[Yc](O)},function(){A[Yc](O)})},update:n,pause:function(){i(c,a(),function(O){O.iterate(function(A){A.pause&&A.pause()})},null)},resume:function(){i(c,a(),function(O){O.iterate(function(A){A.resume&&A.resume()})},null)},teardown:s,getChannel:h,flush:function(O,A,S,M){var P=1,L=!1,V=null;M=M||5e3;function N(){P--,L&&P===0&&(V&&(clearTimeout(V),V=null),A&&A(L),A=null)}return i(c,a(),function(ee){ee.iterate(function(J){if(J[RN]){P++;var K=!1;J[RN](O,function(){K=!0,N()},S)||K||(O&&V==null?V=setTimeout(function(){V=null,N()},M):N())}})},function(){L=!0,N()}),!0},_setQueue:function(O){c=O}};return g}function mbe(c,o,a){var i=[];if(c&&Po(c,function(s){return EG(i,s,a)}),o){var n=[];Po(o,function(s){s[qx]>w4&&n[du](s)}),EG(i,n,a)}return i}function RX(){var c=[];function o(i){i&&c[du](i)}function a(i,n){Po(c,function(s){try{s(i,n)}catch(h){Ni(i[z2](),2,73,"Unexpected error calling unload handler - "+To(h))}}),c=[]}return{add:o,run:a}}var xx="getPlugin",TA=function(){function c(){var o=this,a,i,n,s,h;O(),Wu(c,o,function(A){A[j2]=function(S,M,P,L){g(S,M,L),a=!0},A[lb]=function(S,M){var P,L=A[jl];if(!L||S&&L!==S[jl]())return;var V,N=!1,ee=S||YN(null,L,n&&n[xx]?n[xx]():n),J=M||(P={reason:0},P[Lk]=!1,P);function K(){if(!N){N=!0,s.run(ee,M);var re=h;h=[],Po(re,function(ce){ce.rm()}),V===!0&&ee[Yc](J),O()}}return!A[q6]||A[q6](ee,J,K)!==!0?K():V=!0,V},A[fA]=function(S,M){var P=A[jl];if(!P||S&&P!==S[jl]())return;var L,V=!1,N=S||UP(null,P,n&&n[xx]?n[xx]():n),ee=M||{reason:0};function J(){V||(V=!0,g(N.getCfg(),N.core(),N[u1]()))}return!A._doUpdate||A._doUpdate(N,ee,J)!==!0?J():L=!0,L},A._addHook=function(S){S&&(mu(S)?h=h.concat(S):h[du](S))},NP(A,"_addUnloadCb",function(){return s},"add")}),o[z2]=function(A){return v(A)[z2]()},o[mb]=function(){return a},o.setInitialized=function(A){a=A},o[dA]=function(A){n=A},o[Yc]=function(A,S){S?S[Yc](A):n&&Ba(n[d1])&&n[d1](A,null)},o._getTelCtx=v;function v(A){A===void 0&&(A=null);var S=A;if(!S){var M=i||p1(null,{},o[jl]);n&&n[xx]?S=M[zk](null,n[xx]):S=M[zk](null,n)}return S}function g(A,S,M){A&&Ms(A,OP,[],null,_i),!M&&S&&(M=S[KY]()[u1]());var P=n;n&&n[xx]&&(P=n[xx]()),o[jl]=S,i=p1(M,A,S,P)}function O(){a=!1,o[jl]=null,i=null,n=null,h=[],s=RX()}}return c.__ieDyn=1,c}(),gbe=function(c){Sb(o,c);function o(){var a=c.call(this)||this;a.identifier="TelemetryInitializerPlugin",a.priority=199;var i,n;s(),Wu(o,a,function(h,v){h.addTelemetryInitializer=function(g){var O={id:i++,fn:g};n[du](O);var A={remove:function(){Po(n,function(S,M){if(S.id===O.id)return n[jk](M,1),-1})}};return A},h[d1]=function(g,O){for(var A=!1,S=n[Xa],M=0;M<S;++M){var P=n[M];if(P)try{if(P.fn[Uk](null,[g])===!1){A=!0;break}}catch(L){Ni(O[z2](),1,64,"One of telemetry initializers failed, telemetry item will not be sent: "+Ss(L),{exception:To(L)},!0)}}A||h[Yc](g,O)},h[q6]=function(){s()}});function s(){i=0,n=[]}return a}return o.__ieDyn=1,o}(TA),BX="Plugins must provide initialize method",CG="_notificationManager",SG="SDK is still unloading...",vbe="SDK is not initialized",ybe={loggingLevelConsole:1};function bbe(c,o){return new F1e(o)}function xbe(c,o,a){var i,n=[],s={};return Po(a,function(h){(_i(h)||_i(h[j2]))&&up(BX);var v=h[qx],g=h[$x];h&&v&&(_i(s[v])?s[v]=g:_2(c,"Two extensions have same priority #"+v+" - "+s[v]+", "+g)),(!v||v<o)&&n[du](h)}),i={all:a},i[jl]=n,i}function AG(c,o){var a=!1;return Po(o,function(i){if(i===c)return a=!0,-1}),a}function wbe(){var c;return GY((c={},c[US]=function(o){},c[WS]=function(o){},c[GT]=function(o){},c[VS]=function(o,a){},c[KT]=function(o,a){},c))}var _be=function(){function c(){var o,a,i,n,s,h,v,g,O,A,S,M,P,L,V,N,ee,J,K,re,ce=0;Wu(c,this,function(pe){ke(),pe[mb]=function(){return a},pe[j2]=function(vt,yt,bt,Ht){L&&up(SG),pe[mb]()&&up("Core should not be initialized more than once"),o=vt||{},pe[L2]=o,_i(vt[I5])&&up("Please provide instrumentation key"),n=Ht,pe[CG]=Ht,Ot(),zt(),Mt(),bt&&(pe[o1]=bt);var _t=hf(o,Wye,[]);O=[],O[du].apply(O,jq(jq([],yt,!1),_t)),M=hf(o,Wq,[]),be(null),(!P||P[Xa]===0)&&up("No "+Wq+" available"),a=!0,pe.releaseQueue()},pe.getTransmissionControls=function(){var vt=[];return P&&Po(P,function(yt){vt[du](yt.queue)}),_k(vt)},pe.track=function(vt){vt.iKey=vt.iKey||o[I5],vt[zS]=vt[zS]||Wk(new Date),vt.ver=vt.ver||"4.0",!L&&pe[mb]()?Ce()[Yc](vt):i[du](vt)},pe[KY]=Ce,pe[$6]=function(){return n||(n=wbe(),pe[CG]=n),n},pe[US]=function(vt){n&&n[US](vt)},pe[WS]=function(vt){n&&n[WS](vt)},pe.getCookieMgr=function(){return v||(v=qS(o,pe[o1])),v},pe.setCookieMgr=function(vt){v=vt},pe[LN]=function(){if(!s&&!h&&a1(o.enablePerfMgr)){var vt=a1(o[Vq]);
9092Ba(vt)&&(h=vt(pe,pe[$6]()))}return s||h||R1e()},pe.setPerfMgr=function(vt){s=vt},pe.eventCnt=function(){return i[Xa]},pe.releaseQueue=function(){if(a&&i[Xa]>0){var vt=i;i=[],Po(vt,function(yt){Ce()[Yc](yt)})}},pe.pollInternalLogs=function(vt){N=vt||null;var yt=a1(o.diagnosticLogInterval);return(!yt||!(yt>0))&&(yt=1e4),ce&&clearInterval(ce),ce=setInterval(function(){Ut()},yt),ce},pe[Lq]=function(){ce&&(clearInterval(ce),ce=0,Ut())},_S(pe,function(){return V},["addTelemetryInitializer"]),pe.unload=function(vt,yt,bt){var Ht;vt===void 0&&(vt=!0),a||up(vbe),L&&up(SG);var _t=(Ht={reason:50},Ht[Lk]=vt,Ht.flushComplete=!1,Ht),Ze=YN(ht(),pe);Ze[H6](function(){ke(),yt&&yt(_t)},pe);function Vt(sn){_t.flushComplete=sn,L=!0,J.run(Ze,_t),pe[Lq](),Ze[Yc](_t)}Ee(vt,Vt,6,bt)||Vt(!1)},pe[y4]=$e,pe.addPlugin=function(vt,yt,bt,Ht){if(!vt){Ht&&Ht(!1),Tt(BX);return}var _t=$e(vt[$x]);if(_t&&!yt){Ht&&Ht(!1),Tt("Plugin ["+vt[$x]+"] is already loaded!");return}var Ze={reason:16};function Vt(Yt){O[du](vt),Ze.added=[vt],be(Ze),Ht&&Ht(!0)}if(_t){var sn=[_t.plugin],yn={reason:2,isAsync:!!bt};Dt(sn,yn,function(Yt){Yt?(Ze.removed=sn,Ze.reason|=32,Vt()):Ht&&Ht(!1)})}else Vt()},pe.evtNamespace=function(){return ee},pe[RN]=Ee,pe.getTraceCtx=function(vt){return re||(re=cbe()),re},pe.setTraceCtx=function(vt){re=vt||null},NP(pe,"addUnloadCb",function(){return J},"add");function ke(){a=!1,o=IP(!0,{},ybe),pe[L2]=o,pe[o1]=new b4(o),pe[lT]=[],V=new gbe,i=[],n=null,s=null,h=null,v=null,g=null,A=null,O=[],S=null,M=null,P=null,L=!1,N=null,ee=Ob("AIBaseCore",!0),J=RX(),re=null}function Ce(){return p1(ht(),o,pe)}function be(vt){var yt=xbe(pe[o1],w4,O);A=yt[jl],g=null;var bt=yt.all;if(P=_k(mbe(M,bt,pe)),S){var Ht=Bv(bt,S);Ht!==-1&&bt[jk](Ht,1),Ht=Bv(A,S),Ht!==-1&&A[jk](Ht,1),S._setQueue(P)}else S=pbe(P,pe);bt[du](S),A[du](S),pe[lT]=V5(bt),S[j2](o,pe,bt),FX(Ce(),bt),pe[lT]=_k(V5(A||[])).slice(),vt&&Ke(vt)}function $e(vt){var yt,bt=null,Ht=null;return Po(pe[lT],function(_t){if(_t[$x]===vt&&_t!==S&&_t!==V)return Ht=_t,-1}),!Ht&&S&&(Ht=S.getChannel(vt)),Ht&&(bt=(yt={plugin:Ht},yt[YY]=function(_t){T2(Ht)[Z6]=!_t},yt.isEnabled=function(){var _t=T2(Ht);return!_t[lb]&&!_t[Z6]},yt.remove=function(_t,Ze){var Vt;_t===void 0&&(_t=!0);var sn=[Ht],yn=(Vt={reason:1},Vt[Lk]=_t,Vt);Dt(sn,yn,function(Yt){Yt&&be({reason:32,removed:sn}),Ze&&Ze(Yt)})},yt)),bt}function ht(){if(!g){var vt=(A||[]).slice();Bv(vt,V)===-1&&vt[du](V),g=iw(V5(vt),o,pe)}return g}function Dt(vt,yt,bt){if(vt&&vt[Xa]>0){var Ht=iw(vt,o,pe),_t=YN(Ht,pe);_t[H6](function(){var Ze=!1,Vt=[];Po(O,function(yn,Yt){AG(yn,vt)?Ze=!0:Vt[du](yn)}),O=Vt;var sn=[];M&&(Po(M,function(yn,Yt){var We=[];Po(yn,function(Ye){AG(Ye,vt)?Ze=!0:We[du](Ye)}),sn[du](We)}),M=sn),bt&&bt(Ze)}),_t[Yc](yt)}else bt(!1)}function Ut(){var vt=pe[o1]?pe[o1].queue:[];vt&&(Po(vt,function(yt){var bt,Ht=(bt={},bt[nw]=N||"InternalMessageId: "+yt[BN],bt.iKey=a1(o[I5]),bt.time=Wk(new Date),bt.baseType=pA.dataType,bt.baseData={message:yt[xk]},bt);pe.track(Ht)}),vt[Xa]=0)}function Ee(vt,yt,bt,Ht){return S?S[RN](vt,yt,bt||6,Ht):(yt&&yt(!1),!0)}function Ot(){var vt=a1(o.disableDbgExt);vt===!0&&K&&(n[WS](K),K=null),n&&!K&&vt!==!0&&(K=O1e(o),n[US](K))}function zt(){var vt=a1(o.enablePerfMgr);!vt&&h&&(h=null),vt&&hf(o,Vq,bbe)}function Mt(){var vt=hf(o,OP,{});vt.NotificationManager=n}function Ke(vt){var yt=UP(ht(),pe);(!pe._updateHook||pe._updateHook(yt,vt)!==!0)&&yt[Yc](vt)}function Tt(vt){var yt=pe[o1];yt?Ni(yt,2,73,vt):up(vt)}})}return c.__ieDyn=1,c}();function mT(c,o,a,i){Po(c,function(n){if(n&&n[o])if(a)setTimeout(function(){return i(n)},0);else try{i(n)}catch{}})}var kbe=function(){function c(o){this.listeners=[];var a=!!(o||{}).perfEvtsSendAll;Wu(c,this,function(i){i[US]=function(n){i.listeners[du](n)},i[WS]=function(n){for(var s=Bv(i[G_],n);s>-1;)i.listeners[jk](s,1),s=Bv(i[G_],n)},i[GT]=function(n){mT(i[G_],GT,!0,function(s){s[GT](n)})},i[VS]=function(n,s){mT(i[G_],VS,!0,function(h){h[VS](n,s)})},i[KT]=function(n,s){mT(i[G_],KT,s,function(h){h[KT](n,s)})},i[hk]=function(n){n&&(a||!n[Y6]())&&mT(i[G_],hk,!1,function(s){n[Lk]?setTimeout(function(){return s[hk](n)},0):s[hk](n)})}})}return c.__ieDyn=1,c}(),Ebe=function(c){Sb(o,c);function o(){var a=c.call(this)||this;return Wu(o,a,function(i,n){i[j2]=function(v,g,O,A){n[j2](v,g,O||new b4(v),A||new kbe(v))},i.track=function(v){$N(i[LN](),function(){return"AppInsightsCore:track"},function(){v===null&&(h(v),up("Invalid telemetry item")),s(v),n.track(v)},function(){return{item:v}},!v.sync)};function s(v){_i(v[nw])&&(h(v),up("telemetry name required"))}function h(v){var g=i[$6]();g&&g[VS]([v],2)}}),a}return o.__ieDyn=1,o}(_be),OG="_aiHooks",DG=["req","rsp","hkErr","fnErr"];function WP(c,o){if(c)for(var a=0;a<c[Xa]&&!o(c[a],a);a++);}function $5(c,o,a,i,n){n>=0&&n<=2&&WP(c,function(s,h){var v=s.cbks,g=v[DG[n]];if(g){o.ctx=function(){var S=i[h]=i[h]||{};return S};
9092try{g[Uk](o.inst,a)}catch(S){var O=o.err;try{var A=v[DG[2]];A&&(o.err=S,A[Uk](o.inst,a))}catch{}finally{o.err=O}}}})}function Cbe(c){return function(){var o,a=this,i=arguments,n=c.h,s=(o={},o[nw]=c.n,o.inst=a,o.ctx=null,o.set=O,o),h=[],v=g([s],i);s.evt=zl("event");function g(S,M){return WP(M,function(P){S[du](P)}),S}function O(S,M){i=g([],i),i[S]=M,v=g([s],i)}$5(n,s,v,h,0);var A=c.f;if(A)try{s.rslt=A[Uk](a,i)}catch(S){throw s.err=S,$5(n,s,v,h,3),S}return $5(n,s,v,h,1),s.rslt}}function VP(c,o,a,i){var n=null;return c&&(oX(c,o)?n=c:a&&(n=VP(iX(c),o,i,!1))),n}function Sbe(c,o,a){return c?hB(c[dp],o,a,!1):null}function PX(c,o,a,i){var n=a&&a[OG];if(!n){n={i:0,n:o,f:a,h:[]};var s=Cbe(n);s[OG]=n,c[o]=s}var h={id:n.i,cbks:i,rm:function(){var v=this.id;WP(n.h,function(g,O){if(g.id===v)return n.h[jk](O,1),1})}};return n.i++,n.h[du](h),h}function hB(c,o,a,i,n){if(i===void 0&&(i=!0),c&&o&&a){var s=VP(c,o,i,n);if(s){var h=s[o];if(typeof h===eE)return PX(s,o,h,a)}}return null}function gT(c,o,a,i,n){if(c&&o&&a){var s=VP(c,o,i,n)||c;if(s)return PX(s,o,s[o],a)}return null}var k2="Microsoft_ApplicationInsights_BypassAjaxInstrumentation",jX="sampleRate",H5="ProcessLegacy",TG="http.method",$P="https://dc.services.visualstudio.com",KS="/v2/track",m1="not_specified",q5="iKey";function QC(c){var o=null;if(Ba(Event))o=new Event(c);else{var a=Mg();a&&a.createEvent&&(o=a.createEvent("Event"),o.initEvent(c,!0,!0))}return o}var Vk="split",ga="length",$k="toLowerCase",vT="ingestionendpoint",ow="toString",HP="removeItem",Uv="name",E2="message",Abe="count",pB="stringify",G5="pathname",NG="correlationHeaderExcludePatterns",XN="indexOf",Y_="exceptions",Dv="parsedStack",yb="properties",bb="measurements",Ek="sizeInBytes",sb="typeName",CS="severityLevel",K5="problemGroup",Y5="isManual",LX="CreateFromInterface",pk="assembly",QT="hasFullStack",yT="level",X_="method",ZC="fileName",eS="line",JN="duration",IG="receivedResponse",rE="substring",Obe="sanitizeKeyAndAddUniqueness",Dbe="sanitizeException",Tbe="sanitizeProperties",Nbe="sanitizeMeasurements",tS="";function t1(c,o){return o===void 0&&(o=!1),c==null?o:c.toString()[$k]()==="true"}function Tx(c){(isNaN(c)||c<0)&&(c=0),c=Math.round(c);var o=tS+c%1e3,a=tS+Math.floor(c/1e3)%60,i=tS+Math.floor(c/(1e3*60))%60,n=tS+Math.floor(c/(1e3*60*60))%24,s=Math.floor(c/(1e3*60*60*24));return o=o[ga]===1?"00"+o:o[ga]===2?"0"+o:o,a=a[ga]<2?"0"+a:a,i=i[ga]<2?"0"+i:i,n=n[ga]<2?"0"+n:n,(s>0?s+".":tS)+n+":"+i+":"+a+"."+o}function Ibe(c,o,a,i,n){return!n&&aa(c)&&(c==="Script error."||c==="Script error")}var rc=c1e({requestContextHeader:[0,"Request-Context"],requestContextTargetKey:[1,"appId"],requestContextAppIdFormat:[2,"appId=cid-v1:"],requestIdHeader:[3,"Request-Id"],traceParentHeader:[4,"traceparent"],traceStateHeader:[5,"tracestate"],sdkContextHeader:[6,"Sdk-Context"],sdkContextHeaderAppIdRequest:[7,"appId"],requestContextHeaderLowerCase:[8,"request-context"]}),NA=cX({LocalStorage:0,SessionStorage:1});cX({AI:0,AI_AND_W3C:1,W3C:2});var Yx=void 0,Xx=void 0;function qP(){return KP()?_4(NA.LocalStorage):null}function _4(c){try{if(_i(tE()))return null;var o=new Date()[ow](),a=zl(c===NA.LocalStorage?"localStorage":"sessionStorage");a.setItem(o,o);var i=a.getItem(o)!==o;if(a[HP](o),!i)return a}catch{}return null}function GP(){return gA()?_4(NA.SessionStorage):null}function Mbe(){Yx=!1,Xx=!1}function Fbe(){Yx=KP(!0),Xx=gA(!0)}function KP(c){return(c||Yx===void 0)&&(Yx=!!_4(NA.LocalStorage)),Yx}function Rbe(c,o){var a=qP();if(a!==null)try{return a.getItem(o)}catch(i){Yx=!1,Ni(c,2,1,"Browser failed read of local storage. "+Ss(i),{exception:To(i)})}return null}function Bbe(c,o,a){var i=qP();if(i!==null)try{return i.setItem(o,a),!0}catch(n){Yx=!1,Ni(c,2,3,"Browser failed write to local storage. "+Ss(n),{exception:To(n)})}return!1}function Pbe(c,o){var a=qP();if(a!==null)try{return a[HP](o),!0}catch(i){Yx=!1,Ni(c,2,5,"Browser failed removal of local storage item. "+Ss(i),{exception:To(i)})}return!1}function gA(c){return(c||Xx===void 0)&&(Xx=!!_4(NA.SessionStorage)),Xx}function mB(c,o){var a=GP();if(a!==null)try{return a.getItem(o)}catch(i){Xx=!1,Ni(c,2,2,"Browser failed read of session storage. "+Ss(i),{exception:To(i)})}return null}function gB(c,o,a){var i=GP();if(i!==null)try{return i.setItem(o,a),!0}catch(n){Xx=!1,Ni(c,2,4,"Browser failed write to session storage. "+Ss(n),{exception:To(n)})}return!1}function jbe(c,o){var a=GP();if(a!==null)try{return a[HP](o),!0}catch(i){Xx=!1,Ni(c,2,6,"Browser failed removal of session storage item. "+Ss(i),{exception:To(i)})}return!1}var xm;function YP(c,o,a){var i=o[ga],n=zX(c,o);if(n[ga]!==i){for(var s=0,h=n;a[h]!==void 0;)s++,h=n[rE](0,150-3)+VX(s);n=h}return n}function zX(c,o){var a;return o&&(o=fp(o[ow]()),o[ga]>150&&(a=o[rE](0,150),Ni(c,2,57,"name is too long. It has been truncated to 150 characters.",{name:o},!0))),a||o}function gf(c,o,a){a===void 0&&(a=1024);var i;return o&&(a=a||1024,o=fp(o),o.toString()[ga]>a&&(i=o[ow]()[rE](0,a),Ni(c,2,61,"string value is too long. It has been truncated to "+a+" characters.",{value:o},!0))),i||o}function IA(c,o){return JP(c,o,2048,66)}function XP(c,o){var a;return o&&o[ga]>32768&&(a=o[rE](0,32768),Ni(c,2,56,"message is too long, it has been truncated to 32768 characters.",{message:o},!0)),a||o}function UX(c,o){var a;if(o){var i=""+o;i[ga]>32768&&(a=i[rE](0,32768),Ni(c,2,52,"exception is too long, it has been truncated to 32768 characters.",{exception:o},!0))}return a||o}function sw(c,o){if(o){var a={};ac(o,function(i,n){if(Lv(n)&&nE())try{n=zv()[pB](n)}
9092catch(s){Ni(c,2,49,"custom property is not valid",{exception:s},!0)}n=gf(c,n,8192),i=YP(c,i,a),a[i]=n}),o=a}return o}function uw(c,o){if(o){var a={};ac(o,function(i,n){i=YP(c,i,a),a[i]=n}),o=a}return o}function WX(c,o){return o&&JP(c,o,128,69)[ow]()}function JP(c,o,a,i){var n;return o&&(o=fp(o),o[ga]>a&&(n=o[rE](0,a),Ni(c,2,i,"input is too long, it has been truncated to "+a+" characters.",{data:o},!0))),n||o}function VX(c){var o="00"+c;return o.substr(o[ga]-3)}xm={MAX_NAME_LENGTH:150,MAX_ID_LENGTH:128,MAX_PROPERTY_LENGTH:8192,MAX_STRING_LENGTH:1024,MAX_URL_LENGTH:2048,MAX_MESSAGE_LENGTH:32768,MAX_EXCEPTION_LENGTH:32768},xm[Obe]=YP,xm.sanitizeKey=zX,xm.sanitizeString=gf,xm.sanitizeUrl=IA,xm.sanitizeMessage=XP,xm[Dbe]=UX,xm[Tbe]=sw,xm[Nbe]=uw,xm.sanitizeId=WX,xm.sanitizeInput=JP,xm.padNumber=VX,xm.trim=fp;var MG=Mg()||{},FG=0,Lbe=[null,null,null,null,null];function QP(c){var o=FG,a=Lbe,i=a[o];return MG.createElement?a[o]||(i=a[o]=MG.createElement("a")):i={host:Wbe(c,!0)},i.href=c,o++,o>=a[ga]&&(o=0),FG=o,i}function zbe(c){var o,a=QP(c);return a&&(o=a.href),o}function Ube(c,o){return c?c.toUpperCase()+" "+o:o}function Wbe(c,o){var a=$X(c,o)||"";if(a){var i=a.match(/(www\d{0,5}\.)?([^\/:]{1,256})(:\d{1,20})?/i);if(i!=null&&i[ga]>3&&aa(i[2])&&i[2][ga]>0)return i[2]+(i[3]||"")}return a}function $X(c,o){var a=null;if(c){var i=c.match(/(\w{1,150}):\/\/([^\/:]{1,256})(:\d{1,20})?/i);if(i!=null&&i[ga]>2&&aa(i[2])&&i[2][ga]>0&&(a=i[2]||"",o&&i[ga]>2)){var n=(i[1]||"")[$k](),s=i[3]||"";(n==="http"&&s===":80"||n==="https"&&s===":443")&&(s=""),a+=s}}return a}var Vbe=[$P+KS,"https://breeze.aimon.applicationinsights.io"+KS,"https://dc-int.services.visualstudio.com"+KS];function ZT(c){return Bv(Vbe,c[$k]())!==-1}var mk={correlationIdPrefix:"cid-v1:",canIncludeCorrelationHeader:function(c,o,a){if(!o||c&&c.disableCorrelationHeaders)return!1;if(c&&c[NG]){for(var i=0;i<c.correlationHeaderExcludePatterns[ga];i++)if(c[NG][i].test(o))return!1}var n=QP(o).host[$k]();if(n&&(n[XN](":443")!==-1||n[XN](":80")!==-1)&&(n=($X(o,!0)||"")[$k]()),(!c||!c.enableCorsCorrelation)&&n&&n!==a)return!1;var s=c&&c.correlationHeaderDomains;if(s){var h;if(Po(s,function(O){var A=new RegExp(O.toLowerCase().replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*"));h=h||A.test(n)}),!h)return!1}var v=c&&c.correlationHeaderExcludedDomains;if(!v||v[ga]===0)return!0;for(var i=0;i<v[ga];i++){var g=new RegExp(v[i].toLowerCase().replace(/\\/g,"\\\\").replace(/\./g,"\\.").replace(/\*/g,".*"));if(g.test(n))return!1}return n&&n[ga]>0},getCorrelationContext:function(c){if(c){var o=mk.getCorrelationContextValue(c,rc[1]);if(o&&o!==mk.correlationIdPrefix)return o}},getCorrelationContextValue:function(c,o){if(c)for(var a=c[Vk](","),i=0;i<a[ga];++i){var n=a[i][Vk]("=");if(n[ga]===2&&n[0]===o)return n[1]}}};function $be(c,o,a,i){var n,s=i,h=i;if(o&&o[ga]>0){var v=QP(o);if(n=v.host,!s)if(v[G5]!=null){var g=v.pathname[ga]===0?"/":v[G5];g.charAt(0)!=="/"&&(g="/"+g),h=v[G5],s=gf(c,a?a+" "+g:g)}else s=gf(c,o)}else n=i,s=i;return{target:n,name:s,data:h}}function bT(){var c=rw();if(c&&c.now&&c.timing){var o=c.now()+c.timing.navigationStart;if(o>0)return o}return h1()}function wm(c,o){var a=null;return c!==0&&o!==0&&!_i(c)&&!_i(o)&&(a=o-c),a}function ZP(c,o){var a=c||{};return{getName:function(){return a[Uv]},setName:function(i){o&&o.setName(i),a[Uv]=i},getTraceId:function(){return a.traceID},setTraceId:function(i){o&&o.setTraceId(i),jP(i)&&(a.traceID=i)},getSpanId:function(){return a.parentID},setSpanId:function(i){o&&o.setSpanId(i),LP(i)&&(a.parentID=i)},getTraceFlags:function(){return a.traceFlags},setTraceFlags:function(i){o&&o.setTraceFlags(i),a.traceFlags=i}}}var Hbe=";",qbe="=";function Gbe(c){if(!c)return{};var o=c[Vk](Hbe),a=o1e(o,function(n,s){var h=s[Vk](qbe);if(h[ga]===2){var v=h[0][$k](),g=h[1];n[v]=g}return n},{});if(U2(a)[ga]>0){if(a.endpointsuffix){var i=a.location?a.location+".":"";a[vT]=a[vT]||"https://"+i+"dc."+a.endpointsuffix}a[vT]=a[vT]||$P}return a}var Kbe=function(){function c(o,a,i){var n=this,s=this;s.ver=1,s.sampleRate=100,s.tags={},s[Uv]=gf(o,i)||m1,s.data=a,s.time=Wk(new Date),s.aiDataContract={t
9092ime:1,iKey:1,name:1,sampleRate:function(){return n.sampleRate===100?4:1},tags:1,data:1}}return c}(),Nx=function(){function c(o,a,i,n){this.aiDataContract={ver:1,name:1,properties:0,measurements:0};var s=this;s.ver=2,s[Uv]=gf(o,a)||m1,s[yb]=sw(o,i),s[bb]=uw(o,n)}return c.envelopeType="Microsoft.ApplicationInsights.{0}.Event",c.dataType="EventData",c}(),Ybe="<no_method>",Ck="error",_m="stack",vB="stackDetails",RG="errorSrc",yB="message",HX="description";function bB(c,o){var a=c;return a&&!aa(a)&&(JSON&&JSON[pB]?(a=JSON[pB](c),o&&(!a||a==="{}")&&(Ba(c[ow])?a=c[ow]():a=""+c)):a=""+c+" - (Missing JSON.stringify)"),a||""}function qX(c,o){var a=c;return c&&(a&&!aa(a)&&(a=c[yB]||c[HX]||a),a&&!aa(a)&&(a=bB(a,!0)),c.filename&&(a=a+" @"+(c.filename||"")+":"+(c.lineno||"?")+":"+(c.colno||"?"))),o&&o!=="String"&&o!=="Object"&&o!=="Error"&&(a||"")[XN](o)===-1&&(a=o+": "+a),a||""}function Xbe(c){try{if(Lv(c))return"hasFullStack"in c&&"typeName"in c}catch{}return!1}function Jbe(c){try{if(Lv(c))return"ver"in c&&"exceptions"in c&&"properties"in c}catch{}return!1}function BG(c){return c&&c.src&&aa(c.src)&&c.obj&&mu(c.obj)}function r2(c){var o=c||"";aa(o)||(aa(o[_m])?o=o[_m]:o=""+o);var a=o[Vk](` 9093`);return{src:o,obj:a}}function Qbe(c){for(var o=[],a=c[Vk](` 9094`),i=0;i<a[ga];i++){var n=a[i];a[i+1]&&(n+="@"+a[i+1],i++),o.push(n)}return{src:c,obj:o}}function GX(c){var o=null;if(c)try{if(c[_m])o=r2(c[_m]);else if(c[Ck]&&c[Ck][_m])o=r2(c[Ck][_m]);else if(c.exception&&c.exception[_m])o=r2(c.exception[_m]);else if(BG(c))o=c;else if(BG(c[vB]))o=c[vB];else if(window&&window.opera&&c[yB])o=Qbe(c[E2]);else if(c.reason&&c.reason[_m])o=r2(c.reason[_m]);else if(aa(c))o=r2(c);else{var a=c[yB]||c[HX]||"";aa(c[RG])&&(a&&(a+=` 9095`),a+=" from "+c[RG]),a&&(o=r2(a))}}catch(i){o=r2(i)}return o||{src:"",obj:null}}function Zbe(c){var o="";return c&&(c.obj?Po(c.obj,function(a){o+=a+` 9096`}):o=c.src||""),o}function exe(c){var o,a=c.obj;if(a&&a[ga]>0){o=[];var i=0,n=0;Po(a,function(L){var V=L[ow]();if(xB.regex.test(V)){var N=new xB(V,i++);n+=N[Ek],o.push(N)}});var s=32*1024;if(n>s)for(var h=0,v=o[ga]-1,g=0,O=h,A=v;h<v;){var S=o[h][Ek],M=o[v][Ek];if(g+=S+M,g>s){var P=A-O+1;o.splice(O,P);break}O=h,A=v,h++,v--}}return o}function QN(c){var o="";if(c&&(o=c.typeName||c[Uv]||"",!o))try{var a=/function (.{1,200})\(/,i=a.exec(c.constructor[ow]());o=i&&i[ga]>1?i[1]:""}catch{}return o}function X5(c){if(c)try{if(!aa(c)){var o=QN(c),a=bB(c,!1);return(!a||a==="{}")&&(c[Ck]&&(c=c[Ck],o=QN(c)),a=bB(c,!0)),a[XN](o)!==0&&o!=="String"?o+":"+a:a}}catch{}return""+(c||"")}var S0=function(){function c(o,a,i,n,s,h){this.aiDataContract={ver:1,exceptions:1,severityLevel:0,properties:0,measurements:0};var v=this;v.ver=2,Jbe(a)?(v[Y_]=a[Y_]||[],v[yb]=a[yb],v[bb]=a[bb],a[CS]&&(v[CS]=a[CS]),a.id&&(v.id=a.id),a[K5]&&(v[K5]=a[K5]),_i(a[Y5])||(v[Y5]=a[Y5])):(i||(i={}),v[Y_]=[new PG(o,a,i)],v[yb]=sw(o,i),v[bb]=uw(o,n),s&&(v[CS]=s),h&&(v.id=h))}return c.CreateAutoException=function(o,a,i,n,s,h,v,g){var O,A=QN(s||h||o);return O={},O[E2]=qX(o,A),O.url=a,O.lineNumber=i,O.columnNumber=n,O.error=X5(s||h||o),O.evt=X5(h||o),O[sb]=A,O.stackDetails=GX(v||s||h),O.errorSrc=g,O},c.CreateFromInterface=function(o,a,i,n){var s=a[Y_]&&$S(a[Y_],function(v){return PG[LX](o,v)}),h=new c(o,lp(lp({},a),{exceptions:s}),i,n);return h},c.prototype.toInterface=function(){var o,a=this,i=a.exceptions,n=a.properties,s=a.measurements,h=a.severityLevel,v=a.problemGroup,g=a.id,O=a.isManual,A=i instanceof Array&&$S(i,function(S){return S.toInterface()})||void 0;return o={ver:"4.0"},o[Y_]=A,o.severityLevel=h,o.properties=n,o.measurements=s,o.problemGroup=v,o.id=g,o.isManual=O,o},c.CreateSimpleException=function(o,a,i,n,s,h){var v;return{exceptions:[(v={},v[QT]=!0,v.message=o,v.stack=s,v.typeName=a,v)]}},c.envelopeType="Microsoft.ApplicationInsights.{0}.Exception",c.dataType="ExceptionData",c.formatError=X5,c}(),PG=function(){function c(o,a,i){this.aiDataContract={id:0,outerId:0,typeName:1,message:1,hasFullStack:0,stack:0,parsedStack:2};var n=this;if(Xbe(a))n[sb]=a[sb],n[E2]=a[E2],n[_m]=a[_m],n[Dv]=a[Dv]||[],n[QT]=a[QT];else{var s=a,h=s&&s.evt;DP(s)||(s=s[Ck]||h||s),n[sb]=gf(o,QN(s))||m1,n[E2]=XP(o,qX(a||s,n[sb]))||m1;var v=a[vB]||GX(a);n[Dv]=exe(v),mu(n[Dv])&&$S(n[Dv],function(g){return g[pk]=gf(o,g[pk]
9096)}),n[_m]=UX(o,Zbe(v)),n.hasFullStack=mu(n.parsedStack)&&n.parsedStack[ga]>0,i&&(i[sb]=i[sb]||n[sb])}}return c.prototype.toInterface=function(){var o,a=this,i=a[Dv]instanceof Array&&$S(a[Dv],function(s){return s.toInterface()}),n=(o={id:a.id,outerId:a.outerId,typeName:a[sb],message:a[E2],hasFullStack:a[QT],stack:a[_m]},o[Dv]=i||void 0,o);return n},c.CreateFromInterface=function(o,a){var i=a[Dv]instanceof Array&&$S(a[Dv],function(s){return xB[LX](s)})||a[Dv],n=new c(o,lp(lp({},a),{parsedStack:i}));return n},c}(),xB=function(){function c(o,a){this.aiDataContract={level:1,method:1,assembly:0,fileName:0,line:0};var i=this;if(i[Ek]=0,typeof o=="string"){var n=o;i[yT]=a,i[X_]=Ybe,i[pk]=fp(n),i[ZC]="",i[eS]=0;var s=n.match(c.regex);s&&s[ga]>=5&&(i[X_]=fp(s[2])||i[X_],i[ZC]=fp(s[4]),i[eS]=parseInt(s[5])||0)}else i[yT]=o[yT],i[X_]=o[X_],i[pk]=o[pk],i[ZC]=o[ZC],i[eS]=o[eS],i[Ek]=0;i.sizeInBytes+=i.method[ga],i.sizeInBytes+=i.fileName[ga],i.sizeInBytes+=i.assembly[ga],i[Ek]+=c.baseSize,i.sizeInBytes+=i.level.toString()[ga],i.sizeInBytes+=i.line.toString()[ga]}return c.CreateFromInterface=function(o){return new c(o,null)},c.prototype.toInterface=function(){var o=this;return{level:o[yT],method:o[X_],assembly:o[pk],fileName:o[ZC],line:o[eS]}},c.regex=/^([\s]+at)?[\s]{0,50}([^\@\()]+?)[\s]{0,50}(\@|\()([^\(\n]+):([0-9]+):([0-9]+)(\)?)$/,c.baseSize=58,c}(),txe=function(){function c(){this.aiDataContract={name:1,kind:0,value:1,count:0,min:0,max:0,stdDev:0},this.kind=0}return c}(),N2=function(){function c(o,a,i,n,s,h,v,g,O){this.aiDataContract={ver:1,metrics:1,properties:0};var A=this;A.ver=2;var S=new txe;S[Abe]=n>0?n:void 0,S.max=isNaN(h)||h===null?void 0:h,S.min=isNaN(s)||s===null?void 0:s,S[Uv]=gf(o,a)||m1,S.value=i,S.stdDev=isNaN(v)||v===null?void 0:v,A.metrics=[S],A[yb]=sw(o,g),A[bb]=uw(o,O)}return c.envelopeType="Microsoft.ApplicationInsights.{0}.Metric",c.dataType="MetricData",c}(),Jx=function(){function c(o,a,i,n,s,h,v){this.aiDataContract={ver:1,name:0,url:0,duration:0,properties:0,measurements:0,id:0};var g=this;g.ver=2,g.id=WX(o,v),g.url=IA(o,i),g[Uv]=gf(o,a)||m1,isNaN(n)||(g[JN]=Tx(n)),g[yb]=sw(o,s),g[bb]=uw(o,h)}return c.envelopeType="Microsoft.ApplicationInsights.{0}.Pageview",c.dataType="PageviewData",c}(),I2=function(){function c(o,a,i,n,s,h,v,g,O,A,S,M){O===void 0&&(O="Ajax"),this.aiDataContract={id:1,ver:1,name:0,resultCode:0,duration:0,success:0,data:0,target:0,type:0,properties:0,measurements:0,kind:0,value:0,count:0,min:0,max:0,stdDev:0,dependencyKind:0,dependencySource:0,commandName:0,dependencyTypeName:0};var P=this;P.ver=2,P.id=a,P[JN]=Tx(s),P.success=h,P.resultCode=v+"",P.type=gf(o,O);var L=$be(o,i,g,n);P.data=IA(o,n)||L.data,P.target=gf(o,L.target),A&&(P.target="".concat(P.target," | ").concat(A)),P[Uv]=gf(o,L[Uv]),P[yb]=sw(o,S),P[bb]=uw(o,M)}return c.envelopeType="Microsoft.ApplicationInsights.{0}.RemoteDependency",c.dataType="RemoteDependencyData",c}(),Sk=function(){function c(o,a,i,n,s){this.aiDataContract={ver:1,message:1,severityLevel:0,properties:0};var h=this;h.ver=2,a=a||m1,h[E2]=XP(o,a),h[yb]=sw(o,n),h[bb]=uw(o,s),i&&(h[CS]=i)}return c.envelopeType="Microsoft.ApplicationInsights.{0}.Message",c.dataType="MessageData",c}(),Ak=function(){function c(o,a,i,n,s,h,v){this.aiDataContract={ver:1,name:0,url:0,duration:0,perfTotal:0,networkConnect:0,sentRequest:0,receivedResponse:0,domProcessing:0,properties:0,measurements:0};var g=this;g.ver=2,g.url=IA(o,i),g[Uv]=gf(o,a)||m1,g[yb]=sw(o,s),g[bb]=uw(o,h),v&&(g.domProcessing=v.domProcessing,g[JN]=v[JN],g.networkConnect=v.networkConnect,g.perfTotal=v.perfTotal,g[IG]=v[IG],g.sentRequest=v.sentRequest)}return c.envelopeType="Microsoft.ApplicationInsights.{0}.PageviewPerformance",c.dataType="PageviewPerformanceData",c}(),$2=function(){function c(o,a){this.aiDataContract={baseType:1,baseData:1},this.baseType=o,this.baseData=a}return c}();function cw(c){var o="ai."+c+".";return function(a){return o+a}}var nS=cw("application"),Pl=cw("device"),xT=cw("location"),J_=cw("operation"),J5=cw("session"),wx=cw("user"),i2=cw("cloud"),rS=cw("internal"),KX=function(c){Sb(o,c);function o(){return c.call(this)||this}return o}(u1e({applicationVersion:nS("ver"),applicationBuild:nS("build"),applicationTypeId:nS("typeId"),applicationId:nS("applicationId"),applicationLayer:nS("layer"),deviceId:Pl("id"),deviceIp:Pl("ip"),deviceLanguage:Pl("language"),deviceLocale:Pl("locale"),deviceModel:Pl("model"),deviceFriendlyName:Pl("friendlyName"),deviceNetwork:Pl("network"),deviceNetworkName:Pl("networkName"),deviceOEMName:Pl("oemName"),deviceOS:Pl("os"),deviceOSVersion:Pl("osVersion"),deviceRoleInstance:Pl("roleInstance"),deviceRoleName:Pl("roleName"),deviceScreenResolution:Pl("screenResolution"),deviceType:Pl("type"),deviceMachineName:Pl("machineName"),deviceVMName:Pl("vmName"),deviceBrowser:Pl("browser"),deviceBrowserVersion:Pl("browserVersion"),locationIp:xT("ip"),locationCountry:xT("country"),locationProvince:xT("province"),locationCity:xT("city"),operationId:J_("id"),operationName:J_("name"),operationParentId:J_("parentId"),operationRootId:J_("rootId"),operationSyntheticSource:J_("syntheticSource"),operationCorrelationVector:J_("correlationVector"),sessionId:J5("id"),sessionIsFirst:J5("isFirst"),sessionIsNew:J5("isNew"),userAccountAcquisitionDate:wx("accountAcquisitionDate"),userAccountId:wx("accountId"),userAgent:wx("userAgent"),userId:wx("id"),userStoreRegion:wx("storeRegion"),userAuthUserId:wx("authUserId"),userAnonymousUserAcquisitionDate:wx("anonUserAcquisitionDate"),userAuthenticatedUserAcquisitionDate:wx("authUserAcquisitionDate"),cloudName:i2("name"),cloudRole:i2("role"),cloudRoleVer:i2("roleVer"),cloudRoleInstance:i2("roleInstance"),cloudEnvironment:i2("environment"),cloudLocation:i2("location"),cloudDeploymentUnit:i2("deploymentUnit"),internalNodeName:rS("nodeName"),internalSdkVersion:rS("sdkVersion"),internalAgentVersion:rS("agentVersion"),internalSnippet:rS("snippet"),internalSdkSrc:rS("sdkSrc")}));function Sx(c,o,a,i,n,s){var h;a=gf(i,a)||m1,(_i(c)||_i(o)||_i(a))&&up("Input doesn't contain all required fields");var v="";c[q5]&&(v=c[q5],delete c[q5]);var g=(h={},h[Uv]=a,h.time=Wk(new Date),h.iKey=v,h.ext=s||{},h.tags=[],h.data={},h.baseType=o,h.baseData=c,h);return _i(n)||ac(n,function(O,A){g.data[O]=A}),g}var Og={UserExt:"user",DeviceExt:"device",TraceExt:"trace",WebExt:"web",AppExt:"app",OSExt:"os",SessionExt:"ses",SDKExt:"sdk"},Uu=new KX,k4="AppInsightsPropertiesPlugin",YX="AppInsightsChannelPlugin",nxe="ApplicationInsightsAnalytics",ZN="toString",wB="disableExceptionTracking",e4="autoTrackPageVisitTime",_B="overridePageViewDuration",kB="enableUnhandledPromiseRejectionTracking",wT="samplingPercentage",t4="isStorageUseDisabled",n4="isBrowserLinkTrackingEnabled",EB="enableAutoRouteTracking",CB="namePrefix",Q5="disableFlushOnBeforeUnload",Jf="core",_x="dataType",o2="envelopeType",Ag="diagLog",a2="track",eN="trackPageView",SB="trackPreviousPageVisit",v2="sendPageViewInternal",AB="sendPageViewPerformanceInternal",ej="populatePageViewPerformanceEvent",uk="href",jG="sendExceptionInternal",Z5="exception",iS="error",e6="_onerror",t6="errorSrc",n6="lineNumber",r6="columnNumber",LG="message",i6="CreateAutoException",_T="addTelemetryInitializer",Ox="duration",vA="length",XX="isPerformanceTimingSupported",JX="getPerformanceTiming",r4="navigationStart",OB="shouldCollectDuration",QX="isPerformanceTimingDataReady",rxe="getEntriesByType",SS="responseStart",ixe="requestStart",tN="loadEventEnd",DB="responseEnd",nN="connectEnd",ZX="pageVisitStartTime",kT=null;
9096function oxe(){if(kT==null)try{kT=!!(self&&self instanceof WorkerGlobalScope)}catch{kT=!1}return kT}var axe=function(){function c(o,a,i,n){Wu(c,this,function(s){var h=null,v=[],g=!1,O;i&&(O=i.logger);function A(M){i&&i.flush(M)}function S(M){v.push(M),h||(h=setInterval(function(){var P=v.slice(0),L=!1;v=[],Po(P,function(V){V()?L=!0:v.push(V)}),v[vA]===0&&(clearInterval(h),h=null),L&&A(!0)},100))}s[eN]=function(M,P){var L=M.name;if(_i(L)||typeof L!="string"){var V=Mg();L=M.name=V&&V.title||""}var N=M.uri;if(_i(N)||typeof N!="string"){var ee=jx();N=M.uri=ee&&ee[uk]||""}if(!n[XX]()){o[v2](M,P),A(!0),oxe()||Ni(O,2,25,"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");return}var J=!1,K,re=n[JX]()[r4];re>0&&(K=wm(re,+new Date),n[OB](K)||(K=void 0));var ce;!_i(P)&&!_i(P[Ox])&&(ce=P[Ox]),(a||!isNaN(ce))&&(isNaN(ce)&&(P||(P={}),P[Ox]=K),o[v2](M,P),A(!0),J=!0);var pe=6e4;P||(P={}),S(function(){var ke=!1;try{if(n[QX]()){ke=!0;var Ce={name:L,uri:N};n[ej](Ce),!Ce.isValid&&!J?(P[Ox]=K,o[v2](M,P)):(J||(P[Ox]=Ce.durationMs,o[v2](M,P)),g||(o[AB](Ce,P),g=!0))}else re>0&&wm(re,+new Date)>pe&&(ke=!0,J||(P[Ox]=pe,o[v2](M,P)))}catch(be){Ni(O,1,38,"trackPageView failed on page load calculation: "+Ss(be),{exception:To(be)})}return ke})},s.teardown=function(M,P){if(h){clearInterval(h),h=null;var L=v.slice(0);v=[],Po(L,function(V){V()})}}})}return c.__ieDyn=1,c}(),sxe=36e5,zG=["googlebot","adsbot-google","apis-google","mediapartners-google"];function eJ(){var c=rw();return c&&!!c.timing}function uxe(){var c=rw();return c&&c.getEntriesByType&&c.getEntriesByType("navigation")[vA]>0}function cxe(){var c=rw(),o=c?c.timing:0;return o&&o.domainLookupStart>0&&o[r4]>0&&o[SS]>0&&o[ixe]>0&&o[tN]>0&&o[DB]>0&&o[nN]>0&&o.domLoading>0}function UG(){return eJ()?rw().timing:null}function lxe(){return uxe()?rw()[rxe]("navigation")[0]:null}function fxe(){for(var c=[],o=0;o<arguments.length;o++)c[o]=arguments[o];var a=Ab()||{},i=a.userAgent,n=!1;if(i)for(var s=0;s<zG[vA];s++)n=n||i.toLowerCase().indexOf(zG[s])!==-1;if(n)return!1;for(var s=0;s<c[vA];s++)if(c[s]<0||c[s]>=sxe)return!1;return!0}var dxe=function(){function c(o){var a=this,i=OA(o);Wu(c,this,function(n){n[ej]=function(s){s.isValid=!1;var h=lxe(),v=UG(),g=0,O=0,A=0,S=0,M=0;(h||v)&&(h?(g=h[Ox],O=h.startTime===0?h[nN]:wm(h.startTime,h[nN]),A=wm(h.requestStart,h[SS]),S=wm(h[SS],h[DB]),M=wm(h.responseEnd,h[tN])):(g=wm(v[r4],v[tN]),O=wm(v[r4],v[nN]),A=wm(v.requestStart,v[SS]),S=wm(v[SS],v[DB]),M=wm(v.responseEnd,v[tN])),g===0?Ni(i,2,10,"error calculating page view performance.",{total:g,network:O,request:A,response:S,dom:M}):a[OB](g,O,A,S,M)?g<Math.floor(O)+Math.floor(A)+Math.floor(S)+Math.floor(M)?Ni(i,2,8,"client performance math error.",{total:g,network:O,request:A,response:S,dom:M}):(s.durationMs=g,s.perfTotal=s[Ox]=Tx(g),s.networkConnect=Tx(O),s.sentRequest=Tx(A),s.receivedResponse=Tx(S),s.domProcessing=Tx(M),s.isValid=!0):Ni(i,2,45,"Invalid page load duration value. Browser perf data won't be sent.",{total:g,network:O,request:A,response:S,dom:M}))},n[JX]=UG,n[XX]=eJ,n[QX]=cxe,n[OB]=fxe})}return c.__ieDyn=1,c}(),hxe=function(){function c(o,a){var i="prevPageVisitData";Wu(c,this,function(n){n[SB]=function(g,O){try{var A=s(g,O);A&&a(A.pageName,A.pageUrl,A.pageVisitTime)}catch(S){_2(o,"Auto track page visit time failed, metric will not be collected: "+To(S))}};function s(g,O){var A=null;try{A=v(),h(g,O)}catch(S){_2(o,"Call to restart failed: "+To(S)),A=null}return A}function h(g,O){try{if(gA()){mB(o,i)!=null&&up("Cannot call startPageVisit consecutively without first calling stopPageVisit");var A=new pxe(g,O),S=zv().stringify(A);gB(o,i,S)}}catch(M){_2(o,"Call to start failed: "+To(M))}}function v(){var g=null;try{if(gA()){var O=h1(),A=mB(o,i);A&&nE()&&(g=zv().parse(A),g.pageVisitTime=O-g[ZX],jbe(o,i))}}catch(S){_2(o,"Stop page visit timer failed: "+To(S)),g=null}return g}Px(n,"_logger",function(){return o}),Px(n,"pageVisitTimeTrackingHandler",function(){return a})})}return c.__ieDyn=1,c}(),pxe=function(){function c(o,a){this[ZX]=h1(),this.pageName=o,this.pageUrl=a}return c}(),WG=function(){function c(o,a){var i=this,n={};i.start=function(s){typeof n[s]<"u"&&Ni(o,2,62,"start was called more than once for this event without calling stop.",{name:s,key:s},!0),n[s]=+new Date},i.stop=function(s,h,v,g){var O=n[s];if(isNaN(O))Ni(o,2,63,"stop was called without a corresponding start.",{name:s,key:s},!0);else{var A=+new Date,S=wm(O,A);i.action(s,h,S,v,g)}delete n[s],n[s]=void 0}}return c}(),mxe="event";function oS(c,o){c&&c.dispatchEvent&&o&&c.dispatchEvent(o)}function gxe(c){if(c&&c.reason){var o=c.reason;return!aa(o)&&Ba(o[ZN])?o[ZN]():To(o)}return c||""}var VG=6e4;function $G(c,o){return c=c||o,c<VG&&(c=VG),c}function HG(c){return c||(c={}),c.sessionRenewalMs=$G(c.sessionRenewalMs,30*60*1e3),c.sessionExpirationMs=$G(c.sessionExpirationMs,24*60*60*1e3),c[wB]=t1(c[w
9096B]),c[e4]=t1(c[e4]),c[_B]=t1(c[_B]),c[kB]=t1(c[kB]),(isNaN(c[wT])||c[wT]<=0||c[wT]>=100)&&(c[wT]=100),c[t4]=t1(c[t4]),c[n4]=t1(c[n4]),c[EB]=t1(c[EB]),c[CB]=c[CB]||"",c.enableDebug=t1(c.enableDebug),c[Q5]=t1(c[Q5]),c.disableFlushOnUnload=t1(c.disableFlushOnUnload,c[Q5]),c}function vxe(c){Qf(c[t4])||(c[t4]?Mbe():Fbe())}var yxe=function(c){Sb(o,c);function o(){var a=c.call(this)||this;a.identifier=nxe,a.priority=180,a.autoRoutePVDelay=500;var i,n,s,h,v,g,O,A,S,M,P,L,V,N,ee,J,K;return Wu(o,a,function(re,ce){var pe=ce._addHook;Ke(),re.getCookieMgr=function(){return BP(re[Jf])},re.processTelemetry=function(Tt,vt){re.processNext(Tt,vt)},re.trackEvent=function(Tt,vt){try{var yt=Sx(Tt,Nx[_x],Nx[o2],re[Ag](),vt);re[Jf][a2](yt)}catch(bt){Mt(2,39,"trackTrace failed, trace will not be collected: "+Ss(bt),{exception:To(bt)})}},re.startTrackEvent=function(Tt){try{i.start(Tt)}catch(vt){Mt(1,29,"startTrackEvent failed, event will not be collected: "+Ss(vt),{exception:To(vt)})}},re.stopTrackEvent=function(Tt,vt,yt){try{i.stop(Tt,void 0,vt,yt)}catch(bt){Mt(1,30,"stopTrackEvent failed, event will not be collected: "+Ss(bt),{exception:To(bt)})}},re.trackTrace=function(Tt,vt){try{var yt=Sx(Tt,Sk[_x],Sk[o2],re[Ag](),vt);re[Jf][a2](yt)}catch(bt){Mt(2,39,"trackTrace failed, trace will not be collected: "+Ss(bt),{exception:To(bt)})}},re.trackMetric=function(Tt,vt){try{var yt=Sx(Tt,N2[_x],N2[o2],re[Ag](),vt);re[Jf][a2](yt)}catch(bt){Mt(1,36,"trackMetric failed, metric will not be collected: "+Ss(bt),{exception:To(bt)})}},re[eN]=function(Tt,vt){try{var yt=Tt||{};s[eN](yt,lp(lp(lp({},yt.properties),yt.measurements),vt)),re.config[e4]&&v[SB](yt.name,yt.uri)}catch(bt){Mt(1,37,"trackPageView failed, page view will not be collected: "+Ss(bt),{exception:To(bt)})}},re[v2]=function(Tt,vt,yt){var bt=Mg();bt&&(Tt.refUri=Tt.refUri===void 0?bt.referrer:Tt.refUri);var Ht=Sx(Tt,Jx[_x],Jx[o2],re[Ag](),vt,yt);re[Jf][a2](Ht)},re[AB]=function(Tt,vt,yt){var bt=Sx(Tt,Ak[_x],Ak[o2],re[Ag](),vt,yt);re[Jf][a2](bt)},re.trackPageViewPerformance=function(Tt,vt){var yt=Tt||{};try{h[ej](yt),re[AB](yt,vt)}catch(bt){Mt(1,37,"trackPageViewPerformance failed, page view will not be collected: "+Ss(bt),{exception:To(bt)})}},re.startTrackPage=function(Tt){try{if(typeof Tt!="string"){var vt=Mg();Tt=vt&&vt.title||""}n.start(Tt)}catch(yt){Mt(1,31,"startTrackPage failed, page view may not be collected: "+Ss(yt),{exception:To(yt)})}},re.stopTrackPage=function(Tt,vt,yt,bt){try{if(typeof Tt!="string"){var Ht=Mg();Tt=Ht&&Ht.title||""}if(typeof vt!="string"){var _t=jx();vt=_t&&_t[uk]||""}n.stop(Tt,vt,yt,bt),re.config[e4]&&v[SB](Tt,vt)}catch(Ze){Mt(1,32,"stopTrackPage failed, page view will not be collected: "+Ss(Ze),{exception:To(Ze)})}},re[jG]=function(Tt,vt,yt){var bt=Tt&&(Tt[Z5]||Tt[iS])||DP(Tt)&&Tt||{name:Tt&&typeof Tt,message:Tt||m1};Tt=Tt||{};var Ht=new S0(re[Ag](),bt,Tt.properties||vt,Tt.measurements,Tt.severityLevel,Tt.id).toInterface(),_t=Sx(Ht,S0[_x],S0[o2],re[Ag](),vt,yt);re[Jf][a2](_t)},re.trackException=function(Tt,vt){Tt&&!Tt[Z5]&&Tt[iS]&&(Tt[Z5]=Tt[iS]);try{re[jG](Tt,vt)}catch(yt){Mt(1,35,"trackException failed, exception will not be collected: "+Ss(yt),{exception:To(yt)})}},re[e6]=function(Tt){var vt=Tt&&Tt[iS],yt=Tt&&Tt.evt;try{if(!yt){var bt=Gx();bt&&(yt=bt[mxe])}var Ht=Tt&&Tt.url||(Mg()||{}).URL,_t=Tt[t6]||"window.onerror@"+Ht+":"+(Tt[n6]||0)+":"+(Tt[r6]||0),Ze={errorSrc:_t,url:Ht,lineNumber:Tt[n6]||0,columnNumber:Tt[r6]||0,message:Tt[LG]};Ibe(Tt.message,Tt.url,Tt.lineNumber,Tt.columnNumber,Tt[iS])?ht(S0[i6]("Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.",Ht,Tt[n6]||0,Tt[r6]||0,vt,yt,null,_t),Ze):(Tt[t6]||(Tt[t6]=_t),re.trackException({exception:Tt,severityLevel:3},Ze))}catch(sn){var Vt=vt?vt.name+", "+vt[LG]:"null";Mt(1,11,"_onError threw exception while logging error, error will not be collected: "+Ss(sn),{exception:To(sn),errorString:Vt})}},re[_T]=function(Tt){if(re[Jf])return re[Jf][_T](Tt);g||(g=[]),g.push(Tt)},re.initialize=function(Tt,vt,yt,bt){if(!re.isInitialized()){_i(vt)&&up("Error initializing"),ce.initialize(Tt,vt,yt,bt);try{K=V2(Ob(re.identifier),vt.evtNamespace&&vt.evtNamespace()),g&&(Po(g,function(_t){vt[_T](_t)}),g=null);var Ht=ke(Tt);vxe(Ht),h=new dxe(re[Jf]),s=new axe(a,Ht[_B],re[Jf],h),v=new hxe(re[Ag](),function(_t,Ze,Vt){return be(_t,Ze,Vt)}),Ce(Ht,Tt),i=new WG(re[Ag](),"trackEvent"),i.action=function(_t,Ze,Vt,sn,yn){sn||(sn={}),yn||(yn={}),sn.duration=Vt[ZN](),re.trackEvent({name:_t,properties:sn,measurements:yn})},n=new WG(re[Ag](),"trackPageView"),n.action=function(_t,Ze,Vt,sn,yn){_i(sn)&&(sn={}),sn.duration=Vt[ZN]();var Yt={name:_t,uri:Ze,properties:sn,measurements:yn};re[v2](Yt,sn)},AA()&&(Dt(Ht),Ut(Ht))}catch(_t){throw re.setInitialized(!1),_t}}},re._doTeardown=function(Tt,vt){s&&s.teardown(Tt,vt),GS(window,null,
9096null,K),Ke()};function ke(Tt){var vt=p1(null,Tt,re[Jf]),yt=re.identifier,bt=HG(Tt),Ht=re.config=vt.getExtCfg(yt);return bt!==void 0&&ac(bt,function(_t,Ze){Ht[_t]=vt.getConfig(yt,_t,Ze),Ht[_t]===void 0&&(Ht=Ze)}),Ht}function Ce(Tt,vt){O=Tt[n4]||vt[n4],$e()}function be(Tt,vt,yt){var bt={PageName:Tt,PageUrl:vt};re.trackMetric({name:"PageVisitTime",average:yt,max:yt,min:yt,sampleCount:1},bt)}function $e(){if(!A&&O){var Tt=["/browserLinkSignalR/","/__browserLink/"],vt=function(yt){if(O&&yt.baseType===I2[_x]){var bt=yt.baseData;if(bt){for(var Ht=0;Ht<Tt[vA];Ht++)if(bt.target&&bt.target.indexOf(Tt[Ht])>=0)return!1}}return!0};re[_T](vt),A=!0}}function ht(Tt,vt){var yt=Sx(Tt,S0[_x],S0[o2],re[Ag](),vt);re[Jf][a2](yt)}function Dt(Tt){var vt=Gx(),yt=jx(!0);P=Tt[wB],!P&&!L&&!Tt.autoExceptionInstrumented&&(pe(gT(vt,"onerror",{ns:K,rsp:function(bt,Ht,_t,Ze,Vt,sn){!P&&bt.rslt!==!0&&re[e6](S0[i6](Ht,_t,Ze,Vt,sn,bt.evt))}},!1)),L=!0),zt(Tt,vt,yt)}function Ut(Tt){var vt=Gx(),yt=jx(!0);if(S=Tt[EB]===!0,vt&&S&&gX()){var bt=w1e();Ba(bt.pushState)&&Ba(bt.replaceState)&&typeof Event!==Bx&&Ot(Tt,vt,bt,yt)}}function Ee(){var Tt=null;if(re[Jf]&&re[Jf].getTraceCtx&&(Tt=re[Jf].getTraceCtx(!1)),!Tt){var vt=re[Jf].getPlugin(k4);if(vt){var yt=vt.plugin.context;yt&&(Tt=ZP(yt.telemetryTrace))}}return Tt}function Ot(Tt,vt,yt,bt){var Ht=Tt[CB]||"";function _t(){S&&oS(vt,QC(Ht+"locationchange"))}function Ze(){if(J&&(ee=J),J=bt&&bt[uk]||"",S){var Vt=Ee();if(Vt){Vt.setTraceId(zx());var sn="_unknown_";bt&&bt.pathname&&(sn=bt.pathname+(bt.hash||"")),Vt.setName(gf(re[Ag](),sn))}setTimeout(function(yn){re[eN]({refUri:yn,properties:{duration:0}})}.bind(this,ee),re.autoRoutePVDelay)}}M||(pe(gT(yt,"pushState",{ns:K,rsp:function(){S&&(oS(vt,QC(Ht+"pushState")),oS(vt,QC(Ht+"locationchange")))}},!0)),pe(gT(yt,"replaceState",{ns:K,rsp:function(){S&&(oS(vt,QC(Ht+"replaceState")),oS(vt,QC(Ht+"locationchange")))}},!0)),Kx(vt,Ht+"popstate",_t,K),Kx(vt,Ht+"locationchange",Ze,K),M=!0)}function zt(Tt,vt,yt){V=Tt[kB]===!0,V&&!N&&(pe(gT(vt,"onunhandledrejection",{ns:K,rsp:function(bt,Ht){V&&bt.rslt!==!0&&re[e6](S0[i6](gxe(Ht),yt?yt[uk]:"",0,0,Ht,bt.evt))}},!1)),N=!0,Tt.autoUnhandledPromiseInstrumented=N)}function Mt(Tt,vt,yt,bt,Ht){re[Ag]().throwInternal(Tt,vt,yt,bt,Ht)}function Ke(){i=null,n=null,s=null,h=null,v=null,g=null,O=!1,A=!1,S=!1,M=!1,P=!1,L=!1,V=!1,N=!1;var Tt=jx(!0);ee=Tt&&Tt[uk]||"",J=null,K=null}Px(re,"_pageViewManager",function(){return s}),Px(re,"_pageViewPerformanceManager",function(){return h}),Px(re,"_pageVisitTimeManager",function(){return v}),Px(re,"_evtNamespace",function(){return"."+K})}),a}return o.Version="2.8.11",o.getDefaultConfig=HG,o}(TA),p2="duration",Zf="tags",o6="deviceType",Ng="data",kb="name",yA="traceID",$a="length",bA="stringify",H2="measurements",c1="dataType",q2="envelopeType",m2="toString",ET="onLine",xA="enqueue",Ok="count",Dk="push",TB="emitLineDelimitedJson",Hk="clear",AS="batchPayloads",gk="markAsSent",YS="clearSent",aS="BUFFER_KEY",s2="SENT_BUFFER_KEY",sS="MAX_BUFFER_SIZE",g2="namePrefix",NB="maxBatchSizeInBytes",Q_="triggerSend",op="diagLog",tJ="onunloadDisableBeacon",IB="isBeaconApiDisabled",uS="_sender",zu="_senderConfig",Z_="_buffer",nJ="enableSessionStorageBuffer",rJ="samplingPercentage",rN="instrumentationKey",u2="endpointUrl",iJ="customHeaders",OS="disableXhr",oJ="onunloadDisableFetch",MB="disableTelemetry",a6="baseType",i4="sampleRate",aJ="convertUndefined",bxe="_xhrReadyStateChange",Tv="_onError",s6="_onPartialSuccess",CT="_onSuccess",ST="itemsAccepted",xxe="itemsReceived",DS="isRetryDisabled",u6="setRequestHeader",sJ="maxBatchInterval",qG="eventsSendRequest",GG="disableInstrumentationKeyValidation",uJ="getSamplingScore",wxe="getHashCodeScore",c6="baseType",oc="baseData",pf="properties",KG="true";function pl(c,o,a){return Ms(c,o,a,nB)}function _xe(c,o,a){var i=a[Zf]=a[Zf]||{},n=o.ext=o.ext||{},s=o[Zf]=o[Zf]||[],h=n.user;h&&(pl(i,Uu.userAuthUserId,h.authId),pl(i,Uu.userId,h.id||h.localId)
9096);var v=n.app;v&&pl(i,Uu.sessionId,v.sesId);var g=n.device;g&&(pl(i,Uu.deviceId,g.id||g.localId),pl(i,Uu[o6],g.deviceClass),pl(i,Uu.deviceIp,g.ip),pl(i,Uu.deviceModel,g.model),pl(i,Uu[o6],g[o6]));var O=o.ext.web;if(O){pl(i,Uu.deviceLanguage,O.browserLang),pl(i,Uu.deviceBrowserVersion,O.browserVer),pl(i,Uu.deviceBrowser,O.browser);var A=a[Ng]=a[Ng]||{},S=A[oc]=A[oc]||{},M=S[pf]=S[pf]||{};pl(M,"domain",O.domain),pl(M,"isManual",O.isManual?KG:null),pl(M,"screenRes",O.screenRes),pl(M,"userConsent",O.userConsent?KG:null)}var P=n.os;P&&pl(i,Uu.deviceOS,P[kb]);var L=n.trace;L&&(pl(i,Uu.operationParentId,L.parentID),pl(i,Uu.operationName,gf(c,L[kb])),pl(i,Uu.operationId,L[yA]));for(var V={},N=s[$a]-1;N>=0;N--){var ee=s[N];ac(ee,function(K,re){V[K]=re}),s.splice(N,1)}ac(s,function(K,re){V[K]=re});var J=lp(lp({},i),V);J[Uu.internalSdkVersion]||(J[Uu.internalSdkVersion]="javascript:".concat(kxe.Version)),a[Zf]=uX(J)}function aw(c,o,a){_i(c)||ac(c,function(i,n){aX(n)?a[i]=n:aa(n)?o[i]=n:nE()&&(o[i]=zv()[bA](n))})}function G2(c,o){_i(c)||ac(c,function(a,i){c[a]=i||o})}function K2(c,o,a,i){var n=new Kbe(c,i,o);pl(n,"sampleRate",a[jX]),(a[oc]||{}).startTime&&(n.time=Wk(a[oc].startTime)),n.iKey=a.iKey;var s=a.iKey.replace(/-/g,"");return n[kb]=n[kb].replace("{0}",s),_xe(c,a,n),a[Zf]=a[Zf]||[],uX(n)}function Y2(c,o){_i(o[oc])&&Ni(c,1,46,"telemetryItem.baseData cannot be null.")}var kxe={Version:"2.8.11"};function Exe(c,o,a){Y2(c,o);var i=o[oc][H2]||{},n=o[oc][pf]||{};aw(o[Ng],n,i),_i(a)||G2(n,a);var s=o[oc];if(_i(s))return _2(c,"Invalid input for dependency data"),null;var h=s[pf]&&s[pf][TG]?s[pf][TG]:"GET",v=new I2(c,s.id,s.target,s[kb],s[p2],s.success,s.responseCode,h,s.type,s.correlationContext,n,i),g=new $2(I2[c1],v);return K2(c,I2[q2],o,g)}function cJ(c,o,a){Y2(c,o);var i={},n={};o[c6]!==Nx[c1]&&(i.baseTypeSource=o[c6]),o[c6]===Nx[c1]?(i=o[oc][pf]||{},n=o[oc][H2]||{}):o[oc]&&aw(o[oc],i,n),aw(o[Ng],i,n),_i(a)||G2(i,a);var s=o[oc][kb],h=new Nx(c,s,i,n),v=new $2(Nx[c1],h);return K2(c,Nx[q2],o,v)}function Cxe(c,o,a){Y2(c,o);var i=o[oc][H2]||{},n=o[oc][pf]||{};aw(o[Ng],n,i),_i(a)||G2(n,a);var s=o[oc],h=S0.CreateFromInterface(c,s,n,i),v=new $2(S0[c1],h);return K2(c,S0[q2],o,v)}function Sxe(c,o,a){Y2(c,o);var i=o[oc],n=i[pf]||{},s=i[H2]||{};aw(o[Ng],n,s),_i(a)||G2(n,a);var h=new N2(c,i[kb],i.average,i.sampleCount,i.min,i.max,i.stdDev,n,s),v=new $2(N2[c1],h);return K2(c,N2[q2],o,v)}function Axe(c,o,a){Y2(c,o);var i,n=o[oc];!_i(n)&&!_i(n[pf])&&!_i(n[pf][p2])?(i=n[pf][p2],delete n[pf][p2]):!_i(o[Ng])&&!_i(o[Ng][p2])&&(i=o[Ng][p2],delete o[Ng][p2]);var s=o[oc],h;((o.ext||{}).trace||{})[yA]&&(h=o.ext.trace[yA]);var v=s.id||h,g=s[kb],O=s.uri,A=s[pf]||{},S=s[H2]||{};if(_i(s.refUri)||(A.refUri=s.refUri),_i(s.pageType)||(A.pageType=s.pageType),_i(s.isLoggedIn)||(A.isLoggedIn=s.isLoggedIn[m2]()),!_i(s[pf])){var M=s[pf];ac(M,function(V,N){A[V]=N})}aw(o[Ng],A,S),_i(a)||G2(A,a);var P=new Jx(c,g,O,i,A,S,v),L=new $2(Jx[c1],P);return K2(c,Jx[q2],o,L)}function Oxe(c,o,a){Y2(c,o);var i=o[oc],n=i[kb],s=i.uri||i.url,h=i[pf]||{},v=i[H2]||{};aw(o[Ng],h,v),_i(a)||G2(h,a);var g=new Ak(c,n,s,void 0,h,v,i),O=new $2(Ak[c1],g);return K2(c,Ak[q2],o,O)}function Dxe(c,o,a){Y2(c,o);var i=o[oc].message,n=o[oc].severityLevel,s=o[oc][pf]||{},h=o[oc][H2]||{};aw(o[Ng],s,h),_i(a)||G2(s,a);var v=new Sk(c,i,n,s,h),g=new $2(Sk[c1],v);return K2(c,Sk[q2],o,g)}function YG(c,o){GS(c,null,null,o)}function Txe(c){var o=Mg(),a=Ab(),i=!1,n=!0,s=V2(Ob("OfflineListener"),c);try{if(v(Gx())&&(i=!0),o){var h=o.body||o;h.ononline&&v(h)&&(i=!0)}i&&a&&!_i(a[ET])&&(n=a[ET])}catch{i=!1}function v(M){var P=!1;return M&&(P=Kx(M,"online",g,s),P&&Kx(M,"offline",O,s)),P}function g(){n=!0}function O(){n=!1}function A(){var M=!0;return i?M=n:a&&!_i(a[ET])&&(M=a[ET]),M}function S(){var M=Gx();if(M&&i){if(YG(M,s),o){var P=o.body||o;Qf(P.ononline)||YG(P,s)}i=!1}}return{isOnline:A,isListening:function(){return i},unload:S}}var lJ=function(){function c(o,a){var i=[],n=!1;this._get=function(){return i},this._set=function(s){return i=s,i},Wu(c,this,function(s){s[xA]=function(h){if(s[Ok]()>=a.eventsLimitInMem()){n||(Ni(o,2,105,"Maximum in-memory buffer size reached: "+s[Ok](),!0),n=!0);return}i[Dk](h)},s[Ok]=function(){return i[$a]},s.size=function(){for(var h=i[$a],v=0;v<i[$a];v++)h+=i[v][$a];return a[TB]()||(h+=2),h},s[Hk]=function(){i=[],n=!1},s.getItems=function(){return i.slice(0)},s[AS]=function(h){if(h&&h[$a]>0){var v=a[TB]()?h.join(` 9097`):"["+h.join(",")+"]";return v}return null}})}return c.__ieDyn=1,c}(),Nxe=function(c){Sb(o,c);function o(a,i){var n=c.call(this,a,i)||this;return Wu(o,n,function(s,h){s[gk]=function(v){h[Hk]()},s[YS]=function(v){}}),n}return o.__ieDyn=1,o}(lJ),Ixe=function(c){Sb(o,c);function o(a,i){var n=c.call(this,a,i)||this,s=!1;return Wu(o,n,function(h,v){var g=M(o[aS]),O=M(o[s2]),A=h._set(g.concat(O));A[$a]>o[sS]&&(A[$a]=o[sS]),P(o[s2],[]),P(o[aS],A),h[xA]=function(L){if(h[Ok]()>=o[sS]){s||(Ni(a,2,67,"Maximum buffer size reached: "+h[Ok](),!0),s=!0);return}v[xA](L),P(o[aS],h._get())},h[Hk]=function(){v[Hk](),P(o[aS],h._get()),P(o[s2],[]),s=!1},h[gk]=function(L){P(o[aS],h._set(S(L,h._get())));var V=M(o[s2]);V instanceof Array&&L instanceof Array&&(V=V.concat(L),V[$a]>o[sS]&&(Ni(a,1,67,"Sent buffer reached its maximum size: "+V[$a],!0),V[$a]=o[sS]),P(o[s2],
9097V))},h[YS]=function(L){var V=M(o[s2]);V=S(L,V),P(o[s2],V)};function S(L,V){var N=[];return Po(V,function(ee){!Ba(ee)&&Bv(L,ee)===-1&&N[Dk](ee)}),N}function M(L){var V=L;try{V=i[g2]&&i[g2]()?i[g2]()+"_"+V:V;var N=mB(a,V);if(N){var ee=zv().parse(N);if(aa(ee)&&(ee=zv().parse(ee)),ee&&mu(ee))return ee}}catch(J){Ni(a,1,42," storage key: "+V+", "+Ss(J),{exception:To(J)})}return[]}function P(L,V){var N=L;try{N=i[g2]&&i[g2]()?i[g2]()+"_"+N:N;var ee=JSON[bA](V);gB(a,N,ee)}catch(J){gB(a,N,JSON[bA]([])),Ni(a,2,41," storage key: "+N+", "+Ss(J)+". Buffer cleared",{exception:To(J)})}}}),n}return o.BUFFER_KEY="AI_buffer",o.SENT_BUFFER_KEY="AI_sentBuffer",o.MAX_BUFFER_SIZE=2e3,o}(lJ),Mxe=function(){function c(o){Wu(c,this,function(a){a.serialize=function(h){var v=i(h,"root");try{return zv()[bA](v)}catch(g){Ni(o,1,48,g&&Ba(g[m2])?g[m2]():"Error serializing object",null,!0)}};function i(h,v){var g="__aiCircularRefCheck",O={};if(!h)return Ni(o,1,48,"cannot serialize object because it is null or undefined",{name:v},!0),O;if(h[g])return Ni(o,2,50,"Circular reference detected while serializing object",{name:v},!0),O;if(!h.aiDataContract){if(v==="measurements")O=s(h,"number",v);else if(v==="properties")O=s(h,"string",v);else if(v==="tags")O=s(h,"string",v);else if(mu(h))O=n(h,v);else{Ni(o,2,49,"Attempting to serialize an object which does not implement ISerializable",{name:v},!0);try{zv()[bA](h),O=h}catch(A){Ni(o,1,48,A&&Ba(A[m2])?A[m2]():"Error serializing object",null,!0)}}return O}return h[g]=!0,ac(h.aiDataContract,function(A,S){var M=Ba(S)?S()&1:S&1,P=Ba(S)?S()&4:S&4,L=S&2,V=h[A]!==void 0,N=Lv(h[A])&&h[A]!==null;if(M&&!V&&!L)Ni(o,1,24,"Missing required field specification. The field is required but not present on source",{field:A,name:v});else if(!P){var ee=void 0;N?L?ee=n(h[A],A):ee=i(h[A],A):ee=h[A],ee!==void 0&&(O[A]=ee)}}),delete h[g],O}function n(h,v){var g;if(h)if(!mu(h))Ni(o,1,54,`This field was specified as an array in the contract but the item is not an array.\r 9098`,{name:v},!0);else{g=[];for(var O=0;O<h[$a];O++){var A=h[O],S=i(A,v+"["+O+"]");g[Dk](S)}}return g}function s(h,v,g){var O;return h&&(O={},ac(h,function(A,S){if(v==="string")S===void 0?O[A]="undefined":S===null?O[A]="null":S[m2]?O[A]=S[m2]():O[A]="invalid field: toString() is not defined.";else if(v==="number")if(S===void 0)O[A]="undefined";else if(S===null)O[A]="null";else{var M=parseFloat(S);isNaN(M)?O[A]="NaN":O[A]=M}else O[A]="invalid field: "+g+" is of unknown type.",Ni(o,1,O[A],null,!0)})),O}})}return c.__ieDyn=1,c}(),Fxe=8,Rxe=function(){function c(){}return c.prototype.getHashCodeScore=function(o){var a=this.getHashCode(o)/c.INT_MAX_VALUE;return a*100},c.prototype.getHashCode=function(o){if(o==="")return 0;for(;o[$a]<Fxe;)o=o.concat(o);for(var a=5381,i=0;i<o[$a];++i)a=(a<<5)+a+o.charCodeAt(i),a=a&a;return Math.abs(a)},c.INT_MAX_VALUE=2147483647,c}(),Bxe=function(){function c(){var o=this,a=new Rxe,i=new KX;o[uJ]=function(n){var s=0;return n[Zf]&&n[Zf][i.userId]?s=a.getHashCodeScore(n[Zf][i.userId]):n.ext&&n.ext.user&&n.ext.user.id?s=a[wxe](n.ext.user.id):n[Zf]&&n[Zf][i.operationId]?s=a.getHashCodeScore(n[Zf][i.operationId]):n.ext&&n.ext.telemetryTrace&&n.ext.telemetryTrace[yA]?s=a.getHashCodeScore(n.ext.telemetryTrace[yA]):s=Math.random()*100,s}}return c}(),Pxe=function(){function c(o,a){this.INT_MAX_VALUE=2147483647;var i=a||OA(null);(o>100||o<0)&&(i.throwInternal(2,58,"Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.",{samplingRate:o},!0),o=100),this[i4]=o,this.samplingScoreGenerator=new Bxe}return c.prototype.isSampledIn=function(o){var a=this[i4],i=!1;return a==null||a>=100||o.baseType===N2[c1]?!0:(i=this.samplingScoreGenerator[uJ](o)<a,i)},c}(),ob,jxe=65e3;function AT(c){try{return c.responseText}catch{}return null}function XG(){var c,o,a;return c={endpointUrl:function(){return $P+KS}},c[TB]=function(){return!1},c[sJ]=function(){return 15e3},c[NB]=function(){return 102400},c[MB]=function(){return!1},c[nJ]=function(){return!0},c[DS]=function(){return!1},c[IB]=function(){return!0},c[OS]=function(){return!1},c[oJ]=function(){return!1},c[tJ]=function(){return!1},c[rN]=function(){return o},c[g2]=function(){return o},c[rJ]=function(){return 100},c[iJ]=function(){return a},c[aJ]=function(){return o},c.eventsLimitInMem=function(){return 1e4},c}var Lxe=(ob={},ob[Nx.dataType]=cJ,ob[Sk.dataType]=Dxe,ob[Jx.dataType]=Axe,ob[Ak.dataType]=Oxe,ob[S0.dataType]=Cxe,ob[N2.dataType]=Sxe,ob[I2.dataType]=Exe,ob),zxe=function(c){Sb(o,c);function o(){var a=c.call(this)||this;a.priority=1001,a.identifier=YX,a._senderConfig=XG();var i,n,s,h,v,g,O,A,S=0,M,P,L,V;return Wu(o,a,function(N,ee){_t(),N.pause=function(){zt(),h=!0},N.resume=function(){h&&(h=!1,n=null,N._buffer.size()>N._senderConfig[NB]()&&N[Q_](!0,null,10),Ot())},N.flush=function(Ze,Vt,sn){if(Ze===void 0&&(Ze=!0),!h){zt();try{N[Q_](Ze,null,sn||1)}catch(yn){Ni(N[op](),1,22,"flush failed, telemetry will not be collected: "+Ss(yn),{exception:To(yn)})}}},N.onunloadFlush=function(){if(!h)if((N._senderConfig[tJ]()===!1||N[zu][IB]()===!1)&&fT())try{N[Q_](!0,ce,2)}catch(Ze){Ni(N[op](),1,20,"failed to flush with beacon sender on page unload, telemetry will not be collected: "+Ss(Ze),{exception:To(Ze)})}else N.flush()},N.addHeader=function(Ze,Vt){A[Ze]=Vt},N.initialize=function(Ze,Vt,sn,yn){N.isInitialized()&&Ni(N[op](),1,28,"Sender is already initialized"),ee.initialize(Ze,Vt,sn,yn);var Yt=N._getTelCtx(),We=N.identifier;g=new Mxe(Vt.logger),i=0,n=null,s=0,N[uS]=null,O=0;var Ye=N[op]();V=V2(Ob("Sender"),Vt.evtNamespace&&Vt.evtNamespace()),L=Txe(V);var He=XG();ac(He,function(ct,on){N[zu][ct]=function(){var Xt=Yt.getConfig(We,ct,on());return!Xt&&ct==="endpointUrl"&&(Xt=on()),Xt}}),N._buffer=N[zu][nJ]()&&gA()?new Ixe(Ye,N[zu]):new Nxe(Ye,N[zu]),N._sample=ne
9098w Pxe(N[zu][rJ](),Ye),Ht(Ze)||Ni(Ye,1,100,"Invalid Instrumentation key "+Ze[rN]),!ZT(N._senderConfig.endpointUrl())&&N._senderConfig.customHeaders()&&N._senderConfig.customHeaders()[$a]>0&&Po(N[zu][iJ](),function(ct){a.addHeader(ct.header,ct.value)});var dt=N[zu],It=null;!dt[OS]()&&Qq()?It=Tt:!dt[OS]()&&WN()&&(It=Ce),!It&&Jq()&&(It=$e),M=It||Ce,!dt[IB]()&&fT()&&(It=ke),N[uS]=It||Ce,!dt[oJ]()&&Jq(!0)?P=be:fT()?P=ke:!dt[OS]()&&Qq()?P=Tt:!dt[OS]()&&WN()?P=Ce:P=M},N.processTelemetry=function(Ze,Vt){Vt=N._getTelCtx(Vt);var sn=Vt[op]();try{if(N[zu][MB]())return;if(!Ze){Ni(sn,1,7,"Cannot send empty telemetry");return}if(Ze.baseData&&!Ze[a6]){Ni(sn,1,70,"Cannot send telemetry without baseData and baseType");return}if(Ze[a6]||(Ze[a6]="EventData"),!N[uS]){Ni(sn,1,28,"Sender was not initialized");return}if(J(Ze))Ze[jX]=N._sample[i4];else{Ni(sn,2,33,"Telemetry item was sampled out and not sent",{SampleRate:N._sample[i4]});return}var yn=N[zu][aJ]()||void 0,Yt=Ze.iKey||N[zu][rN](),We=o.constructEnvelope(Ze,Yt,sn,yn);if(!We){Ni(sn,1,47,"Unable to create an AppInsights envelope");return}var Ye=!1;if(Ze[Zf]&&Ze[Zf][H5]&&(Po(Ze[Zf][H5],function(ct){try{ct&&ct(We)===!1&&(Ye=!0,_2(sn,"Telemetry processor check returns false"))}catch(on){Ni(sn,1,64,"One of telemetry initializers failed, telemetry item will not be sent: "+Ss(on),{exception:To(on)},!0)}}),delete Ze[Zf][H5]),Ye)return;var He=g.serialize(We),dt=N[Z_],It=dt.size();It+He[$a]>N[zu][NB]()&&N[Q_](!0,null,10),dt[xA](He),Ot()}catch(ct){Ni(sn,2,12,"Failed adding telemetry to the sender's buffer, some telemetry will be lost: "+Ss(ct),{exception:To(ct)})}N.processNext(Ze,Vt)},N[bxe]=function(Ze,Vt,sn){Ze.readyState===4&&K(Ze.status,Vt,Ze.responseURL,sn,Ke(Ze),AT(Ze)||Ze.response)},N[Q_]=function(Ze,Vt,sn){if(Ze===void 0&&(Ze=!0),!h)try{var yn=N[Z_];if(N[zu][MB]())yn[Hk]();else{if(yn[Ok]()>0){var Yt=yn.getItems();bt(sn||0,Ze),Vt?Vt.call(a,Yt,Ze):N[uS](Yt,Ze)}s=+new Date}zt()}catch(Ye){var We=vX();(!We||We>9)&&Ni(N[op](),1,40,"Telemetry transmission failed, some telemetry will be lost: "+Ss(Ye),{exception:To(Ye)})}},N._doTeardown=function(Ze,Vt){N.onunloadFlush(),L.unload(),_t()},N[Tv]=function(Ze,Vt,sn){Ni(N[op](),2,26,"Failed to send telemetry.",{message:Vt}),N._buffer[YS](Ze)},N[s6]=function(Ze,Vt){for(var sn=[],yn=[],Yt=Vt.errors.reverse(),We=0,Ye=Yt;We<Ye.length;We++){var He=Ye[We],dt=Ze.splice(He.index,1)[0];Mt(He.statusCode)?yn[Dk](dt):sn[Dk](dt)}Ze[$a]>0&&N[CT](Ze,Vt[ST]),sn[$a]>0&&N[Tv](sn,Ke(null,["partial success",Vt[ST],"of",Vt.itemsReceived].join(" "))),yn[$a]>0&&(Ut(yn),Ni(N[op](),2,40,"Partial success. Delivered: "+Ze[$a]+", Failed: "+sn[$a]+". Will retry to send "+yn[$a]+" our of "+Vt[xxe]+" items"))},N[CT]=function(Ze,Vt){N._buffer[YS](Ze)},N._xdrOnLoad=function(Ze,Vt){var sn=AT(Ze);if(Ze&&(sn+""=="200"||sn===""))i=0,N[CT](Vt,0);else{var yn=Dt(sn);yn&&yn.itemsReceived&&yn.itemsReceived>yn[ST]&&!N[zu][DS]()?N[s6](Vt,yn):N[Tv](Vt,vt(Ze))}};function J(Ze){return N._sample.isSampledIn(Ze)}function K(Ze,Vt,sn,yn,Yt,We){var Ye=null;if(N._appId||(Ye=Dt(We),Ye&&Ye.appId&&(N._appId=Ye.appId)),(Ze<200||Ze>=300)&&Ze!==0){if((Ze===301||Ze===307||Ze===308)&&!re(sn)){N[Tv](Vt,Yt);return}!N[zu][DS]()&&Mt(Ze)?(Ut(Vt),Ni(N[op](),2,40,". Response code "+Ze+". Will retry to send "+Vt[$a]+" items.")):N[Tv](Vt,Yt)}else if(L&&!L.isOnline()){if(!N[zu][DS]()){var He=10;Ut(Vt,He),Ni(N[op](),2,40,". Offline - Response Code: ".concat(Ze,". Offline status: ").concat(!L.isOnline(),". Will retry to send ").concat(Vt.length," items."))}}else re(sn),Ze===206?(Ye||(Ye=Dt(We)),Ye&&!N[zu][DS]()?N[s6](Vt,Ye):N[Tv](Vt,Yt)):(i=0,N[CT](Vt,yn))}function re(Ze){return O>=10?!1:!_i(Ze)&&Ze!==""&&Ze!==N[zu][u2]()?(N[zu][u2]=function(){return Ze},++O,!0):!1}function ce(Ze,Vt){P?P(Ze,!1):ke(Ze)}function pe(Ze){var Vt=Ab(),sn=N[Z_],yn=N[zu][u2](),Yt=N._buffer[AS](Ze),We=new Blob([Yt],{type:"text/plain;charset=UTF-8"}),Ye=Vt.sendBeacon(yn,We);return Ye&&(sn[gk](Ze),N._onSuccess(Ze,Ze[$a])),Ye}function ke(Ze,Vt){if(mu(Ze)&&Ze[$a]>0&&!pe(Ze)){for(var sn=[],yn=0;yn<Ze[$a];yn++){var Yt=Ze[yn];pe([Yt])||sn[Dk](Yt)}sn[$a]>0&&(M&&M(sn,!0),Ni(N[op](),2,40,". Failed to send telemetry with Beacon API, retried with
9098normal sender."))}}function Ce(Ze,Vt){var sn=new XMLHttpRequest,yn=N[zu][u2]();try{sn[k2]=!0}catch{}sn.open("POST",yn,Vt),sn[u6]("Content-type","application/json"),ZT(yn)&&sn[u6](rc[6],rc[7]),Po(U2(A),function(We){sn[u6](We,A[We])}),sn.onreadystatechange=function(){return N._xhrReadyStateChange(sn,Ze,Ze[$a])},sn.onerror=function(We){return N[Tv](Ze,Ke(sn),We)};var Yt=N._buffer[AS](Ze);sn.send(Yt),N._buffer[gk](Ze)}function be(Ze,Vt){if(mu(Ze)){for(var sn=Ze[$a],yn=0;yn<Ze[$a];yn++)sn+=Ze[yn][$a];S+sn<=jxe?ht(Ze,!1):fT()?ke(Ze):(M&&M(Ze,!0),Ni(N[op](),2,40,". Failed to send telemetry with Beacon API, retried with xhrSender."))}}function $e(Ze,Vt){ht(Ze,!0)}function ht(Ze,Vt){var sn,yn=N[zu][u2](),Yt=N._buffer[AS](Ze),We=new Blob([Yt],{type:"application/json"}),Ye=new Headers,He=Yt[$a],dt=!1,It=!1;ZT(yn)&&Ye.append(rc[6],rc[7]),Po(U2(A),function(Xt){Ye.append(Xt,A[Xt])});var ct=(sn={method:"POST",headers:Ye,body:We},sn[k2]=!0,sn);Vt||(ct.keepalive=!0,dt=!0,S+=He);var on=new Request(yn,ct);try{on[k2]=!0}catch{}N._buffer[gk](Ze);try{fetch(on).then(function(Xt){Vt||(S-=He,He=0),It||(It=!0,Xt.ok?Xt.text().then(function(En){K(Xt.status,Ze,Xt.url,Ze[$a],Xt.statusText,En)}):N[Tv](Ze,Xt.statusText))}).catch(function(Xt){Vt||(S-=He,He=0),It||(It=!0,N[Tv](Ze,Xt.message))})}catch(Xt){It||N[Tv](Ze,To(Xt))}dt&&!It&&(It=!0,N._onSuccess(Ze,Ze[$a]))}function Dt(Ze){try{if(Ze&&Ze!==""){var Vt=zv().parse(Ze);if(Vt&&Vt.itemsReceived&&Vt.itemsReceived>=Vt[ST]&&Vt.itemsReceived-Vt.itemsAccepted===Vt.errors[$a])return Vt}}catch(sn){Ni(N[op](),1,43,"Cannot parse the response. "+Ss(sn),{response:Ze})}return null}function Ut(Ze,Vt){if(Vt===void 0&&(Vt=1),!(!Ze||Ze[$a]===0)){var sn=N[Z_];sn[YS](Ze),i++;for(var yn=0,Yt=Ze;yn<Yt.length;yn++){var We=Yt[yn];sn[xA](We)}Ee(Vt),Ot()}}function Ee(Ze){var Vt=10,sn;if(i<=1)sn=Vt;else{var yn=(Math.pow(2,i)-1)/2,Yt=Math.floor(Math.random()*yn*Vt)+1;Yt=Ze*Yt,sn=Math.max(Math.min(Yt,3600),Vt)}var We=h1()+sn*1e3;n=We}function Ot(){if(!v&&!h){var Ze=n?Math.max(0,n-h1()):0,Vt=Math.max(N[zu][sJ](),Ze);v=setTimeout(function(){v=null,N[Q_](!0,null,1)},Vt)}}function zt(){clearTimeout(v),v=null,n=null}function Mt(Ze){return Ze===401||Ze===403||Ze===408||Ze===429||Ze===500||Ze===502||Ze===503||Ze===504}function Ke(Ze,Vt){return Ze?"XMLHttpRequest,Status:"+Ze.status+",Response:"+AT(Ze)||Ze.response||"":Vt}function Tt(Ze,Vt){var sn=N[Z_],yn=Gx(),Yt=new XDomainRequest;Yt.onload=function(){return N._xdrOnLoad(Yt,Ze)},Yt.onerror=function(dt){return N[Tv](Ze,vt(Yt),dt)};var We=yn&&yn.location&&yn.location.protocol||"";if(N[zu][u2]().lastIndexOf(We,0)!==0){Ni(N[op](),2,40,". Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."),sn[Hk]();return}var Ye=N[zu][u2]().replace(/^(https?:)/,"");Yt.open("POST",Ye);var He=sn[AS](Ze);Yt.send(He),sn[gk](Ze)}function vt(Ze,Vt){return Ze?"XDomainRequest,Response:"+AT(Ze)||"":Vt}function yt(){var Ze="getNotifyMgr";return N.core[Ze]?N.core[Ze]():N.core._notificationManager}function bt(Ze,Vt){var sn=yt();if(sn&&sn[qG])try{sn[qG](Ze,Vt)}catch(yn){Ni(N[op](),1,74,"send request notification failed: "+Ss(yn),{exception:To(yn)})}}function Ht(Ze){var Vt=_i(Ze[GG])?!1:Ze[GG];if(Vt)return!0;var sn="^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",yn=new RegExp(sn);return yn.test(Ze[rN])}function _t(){N[uS]=null,N[Z_]=null,N._appId=null,N._sample=null,A={},L=null,i=0,n=null,s=null,h=!1,v=null,g=null,O=0,S=0,M=null,P=null,V=null}}),a}return o.constructEnvelope=function(a,i,n,s){var h;i!==a.iKey&&!_i(i)?h=lp(lp({},a),{iKey:i}):h=a;var v=Lxe[h.baseType]||cJ;return v(n,h,s)},o}(TA),JG="duration",qk="properties",A0="requestUrl",TS="inst",fb="length",gb="traceID",Ux="spanID",O0="traceFlags",XS="context",Tk="aborted",iN="traceId",oN="spanId",n1="core",l6="includeCorrelationHeaders",QG="canIncludeCorrelationHeader",FB="getAbsoluteUrl",c2="headers",C0="requestHeaders",OT="appId",f6="setRequestHeader",ZG="trackDependencyDataInternal",d6="distributedTracingMode",C2="startTime",ek="toLowerCase",Uxe="enableRequestHeaderTracking",Wxe="enableAjaxErrorStatusText",Vxe="enableAjaxPerfTracking",$xe="maxAjaxCallsPerVie
9098w",Hxe="enableResponseHeaderTracking",qxe="excludeRequestFromAutoTrackingPatterns",Gxe="addRequestContext",Kxe="disableAjaxTracking",Yxe="disableFetchTracking",Fv="status",y2="statusText",o4="headerMap",RB="openDone",BB="sendDone",S2="requestSentTime",PB="abortDone",jB="getTraceId",LB="getTraceFlags",Ix="method",zB="errorStatusText",fJ="stateChangeAttached",Xxe="responseText",NS="responseFinishedTime",UB="CreateTrackItem",dJ="response",eK="getAllResponseHeaders",WB="getPartAProps",tK="getCorrelationContext",a4="perfMark",Jxe="ajaxPerfLookupDelay",ck="name",VB="perfTiming",Qxe="correlationContext",h6="ajaxTotalDuration",p6="eventTraceCtx";function hJ(c,o,a){var i=0,n=c[o],s=c[a];return n&&s&&(i=wm(n,s)),i}function l2(c,o,a,i,n){var s=0,h=hJ(a,i,n);return h&&(s=Ax(c,o,Tx(h))),s}function Ax(c,o,a){var i="ajaxPerf",n=0;if(c&&o&&a){var s=c[i]=c[i]||{};s[o]=a,n=1}return n}function Zxe(c,o){var a=c[VB],i=o[qk]||{},n=0,s="name",h="Start",v="End",g="domainLookup",O="connect",A="redirect",S="request",M="response",P="startTime",L=g+h,V=g+v,N=O+h,ee=O+v,J=S+h,K=S+v,re=M+h,ce=M+v,pe=A+h,ke=A=v,Ce="transferSize",be="encodedBodySize",$e="decodedBodySize",ht="serverTiming";if(a){n|=l2(i,A,a,pe,ke),n|=l2(i,g,a,L,V),n|=l2(i,O,a,N,ee),n|=l2(i,S,a,J,K),n|=l2(i,M,a,re,ce),n|=l2(i,"networkConnect",a,P,ee),n|=l2(i,"sentRequest",a,J,ce);var Dt=a[JG];Dt||(Dt=hJ(a,P,ce)||0),n|=Ax(i,JG,Dt),n|=Ax(i,"perfTotal",Dt);var Ut=a[ht];if(Ut){var Ee={};Po(Ut,function(Ot,zt){var Mt=UN(Ot[s]||""+zt),Ke=Ee[Mt]||{};ac(Ot,function(Tt,vt){(Tt!==s&&aa(vt)||aX(vt))&&(Ke[Tt]&&(vt=Ke[Tt]+";"+vt),(vt||!aa(vt))&&(Ke[Tt]=vt))}),Ee[Mt]=Ke}),n|=Ax(i,ht,Ee)}n|=Ax(i,Ce,a[Ce]),n|=Ax(i,be,a[be]),n|=Ax(i,$e,a[$e])}else c[a4]&&(n|=Ax(i,"missing",c.perfAttempts));n&&(o[qk]=i)}var ewe=function(){function c(){var o=this;o[RB]=!1,o.setRequestHeaderDone=!1,o[BB]=!1,o[PB]=!1,o[fJ]=!1}return c}(),nK=function(){function c(o,a,i,n){var s,h=this,v=i,g="responseText";h[a4]=null,h.completed=!1,h.requestHeadersSize=null,h[C0]=null,h.responseReceivingDuration=null,h.callbackDuration=null,h[h6]=null,h[Tk]=0,h.pageUrl=null,h[A0]=null,h.requestSize=0,h[Ix]=null,h[Fv]=null,h[S2]=null,h.responseStartedTime=null,h[NS]=null,h.callbackFinishedTime=null,h.endTime=null,h.xhrMonitoringState=new ewe,h.clientFailure=0,h[gb]=o,h[Ux]=a,h[O0]=n==null?void 0:n.getTraceFlags(),n?h[p6]=(s={},s[iN]=n[jB](),s[oN]=n.getSpanId(),s[O0]=n[LB](),s):h[p6]=null,Wu(c,h,function(O){O.getAbsoluteUrl=function(){return O[A0]?zbe(O[A0]):null},O.getPathName=function(){return O[A0]?IA(v,Ube(O[Ix],O[A0])):null},O[UB]=function(A,S,M){var P;if(O.ajaxTotalDuration=Math.round(wm(O.requestSentTime,O.responseFinishedTime)*1e3)/1e3,O[h6]<0)return null;var L=(P={id:"|"+O[gb]+"."+O[Ux],target:O[FB]()},P[ck]=O.getPathName(),P.type=A,P[C2]=null,P.duration=O[h6],P.success=+O[Fv]>=200&&+O[Fv]<400,P.responseCode=+O[Fv],P[qk]={HttpMethod:O[Ix]},P),V=L[qk];if(O[Tk]&&(V[Tk]=!0),O[S2]&&(L[C2]=new Date,L[C2].setTime(O[S2])),Zxe(O,L),S&&U2(O.requestHeaders)[fb]>0&&(V[C0]=O[C0]),M){var N=M();if(N){var ee=N[Qxe];if(ee&&(L.correlationContext=ee),N[o4]&&U2(N.headerMap)[fb]>0&&(V.responseHeaders=N[o4]),O[zB])if(O[Fv]>=400){var J=N.type;(J===""||J==="text")&&(V.responseText=N.responseText?N[y2]+" - "+N[g]:N[y2]),J==="json"&&(V.responseText=N.response?N[y2]+" - "+JSON.stringify(N[dJ]):N[y2])}else O[Fv]===0&&(V.responseText=N[y2]||"")}}return L},O[WB]=function(){var A,S=null,M=O[p6];if(M&&(M[iN]||M[oN])){S={};var P=S[Og.TraceExt]=(A={},A[gb]=M[iN],A.parentID=M[oN],A);_i(M[O0])||(P[O0]=M[O0])}return S}})}return c.__ieDyn=1,c}(),rK="ai.ajxmn.",JS="diagLog",Tg="ajaxData",b2="fetch",cS="Failed to monitor XMLHttpRequest",pJ=", monitoring data for this ajax call ",tk=pJ+"may be incorrect.",iK=pJ+"won't be sent.",oK="Failed to get Request-Context correlation header as it may be not included in the response or not accessible.",aK="Failed to add custom defined request context as configured call back may missing a null check.",sK="Failed to calculate the duration of the ",uK=0;function twe(){var c=tE();return!c||_i(c.Request)||_i(c.Request[dp])||_i(c[b2])?null:c[b2]}var DT=null;function nwe(){if(DT==null)try{DT=!!(self&&self instanceof WorkerGlobalScope)}catch{DT=!1}return DT}function rwe(c){var o=!1;if(WN()){var a=XMLHttpRequest[dp];o=!_i(a)&&!_i(a.open)&&!_i(a.send)&&!_i(a.abort)}var i=vX();if(i&&i<9&&(o=!1),o)try{var n=new XMLHttpRequest;n[Tg]={};var s=XMLHttpRequest[dp].open;XMLHttpRequest[dp].open=s}catch(h){o=!1,QS(c,15,"Failed to enable XMLHttpRequest monitoring, extension is not supported",{exception:To(h)})}return o}function aN(c){var o="";
9098try{c&&c[Tg]&&c[Tg][A0]&&(o+="(url: '"+c[Tg][A0]+"')")}catch{}return o}function QS(c,o,a,i,n){Ni(c[JS](),1,o,a,i,n)}function nk(c,o,a,i,n){Ni(c[JS](),2,o,a,i,n)}function lS(c,o,a){return function(i){QS(c,o,a,{ajaxDiagnosticsMessage:aN(i[TS]),exception:To(i.err)})}}function rk(c,o){return c&&o?c.indexOf(o):-1}function cK(c,o,a){var i={id:o,fn:a};return c.push(i),{remove:function(){Po(c,function(n,s){if(n.id===i.id)return c.splice(s,1),-1})}}}function mJ(c,o,a,i){var n=!0;return Po(o,function(s,h){try{s.fn.call(null,a)===!1&&(n=!1)}catch(v){Ni(c&&c.logger,1,64,"Dependency "+i+" [#"+h+"] failed: "+Ss(v),{exception:To(v)},!0)}}),n}function iwe(c,o,a,i,n,s){var h=c[fb];if(h>0){var v={core:o,xhr:i,input:n,init:s,traceId:a[gb],spanId:a[Ux],traceFlags:a[O0],context:a[XS]||{},aborted:!!a[Tk]};mJ(o,c,v,"listener"),a[gb]=v[iN],a[Ux]=v[oN],a[O0]=v[O0],a[XS]=v[XS]}}var TT="*.blob.core.",owe=TP([TT+"windows.net",TT+"chinacloudapi.cn",TT+"cloudapi.de",TT+"usgovcloudapi.net"]),awe=[/https:\/\/[^\/]*(\.pipe\.aria|aria\.pipe|events\.data|collector\.azure)\.[^\/]+\/(OneCollector\/1|Collector\/3)\.0/i];function $B(){var c={maxAjaxCallsPerView:500,disableAjaxTracking:!1,disableFetchTracking:!1,excludeRequestFromAutoTrackingPatterns:void 0,disableCorrelationHeaders:!1,distributedTracingMode:1,correlationHeaderExcludedDomains:owe,correlationHeaderDomains:void 0,correlationHeaderExcludePatterns:void 0,appId:void 0,enableCorsCorrelation:!1,enableRequestHeaderTracking:!1,enableResponseHeaderTracking:!1,enableAjaxErrorStatusText:!1,enableAjaxPerfTracking:!1,maxAjaxPerfLookupAttempts:3,ajaxPerfLookupDelay:25,ignoreHeaders:["Authorization","X-API-Key","WWW-Authenticate"],addRequestContext:void 0,addIntEndpoints:!0};return c}function lK(){var c=$B();return ac(c,function(o){c[o]=void 0}),c}var swe=function(c){Sb(o,c);function o(){var a=c.call(this)||this;a.identifier=o.identifier,a.priority=120;var i,n,s,h,v,g,O,A,S,M,P,L,V,N,ee,J,K,re,ce,pe,ke,Ce,be;return Wu(o,a,function($e,ht){var Dt=ht._addHook;Ut(),$e.initialize=function(ct,on,Xt,En){$e.isInitialized()||(ht.initialize(ct,on,Xt,En),pe=V2(Ob("ajax"),on&&on.evtNamespace&&on.evtNamespace()),Ee(ct),Tt(),Mt(),Ot())},$e._doTeardown=function(){Ut()},$e.trackDependencyData=function(ct,on){It(be,$e[n1],null,ct,on)},$e[l6]=function(ct,on,Xt,En){var xe=$e._currentWindowHost||s;if(iwe(Ce,$e[n1],ct,En,on,Xt),on){if(mk[QG](h,ct[FB](),xe)){Xt||(Xt={});var jn=new Headers(Xt[c2]||(on instanceof Request?on[c2]||{}:{}));if(M){var nr="|"+ct[gb]+"."+ct[Ux];jn.set(rc[3],nr),v&&(ct[C0][rc[3]]=nr)}var ar=h[OT]||A&&A[OT]();if(ar&&(jn.set(rc[0],rc[2]+ar),v&&(ct[C0][rc[0]]=rc[2]+ar)),S){var cr=ct[O0];_i(cr)&&(cr=1);var Er=xG(bG(ct[gb],ct[Ux],cr));jn.set(rc[4],Er),v&&(ct[C0][rc[4]]=Er)}Xt[c2]=jn}return Xt}else if(En){if(mk[QG](h,ct[FB](),xe)){if(M){var nr="|"+ct[gb]+"."+ct[Ux];En[f6](rc[3],nr),v&&(ct[C0][rc[3]]=nr)}var ar=h[OT]||A&&A[OT]();if(ar&&(En[f6](rc[0],rc[2]+ar),v&&(ct[C0][rc[0]]=rc[2]+ar)),S){var cr=ct[O0];_i(cr)&&(cr=1);var Er=xG(bG(ct[gb],ct[Ux],cr));En[f6](rc[4],Er),v&&(ct[C0][rc[4]]=Er)}}return En}},$e[ZG]=function(ct,on,Xt){if(V===-1||O<V){(h[d6]===2||h[d6]===1)&&typeof ct.id=="string"&&ct.id[ct.id[fb]-1]!=="."&&(ct.id+="."),_i(ct[C2])&&(ct[C2]=new Date);var En=Sx(ct,I2.dataType,I2.envelopeType,$e[JS](),on,Xt);$e[n1].track(En)}else O===V&&QS($e,55,"Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.",!0);++O},$e.addDependencyListener=function(ct){return cK(Ce,ke++,ct)},$e.addDependencyInitializer=function(ct){return cK(be,ke++,ct)};function Ut(){var ct=jx();i=!1,n=!1,s=ct&&ct.host&&ct.host[ek](),h=o.getEmptyConfig(),v=!1,g=!1,O=0,A=null,S=!1,M=!1,P=null,L=!1,V=0,N=!1,ee={},J=!1,K=!1,re=null,ce=null,pe=null,ke=0,Ce=[],be=[]}function Ee(ct){var on=p1(null,ct,$e[n1]);h=lK();var Xt=$B();ac(Xt,function(jn,nr){h[jn]=on.getConfig(o.identifier,jn,nr)});var En=h[d6];if(v=h[Uxe],g=h[Wxe],L=h[Vxe],V=h[$xe],N=h[Hxe],re=[].concat(h[qxe]||[],h.addIntEndpoints!==!1?awe:[]),ce=h[Gxe],M=En===0||En===1,S=En===1||En===2,L){var xe=ct.instrumentationKey||"unkwn";xe[fb]>5?P=rK+xe.substring(xe[fb]-5)+".":P=rK+xe+"."}J=!!h[Kxe],K=!!h[Yxe]}function Ot(){var ct=$e[n1].getPlugin(k4);ct&&(A=ct.plugin[XS])}function zt(ct){var on=!0;return(ct||h.ignoreHeaders)&&Po(h.ignoreHeaders,function(Xt){if(Xt[ek]()===ct[ek]())return on=!1,-1}),on}function Mt(){var ct=twe();if(ct){var on=tE(),Xt=ct.polyfill;!K&&!i?(Dt(hB(on,b2,{ns:pe,req:function(En,xe,jn){var nr;if(!K&&i&&!vt(null,xe,jn)&&!(Xt&&n)){var ar=En.ctx();nr=We(xe,jn);var cr=$e[l6](nr,xe,jn);cr!==jn&&En.set(1,cr),ar.data=nr}},rsp:function(En,xe){if(!K){var jn=En.ctx().data;jn&&(En.rslt=En.rslt.then(function(nr){return He(En,(nr||{})[Fv],xe,nr,jn,function(){var ar={statusText:(nr||{})[y2],headerMap:null,correlationContext:dt(nr)};if(N&&nr){var cr={};
9098nr.headers.forEach(function(Er,hn){zt(hn)&&(cr[hn]=Er)}),ar[o4]=cr}return ar}),nr}).catch(function(nr){throw He(En,0,xe,null,jn,null,{error:nr.message||To(nr)}),nr}))}},hkErr:lS($e,15,"Failed to monitor Window.fetch"+tk)},!0,nwe())),i=!0):Xt&&Dt(hB(on,b2,{ns:pe,req:function(En,xe,jn){vt(null,xe,jn)}})),Xt&&(on[b2].polyfill=Xt)}}function Ke(ct,on,Xt){Dt(Sbe(ct,on,Xt))}function Tt(){rwe($e)&&!J&&!n&&(Ke(XMLHttpRequest,"open",{ns:pe,req:function(ct,on,Xt,En){if(!J){var xe=ct[TS],jn=xe[Tg];!vt(xe,Xt)&&yt(xe,!0)&&((!jn||!jn.xhrMonitoringState[RB])&&Ht(xe,on,Xt,En),_t(xe))}},hkErr:lS($e,15,cS+".open"+tk)}),Ke(XMLHttpRequest,"send",{ns:pe,req:function(ct,on){if(!J){var Xt=ct[TS],En=Xt[Tg];yt(Xt)&&!En.xhrMonitoringState[BB]&&(yn("xhr",En),En[S2]=bT(),$e[l6](En,void 0,void 0,Xt),En.xhrMonitoringState[BB]=!0)}},hkErr:lS($e,17,cS+tk)}),Ke(XMLHttpRequest,"abort",{ns:pe,req:function(ct){if(!J){var on=ct[TS],Xt=on[Tg];yt(on)&&!Xt.xhrMonitoringState[PB]&&(Xt[Tk]=1,Xt.xhrMonitoringState[PB]=!0)}},hkErr:lS($e,13,cS+".abort"+tk)}),Ke(XMLHttpRequest,"setRequestHeader",{ns:pe,req:function(ct,on,Xt){if(!J&&v){var En=ct[TS];yt(En)&&zt(on)&&(En[Tg][C0][on]=Xt)}},hkErr:lS($e,71,cS+".setRequestHeader"+tk)}),n=!0)}function vt(ct,on,Xt){var En=!1,xe=((aa(on)?on:(on||{}).url||"")||"")[ek]();if(Po(re,function(ar){var cr=ar;aa(ar)&&(cr=new RegExp(ar)),En||(En=cr.test(xe))}),En)return En;var jn=rk(xe,"?"),nr=rk(xe,"#");return(jn===-1||nr!==-1&&nr<jn)&&(jn=nr),jn!==-1&&(xe=xe.substring(0,jn)),_i(ct)?_i(on)||(En=(typeof on=="object"?on[k2]===!0:!1)||(Xt?Xt[k2]===!0:!1)):En=ct[k2]===!0||xe[k2]===!0,!En&&xe&&ZT(xe)&&(En=!0),En?ee[xe]||(ee[xe]=1):ee[xe]&&(En=!0),En}function yt(ct,on){var Xt=!0,En=n;return _i(ct)||(Xt=on===!0||!_i(ct[Tg])),En&&Xt}function bt(){var ct=null;return $e[n1]&&$e[n1].getTraceCtx&&(ct=$e[n1].getTraceCtx(!1)),!ct&&A&&A.telemetryTrace&&(ct=ZP(A.telemetryTrace)),ct}function Ht(ct,on,Xt,En){var xe,jn=bt(),nr=jn&&jn[jB]()||zx(),ar=zx().substr(0,16),cr=new nK(nr,ar,$e[JS](),(xe=$e.core)===null||xe===void 0?void 0:xe.getTraceCtx());cr[O0]=jn&&jn[LB](),cr[Ix]=on,cr[A0]=Xt,cr.xhrMonitoringState[RB]=!0,cr[C0]={},cr.async=En,cr[zB]=g,ct[Tg]=cr}function _t(ct){ct[Tg].xhrMonitoringState[fJ]=Kx(ct,"readystatechange",function(){try{ct&&ct.readyState===4&&yt(ct)&&Vt(ct)}catch(Xt){var on=To(Xt);(!on||rk(on[ek](),"c00c023f")===-1)&&QS($e,16,cS+" 'readystatechange' event handler"+tk,{ajaxDiagnosticsMessage:aN(ct),exception:on})}},pe)}function Ze(ct){try{var on=ct.responseType;if(on===""||on==="text")return ct[Xxe]}catch{}return null}function Vt(ct){var on=ct[Tg];on[NS]=bT(),on[Fv]=ct[Fv];function Xt(En,xe){var jn=xe||{};jn.ajaxDiagnosticsMessage=aN(ct),En&&(jn.exception=To(En)),nk($e,14,sK+"ajax call"+iK,jn)}Yt("xmlhttprequest",on,function(){try{var En=on[UB]("Ajax",v,function(){var nr={statusText:ct[y2],headerMap:null,correlationContext:sn(ct),type:ct.responseType,responseText:Ze(ct),response:ct[dJ]};if(N){var ar=ct[eK]();if(ar){var cr=fp(ar).split(/[\r\n]+/),Er={};Po(cr,function(hn){var rn=hn.split(": "),fn=rn.shift(),Xn=rn.join(": ");zt(fn)&&(Er[fn]=Xn)}),nr[o4]=Er}}return nr}),xe=void 0;try{ce&&(xe=ce({status:ct[Fv],xhr:ct}))}catch{nk($e,104,aK)}if(En){xe!==void 0&&(En[qk]=lp(lp({},En.properties),xe));var jn=on[WB]();It(be,$e[n1],on,En,null,jn)}else Xt(null,{requestSentTime:on[S2],responseFinishedTime:on[NS]})}finally{try{ct[Tg]=null}catch{}}},function(En){Xt(En,null)})}function sn(ct){try{var on=ct[eK]();if(on!==null){var Xt=rk(on[ek](),rc[8]);if(Xt!==-1){var En=ct.getResponseHeader(rc[0]);return mk[tK](En)}}}catch(xe){nk($e,18,oK,{ajaxDiagnosticsMessage:aN(ct),exception:To(xe)})}}function yn(ct,on){if(on[A0]&&P&&L){var Xt=rw();if(Xt&&Ba(Xt.mark)){uK++;var En=P+ct+"#"+uK;Xt.mark(En);var xe=Xt.getEntriesByName(En);xe&&xe[fb]===1&&(on[a4]=xe[0])}}}function Yt(ct,on,Xt,En){var xe=on[a4],jn=rw(),nr=h.maxAjaxPerfLookupAttempts,ar=h[Jxe],cr=on[A0],Er=0;(function hn(){try{if(jn&&xe){Er++;for(var rn=null,fn=jn.getEntries(),Xn=fn[fb]-1;Xn>=0;Xn--){var Fn=fn[Xn];if(Fn){if(Fn.entryType==="resource")Fn.initiatorType===ct&&(rk(Fn[ck],cr)!==-1||rk(cr,Fn[ck])!==-1)&&(rn=Fn);else if(Fn.entryType==="mark"&&Fn[ck]===xe[ck]){on[VB]=rn;break}if(Fn[C2]<xe[C2]-1e3)break}}}!xe||on[VB]||Er>=nr||on.async===!1?(xe&&Ba(jn.clearMarks)&&jn.clearMarks(xe[ck]),on.perfAttempts=Er,Xt()):setTimeout(hn,ar)}catch(Ar){En(Ar)}})()}function We(ct,on){var Xt,En=bt(),xe=En&&En[jB]()||zx(),jn=zx().substr(0,16),nr=new nK(xe,jn,$e[JS](),(Xt=$e.core)===null||Xt===void 0?void 0:Xt.getTraceCtx());nr[O0]=En&&En[LB](),nr[S2]=bT(),nr[zB]=g,ct instanceof Request?nr[A0]=ct?ct.url:"":nr[A0]=ct;var ar="GET";on&&on[Ix]?ar=on[Ix]:ct&&ct instanceof Request&&(ar=ct[Ix]),nr[Ix]=ar;var cr={};if(v){var Er=new Headers((on?on[c2]:0)||(ct instanceof Request?ct[c2]||{}:{}));Er.forEach(function(hn,rn){zt(rn)&&(cr[rn]=hn)})}return nr[C0]=cr,yn(b2,nr),nr}function Ye(ct){var on="";try{_i(ct)||(typeof ct=="string"?on+="(url: '".concat(ct,"')"):on+="(url: '".concat(ct.url,"')"))}catch(Xt){QS($e,15,"Failed to grab failed fetch diagnostics message",{exception:To(Xt)})}return on}function He(ct,on,Xt,En,xe,jn,nr){if(!xe)return;function ar(cr,Er,hn){var rn=hn||{};rn.fetchDiagnosticsMessage=Ye(Xt),Er&&(rn.exception=To(Er)),nk($e,cr,sK+"fetch call"+iK,rn)}
9098xe[NS]=bT(),xe[Fv]=on,Yt(b2,xe,function(){var cr=xe[UB]("Fetch",v,jn),Er;try{ce&&(Er=ce({status:on,request:Xt,response:En}))}catch{nk($e,104,aK)}if(cr){Er!==void 0&&(cr[qk]=lp(lp({},cr.properties),Er));var hn=xe[WB]();It(be,$e[n1],xe,cr,null,hn)}else ar(14,null,{requestSentTime:xe[S2],responseFinishedTime:xe[NS]})},function(cr){ar(18,cr,null)})}function dt(ct){if(ct&&ct[c2])try{var on=ct[c2].get(rc[0]);return mk[tK](on)}catch(Xt){nk($e,18,oK,{fetchDiagnosticsMessage:Ye(ct),exception:To(Xt)})}}function It(ct,on,Xt,En,xe,jn){var nr=!0,ar=ct[fb];if(ar>0){var cr={item:En,properties:xe,sysProperties:jn,context:Xt?Xt[XS]:null,aborted:Xt?!!Xt[Tk]:!1};nr=mJ(on,ct,cr,"initializer")}nr&&$e[ZG](En,xe,jn)}}),a}return o.prototype.processTelemetry=function(a,i){this.processNext(a,i)},o.prototype.addDependencyInitializer=function(a){return null},o.identifier="AjaxDependencyPlugin",o.getDefaultConfig=$B,o.getEmptyConfig=lK,o}(TA),uwe=function(){function c(){}return c}(),cwe=function(){function c(){this.id="browser",this.deviceClass="Browser"}return c}(),s4="sessionManager",u4="update",sN="isUserCookieSet",c4="isNewUser",m6="getTraceCtx",HB="telemetryTrace",gJ="applySessionContext",vJ="applyApplicationContext",yJ="applyDeviceContext",bJ="applyOperationContext",xJ="applyUserContext",wJ="applyOperatingSystemContxt",_J="applyLocationContext",kJ="applyInternalContext",Dx="accountId",uN="sdkExtension",cN="getSessionId",M2="namePrefix",lN="sessionCookiePostfix",fN="userCookiePostfix",wA="idLength",_A="getNewId",l4="length",lk="automaticSession",fk="authenticatedId",fS="sessionExpirationMs",NT="sessionRenewalMs",db="config",dS="acquisitionDate",IT="renewalDate",qB="cookieDomain",dN="join",hS="cookieSeparator",g6="authUserCookieName",lwe="2.8.11",fwe=function(){function c(o){this.sdkVersion=(o[uN]&&o[uN]()?o[uN]()+"_":"")+"javascript:"+lwe}return c}(),dwe=function(){function c(){}return c}(),hwe="ai_session",EJ=function(){function c(){}return c}(),pwe=function(){function c(o,a){var i=this,n,s,h=OA(a),v=BP(a);Wu(c,i,function(g){o||(o={}),Ba(o[fS])||(o[fS]=function(){return c.acquisitionSpan}),Ba(o[NT])||(o[NT]=function(){return c.renewalSpan}),g[db]=o;var O=g.config[lN]&&g[db][lN]()?g.config[lN]():g.config[M2]&&g[db][M2]()?g[db][M2]():"";n=function(){return hwe+O},g[lk]=new EJ,g[u4]=function(){var V=h1(),N=!1,ee=g[lk];ee.id||(N=!A(ee));var J=g.config[fS]();if(!N&&J>0){var K=g.config[NT](),re=V-ee[dS],ce=V-ee[IT];N=re<0||ce<0,N=N||re>J,N=N||ce>K}N?M(V):(!s||V-s>c.cookieUpdateInterval)&&P(ee,V)},g.backup=function(){var V=g[lk];L(V.id,V[dS],V[IT])};function A(V,N){var ee=!1,J=v.get(n());if(J&&Ba(J.split))ee=S(V,J);else{var K=Rbe(h,n());K&&(ee=S(V,K))}return ee||!!V.id}function S(V,N){var ee=!1,J=", session will be reset",K=N.split("|");if(K[l4]>=2)try{var re=+K[1]||0,ce=+K[2]||0;isNaN(re)||re<=0?Ni(h,2,27,"AI session acquisition date is 0"+J):isNaN(ce)||ce<=0?Ni(h,2,27,"AI session renewal date is 0"+J):K[0]&&(V.id=K[0],V[dS]=re,V[IT]=ce,ee=!0)}catch(pe){Ni(h,1,9,"Error parsing ai_session value ["+(N||"")+"]"+J+" - "+Ss(pe),{exception:To(pe)})}return ee}function M(V){var N=g[db]||{},ee=(N[_A]?N[_A]():null)||FP;g.automaticSession.id=ee(N[wA]?N[wA]():22),g[lk][dS]=V,P(g[lk],V),KP()||Ni(h,2,0,"Browser does not support local storage. Session durations will be inaccurate.")}function P(V,N){var ee=V[dS];V[IT]=N;var J=g[db],K=J[NT](),re=ee+J[fS]()-N,ce=[V.id,ee,N],pe=0;re<K?pe=re/1e3:pe=K/1e3;var ke=J[qB]?J[qB]():null;v.set(n(),ce.join("|"),J[fS]()>0?pe:null,ke),s=N}function L(V,N,ee){Bbe(h,n(),[V,N,ee][dN]("|"))}})}return c.acquisitionSpan=864e5,c.renewalSpan=18e5,c.cookieUpdateInterval=6e4,c}(),mwe=function(){function c(o,a,i,n){var s=this;s.traceID=o||zx(),s.parentID=a;var h=jx();!i&&h&&h.pathname&&(i=h.pathname),s.name=gf(n,i)}return c}();function fK(c){return!(typeof c!="string"||!c||c.match(/,|;|=| |\|/))}var gwe=function(){function c(o,a){this.isNewUser=!1,this.isUserCookieSet=!1;var i=OA(a),n=BP(a),s;Wu(c,this,function(h){h[db]=o;var v=h.config[fN]&&h[db][fN]()?h[db][fN]():"";s=function(){return c.userCookieName+v};var g=n.get(s());if(g){h[c4]=!1;var O=g.split(c[hS]);O[l4]>0&&(h.id=O[0],h[sN]=!!h.id)}function A(){var ee=o||{},J=(ee[_A]?ee[_A]():null)||FP,K=J(ee[wA]?o[wA]():22);return K}function S(ee){var J=Wk(new Date);h.accountAcquisitionDate=J,h[c4]=!0;var K=[ee,J];return K}function M(ee){var J=31536e3;h[sN]=n.set(s(),ee,J)}if(!h.id){h.id=A();var P=S(h.id);M(P[dN](c[hS]));var L=o[M2]&&o[M2]()?o[M2]()+"ai_session":"ai_session";Pbe(i,L)}h[Dx]=o[Dx]?o[Dx]():void 0;var V=n.get(c[g6]);if(V){V=decodeURI(V);var N=V.split(c[hS]);N[0]&&(h[fk]=N[0]),N[l4]>1&&N[1]&&(h[Dx]=N[1])}h.setAuthenticatedUserContext=function(ee,J,K){K===void 0&&(K=!1);var re=!fK(ee)||J&&!fK(J);if(re){Ni(i,2,60,"Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.",!0);return}h[fk]=ee;var ce=h[fk];J&&(h[Dx]=J,ce=[h[fk],h.accountId][dN](c[hS])),K&&n.set(c[g6],encodeURI(ce))},h.clearAuthenticatedUserContext=function(){h[fk]=null,h[Dx]=null,n.del(c[g6])}
9098,h[u4]=function(ee){if(h.id!==ee||!h[sN]){var J=ee||A(),K=S(J);M(K[dN](c[hS]))}}})}return c.cookieSeparator="|",c.userCookieName="ai_user",c.authUserCookieName="ai_authUser",c}(),MT="ext",FT="tags";function ik(c,o){c&&c[o]&&U2(c[o])[l4]===0&&delete c[o]}var vwe=function(){function c(o,a,i){var n=this,s=o.logger;this.appId=function(){return null},this[cN]=function(){return null},Wu(c,this,function(h){if(h.application=new uwe,h.internal=new fwe(a),AA()){h[s4]=new pwe(a,o),h.device=new cwe,h.location=new dwe,h.user=new gwe(a,o);var v=void 0,g=void 0,O;i&&(v=i.getTraceId(),g=i.getSpanId(),O=i.getName()),h[HB]=new mwe(v,g,O,s),h.session=new EJ}h[cN]=function(){var A=h.session,S=null;if(A&&aa(A.id))S=A.id;else{var M=(h[s4]||{})[lk];S=M&&aa(M.id)?M.id:null}return S},h[gJ]=function(A,S){Ms(hf(A.ext,Og.AppExt),"sesId",h[cN](),aa)},h[wJ]=function(A,S){Ms(A.ext,Og.OSExt,h.os)},h[vJ]=function(A,S){var M=h.application;if(M){var P=hf(A,FT);Ms(P,Uu.applicationVersion,M.ver,aa),Ms(P,Uu.applicationBuild,M.build,aa)}},h[yJ]=function(A,S){var M=h.device;if(M){var P=hf(hf(A,MT),Og.DeviceExt);Ms(P,"localId",M.id,aa),Ms(P,"ip",M.ip,aa),Ms(P,"model",M.model,aa),Ms(P,"deviceClass",M.deviceClass,aa)}},h[kJ]=function(A,S){var M=h.internal;if(M){var P=hf(A,FT);Ms(P,Uu.internalAgentVersion,M.agentVersion,aa),Ms(P,Uu.internalSdkVersion,M.sdkVersion,aa),(A.baseType===pA.dataType||A.baseType===Jx.dataType)&&(Ms(P,Uu.internalSnippet,M.snippetVer,aa),Ms(P,Uu.internalSdkSrc,M.sdkSrc,aa))}},h[_J]=function(A,S){var M=n.location;M&&Ms(hf(A,FT,[]),Uu.locationIp,M.ip,aa)},h[bJ]=function(A,S){var M=h[HB];if(M){var P=hf(hf(A,MT),Og.TraceExt,{traceID:void 0,parentID:void 0});Ms(P,"traceID",M.traceID,aa,_i),Ms(P,"name",M.name,aa,_i),Ms(P,"parentID",M.parentID,aa,_i)}},h.applyWebContext=function(A,S){var M=n.web;M&&Ms(hf(A,MT),Og.WebExt,M)},h[xJ]=function(A,S){var M=h.user;if(M){var P=hf(A,FT,[]);Ms(P,Uu.userAccountId,M[Dx],aa);var L=hf(hf(A,MT),Og.UserExt);Ms(L,"id",M.id,aa),Ms(L,"authId",M[fk],aa)}},h.cleanUp=function(A,S){var M=A.ext;M&&(ik(M,Og.DeviceExt),ik(M,Og.UserExt),ik(M,Og.WebExt),ik(M,Og.OSExt),ik(M,Og.AppExt),ik(M,Og.TraceExt))}})}return c.__ieDyn=1,c}(),ywe=function(c){Sb(o,c);function o(){var a=c.call(this)||this;a.priority=110,a.identifier=k4;var i,n,s;return Wu(o,a,function(h,v){g(),h.initialize=function(S,M,P,L){v.initialize(S,M,P,L),O(S)},h.processTelemetry=function(S,M){if(!_i(S)){M=h._getTelCtx(M),S.name===Jx.envelopeType&&M.diagLog().resetInternalMessageCount();var P=h.context||{};P.session&&typeof h.context.session.id!="string"&&P[s4]&&P[s4][u4]();var L=P.user;if(L&&!L[sN]&&L[u4](P.user.id),A(S,M),L&&L[c4]){L[c4]=!1;var V=new pA(72,(Ab()||{}).userAgent||"");I1e(M.diagLog(),1,V)}h.processNext(S,M)}},h._doTeardown=function(S,M){var P=(S||{}).core();if(P&&P[m6]){var L=P[m6](!1);L===n&&P.setTraceCtx(s)}g()};function g(){i=null,n=null,s=null}function O(S){var M=h.identifier,P=h.core,L=p1(null,S,P),V=o.getDefaultConfig();i=i||{},ac(V,function(N,ee){i[N]=function(){return L.getConfig(M,N,ee())}}),s=P[m6](!1),h.context=new vwe(P,i,s),n=ZP(h.context[HB],s),P.setTraceCtx(n),h.context.appId=function(){var N=P.getPlugin(YX);return N?N.plugin._appId:null},h._extConfig=i}function A(S,M){hf(S,"tags",[]),hf(S,"ext",{});var P=h.context;P[gJ](S,M),P[vJ](S,M),P[yJ](S,M),P[bJ](S,M),P[xJ](S,M),P[wJ](S,M),P.applyWebContext(S,M),P[_J](S,M),P[kJ](S,M),P.cleanUp(S,M)}}),a}return o.getDefaultConfig=function(){var a,i,n=null,s=(a={instrumentationKey:function(){return i}},a[Dx]=function(){return n},a.sessionRenewalMs=function(){return 30*60*1e3},a.samplingPercentage=function(){return 100},a.sessionExpirationMs=function(){return 24*60*60*1e3},a[qB]=function(){return n},a[uN]=function(){return n},a.isBrowserLinkTrackingEnabled=function(){return!1},a.appId=function(){return n},a[cN]=function(){return n},a[M2]=function(){return i},a[lN]=function(){return i},a[fN]=function(){return i},a[wA]=function(){return 22},a[_A]=function(){return n},a);return s},o}(TA);const bwe=ywe;var CJ="AuthenticatedUserContext",iE="track",GB="snippet",xwe="getCookieMgr",wwe="startTrackPage",_we="stopTrackPage",v6="flush",kwe="startTrackEvent",Ewe="stopTrackEvent",Cwe="addTelemetryInitializer",dK="pollInternalLogs",y6="getPlugin",b6="evtNamespace",Swe=iE+"Event",Awe=iE+"Trace",Owe=iE+"Metric",Dwe=iE+"PageView",Twe=iE+"Exception",Nwe=iE+"DependencyData",Iwe="set"+CJ,Mwe="clear"+CJ,Fwe="updateSnippetDefinitions",Rwe="loadAppInsights",hK="endpointUrl",RT="diagnosticLogInterval",Bwe="disableFlushOnBeforeUnload",Pwe="disableFlushOnUnload",kx="config",Nv="context",BT="push",x6="version",f2="queue",w6="connectionString",pK="instrumentationKey",PT="appInsights",mK="disableIkeyDeprecationMessage",gK="getTransmissionControls",pS="onunloadFlush",vK="addHousekeepingBeforeUnload",jT="indexOf",KB,yK=[GB,"depen
9098dencies","properties","_snippetVersion","appInsightsNew","getSKUDefaults"],jwe=function(){function c(o){var a=this,i,n,s,h,v,g,O;Wu(c,this,function(A){ee(),h=""+(o.sv||o[x6]||""),o[f2]=o[f2]||[],o[x6]=o[x6]||2;var S=o[kx]||{};if(S[w6]){var M=Gbe(S[w6]),P=M.ingestionendpoint;S[hK]=P?P+KS:S[hK],S[pK]=M.instrumentationkey||S[pK]}A[PT]=new yxe,n=new bwe,i=new swe,s=new zxe,O=new Ebe,A.core=O;var L=_i(S[mK])?!0:S[mK];!S[w6]&&!L&&Ni(O.logger,1,106,"Instrumentation key support will end soon, see aka.ms/IkeyMigrate"),A[GB]=o,A[kx]=S,V(),A[v6]=function(J){J===void 0&&(J=!0),$N(O,function(){return"AISKU.flush"},function(){Po(O[gK](),function(K){Po(K,function(re){re[v6](J)})})},null,J)},A[pS]=function(J){J===void 0&&(J=!0),Po(O[gK](),function(K){Po(K,function(re){re[pS]?re[pS]():re[v6](J)})})},A[Rwe]=function(J,K,re){J===void 0&&(J=!1);function ce(pe){if(pe){var ke="";_i(h)||(ke+=h),J&&(ke+=".lg"),A[Nv]&&A[Nv].internal&&(A[Nv].internal.snippetVer=ke||"-"),ac(A,function(Ce,be){aa(Ce)&&!Ba(be)&&Ce&&Ce[0]!=="_"&&Bv(yK,Ce)===-1&&(pe[Ce]=be)})}}return J&&A[kx].extensions&&A[kx].extensions.length>0&&up("Extensions not allowed in legacy mode"),$N(A.core,function(){return"AISKU.loadAppInsights"},function(){var pe=[];pe[BT](s),pe[BT](n),pe[BT](i),pe[BT](A[PT]),O.initialize(A[kx],pe,K,re),A[Nv]=n[Nv],KB&&A[Nv]&&(A[Nv].internal.sdkSrc=KB),ce(A[GB]),A.emptyQueue(),A[dK](),A[vK](a)}),A},A[Fwe]=function(J){s1e(J,A,function(K){return K&&Bv(yK,K)===-1})},A.emptyQueue=function(){try{if(mu(A.snippet[f2])){for(var J=A.snippet[f2].length,K=0;K<J;K++){var re=A.snippet[f2][K];re()}A.snippet[f2]=void 0,delete A.snippet[f2]}}catch(pe){var ce={};pe&&Ba(pe.toString)&&(ce.exception=pe.toString())}},A[vK]=function(J){if(AA()||pX()){var K=function(){if(J[pS](!1),Ba(a.core[y6])){var pe=a.core[y6](k4);if(pe){var ke=pe.plugin;ke&&ke[Nv]&&ke[Nv]._sessionManager&&ke[Nv]._sessionManager.backup()}}},re=!1,ce=J.appInsights[kx].disablePageUnloadEvents;g||(g=V2(v,O[b6]&&O[b6]())),J.appInsights.config[Bwe]||(rbe(K,ce,g)&&(re=!0),fB(K,ce,g)&&(re=!0),!re&&!C1e()&&Ni(J[PT].core.logger,1,19,"Could not add handler for beforeunload and pagehide")),!re&&!J.appInsights.config[Pwe]&&fB(K,ce,g)}},A.getSender=function(){return s},A.unload=function(J,K,re){A[pS](J),g&&(ibe(null,g),obe(null,g)),O.unload&&O.unload(J,K,re)},_S(A,A[PT],[xwe,Swe,Dwe,"trackPageViewPerformance",Twe,"_onerror",Awe,Owe,wwe,_we,kwe,Ewe]),_S(A,N,[Nwe,"addDependencyListener","addDependencyInitializer"]),_S(A,O,[Cwe,dK,"stopPollingInternalLogs",y6,"addPlugin",b6,"addUnloadCb","getTraceCtx"]),_S(A,function(){var J=n[Nv];return J?J.user:null},[Iwe,Mwe]);function V(){A.config[RT]=A.config[RT]&&A[kx][RT]>0?A[kx][RT]:1e4}function N(){return i}function ee(){v=Ob("AISKU"),g=null,i=null,n=null,s=null,h=null}})}return c.prototype.addDependencyInitializer=function(o){return null},c}();(function(){var c=null,o=!1,a=["://js.monitor.azure.com/","://az416426.vo.msecnd.net/"];try{var i=(document||{}).currentScript;
9098i&&(c=i.src)}catch{}if(c)try{var n=c.toLowerCase();if(n){for(var s="",h=0;h<a.length;h++)if(n[jT](a[h])!==-1){s="cdn"+(h+1),n[jT]("/scripts/")===-1&&(n[jT]("/next/")!==-1?s+="-next":n[jT]("/beta/")!==-1&&(s+="-beta")),KB=s+(o?".mod":"");break}}}catch{}})();const SJ=()=>{Rv.getComplianceChoices().analytics&&(bK.loadAppInsights(),bK.trackPageView())},bK=new jwe({config:{connectionString:"InstrumentationKey=a475fa05-ab5e-4a01-82a0-0a1b58af45da;IngestionEndpoint=https://northeurope-2.in.applicationinsights.azure.com/;LiveEndpoint=https://northeurope.livediagnostics.monitor.azure.com/"}});SJ();document.addEventListener("complianceCookieChange",SJ);new Nye({target:document.body});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.